Skip to content

Instantly share code, notes, and snippets.

@mnutt
Created April 13, 2009 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnutt/94597 to your computer and use it in GitHub Desktop.
Save mnutt/94597 to your computer and use it in GitHub Desktop.
== Bridge API ==
=== Requests ===
A bridge command is written in YAML, in the following format:
Request:
---
handler: library
action: show
options:
id: 1
Response:
---
handler: library
action: show
file:
sha1: 123456789ABCDEF
file_name: test.png
...
Request:
---
handler: library
action: list
options:
shared: true
limit: 30
Response:
---
handler: library
action: list
files:
- file:
sha1: 0123456789ABCDE
file_name: tree.png
- file:
sha1: 9874632ADCDF833
file_name: beach.png
...
Request:
---
handler: search
action: create
options:
query: "test"
Response:
---
handler: search
action: create
search:
query: "test"
guid: 8372379237432848324
Request:
---
handler: search
action: start
options:
guid: 02AC8E892BD83F8C832
Response:
---
handler: search
action: start
options:
guid: 02AC8E892BD83F8C832
status: ok
Request:
---
handler: search
action: begin_listen
options:
guid: 02AC8E892BD83F8C832
Response:
---
handler: search
action: results
options:
guid: 02AC8E892BD83F8C832
results:
- name: test launch
file_name: test.png
sha1: 2389240132489238498
---
handler: search
action: results
options:
guid: 02AC8E892BD83F8C832
results:
- name: testing
file_name: testing.png
sha1: 8293849238423942834
...
=== Handlers ===
Handlers respond to requests sent by the client. A dispatcher parses incoming requests, converts the YAML to objects, and calls the correct handler. The handler fulfills the request and returns a HashMap.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment