Skip to content

Deprecated GrantToken with spaces and users #354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,14 @@ interface PubNub : EventEmitter, StatusEmitter {
* Each type of resource have different set of permissions. To know what's possible for each of them
* check ChannelGrant, ChannelGroupGrant and UUIDGrant.
*/
@Deprecated(
replaceWith =
ReplaceWith(
"grantToken(ttl)"
),
level = DeprecationLevel.WARNING,
message = "Use grantToken(ttl) instead",
)
fun grantToken(): GrantTokenBuilder

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ public interface GrantTokenBuilder extends Endpoint<PNGrantTokenResult> {

GrantTokenObjectsBuilder authorizedUUID(String authorizedUUID);

@Deprecated
GrantTokenEntitiesBuilder authorizedUserId(UserId userId);

@Deprecated
GrantTokenEntitiesBuilder spacesPermissions(List<SpacePermissions> spacesPermissions);

@Deprecated
GrantTokenEntitiesBuilder usersPermissions(List<UserPermissions> usersPermissions);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@

public interface GrantTokenEntitiesBuilder extends Endpoint<PNGrantTokenResult> {

@Deprecated
GrantTokenEntitiesBuilder meta(Object meta);

@Deprecated
GrantTokenEntitiesBuilder spacesPermissions(List<SpacePermissions> spacesPermissions);

@Deprecated
GrantTokenEntitiesBuilder usersPermissions(List<UserPermissions> usersPermissions);

@Deprecated
GrantTokenEntitiesBuilder authorizedUserId(UserId userId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ public void happyPath() throws PubNubException {

//when
final PNGrantTokenResult grantTokenResponse = pubNubUnderTest
.grantToken()
.ttl(expectedTTL)
.grantToken(expectedTTL)
.channels(Arrays.asList(ChannelGrant.name(expectedChannelResourceName).delete(),
ChannelGrant.pattern(expectedChannelPattern).write()))
.channelGroups(Arrays.asList(ChannelGroupGrant.id(expectedChannelGroupResourceId).read(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,13 @@ actual interface PubNub : StatusEmitter, EventEmitter {
* @param spacesPermissions List of all space grants
* @param usersPermissions List of all userId grants
*/
@Deprecated(
level = DeprecationLevel.WARNING,
message = "This function is deprecated. Use the new grantToken(ttl, userId, meta, authorizedUUID, channels, channelGroups, uuids)",
replaceWith = ReplaceWith(
"grantToken(ttl, meta, authorizedUUID, channels, channelGroups, uuids)"
)
)
fun grantToken(
ttl: Int,
meta: Any? = null,
Expand Down
Loading