Bladeren bron

Now working with sessions

master
Pete Shadbolt 7 jaren geleden
bovenliggende
commit
b9accbc7ac
1 gewijzigde bestanden met toevoegingen van 24 en 10 verwijderingen
  1. +24
    -10
      templates/doc.md

+ 24
- 10
templates/doc.md Bestand weergeven

@@ -8,21 +8,39 @@ This server does a few things:
- Displays a 3D representation of the state
- Randomly updates the state every five seconds

## Endpoints
## Using the interface
Sessions are identified by a UUID such as `oranges-arkansas-mexico-fish`. You can share this URL with other people to share your screen and edit collaboratively.

- `/`: Displays the state using Three.js
- `graph/`:
- Click on the grid to make a new node
- Ctrl-click a node to act a Hadamard gate
- Select a node, then shift-click another node to act a CZ gate
- Press space to rotate the grid

## Python package
The underlying graph state simulator is based on Anders' and Briegel's method. Full docs for the Python package are [here](https://peteshadbolt.co.uk/static/abp/).


## API

We expose an API so that you can programmatically read and write states to/from the server and simulate mouse clicks.

### Endpoints

- `/<uuid>`: Displays the state using Three.js
- `/<uuid>/graph`:
- `GET` returns JSON representing the state
- `POST` accepts JSON in the same format and overwrites the state in memory
- `/<uuid>/edit`:
- `POST` accepts edit commands such as `cz`, `add_node` etc.
- `doc/`: Shows this page


## Data format
### Data format

If you do an HTTPS GET against `/graph`, you will receive some JSON.
If you do an HTTPS GET against `/<uuid>/graph`, you will receive some JSON.

:::bash
$ curl https://abv.peteshadbolt.co.uk/graph
$ curl https://abv.peteshadbolt.co.uk/<uuid>/graph

outputs

@@ -56,7 +74,3 @@ Here's an example of a graph `(A-B C)`:
1: {'position': {'x': 1, 'y': 0, 'z': 0}, 'vop': 0},
2: {'position': {'x': 2, 'y': 0, 'z': 0}, 'vop': 10}}}

## ABP

The underlying graph library is based on Anders' and Briegel's method. Full docs for the Python library are [here](https://peteshadbolt.co.uk/static/abp/).


Laden…
Annuleren
Opslaan