コード例 #1
0
        /// <summary>
        /// platform-developer Post RenamePackageFile description DOCUMENT_HERE
        /// <example>
        ///  <code>
        /// var result = PublicApplicationFactory.RenamePackageFile(handler : handler,  renameInfo :  renameInfo,  applicationKey :  applicationKey,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<FileMetadata/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.AppDev.FileMetadata RenamePackageFile(ServiceClientMessageHandler handler,
                                                                               Mozu.Api.Contracts.AppDev.RenameInfo renameInfo, string applicationKey, 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.ApplicationClient.RenamePackageFileClient(
                renameInfo:  renameInfo, applicationKey:  applicationKey, 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.AppDev.FileMetadata RenamePackageFile(Mozu.Api.Contracts.AppDev.RenameInfo renameInfo, string applicationKey, string responseFields = null)
        {
            MozuClient <Mozu.Api.Contracts.AppDev.FileMetadata> response;
            var client = Mozu.Api.Clients.Platform.ApplicationClient.RenamePackageFileClient(renameInfo, applicationKey, responseFields);

            client.WithContext(_apiContext);
            response = client.Execute();
            return(response.Result());
        }
コード例 #3
0
        /// <summary>
        /// platform-developer Post RenamePackageFile description DOCUMENT_HERE
        /// </summary>
        /// <param name="applicationKey"></param>
        /// <param name="responseFields">A list or array of fields returned for a call. These fields may be customized and may be used for various types of data calls in Mozu. For example, responseFields are returned for retrieving or updating attributes, carts, and messages in Mozu.</param>
        /// <param name="renameInfo">Information required to update the name of a file in a package, which consists of the original name and the new name.</param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.AppDev.FileMetadata"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=RenamePackageFile( renameInfo,  applicationKey,  responseFields);
        ///   var fileMetadataClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <Mozu.Api.Contracts.AppDev.FileMetadata> RenamePackageFileClient(Mozu.Api.Contracts.AppDev.RenameInfo renameInfo, string applicationKey, string responseFields = null)
        {
            var          url        = Mozu.Api.Urls.Platform.ApplicationUrl.RenamePackageFileUrl(applicationKey, responseFields);
            const string verb       = "POST";
            var          mozuClient = new MozuClient <Mozu.Api.Contracts.AppDev.FileMetadata>()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.AppDev.RenameInfo>(renameInfo);

            return(mozuClient);
        }
コード例 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="applicationKey">The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}.</param>
        /// <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="renameInfo">Information required to update the name of a file in a package, which consists of the original name and the new name.</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.AppDev.FileMetadata"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var application = new Application();
        ///   var fileMetadata = await application.RenamePackageFileAsync( renameInfo,  applicationKey,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.AppDev.FileMetadata> RenamePackageFileAsync(Mozu.Api.Contracts.AppDev.RenameInfo renameInfo, string applicationKey, string responseFields = null, CancellationToken ct = default(CancellationToken))
        {
            MozuClient <Mozu.Api.Contracts.AppDev.FileMetadata> response;
            var client = Mozu.Api.Clients.Platform.ApplicationClient.RenamePackageFileClient(renameInfo, applicationKey, responseFields);

            client.WithContext(_apiContext);
            response = await client.ExecuteAsync(ct).ConfigureAwait(false);

            return(await response.ResultAsync());
        }