App Context API for Python-Asyncio SDK

App Context lets a PubNub client for Python-Asyncio store metadata about users and channels, and the memberships that link them, without running a database. The methods live on the PubNubAsyncio client, and the User ID parameter is named uuid.

This page describes App Context (formerly Objects v2). To upgrade from Objects v1, see the migration guide.

The methods fall into four groups:

A membership is the stored link between a user and a channel. A membership is not a subscription and delivers no messages. Membership methods start from a user and act on the channels that the user belongs to. Member methods start from a channel and act on its users. Both kinds change the same underlying membership.

PubNub publishes an App Context event when a set or delete call succeeds. See App Context events.

A builder sends its request when you await its future(). A request that fails, or fails validation, does not raise an exception. future() resolves with a PubNubAsyncioException whose result is None and whose status holds the error. Call is_error() on the awaited value before you read result.

Each keyword argument is also a builder method of the same name, except where a table says otherwise.

The builder methods include_custom(), include_status(), include_type(), include_total_count(), include_channel(), and include_uuid() are deprecated since 10.1.0 and issue a DeprecationWarning, but they still work. Use the keyword arguments of the same names on the user and channel metadata methods. On the membership and member methods, use the include parameter with MembershipIncludes or MemberIncludes instead. Keyword arguments with the same names are not deprecated.

The methods take channel and user ID strings, not SDK channel entities.

Get metadata for all users​

pubnub.get_all_uuid_metadata() returns a paginated list of the user metadata objects stored in App Context, through a PubNub client for Python-Asyncio. Each object holds the profile fields of a user and, on request, its custom data.

Required keyset configuration
To get all channel and user metadata, you must uncheck the Disallow Get All Channel Metadata and Disallow Get All User Metadata checkboxes in the App Context section of your keyset configuration in the Admin Portal.
include_total_count#
Type: bool
Default: False
Whether the result includes total_count, the number of user metadata objects that match the request. Without it, total_count is None.
include_custom#
Type: bool
Default: False
Whether each user metadata object in the response includes its custom object.
include_status#
Type: bool
Default: True
Whether each user metadata object in the response includes its status field.
include_type#
Type: bool
Default: True
Whether each user metadata object in the response includes its type field.
filter#
Type: str
Default: no default
The filter expression. The response includes only the user metadata objects that match it. See filtering.
sort_keys#
Type: List[PNSortKey]
Default: no default
The sort order of the result, as a list of PNSortKey objects. Build each one with PNSortKey.asc() or PNSortKey.desc() and a PNSortKeyValue of ID, NAME, or UPDATED. The builder method is sort(), and it takes the keys as separate arguments.
limit#
Type: int
Default: 100
The maximum number of user metadata objects to return in one response. The maximum value is 100.
page#
Type: PNPage
Default: no default
The page to return, as a Next or Previous object from pubnub.models.consumer.objects_v2.page. Pass the next or prev property of an earlier result, which already has that type. The keyword arguments of get_all_uuid_metadata() do not include page, so set it with the builder method page().

Returns​

get_all_uuid_metadata() resolves with an AsyncioEnvelope whose result is a PNGetAllUUIDMetadataResult and whose status is a PNStatus.

PNGetAllUUIDMetadataResult​

status#
Type: int
The HTTP status code of the response.
data#
Type: List[dict]
The user metadata objects on this page.
property of data: id#
Type: str
The ID of the user.
property of data: name#
Type: str
The display name of the user, or None when unset.
property of data: externalId#
Type: str
The ID in an external system of the user, or None when unset.
property of data: profileUrl#
Type: str
The URL of the profile picture of the user, or None when unset.
property of data: email#
Type: str
The email address of the user, or None when unset.
property of data: type#
Type: str
The type of the user, or None when unset. The result includes it unless include_type is False.
property of data: status#
Type: str
The status of the user, or None when unset. The result includes it unless include_status is False.
property of data: custom#
Type: dict
The custom data of the user. The key is present only when include_custom is True. The key holds None when the user has none.
property of data: updated#
Type: str
The date and time of the last update, in ISO 8601 format.
property of data: eTag#
Type: str
The version hash of the user metadata.
total_count#
Type: int
The number of user metadata objects that match the request, or None when include_total_count is not True.
next#
Type: Next
A Next object for the next page, or None when there is no next page.
prev#
Type: Previous
A Previous object for the previous page, or None when there is no previous page.

Syntax

1await pubnub.get_all_uuid_metadata(
2 include_total_count: bool,
3 include_custom: bool,
4 include_status: bool,
5 include_type: bool,
6 filter: str,
7 sort_keys: List[PNSortKey],
8 limit: int
9).future() -> AsyncioEnvelope

Get user metadata​

pubnub.get_uuid_metadata() returns the metadata of one user from App Context through a PubNub client for Python-Asyncio. The metadata holds the profile fields of the user and, on request, its custom data.

uuid#
Type: str
Default: no default
The ID of the user to get metadata for. When omitted, the SDK uses the user_id of the PubNub client. An empty string fails validation with the message uuid missing or not a string.
include_custom#
Type: bool
Default: False
Whether the response includes the custom object of the user.
include_status#
Type: bool
Default: True
Whether the result includes the status field of the user.
include_type#
Type: bool
Default: True
Whether the result includes the type field of the user.

Returns​

get_uuid_metadata() resolves with an AsyncioEnvelope whose result is a PNGetUUIDMetadataResult and whose status is a PNStatus.

PNGetUUIDMetadataResult​

status#
Type: int
The HTTP status code of the response.
data#
Type: dict
The user metadata object.
property of data: id#
Type: str
The ID of the user.
property of data: name#
Type: str
The display name of the user, or None when unset.
property of data: externalId#
Type: str
The ID in an external system of the user, or None when unset.
property of data: profileUrl#
Type: str
The URL of the profile picture of the user, or None when unset.
property of data: email#
Type: str
The email address of the user, or None when unset.
property of data: type#
Type: str
The type of the user, or None when unset. The result includes it unless include_type is False.
property of data: status#
Type: str
The status of the user, or None when unset. The result includes it unless include_status is False.
property of data: custom#
Type: dict
The custom data of the user. The key is present only when include_custom is True.
property of data: updated#
Type: str
The date and time of the last update, in ISO 8601 format.
property of data: eTag#
Type: str
The version hash of the user metadata.

Syntax

1await pubnub.get_uuid_metadata(
2 uuid: str,
3 include_custom: bool,
4 include_status: bool,
5 include_type: bool
6).future() -> AsyncioEnvelope

Set user metadata​

