示例#1
0
        /// <summary>
        /// Sections / Update Section
        /// </summary>
        public async Task <UpdateSectionResponse> UpdateSectionAsync(UpdateSectionRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("Value cannot be null.", nameof(request));
            }
            if (request.Id <= 0)
            {
                throw new ArgumentOutOfRangeException("Value must be positive and non zero.", nameof(request.Id));
            }
            if (string.IsNullOrEmpty(request.Name))
            {
                throw new ArgumentException("Value cannot be null or empty.", nameof(request.Name));
            }
            if (request.Position <= 0)
            {
                throw new ArgumentOutOfRangeException("Value must be positive and non zero.", nameof(request.Position));
            }
            if (request.Status == null)
            {
                throw new ArgumentNullException("Value cannot be null.", nameof(request.Status));
            }

            return(await ExecuteAsync <UpdateSectionResponse>(UpdateRequest <UpdateSectionRequest>(SECTIONS_PATH, request.Id, request)).ConfigureAwait(false));
        }
示例#2
0
        public void UpdateSection(SectionInfo section)
        {
            UpdateSectionRequest request = new UpdateSectionRequest()
            {
                Section = section
            };

            CallWebService <IOrgUnitManagementServicev1_0, UpdateSectionRequest, UpdateOrgUnitResponse>(
                m_service1_0, request, (s, q) => s.UpdateSection(q));
        }
示例#3
0
        /// <summary>
        /// Update a section within a ticket field.
        ///
        /// c.f. https://developers.freshdesk.com/api/#update_section
        /// </summary>
        ///
        /// <param name="ticketFieldId">
        /// The unique identifier for the ticket field
        /// </param>
        ///
        /// <param name="sectionId">
        /// The unique identifier for the section to be updated
        /// </param>
        ///
        /// <param name="request">
        /// The request encapsulating the properties to set on the section.
        /// </param>
        ///
        /// <param name="cancellationToken"></param>
        ///
        /// <returns>The updated section</returns>
        public async Task <Section> UpdateSectionAsync(
            long ticketFieldId,
            long sectionId,
            UpdateSectionRequest request,
            CancellationToken cancellationToken = default)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request), "Request must not be null");
            }

            return(await _freshdeskClient
                   .ApiOperationAsync <Section, UpdateSectionRequest>(HttpMethod.Put, $"/api/v2/admin/ticket_fields/{ticketFieldId}/sections/{sectionId}", request, cancellationToken)
                   .ConfigureAwait(false));
        }