/// <summary>
        /// Retrieves a paginated list of the items from the draft catalog.
        /// </summary>
        public void GetDraftItems(GetDraftItemsRequest request, Action <GetDraftItemsResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null)
        {
            var context      = (request == null ? null : request.AuthenticationContext) ?? authenticationContext;
            var callSettings = apiSettings ?? PlayFabSettings.staticSettings;

            if (!context.IsEntityLoggedIn())
            {
                throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn, "Must be logged in to call this method");
            }
            PlayFabHttp.MakeApiCall("/Catalog/GetDraftItems", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this);
        }
        /// <summary>
        /// Retrieves a paginated list of the items from the draft catalog.
        /// </summary>
        public static async Task <PlayFabResult <GetDraftItemsResponse> > GetDraftItemsAsync(GetDraftItemsRequest request, object customData = null, Dictionary <string, string> extraHeaders = null)
        {
            await new PlayFabUtil.SynchronizationContextRemover();

            var requestContext  = request?.AuthenticationContext ?? PlayFabSettings.staticPlayer;
            var requestSettings = PlayFabSettings.staticSettings;

            if (requestContext.EntityToken == null)
            {
                throw new PlayFabException(PlayFabExceptionCode.EntityTokenNotSet, "Must call Client Login or GetEntityToken before calling this method");
            }


            var httpResult = await PlayFabHttp.DoPost("/Catalog/GetDraftItems", request, "X-EntityToken", requestContext.EntityToken, extraHeaders);

            if (httpResult is PlayFabError)
            {
                var error = (PlayFabError)httpResult;
                PlayFabSettings.GlobalErrorHandler?.Invoke(error);
                return(new PlayFabResult <GetDraftItemsResponse> {
                    Error = error, CustomData = customData
                });
            }

            var resultRawJson = (string)httpResult;
            var resultData    = PluginManager.GetPlugin <ISerializerPlugin>(PluginContract.PlayFab_Serializer).DeserializeObject <PlayFabJsonSuccess <GetDraftItemsResponse> >(resultRawJson);
            var result        = resultData.data;

            return(new PlayFabResult <GetDraftItemsResponse> {
                Result = result, CustomData = customData
            });
        }
Пример #3
0
 /// <summary>
 /// Retrieves a paginated list of the items created by a user.
 /// </summary>
 public static void GetDraftUgcItems(GetDraftItemsRequest request, Action <GetDraftItemsResult> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null)
 {
     PlayFabHttp.MakeApiCall("/UserGeneratedContent/GetDraftUgcItems", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders);
 }
Пример #4
0
        /// <summary>
        /// Retrieves a paginated list of the items from the draft catalog.
        /// </summary>

        public void GetDraftItems(GetDraftItemsRequest request, Action <GetDraftItemsResult> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null)
        {
            PlayFabHttp.MakeApiCall("/Catalog/GetDraftItems", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, false, authenticationContext, ApiSettings);
        }