Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ The data will automatically be sent to the user via Pusher.

#### WRITE Response Errors
When there is an error on a WRITE response (`jsonCode!==200`), the error must come back to the client on the HTTPS response. The error is only relevant to the client that made the request and it wouldn't make sense to send it out to all connected clients.

Error messages should be returned and stored as a String under the `error` property. If absolutely needed, additional error properties can be stored under other, more specific fields that sit at the same level as `error`:
```php
[
'onyxMethod' => Onyx::METHOD_MERGE,
'key' => OnyxKeys::WALLET_ADDITIONAL_DETAILS,
'value' => [
'error' => 'We\'re having trouble verifying your SSN. Please enter the full 9 digits of your SSN.',
'errorCode' => 'ssnError'
],
]
```

### Hybrid READ/WRITE Responses
There are some commands which might technically be a READ and a WRITE.

Expand All @@ -68,4 +81,4 @@ For example: Accessing the data for a chat report will return the data if the re

### How should we remove local data from the store if the data no longer exist in the server? eg. local policy data for policies the user is no longer a member of.

Use `Onyx.set(key, null)` for each data (eg. policy) not found in the server.
Use `Onyx.set(key, null)` for each data (eg. policy) not found in the server.