Skip to content
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

Add unlink method for DeleteRequest api request #73

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
20 changes: 20 additions & 0 deletions Assets/Xsolla/UserAccount/XsollaUserAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,26 @@ public static void LinkSocialProvider(SocialProvider providerName, Action<LinkSo
onSuccess,
error => TokenAutoRefresher.Check(error, onError, () => LinkSocialProvider(providerName, onSuccess, onError, redirectUri)));
}

/// <summary>
/// Unlinks a social network that can be used for authentication to the current account.
/// </summary>/// <param name="providerName">Name of a social network. Provider must be connected to Login in Publisher Account.<br/>
/// Can be `amazon`, `apple`, `baidu`, `battlenet`, `discord`, `facebook`, `github`, `google`, `instagram`, `kakao`, `linkedin`, `mailru`, `microsoft`, `msn`, `naver`, `ok`, `paradox`, `paypal`, `psn`, `qq`, `reddit`, `steam`, `twitch`, `twitter`, `vimeo`, `vk`, `wechat`, `weibo`, `yahoo`, `yandex`, `youtube`, `xbox`, `playstation`.</param>
/// <param name="onSuccess">Called after the social network successfully unlinked.</param>
/// <param name="onError">Called after the request resulted with an error.</param>
public static void UnlinkSocialProvider(SocialProvider providerName, Action onSuccess, Action<Error> onError)
{
var providerValue = providerName.ToApiParameter();
var url = new UrlBuilder($"{BaseUrl}/users/me/social_providers/{providerValue}")
.Build();

WebRequestHelper.Instance.DeleteRequest(
SdkType.Login,
url,
WebRequestHeader.AuthHeader(),
onSuccess,
error => TokenAutoRefresher.Check(error, onError, () => UnlinkSocialProvider(providerName, onSuccess, onError)));
}

/// <summary>
/// Returns the list of social networks linked to the user account.
Expand Down