Encapsulated User ID

There are two classes to represent User Identifier in GetSocial: UserId and UserIdList for single and multiple users respectively.

Both those classes supports two ways of representing the user: by User ID in GetSocial system and by id in your system based on identity details.

All methods that accept UserId or UserIdList work with both approaches.

GetSocial User ID

You can get the GetSocial User ID for any user in GetSocial system.

1
2
3
4
5
val user: User = GetSocial.getCurrentUser()!!
val userId = UserId.create(user.id)

// multiple users
val userIds = UserIdList.create(user.id, anotherUser.id)
1
2
3
4
5
let user: User = GetSocial.getCurrentUser()!
let userId = UserId.create(user.id)

// multiple users
let userIds = UserIdList.create(user.id, anotherUser.id)
1
2
3
4
5
var user: User = GetSocial.GetCurrentUser();
var userId = UserId.Create(user.id);

// multiple users
var userIds = UserIdList.Create(user.id, anotherUser.id);

Identity User ID

If you’ve added the custom identity to you users, you can then use this identity as user identifier:

1
2
3
4
5
6
7
// that's how you created identity
val identity = Identity.custom("my-custom-identity", "user-id", "*****")

val userId = UserId.createWithProvider("my-custom-identity", "user-id")

// multiple users
val userIds = UserIdList.createWithProvider("my-custom-identity", "user-id", "another-user-id")
1
2
3
4
5
6
7
// that's how you created identity
let identity = Identity.custom("my-custom-identity", "user-id", "*****")

let userId = UserId.createWithProvider("my-custom-identity", "user-id")

// multiple users
let userIds = UserIdList.createWithProvider("my-custom-identity", "user-id", "another-user-id")
1
2
3
4
5
6
7
// that's how you created identity
var identity = Identity.Custom("my-custom-identity", "user-id", "*****");

var userId = UserId.CreateWithProvider("my-custom-identity", "user-id");

// multiple users
val userIds = UserIdList.CreateWithProvider("my-custom-identity", "user-id", "another-user-id");

Give us your feedback! Was this article helpful?

😀 🙁