PubNub LogoDocs
SupportContact SalesLoginTry Our APIs

›API Reference

unity

  • Getting Started
  • API Reference

    • Configuration
    • Publish & Subscribe
    • Presence
    • Access Manager
    • Channel Groups
    • Message Persistence
    • Mobile Push
    • Objects
    • Files
    • Message Actions
    • Miscellaneous
  • Status Events
  • Troubleshooting
  • Change Log
  • Feature Support
  • Platform Support

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:

  1. pubnub.GetAllUUIDMetadata() .Include(PNUUIDMetadataInclude[]) .Limit(int) .Start(string) .End(string) .Filter(string) .Sort(List<string>) .Count(boolean) .Async()
    
    ParameterTypeRequiredDefaultDescription
    IncludePNUUIDMetadataInclude[]OptionalList of additional/complex UUID attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes. Available values: PNUUIDMetadataIncludeCustom
    LimitintOptional100Number of objects to return in response. Default is 100, which is also the maximum value.
    IncludeCountboolOptionalfalseRequest Count to be included in paginated response. By default, Count is omitted.
    StartstringOptionalnullPreviously-returned cursor bookmark for fetching the next page.
    EndstringOptionalnullPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
    FilterstringOptionalnullExpression 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).
    SortListOptionalnullList 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);
            }
        }
});

Response

The GetAllUUIDMetadata() operation returns a type PNGetAllUUIDMetadataResult which contains the following properties:

Property NameTypeDescription
DataListDetails of type PNUUIDMetadataResult are here
TotalCountlongTotal count of objects without pagination.
NextstringCursor bookmark for fetching next page.
PrevstringCursor 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:

  1. pubnub.GetUUIDMetadata().UUID(string).Async()
    
    ParameterTypeRequiredDefaultDescription
    UUIDstringYespubnub.configuration.uuidUnique UUID Metadata identifier. If not supplied, then UUID from configuration will be used.
    IncludePNUUIDMetadataInclude[]OptionalList 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 NameTypeDescription
IDstringUnique user identifier. If not supplied then current user's uuid is used.
NamestringDisplay name for the user. Maximum 200 characters.
ExternalIDstringUser's identifier in an external system.
ProfileURLstringThe URL of the user's profile picture.
EmailstringThe user's email address. Maximum 80 characters.
CustomDictionary<string, object>JSON object of key-value pairs with supported data types.
UpdatedstringLast updated date.
ETagstringThe 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:

  1. pubnub.SetUUIDMetadata().Email(string).ExternalID(string).Name(string).UUID(string).ProfileURL(string).Custom(Dictionary<string, object>).Include(PNUUIDMetadataInclude[]).Async()
    
    ParameterTypeRequiredDefaultDescription
    IncludePNUUIDMetadataInclude[]OptionalList of additional/complex UUID attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes. Available values: PNUUIDMetadataIncludeCustom
    UUIDstringYesnullUnique user identifier. If not supplied then current user's uuid is used.
    NamestringYesnullDisplay name for the user. Maximum 200 characters.
    ExternalIdstringOptionalnullUser's identifier in an external system
    ProfileUrlstringOptionalnullThe URL of the user's profile picture
    EmailstringOptionalnullThe user's email address. Maximum 80 characters.
    CustomDictionary<string, object>OptionalnullAny object of key-value pairs with supported data types. Objects filtering language doesn’t support filtering by custom properties.
    IncludePNUUIDMetadataInclude[]OptionalList 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:

  1. pubnub.RemoveUUIDMetadata().UUID(string).Async()
    
    ParameterTypeRequiredDescription
    UUIDstringOptionalUnique 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:

  1. pubnub.GetAllChannelMetadata().Include(PNChannelMetadataInclude[]).Start(string).End(string).Limit(int).Count(bool).Filter(string).Sort(List<string>).Async()
    
    ParameterTypeRequiredDefaultDescription
    IncludePNChannelMetadataInclude[]OptionalList of additional/complex channel attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes. Available values: PNChannelMetadataIncludeCustom
    LimitintOptional100Number of objects to return in response. Default is 100, which is also the maximum value.
    CountboolOptionalfalseRequest Count to be included in paginated response. By default, Count is omitted.
    StartstringOptionalnullPreviously-returned cursor bookmark for fetching the next page.
    EndstringOptionalnullPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
    FilterstringOptionalnullExpression 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).
    SortListOptionalnullList 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 NameTypeDescription
