/// <summary>
        /// Creates a new development or release package for the application version specified in the request.
        /// <example>
        ///  <code>
        /// var result = ApplicationVersionFactory.AddPackage(handler : handler,  pkg :  pkg,  applicationVersionId :  applicationVersionId,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<Package/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.AppDev.Package AddPackage(ServiceClientMessageHandler handler,
                                                                   Mozu.Api.Contracts.AppDev.Package pkg, int applicationVersionId,
                                                                   HttpStatusCode expectedCode = HttpStatusCode.Created, HttpStatusCode successCode = HttpStatusCode.Created)
        {
            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.Developer.ApplicationVersionClient.AddPackageClient(
                pkg:  pkg, applicationVersionId:  applicationVersionId);

            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
        /// <summary>
        ///
        /// <example>
        ///  <code>
        /// var result = AppPackageFactory.UpdatePackage(handler : handler,  pkg :  pkg,  applicationKey :  applicationKey,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<Package/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.AppDev.Package UpdatePackage(ServiceClientMessageHandler handler,
                                                                      Mozu.Api.Contracts.AppDev.Package pkg, 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.Appdev.AppPackageClient.UpdatePackageClient(
                pkg:  pkg, applicationKey:  applicationKey, responseFields:  responseFields);

            try
            {
                apiClient.WithContext(handler.ApiContext).ExecuteAsync(default(CancellationToken)).Wait();
            }
            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);
        }
예제 #3
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="package">Properties for a package for fulfillment and shipment. A package may include one to many products, or a bundle of products.</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.AppDev.Package"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var apppackage = new AppPackage();
        ///   var package = await apppackage.UpdatePackageAsync( pkg,  applicationKey,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.AppDev.Package> UpdatePackageAsync(Mozu.Api.Contracts.AppDev.Package pkg, string applicationKey, string responseFields = null, CancellationToken ct = default(CancellationToken))
        {
            MozuClient <Mozu.Api.Contracts.AppDev.Package> response;
            var client = Mozu.Api.Clients.Platform.Appdev.AppPackageClient.UpdatePackageClient(pkg, applicationKey, responseFields);

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

            return(await response.ResultAsync());
        }
예제 #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="package">Properties for a package for fulfillment and shipment. A package may include one to many products, or a bundle of products.</param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.AppDev.Package"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=UpdatePackage( pkg,  applicationKey,  responseFields);
        ///   var packageClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <Mozu.Api.Contracts.AppDev.Package> UpdatePackageClient(Mozu.Api.Contracts.AppDev.Package pkg, string applicationKey, string responseFields = null)
        {
            var          url        = Mozu.Api.Urls.Platform.Appdev.AppPackageUrl.UpdatePackageUrl(applicationKey, responseFields);
            const string verb       = "PUT";
            var          mozuClient = new MozuClient <Mozu.Api.Contracts.AppDev.Package>()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.AppDev.Package>(pkg);

            return(mozuClient);
        }
예제 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="projectId"></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="package">Properties for a package for fulfillment and shipment. A package may include one to many products, or a bundle of products.</param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.AppDev.Package"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=CreatePackage( pkg,  projectId,  responseFields);
        ///   var packageClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <Mozu.Api.Contracts.AppDev.Package> CreatePackageClient(Mozu.Api.Contracts.AppDev.Package pkg, int?projectId = null, string responseFields = null)
        {
            var          url        = Mozu.Api.Urls.Platform.Appdev.AppPackageUrl.CreatePackageUrl(projectId, responseFields);
            const string verb       = "POST";
            var          mozuClient = new MozuClient <Mozu.Api.Contracts.AppDev.Package>()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.AppDev.Package>(pkg);

            return(mozuClient);
        }