export type GetApiRelatedAccessIdArgs = {accessId: string}; export type GetApiRelatedAccessIdOptions = {baseUrl: string, apiKeyScheme?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get a list of relationships for a given accessId * * GET /related/{accessId} */ export const getApiRelatedAccessId = async (args: GetApiRelatedAccessIdArgs, options: GetApiRelatedAccessIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, apiKeyScheme} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (apiKeyScheme !== undefined) query.set("api_key", apiKeyScheme) const url = `${baseUrl.replace(/\/+$/, '')}/related/${encodeURIComponent(String(args.accessId))}${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() };