Metadata API for PubNub Unity SDK
This page describes the new Objects v2. To upgrade from Objects v1, refer to the migration guide.
Objects provides easy-to-use, serverless storage for user and channel data you need to build innovative, reliable, scalable applications. Use Objects to easily store metadata about your application users and channels, and their membership associations, without the need to stand up your own databases.
PubNub also triggers events when object data is set or removed from the database. Clients can receive these events in real time and update their front-end application accordingly.
User
Get Metadata for All Users
Description
Returns a paginated list of UUID Metadata objects, optionally including the custom data object for each.
Method(s)
To Get All UUID Metadata
you can use the following method(s) in the Unity V4 SDK:
pubnub.GetAllUUIDMetadata() .Include(PNUUIDMetadataInclude[]) .Limit(int) .Start(string) .End(string) .Filter(string) .Sort(List<string>) .Count(boolean) .Async()
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
Include | PNUUIDMetadataInclude[] | Optional | List of additional/complex UUID attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes. Available values: PNUUIDMetadataIncludeCustom | |
Limit | int | Optional | 100 | Number of objects to return in response. Default is 100, which is also the maximum value. |
IncludeCount | bool | Optional | false | Request Count to be included in paginated response. By default, Count is omitted. |
Start | string | Optional | null | Previously-returned cursor bookmark for fetching the next page. |
End | string | Optional | null | Previously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter. |
Filter | string | Optional | null | Expression used to filter the results. Only objects whose properties satisfy the given expression are returned. The filter language is defined here In addition to custom attributes, the expressions can refer to attributes on associated entities one level deep (that is, the association and its target entities). |
Sort | List<string> | Optional | null | List of properties to sort by. Available options are id , name , and updated . Use asc or desc to specify sort direction. For example: {name: 'asc'} |
Basic Usage
pubnub.GetAllUUIDMetadata().Async((result, status) => {
Debug.Log("result.Next:" + result.Next);
Debug.Log("result.Prev:" + result.Prev);
Debug.Log("result.TotalCount:" + result.TotalCount);
if (result.Data != null)
{
foreach (PNUUIDMetadataResult pnUUIDMetadataResult in result.Data)
{
Debug.Log(pnUUIDMetadataResult.Name);
Debug.Log(pnUUIDMetadataResult.Email);
Debug.Log(pnUUIDMetadataResult.ExternalID);
Debug.Log(pnUUIDMetadataResult.ProfileURL);
Debug.Log(pnUUIDMetadataResult.ETag);
Debug.Log(pnUUIDMetadataResult.Custom);
}
show all 17 linesResponse
The GetAllUUIDMetadata()
operation returns a type PNGetAllUUIDMetadataResult
which contains the following properties:
Property Name | Type | Description |
---|---|---|
Data | List<PNUUIDMetadataResult > | Details of type PNUUIDMetadataResult are here |
TotalCount | long | Total count of objects without pagination. |
Next | string | Cursor bookmark for fetching next page. |
Prev | string | Cursor bookmark for fetching prev page. |
Get User Metadata
Description
Returns metadata for the specified UUID, optionally including the custom data object for each.
Method(s)
To Get UUID Metadata
you can use the following method(s) in the Unity V4 SDK:
pubnub.GetUUIDMetadata().UUID(string).Async()
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
UUID | string | Yes | pubnub.configuration.uuid | Unique UUID Metadata identifier. If not supplied, then UUID from configuration will be used. |
Include | PNUUIDMetadataInclude[] | Optional | List of additional/complex UUID attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes. Available values: PNUUIDMetadataIncludeCustom |
Basic Usage
pubnub.GetUUIDMetadata().UUID("testuuid").Async((result, status) =>
{
Debug.Log(result.Name);
Debug.Log(result.Email);
Debug.Log(result.ExternalID);
Debug.Log(result.ProfileURL);
Debug.Log(result.ID);
Debug.Log(result.ETag);
});
Response
The GetUUIDMetadata()
operation returns a type PNUUIDMetadataResult
which contains the following properties:
PNUUIDMetadataResult
PNUUIDMetadataResult
contains the following properties:
Property Name | Type | Description |
---|---|---|
ID | string | Unique user identifier. If not supplied then current user's uuid is used. |
Name | string | Display name for the user. Maximum 200 characters. |
ExternalID | string | User's identifier in an external system. |
ProfileURL | string | The URL of the user's profile picture. |
Email | string | The user's email address. Maximum 80 characters. |
Custom | Dictionary<string, object> | JSON object of key-value pairs with supported data types. |
Updated | string | Last updated date. |
ETag | string | The ETag. |
Set User Metadata
Description
Set metadata for a UUID in the database, optionally including the custom data object for each.
Method(s)
To Set UUID Metadata
you can use the following method(s) in the Unity V4 SDK:
pubnub.SetUUIDMetadata().Email(string).ExternalID(string).Name(string).UUID(string).ProfileURL(string).Custom(Dictionary<string, object>).Include(PNUUIDMetadataInclude[]).Async()
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
Include | PNUUIDMetadataInclude[] | Optional | List of additional/complex UUID attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes. Available values: PNUUIDMetadataIncludeCustom | |
UUID | string | Yes | null | Unique user identifier. If not supplied then current user's uuid is used. |
Name | string | Yes | null | Display name for the user. Maximum 200 characters. |
ExternalId | string | Optional | null | User's identifier in an external system |
ProfileUrl | string | Optional | null | The URL of the user's profile picture |
Email | string | Optional | null | The user's email address. Maximum 80 characters. |
Custom | Dictionary<string, object> | Optional | null | Any object of key-value pairs with supported data types. Objects filtering language doesn’t support filtering by custom properties. |
Include | PNUUIDMetadataInclude[] | Optional | List of additional/complex UUID attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes. Available values: PNUUIDMetadataIncludeCustom |
Basic Usage
pubnub.SetUUIDMetadata().Email("email").ExternalID("extid").Name("name").UUID("testuuid").ProfileURL("profileurl").Async((result, status) => {
Debug.Log(result.Name);
Debug.Log(result.Email);
Debug.Log(result.ExternalID);
Debug.Log(result.ProfileURL);
Debug.Log(result.ID);
Debug.Log(result.ETag);
});
Response
The SetUUIDMetadata()
operation returns a type PNUUIDMetadataResult
. Details of type PNUUIDMetadataResult
are here.
Remove User Metadata
Description
Removes the metadata from a specified UUID.
Method(s)
To Remove UUID Metadata
you can use the following method(s) in the Unity V4 SDK:
pubnub.RemoveUUIDMetadata().UUID(string).Async()
Parameter | Type | Required | Description |
---|---|---|---|
UUID | string | Optional | Unique user identifier. If not supplied then current user's uuid is used. |
Basic Usage
pubnub.RemoveUUIDMetadata().UUID("testuuid").Async((result, status) => {
Debug.Log(status.Error);
});
Response
The RemoveUUIDMetadata()
operation returns a type PNRemoveUUIDMetadataResult
which is empty.
Channel
Get Metadata for All Channels
Description
Returns a paginated list of Channel Metadata objects, optionally including the custom data object for each.
Method(s)
To Get All Channel Metadata
you can use the following method(s) in the Unity V4 SDK:
pubnub.GetAllChannelMetadata().Include(PNChannelMetadataInclude[]).Start(string).End(string).Limit(int).Count(bool).Filter(string).Sort(List<string>).Async()
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
Include | PNChannelMetadataInclude[] | Optional | List of additional/complex channel attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes. Available values: PNChannelMetadataIncludeCustom | |
Limit | int | Optional | 100 | Number of objects to return in response. Default is 100, which is also the maximum value. |
Count | bool | Optional | false | Request Count to be included in paginated response. By default, Count is omitted. |
Start | string | Optional | null | Previously-returned cursor bookmark for fetching the next page. |
End | string | Optional | null | Previously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter. |
Filter | string | Optional | null | Expression used to filter the results. Only objects whose properties satisfy the given expression are returned. The filter language is defined here In addition to custom attributes, the expressions can refer to attributes on associated entities one level deep (that is, the association and its target entities). |
Sort | List<string> | Optional | null | List of properties to sort by. Available options are id , name , and updated . Use asc or desc to specify sort direction. For example: {name: 'asc'} |
Basic Usage
pubnub.GetAllChannelMetadata().Async((result, status) => {
if (result.Data != null)
{
Debug.Log("result.Next:" + result.Next);
Debug.Log("result.Prev:" + result.Prev);
Debug.Log("result.TotalCount:" + result.TotalCount);
foreach (PNChannelMetadataResult m in result.Data)
{
Debug.LOg(result.Data[i].ID);
}
}
});
Response
The GetAllChannelMetadata()
operation returns a type PNGetAllChannelMetadataResult
.
PNGetAllChannelMetadataResult
Property Name | Type | Description |
---|---|---|
Data | List<PNChannelMetadataResult > | Details of type PNChannelMetadataResult are here |
TotalCount | long | Total count of objects without pagination. |
Next | string | Cursor bookmark for fetching next page. |
Prev | string | Cursor bookmark for fetching prev page. |
Get Channel Metadata
Description
Returns metadata for the specified Channel, optionally including the custom data object for each.
Method(s)
To Get Channel Metadata
you can use the following method(s) in the Unity V4 SDK:
pubnub.GetChannelMetadata().Channel(string).Include(PNChannelMetadataInclude).Async()
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
Channel | string | Yes | Channel name. | |
Include | PNChannelMetadataInclude[] | Optional | List of additional/complex space attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes. Available values: PNChannelMetadataIncludeCustom . |
Basic Usage
pubnub.GetChannelMetadata().Channel("testchannel").Async((result, status) =>
{
Debug.Log(result.Name);
Debug.Log(result.Description);
Debug.Log(result.ID);
Debug.Log(result.ETag);
});
Response
The GetChannelMetadata()
operation returns a type PNChannelMetadataResult
.
PNChannelMetadataResult
Property Name | Type | Description |
---|---|---|
ID | string | Unique user identifier. If not supplied then current user's uuid is used. |
Name | string | Display name of the channel. Maximum 200 characters. |
Description | string | Description of the channel. Maximum 80 characters. |
Custom | Dictionary<string, object> | JSON object of key-value pairs with supported data types. |
Updated | string | Last updated date. |
ETag | string | The ETag. |
Set Channel Metadata
Description
Set metadata for a Channel in the database, optionally including the custom data object for each.
Method(s)
To Set Channel Metadata
you can use the following method(s) in the Unity V4 SDK:
pubnub.SetChannelMetadata().Name(string).Channel(string).Include(PNChannelMetadataInclude[]).Custom(Dictionary<string, object>).Description(string).Async()
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
Include | PNChannelMetadataInclude[] | Optional | List of additional/complex channel attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes. Available values: PNChannelMetadataIncludeCustom | |
Channel | string | Yes | Channel Metadata identifier. | |
Name | string | Optional | Name of a channel. | |
Description | string | Optional | Description of a channel. | |
Custom | Dictionary<string, object> | Optional | null | Any object of key-value pairs with supported data types. Objects filtering language doesn’t support filtering by custom properties. |
Basic Usage
pubnub.SetChannelMetadata().Name(channelMetadataname2).Channel(channelMetadataID2).Include(channelMetadataInclude).Custom(channelMetadataCustom2).Description(channelMetadatadesc2).Async((result, status) => {
Debug.Log(result.Name);
Debug.Log(result.Description);
Debug.Log(result.ID);
Debug.Log(result.ETag);
});
Response
The SetChannelMetadata()
operation returns a type PNChannelMetadataResult
. Details of PNChannelMetadataResult
are here
Remove Channel Metadata
Description
Removes the metadata from a specified channel.
Method(s)
To Remove Channel Metadata
you can use the following method(s) in the Unity V4 SDK:
pubnub.RemoveChannelMetadata().Channel(string).Async()
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
Channel | string | Yes | Channel name. |
Basic Usage
pubnub.RemoveChannelMetadata().Channel("testchannel").Async((result, status) => {
Debug.Log(status.Error);
});
Response
The RemoveChannelMetadata()
operation returns a type PNRemoveChannelMetadataResult
which is empty.
Channel Memberships
Get Channel Memberships
Description
The method returns a list of channel memberships for a user. This method doesn't return a user's subscriptions.
Method(s)
To Get Memberships
you can use the following method(s) in the Unity V4 SDK:
pubnub.GetMemberships().UUID(string).Include(PNMembershipsInclude[]).Start(string).End(string).Limit(int).Count(bool).Filter(string).Sort(List<string>).Async()
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
UUID | string | Optional | Unique user identifier. If not supplied then current user's UUID is used. | |
Include | PNMembershipsInclude[] | Optional | List of additional/complex UUID attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes. Available values: PNMembershipsIncludeCustom ,PNMembershipsIncludeChannel ,PNMembershipsIncludeChannelCustom . | |
Limit | int | Optional | 100 | Number of objects to return in response. Default is 100 , which is also the maximum value. |
Count | bool | Optional | false | Request Count to be included in paginated response. By default, Count is omitted. |
Start | string | Optional | null | Previously-returned cursor bookmark for fetching the next page. |
End | string | Optional | null | Previously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter. |
Filter | string | Optional | null | Expression used to filter the results. Only objects whose properties satisfy the given expression are returned. The filter language is defined here In addition to custom attributes, the expressions can refer to attributes on associated entities one level deep (that is, the association and its target entities). |
Sort | List<string> | Optional | null | List of properties to sort by. Available options are id , name , and updated . Use asc or desc to specify sort direction. For example: {name: 'asc'} |
Basic Usage
pubnub.GetMemberships().UUID("testuuid").Async((result, status) =>
{
if (result.Data != null)
{
var resultData = result.Data as List<PNMemberships>;
foreach (PNMemberships m in result.Data)
{
Debug.Log(resultData[i].ID)
}
}
});
Response
The GetMemberships()
operation returns a PNGetMembershipsResult
which contains the following parameters:
Property Name | Type | Description |
---|---|---|
Data | List<PNMemberships > | Details of type PNMemberships are here |
TotalCount | long | Total count of objects without pagination. |
Next | string | Cursor bookmark for fetching next page. |
Prev | string | Cursor bookmark for fetching prev page. |
PNMemberships
Property Name | Type | Description |
---|---|---|
ID | string | Unique user identifier. If not supplied then current user's UUID is used. |
Channel | PNChannelMetadataResult | Display name for the user. Maximum 200 characters. |
Created | string | Created date. |
Custom | Dictionary<string, object> | JSON object of key-value pairs with supported data types. |
Updated | string | Last updated date. |
ETag | string | The ETag. |
Set Channel Memberships
Description
Set channel memberships for a UUID.
Method(s)
To Set Memberships
you can use the following method(s) in the Unity V4 SDK:
pubnub.SetMemberships().Include(PNMembershipsInclude[]).UUID(string).Set(List<PNMembershipsSet>).Limit(int).Count(bool).Start(string).End(string).Sort(List<string>).Async()
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
Set | List<PNMembershipSet > | Optional | List of channels (as [PNMembershipsSet ] to set for membership. | |
UUID | string | Optional | Unique user identifier. If not supplied then current user's UUID is used. | |
Include | PNMembershipsInclude[] | Optional | List of additional/complex UUID attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes. Available values: PNMembershipsIncludeCustom ,PNMembershipsIncludeChannel ,PNMembershipsIncludeChannelCustom . | |
Limit | int | Optional | 100 | Number of objects to return in response. Default is 100 , which is also the maximum value. |
Count | bool | Optional | false | Request Count to be included in paginated response. By default, Count is omitted. |
Start | string | Optional | null | Previously-returned cursor bookmark for fetching the next page. |
End | string | Optional | null | Previously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter. |
Sort | List<string> | Optional | null | List of properties to sort by. Available options are id , name , and updated . Use asc or desc to specify sort direction. For example: {name: 'asc'} |
Basic Usage
PNMembershipsSet inputMemberships = new PNMembershipsSet();
inputMemberships.Channel = new PNMembershipsChannel {
ID = "channelID"
};
pubnub.SetMemberships().UUID("testuuid").Set(new List<PNMembershipsSet> { inputMemberships }.Async((result, status) => {
Debug.Log("result.Next:" + result.Next);
Debug.Log("result.Prev:" + result.Prev);
Debug.Log("result.TotalCount:" + result.TotalCount);
foreach (PNMemberships mem in result.Data)
{
Debug.Log(mem.Channel.ID);
Debug.Log(mem.Channel.Name);
Debug.Log(mem.Channel.Description);
show all 18 linesResponse
The SetMemberships()
operation returns a PNSetMembershipsResult
which contains the following parameters:
PNManageMembershipsResult
Property Name | Type | Description |
---|---|---|
Data | List<PNMemberships > | Details of type PNMemberships are here |
TotalCount | long | Total count of objects without pagination. |
Next | string | Cursor bookmark for fetching next page. |
Prev | string | Cursor bookmark for fetching previous page. |
Remove Channel Memberships
Description
Remove channel memberships for a UUID.
Method(s)
To Remove Memberships
you can use the following method(s) in the Unity V4 SDK:
pubnub.RemoveMemberships().UUID(string).Remove(List<PNMembershipsRemove>).Include(PNMembershipsInclude[]).Limit(int).Count(bool).Async()
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
Remove | List<PNMembershipRemove > | Optional | List of channels (as [PNMembershipsRemove ] to remove membership for. | |
UUID | string | Optional | Unique user identifier. If not supplied then current user's UUID is used. | |
Include | PNMembershipsInclude[] | Optional | List of additional/complex UUID attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes. Available values: PNMembershipsIncludeCustom ,PNMembershipsIncludeChannel ,PNMembershipsIncludeChannelCustom . | |
Limit | int | Optional | 100 | Number of objects to return in response. Default is 100 , which is also the maximum value. |
Count | bool | Optional | false | Request Count to be included in paginated response. By default, Count is omitted. |
Basic Usage
PNMembershipsRemove inputMembershipsRm = new PNMembershipsRemove();
inputMembershipsRm.Channel = new PNMembershipsChannel {
ID = "channelID"
};
pubnub.RemoveMemberships().UUID("testuuid").Remove(new List<PNMembershipsRemove> { inputMembershipsRm }).Async((result, status) => {
Debug.Log("result.Next:" + result.Next);
Debug.Log("result.Prev:" + result.Prev);
Debug.Log("result.TotalCount:" + result.TotalCount);
foreach (PNMemberships mem in result.Data)
{
Debug.Log(mem.Channel.ID);
Debug.Log(mem.Channel.Name);
Debug.Log(mem.Channel.Description);
show all 18 linesResponse
The RemoveMemberships()
operation returns a type PNManageMembershipsResult
. Details of type PNManageMembershipsResult
are here
Manage Channel Memberships
Description
Manage a user's channel memberships.
Method(s)
To Manage Memberships
you can use the following method(s) in the Unity V4 SDK:
pubnub.ManageMemberships().UUID(string).Set(List<PNMembershipsSet>.Remove(List<PNMembershipsRemove>).Include(PNMembershipsInclude[]).Limit(int).Count(bool).Async()
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
Set | List<PNMembershipsSet > | Optional | List of channels (as [PNMembershipsSet ] to set for membership. | |
Remove | List<PNMembershipsRemove > | Optional | List of channels (as [PNMembershipsRemove ] to remove membership for. | |
UUID | string | Optional | Unique user identifier. If not supplied then current user's UUID is used. | |
Include | PNMembershipsInclude[] | Optional | List of additional/complex UUID attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes. Available values: PNMembershipsIncludeCustom ,PNMembershipsIncludeChannel ,PNMembershipsIncludeChannelCustom . | |
Limit | int | Optional | 100 | Number of objects to return in response. Default is 100 , which is also the maximum value. |
Count | bool | Optional | false | Request Count to be included in paginated response. By default, Count is omitted. |
Basic Usage
PNMembershipsSet inputMemberships = new PNMembershipsSet();
inputMemberships.Channel = new PNMembershipsChannel {
ID = "channelID"
};
pubnub.ManageMemberships().UUID("testuuid").Set(new List<PNMembershipsSet> { inputMemberships }).Async((result, status) => {
Debug.Log("result.Next:" + result.Next);
Debug.Log("result.Prev:" + result.Prev);
Debug.Log("result.TotalCount:" + result.TotalCount);
foreach (PNMemberships mem in result.Data)
{
Debug.Log(mem.Channel.ID);
Debug.Log(mem.Channel.Name);
Debug.Log(mem.Channel.Description);
show all 19 linesResponse
The ManageMemberships()
operation returns a type PNManageMembershipsResult
. Details of type PNManageMembershipsResult
are here
Channel Members
Get Channel Members
Description
The method returns a list of members in a channel. The list will include user metadata for members that have additional metadata stored in the database.
Method(s)
To Get Channel Members
you can use the following method(s) in the Unity V4 SDK:
pubnub.GetChannelMembers().Channel(string).Include(PNChannelMembersInclude[]).Limit(int).Start(string).End(string).Count(bool).Filter(string).Sort(List<string>).Async()
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
Include | PNChannelMembersInclude[] | Optional | List of additional/complex UUID attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes. Available values: PNChannelMembersIncludeCustom , PNChannelMembersIncludeUUID , PNChannelMembersIncludeUUIDCustom . | |
Limit | int | Optional | 100 | Number of objects to return in response. Default is 100, which is also the maximum value. |
IncludeCount | bool | Optional | false | Request Count to be included in paginated response. By default, Count is omitted. |
Start | string | Optional | null | Previously-returned cursor bookmark for fetching the next page. |
End | string | Optional | null | Previously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter. |
Filter | string | Optional | null | Expression used to filter the results. Only objects whose properties satisfy the given expression are returned. The filter language is defined here In addition to custom attributes, the expressions can refer to attributes on associated entities one level deep (that is, the association and its target entities). |
Sort | List<string> | Optional | false | List of properties to sort by. Available options are id , name , and updated . Use asc or desc to specify sort direction. For example: {name: 'asc'} |
Basic Usage
pubnub.GetChannelMembers().Channel("testchannel").Async((result, status) =>
{
Debug.Log("result.Next:" + result.Next);
Debug.Log("result.Prev:" + result.Prev);
Debug.Log("result.TotalCount:" + result.TotalCount)
if (result.Data != null)
{
foreach (PNMembers m in result.Data)
{
Debug.Log(result.Data[i].ID);
}
}
});
Response
The GetChannelMembers()
operation returns a type PNGetChannelMembersResult
.
PNGetChannelMembersResult
Property Name | Type | Description |
---|---|---|
ID | string | Unique user identifier. If not supplied then current user's uuid is used. |
Data | List<PNMembers > | Details of type PNMembers are here |
TotalCount | long | Total count of objects without pagination. |
Next | string | Cursor bookmark for fetching next page. |
Prev | string | Cursor bookmark for fetching next page. |
PNMembers
Property Name | Type | Description |
---|---|---|
UUID | PNUUIDMetadataResult | Details of type PNUUIDMetadataResult are here |
Set Channel Members
Description
This method sets members in a channel.
Method(s)
To Set Channel Members
you can use the following method(s) in the Unity V4 SDK:
pubnub.SetChannelMembers().Channel(string).Set( List<PNChannelMembersSet>).Include(PNChannelMembersInclude[]).Limit(int).Count(bool).Start(string).End(string).Sort(List<string>).Async()
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
Set | List<PNChannelMembersSet > | Optional | List of channels (as [PNChannelMembersSet ] to set for membership. | |
Channel | string | Yes | Channel name. | |
Include | PNChannelMembersInclude[] | Optional | List of additional/complex UUID attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes. Available values: PNChannelMembersIncludeIncludeCustom ,PNChannelMembersIncludeChannel ,PNChannelMembersIncludeChannelCustom . | |
Limit | int | Optional | 100 | Number of objects to return in response. Default is 100 , which is also the maximum value. |
Count | bool | Optional | false | Request Count to be included in paginated response. By default, Count is omitted. |
Start | string | Optional | null | Previously-returned cursor bookmark for fetching the next page. |
End | string | Optional | null | Previously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter. |
Filter | string | Optional | null | Expression used to filter the results. Only objects whose properties satisfy the given expression are returned. The filter language is defined here In addition to custom attributes, the expressions can refer to attributes on associated entities one level deep (that is, the association and its target entities). |
Sort | List<string> | Optional | null | List of properties to sort by. Available options are id , name , and updated . Use asc or desc to specify sort direction. For example: {name: 'asc'} |
Basic Usage
PNChannelMembersSet input = new PNChannelMembersSet();
input.UUID = new PNChannelMembersUUID {
ID = uuidMetadataid
};
pubnub.SetChannelMembers().Channel("testchannel").Set(new List<PNChannelMembersSet> { input }).Async((result, status) => {
Debug.Log("result.Next:" + result.Next);
Debug.Log("result.Prev:" + result.Prev);
Debug.Log("result.TotalCount:" + result.TotalCount);
foreach (PNMembers mem in result.Data)
{
Debug.Log(mem.UUID.ID);
Debug.Log(mem.UUID.Name);
Debug.Log(mem.UUID.Email);
Debug.Log(mem.UUID.ExternalID);
Debug.Log(mem.UUID.ProfileURL);
show all 19 linesResponse
The SetChannelMembers()
operation returns a type PNManageChannelMembersResult
.
PNManageChannelMembersResult
Property Name | Type | Description |
---|---|---|
Data | List<PNMembers > | Details of type PNMembers are here |
TotalCount | long | Total count of objects without pagination. |
Next | string | Cursor bookmark for fetching next page. |
Prev | string | Cursor bookmark for fetching next page. |
Remove Channel Members
Description
Remove members from a Channel.
Method(s)
To Remove Channel Members
you can use the following method(s) in the Unity V4 SDK:
pubnub.RemoveChannelMembers().Channel(string).Remove( List<PNChannelMembersRemove>).Include(PNChannelMembersInclude[]).Limit(int).Count(bool).Start(string).End(string).Sort(List<string>).Async()
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
Remove | List<PNChannelMembersRemove > | Optional | List of channels (as [PNChannelMembersRemove ] to remove a membership for. | |
Channel | string | Yes | Channel name. | |
Include | PNChannelMembersInclude[] | Optional | List of additional/complex UUID attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes. Available values: PNChannelMembersIncludeIncludeCustom ,PNChannelMembersIncludeChannel ,PNChannelMembersIncludeChannelCustom . | |
Limit | int | Optional | 100 | Number of objects to return in response. Default is 100 , which is also the maximum value. |
Count | bool | Optional | false | Request Count to be included in paginated response. By default, Count is omitted. |
Start | string | Optional | null | Previously-returned cursor bookmark for fetching the next page. |
End | string | Optional | null | Previously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter. |
Filter | string | Optional | null | Expression used to filter the results. Only objects whose properties satisfy the given expression are returned. The filter language is defined here In addition to custom attributes, the expressions can refer to attributes on associated entities one level deep (that is, the association and its target entities). |
Sort | List<string> | Optional | null | List of properties to sort by. Available options are id , name , and updated . Use asc or desc to specify sort direction. For example: {name: 'asc'} |
Basic Usage
PNChannelMembersRemove inputRm = new PNChannelMembersRemove();
inputRm.UUID = new PNChannelMembersUUID {
ID = uuidMetadataid
};;
pubnub.RemoveChannelMembers().Channel("testchannel").Remove(new List<PNChannelMembersRemove> { inputRm }).Async((result, status) => {
foreach (PNMembers mem in result.Data)
{
Debug.Log("result.Next:" + result.Next);
Debug.Log("result.Prev:" + result.Prev);
Debug.Log("result.TotalCount:" + result.TotalCount);
foreach (PNMembers mem in result.Data)
{
Debug.Log(mem.UUID.ID);
Debug.Log(mem.UUID.Name);
show all 23 linesResponse
The RemoveChannelMembers()
operation returns a type PNManageChannelMembersResult
. Details of type PNManageChannelMembersResult
can be found here
Manage Channel Members
Description
Manage the members of a channel.
Method(s)
To Manage Channel Members
you can use the following method(s) in the Unity V4 SDK:
pubnub.ManageChannelMembers().Channel(string).Set(List<PNChannelMembersSet>).Remove( List<PNChannelMembersRemove>).Include(PNChannelMembersInclude[]).Limit(int).Count(bool).Start(string).End(string).Sort(List<string>).Async()
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
Set | List<PNChannelMembersSet > | Optional | List of channels (as [PNChannelMembersSet ] to set for membership. | |
Remove | List<PNChannelMembersRemove > | Optional | List of channels (as [PNChannelMembersRemove ] to remove a membership for. | |
Channel | string | Yes | Channel name. | |
Include | PNChannelMembersInclude[] | Optional | List of additional/complex UUID attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes. Available values: PNChannelMembersIncludeIncludeCustom ,PNChannelMembersIncludeChannel ,PNChannelMembersIncludeChannelCustom . | |
Limit | int | Optional | 100 | Number of objects to return in response. Default is 100 , which is also the maximum value. |
Count | bool | Optional | false | Request Count to be included in paginated response. By default, Count is omitted. |
Start | string | Optional | null | Previously-returned cursor bookmark for fetching the next page. |
End | string | Optional | null | Previously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter. |
Filter | string | Optional | null | Expression used to filter the results. Only objects whose properties satisfy the given expression are returned. The filter language is defined here In addition to custom attributes, the expressions can refer to attributes on associated entities one level deep (that is, the association and its target entities). |
Sort | List<string> | Optional | null | List of properties to sort by. Available options are id , name , and updated . Use asc or desc to specify sort direction. For example: {name: 'asc'} |
Basic Usage
PNChannelMembersSet input = new PNChannelMembersSet();
input.UUID = new PNChannelMembersUUID {
ID = uuidMetadataid
};
pubnubObjects.ManageChannelMembers().Channel("testchannel").Set(new List<PNChannelMembersSet> { input }).Remove(new List<PNChannelMembersRemove> { }).Async((result, status) => {
foreach (PNMembers mem in result.Data)
{
Debug.Log("result.Next:" + result.Next);
Debug.Log("result.Prev:" + result.Prev);
Debug.Log("result.TotalCount:" + result.TotalCount);
foreach (PNMembers mem in result.Data)
{
Debug.Log(mem.UUID.ID);
Debug.Log(mem.UUID.Name);
show all 23 linesResponse
The ManageChannelMembers()
operation returns a type PNManageChannelMembersResult
. Details of type PNManageChannelMembersResult
can be found here
Objects Filtering Language Definition
The filtering language for Objects is similar to the stream filtering language.
Note the following:
Date/time properties, such as
updated
, must be compared to valid date/time strings formatted according to ISO 8601.The LIKE operator supports wildcards denoted by the
*
character. A wildcard matches any sequence of arbitrary Unicode characters, including the empty sequence. The literal asterisk is matched when escaped using the backslash (\
) character.Values used with LIKE must be properly encoded just like any other string value. Thus, in order to escape an asterisk, the raw value must contain
\\*
.The entire expression must be properly URL-encoded when used in the query string.
Custom property filtering
You can't filter by custom properties.
<expression> ::= <and_expression> ( "||" <and_expression> )*
<and_expression> ::= <binary_condition> ( "&&" <binary_condition> )*
<binary_condition> ::= "!" <binary_condition> | "(" <expression> ")" | <relational_condition>
<relational_condition> ::= <property_path> <relational_operator> <value>
<property_path> ::= <property_name> ( "." <property_name> )*
<property_name> ::= <identifier> | "[" <string> "]"
<value> ::= <string> | <number> | "true" | "false" | "null"
Tokens
<identifier> ::= <letter> | "$" | "_" ( <letter> | "$" | "_" | <digit> )*
<relational_operator> ::= "==" | "!=" | "<=" | ">=" | "<" | ">" | "LIKE"
<string> ::= <double_quote> ( "\" <double_quote> | "\" <special_char>
| "\" "u" <hex_digit> <hex_digit> <hex_digit> <hex_digit>
| <unicode_char> - <double_quote> - "\" )* <double_quote>
show all 26 linesSample object filtering operations
The following date/time comparison returns results that were modified on or after August 31st, 2019 (UTC):
updated >= "2019-08-31T00:00:00Z"
The following wildcard expression returns results whose name starts with the letter X:
name LIKE 'X*'
The following escaped wildcard expression returns results whose name contains an asterisk:
name LIKE '*\\**'