Group: GNU Social P2P/Design/Agent2RemoteCore

From LibrePlanet
Jump to: navigation, search

< Group:GNU Social P2P/Design

Core to Core

Remember that values are opaque to Cores.

HTTP REST

A simple binding over HTTP REST. All {} enclosed structures are JSON encoded.

$route = { uri: $destURI }

enqueue

Notify a remote of a new value at a certain path.

$path_keys = [ $path_key* ]

path_keys is an array of encrypted path keys that would enable the friend's Agent to decrypt the value. It starts with a path_key encrypted with the friend's public key.

POST '/send', {
 route: $route,
 body: recipient, {
   path: $path,
   path_keys: $path_keys,
   value: $value,
 }
}

result is:

{ success: true }

or

{ success: false, message: "why" }

get

Request the value at a certain path.

GET '/get', {
 route: $route,
 body: {
   friend_id: $friend_id,
   path: $path,
 }
}

result is:

{ success: true, value: $value, $path_keys }

or

{ success: false, message: "why" }

scan

Request the paths at a subtree:

GET '/scan', {
 route: $route,
 body: {
   friend_id: $friend_id,
   path: $path,
   end_path: $end_path,
   max: $max,
   order: $order,
 }
}

result is:

{ success: true, paths: [$path*], $path_keys }

or

{ success: false, message: "why" }