getChannels

abstract fun getChannels(className: String? = null, classVersion: Int? = null, classLevel: PNDataSyncClassLevel? = null, filterFast: String? = null, filter: String? = null, sort: List<PNDataSyncSortField> = emptyList(), limit: Int? = null, cursor: String? = null): GetChannels

List DataSync channels.

Results are scoped to the caller's access token: only channels the token is permitted to read (get) are returned. Channels the token cannot read are silently omitted — the call does not error and does not return a 403 for the un-readable channels. This token scoping is applied before filterFast / filter / sort. When the PubNub instance is configured with a secretKey (a trusted server-side deployment, never a client — the secretKey must not be shipped to clients), or when using a token whose grants cover the whole result set, no permission-based filtering is applied and all matching channels are returned, subject only to filterFast / filter / sort and limit paging.

Parameters

className

Optional entity class identifier. When null the whole Channel family is returned; when set it narrows the results to that Channel subclass.

classVersion

Restricts results to a single version of the entity class (and its subclasses). If null, items of every version are returned, while filterFast, filter and sort fields are checked against the latest version. Pass a version to make results stable when new class versions are published.

classLevel

Optional level at which the entity class is defined. The built-in Channel class is defined at the GLOBAL level.

filterFast

Optional filter expression. Filtering is only allowed on properties the entity class marks as filterable; filtering on any other property returns a server error. Each property declares a filtering mode — none, simple, or full — and the mode is cumulative: a simple property is usable with filterFast (and sort on the filterFast path); a full property is usable with both filterFast and filter; a none property is not filterable at all. So a simple property works here but is rejected by filter. For the default Channel class this set is name and type, but a custom class or subclass may declare additional filterable properties. These are filterable indexes over /payload/name and /payload/type — both nullable, not a required or exclusive payload schema; the payload stays arbitrary JSON. In addition, the built-in fields id, createdAt, updatedAt, and status (case-sensitive, exactly as spelled) behave as full and are always filterable and sortable on any class, on both the filterFast and filter paths, regardless of its declared properties. filterFast is strongly consistent — it always reflects the latest writes — but accepts fewer conditions than filter; a limit on the number of conditions applies and can be adjusted by PubNub support (see the PubNub DataSync documentation for the current limit). For larger or more complex queries use filter. At most one of filterFast and filter may be supplied; sending both is rejected by the server (HTTP 400).

filter

Optional advanced filter expression. Uses the same syntax as filterFast, but only properties whose filtering mode is full (plus the built-in fields) are usable here — a simple property that works with filterFast is rejected by filter. It is not subject to the same condition limit, so use it for larger or more complex queries. The trade-off is consistency: filter is eventually consistent (recent writes may not yet be reflected), whereas filterFast is strongly consistent. At most one of filterFast and filter may be supplied; sending both is rejected by the server (HTTP 400).

sort

Optional sort criteria applied in order; each PNDataSyncSortField sorts on a payload property either ascending (default) or descending. Sorting is governed by the same filtering-mode gate as filtering: a simple property is sortable on the strongly-consistent path (filterFast, or a sort-only / cursor request with neither filter); a full property is sortable on that path and on the filter path. The built-in fields id, createdAt, updatedAt, and status are always sortable (default Channel class filterable/sortable properties: name and type).

limit

Optional page size, 1–100 (server default 20). A value outside that range is rejected by the server (HTTP 400), not clamped.

cursor

Optional opaque cursor for pagination (from a previous result's next.cursor).