/// <summary>
        /// Stops an existing experiment for a title.
        /// </summary>
        public async Task <PlayFabResult <EmptyResponse> > StopExperimentAsync(StopExperimentRequest request, object customData = null, Dictionary <string, string> extraHeaders = null)
        {
            await new PlayFabUtil.SynchronizationContextRemover();

            var requestContext  = request?.AuthenticationContext ?? authenticationContext;
            var requestSettings = apiSettings ?? 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("/Experimentation/StopExperiment", request, "X-EntityToken", requestContext.EntityToken, extraHeaders, requestSettings);

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

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

            return(new PlayFabResult <EmptyResponse> {
                Result = result, CustomData = customData
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// Stops the specified experiment.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the StopExperiment service method.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        ///
        /// <returns>The response from the StopExperiment service method, as returned by FIS.</returns>
        /// <exception cref="Amazon.FIS.Model.ResourceNotFoundException">
        /// The specified resource cannot be found.
        /// </exception>
        /// <exception cref="Amazon.FIS.Model.ValidationException">
        /// The specified input is not valid, or fails to satisfy the constraints for the request.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/fis-2020-12-01/StopExperiment">REST API Reference for StopExperiment Operation</seealso>
        public virtual Task <StopExperimentResponse> StopExperimentAsync(StopExperimentRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = StopExperimentRequestMarshaller.Instance;
            options.ResponseUnmarshaller = StopExperimentResponseUnmarshaller.Instance;

            return(InvokeAsync <StopExperimentResponse>(request, options, cancellationToken));
        }
Exemplo n.º 3
0
        internal virtual StopExperimentResponse StopExperiment(StopExperimentRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = StopExperimentRequestMarshaller.Instance;
            options.ResponseUnmarshaller = StopExperimentResponseUnmarshaller.Instance;

            return(Invoke <StopExperimentResponse>(request, options));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Stops an existing experiment for a title.
        /// </summary>
        public void StopExperiment(StopExperimentRequest request, Action <EmptyResponse> 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("/Experimentation/StopExperiment", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this);
        }
Exemplo n.º 5
0
 /// <summary>Snippet for StopExperiment</summary>
 public void StopExperimentRequestObject()
 {
     // Snippet: StopExperiment(StopExperimentRequest, CallSettings)
     // Create client
     ExperimentsClient experimentsClient = ExperimentsClient.Create();
     // Initialize request argument(s)
     StopExperimentRequest request = new StopExperimentRequest
     {
         ExperimentName = ExperimentName.FromProjectLocationAgentEnvironmentExperiment("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]"),
     };
     // Make the request
     Experiment response = experimentsClient.StopExperiment(request);
     // End snippet
 }
Exemplo n.º 6
0
        /// <summary>Snippet for StopExperimentAsync</summary>
        public async Task StopExperimentRequestObjectAsync()
        {
            // Snippet: StopExperimentAsync(StopExperimentRequest, CallSettings)
            // Additional: StopExperimentAsync(StopExperimentRequest, CancellationToken)
            // Create client
            ExperimentsClient experimentsClient = await ExperimentsClient.CreateAsync();

            // Initialize request argument(s)
            StopExperimentRequest request = new StopExperimentRequest
            {
                ExperimentName = ExperimentName.FromProjectLocationAgentEnvironmentExperiment("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]"),
            };
            // Make the request
            Experiment response = await experimentsClient.StopExperimentAsync(request);

            // End snippet
        }