pubnub.set_uuid_metadata() sets the metadata of one user in App Context through a PubNub client for Python-Asyncio and returns the stored object. The call creates the metadata when the user has none yet.

uuid#
Type: str
Default: no default
The ID of the user to set metadata for. When omitted, the SDK uses the user_id of the PubNub client. An empty string fails validation with the message uuid missing or not a string.
name#
Type: str
Default: no default
The display name of the user. The builder method is set_name().
external_id#
Type: str
Default: no default
The ID of the user in an external system.
profile_url#
Type: str
Default: no default
The URL of the profile picture of the user.
email#
Type: str
Default: no default
The email address of the user.
type#
Type: str
Default: no default
The type of the user. The builder method is set_type().
status#
Type: str
Default: no default
The status of the user. The builder method is set_status().
custom#
Type: dict
Default: no default
The custom data of the user. A set call replaces the whole stored custom object. To add a key, get the metadata first, add the key, and set the complete object. Values can be strings, numbers, or booleans. The builder method custom() also sets include_custom to True, but the keyword argument custom does not.
include_custom#
Type: bool
Default: False
Whether the response includes the custom object of the user.
include_status#
Type: bool
Default: True
Whether the result includes the status field of the user.
include_type#
Type: bool
Default: True
Whether the result includes the type field of the user.
if_matches_etag#
Type: str
Default: no default
The eTag of the user metadata that you last read. The update applies only if the stored metadata still has this eTag. Otherwise PubNub rejects the update with HTTP status 412. Get the eTag from the response of get_uuid_metadata(). The keyword arguments do not include it, so set it with the builder method if_matches_etag(), available since 10.2.0.

The SDK sends name, external_id, email, and profile_url as null when you leave them out. Pass every field that you want to keep, because a set call without name clears the stored value.

API limits

To learn about the maximum length of parameters used to set user metadata, refer to REST API docs.

Returns​

set_uuid_metadata() resolves with an AsyncioEnvelope whose result is a PNSetUUIDMetadataResult and whose status is a PNStatus.Its data property holds the stored user metadata and has the same properties as the data property of the Get user metadata response.

PNSetUUIDMetadataResult​

status#
Type: int
The HTTP status code of the response.
data#
Type: dict
The stored user metadata object.

Syntax

1await pubnub.set_uuid_metadata(
2 uuid: str,
3 name: str,
4 external_id: str,
5 profile_url: str,
6 email: str,
7 type: str,
8 status: str,
9 custom: dict,
10 include_custom: bool,
11 include_status: bool,
12 include_type: bool
13).future() -> AsyncioEnvelope

Remove user metadata​

pubnub.remove_uuid_metadata() deletes the metadata of one user from App Context through a PubNub client for Python-Asyncio. Deleting the metadata deletes the memberships of the user only when the keyset enforces referential integrity.

uuid#
Type: str
Default: no default
The ID of the user to delete metadata for. When omitted, the SDK uses the user_id of the PubNub client. An empty string fails validation with the message uuid missing or not a string.

Returns​

remove_uuid_metadata() resolves with an AsyncioEnvelope whose result is a PNRemoveUUIDMetadataResult and whose status is a PNStatus.

PNRemoveUUIDMetadataResult​

status#
Type: int
The HTTP status code of the response.
data#
Type: None
Always None.

Syntax

1await pubnub.remove_uuid_metadata(
2 uuid: str
3).future() -> AsyncioEnvelope

Get metadata for all channels​

pubnub.get_all_channel_metadata() returns a paginated list of the channel metadata objects stored in App Context, through a PubNub client for Python-Asyncio. Each object holds the name and description of a channel and, on request, its custom data.

Required keyset configuration
To get all channel and user metadata, you must uncheck the Disallow Get All Channel Metadata and Disallow Get All User Metadata checkboxes in the App Context section of your keyset configuration in the Admin Portal.
include_total_count#
Type: bool
Default: False
Whether the result includes total_count, the number of channel metadata objects that match the request. Without it, total_count is None.
include_custom#
Type: bool
Default: False
Whether each channel metadata object in the response includes its custom object.
include_status#
Type: bool
Default: True
Whether each channel metadata object in the response includes its status field.
include_type#
Type: bool
Default: True
Whether each channel metadata object in the response includes its type field.
filter#
Type: str
Default: no default
The filter expression. The response includes only the channel metadata objects that match it. See filtering.
sort_keys#
Type: List[PNSortKey]
Default: no default
The sort order of the result, as a list of PNSortKey objects. Build each one with PNSortKey.asc() or PNSortKey.desc() and a PNSortKeyValue of ID, NAME, or UPDATED. The builder method is sort(), and it takes the keys as separate arguments.
limit#
Type: int
Default: 100
The maximum number of channel metadata objects to return in one response. The maximum value is 100.
page#
Type: PNPage
Default: no default
The page to return, as a Next or Previous object from pubnub.models.consumer.objects_v2.page. Pass the next or prev property of an earlier result, which already has that type.

Returns​

get_all_channel_metadata() resolves with an AsyncioEnvelope whose result is a PNGetAllChannelMetadataResult and whose status is a PNStatus.

PNGetAllChannelMetadataResult​

status#
Type: int
The HTTP status code of the response.
data#
Type: List[dict]
The channel metadata objects on this page.
property of data: id#
Type: str
The ID of the channel.
property of data: name#
Type: str
The name of the channel, or None when unset.
property of data: description#
Type: str
The description of the channel, or None when unset.
property of data: type#
Type: str
The type of the channel, or None when unset. The result includes it unless include_type is False.
property of data: status#
Type: str
The status of the channel, or None when unset. The result includes it unless include_status is False.
property of data: custom#
Type: dict
The custom data of the channel. The key is present only when include_custom is True. The key holds None when the channel has none.
property of data: updated#
Type: str
The date and time of the last update, in ISO 8601 format.
property of data: eTag#
Type: str
The version hash of the channel metadata.
total_count#
Type: int
The number of channel metadata objects that match the request, or None when include_total_count is not True.
next#
Type: Next
A Next object for the next page, or None when there is no next page.
prev#
Type: Previous
A Previous object for the previous page, or None when there is no previous page.

Syntax

1await pubnub.get_all_channel_metadata(
2 include_total_count: bool,
3 include_custom: bool,
4 include_status: bool,
5 include_type: bool,
6 filter: str,
7 sort_keys: List[PNSortKey],
8 limit: int,
9 page: PNPage
10).future() -> AsyncioEnvelope

Get channel metadata​

pubnub.get_channel_metadata() returns the metadata of one channel from App Context through a PubNub client for Python-Asyncio. The metadata holds the name and description of the channel and, on request, its custom data.

