export type MessageChannelConfig = {channels: Array<'EMAIL' | 'CHAT' | 'CHAT_SLACK' | 'CHAT_TEAMS'>, alwaysEmail: boolean}; export type CreateSignatureRequestRequest = {signerUserIds: Array, message?: string | undefined, messageChannel?: MessageChannelConfig | undefined, isSequential?: boolean | undefined}; export type CreateApiV1OrgOrgIdSignatureRequestFileFileIdArgs = {orgId: string, fileId: string, body: CreateSignatureRequestRequest}; export type CreateApiV1OrgOrgIdSignatureRequestFileFileIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a new signature request on a file * * POST /v1/org/{orgId}/signature-request/file/{fileId} */ export const createApiV1OrgOrgIdSignatureRequestFileFileId = async (args: CreateApiV1OrgOrgIdSignatureRequestFileFileIdArgs, options?: CreateApiV1OrgOrgIdSignatureRequestFileFileIdOptions) => { const {baseUrl = "https://localhost", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/org/${encodeURIComponent(String(args.orgId))}/signature-request/file/${encodeURIComponent(String(args.fileId))}${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 undefined };