/// <summary> /// Creates a new Draft that can be claimed using the claim URL. /// The first authenticated user to access the URL will claim the Draft and will be shown either /// the "Sign and send" or the "Request signature" page with the Draft loaded. /// Subsequent access to the claim URL will result in a 404. /// </summary> /// <param name="draft">The draft.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">draft</exception> public Task <UnclaimedDraftResponse> CreateUnclaimedDraftAsync(NewUnclaimedDraft draft, CancellationToken cancellationToken) { if (draft == null) { throw new ArgumentNullException(nameof(draft)); } var content = new MultipartFormDataContent(); content.AddUnclaimedDraft(_log, draft); return(PostAsync <UnclaimedDraftResponse>($"{DraftUrl}/create", content, cancellationToken)); }
/// <summary> /// Creates a new Draft that can be claimed using the claim URL. /// The first authenticated user to access the URL will claim the Draft and will be shown either /// the "Sign and send" or the "Request signature" page with the Draft loaded. /// Subsequent access to the claim URL will result in a 404. /// </summary> /// <param name="draft">The draft.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">draft</exception> public Task <UnclaimedDraftResponse> CreateUnclaimedDraftAsync(NewUnclaimedDraft draft) { return(CreateUnclaimedDraftAsync(draft, CancellationToken.None)); }
public static void AddUnclaimedDraft(this MultipartFormDataContent content, IApiLog log, NewUnclaimedDraft draft) { content.AddRequestBase(log, draft); content.AddFiles(log, draft.Files); content.AddParameter(log, "type", draft.Type); if (draft.UsePreexistingFields) { content.AddParameter(log, "use_preexisting_fields", "1"); } int i = 0; foreach (var cc in draft.CcEmailAddresses) { content.AddParameter(log, $"cc_email_addresses[{i++}]", cc); } if (draft.UseTextTags) { content.AddParameter(log, "use_text_tags", "1"); } if (draft.HideTextTags) { content.AddParameter(log, "hide_text_tags", "1"); } if (draft.FormFieldsPerDocument.Count > 0) { content.AddParameter(log, "form_fields_per_document", JsonConvert.SerializeObject(draft.FormFieldsPerDocument, HttpResponseExtensions.JsonSettings)); } }