required
channel required#
Type: str
Default: no default
The ID of the channel to get metadata for. A request without a channel fails validation with the message Channel missing.
include_custom#
Type: bool
Default: False
Whether the response includes the custom object of the channel.
include_status#
Type: bool
Default: True
Whether the result includes the status field of the channel.
include_type#
Type: bool
Default: True
Whether the result includes the type field of the channel.

Returns​

get_channel_metadata() resolves with an AsyncioEnvelope whose result is a PNGetChannelMetadataResult and whose status is a PNStatus.

PNGetChannelMetadataResult​

status#
Type: int
The HTTP status code of the response.
data#
Type: dict
The channel metadata object.
property of data: id#
Type: str
The ID of the channel.
property of data: name#
Type: str
The name of the channel, or None when unset.
property of data: description#
Type: str
The description of the channel, or None when unset.
property of data: type#
Type: str
The type of the channel, or None when unset. The result includes it unless include_type is False.
property of data: status#
Type: str
The status of the channel, or None when unset. The result includes it unless include_status is False.
property of data: custom#
Type: dict
The custom data of the channel. The key is present only when include_custom is True.
property of data: updated#
Type: str
The date and time of the last update, in ISO 8601 format.
property of data: eTag#
Type: str
The version hash of the channel metadata.

Syntax

1await pubnub.get_channel_metadata(
2 channel: str,
3 include_custom: bool,
4 include_status: bool,
5 include_type: bool
6).future() -> AsyncioEnvelope

Set channel metadata​

pubnub.set_channel_metadata() sets the metadata of one channel in App Context through a PubNub client for Python-Asyncio and returns the stored object. The call creates the metadata when the channel has none yet.

required
channel required#
Type: str
Default: no default
The ID of the channel to set metadata for. A request without a channel fails validation with the message Channel missing.
name#
Type: str
Default: no default
The name of the channel. The builder method is set_name().
description#
Type: str
Default: no default
The description of the channel.
type#
Type: str
Default: no default
The type of the channel. The builder method is set_type().
status#
Type: str
Default: no default
The status of the channel. The builder method is set_status().
custom#
Type: dict
Default: no default
The custom data of the channel. A set call replaces the whole stored custom object. To add a key, get the metadata first, add the key, and set the complete object. Values can be strings, numbers, or booleans. The builder method custom() also sets include_custom to True, but the keyword argument custom does not.
include_custom#
Type: bool
Default: False
Whether the response includes the custom object of the channel.
include_status#
Type: bool
Default: True
Whether the result includes the status field of the channel.
include_type#
Type: bool
Default: True
Whether the result includes the type field of the channel.
if_matches_etag#
Type: str
Default: no default
The eTag of the channel metadata that you last read. The update applies only if the stored metadata still has this eTag. Otherwise PubNub rejects the update with HTTP status 412. Get the eTag from the response of get_channel_metadata(). The keyword arguments do not include it, so set it with the builder method if_matches_etag(), available since 10.2.0.

The SDK sends name, description, type, status, and custom as null when you leave them out. Pass every field that you want to keep, because a set call without name clears the stored value.

API limits

To learn about the maximum length of parameters used to set channel metadata, refer to REST API docs.

Returns​

set_channel_metadata() resolves with an AsyncioEnvelope whose result is a PNSetChannelMetadataResult and whose status is a PNStatus.Its data property holds the stored channel metadata and has the same properties as the data property of the Get channel metadata response.

PNSetChannelMetadataResult​

status#
Type: int
The HTTP status code of the response.
data#
Type: dict
The stored channel metadata object.

Syntax

1await pubnub.set_channel_metadata(
2 channel: str,
3 name: str,
4 description: str,
5 type: str,
6 status: str,
7 custom: dict,
8 include_custom: bool,
9 include_status: bool,
10 include_type: bool
11).future() -> AsyncioEnvelope

Remove channel metadata​

pubnub.remove_channel_metadata() deletes the metadata of one channel from App Context through a PubNub client for Python-Asyncio. Deleting the metadata deletes the memberships of the channel only when the keyset enforces referential integrity.

required
channel required#
Type: str
Default: no default
The ID of the channel to delete metadata for. A request without a channel fails validation with the message Channel missing.

Returns​

remove_channel_metadata() resolves with an AsyncioEnvelope whose result is a PNRemoveChannelMetadataResult and whose status is a PNStatus.

PNRemoveChannelMetadataResult​

status#
Type: int
The HTTP status code of the response.
data#
Type: None
Always None.

Syntax

1await pubnub.remove_channel_metadata(
2 channel: str
3).future() -> AsyncioEnvelope

Get channel memberships​

pubnub.get_memberships() returns a page of the channel memberships of one user through a PubNub client for Python-Asyncio. A membership links the user to a channel and is not a subscription.

uuid#
Type: str
Default: no default
The ID of the user to get channel memberships for. When omitted, the SDK uses the user_id of the PubNub client. An empty string fails validation with the message uuid missing or not a string.
include#
Type: MembershipIncludes
Default: no default
The fields to add to the result, as a MembershipIncludes object. By default the result has none of them. The SDK ignores include_custom when you pass include.
property of include: custom#
Type: bool
Default: False
Whether each membership in the response includes its custom object.
property of include: status#
Type: bool
Default: False
Whether each membership in the response includes its status field.
property of include: type#
Type: bool
Default: False
Whether each membership in the response includes its type field.
property of include: channel#
Type: bool
Default: False
Whether each membership includes the metadata of its channel in the channel object, such as name and description.
property of include: channel_custom#
Type: bool
Default: False
Whether the channel object of each membership includes the custom object of the channel.
property of include: channel_status#
Type: bool
Default: False
Whether the channel object of each membership includes the status of the channel. The status option controls the status of the membership instead.
property of include: channel_type#
Type: bool
Default: False
Whether the channel object of each membership includes the type of the channel. The type option controls the type of the membership instead.
include_custom#
Type: bool
Default: False
Whether each membership in the response includes its custom object. The SDK ignores it when you pass include.
include_total_count#
Type: bool
Default: False
Whether the result includes total_count, the number of memberships of the user. Without it, total_count is None. The total_count field of MembershipIncludes requests the total count too.
filter#
Type: str
Default: no default
The filter expression. The response includes only the memberships that match it. See filtering.
sort_keys#
Type: List[PNSortKey]
Default: no default
The sort order of the result, as a list of PNSortKey objects. Build each one with PNSortKey.asc() or PNSortKey.desc() and a PNSortKeyValue of ID, NAME, or UPDATED. Only PNSortKeyValue.UPDATED sorts memberships. The other values make PubNub return HTTP status 400. The builder method is sort(), and it takes the keys as separate arguments.
limit#
Type: int
Default: 100
The maximum number of memberships to return in one response. The maximum value is 100.
page#
Type: PNPage
Default: no default
The page to return, as a Next or Previous object from pubnub.models.consumer.objects_v2.page. Pass the next or prev property of an earlier result, which already has that type.

