/// <summary>
        /// Creates and sends a new SignatureRequest based off of the Template specified.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">request</exception>
        public Task <SignatureRequestResponse> SendSignatureFromTemplateRequestAsync(NewTemplatedSignatureRequest request, CancellationToken cancellationToken)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            var content = new MultipartFormDataContent();

            content.AddTemplatedRequest(_log, request);

            return(PostAsync <SignatureRequestResponse>($"{SignatureUrl}/send_with_template", content, cancellationToken));
        }
 /// <summary>
 /// Creates and sends a new SignatureRequest based off of the Template specified.
 /// </summary>
 /// <param name="request">The request.</param>
 /// <returns></returns>
 /// <exception cref="ArgumentNullException">request</exception>
 public Task <SignatureRequestResponse> SendSignatureFromTemplateRequestAsync(NewTemplatedSignatureRequest request)
 {
     return(SendSignatureFromTemplateRequestAsync(request, CancellationToken.None));
 }
Ejemplo n.º 3
0
        public static void AddTemplatedRequest(this MultipartFormDataContent content, IApiLog log, NewTemplatedSignatureRequest request)
        {
            content.AddRequestBase(log, request);

            content.AddParameter(log, "client_id", request.ClientId);
            int i = 0;

            foreach (var tid in request.TemplateIds)
            {
                content.AddParameter(log, $"template_ids[{i++}]", tid);
            }
            content.AddParameter(log, "title", request.Title);
            foreach (var cc in request.Ccs)
            {
                content.AddParameter(log, $"ccs[{cc.Role}]", cc.Email);
            }
            content.AddParameter(log, "custom_fields", JsonConvert.SerializeObject(request.CustomFields, HttpResponseExtensions.JsonSettings));
        }