Ejemplo n.º 1
0
        /// <summary>
        /// Updates the product publishing mode for the master catalog specified in the request.
        /// </summary>
        /// <param name="masterCatalogId"></param>
        /// <param name="responseFields">Use this field to include those fields which are not included by default.</param>
        /// <param name="masterCatalog">Properties of a master product catalog defined for a tenant. All catalogs and sites associated with a master catalog share product definitions.</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.ProductAdmin.MasterCatalog"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var mastercatalog = new MasterCatalog();
        ///   var masterCatalog = await mastercatalog.UpdateMasterCatalogAsync( masterCatalog,  masterCatalogId,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.ProductAdmin.MasterCatalog> UpdateMasterCatalogAsync(Mozu.Api.Contracts.ProductAdmin.MasterCatalog masterCatalog, int masterCatalogId, string responseFields = null)
        {
            MozuClient <Mozu.Api.Contracts.ProductAdmin.MasterCatalog> response;
            var client = Mozu.Api.Clients.Commerce.Catalog.Admin.MasterCatalogClient.UpdateMasterCatalogClient(masterCatalog, masterCatalogId, responseFields);

            client.WithContext(_apiContext);
            response = await client.ExecuteAsync();

            return(await response.ResultAsync());
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// <example>
        ///  <code>
        /// var result = MasterCatalogFactory.UpdateMasterCatalog(handler : handler,  masterCatalog :  masterCatalog,  masterCatalogId :  masterCatalogId,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<MasterCatalog/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.ProductAdmin.MasterCatalog UpdateMasterCatalog(ServiceClientMessageHandler handler,
                                                                                        Mozu.Api.Contracts.ProductAdmin.MasterCatalog masterCatalog, int masterCatalogId, 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.Commerce.Catalog.Admin.MasterCatalogClient.UpdateMasterCatalogClient(
                masterCatalog:  masterCatalog, masterCatalogId:  masterCatalogId, 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);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="masterCatalogId">Unique identifier for the master catalog. The master catalog contains all products accessible per catalogs and the site/tenant.</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="masterCatalog">Properties of a master product catalog defined for a tenant. All catalogs and sites associated with a master catalog share product definitions.</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.ProductAdmin.MasterCatalog"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var mastercatalog = new MasterCatalog();
        ///   var masterCatalog = await mastercatalog.UpdateMasterCatalogAsync( masterCatalog,  masterCatalogId,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.ProductAdmin.MasterCatalog> UpdateMasterCatalogAsync(Mozu.Api.Contracts.ProductAdmin.MasterCatalog masterCatalog, int masterCatalogId, string responseFields = null, CancellationToken ct = default(CancellationToken))
        {
            MozuClient <Mozu.Api.Contracts.ProductAdmin.MasterCatalog> response;
            var client = Mozu.Api.Clients.Commerce.Catalog.Admin.MasterCatalogClient.UpdateMasterCatalogClient(masterCatalog, masterCatalogId, responseFields);

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

            return(await response.ResultAsync());
        }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="masterCatalogId">Unique identifier for the master catalog. The master catalog contains all products accessible per catalogs and the site/tenant.</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="masterCatalog">Properties of a master product catalog defined for a tenant. All catalogs and sites associated with a master catalog share product definitions.</param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.ProductAdmin.MasterCatalog"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=UpdateMasterCatalog( masterCatalog,  masterCatalogId,  responseFields);
        ///   var masterCatalogClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <Mozu.Api.Contracts.ProductAdmin.MasterCatalog> UpdateMasterCatalogClient(Mozu.Api.Contracts.ProductAdmin.MasterCatalog masterCatalog, int masterCatalogId, string responseFields = null)
        {
            var          url        = Mozu.Api.Urls.Commerce.Catalog.Admin.MasterCatalogUrl.UpdateMasterCatalogUrl(masterCatalogId, responseFields);
            const string verb       = "PUT";
            var          mozuClient = new MozuClient <Mozu.Api.Contracts.ProductAdmin.MasterCatalog>()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.ProductAdmin.MasterCatalog>(masterCatalog);

            return(mozuClient);
        }