export type GetApiV2PartnerDocumentIdContentArgs = {id: string}; export type GetApiV2PartnerDocumentIdContentOptions = {baseUrl?: string | undefined, TrustedPartner?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download a document's content * * GET /v2/partner/document/{id}/content */ export const getApiV2PartnerDocumentIdContent = async (args: GetApiV2PartnerDocumentIdContentArgs, options?: GetApiV2PartnerDocumentIdContentOptions) => { const {baseUrl = "https://api.prod.whoop.com/developer", fetch: fetchFn = fetch, TrustedPartner} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (TrustedPartner !== undefined) headers.set('authorization', `Bearer ${TrustedPartner}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/partner/document/${encodeURIComponent(String(args.id))}/content${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 undefined };