Appearance
traits/publication.proto
Table of Contents
traits/publication.proto
AcknowledgePublicationRequest
Field | Type | Label | Description |
---|---|---|---|
name | string | The name of the device | |
id | string | The ID of the publication to acknowledge. Required. | |
version | string | The version of the publication to acknowledge. Required. | |
receipt | Publication.Audience.Receipt | One of ACCEPTED or REJECTED. Optional, ACCEPTED is used if not present | |
receipt_rejected_reason | string | If receipt is REJECTED, supply a reason that may be shown to an operator to help troubleshoot issues. | |
allow_acknowledged | bool | If true, acknowledging a publication more than once will not result in an error response status and the publication will not change. |
CreatePublicationRequest
Field | Type | Label | Description |
---|---|---|---|
name | string | The name of the device | |
publication | Publication | The publication data to seed |
DeletePublicationRequest
Field | Type | Label | Description |
---|---|---|---|
name | string | The name of the device | |
id | string | The publication id. | |
version | string | If present, the delete will fail if the version on the server does not match this version. Populate with the latest known version on the client to avoid concurrent updates overriding each other transparently. | |
allow_missing | bool | If set to true, and no publication with the given id exists, the request will succeed but no action will be taken. |
GetPublicationRequest
Field | Type | Label | Description |
---|---|---|---|
name | string | The name of the device | |
id | string | The id of the publication to retrieve | |
read_mask | google.protobuf.FieldMask | Fields to fetch relative to the Publication type | |
version | string | The version to retrieve. Optional, if absent the latest version will be retrieved. |
ListPublicationsRequest
Field | Type | Label | Description |
---|---|---|---|
name | string | The name of the device | |
read_mask | google.protobuf.FieldMask | Fields to fetch relative to the Publication type | |
page_size | int32 | The maximum number of items to return. The service may return fewer than this value. If unspecified, at most 50 items will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. | |
page_token | string | A page token, received from a previous ListPublicationsResponse call. Provide this to retrieve the subsequent page. |
todo: enable filtering Filter allows for customisation of the items returned by this request. See https://google.aip.dev/160 for details. Individual devices should document if and how filter is supported by that device. string filter = 5; |
ListPublicationsResponse
Field | Type | Label | Description |
---|---|---|---|
publications | Publication | repeated | |
next_page_token | string | A token, which can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages. | |
total_size | int32 | If non-zero this is the total number of consumables. This may be an estimate. |
Publication
Publication describes some data that can be published. While the content of the data is undefined, the metadata about data is described. A publication can be intended for a specific audience, either a device or some other concept. The audience for a publication is able to acknowledge that publication, indicating they have received it.
Field | Type | Label | Description |
---|---|---|---|
id | string | An identifier for this publication. Will be unique within the context of the device managing the publications. The ID does not change between publication versions. | |
version | string | An opaque string used to distinguish between versions of the same publication. Output only. | |
body | bytes | The body of this publication. Can be any sequence of bytes from plain text, to binary content, to a serialised proto message. It can also be empty. |
todo: decide on a limit for the size of data, or document that it doesn't need one | | audience | Publication.Audience | | An indication of who the publication is targeting. Optional. For example, if the publication represents configuration for a device, the audience would represent that device. | | publish_time | google.protobuf.Timestamp | | The time this version of the publication was published. Output only. | | media_type | string | | An indication of format of the data in body. Optional. The use of a Media Type is recommended, but any value recognised by both the server and client is acceptable. |
Publication.Audience
Audience describes who a publication is targeting. A publication audience is typically used when one device is responsible for managing the state of another device, for example holding configuration data. In this case DeviceA creates device configuration for DeviceB, DeviceB is the audience for that configuration publication. When a publication has an audience, it is useful to know when that third-party has received the publication, this is modelled as a receipt.
Field | Type | Label | Description |
---|---|---|---|
name | string | The name of the device that is the audience for the publication. | |
receipt | Publication.Audience.Receipt | An indication of whether the audience has received this publication. | |
receipt_rejected_reason | string | A reason for a rejection of the publication by the audience. | |
receipt_time | google.protobuf.Timestamp | A timestamp indicating when the audience acknowledged the publication. Output only. Populated using the servers time when AcknowledgePublication is called by the audience. |
PullPublicationRequest
Field | Type | Label | Description |
---|---|---|---|
name | string | The name of the device | |
id | string | The id of the publication to retrieve | |
read_mask | google.protobuf.FieldMask | Fields to fetch relative to the Publication type | |
updates_only | bool | When true the device will only send changes to the resource value. The default behaviour is to send the current value immediately followed by any updates as they happen. |
PullPublicationResponse
Field | Type | Label | Description |
---|---|---|---|
changes | PullPublicationResponse.Change | repeated | Changes since the last message. |
PullPublicationResponse.Change
Field | Type | Label | Description |
---|---|---|---|
name | string | Name of the device that issued the change. | |
change_time | google.protobuf.Timestamp | When the change occurred | |
publication | Publication | The new value for the publication. |
PullPublicationsRequest
Field | Type | Label | Description |
---|---|---|---|
name | string | The name of the device | |
read_mask | google.protobuf.FieldMask | Fields to fetch relative to the Publication type | |
updates_only | bool | When true the device will only send changes to the resource value. The default behaviour is to send the current value immediately followed by any updates as they happen. |
todo: enable filtering Filter allows for customisation of the items returned by this request. See https://google.aip.dev/160 for details. Individual devices should document if and how filter is supported by that device. string filter = 4; |
PullPublicationsResponse
Field | Type | Label | Description |
---|---|---|---|
changes | PullPublicationsResponse.Change | repeated | The list of changes which have occurred |
PullPublicationsResponse.Change
Field | Type | Label | Description |
---|---|---|---|
name | string | The name of the device that emitted this change | |
type | smartcore.types.ChangeType | The type of change (e.g. ADD, UPDATE, etc...) | |
new_value | Publication | The new value to use for ADD | |
old_value | Publication | The old value to use for UPDATE | |
change_time | google.protobuf.Timestamp | When the change occurred |
UpdatePublicationRequest
Field | Type | Label | Description |
---|---|---|---|
name | string | The name of the device | |
publication | Publication | The publication to update. | |
update_mask | google.protobuf.FieldMask | Fields to update relative to the Publication type | |
version | string | If present, the update will fail if the version on the server does not match this version. Populate with the latest known version on the client to avoid concurrent updates overriding each other transparently. |
Publication.Audience.Receipt
Receipt defines the possible acceptance states for downstream audiences of this publication.
Name | Number | Description |
---|---|---|
RECEIPT_UNSPECIFIED | 0 | |
NO_SIGNAL | 1 | |
ACCEPTED | 2 | |
REJECTED | 3 |
PublicationApi
The PublicationApi describes the capabilities of a device to manage and publish content. This could be used by a central device to publish configuration updates for other devices to receive. The primary resource of this trait is a collection of Publications. Publication comprises of some binary data and metadata surrounding the versioning and publication of that data.
Method Name | Request Type | Response Type | Description |
---|---|---|---|
CreatePublication | CreatePublicationRequest | Publication | Create a new publication. The returned Publication will include an id unique for this new publication within the named device. Note that if you want to create a new version for an existing publication, use UpdatePublication. |
GetPublication | GetPublicationRequest | Publication | Get the contents and metadata for a publication identified by id. If version is not provided, this returns the newest version. |
UpdatePublication | UpdatePublicationRequest | Publication | Update a publication by id. The updated Publication will have a new version, publish time, and reset receipt properties. If the request has a version then the device will compare it with its known version and fail to update if they differ enabling multiple concurrent uses of this API. |
DeletePublication | DeletePublicationRequest | Publication | Delete a publication by id. If the request has a version then the device will compare it with its known version and fail to delete if they differ enabling multiple concurrent uses of this API. |
PullPublication | PullPublicationRequest | PullPublicationResponse stream | Subscribe to changes for a single publication. The stream is closed if the publication is deleted. |
ListPublications | ListPublicationsRequest | ListPublicationsResponse | List all publications available on the device. The version returned for each publication will be the latest. |
PullPublications | PullPublicationsRequest | PullPublicationsResponse stream | Subscribe to changes in publications on the device. |
AcknowledgePublication | AcknowledgePublicationRequest | Publication | Acknowledge the receipt of a publication. This API should only be called when the audience for a publication has received that publication. Typically the audience will call this method itself after a get or pull publication method returns a new version. |