Ejemplo n.º 1
0
        /// <summary>
        /// Updates a DocumentType
        /// <example>
        ///  <code>
        /// var result = DocumentTypeFactory.UpdateDocumentType(handler : handler,  documentType :  documentType,  documentTypeName :  documentTypeName,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<DocumentType/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.Content.DocumentType UpdateDocumentType(ServiceClientMessageHandler handler,
                                                                                 Mozu.Api.Contracts.Content.DocumentType documentType, string documentTypeName, 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.Content.DocumentTypeClient.UpdateDocumentTypeClient(
                documentType:  documentType, documentTypeName:  documentTypeName, 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);
        }
Ejemplo n.º 2
0
        public virtual Mozu.Api.Contracts.Content.DocumentType UpdateDocumentType(Mozu.Api.Contracts.Content.DocumentType documentType, string documentTypeName, string responseFields = null)
        {
            MozuClient <Mozu.Api.Contracts.Content.DocumentType> response;
            var client = Mozu.Api.Clients.Content.DocumentTypeClient.UpdateDocumentTypeClient(documentType, documentTypeName, responseFields);

            client.WithContext(_apiContext);
            response = client.Execute();
            return(response.Result());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a new DocumentType
        /// </summary>
        /// <param name="responseFields">Use this field to include those fields which are not included by default.</param>
        /// <param name="documentType">The type of documents used in the CMS such as "web_page" or "template" or "image_url".</param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.Content.DocumentType"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=CreateDocumentType(dataViewMode,  documentType,  responseFields);
        ///   var documentTypeClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <Mozu.Api.Contracts.Content.DocumentType> CreateDocumentTypeClient(DataViewMode dataViewMode, Mozu.Api.Contracts.Content.DocumentType documentType, string responseFields = null)
        {
            var          url        = Mozu.Api.Urls.Content.DocumentTypeUrl.CreateDocumentTypeUrl(responseFields);
            const string verb       = "POST";
            var          mozuClient = new MozuClient <Mozu.Api.Contracts.Content.DocumentType>()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.Content.DocumentType>(documentType).WithHeader(Headers.X_VOL_DATAVIEW_MODE, dataViewMode.ToString())
            ;

            return(mozuClient);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Updates a DocumentType
        /// </summary>
        /// <param name="documentTypeName">The name of the document type to retrieve.</param>
        /// <param name="responseFields">Use this field to include those fields which are not included by default.</param>
        /// <param name="documentType">The type of documents used in the CMS such as "web_page" or "template" or "image_url".</param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.Content.DocumentType"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=UpdateDocumentType( documentType,  documentTypeName,  responseFields);
        ///   var documentTypeClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <Mozu.Api.Contracts.Content.DocumentType> UpdateDocumentTypeClient(Mozu.Api.Contracts.Content.DocumentType documentType, string documentTypeName, string responseFields = null)
        {
            var          url        = Mozu.Api.Urls.Content.DocumentTypeUrl.UpdateDocumentTypeUrl(documentTypeName, responseFields);
            const string verb       = "PUT";
            var          mozuClient = new MozuClient <Mozu.Api.Contracts.Content.DocumentType>()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.Content.DocumentType>(documentType);

            return(mozuClient);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Updates a DocumentType
        /// </summary>
        /// <param name="documentTypeName">The name of the document type to retrieve.</param>
        /// <param name="responseFields">Use this field to include those fields which are not included by default.</param>
        /// <param name="documentType">The type of documents used in the CMS such as "web_page" or "template" or "image_url".</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.Content.DocumentType"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var documenttype = new DocumentType();
        ///   var documentType = await documenttype.UpdateDocumentTypeAsync( documentType,  documentTypeName,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.Content.DocumentType> UpdateDocumentTypeAsync(Mozu.Api.Contracts.Content.DocumentType documentType, string documentTypeName, string responseFields = null)
        {
            MozuClient <Mozu.Api.Contracts.Content.DocumentType> response;
            var client = Mozu.Api.Clients.Content.DocumentTypeClient.UpdateDocumentTypeClient(documentType, documentTypeName, responseFields);

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

            return(await response.ResultAsync());
        }