Returns​

get_memberships() resolves with an AsyncioEnvelope whose result is a PNGetMembershipsResult and whose status is a PNStatus.

PNGetMembershipsResult​

status#
Type: int
The HTTP status code of the response.
data#
Type: List[dict]
The memberships of the user on this page.
property of data: channel#
Type: dict
The channel of the membership. With include.channel set to True it holds the channel metadata, including id, name, description, updated, and eTag. Otherwise it holds the id of the channel and the channel fields that the include object requests.
property of data: status#
Type: str
The status of the membership. The key is present only when include.status is True.
property of data: type#
Type: str
The type of the membership. The key is present only when include.type is True.
property of data: custom#
Type: dict
The custom data of the membership. The key is present only when include_custom or include.custom is True.
property of data: updated#
Type: str
The date and time of the last update, in ISO 8601 format.
property of data: eTag#
Type: str
The version hash of the membership.
total_count#
Type: int
The number of memberships of the user, or None when include_total_count is not True.
next#
Type: Next
A Next object for the next page, or None when there is no next page.
prev#
Type: Previous
A Previous object for the previous page, or None when there is no previous page.

Syntax

1await pubnub.get_memberships(
2 uuid: str,
3 include: MembershipIncludes,
4 include_custom: bool,
5 include_total_count: bool,
6 filter: str,
7 sort_keys: List[PNSortKey],
8 limit: int,
9 page: PNPage
10).future() -> AsyncioEnvelope

Set channel memberships​

pubnub.set_memberships() sets channel memberships for one user through a PubNub client for Python-Asyncio and returns a page of the memberships of that user.

required
uuid#
Type: str
Default: no default
The ID of the user to set channel memberships for. When omitted, the SDK uses the user_id of the PubNub client. An empty string fails validation with the message uuid missing or not a string.
channel_memberships required#
Type: List[PNChannelMembership]
Default: no default
The memberships to set for the user, as a list of PNChannelMembership objects. Build each one with PNChannelMembership.channel(), PNChannelMembership.channel_with_custom(), or the PNChannelMembership constructor. The call adds the memberships that you pass and keeps the other memberships of the user.
include#
Type: MembershipIncludes
Default: no default
The fields to add to the result, as a MembershipIncludes object. By default the result has none of them. The SDK ignores include_custom when you pass include.
property of include: custom#
Type: bool
Default: False
Whether each membership in the response includes its custom object.
property of include: status#
Type: bool
Default: False
Whether each membership in the response includes its status field.
property of include: type#
Type: bool
Default: False
Whether each membership in the response includes its type field.
property of include: channel#
Type: bool
Default: False
Whether each membership includes the metadata of its channel in the channel object, such as name and description.
property of include: channel_custom#
Type: bool
Default: False
Whether the channel object of each membership includes the custom object of the channel.
property of include: channel_status#
Type: bool
Default: False
Whether the channel object of each membership includes the status of the channel. The status option controls the status of the membership instead.
property of include: channel_type#
Type: bool
Default: False
Whether the channel object of each membership includes the type of the channel. The type option controls the type of the membership instead.
include_custom#
Type: bool
Default: False
Whether each membership in the response includes its custom object. The SDK ignores it when you pass include.
include_total_count#
Type: bool
Default: False
Whether the result includes total_count, the number of memberships of the user. Without it, total_count is None. The total_count field of MembershipIncludes requests the total count too.
filter#
Type: str
Default: no default
The filter expression. The response includes only the memberships that match it. See filtering.
sort_keys#
Type: List[PNSortKey]
Default: no default
The sort order of the result, as a list of PNSortKey objects. Build each one with PNSortKey.asc() or PNSortKey.desc() and a PNSortKeyValue of ID, NAME, or UPDATED. Only PNSortKeyValue.UPDATED sorts memberships. The other values make PubNub return HTTP status 400. The builder method is sort(), and it takes the keys as separate arguments.
limit#
Type: int
Default: 100
The maximum number of memberships to return in one response. The maximum value is 100.
page#
Type: PNPage
Default: no default
The page to return, as a Next or Previous object from pubnub.models.consumer.objects_v2.page. Pass the next or prev property of an earlier result, which already has that type.
API limits

To learn about the maximum length of parameters used to set channel membership metadata, refer to REST API docs.

Returns​

set_memberships() resolves with an AsyncioEnvelope whose result is a PNSetMembershipsResult and whose status is a PNStatus.The data property lists the memberships of the user after the change.

PNSetMembershipsResult​

status#
Type: int
The HTTP status code of the response.
data#
Type: List[dict]
The memberships of the user on this page.
property of data: channel#
Type: dict
The channel of the membership. With include.channel set to True it holds the channel metadata, including id, name, description, updated, and eTag. Otherwise it holds the id of the channel and the channel fields that the include object requests.
property of data: status#
Type: str
The status of the membership. The key is present only when include.status is True.
property of data: type#
Type: str
The type of the membership. The key is present only when include.type is True.
property of data: custom#
Type: dict
The custom data of the membership. The key is present only when include_custom or include.custom is True.
property of data: updated#
Type: str
The date and time of the last update, in ISO 8601 format.
property of data: eTag#
Type: str
The version hash of the membership.
total_count#
Type: int
The number of memberships of the user, or None when include_total_count is not True.
next#
Type: Next
A Next object for the next page, or None when there is no next page.
prev#
Type: Previous
A Previous object for the previous page, or None when there is no previous page.

Syntax

1await pubnub.set_memberships(
2 uuid: str,
3 channel_memberships: List[PNChannelMembership],
4 include: MembershipIncludes,
5 include_custom: bool,
6 include_total_count: bool,
7 filter: str,
8 sort_keys: List[PNSortKey],
9 limit: int,
10 page: PNPage
11).future() -> AsyncioEnvelope

Remove channel memberships​

pubnub.remove_memberships() removes channel memberships from one user through a PubNub client for Python-Asyncio and returns a page of the remaining memberships of that user.

