/// <summary> /// Returns user attributes. /// </summary> /// <remarks> Swagger method name:<c>Get User's Attributes from Client</c>.</remarks> /// <see cref="https://developers.xsolla.com/login-api/attributes/get-user-attributes-from-client"/> /// <param name="token">JWT from Xsolla Login.</param> /// <param name="projectId">Project ID from your Publisher Account.</param> /// <param name="attributeKeys">Attributes names list filter</param> /// <param name="userId">Login user ID. Can be null, because this info exist in the token.</param> /// <param name="attributeType">User attribute type to get</param> /// <param name="onSuccess">Successful operation callback.</param> /// <param name="onError">Failed operation callback.</param> /// <seealso cref="UpdateUserAttributes"/> /// <seealso cref="RemoveUserAttributes"/> public void GetUserAttributes(string token, string projectId, UserAttributeType attributeType, [CanBeNull] List <string> attributeKeys, [CanBeNull] string userId, [NotNull] Action <List <UserAttribute> > onSuccess, [CanBeNull] Action <Error> onError) { var getAttributesRequestBody = new GetAttributesJson(attributeKeys, projectId, userId); var headers = new List <WebRequestHeader> { WebRequestHeader.AuthHeader(token), WebRequestHeader.ContentTypeHeader() }; string url = default(string); switch (attributeType) { case UserAttributeType.CUSTOM: url = URL_USER_GET_ATTRIBUTES; break; case UserAttributeType.READONLY: url = URL_USER_GET_READONLY_ATTRIBUTES; break; } WebRequestHelper.Instance.PostRequest(SdkType.Login, url, getAttributesRequestBody, headers, onSuccess, onError); }
/// <summary> /// Get see <see cref="Type"/> corresponding specific <see cref="UserAttributeType"/>. /// </summary> /// <param name="type"><see cref="UserAttributeType"/> to convert.</param> /// <returns><see cref="Type"/> corresponding specific type</returns> public static Type GetTypeByUserAttribute(UserAttributeType type) { return(attributeTypes[type]); }
public void GetUserAttributes(string token, string projectId, UserAttributeType attributeType, List <string> attributeKeys, string userId, Action <List <UserAttribute> > onSuccess, Action <Error> onError) { XsollaLogin.Instance.GetUserAttributes(token, projectId, attributeType, attributeKeys, userId, onSuccess, onError); }