export type EnvelopeDelayRule = {delay?: string | undefined, resumeDate?: string | undefined}; export type ScheduledSending = {bulkListId?: string | undefined, resumeDate?: string | undefined, rules?: Array | undefined, status?: 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 Workflow = {currentWorkflowStepId?: string | undefined, resumeDate?: string | undefined, scheduledSending?: ScheduledSending | undefined, workflowStatus?: string | undefined, workflowSteps?: Array | undefined}; export type UpdateApiV21AccountsAccountIdEnvelopesEnvelopeIdWorkflowArgs = {accountId: string, envelopeId: string, body: Workflow}; export type UpdateApiV21AccountsAccountIdEnvelopesEnvelopeIdWorkflowOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates the workflow definition for an envelope. * * PUT /v2.1/accounts/{accountId}/envelopes/{envelopeId}/workflow */ export const updateApiV21AccountsAccountIdEnvelopesEnvelopeIdWorkflow = async (args: UpdateApiV21AccountsAccountIdEnvelopesEnvelopeIdWorkflowArgs, options?: UpdateApiV21AccountsAccountIdEnvelopesEnvelopeIdWorkflowOptions) => { 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${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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() };