DataListDetails of type PNChannelMetadataResult are here
TotalCountlongTotal count of objects without pagination.
NextstringCursor bookmark for fetching next page.
PrevstringCursor 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:

  1. pubnub.GetChannelMetadata().Channel(string).Include(PNChannelMetadataInclude).Async()
    
    ParameterTypeRequiredDefaultDescription
    ChannelstringYesChannel name.
    IncludePNChannelMetadataInclude[]OptionalList 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 NameTypeDescription
IDstringUnique user identifier. If not supplied then current user's uuid is used.
NamestringDisplay name of the channel. Maximum 200 characters.
DescriptionstringDescription of the channel. Maximum 80 characters.
CustomDictionary<string, object>JSON object of key-value pairs with supported data types.
UpdatedstringLast updated date.
ETagstringThe 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:

  1. pubnub.SetChannelMetadata().Name(string).Channel(string).Include(PNChannelMetadataInclude[]).Custom(Dictionary<string, object>).Description(string).Async()
    
    ParameterTypeRequiredDefaultDescription
    IncludePNChannelMetadataInclude[]OptionalList of additional/complex channel attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes. Available values: PNChannelMetadataIncludeCustom
    ChannelstringYesChannel Metadata identifier.
    NamestringOptionalName of a channel.
    DescriptionstringOptionalDescription of a channel.
    CustomDictionary<string, object>OptionalnullAny 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:

  1. pubnub.RemoveChannelMetadata().Channel(string).Async()
    
    ParameterTypeRequiredDefaultDescription
    ChannelstringYesChannel 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:

  1. pubnub.GetMemberships().UUID(string).Include(PNMembershipsInclude[]).Start(string).End(string).Limit(int).Count(bool).Filter(string).Sort(List<string>).Async()
    
    ParameterTypeRequiredDefaultDescription
    UUIDstringOptionalUnique user identifier. If not supplied then current user's UUID is used.
    IncludePNMembershipsInclude[]OptionalList 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.
    LimitintOptional100Number of objects to return in response. Default is 100, which is also the maximum value.
    CountboolOptionalfalseRequest Count to be included in paginated response. By default, Count is omitted.
    StartstringOptionalnullPreviously-returned cursor bookmark for fetching the next page.
    EndstringOptionalnullPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
    FilterstringOptionalnullExpression 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).
    SortListOptionalnullList 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:

  1. Property NameTypeDescription
    DataListDetails of type PNMemberships are here
    TotalCountlongTotal count of objects without pagination.
    NextstringCursor bookmark for fetching next page.
    PrevstringCursor bookmark for fetching prev page.

PNMemberships

Property NameTypeDescription
IDstringUnique user identifier. If not supplied then current user's UUID is used.
ChannelPNChannelMetadataResultDisplay name for the user. Maximum 200 characters.
CreatedstringCreated date.
CustomDictionary<string, object>JSON object of key-value pairs with supported data types.
UpdatedstringLast updated date.
ETagstringThe 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:

  1. pubnub.SetMemberships().Include(PNMembershipsInclude[]).UUID(string).Set(List<PNMembershipsSet>).Limit(int).Count(bool).Start(string).End(string).Sort(List<string>).Async()
    
    ParameterTypeRequiredDefaultDescription
    SetListOptionalList of channels (as [PNMembershipsSet] to set for membership.
    UUIDstringOptionalUnique user identifier. If not supplied then current user's UUID is used.
    IncludePNMembershipsInclude[]OptionalList 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.
    LimitintOptional100Number of objects to return in response. Default is 100, which is also the maximum value.
    CountboolOptionalfalseRequest Count to be included in paginated response. By default, Count is omitted.
    StartstringOptionalnullPreviously-returned cursor bookmark for fetching the next page.
    EndstringOptionalnullPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
    SortListOptionalnullList 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);
            Debug.Log(mem.Channel.ID);
        }
    });

