Skip to content

Commit

Permalink
materialization: Add message action and additional fields to features…
Browse files Browse the repository at this point in the history
… documentation

- Added @action@ enum field in the message structure, which specifies the type of the message action. It includes a series of predefined actions (CREATE, UPDATE, DELETE, etc.).
- Added additional fields `serial`, `refSerial`, `refType`, `updatedAt`, `deletedAt`, and `operation` to the Message data type.
- Update the Message class to reflect the new members.
  • Loading branch information
splindsay-92 committed Oct 10, 2024
1 parent bdcdec1 commit 32a69df
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions textile/features.textile
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,22 @@ h4. Message
** @(TM2e)@ @encoding@ string
** @(TM2i)@ @extras@ JSON-encodable object, used to contain any arbitrary key value pairs which may also contain other primitive JSON types, JSON-encodable objects or JSON-encodable arrays. The @extras@ field is provided to contain message metadata and/or ancillary payloads in support of specific functionality, e.g. push. Each of these supported extensions is documented separately; for 1.1 the only supported extension is @push@, via the @extras.push@ member; 1.2 adds the @delta@ extension whose keys and values are described by the attributes of the type @DeltaExtras@, and the @headers@ extension, which contains arbitrary @string->string@ key-value pairs, settable at publish time, and @ref@ whose keys and values are described by the attributes of the type @ReferenceExtras@. Unless otherwise specified, the client library should not attempt to do any filtering or validation of the @extras@ field itself, but should treat it opaquely, encoding it and passing it to realtime unaltered.
** @(TM2f)@ @timestamp@ time in milliseconds since epoch. If a message received from Ably does not contain a @timestamp@, it should be set to the @timestamp@ of the encapsulating @ProtocolMessage@
** @(TM2j)@ @action@ enum - the @MessageAction@ type of the message. Any message received from Ably must have an @action@ field set to one of the following values:
*** @(TM2j1)@ 0: @MESSAGE_UNSET@
*** @(TM2j2)@ 1: @MESSAGE_CREATE@
*** @(TM2j3)@ 2: @MESSAGE_UPDATE@
*** @(TM2j4)@ 3: @MESSAGE_DELETE@
*** @(TM2j5)@ 4: @MESSAGE_ANNOTATION_CREATE@
*** @(TM2j6)@ 5: @MESSAGE_ANNOTATION_DELETE@
** @(TM2K)@ @serial@ string - the serial of the message. This will be set to the @msgSerial@ of the @ProtocolMessage@ that encapsulates the message, with an additional offset that locates the message in the @ProtocolMessage@ messages array. If the message is received from Ably, this must be set.
** @(TM2L)@ @refSerial@ string - if this message is an annotation that references another message, this must be set to the @serial@ of the referenced message. If the @refSerial@ is set, the @refType@ must also be set.
** @(TM2M)@ @refType@ string - if the @refSerial@ is set, this must be set. If describes the type of the reference.
** @(TM2N)@ @updatedAt@ time in milliseconds since epoch. If a message received from Ably has the @action@ field set to "MESSAGE_UPDATE" then the @updatedAt@ field must be set to the time the message was updated.
** @(TM2O)@ @deletedAt@ time in milliseconds since epoch. If a message received from Ably has the @action@ field set to "MESSAGE_DELETE" then the @deleteAt@ field must be set to the time the message was deleted.
** @(TM2P)@ @operation@ operation is an JSON-encodable object that contains the following `optional` fields;
*** @(TM2P1)@ @clientId@ string - the clientId, if any, that the operation is associated with.
*** @(TM2P2)@ @description@ string - the description of the operation.
*** @(TM2P3)@ @metadata@ JSON-encodable object, used to contain any arbitrary key value pairs of type string.
* @(TM4)@ @Message@ has constructors @constructor(name: String?, data: Data?)@ and @constructor(name: String?, data: Data?, clientId: String?)@.
* @(TM3)@ @fromEncoded@ and @fromEncodedArray@ are alternative constructors that take an (already deserialized) @Message@-like object (or array of such objects), and optionally a @channelOptions@, and return a @Message@ (or array of such @Messages@) that's decoded and decrypted as specified in @RSL6@, using the cipher in the @channelOptions@ if the message is encrypted, with any residual transforms (ones that the library cannot decode or decrypt) left in the @encoding@ property per @RSL6b@. This is intended for users receiving messages other than from a REST or Realtime channel (for example, from a queue), to avoid them having to parse the @encoding@ string themselves.

Expand Down Expand Up @@ -2152,6 +2168,13 @@ class Message: // TM*
id: String // TM2a
name: String? // TM2g
timestamp: Time // TM2f
action: enum // TM2j
serial: string // RTN7b, TM2K
refSerial: string? // RTN7b, TM2L
refType: string? // TM2M
updatedAt: Time? // TM2N
deletedAt: Time? // TM2O
operation: JsonObject? // TM2P

class PresenceMessage // TP*
+fromEncoded(JsonObject, ChannelOptions?) -> PresenceMessage // TP4
Expand Down

0 comments on commit 32a69df

Please sign in to comment.