export type GetApiTokensAuthAuthIdArgs = {auth_id: string}; export type GetApiTokensAuthAuthIdOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get All Authentication Tokens for an Authentication Setting * * GET /tokens/auth/{auth_id}/ */ export const getApiTokensAuthAuthId = async (args: GetApiTokensAuthAuthIdArgs, options?: GetApiTokensAuthAuthIdOptions) => { const {baseUrl = "https://client.apimetrics.io/api/2", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (ApiKeyAuth !== undefined) headers.set("Authorization", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/tokens/auth/${encodeURIComponent(String(args.auth_id))}/${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 (await res.json()) as unknown };