Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API cleaning #213

Open
nikhan opened this issue Dec 6, 2015 · 2 comments
Open

API cleaning #213

nikhan opened this issue Dec 6, 2015 · 2 comments
Assignees
Milestone

Comments

@nikhan
Copy link
Contributor

nikhan commented Dec 6, 2015

API

GET /pattern
Get JSON for all nodes.

POST /pattern
Import JSON without a parent group.
expects JSON body []CreateElement

GET /pattern?action=get&id=,,,
(recursive) Batch JSON export of nodes.

POST /pattern?action=reset&id=,,,
(recursive) Batch reset nodes.

POST /pattern?action=delete&id=,,,
(recursive) Batch delete nodes.

POST /pattern?action=ungroup&id=,,,
Batch ungroup nodes. Each group deleted and all child nodes are given to their grandparent.

POST /pattern?action=translate&x=<offset>&y=<offset>&id=,,,
Batch translate nodes by offset.

GET /pattern/{id}
Get JSON of id and all descendants of id.

POST /pattern/{id}
Import JSON with parent group of id.
expects JSON body []CreateElement

PUT /pattern/{id}
sets node root keys.
expects JSON body UpdateElement

GET /pattern/{id}/state
returns node state (if applicable)

PUT /pattern/{id}/state
sets node state (if applicable)
expects JSON body

PUT /pattern/{id}/routes/{route_id}
sets route state on a group (if applicable)
expects JSON body UpdateElement

websocket client

subscription

{
    "action": "subscribe"
    "id": string
}

websocket server

element creation

{
    "action":"create"
    "data": [ Element ]
}

element translation

{
    "action":"translate"
    "x": int
    "y": int
    "data": [ ID ]
}

elements deleted

{
    "action":"delete"
    "data": [ ID ]
}

elements update alias

{
    "action":"update_alias"
    "id": string
    "alias": string
}

elements update position

{
    "action":"update_position"
    "id": string
    "position":{
        "x":int
        "y":int
    }
}

element update group route alias

{
    "action":"update_alias"
    "id": string
    "alias": string
}

element update group route hidden

{
    "action":"update_alias"
    "id": string
    "hidden": bool
}

element status

{
    "action":"status"
    "id": string
    "code": int
}

pattern JSON

[ Element... ] 

where element order is leaf-first

@mikedewar
Copy link
Collaborator

I don't quite understand:

  • POST /pattern?action=get - method is POST, action is GET and it's an export? How is it different to GET /pattern ?
  • PUT /pattern/{id}/state - when would this be used?

@nikhan
Copy link
Contributor Author

nikhan commented Dec 7, 2015

you POST an array of IDs -- this is for circumstances where you export a series of blocks without a root parent. I was thinking about offloading the operation that generates the copy JSON to the server, such that when you hit ctrl-c, it does this api call to recursively retrieve all JSON of selected blocks that does not require a root.

the second is if you want a store to have a specific value. so i can post my weights to a store or whatever.

@mikedewar mikedewar modified the milestone: Release v0 Jan 6, 2016
@mikedewar mikedewar assigned alexislloyd and nikhan and unassigned alexislloyd Jan 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants