export type CreateApiApiV1AdminVendorsEnvRevokeArgs = {env: 'staging' | 'prod'}; export type CreateApiApiV1AdminVendorsEnvRevokeOptions = {baseUrl: string, OAuth2PasswordBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Revoke Oauth * * POST /api/v1/admin/vendors/{env}/revoke */ export const createApiApiV1AdminVendorsEnvRevoke = async (args: CreateApiApiV1AdminVendorsEnvRevokeArgs, options: CreateApiApiV1AdminVendorsEnvRevokeOptions) => { const {baseUrl, fetch: fetchFn = fetch, OAuth2PasswordBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (OAuth2PasswordBearer !== undefined) headers.set('authorization', `Bearer ${OAuth2PasswordBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/admin/vendors/${encodeURIComponent(String(args.env))}/revoke${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };