export type GetApiV21AccountsAccountIdFoldersArgs = {accountId: string, count?: string | undefined, include?: string | undefined, include_items?: string | undefined, start_position?: string | undefined, sub_folder_depth?: string | undefined, template?: string | undefined, user_filter?: string | undefined}; export type GetApiV21AccountsAccountIdFoldersOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Returns a list of the account's folders. * * GET /v2.1/accounts/{accountId}/folders */ export const getApiV21AccountsAccountIdFolders = async (args: GetApiV21AccountsAccountIdFoldersArgs, options?: GetApiV21AccountsAccountIdFoldersOptions) => { const {baseUrl = "https://www.docusign.net/restapi", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.count != null) query.append("count", String(args.count)) if (args.include != null) query.append("include", String(args.include)) if (args.include_items != null) query.append("include_items", String(args.include_items)) if (args.start_position != null) query.append("start_position", String(args.start_position)) if (args.sub_folder_depth != null) query.append("sub_folder_depth", String(args.sub_folder_depth)) if (args.template != null) query.append("template", String(args.template)) if (args.user_filter != null) query.append("user_filter", String(args.user_filter)) const url = `${baseUrl.replace(/\/+$/, '')}/v2.1/accounts/${encodeURIComponent(String(args.accountId))}/folders${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };