Skip to content

Commit

Permalink
Added membershipType to Memberships and ChannelMembers APIs
Browse files Browse the repository at this point in the history
Introduced new API with userId instead of UUID and possibility to include optional data in respons. See MemberInclude and MembershipInclude.
  • Loading branch information
marcin-cebo authored Dec 5, 2024
1 parent 51da946 commit c8ae89e
Show file tree
Hide file tree
Showing 86 changed files with 3,184 additions and 388 deletions.
2 changes: 1 addition & 1 deletion .pubnub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ changelog:
version: v10.2.0
changes:
- type: feature
text: "Publish, signal, share file, subscribe, and history."
text: "Added custom messageType for publish, signal, file, subscribe and history."
- date: 2024-11-06
version: v10.1.0
changes:
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ December 03 2024
November 18 2024

#### Added
- Publish, signal, share file, subscribe, and history.
- Added customMessageType to publish, signal, file, subscribe and history.

## v10.1.0
November 06 2024
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,20 @@ import com.pubnub.api.java.endpoints.objects_api.channel.GetChannelMetadata
import com.pubnub.api.java.endpoints.objects_api.channel.RemoveChannelMetadata
import com.pubnub.api.java.endpoints.objects_api.channel.SetChannelMetadata
import com.pubnub.api.java.endpoints.objects_api.members.GetChannelMembers
import com.pubnub.api.java.endpoints.objects_api.members.GetChannelMembersBuilder
import com.pubnub.api.java.endpoints.objects_api.members.ManageChannelMembers
import com.pubnub.api.java.endpoints.objects_api.members.ManageChannelMembersBuilder
import com.pubnub.api.java.endpoints.objects_api.members.RemoveChannelMembers
import com.pubnub.api.java.endpoints.objects_api.members.RemoveChannelMembersBuilder
import com.pubnub.api.java.endpoints.objects_api.members.SetChannelMembers
import com.pubnub.api.java.endpoints.objects_api.members.SetChannelMembersBuilder
import com.pubnub.api.java.endpoints.objects_api.memberships.GetMemberships
import com.pubnub.api.java.endpoints.objects_api.memberships.ManageMemberships
import com.pubnub.api.java.endpoints.objects_api.memberships.ManageMembershipsBuilder
import com.pubnub.api.java.endpoints.objects_api.memberships.RemoveMemberships
import com.pubnub.api.java.endpoints.objects_api.memberships.RemoveMembershipsBuilder
import com.pubnub.api.java.endpoints.objects_api.memberships.SetMemberships
import com.pubnub.api.java.endpoints.objects_api.memberships.SetMembershipsBuilder
import com.pubnub.api.java.endpoints.objects_api.uuid.GetAllUUIDMetadata
import com.pubnub.api.java.endpoints.objects_api.uuid.GetUUIDMetadata
import com.pubnub.api.java.endpoints.objects_api.uuid.RemoveUUIDMetadata
Expand All @@ -53,6 +60,8 @@ import com.pubnub.api.java.endpoints.push.AddChannelsToPush
import com.pubnub.api.java.endpoints.push.ListPushProvisions
import com.pubnub.api.java.endpoints.push.RemoveAllPushChannelsForDevice
import com.pubnub.api.java.endpoints.push.RemoveChannelsFromPush
import com.pubnub.api.java.models.consumer.objects_api.member.PNUser
import com.pubnub.api.java.models.consumer.objects_api.membership.PNChannelMembership
import com.pubnub.api.java.v2.PNConfiguration
import com.pubnub.api.java.v2.callbacks.EventEmitter
import com.pubnub.api.java.v2.callbacks.StatusEmitter
Expand Down Expand Up @@ -468,39 +477,106 @@ interface PubNub : EventEmitter, StatusEmitter {
/**
* Set channel memberships for a UUID.
*/
fun setMemberships(): SetMemberships.Builder
@Deprecated(
message = "Use setMemberships(Collection<PNChannelMembership>) instead.",
replaceWith = ReplaceWith("setMemberships(channelMemberships)")
)
fun setMemberships(): SetMemberships.Builder // add deprecation

/**
* Set channel memberships for a User.
*/
fun setMemberships(channelMemberships: Collection<PNChannelMembership>): SetMembershipsBuilder

/**
* Remove channel memberships for a UUID.
*/
@Deprecated(
message = "Use removeMemberships(Collection<PNChannelMembership>) instead.",
replaceWith = ReplaceWith("removeMemberships(channelMemberships)")
)
fun removeMemberships(): RemoveMemberships.Builder

/**
* Add and remove channel memberships for a UUID.
* Remove channel memberships for a UUID.
*/
fun removeMemberships(channelMemberships: Collection<String>): RemoveMembershipsBuilder

/**
* Add and/or remove channel memberships for a UUID.
*/
@Deprecated(
message = "Use manageMemberships(Collection<PNChannelMembership>, Collection<PNChannelMembership>) instead.",
replaceWith = ReplaceWith("manageMemberships(channelMembershipsToAdd, channelMembershipsToRemove)")
)
fun manageMemberships(): ManageMemberships.Builder

/**
* Add and/or remove channel memberships for a UUID.
*/
fun manageMemberships(
channelsToSet: Collection<PNChannelMembership>,
channelsToDelete: Collection<String>
): ManageMembershipsBuilder

/**
* 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.
*/
@Deprecated(
message = "Use getChannelMembers(String) instead.",
replaceWith = ReplaceWith("getChannelMembers(channelId)")
)
fun getChannelMembers(): GetChannelMembers.Builder

/**
* 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.
*/
fun getChannelMembers(channelId: String): GetChannelMembersBuilder

/**
* This method sets members in a channel.
*/
@Deprecated(
message = "Use setChannelMembers(String, Collection<PNUUID>) instead.",
replaceWith = ReplaceWith("setChannelMembers(channelId, channelMembers)")
)
fun setChannelMembers(): SetChannelMembers.Builder

/**
* This method sets members in a channel.
*/
fun setChannelMembers(channelId: String, channelMembers: Collection<PNUser>): SetChannelMembersBuilder

/**
* Remove members from a Channel.
*/
@Deprecated(
message = "Use removeChannelMembers(String, Collection<PNUUID>) instead.",
replaceWith = ReplaceWith("removeChannelMembers(channelId, channelMembers)")
)
fun removeChannelMembers(): RemoveChannelMembers.Builder

/**
* Remove members from a Channel.
*/
fun removeChannelMembers(channelId: String, channelMembers: Collection<String>): RemoveChannelMembersBuilder

/**
* Set or remove members in a channel.
*/
@Deprecated(
message = "Use manageChannelMembers(String, Collection<PNUUID>, Collection<PNUUID>) instead.",
replaceWith = ReplaceWith("manageChannelMembers(channelId, channelMembersToSet, channelMembersToRemove)")
)
fun manageChannelMembers(): ManageChannelMembers.Builder

/**
* Set or remove members in a channel.
*/
fun manageChannelMembers(channelId: String, set: Collection<PNUser>, remove: Collection<String>): ManageChannelMembersBuilder

/**
* Add an action on a published message. Returns the added action in the response.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.pubnub.api.java.endpoints.objects_api.utils.PNSortKey;
import com.pubnub.api.java.models.consumer.objects_api.member.PNGetChannelMembersResult;

@Deprecated
public interface GetChannelMembers extends Endpoint<PNGetChannelMembersResult> {
GetChannelMembers limit(Integer limit);

Expand All @@ -21,6 +22,7 @@ public interface GetChannelMembers extends Endpoint<PNGetChannelMembersResult> {

GetChannelMembers includeUUID(Include.PNUUIDDetailsLevel includeUUID);

@Deprecated
interface Builder extends BuilderSteps.ChannelStep<GetChannelMembers> {
@Override
GetChannelMembers channel(String channel);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.pubnub.api.java.endpoints.objects_api.members;

import com.pubnub.api.java.endpoints.Endpoint;
import com.pubnub.api.java.endpoints.objects_api.utils.PNSortKey;
import com.pubnub.api.java.models.consumer.objects_api.member.MemberInclude;
import com.pubnub.api.java.models.consumer.objects_api.member.PNGetChannelMembersResult;

public interface GetChannelMembersBuilder extends Endpoint<PNGetChannelMembersResult> {
GetChannelMembersBuilder limit(Integer limit);
GetChannelMembersBuilder page(com.pubnub.api.models.consumer.objects.PNPage page);
GetChannelMembersBuilder filter(String filter);
GetChannelMembersBuilder sort(java.util.Collection<PNSortKey> sort);
GetChannelMembersBuilder include(MemberInclude include);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.util.Collection;

@Deprecated
public interface ManageChannelMembers extends Endpoint<PNManageChannelMembersResult> {
ManageChannelMembers limit(Integer limit);

Expand All @@ -24,6 +25,7 @@ public interface ManageChannelMembers extends Endpoint<PNManageChannelMembersRes

ManageChannelMembers includeUUID(Include.PNUUIDDetailsLevel includeUUID);

@Deprecated
interface Builder extends ObjectsBuilderSteps.ChannelStep<ObjectsBuilderSteps.RemoveOrSetStep<ManageChannelMembers, PNUUID>> {
@Override
ObjectsBuilderSteps.RemoveOrSetStep<ManageChannelMembers, PNUUID> channel(String channel);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.pubnub.api.java.endpoints.objects_api.members;

import com.pubnub.api.java.endpoints.Endpoint;
import com.pubnub.api.java.endpoints.objects_api.utils.PNSortKey;
import com.pubnub.api.java.models.consumer.objects_api.member.MemberInclude;
import com.pubnub.api.java.models.consumer.objects_api.member.PNManageChannelMembersResult;

import java.util.Collection;

public interface ManageChannelMembersBuilder extends Endpoint<PNManageChannelMembersResult> {
ManageChannelMembersBuilder limit(Integer limit);
ManageChannelMembersBuilder page(com.pubnub.api.models.consumer.objects.PNPage page);
ManageChannelMembersBuilder filter(String filter);
ManageChannelMembersBuilder sort(Collection<PNSortKey> sort);
ManageChannelMembersBuilder include(MemberInclude include);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.util.Collection;

@Deprecated
public interface RemoveChannelMembers extends Endpoint<PNRemoveChannelMembersResult> {

RemoveChannelMembers limit(Integer limit);
Expand All @@ -25,6 +26,7 @@ public interface RemoveChannelMembers extends Endpoint<PNRemoveChannelMembersRes

RemoveChannelMembers includeUUID(Include.PNUUIDDetailsLevel includeUUID);

@Deprecated
interface Builder extends BuilderSteps.ChannelStep<ObjectsBuilderSteps.UUIDsStep<RemoveChannelMembers>> {
@Override
ObjectsBuilderSteps.UUIDsStep<RemoveChannelMembers> channel(String channel);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.pubnub.api.java.endpoints.objects_api.members;

import com.pubnub.api.java.endpoints.Endpoint;
import com.pubnub.api.java.endpoints.objects_api.utils.PNSortKey;
import com.pubnub.api.java.models.consumer.objects_api.member.MemberInclude;
import com.pubnub.api.java.models.consumer.objects_api.member.PNRemoveChannelMembersResult;

import java.util.Collection;

public interface RemoveChannelMembersBuilder extends Endpoint<PNRemoveChannelMembersResult> {
RemoveChannelMembersBuilder limit(Integer limit);
RemoveChannelMembersBuilder page(com.pubnub.api.models.consumer.objects.PNPage page);
RemoveChannelMembersBuilder filter(String filter);
RemoveChannelMembersBuilder sort(Collection<PNSortKey> sort);
RemoveChannelMembersBuilder include(MemberInclude include);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.util.Collection;

@Deprecated
public interface SetChannelMembers extends Endpoint<PNSetChannelMembersResult> {

SetChannelMembers limit(Integer limit);
Expand All @@ -25,6 +26,7 @@ public interface SetChannelMembers extends Endpoint<PNSetChannelMembersResult> {

SetChannelMembers includeUUID(Include.PNUUIDDetailsLevel includeUUID);

@Deprecated
interface Builder extends BuilderSteps.ChannelStep<ObjectsBuilderSteps.UUIDsStep<SetChannelMembers>> {
@Override
ObjectsBuilderSteps.UUIDsStep<SetChannelMembers> channel(String channel);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.pubnub.api.java.endpoints.objects_api.members;

import com.pubnub.api.java.endpoints.Endpoint;
import com.pubnub.api.java.endpoints.objects_api.utils.PNSortKey;
import com.pubnub.api.java.models.consumer.objects_api.member.MemberInclude;
import com.pubnub.api.java.models.consumer.objects_api.member.PNSetChannelMembersResult;

import java.util.Collection;

public interface SetChannelMembersBuilder extends Endpoint<PNSetChannelMembersResult> {
SetChannelMembers limit(Integer limit);
SetChannelMembers page(com.pubnub.api.models.consumer.objects.PNPage page);
SetChannelMembers filter(String filter);
SetChannelMembers sort(Collection<PNSortKey> sort);
SetChannelMembers include(MemberInclude include);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,24 @@
import com.pubnub.api.java.endpoints.Endpoint;
import com.pubnub.api.java.endpoints.objects_api.utils.Include;
import com.pubnub.api.java.endpoints.objects_api.utils.PNSortKey;
import com.pubnub.api.java.models.consumer.objects_api.membership.MembershipInclude;
import com.pubnub.api.java.models.consumer.objects_api.membership.PNGetMembershipsResult;

public interface GetMemberships extends Endpoint<PNGetMembershipsResult> {
/**
* Set the user ID for fetching memberships.
*
* @param userId the user ID
* @return the current instance of {@code GetMemberships}
*/
GetMemberships userId(String userId);

/**
* @deprecated Use {@link #userId(String)} instead.
* @param uuid the user ID (previously referred to as UUID)
* @return the current instance of {@code GetMemberships}
*/
@Deprecated()
GetMemberships uuid(String uuid);

GetMemberships limit(Integer limit);
Expand All @@ -16,9 +31,29 @@ public interface GetMemberships extends Endpoint<PNGetMembershipsResult> {

GetMemberships sort(java.util.Collection<PNSortKey> sort);

/**
* @deprecated Use {@link #include(MembershipInclude)} instead.
* @param includeTotalCount specifies in totalCount should be included in response
* @return the current instance of {@code GetMemberships}
*/
@Deprecated()
GetMemberships includeTotalCount(boolean includeTotalCount);

/**
* @deprecated Use {@link #include(MembershipInclude)} instead.
* @param includeCustom specifies in Custom data should be included in response
* @return the current instance of {@code GetMemberships}
*/
@Deprecated()
GetMemberships includeCustom(boolean includeCustom);

/**
* @deprecated Use {@link #include(MembershipInclude)} instead.
* @param includeChannel specifies in ChannelMetadata should be included in response
* @return the current instance of {@code GetMemberships}
*/
@Deprecated()
GetMemberships includeChannel(Include.PNChannelDetailsLevel includeChannel);

GetMemberships include(MembershipInclude include);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.util.Collection;

@Deprecated
public interface ManageMemberships extends Endpoint<PNManageMembershipResult> {

ManageMemberships set(Collection<PNChannelMembership> set);
Expand All @@ -31,6 +32,7 @@ public interface ManageMemberships extends Endpoint<PNManageMembershipResult> {

ManageMemberships includeChannel(Include.PNChannelDetailsLevel includeChannel);

@Deprecated
interface Builder extends ObjectsBuilderSteps.RemoveOrSetStep<ManageMemberships, PNChannelMembership> {
@Override
RemoveStep<ManageMemberships, PNChannelMembership> set(Collection<PNChannelMembership> channelsToSet);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.pubnub.api.java.endpoints.objects_api.memberships;

import com.pubnub.api.java.endpoints.Endpoint;
import com.pubnub.api.java.endpoints.objects_api.utils.PNSortKey;
import com.pubnub.api.java.models.consumer.objects_api.membership.MembershipInclude;
import com.pubnub.api.java.models.consumer.objects_api.membership.PNManageMembershipResult;

import java.util.Collection;

public interface ManageMembershipsBuilder extends Endpoint<PNManageMembershipResult> {
ManageMembershipsBuilder userId(String userId);
ManageMembershipsBuilder limit(Integer limit);
ManageMembershipsBuilder page(com.pubnub.api.models.consumer.objects.PNPage page);
ManageMembershipsBuilder filter(String filter);
ManageMembershipsBuilder sort(Collection<PNSortKey> sort);
ManageMembershipsBuilder include(MembershipInclude include);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import java.util.Collection;

@Deprecated
public interface RemoveMemberships extends Endpoint<PNRemoveMembershipResult> {

RemoveMemberships uuid(String uuid);
Expand All @@ -28,6 +29,7 @@ public interface RemoveMemberships extends Endpoint<PNRemoveMembershipResult> {

RemoveMemberships includeChannel(Include.PNChannelDetailsLevel includeChannel);

@Deprecated
interface Builder extends ObjectsBuilderSteps.ChannelMembershipsStep<RemoveMemberships> {
@Override
RemoveMemberships channelMemberships(@NotNull Collection<PNChannelMembership> channelMemberships);
Expand Down
Loading

0 comments on commit c8ae89e

Please sign in to comment.