Response

The SetMemberships() operation returns a PNSetMembershipsResult which contains the following parameters:

PNManageMembershipsResult
  1. Property NameTypeDescription
    DataListDetails of type PNMemberships are here
    TotalCountlongTotal count of objects without pagination.
    NextstringCursor bookmark for fetching next page.
    PrevstringCursor 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:

  1. pubnub.RemoveMemberships().UUID(string).Remove(List<PNMembershipsRemove>).Include(PNMembershipsInclude[]).Limit(int).Count(bool).Async()
    
    ParameterTypeRequiredDefaultDescription
    RemoveListOptionalList of channels (as [PNMembershipsRemove] to remove membership for.
    UUIDstringOptionalUnique user identifier. If not supplied then current user's UUID is used.
    IncludePNMembershipsInclude[]OptionalList 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.
    LimitintOptional100Number of objects to return in response. Default is 100, which is also the maximum value.
    CountboolOptionalfalseRequest 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);
            Debug.Log(mem.Channel.ID);
        }
    });

Response

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:

  1. pubnub.ManageMemberships().UUID(string).Set(List<PNMembershipsSet>.Remove(List<PNMembershipsRemove>).Include(PNMembershipsInclude[]).Limit(int).Count(bool).Async()
    
    ParameterTypeRequiredDefaultDescription
    SetListOptionalList of channels (as [PNMembershipsSet] to set for membership.
    RemoveListOptionalList of channels (as [PNMembershipsRemove] to remove membership for.
    UUIDstringOptionalUnique user identifier. If not supplied then current user's UUID is used.
    IncludePNMembershipsInclude[]OptionalList 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.
    LimitintOptional100Number of objects to return in response. Default is 100, which is also the maximum value.
    CountboolOptionalfalseRequest 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);
            Debug.Log(mem.Channel.ID);
        }

    });

Response

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:

  1. pubnub.GetChannelMembers().Channel(string).Include(PNChannelMembersInclude[]).Limit(int).Start(string).End(string).Count(bool).Filter(string).Sort(List<string>).Async()
    
    ParameterTypeRequiredDefaultDescription
    IncludePNChannelMembersInclude[]OptionalList 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.
    LimitintOptional100Number of objects to return in response. Default is 100, which is also the maximum value.
    IncludeCountboolOptionalfalseRequest Count to be included in paginated response. By default, Count is omitted.
    StartstringOptionalnullPreviously-returned cursor bookmark for fetching the next page.
    EndstringOptionalnullPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
    FilterstringOptionalnullExpression 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).
    SortListOptionalfalseList 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 NameTypeDescription
IDstringUnique user identifier. If not supplied then current user's uuid is used.
DataListDetails of type PNMembers are here
TotalCountlongTotal count of objects without pagination.
NextstringCursor bookmark for fetching next page.
PrevstringCursor bookmark for fetching next page.

PNMembers

Property NameTypeDescription
UUIDPNUUIDMetadataResultDetails 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:

  1. pubnub.SetChannelMembers().Channel(string).Set( List<PNChannelMembersSet>).Include(PNChannelMembersInclude[]).Limit(int).Count(bool).Start(string).End(string).Sort(List<string>).Async()
    
    ParameterTypeRequiredDefaultDescription
    SetListOptionalList of channels (as [PNChannelMembersSet] to set for membership.
    ChannelstringYesChannel name.
    IncludePNChannelMembersInclude[]OptionalList 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.
    LimitintOptional100Number of objects to return in response. Default is 100, which is also the maximum value.
    CountboolOptionalfalseRequest Count to be included in paginated response. By default, Count is omitted.
    StartstringOptionalnullPreviously-returned cursor bookmark for fetching the next page.
    EndstringOptionalnullPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
    FilterstringOptionalnullExpression 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).
    SortListOptionalnullList 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);
        Debug.Log(mem.UUID.ID);
        Debug.Log(mem.UUID.ETag);
    }
});

Response

The SetChannelMembers() operation returns a type PNManageChannelMembersResult.

PNManageChannelMembersResult

