-
Notifications
You must be signed in to change notification settings - Fork 46
feat: Update the LiveObjects Rest Documentation #2884
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
base: main
Are you sure you want to change the base?
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @mschristensen Do you mind having a look at OpenAPI specification for the new endpoints. One thing I wanted to get your thoughts on was the examples for I could write slightly different examples with different data just to make it more interesting to read. Also I have used the deprecated flag provided by the OpenAPI spec which strikes out the previous endpoints in the menu.
|
|
Hi @mschristensen, I have pushed up the usage docs changes as well |
| </Code> | ||
|
|
||
| This request is billed per object ID returned - each object ID counts as one billable message. | ||
| #### Get the entire object with metatdata <a id="fetching-object"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| #### Get the entire object with metatdata <a id="fetching-object"/> | |
| #### Get the entire object with metadata <a id="fetching-object"/> |
| `GET main.realtime.ably.net/channels/<channelName>/objects` | ||
|
|
||
| Fetch a flat list of objects on the channel: | ||
| The following request returns the entrie object tree. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The following request returns the entrie object tree. | |
| The following request returns the entire channel object. |
Note we should not refer to the "tree" any more, just the channel object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks I have removed all instances of "object tree"
| </Code> | ||
|
|
||
| The response includes the IDs of the objects on the channel: | ||
| This endpoint by default returns the compact representation of the object tree. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| This endpoint by default returns the compact representation of the object tree. | |
| This endpoint returns the compact representation of the object tree by default. |
| #### Including values <a id="fetching-objects-list-values"/> | ||
|
|
||
| To include values of the objects in the response, set the `values=true` query parameter: | ||
| By providing the `compact=false` query param the response will contain the full object representation including the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| By providing the `compact=false` query param the response will contain the full object representation including the | |
| You can optionally include additional object [metadata](/docs/liveobjects/concepts/objects#metadata) in the response by specifying the `compact=false` query option: |
| </Code> | ||
|
|
||
| #### Including metadata <a id="fetching-objects-list-metadata"/> | ||
| Both these requests are billed per object returned. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Both these requests are billed per object returned. | |
| Each instance of an [object type](/docs/liveobjects/concepts/objects#object-types) included is the response is counted as one billable message. |
I think this statement should also appear at the end of the "Get the entire object" section (so that a reader of that specific section has all the information they need, i.e. we do not hide information relating to one section in the content for other sections)
| -d '{ | ||
| "operation": "COUNTER_INC", | ||
| "path": "votes.up", | ||
| "path": "poll.votes.up", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have we added poll here? Do we need to update the text above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had changed the structure of the example app from
{
"votes": {
"up": 5,
"down": 10
}
}
to
{
"poll": {
"name": "First Poll"
"votes": {
"down": 10,
"up": 5,
}
}
}
I can't remember why I did this. I think I will revert the docs to reference the original structure.
| </Code> | ||
|
|
||
| When you create a new object it is important that the new object is assigned to the object tree so that it is [reachable](/docs/liveobjects/concepts/objects#reachability) from the root object. | ||
| When you create a new object it is important that the new object is assigned to the object tree so that it is [reachable](/docs/liveobjects/concepts/object#reachability) from the root object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you create a new object it is important that the new object instance is assigned to the channel object so that it is reachable.
| ``` | ||
| </Code> | ||
|
|
||
| Note in this example if the key `title` didn't exist it would have been created and set by this operation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this mentioned? This isn't a case of e.g. creating a counter object and assigning it to a key via a COUNTER_CREATE with a path field. This is a regular map set, so I'm not sure what this comment is for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your right its not needed. I think I was trying to convey that map sets are idempotent.
static/open-specs/liveobjects.yaml
Outdated
| schema: | ||
| type: string | ||
| example: "my-channel" | ||
| - name: compacted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The query argument is compact, not compacted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When looking into this I realised I can't reuse the original definitions of LiveMap and LiveCounter because they contain the MetaData. I have created a second version of these types so that we preserve the old ones for the deprecated API docs.
See in this fixup 30f0e02e1ae1b9737f5c7607b492abbe14ee1f5f which has the new types added.
30f0e02 to
401914e
Compare
Depricate all the current LiveObjects endpoints.
Add three new specification endpoints:
1. /channels/{channelId}/object POST: publish live objects operations
2. /channels/{channelId}/object GET : get an object
2. /channels/{channelId}/object/{objectId} GET : get an object by ID
The LiveObjects API usage docs have been updated to reference the new endpoints.
401914e to
6162fd0
Compare
| To include values of the objects in the response, set the `values=true` query parameter: | ||
| #### Get the entire object with metadata <a id="fetching-object"/> | ||
|
|
||
| You can optionally include additional object [metadata](/docs/liveobjects/concepts/objects#metadata) in the response by specifying the `compact=false` query option: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mschristensen I was just checking all the anchor tags work and realised that this metadata link shows information about Tomestones and Timeserials but we don't actually return any of these any more. The only metadata return now is the semantic type of a map and the object ID. Should I remove the Tomestones and Timeserials information from this page? https://ably.com/docs/liveobjects/concepts/objects#metadata


Description
This PR does the following:
Checklist