export type SignView = {email?: string | undefined, password?: string | undefined}; export type CreateApiV2DistributorsAccountsIdAccessTokenArgs = {id: string, body: SignView}; export type CreateApiV2DistributorsAccountsIdAccessTokenOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /v2/distributors/accounts/{id}/access-token */ export const createApiV2DistributorsAccountsIdAccessToken = async (args: CreateApiV2DistributorsAccountsIdAccessTokenArgs, options?: CreateApiV2DistributorsAccountsIdAccessTokenOptions) => { const {baseUrl = "https://api.cloudally.com", 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/distributors/accounts/${encodeURIComponent(String(args.id))}/access-token${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 res.blob() };