GoGo V4 Objects (BETA) API Reference for Realtime Apps

This page describes the new Objects v2(beta). To upgrade from Objects v1, refer to the migration guide.
 

These docs are for PubNub 4.0 for Go which is our latest and greatest! For the docs of the older versions of the SDK, please check PubNub 3.0 for Go.

If you have questions about the PubNub for Go SDK, please contact us at support@pubnub.com.

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 realtime and update their front-end application accordingly.

 Objects is an optional feature, currently in a BETA release.

Returns a paginated list of UUID Metadata objects, optionally including the custom data object for each.

  1. ParameterTypeRequiredDescription
    LimitintOptionalNumber of objects to return in response. Default is 100, which is also the maximum value.
    CountboolOptionalRequest Count to be included in paginated response. By default, Count is omitted.
    StartstringOptionalPreviously-returned cursor bookmark for fetching the next page.
    EndstringOptionalPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
    FilterstringOptionalExpression 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).
    Include[]pubnub.PNUUIDMetadataIncludeOptionalList of additional/complex UUID attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes.

    Available values:
    pubnub.PNUUIDMetadataIncludeCustom
incl := []pubnub.PNUUIDMetadataInclude{
        pubnub.PNUUIDMetadataIncludeCustom,
    }
 
res, status, err := pn.GetAllUUIDMetadata().Include(incl).Sort(sort).Limit(100).Count(true).Execute()

The GetAllUUIDMetadata() operation returns a PNGetAllChannelMetadataResponse which contains the following parameters:

  1. Property NameTypeDescription
    Data[]PNUUIDDetails of type PNUUID are here.
    TotalCountintTotal count of objects without pagination.
    NextstringCursor bookmark for fetching next page.
    PrevstringCursor bookmark for fetching prev page.

Returns metadata for the specified UUID, optionally including the custom data object for each.

  1. ParameterTypeRequiredDescription
    IDstringYesUnique user identifier. If not supplied then current user’s uuid is used.
    Include[]pubnub.PNUUIDMetadataIncludeCustomOptionalList of additional/complex UUID attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes.

    Available values:
    pubnub.PNUUIDMetadataIncludeCustom
id := "testuuid" 
incl := []pubnub.PNUUIDMetadataInclude{
        pubnub.PNUUIDMetadataIncludeCustom,
    }
res, status, err := pn.GetUUIDMetadata().UUID(id).Include(incl).Execute()
fmt.Println(res, status, err)

The GetUUIDMetadata() operation returns a PNGetUUIDMetadataResponse which contains the following parameters:

  1. Property NameTypeDescription
    DataPNUUIDDetails of type PNUUID are here.

Set metadata for a UUID in the database, optionally including the custom data object for each.

  1. ParameterTypeRequiredDescription
    IDstringYesUnique user identifier. If not supplied then current user’s uuid is used.
    NamestringYesDisplay name for the user.
    Maximum 200 characters.
    ExternalIDstringOptionalUser's identifier in an external system
    ProfileURLstringOptionalThe URL of the user's profile picture
    EmailstringOptionalThe user's email address.
    Maximum 80 characters.
    Custommap[string]interface{}OptionalJSON object of key-value pairs with supported data types.
    Include[]pubnub.PNUUIDMetadataIncludeOptionalList of additional/complex UUID attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes.

    Available values:
    pubnub.PNUUIDMetadataIncludeCustom
id := "testuuid" 
name := "name" 
extid := "extid"
purl := "profileurl"
email := "email"
 
custom := make(map[string]interface{})
custom["a"] = "b"
custom["c"] = "d"
 
incl := []pubnub.PNUUIDMetadataInclude{
        pubnub.PNUUIDMetadataIncludeCustom,
	}
 
res, status, err := pn.SetUUIDMetadata().Include(incl).UUID(id).Name(name).ExternalID(extid).ProfileURL(purl).Email(email).Custom(custom).Execute()
fmt.Println(res, status, err)

The SetUUIDMetadata() operation returns a PNSetUUIDMetadataResponse which contains the following parameters:

  1. Property NameTypeDescription
    DataPNUUIDDetails of type PNUUID are here.
  1. 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.
    Custommap[string]interfaceJSON object of key-value pairs with supported data types.
    UpdatedstringLast updated date.
    ETagstringThe ETag.

Removes the metadata from a specified UUID.

  1. ParameterTypeRequiredDescription
    IDstringYesUnique user identifier. If not supplied then current user’s uuid is used.