Property NameTypeDescription
DataListDetails of type PNMembers are here
TotalCountlongTotal count of objects without pagination.
NextstringCursor bookmark for fetching next page.
PrevstringCursor 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:

  1. pubnub.RemoveChannelMembers().Channel(string).Remove( List<PNChannelMembersRemove>).Include(PNChannelMembersInclude[]).Limit(int).Count(bool).Start(string).End(string).Sort(List<string>).Async()
    
    ParameterTypeRequiredDefaultDescription
    RemoveListOptionalList of channels (as [PNChannelMembersRemove] to remove a membership for.
    ChannelstringYesChannel name.
    IncludePNChannelMembersInclude[]OptionalList 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.
    LimitintOptional100Number of objects to return in response. Default is 100, which is also the maximum value.
    CountboolOptionalfalseRequest Count to be included in paginated response. By default, Count is omitted.
    StartstringOptionalnullPreviously-returned cursor bookmark for fetching the next page.
    EndstringOptionalnullPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
    FilterstringOptionalnullExpression 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).
    SortListOptionalnullList 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);
                Debug.Log(mem.UUID.Email);
                Debug.Log(mem.UUID.ExternalID);
                Debug.Log(mem.UUID.ProfileURL);
                Debug.Log(mem.UUID.ID);
                Debug.Log(mem.UUID.ETag);
            }
        }
    });

Response

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:

  1. pubnub.ManageChannelMembers().Channel(string).Set(List<PNChannelMembersSet>).Remove( List<PNChannelMembersRemove>).Include(PNChannelMembersInclude[]).Limit(int).Count(bool).Start(string).End(string).Sort(List<string>).Async()
    
    ParameterTypeRequiredDefaultDescription
    SetListOptionalList of channels (as [PNChannelMembersSet] to set for membership.
    RemoveListOptionalList of channels (as [PNChannelMembersRemove] to remove a membership for.
    ChannelstringYesChannel name.
    IncludePNChannelMembersInclude[]OptionalList 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.
    LimitintOptional100Number of objects to return in response. Default is 100, which is also the maximum value.
    CountboolOptionalfalseRequest Count to be included in paginated response. By default, Count is omitted.
    StartstringOptionalnullPreviously-returned cursor bookmark for fetching the next page.
    EndstringOptionalnullPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
    FilterstringOptionalnullExpression 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).
    SortListOptionalnullList 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);
                Debug.Log(mem.UUID.Email);
                Debug.Log(mem.UUID.ExternalID);
                Debug.Log(mem.UUID.ProfileURL);
                Debug.Log(mem.UUID.ID);
                Debug.Log(mem.UUID.ETag);
            }
        }
    });

Response

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>
                            | "'" ( "\" "'" | "\" <special_char>
                            | "\" "u" <hex_digit> <hex_digit> <hex_digit> <hex_digit>
                            | <unicode_char> - "'" - "\" )* "'"
<number>               ::= ( "+" | "-" )? ( <digit> )* ( "." )? <digit> ( <digit> )*
                            ( "e" | "E" ( "+" | "-" )? <digit> ( <digit> )* )?
<letter>               ::= Unicode Letter (category; any kind of letter from any language)
<digit>                ::= "0" .. "9"
<hex_digit>            ::= <digit> | "A" .. "F"
<double_quote>         ::= the " character
<unicode_char>         ::= any character in the Unicode range from U+0020 to U+10FFFF inclusive
<special_char>         ::= "\" | "/" | "b" | "f" | "n" | "r" | "t"

Sample 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 '*\\**'
← Mobile PushFiles →
  • User
    • Get Metadata for All Users
    • Get User Metadata
    • Set User Metadata
    • Remove User Metadata
  • Channel
    • Get Metadata for All Channels
    • Get Channel Metadata
    • Set Channel Metadata
    • Remove Channel Metadata
  • Channel Memberships
    • Get Channel Memberships
    • Set Channel Memberships
    • Remove Channel Memberships
    • Manage Channel Memberships
  • Channel Members
    • Get Channel Members
    • Set Channel Members
    • Remove Channel Members
    • Manage Channel Members
  • Objects Filtering Language Definition
    • Sample object filtering operations
© PubNub Inc. - Privacy Policy