diff options
Diffstat (limited to '')
| -rw-r--r-- | eg/api.pl | 10 | ||||
| -rw-r--r-- | eg/github.json | 31 | ||||
| -rw-r--r-- | eg/github.yaml | 19 | ||||
| -rw-r--r-- | eg/twitter.json | 27 | ||||
| -rw-r--r-- | eg/twitter.yaml | 19 |
5 files changed, 106 insertions, 0 deletions
diff --git a/eg/api.pl b/eg/api.pl new file mode 100644 index 0000000..d5e8a61 --- /dev/null +++ b/eg/api.pl @@ -0,0 +1,10 @@ +use strict; +use warnings; +use 5.010; + +use Net::HTTP::API::Spec; + +my $api = Net::HTTP::API::Spec->load_from_spec(shift); +my $res = $api->user_information(format => 'json', username => 'franckcuny'); + +use YAML::Syck; warn Dump $res; diff --git a/eg/github.json b/eg/github.json new file mode 100644 index 0000000..52513d1 --- /dev/null +++ b/eg/github.json @@ -0,0 +1,31 @@ +{ + "declare" : { + "api_base_url" : "http://github.com/api/v2/", + "api_format_mode" : "content-type", + "api_format" : "json" + }, + "methods" : { + "user_information" : { + "params" : [ + "username", + "format" + ], + "required" : [ + "username", + "format" + ], + "path" : "/:format/user/show/:username", + "method" : "GET" + }, + "user_following" : { + "params" : [ + "user" + ], + "required" : [ + "user" + ], + "path" : "/user/show/:user/followers", + "method" : "GET" + } + } +} diff --git a/eg/github.yaml b/eg/github.yaml new file mode 100644 index 0000000..c28e370 --- /dev/null +++ b/eg/github.yaml @@ -0,0 +1,19 @@ +declare: + api_base_url: http://github.com/api/v2/ + api_format: JSON + api_format_mode: content-type +methods: + user_information: + method: GET + path: /user/show/:username + params: + - username + required: + - username + user_following: + method: GET + path: /user/show/:user/followers + params: + - user + required: + - user diff --git a/eg/twitter.json b/eg/twitter.json new file mode 100644 index 0000000..f07470e --- /dev/null +++ b/eg/twitter.json @@ -0,0 +1,27 @@ +{ + "declare" : { + "api_base_url" : "http://api.twitter.com/1", + "api_format_mode" : "append", + "api_format" : "json" + }, + "methods" : { + "public_timeline" : { + "params" : [ + "skip_user" + ], + "path" : "/statuses/public_timeline", + "method" : "GET" + }, + "home_timeline" : { + "params" : [ + "since_id", + "max_id", + "count", + "page", + "skip_user" + ], + "path" : "/statuses/home_timeline", + "method" : "GET" + } + } +} diff --git a/eg/twitter.yaml b/eg/twitter.yaml new file mode 100644 index 0000000..92054b7 --- /dev/null +++ b/eg/twitter.yaml @@ -0,0 +1,19 @@ +declare: + api_base_url: http://api.twitter.com/1 + api_format: json + api_format_mode: append +methods: + public_timeline: + method: GET + path: /statuses/public_timeline + params: + - skip_user + home_timeline: + method: GET + path: /statuses/home_timeline + params: + - since_id + - max_id + - count + - page + - skip_user |
