# Protocol


## Register

Client -> Server
```json
{
  "action": {
    "type": "Register"
  }
}
```

Server -> Client
```json
{
  "confirmAction": {
    "type": "Register",
    "clientId": "1"
  }
}
```


## GetLists

Client -> Server
```json
{
  "action": {
    "type": "GetLists"
  }
}
```

Server -> Client
```json
{
  "confirmAction": {
    "type": "GetLists",
    "lists": [
      {
        "listId": "1",
        "title": "foo"
      }
    ]
  }
}
```

# WS Protocol


## Register

Client -> Server
```json
{
  "action": {
    "type": "Register"
  }
}
```

Server -> Client
```json
{
  "confirmAction": {
    "type": "Register",
    "clientId": "1"
  }
}
```


## GetLists

Client -> Server
```json
{
  "action": {
    "type": "GetLists"
  }
}
```

Server -> Client
```json
{
  "confirmAction": {
    "type": "GetLists",
    "lists": [
      {
        "listId": "1",
        "title": "foo"
      }
    ]
  }
}
```

## CreateList

* TODO: What ids should the clients give lists before they're persisted?
  - UUIDs on the client, then DB ids after persisted

Client -> Server
```json
{
  "action": {
    "type": "CreateList",
    "title": "Foo bar list"
  }
}
```

Server -> Client
```json
{
  "confirmAction": {
    "type": "CreateList",
    "list": {
      "listId": "1",
      "title": "foo"
    }
  }
}
```

Add CreateList to WS Protocol file
Add CreateList to WS Protocol file
