Inheritance: PlayFabRequestCommon
Example #1
0
		/// <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 Kongregate identifier to the user's PlayFab account
        /// </summary>
        public static void LinkKongregate(LinkKongregateAccountRequest request, ProcessApiCallback<LinkKongregateAccountResult> resultCallback, ErrorCallback errorCallback, object customData = null)
        {
            if (_authKey == null) throw new Exception("Must be logged in to call this method");

            string serializedJson = SimpleJson.SerializeObject(request, Util.ApiSerializerStrategy);
            Action<CallRequestContainer> callback = delegate(CallRequestContainer requestContainer)
            {
                ResultContainer<LinkKongregateAccountResult>.HandleResults(requestContainer, resultCallback, errorCallback, null);
            };
            PlayFabHTTP.Post("/Client/LinkKongregate", serializedJson, "X-Authorization", _authKey, callback, request, customData);
        }
Example #3
0
		/// <summary>
		/// Links the Kongregate identifier to the user's PlayFab account
		/// </summary>
		public static void LinkKongregate(LinkKongregateAccountRequest request, LinkKongregateCallback resultCallback, ErrorCallback errorCallback, object customData = null)
		{
			if (AuthKey == null) throw new Exception ("Must be logged in to call this method");

			string serializedJSON = JsonConvert.SerializeObject(request, Util.JsonFormatting, Util.JsonSettings);
			Action<string,PlayFabError> callback = delegate(string responseStr, PlayFabError pfError)
			{
				LinkKongregateAccountResult result = null;
				ResultContainer<LinkKongregateAccountResult>.HandleResults(responseStr, ref pfError, out result);
				if(pfError != null && errorCallback != null)
				{
					errorCallback(pfError);
				}
				if(result != null)
				{
					
					result.CustomData = customData;
					result.Request = request;
					if(resultCallback != null)
					{
						resultCallback(result);
					}
				}
			};
			PlayFabHTTP.Post(PlayFabSettings.GetURL()+"/Client/LinkKongregate", serializedJSON, "X-Authorization", AuthKey, callback);
		}