required
uuid#
Type: str
Default: no default
The ID of the user to remove channel memberships from. When omitted, the SDK uses the user_id of the PubNub client. An empty string fails validation with the message uuid missing or not a string.
channel_memberships required#
Type: List[PNChannelMembership]
Default: no default
The memberships to remove from the memberships of the user, as a list of PNChannelMembership objects. Build each one with PNChannelMembership.channel(), PNChannelMembership.channel_with_custom(), or the PNChannelMembership constructor.
include#
Type: MembershipIncludes
Default: no default
The fields to add to the result, as a MembershipIncludes object. By default the result has none of them. The SDK ignores include_custom when you pass include.
property of include: custom#
Type: bool
Default: False
Whether each membership in the response includes its custom object.
property of include: status#
Type: bool
Default: False
Whether each membership in the response includes its status field.
property of include: type#
Type: bool
Default: False
Whether each membership in the response includes its type field.
property of include: channel#
Type: bool
Default: False
Whether each membership includes the metadata of its channel in the channel object, such as name and description.
property of include: channel_custom#
Type: bool
Default: False
Whether the channel object of each membership includes the custom object of the channel.
property of include: channel_status#
Type: bool
Default: False
Whether the channel object of each membership includes the status of the channel. The status option controls the status of the membership instead.
property of include: channel_type#
Type: bool
Default: False
Whether the channel object of each membership includes the type of the channel. The type option controls the type of the membership instead.
include_custom#
Type: bool
Default: False
Whether each membership in the response includes its custom object. The SDK ignores it when you pass include.
include_total_count#
Type: bool
Default: False
Whether the result includes total_count, the number of memberships of the user. Without it, total_count is None. The total_count field of MembershipIncludes requests the total count too.
filter#
Type: str
Default: no default
The filter expression. The response includes only the memberships that match it. See filtering.
sort_keys#
Type: List[PNSortKey]
Default: no default
The sort order of the result, as a list of PNSortKey objects. Build each one with PNSortKey.asc() or PNSortKey.desc() and a PNSortKeyValue of ID, NAME, or UPDATED. Only PNSortKeyValue.UPDATED sorts memberships. The other values make PubNub return HTTP status 400. The builder method is sort(), and it takes the keys as separate arguments.
limit#
Type: int
Default: 100
The maximum number of memberships to return in one response. The maximum value is 100.
page#
Type: PNPage
Default: no default
The page to return, as a Next or Previous object from pubnub.models.consumer.objects_v2.page. Pass the next or prev property of an earlier result, which already has that type.

Returns​

remove_memberships() resolves with an AsyncioEnvelope whose result is a PNRemoveMembershipsResult and whose status is a PNStatus.The data property lists the memberships that remain for the user.

PNRemoveMembershipsResult​

status#
Type: int
The HTTP status code of the response.
data#
Type: List[dict]
The memberships of the user on this page.
property of data: channel#
Type: dict
The channel of the membership. With include.channel set to True it holds the channel metadata, including id, name, description, updated, and eTag. Otherwise it holds the id of the channel and the channel fields that the include object requests.
property of data: status#
Type: str
The status of the membership. The key is present only when include.status is True.
property of data: type#
Type: str
The type of the membership. The key is present only when include.type is True.
property of data: custom#
Type: dict
The custom data of the membership. The key is present only when include_custom or include.custom is True.
property of data: updated#
Type: str
The date and time of the last update, in ISO 8601 format.
property of data: eTag#
Type: str
The version hash of the membership.
total_count#
Type: int
The number of memberships of the user, or None when include_total_count is not True.
next#
Type: Next
A Next object for the next page, or None when there is no next page.
prev#
Type: Previous
A Previous object for the previous page, or None when there is no previous page.

Syntax

1await pubnub.remove_memberships(
2 uuid: str,
3 channel_memberships: List[PNChannelMembership],
4 include: MembershipIncludes,
5 include_custom: bool,
6 include_total_count: bool,
7 filter: str,
8 sort_keys: List[PNSortKey],
9 limit: int,
10 page: PNPage
11).future() -> AsyncioEnvelope

Get channel members​

pubnub.get_channel_members() returns a page of the members of one channel through a PubNub client for Python-Asyncio. A member is a user that has a membership in the channel.

required
channel required#
Type: str
Default: no default
The ID of the channel to get members for. A request without a channel fails validation with the message Channel missing.
include#
Type: MemberIncludes
Default: no default
The fields to add to the result, as a MemberIncludes object. By default the result has none of them. The SDK ignores include_custom when you pass include.
property of include: custom#
Type: bool
Default: False
Whether each member in the response includes its custom object.
property of include: status#
Type: bool
Default: False
Whether each member in the response includes its status field.
property of include: type#
Type: bool
Default: False
Whether each member in the response includes its type field.
property of include: user#
Type: bool
Default: False
Whether each member includes the metadata of its user in the uuid object, such as name and email.
property of include: user_custom#
Type: bool
Default: False
Whether the uuid object of each member includes the custom object of the user.
property of include: user_status#
Type: bool
Default: False
Whether the uuid object of each member includes the status of the user. The status option controls the status of the member instead.
property of include: user_type#
Type: bool
Default: False
Whether the uuid object of each member includes the type of the user. The type option controls the type of the member instead.
include_custom#
Type: bool
Default: False
Whether each member in the response includes its custom object. The SDK ignores it when you pass include.
include_total_count#
Type: bool
Default: False
Whether the result includes total_count, the number of members of the channel. Without it, total_count is None. The total_count field of MemberIncludes requests the total count too.
filter#
Type: str
Default: no default
The filter expression. The response includes only the members that match it. See filtering.
sort_keys#
Type: List[PNSortKey]
Default: no default
The sort order of the result, as a list of PNSortKey objects. Build each one with PNSortKey.asc() or PNSortKey.desc() and a PNSortKeyValue of ID, NAME, or UPDATED. Only PNSortKeyValue.UPDATED sorts members. The other values make PubNub return HTTP status 400. The builder method is sort(), and it takes the keys as separate arguments.
limit#
Type: int
Default: 100
The maximum number of members to return in one response. The maximum value is 100.
page#
Type: PNPage
Default: no default
The page to return, as a Next or Previous object from pubnub.models.consumer.objects_v2.page. Pass the next or prev property of an earlier result, which already has that type.

Returns​

get_channel_members() resolves with an AsyncioEnvelope whose result is a PNGetChannelMembersResult and whose status is a PNStatus.

PNGetChannelMembersResult​

