export type EnvelopeDelayRule = {delay?: string | undefined, resumeDate?: string | undefined}; export type DelayedRouting = {resumeDate?: string | undefined, rules?: Array | undefined, status?: string | undefined}; export type ConditionalRecipientRuleFilter = {operator?: string | undefined, recipientId?: string | undefined, scope?: string | undefined, tabId?: string | undefined, tabLabel?: string | undefined, tabType?: string | undefined, value?: string | undefined}; export type ConditionalRecipientRuleCondition = {filters?: Array | undefined, order?: string | undefined, recipientLabel?: string | undefined}; export type RecipientOption = {email?: string | undefined, name?: string | undefined, recipientLabel?: string | undefined, roleName?: string | undefined, signingGroupId?: string | undefined}; export type RecipientGroup = {groupMessage?: string | undefined, groupName?: string | undefined, recipients?: Array | undefined}; export type ConditionalRecipientRule = {conditions?: Array | undefined, order?: string | undefined, recipientGroup?: RecipientGroup | undefined, recipientId?: string | undefined}; export type RecipientRules = {conditionalRecipients?: Array | undefined}; export type RecipientRouting = {rules?: RecipientRules | undefined}; export type WorkflowStep = {action?: string | undefined, completedDate?: string | undefined, delayedRouting?: DelayedRouting | undefined, itemId?: string | undefined, recipientRouting?: RecipientRouting | undefined, status?: string | undefined, triggeredDate?: string | undefined, triggerOnItem?: string | undefined, workflowStepId?: string | undefined}; export type CreateApiV21AccountsAccountIdEnvelopesEnvelopeIdWorkflowStepsArgs = {accountId: string, envelopeId: string, body: WorkflowStep}; export type CreateApiV21AccountsAccountIdEnvelopesEnvelopeIdWorkflowStepsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Adds a new step to an envelope's workflow. * * POST /v2.1/accounts/{accountId}/envelopes/{envelopeId}/workflow/steps */ export const createApiV21AccountsAccountIdEnvelopesEnvelopeIdWorkflowSteps = async (args: CreateApiV21AccountsAccountIdEnvelopesEnvelopeIdWorkflowStepsArgs, options?: CreateApiV21AccountsAccountIdEnvelopesEnvelopeIdWorkflowStepsOptions) => { const {baseUrl = "https://www.docusign.net/restapi", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/v2.1/accounts/${encodeURIComponent(String(args.accountId))}/envelopes/${encodeURIComponent(String(args.envelopeId))}/workflow/steps${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };