コード例 #1
0
        /// <summary>
        /// Generates a new user authentication ticket for the specified tenant by supplying the user's existing refresh token information.
        /// <example>
        ///  <code>
        /// var result = TenantAdminUserAuthTicketFactory.RefreshAuthTicket(handler : handler,  existingAuthTicket :  existingAuthTicket,  tenantId :  tenantId,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<TenantAdminUserAuthTicket/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.AdminUser.TenantAdminUserAuthTicket RefreshAuthTicket(ServiceClientMessageHandler handler,
                                                                                               Mozu.Api.Contracts.AdminUser.TenantAdminUserAuthTicket existingAuthTicket, int?tenantId = null, string responseFields = null,
                                                                                               HttpStatusCode expectedCode = HttpStatusCode.OK, HttpStatusCode successCode = HttpStatusCode.OK)
        {
            SetSdKparameters();
            var currentClassName  = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
            var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;

            Debug.WriteLine(currentMethodName + '.' + currentMethodName);
            var apiClient = Mozu.Api.Clients.Platform.Adminuser.TenantAdminUserAuthTicketClient.RefreshAuthTicketClient(
                existingAuthTicket:  existingAuthTicket, tenantId:  tenantId, responseFields:  responseFields);

            try
            {
                apiClient.WithContext(handler.ApiContext).Execute();
            }
            catch (ApiException ex)
            {
                // Custom error handling for test cases can be placed here
                Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
                if (customException != null)
                {
                    throw customException;
                }
                return(null);
            }
            return(ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
                                         ? (apiClient.Result())
                                         : null);
        }
コード例 #2
0
        public virtual Mozu.Api.Contracts.AdminUser.TenantAdminUserAuthTicket RefreshAuthTicket(Mozu.Api.Contracts.AdminUser.TenantAdminUserAuthTicket existingAuthTicket, int?tenantId = null, string responseFields = null)
        {
            MozuClient <Mozu.Api.Contracts.AdminUser.TenantAdminUserAuthTicket> response;
            var client = Mozu.Api.Clients.Platform.Adminuser.TenantAdminUserAuthTicketClient.RefreshAuthTicketClient(existingAuthTicket, tenantId, responseFields);

            client.WithContext(_apiContext);
            response = client.Execute();
            return(response.Result());
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="responseFields">Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.</param>
        /// <param name="tenantId">Unique identifier of the development or production tenant for which to generate the user authentication ticket.</param>
        /// <param name="existingAuthTicket">Properties of the authentication ticket to be used in user claims with the  API.</param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.AdminUser.TenantAdminUserAuthTicket"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=RefreshAuthTicket( existingAuthTicket,  tenantId,  responseFields);
        ///   var tenantAdminUserAuthTicketClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <Mozu.Api.Contracts.AdminUser.TenantAdminUserAuthTicket> RefreshAuthTicketClient(Mozu.Api.Contracts.AdminUser.TenantAdminUserAuthTicket existingAuthTicket, int?tenantId = null, string responseFields = null)
        {
            var          url        = Mozu.Api.Urls.Platform.Adminuser.TenantAdminUserAuthTicketUrl.RefreshAuthTicketUrl(tenantId, responseFields);
            const string verb       = "PUT";
            var          mozuClient = new MozuClient <Mozu.Api.Contracts.AdminUser.TenantAdminUserAuthTicket>()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.AdminUser.TenantAdminUserAuthTicket>(existingAuthTicket);

            return(mozuClient);
        }