Skip to content

Commit

Permalink
Merge pull request #7 from PlayFab/IncApiVersion100815
Browse files Browse the repository at this point in the history
Updating all SDKs after changes to API_Specs
  • Loading branch information
Paul Gilmore committed Aug 10, 2015
2 parents 45f8c8f + ed3639e commit be44ed5
Show file tree
Hide file tree
Showing 18 changed files with 2,620 additions and 296 deletions.
132 changes: 131 additions & 1 deletion PlayFabClientSDK/source/PlayFabClientAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,40 @@ public static async Task<PlayFabResult<LoginResult>> LoginWithIOSDeviceIDAsync(L
AuthKey = result.SessionTicket ?? AuthKey;


return new PlayFabResult<LoginResult>
{
Result = result
};
}

/// <summary>
/// Signs the user in using a Kongregate player account.
/// </summary>
public static async Task<PlayFabResult<LoginResult>> LoginWithKongregateAsync(LoginWithKongregateRequest request)
{
request.TitleId = PlayFabSettings.TitleId ?? request.TitleId;
if(request.TitleId == null) throw new Exception ("Must be have PlayFabSettings.TitleId set to call this method");

object httpResult = await PlayFabHTTP.DoPost(PlayFabSettings.GetURL() + "/Client/LoginWithKongregate", request, null, null);
if(httpResult is PlayFabError)
{
PlayFabError error = (PlayFabError)httpResult;
if (PlayFabSettings.GlobalErrorHandler != null)
PlayFabSettings.GlobalErrorHandler(error);
return new PlayFabResult<LoginResult>
{
Error = error,
};
}
string resultRawJson = (string)httpResult;

var serializer = JsonSerializer.Create(PlayFabSettings.JsonSettings);
var resultData = serializer.Deserialize<PlayFabJsonSuccess<LoginResult>>(new JsonTextReader(new StringReader(resultRawJson)));

LoginResult result = resultData.data;
AuthKey = result.SessionTicket ?? AuthKey;


return new PlayFabResult<LoginResult>
{
Result = result
Expand Down Expand Up @@ -707,6 +741,38 @@ public static async Task<PlayFabResult<LinkIOSDeviceIDResult>> LinkIOSDeviceIDAs
};
}

/// <summary>
/// Links the Kongregate identifier to the user's PlayFab account
/// </summary>
public static async Task<PlayFabResult<LinkKongregateAccountResult>> LinkKongregateAsync(LinkKongregateAccountRequest request)
{
if (AuthKey == null) throw new Exception ("Must be logged in to call this method");

object httpResult = await PlayFabHTTP.DoPost(PlayFabSettings.GetURL() + "/Client/LinkKongregate", request, "X-Authorization", AuthKey);
if(httpResult is PlayFabError)
{
PlayFabError error = (PlayFabError)httpResult;
if (PlayFabSettings.GlobalErrorHandler != null)
PlayFabSettings.GlobalErrorHandler(error);
return new PlayFabResult<LinkKongregateAccountResult>
{
Error = error,
};
}
string resultRawJson = (string)httpResult;

var serializer = JsonSerializer.Create(PlayFabSettings.JsonSettings);
var resultData = serializer.Deserialize<PlayFabJsonSuccess<LinkKongregateAccountResult>>(new JsonTextReader(new StringReader(resultRawJson)));

LinkKongregateAccountResult result = resultData.data;


return new PlayFabResult<LinkKongregateAccountResult>
{
Result = result
};
}

/// <summary>
/// Links the Steam account associated with the provided Steam authentication ticket to the user's PlayFab account
/// </summary>
Expand Down Expand Up @@ -930,6 +996,38 @@ public static async Task<PlayFabResult<UnlinkIOSDeviceIDResult>> UnlinkIOSDevice
};
}

/// <summary>
/// Unlinks the related Kongregate identifier from the user's PlayFab account
/// </summary>
public static async Task<PlayFabResult<UnlinkKongregateAccountResult>> UnlinkKongregateAsync(UnlinkKongregateAccountRequest request)
{
if (AuthKey == null) throw new Exception ("Must be logged in to call this method");

object httpResult = await PlayFabHTTP.DoPost(PlayFabSettings.GetURL() + "/Client/UnlinkKongregate", request, "X-Authorization", AuthKey);
if(httpResult is PlayFabError)
{
PlayFabError error = (PlayFabError)httpResult;
if (PlayFabSettings.GlobalErrorHandler != null)
PlayFabSettings.GlobalErrorHandler(error);
return new PlayFabResult<UnlinkKongregateAccountResult>
{
Error = error,
};
}
string resultRawJson = (string)httpResult;

var serializer = JsonSerializer.Create(PlayFabSettings.JsonSettings);
var resultData = serializer.Deserialize<PlayFabJsonSuccess<UnlinkKongregateAccountResult>>(new JsonTextReader(new StringReader(resultRawJson)));

UnlinkKongregateAccountResult result = resultData.data;


return new PlayFabResult<UnlinkKongregateAccountResult>
{
Result = result
};
}

/// <summary>
/// Unlinks the related Steam account from the user's PlayFab account
/// </summary>
Expand Down Expand Up @@ -1602,6 +1700,38 @@ public static async Task<PlayFabResult<GetCharacterInventoryResult>> GetCharacte
};
}

/// <summary>
/// Retrieves a completed purchase along with its current PlayFab status.
/// </summary>
public static async Task<PlayFabResult<GetPurchaseResult>> GetPurchaseAsync(GetPurchaseRequest request)
{
if (AuthKey == null) throw new Exception ("Must be logged in to call this method");

object httpResult = await PlayFabHTTP.DoPost(PlayFabSettings.GetURL() + "/Client/GetPurchase", request, "X-Authorization", AuthKey);
if(httpResult is PlayFabError)
{
PlayFabError error = (PlayFabError)httpResult;
if (PlayFabSettings.GlobalErrorHandler != null)
PlayFabSettings.GlobalErrorHandler(error);
return new PlayFabResult<GetPurchaseResult>
{
Error = error,
};
}
string resultRawJson = (string)httpResult;

var serializer = JsonSerializer.Create(PlayFabSettings.JsonSettings);
var resultData = serializer.Deserialize<PlayFabJsonSuccess<GetPurchaseResult>>(new JsonTextReader(new StringReader(resultRawJson)));

GetPurchaseResult result = resultData.data;


return new PlayFabResult<GetPurchaseResult>
{
Result = result
};
}

/// <summary>
/// Retrieves the user's current inventory of virtual goods
/// </summary>
Expand Down Expand Up @@ -1859,7 +1989,7 @@ public static async Task<PlayFabResult<UnlockContainerItemResult>> UnlockContain
}

/// <summary>
/// Adds the PlayFab user, based upon a match against a supplied unique identifier, to the friend list of the local user
/// Adds the PlayFab user, based upon a match against a supplied unique identifier, to the friend list of the local user. At least one of FriendPlayFabId,FriendUsername,FriendEmail, or FriendTitleDisplayName should be initialized.
/// </summary>
public static async Task<PlayFabResult<AddFriendResult>> AddFriendAsync(AddFriendRequest request)
{
Expand Down
Loading

0 comments on commit be44ed5

Please sign in to comment.