id := "testuuid" 
res, status, err := pn.RemoveUUIDMetadata().UUID(id).Execute() 
fmt.Println(res, status, err)

The RemoveUUIDMetadata() operation returns a PNRemoveUUIDMetadataResponse which contains the following parameters:

  1. Property NameTypeDescription
    Datainterface{}Returns an empty interface.

Returns a paginated list of Channel Metadata objects, optionally including the custom data object for each.

  1. ParameterTypeRequiredDescription
    LimitintOptionalNumber of objects to return in response. Default is 100, which is also the maximum value.
    CountboolOptionalRequest Count to be included in paginated response. By default, Count is omitted.
    StartstringOptionalPreviously-returned cursor bookmark for fetching the next page.
    EndstringOptionalPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
    FilterstringOptionalExpression 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).
    Include[]pubnub.PNChannelMetadataIncludeOptionalList of additional/complex space attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes.

    Available values:
    pubnub.PNChannelMetadataIncludeCustom
incl := []pubnub.PNChannelMetadataInclude{
        pubnub.PNChannelMetadataIncludeCustom,
    } 
res, status, err := pn.GetAllChannelMetadata().Include(incl).Sort(sort).Limit(100).Count(true).Execute()
fmt.Println(res, status, err)

The GetAllChannelMetadata() operation returns a PNGetAllChannelMetadataResponse which contains the following parameters:

  1. Property NameTypeDescription
    Data[]PNChannelDetails of type PNChannel are here.
    TotalCountintTotal count of objects without pagination.
    NextstringCursor bookmark for fetching next page.
    PrevstringCursor bookmark for fetching prev page.

Returns metadata for the specified Channel, optionally including the custom data object for each.

  1. ParameterTypeRequiredDescription
    IDstringYesUnique user identifier. If not supplied then current user’s uuid is used.
    Include[]pubnub.PNChannelMetadataIncludeOptionalList of additional/complex space attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes.

    Available values:
    pubnub.PNChannelMetadataIncludeCustom
id := "testchannel" 
incl := []pubnub.PNChannelMetadataInclude{
        pubnub.PNChannelMetadataIncludeCustom,
    } 
res, status, err := pn.GetChannelMetadata().Include(incl).Channel(id).Execute()
fmt.Println(res, status, err)

The GetChannelMetadata() operation returns a PNGetChannelMetadataResponse which contains the following parameters:

  1. Property NameTypeDescription
    DataPNChannelDetails of type PNChannel are here.

Set metadata for a Channel in the database, optionally including the custom data object for each.

  1. ParameterTypeRequiredDescription
    IDstringYesUnique user identifier. If not supplied then current user’s uuid is used.
    NamestringYesName of a channel.
    DescriptionstringOptionalDescription of a channel.
    Custommap[string]interface{}OptionalMap of string and interface with supported data types. Values must be scalar only; arrays or objects are not supported.
    Include[]pubnub.PNChannelMetadataIncludeOptionalList of additional/complex space attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes.

    Available values:
    pubnub.PNChannelMetadataIncludeCustom
id := "testchannel" 
name := "name" 
desc := "desc" 
custom := make(map[string]interface{}) custom["a"] = "b" custom["c"] = "d"
incl := []pubnub.PNChannelMetadataInclude{
        pubnub.PNChannelMetadataIncludeCustom,
    }
res, status, err := pn.SetChannelMetadata().Include(incl).Channel(id).Name(name).Description(desc).Custom(custom).Execute()

The SetChannelMetadata() operation returns a PNSetChannelMetadataResponse which contains the following parameters:

  1. Property NameTypeDescription
    DataPNChannelDetails of type PNChannel are here.
  1. Property NameTypeDescription
    IDstringUnique user identifier. If not supplied then current user’s uuid is used.
    NamestringDisplay name for the user.
    Maximum 200 characters.
    DescriptionstringDescription of a channel.
    Custommap[string]interfaceMap of string and interface with supported data types. Values must be scalar only; arrays or objects are not supported.
    UpdatedstringLast updated date.
    ETagstringThe ETag.

Removes the metadata from a specified channel.

  1. ParameterTypeRequiredDescription
    IDstringYesUnique user identifier. If not supplied then current user’s uuid is used.
id := "testchannel" 
res, status, err := pn.RemoveChannelMetadata().Channel(id).Execute()

