/// <summary> /// Creates a new Draft with a previously saved template that can be claimed and used in an embedded iFrame. /// The first authenticated user to access the URL will claim the Draft and will be shown the "Request signature" page with the Draft loaded. /// Subsequent access to the claim URL will result in a 404. For this embedded endpoint the RequesterEmailAddress parameter is required. /// </summary> /// <param name="draft">The draft.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">draft</exception> public Task <UnclaimedDraftResponse> CreateEmbeddedUnclaimedDraftWithTemplateAsync(NewTemplatedEmbeddedUnclaimedDraft draft, CancellationToken cancellationToken) { if (draft == null) { throw new ArgumentNullException(nameof(draft)); } var content = new MultipartFormDataContent(); content.AddTemplatedEmbeddedUnclaimedDraft(_log, draft); return(PostAsync <UnclaimedDraftResponse>($"{DraftUrl}/create_embedded_with_template", content, cancellationToken)); }
/// <summary> /// Creates a new Draft with a previously saved template that can be claimed and used in an embedded iFrame. /// The first authenticated user to access the URL will claim the Draft and will be shown the "Request signature" page with the Draft loaded. /// Subsequent access to the claim URL will result in a 404. For this embedded endpoint the RequesterEmailAddress parameter is required. /// </summary> /// <param name="draft">The draft.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">draft</exception> public Task <UnclaimedDraftResponse> CreateEmbeddedUnclaimedDraftWithTemplateAsync(NewTemplatedEmbeddedUnclaimedDraft draft) { return(CreateEmbeddedUnclaimedDraftWithTemplateAsync(draft, CancellationToken.None)); }
public static void AddTemplatedEmbeddedUnclaimedDraft(this MultipartFormDataContent content, IApiLog log, NewTemplatedEmbeddedUnclaimedDraft draft) { content.AddRequestBase(log, draft); content.AddParameter(log, "client_id", draft.ClientId); int i = 0; foreach (var tid in draft.TemplateIds) { content.AddParameter(log, $"template_ids[{i++}]", tid); } content.AddParameter(log, "title", draft.Title); content.AddParameter(log, "requesting_redirect_url", draft.RequestingRedirectUrl); foreach (var cc in draft.Ccs) { content.AddParameter(log, $"ccs[{cc.Role}]", cc.Email); } content.AddParameter(log, "custom_fields", JsonConvert.SerializeObject(draft.CustomFields, HttpResponseExtensions.JsonSettings)); if (draft.IsForEmbeddedSigning) { content.AddParameter(log, "is_for_embedded_signing", "1"); } }