-
-
Save nyurik/ab3138ecaeb01e058300 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/{module:graphoid}: | |
x-modules: | |
- name: simple_service | |
version: 1.0.0 | |
type: file | |
options: | |
paths: | |
# Do we need those parameters?? | |
/v1/png: | |
post: | |
on_setup: | |
- setup_post_storage: | |
method: put | |
uri: /{domain}/sys/key_value/graphoid.post | |
- setup_png_storage: | |
method: put | |
uri: /{domain}/sys/key_value/graphoid.png | |
on_request: | |
# Don't know how to make posts to graphoid correctly and which data to post there | |
# -- Graphoid service needs the domain, format (png/svg), and the json blob. It will return a PNG/SVG | |
- graphoid_request: | |
request: | |
# post or put? what's the difference here | |
method: post | |
uri: http://graphoid.wikimedia.org/{domain}/v1/png | |
body: '{$.request.body}' | |
# Should there be a '-' here? | |
save_post_request: | |
request: | |
method: put | |
# TODO URI substitution like this is not supported!! | |
uri: /{domain}/sys/key_value/graphoid.post/{$.request.hash} | |
body: '{$.request}' | |
- store_result: | |
request: | |
method: put | |
# TODO URI substitution like this is not supported!! | |
uri: /{domain}/sys/key_value/graphoid.png/{$.request.hash} | |
body: '{$.graphoid_request.body}' | |
- return_result: | |
return: | |
status: '{$.graphoid_request.status}' | |
headers: | |
# Which header are we going to use? | |
location-hash: '$.request.hash' | |
body: '{$.graphoid_request.body}' | |
/v1/png/{hash}: | |
get: | |
on_request: | |
- get_from_storage: | |
request: | |
uri: /{domain}/sys/key_value/graphoid.png/{hash} | |
return_if: | |
status: 200 | |
catch: | |
status: 404 | |
- load_post: | |
request: | |
uri: /{domain}/sys/key_value/graphoid.post/{hash} | |
- request_again: | |
request: | |
method: post | |
uri: /v1/png: | |
headers: '{$.load_post.headers}' | |
body: '{$.load_post.body}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
line 23 - now idea, it's a request to graphoid, I don't know what does it require
line 27 - absence of '-' represents parallel request - we can go to graphed and save post request concurrently