/// <summary>
        /// Modifies an existing note for a customer account.
        /// <example>
        ///  <code>
        /// var result = CustomerNoteFactory.UpdateAccountNote(handler : handler,  note :  note,  accountId :  accountId,  noteId :  noteId,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<CustomerNote/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.Customer.CustomerNote UpdateAccountNote(ServiceClientMessageHandler handler,
                                                                                 Mozu.Api.Contracts.Customer.CustomerNote note, int accountId, int noteId, 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.Customer.Accounts.CustomerNoteClient.UpdateAccountNoteClient(
                note:  note, accountId:  accountId, noteId:  noteId, 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);
        }
        public virtual Mozu.Api.Contracts.Customer.CustomerNote UpdateAccountNote(Mozu.Api.Contracts.Customer.CustomerNote note, int accountId, int noteId, string responseFields = null)
        {
            MozuClient <Mozu.Api.Contracts.Customer.CustomerNote> response;
            var client = Mozu.Api.Clients.Commerce.Customer.Accounts.CustomerNoteClient.UpdateAccountNoteClient(note, accountId, noteId, responseFields);

            client.WithContext(_apiContext);
            response = client.Execute();
            return(response.Result());
        }
        /// <summary>
        /// Adds a new note to the specified customer account.
        /// </summary>
        /// <param name="accountId">Unique identifier of the customer account.</param>
        /// <param name="responseFields">Use this field to include those fields which are not included by default.</param>
        /// <param name="note">Properties of a note configured for a customer account.</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.Customer.CustomerNote"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var customernote = new CustomerNote();
        ///   var customerNote = await customernote.AddAccountNoteAsync( note,  accountId,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.Customer.CustomerNote> AddAccountNoteAsync(Mozu.Api.Contracts.Customer.CustomerNote note, int accountId, string responseFields = null)
        {
            MozuClient <Mozu.Api.Contracts.Customer.CustomerNote> response;
            var client = Mozu.Api.Clients.Commerce.Customer.Accounts.CustomerNoteClient.AddAccountNoteClient(note, accountId, responseFields);

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

            return(await response.ResultAsync());
        }
示例#4
0
        /// <summary>
        /// Adds a new note to the specified customer account.
        /// </summary>
        /// <param name="accountId">Unique identifier of the customer account.</param>
        /// <param name="responseFields">Use this field to include those fields which are not included by default.</param>
        /// <param name="note">Properties of a note configured for a customer account.</param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.Customer.CustomerNote"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=AddAccountNote( note,  accountId,  responseFields);
        ///   var customerNoteClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <Mozu.Api.Contracts.Customer.CustomerNote> AddAccountNoteClient(Mozu.Api.Contracts.Customer.CustomerNote note, int accountId, string responseFields = null)
        {
            var          url        = Mozu.Api.Urls.Commerce.Customer.Accounts.CustomerNoteUrl.AddAccountNoteUrl(accountId, responseFields);
            const string verb       = "POST";
            var          mozuClient = new MozuClient <Mozu.Api.Contracts.Customer.CustomerNote>()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.Customer.CustomerNote>(note);

            return(mozuClient);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="accountId">Unique identifier of the customer account.</param>
        /// <param name="noteId">Unique identifier of a particular note to retrieve.</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="note">Properties of a note configured for a customer account.</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.Customer.CustomerNote"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var customernote = new CustomerNote();
        ///   var customerNote = await customernote.UpdateAccountNoteAsync( note,  accountId,  noteId,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.Customer.CustomerNote> UpdateAccountNoteAsync(Mozu.Api.Contracts.Customer.CustomerNote note, int accountId, int noteId, string responseFields = null, CancellationToken ct = default(CancellationToken))
        {
            MozuClient <Mozu.Api.Contracts.Customer.CustomerNote> response;
            var client = Mozu.Api.Clients.Commerce.Customer.Accounts.CustomerNoteClient.UpdateAccountNoteClient(note, accountId, noteId, responseFields);

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

            return(await response.ResultAsync());
        }