status#
Type: int
The HTTP status code of the response.
data#
Type: List[dict]
The members of the channel on this page.
property of data: uuid#
Type: dict
The user of the member. With include.user set to True it holds the user metadata, including id, name, email, updated, and eTag. Otherwise it holds the id of the user and the user fields that the include object requests.
property of data: status#
Type: str
The status of the member. The key is present only when include.status is True.
property of data: type#
Type: str
The type of the member. The key is present only when include.type is True.
property of data: custom#
Type: dict
The custom data of the member. The key is present only when include_custom or include.custom is True.
property of data: updated#
Type: str
The date and time of the last update, in ISO 8601 format.
property of data: eTag#
Type: str
The version hash of the member.
total_count#
Type: int
The number of members of the channel, or None when include_total_count is not True.
next#
Type: Next
A Next object for the next page, or None when there is no next page.
prev#
Type: Previous
A Previous object for the previous page, or None when there is no previous page.

Syntax

1await pubnub.get_channel_members(
2 channel: str,
3 include: MemberIncludes,
4 include_custom: bool,
5 include_total_count: bool,
6 filter: str,
7 sort_keys: List[PNSortKey],
8 limit: int,
9 page: PNPage
10).future() -> AsyncioEnvelope

Set channel members​

pubnub.set_channel_members() sets members for one channel through a PubNub client for Python-Asyncio and returns a page of the members of that channel.

required
channel required#
Type: str
Default: no default
The ID of the channel to set members for. A request without a channel fails validation with the message Channel missing.
uuids required#
Type: List[PNUserMember]
Default: no default
The members to set for the channel, as a list of PNUserMember objects. The call adds the members that you pass and keeps the other members of the channel.
include#
Type: MemberIncludes
Default: no default
The fields to add to the result, as a MemberIncludes object. By default the result has none of them. The SDK ignores include_custom when you pass include.
property of include: custom#
Type: bool
Default: False
Whether each member in the response includes its custom object.
property of include: status#
Type: bool
Default: False
Whether each member in the response includes its status field.
property of include: type#
Type: bool
Default: False
Whether each member in the response includes its type field.
property of include: user#
Type: bool
Default: False
Whether each member includes the metadata of its user in the uuid object, such as name and email.
property of include: user_custom#
Type: bool
Default: False
Whether the uuid object of each member includes the custom object of the user.
property of include: user_status#
Type: bool
Default: False
Whether the uuid object of each member includes the status of the user. The status option controls the status of the member instead.
property of include: user_type#
Type: bool
Default: False
Whether the uuid object of each member includes the type of the user. The type option controls the type of the member instead.
include_custom#
Type: bool
Default: False
Whether each member in the response includes its custom object. The SDK ignores it when you pass include.
include_total_count#
Type: bool
Default: False
Whether the result includes total_count, the number of members of the channel. Without it, total_count is None. The total_count field of MemberIncludes requests the total count too.
filter#
Type: str
Default: no default
The filter expression. The response includes only the members that match it. See filtering.
sort_keys#
Type: List[PNSortKey]
Default: no default
The sort order of the result, as a list of PNSortKey objects. Build each one with PNSortKey.asc() or PNSortKey.desc() and a PNSortKeyValue of ID, NAME, or UPDATED. Only PNSortKeyValue.UPDATED sorts members. The other values make PubNub return HTTP status 400. The builder method is sort(), and it takes the keys as separate arguments.
limit#
Type: int
Default: 100
The maximum number of members to return in one response. The maximum value is 100.
page#
Type: PNPage
Default: no default
The page to return, as a Next or Previous object from pubnub.models.consumer.objects_v2.page. Pass the next or prev property of an earlier result, which already has that type.
API limits

To learn about the maximum length of parameters used to set channel members metadata, refer to REST API docs.

Returns​

set_channel_members() resolves with an AsyncioEnvelope whose result is a PNSetChannelMembersResult and whose status is a PNStatus.The data property lists the members of the channel after the change.

PNSetChannelMembersResult​

status#
Type: int
The HTTP status code of the response.
data#
Type: List[dict]
The members of the channel on this page.
property of data: uuid#
Type: dict
The user of the member. With include.user set to True it holds the user metadata, including id, name, email, updated, and eTag. Otherwise it holds the id of the user and the user fields that the include object requests.
property of data: status#
Type: str
The status of the member. The key is present only when include.status is True.
property of data: type#
Type: str
The type of the member. The key is present only when include.type is True.
property of data: custom#
Type: dict
The custom data of the member. The key is present only when include_custom or include.custom is True.
property of data: updated#
Type: str
The date and time of the last update, in ISO 8601 format.
property of data: eTag#
Type: str
The version hash of the member.
total_count#
Type: int
The number of members of the channel, or None when include_total_count is not True.
next#
Type: Next
A Next object for the next page, or None when there is no next page.
prev#
Type: Previous
A Previous object for the previous page, or None when there is no previous page.

Syntax

1await pubnub.set_channel_members(
2 channel: str,
3 uuids: List[PNUserMember],
4 include: MemberIncludes,
5 include_custom: bool,
6 include_total_count: bool,
7 filter: str,
8 sort_keys: List[PNSortKey],
9 limit: int,
10 page: PNPage
11).future() -> AsyncioEnvelope

Remove channel members​

pubnub.remove_channel_members() removes members from one channel through a PubNub client for Python-Asyncio and returns a page of the remaining members of that channel.

required
channel required#
Type: str
Default: no default
The ID of the channel to remove members from. A request without a channel fails validation with the message Channel missing.
uuids required#
Type: List[PNUserMember]
Default: no default
The members to remove from the members of the channel, as a list of PNUserMember objects.
include#
Type: MemberIncludes
Default: no default
The fields to add to the result, as a MemberIncludes object. By default the result has none of them. The SDK ignores include_custom when you pass include.
property of include: custom#
Type: bool
Default: False
Whether each member in the response includes its custom object.
property of include: status#
Type: bool
Default: False
Whether each member in the response includes its status field.
property of include: type#
Type: bool
Default: False
Whether each member in the response includes its type field.
property of include: user#
Type: bool
Default: False
Whether each member includes the metadata of its user in the uuid object, such as name and email.
property of include: user_custom#
Type: bool
Default: False
Whether the uuid object of each member includes the custom object of the user.
property of include: user_status#
Type: bool
Default: False
Whether the uuid object of each member includes the status of the user. The status option controls the status of the member instead.
property of include: user_type#
Type: bool
Default: False
Whether the uuid object of each member includes the type of the user. The type option controls the type of the member instead.
include_custom#
Type: bool
Default: False
Whether each member in the response includes its custom object. The SDK ignores it when you pass include.
include_total_count#
Type: bool
Default: False
Whether the result includes total_count, the number of members of the channel. Without it, total_count is None. The total_count field of MemberIncludes requests the total count too.
filter#
Type: str
Default: no default
The filter expression. The response includes only the members that match it. See filtering.
sort_keys#
Type: List[PNSortKey]
Default: no default
The sort order of the result, as a list of PNSortKey objects. Build each one with PNSortKey.asc() or PNSortKey.desc() and a PNSortKeyValue of ID, NAME, or UPDATED. Only PNSortKeyValue.UPDATED sorts members. The other values make PubNub return HTTP status 400. The builder method is sort(), and it takes the keys as separate arguments.
limit#
Type: int
Default: 100
The maximum number of members to return in one response. The maximum value is 100.
page#
Type: PNPage
Default: no default
The page to return, as a Next or Previous object from pubnub.models.consumer.objects_v2.page. Pass the next or prev property of an earlier result, which already has that type.