The RemoveChannelMetadata() operation returns a PNRemoveChannelMetadataResponse which contains the following parameters:

  1. Property NameTypeDescription
    Datainterface{}Returns an empty interface.

The method returns a list of channel memberships for a user. This method doesn't return a user's subscriptions.

  1. ParameterTypeRequiredDescription
    UUIDstringYesUnique user identifier. If not supplied then current user’s uuid is used.
    LimitintOptionalNumber of objects to return in response. Default is 100, which is also the maximum value.
    CountboolOptionalRequest Count to be included in paginated response. By default, Count is omitted.
    StartstringOptionalPreviously-returned cursor bookmark for fetching the next page.
    EndstringOptionalPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
    FilterstringOptionalExpression 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).
    Include[]pubnub.PNMembershipsIncludeOptionalList of additional/complex attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes.

    Available values:
    pubnub.PNMembershipsIncludeCustom, pubnub.PNMembershipsIncludeChannel, pubnub.PNMembershipsIncludeChannelCustom
inclMemberships := []pubnub.PNMembershipsInclude{
        pubnub.PNMembershipsIncludeCustom,
        pubnub.PNMembershipsIncludeChannel,
        pubnub.PNMembershipsIncludeChannelCustom,
    }
 
res, status, err := pn.GetMemberships().UUID("testuuid").Include(inclMemberships).Limit(100).Count(true).Execute()

The GetMemberships() operation returns a PNGetMembershipsResponse which contains the following parameters:

  1. Property NameTypeDescription
    Data[]PNMembershipsDetails of type PNMemberships are here.
    TotalCountintTotal count of objects without pagination.
    NextstringCursor bookmark for fetching next page.
    PrevstringCursor bookmark for fetching prev page.
  1. Property NameTypeDescription
    IDstringUnique user identifier. If not supplied then current user’s uuid is used.
    ChannelPNChannelDetails of type PNChannel are here.
    Custommap[string]interfaceMap of string and interface with supported data types.
    UpdatedstringLast updated date.
    ETagstringThe ETag.

Set channel memberships for a UUID.

  1. ParameterTypeRequiredDescription
    UUIDstringYesUnique user identifier. If not supplied then current user’s uuid is used.
    Setpubnub.PNMembershipsSetOptionalStruct of type pubnub.PNMembershipsSet to be added for the specified UUID. In PNMembershipsSet you can set the Channel (of type PNMembershipsChannel - consisting of an ID of string type ) and a Custom map.
    LimitintOptionalMaximum number of results to return per page.
    Default 100.
    CountboolOptionalRequest TotalCount to be included in paginated response. Default false
    StartstringOptionalPreviously-returned cursor bookmark for fetching the next page.
    EndstringOptionalPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
    Include[]pubnub.PNMembershipsIncludeOptionalList of additional/complex attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes.

    Available values:
    pubnub.PNMembershipsIncludeCustom, pubnub.PNMembershipsIncludeChannel, pubnub.PNMembershipsIncludeChannelCustom
inclMemberships := []pubnub.PNMembershipsInclude{
        pubnub.PNMembershipsIncludeCustom,
        pubnub.PNMembershipsIncludeChannel,
        pubnub.PNMembershipsIncludeChannelCustom,
    }
 
custom := make(map[string]interface{})
custom["a"] = "b"
custom["c"] = "d"
channel := pubnub.PNMembershipsChannel{
        ID: "testchannel",
    }
 
inMem := pubnub.PNMembershipsSet{
        ID: channel,
        Custom: custom,
    }
inArrMem := []pubnub.PNMembershipsSet{
        inMem,
}
 
res, status, err := pn.SetMemberships().UUID("testuuid").Set(inArrMem).Include(inclMemberships).Limit(100).Count(true).Execute()
fmt.Println(res, status, err)

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

  1. Property NameTypeDescription
    Data[]PNMembershipsDetails of type PNMemberships are here.
    TotalCountintTotal count of objects without pagination.
    NextstringCursor bookmark for fetching next page.
    PrevstringCursor bookmark for fetching prev page.

