예제 #1
0
        /// <summary>
        /// Updates the service request.
        /// </summary>
        /// <param name="entity">The service request to be updated.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
        /// <returns>The service request that was just updated.</returns>
        public async Task <ServiceRequest> PatchAsync(ServiceRequest entity, CancellationToken cancellationToken = default)
        {
            entity.AssertNotNull(nameof(entity));

            return(await Partner.ServiceClient.PatchAsync <ServiceRequest, ServiceRequest>(
                       new Uri(
                           string.Format(
                               CultureInfo.InvariantCulture,
                               $"/{PartnerService.Instance.ApiVersion}/{PartnerService.Instance.Configuration.Apis.UpdateServiceRequestPartner.Path}",
                               Context.Item1),
                           UriKind.Relative),
                       entity,
                       cancellationToken).ConfigureAwait(false));
        }
예제 #2
0
        /// <summary>
        /// Creates a service request.
        /// </summary>
        /// <param name="serviceRequest">The service request to be created.</param>
        /// <param name="agentLocale">The agent locale.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
        /// <returns>The created service request with associated identifier.</returns>
        public async Task <ServiceRequest> CreateAsync(ServiceRequest serviceRequest, string agentLocale, CancellationToken cancellationToken = default)
        {
            serviceRequest.AssertNotNull(nameof(serviceRequest));
            agentLocale.AssertNotEmpty(nameof(agentLocale));

            return(await Partner.ServiceClient.PostAsync <ServiceRequest, ServiceRequest>(
                       new Uri(
                           string.Format(
                               CultureInfo.InvariantCulture,
                               $"/{PartnerService.Instance.ApiVersion}/{PartnerService.Instance.Configuration.Apis.CreateServiceRequest.Path}",
                               agentLocale),
                           UriKind.Relative),
                       serviceRequest,
                       cancellationToken).ConfigureAwait(false));
        }