Returns​

remove_channel_members() resolves with an AsyncioEnvelope whose result is a PNRemoveChannelMembersResult and whose status is a PNStatus.The data property lists the members that remain in the channel.

PNRemoveChannelMembersResult​

status#
Type: int
The HTTP status code of the response.
data#
Type: List[dict]
The members of the channel on this page.
property of data: uuid#
Type: dict
The user of the member. With include.user set to True it holds the user metadata, including id, name, email, updated, and eTag. Otherwise it holds the id of the user and the user fields that the include object requests.
property of data: status#
Type: str
The status of the member. The key is present only when include.status is True.
property of data: type#
Type: str
The type of the member. The key is present only when include.type is True.
property of data: custom#
Type: dict
The custom data of the member. The key is present only when include_custom or include.custom is True.
property of data: updated#
Type: str
The date and time of the last update, in ISO 8601 format.
property of data: eTag#
Type: str
The version hash of the member.
total_count#
Type: int
The number of members of the channel, or None when include_total_count is not True.
next#
Type: Next
A Next object for the next page, or None when there is no next page.
prev#
Type: Previous
A Previous object for the previous page, or None when there is no previous page.

Syntax

1await pubnub.remove_channel_members(
2 channel: str,
3 uuids: List[PNUserMember],
4 include: MemberIncludes,
5 include_custom: bool,
6 include_total_count: bool,
7 filter: str,
8 sort_keys: List[PNSortKey],
9 limit: int,
10 page: PNPage
11).future() -> AsyncioEnvelope

Manage channel memberships​

pubnub.manage_memberships() sets and removes channel memberships of one user in one request through a PubNub client for Python-Asyncio.

uuid#
Type: str
Default: no default
The ID of the user to manage channel memberships for. When omitted, the SDK uses the user_id of the PubNub client. An empty string fails validation with the message uuid missing or not a string.
channel_memberships_to_set#
Type: List[PNChannelMembership]
Default: no default
The memberships to set for the user, as a list of PNChannelMembership objects. Build each one with PNChannelMembership.channel(), PNChannelMembership.channel_with_custom(), or the PNChannelMembership constructor. The call adds the memberships that you pass and keeps the other memberships of the user. The builder method is set().
channel_memberships_to_remove#
Type: List[PNChannelMembership]
Default: no default
The memberships to remove from the memberships of the user, as a list of PNChannelMembership objects. Build each one with PNChannelMembership.channel(), PNChannelMembership.channel_with_custom(), or the PNChannelMembership constructor. The builder method is remove().
include#
Type: MembershipIncludes
Default: no default
The fields to add to the result, as a MembershipIncludes object. By default the result has none of them. The SDK ignores include_custom when you pass include.
property of include: custom#
Type: bool
Default: False
Whether each membership in the response includes its custom object.
property of include: status#
Type: bool
Default: False
Whether each membership in the response includes its status field.
property of include: type#
Type: bool
Default: False
Whether each membership in the response includes its type field.
property of include: channel#
Type: bool
Default: False
Whether each membership includes the metadata of its channel in the channel object, such as name and description.
property of include: channel_custom#
Type: bool
Default: False
Whether the channel object of each membership includes the custom object of the channel.
property of include: channel_status#
Type: bool
Default: False
Whether the channel object of each membership includes the status of the channel. The status option controls the status of the membership instead.
property of include: channel_type#
Type: bool
Default: False
Whether the channel object of each membership includes the type of the channel. The type option controls the type of the membership instead.
include_custom#
Type: bool
Default: False
Whether each membership in the response includes its custom object. The SDK ignores it when you pass include.
include_total_count#
Type: bool
Default: False
Whether the result includes total_count, the number of memberships of the user. Without it, total_count is None. The total_count field of MembershipIncludes requests the total count too.
filter#
Type: str
Default: no default
The filter expression. The response includes only the memberships that match it. See filtering.
sort_keys#
Type: List[PNSortKey]
Default: no default
The sort order of the result, as a list of PNSortKey objects. Build each one with PNSortKey.asc() or PNSortKey.desc() and a PNSortKeyValue of ID, NAME, or UPDATED. Only PNSortKeyValue.UPDATED sorts memberships. The other values make PubNub return HTTP status 400. The builder method is sort(), and it takes the keys as separate arguments.
limit#
Type: int
Default: 100
The maximum number of memberships to return in one response. The maximum value is 100.
page#
Type: PNPage
Default: no default
The page to return, as a Next or Previous object from pubnub.models.consumer.objects_v2.page. Pass the next or prev property of an earlier result, which already has that type.
API limits

To learn about the maximum length of parameters used to set channel membership metadata, refer to REST API docs.

Returns​

manage_memberships() resolves with an AsyncioEnvelope whose result is a PNManageMembershipsResult and whose status is a PNStatus.The data property lists the memberships of the user after the change.

PNManageMembershipsResult​

status#
Type: int
The HTTP status code of the response.
data#
Type: List[dict]
The memberships of the user on this page.
property of data: channel#
Type: dict
The channel of the membership. With include.channel set to True it holds the channel metadata, including id, name, description, updated, and eTag. Otherwise it holds the id of the channel and the channel fields that the include object requests.
property of data: status#
Type: str
The status of the membership. The key is present only when include.status is True.
property of data: type#
Type: str
The type of the membership. The key is present only when include.type is True.
property of data: custom#
Type: dict
The custom data of the membership. The key is present only when include_custom or include.custom is True.
property of data: updated#
Type: str
The date and time of the last update, in ISO 8601 format.
property of data: eTag#
Type: str
The version hash of the membership.
total_count#
Type: int
The number of memberships of the user, or None when include_total_count is not True.
next#
Type: Next
A Next object for the next page, or None when there is no next page.
prev#
Type: Previous
A Previous object for the previous page, or None when there is no previous page.

Syntax