Remove channel memberships for a UUID.

  1. ParameterTypeRequiredDescription
    UUIDstringYesUnique user identifier. If not supplied then current user’s uuid is used.
    Removepubnub.PNMembershipsRemoveOptionalStruct of type pubnub.PNMembershipsRemove to be added for the specified UUID. In PNMembershipsRemove you can set the Channel (of type PNMembershipsChannel - consisting of an ID of string type ) and a Custom map.
    LimitintOptionalMaximum number of results to return per page.
    Default 100.
    CountboolOptionalRequest TotalCount to be included in paginated response. Default false
    StartstringOptionalPreviously-returned cursor bookmark for fetching the next page.
    EndstringOptionalPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
    Include[]pubnub.PNMembershipsIncludeOptionalList of additional/complex attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes.

    Available values:
    pubnub.PNMembershipsIncludeCustom, pubnub.PNMembershipsIncludeChannel, pubnub.PNMembershipsIncludeChannelCustom
inclMemberships := []pubnub.PNMembershipsInclude{
        pubnub.PNMembershipsIncludeCustom,
        pubnub.PNMembershipsIncludeChannel,
        pubnub.PNMembershipsIncludeChannelCustom,
    }
channel := pubnub.PNMembershipsChannel{
        ID: "testchannel",
    }
    reMem := pubnub.PNMembershipsRemove{
        ID: channel, 
    }
    reArrMem := []pubnub.PNMembershipsRemove{
        reMem,
    }
res, status, err := pn.RemoveMemberships().UUID("testuuid").Remove(reArrMem).Include(inclMemberships).Limit(100).Count(true).Execute()
fmt.Println(res, status, err)

The RemoveMemberships() operation returns a PNRemoveMembershipsResponse which contains the following parameters:

  1. Property NameTypeDescription
    Data[]PNMembershipsDetails of type PNMemberships are here.
    TotalCountintTotal count of objects without pagination.
    NextstringCursor bookmark for fetching next page.
    PrevstringCursor bookmark for fetching prev page.

Manage the specified UUID's memberships. You can Add, Remove, and Update a UUID's memberships.

  1. ParameterTypeRequiredDescription
    UUIDstringstringUnique user identifier. If not supplied then current user’s Uuid is used.
    Setpubnub.PNMembershipsSetOptionalStruct of type pubnub.PNMembershipsSet to be added for the specified UUID. In PNMembershipsSet you can set the Channel (of type PNMembershipsChannel - consisting of an ID of string type ) and a Custom map.
    Removepubnub.PNMembershipsRemoveOptionalStruct of type pubnub.PNMembershipsRemove to be added for the specified UUID. In PNMembershipsRemove you can set the Channel (of type PNMembershipsChannel - consisting of an ID of string type )
    LimitintOptionalMaximum number of results to return per page.
    Default 100.
    CountboolOptionalRequest TotalCount to be included in paginated response. Default false
    StartstringOptionalPreviously-returned cursor bookmark for fetching the next page.
    EndstringOptionalPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
    Include[]pubnub.PNMembershipsIncludeOptionalList of additional/complex attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes.

    Available values:
    pubnub.PNMembershipsIncludeCustom, pubnub.PNMembershipsIncludeChannel, pubnub.PNMembershipsIncludeChannelCustom
inclMemberships := []pubnub.PNMembershipsInclude{
        pubnub.PNMembershipsIncludeCustom,
        pubnub.PNMembershipsIncludeChannel,
        pubnub.PNMembershipsIncludeChannelCustom,
    }
 
custom := make(map[string]interface{})
custom["a"] = "b"
custom["c"] = "d"
    channel := pubnub.PNMembershipsChannel{
        ID: "testchannel",
    }
 
inMem := pubnub.PNMembershipsSet{
        ID: channel, 	
        Custom: custom,
    }
inArrMem := []pubnub.PNMembershipsSet{
        inMem,
}
 
res, status, err := pn.ManageMemberships().UUID("testuuid").Set(inArrMem).Remove([]pubnub.PNMembershipsRemove{}).Include(inclMemberships).Limit(100).Count(true).Execute()
fmt.Println(res, status, err)

The ManageMemberships() operation returns a PNManageMembershipsResponse which contains the following parameters:

  1. Property NameTypeDescription
    Data[]PNMembershipsDetails of type PNMemberships are here.
    TotalCountintTotal count of objects without pagination.
    NextstringCursor bookmark for fetching next page.
    PrevstringCursor bookmark for fetching prev page.

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.

  1. ParameterTypeRequiredDescription
    ChannelstringYesChannel name.
    LimitintOptionalMaximum number of results to return per page.
    Default 100.
    CountboolOptionalRequest TotalCount to be included in paginated response. Default false
    StartstringOptionalPreviously-returned cursor bookmark for fetching the next page.
    EndstringOptionalPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
    FilterstringOptionalExpression 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).
    Include[]pubnub.PNChannelMembersIncludeOptionalList of additional/complex attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes.

    Available values:
    pubnub.PNChannelMembersIncludeCustom, pubnub.PNChannelMembersIncludeUUID, pubnub.PNChannelMembersIncludeUUIDCustom
