This repository has been archived by the owner on Apr 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Aliases
Yuri Schimke edited this page Jul 18, 2018
·
7 revisions
OkUrl support defining short aliases, and comes with some by default e.g.
- fbgraph -> https://graph.facebook.com{0}
- twitterapi -> https://api.twitter.com{0}
- uberapi -> https://api.uber.com{0}
The format for these files is generally
#!/usr/bin/env ./okapi
"https://api.twitter.com" + item
-
client (okhttp3.Client)
-
clientBuilder (okhttp3.Client.Builder)
-
requestBuilder (okhttp3.Request.Builder)
-
item (String argument from command line)
-
arguments (String[] in -m mode)
- String (URI)
- okhttp3.Request
- iterable of String/Request
with -m, your alias script will receive all arguments and can do option parsing or use 3 arguments to build a single request
#!/usr/bin/env okapi -m
"https://api.twitter.com/1.1/search/tweets.json?q=" + arguments[0] + "&count=" + arguments[1]
$ ./commands/tweetsearch test 1 | jq .statuses[].text
"RT @somebody: bio test tomorrow 🙃"