export type ConnectOAuthConfig = {authorizationServerUrl?: string | undefined, clientId?: string | undefined, clientSecret?: string | undefined, customParameters?: {[key: string]: string} | undefined, scope?: string | undefined}; export type UpdateApiV21AccountsAccountIdConnectOauthArgs = {accountId: string, body: ConnectOAuthConfig}; export type UpdateApiV21AccountsAccountIdConnectOauthOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates the existing Connect OAuth configuration for the account. * * * PUT /v2.1/accounts/{accountId}/connect/oauth */ export const updateApiV21AccountsAccountIdConnectOauth = async (args: UpdateApiV21AccountsAccountIdConnectOauthArgs, options?: UpdateApiV21AccountsAccountIdConnectOauthOptions) => { 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))}/connect/oauth${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() };