inclSm := []pubnub.PNChannelMembersInclude{
        pubnub.PNChannelMembersIncludeCustom,
        pubnub.PNChannelMembersIncludeUUID,
        pubnub.PNChannelMembersIncludeUUIDCustom,
    }
 
res, status, err := pn.GetChannelMembers().Channel("testchannel").Include(inclSm).Limit(100).Count(true).Execute()
fmt.Println(res, status, err)

The GetChannelMembers() operation returns a PNGetChannelMembersResponse which contains the following parameters:

  1. Property NameTypeDescription
    Data[]PNChannelMembersDetails of type PNChannelMembers are here.
    TotalCountintTotal count of objects without pagination.
    NextstringCursor bookmark for fetching next page.
    PrevstringCursor bookmark for fetching prev page.
  1. Property NameTypeDescription
    IDstringUnique user identifier. If not supplied then current user’s uuid is used.
    UUIDPNUUIDDetails of type PNUUID are here.
    Custommap[string]interfaceMap of string and interface with supported data types.
    UpdatedstringLast updated date.
    ETagstringThe ETag.

This method sets members in a channel.

  1. ParameterTypeRequiredDescription
    ChannelstringYesChannel name.
    Setpubnub.PNChannelMembersSetOptionalStruct of type pubnub.PNChannelMembersSet to be added for the specified space. In PNChannelMembersSet you can set the UUID (of type PNChannelMembersUUID - consisting of an ID of string type ) and a Custom map.
    LimitintOptionalMaximum number of results to return per page.
    Default 100.
    CountboolOptionalRequest TotalCount to be included in paginated response. Default false
    StartstringOptionalPreviously-returned cursor bookmark for fetching the next page.
    EndstringOptionalPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
    Include[]pubnub.PNChannelMembersIncludeOptionalList of additional/complex attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes.

    Available values:
    pubnub.PNChannelMembersIncludeCustom, pubnub.PNChannelMembersIncludeUUID, pubnub.PNChannelMembersIncludeUUIDCustom
inclSm := []pubnub.PNChannelMembersInclude{
        pubnub.PNChannelMembersIncludeCustom,
        pubnub.PNChannelMembersIncludeUUID,
        pubnub.PNChannelMembersIncludeUUIDCustom,
    }
    custom := make(map[string]interface{})
    custom["a"] = "b"
    custom["c"] = "d"
    uuid := pubnub.PNChannelMembersUUID{
        ID: "testuuid",
    }
inputUUID := pubnub.PNChannelMembersSet{
        UUID:   uuid,
        Custom: custom,
    }
 
    inArrMem := []pubnub.PNChannelMembersSet{
        inputUUID,
    }
 
res, status, err := pn.SetChannelMembers().Channel("testchannel").Set(inArrMem).Include(inclSm).Limit(100).Count(true).Execute()
fmt.Println(res, status, err)

The SetChannelMembers() operation returns a PNSetChannelMembersResponse which contains the following parameters:

  1. Property NameTypeDescription
    Data[]PNChannelMembersDetails of type PNChannelMembers are here.
    TotalCountintTotal count of objects without pagination.
    NextstringCursor bookmark for fetching next page.
    PrevstringCursor bookmark for fetching prev page.

Remove members from a Channel.

  1. ParameterTypeRequiredDescription
    ChannelstringYesChannel name.
    Removepubnub.PNChannelMembersRemoveOptionalStruct of type pubnub.PNChannelMembersRemove to be removed for the specified space. In PNChannelMembersRemove you can set the UUID (of type PNChannelMembersUUID - consisting of an ID of string type )
    LimitintOptionalMaximum number of results to return per page.
    Default 100.
    CountboolOptionalRequest TotalCount to be included in paginated response. Default false
    StartstringOptionalPreviously-returned cursor bookmark for fetching the next page.
    EndstringOptionalPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
    Include[]pubnub.PNChannelMembersIncludeOptionalList of additional/complex attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes.

    Available values:
    pubnub.PNChannelMembersIncludeCustom, pubnub.PNChannelMembersIncludeUUID, pubnub.PNChannelMembersIncludeUUIDCustom
inclSm := []pubnub.PNChannelMembersInclude{
        pubnub.PNChannelMembersIncludeCustom,
        pubnub.PNChannelMembersIncludeUUID,
        pubnub.PNChannelMembersIncludeUUIDCustom,
    }
    uuid := pubnub.PNChannelMembersUUID{
        ID: "testuuid",
    }
    re := pubnub.PNChannelMembersRemove{
        UUID: uuid,
    }
 
    reArr := []pubnub.PNChannelMembersRemove{
        re,
    }
 
 
res, status, err := pn.RemoveChannelMembers().Channel("testchannel").Remove(reArr).Include(inclSm).Limit(100).Count(true).Execute()
fmt.Println(res, status, err)

The RemoveChannelMembers() operation returns a PNRemoveChannelMembersResponse which contains the following parameters:

  1. Property NameTypeDescription
    Data[]PNChannelMembersDetails of type PNChannelMembers are here.
    TotalCountintTotal count of objects without pagination.
    NextstringCursor bookmark for fetching next page.
    PrevstringCursor bookmark for fetching prev page.

The method Set and Remove channel memberships for a user.

  1. ParameterTypeRequiredDescription
    ChannelstringYesChannel Name.
    Setpubnub.PNChannelMembersSetOptionalStruct of type pubnub.PNChannelMembersSet to be added for the specified space. In PNChannelMembersSet you can set the UUID (of type PNChannelMembersUUID - consisting of an ID of string type ) and a Custom map.
    Removepubnub.PNChannelMembersRemoveOptionalStruct of type pubnub.PNChannelMembersRemove to be removed for the specified space. In PNChannelMembersRemove you can set the UUID (of type PNChannelMembersUUID - consisting of an ID of string type )
    LimitintOptionalMaximum number of results to return per page.
    Default 100.
    CountboolOptionalRequest TotalCount to be included in paginated response. Default false
    StartstringOptionalPreviously-returned cursor bookmark for fetching the next page.
    EndstringOptionalPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
    Include[]pubnub.PNChannelMembersIncludeOptionalList of additional/complex attributes to include in response. Omit this parameter if you don't want to retrieve additional attributes.

    Available values:
    pubnub.PNChannelMembersIncludeCustom, pubnub.PNChannelMembersIncludeUUID, pubnub.PNChannelMembersIncludeUUIDCustom
inclSm := []pubnub.PNChannelMembersInclude{
        pubnub.PNChannelMembersIncludeCustom,
        pubnub.PNChannelMembersIncludeUUID,
        pubnub.PNChannelMembersIncludeUUIDCustom,
    }
    custom := make(map[string]interface{})
    custom["a"] = "b"
    custom["c"] = "d"
    uuid := pubnub.PNChannelMembersUUID{
        ID: "testuuid",
    }
inputUUID := pubnub.PNChannelMembersSet{
        UUID:   uuid,
        Custom: custom,
    }
 
    inArrMem := []pubnub.PNChannelMembersSet{
        inputUUID,
    }
 
res, status, err := pn.ManageChannelMembers().Channel("testchannel").Set(inArrMem).Remove([]pubnub.PNChannelMembersRemove{}).Include(inclSm).Limit(100).Count(true).Execute()
fmt.Println(res, status, err)

The ManageChannelMembers() operation returns a PNManageMembersResponse which contains the following parameters:

  1. Property NameTypeDescription
    Data[]PNChannelMembersDetails of type PNChannelMembers are here.
    TotalCountintTotal count of objects without pagination.
    NextstringCursor bookmark for fetching next page.
    PrevstringCursor bookmark for fetching prev page.

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.
  • Custom properties must have the same type as the value used in the expression; it is an error to compare a custom property of one type to a value of another type.
  • Objects that do not have the referenced custom property at all are excluded regardless of the operator or value used in the expression. The null value can be used to filter out objects that do or do not have the referenced custom property.
  • 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.

<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"

The following simple expression returns results whose custom property named public is equal to Boolean true.


custom.public == true

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 compound expression returns results that don't have a description, but do have a non-empty custom label or description property:


description == null && (custom.label != "" || custom.description != "")

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 '*\\**'