createChannel

abstract fun createChannel(classVersion: Int, channelId: String? = null, className: String? = null, classLevel: PNDataSyncClassLevel? = null, status: String? = null, payload: Any? = null): CreateChannel

Create a DataSync channel.

Parameters

classVersion

Version of the entity class.

channelId

Optional channel identifier. When null the server generates one.

className

Optional entity class identifier. When null the server defaults it to Channel. When set it must be a Channel subclass.

classLevel

Optional level at which the entity class is defined. Disambiguates a class defined at more than one level. Create-only — not accepted by setChannel. The built-in Channel class is defined at the GLOBAL level.

status

Optional channel status.

payload

Optional arbitrary JSON object payload. The payload is free-form, but the default Channel class indexes the name and type properties: populating them here makes the channel filterable and sortable on name / type in getChannels. Any other payload property is stored but not queryable unless a custom class or Channel subclass declares it filterable (a subclass inherits the name / type indexes and may add its own). The built-in fields id, createdAt, updatedAt, and status are always filterable/sortable regardless of payload.