1await pubnub.manage_memberships(
2 uuid: str,
3 channel_memberships_to_set: List[PNChannelMembership],
4 channel_memberships_to_remove: List[PNChannelMembership],
5 include: MembershipIncludes,
6 include_custom: bool,
7 include_total_count: bool,
8 filter: str,
9 sort_keys: List[PNSortKey],
10 limit: int,
11 page: PNPage
12).future() -> AsyncioEnvelope

Manage channel members​

pubnub.manage_channel_members() sets and removes members of one channel in one request through a PubNub client for Python-Asyncio.

required
channel required#
Type: str
Default: no default
The ID of the channel to manage members for. A request without a channel fails validation with the message Channel missing.
uuids_to_set#
Type: List[PNUserMember]
Default: no default
The members to set for the channel, as a list of PNUserMember objects. The call adds the members that you pass and keeps the other members of the channel. The builder method is set().
uuids_to_remove#
Type: List[PNUserMember]
Default: no default
The members to remove from the members of the channel, as a list of PNUserMember objects. The builder method is remove().
include#
Type: MemberIncludes
Default: no default
The fields to add to the result, as a MemberIncludes object. By default the result has none of them. The SDK ignores include_custom when you pass include.
property of include: custom#
Type: bool
Default: False
Whether each member in the response includes its custom object.
property of include: status#
Type: bool
Default: False
Whether each member in the response includes its status field.
property of include: type#
Type: bool
Default: False
Whether each member in the response includes its type field.
property of include: user#
Type: bool
Default: False
Whether each member includes the metadata of its user in the uuid object, such as name and email.
property of include: user_custom#
Type: bool
Default: False
Whether the uuid object of each member includes the custom object of the user.
property of include: user_status#
Type: bool
Default: False
Whether the uuid object of each member includes the status of the user. The status option controls the status of the member instead.
property of include: user_type#
Type: bool
Default: False
Whether the uuid object of each member includes the type of the user. The type option controls the type of the member instead.
include_custom#
Type: bool
Default: False
Whether each member in the response includes its custom object. The SDK ignores it when you pass include.
include_total_count#
Type: bool
Default: False
Whether the result includes total_count, the number of members of the channel. Without it, total_count is None. The total_count field of MemberIncludes requests the total count too.
filter#
Type: str
Default: no default
The filter expression. The response includes only the members that match it. See filtering.
sort_keys#
Type: List[PNSortKey]
Default: no default
The sort order of the result, as a list of PNSortKey objects. Build each one with PNSortKey.asc() or PNSortKey.desc() and a PNSortKeyValue of ID, NAME, or UPDATED. Only PNSortKeyValue.UPDATED sorts members. The other values make PubNub return HTTP status 400. The builder method is sort(), and it takes the keys as separate arguments.
limit#
Type: int
Default: 100
The maximum number of members to return in one response. The maximum value is 100.
page#
Type: PNPage
Default: no default
The page to return, as a Next or Previous object from pubnub.models.consumer.objects_v2.page. Pass the next or prev property of an earlier result, which already has that type.
API limits

To learn about the maximum length of parameters used to set channel members metadata, refer to REST API docs.

Returns​

manage_channel_members() resolves with an AsyncioEnvelope whose result is a PNManageChannelMembersResult and whose status is a PNStatus.The data property lists the members of the channel after the change.

PNManageChannelMembersResult​

status#
Type: int
The HTTP status code of the response.
data#
Type: List[dict]
The members of the channel on this page.
property of data: uuid#
Type: dict
The user of the member. With include.user set to True it holds the user metadata, including id, name, email, updated, and eTag. Otherwise it holds the id of the user and the user fields that the include object requests.
property of data: status#
Type: str
The status of the member. The key is present only when include.status is True.
property of data: type#
Type: str
The type of the member. The key is present only when include.type is True.
property of data: custom#
Type: dict
The custom data of the member. The key is present only when include_custom or include.custom is True.
property of data: updated#
Type: str
The date and time of the last update, in ISO 8601 format.
property of data: eTag#
Type: str
The version hash of the member.
total_count#
Type: int
The number of members of the channel, or None when include_total_count is not True.
next#
Type: Next
A Next object for the next page, or None when there is no next page.
prev#
Type: Previous
A Previous object for the previous page, or None when there is no previous page.

Syntax

1await pubnub.manage_channel_members(
2 channel: str,
3 uuids_to_set: List[PNUserMember],
4 uuids_to_remove: List[PNUserMember],
5 include: MemberIncludes,
6 include_custom: bool,
7 include_total_count: bool,
8 filter: str,
9 sort_keys: List[PNSortKey],
10 limit: int,
11 page: PNPage
12).future() -> AsyncioEnvelope

PNChannelMembership class​

PNChannelMembership describes one channel membership that you pass to the membership methods of the Python-Asyncio SDK. The factory methods PNChannelMembership.channel(channel) and PNChannelMembership.channel_with_custom(channel, custom) build one without or with custom data, and the constructor also sets a status and a type.

required
channel required#
Type: str
Default: no default
The ID of the channel.
custom#
Type: dict
Default: no default
The custom data of the membership. The factory method channel_with_custom() takes it as its second argument.
status#
Type: str
Default: no default
The status of the membership.
type#
Type: str
Default: no default
The type of the membership.

Syntax

1PNChannelMembership(
2 channel: str,
3 custom: dict,
4 status: str,
5 type: str
6)

PNUserMember class​

PNUserMember describes one member of a channel that you pass to the member methods of the Python-Asyncio SDK. It replaces the deprecated factory methods of PNUUID.

required
user_id required#
Type: str
Default: no default
The ID of the user.
type#
Type: str
Default: no default
The type of the member.
status#
Type: str
Default: no default
The status of the member.
custom#
Type: dict
Default: no default
The custom data of the member.

Syntax

1PNUserMember(
2 user_id: str,
3 type: str,
4 status: str,
5 custom: dict
6)

PNUUID class​

PNUUID builds member objects in the Python-Asyncio SDK, and its factory methods are deprecated in favor of PNUserMember. The methods PNUUID.uuid(uuid) and PNUUID.uuid_with_custom(uuid, custom) issue a DeprecationWarning and still work.

required
uuid required#
Type: str
Default: no default
The ID of the user.
custom required#
Type: dict
Default: no default
The custom data of the member. Only uuid_with_custom() takes it.

Syntax

1PNUUID.uuid(
2 uuid: str
3) -> JustUUID
4
5PNUUID.uuid_with_custom(
6 uuid: str,
7 custom: dict
8) -> UUIDWithCustom

Was this page useful?

Last updated on