export type GetApiAbdmV1ProfileAssetCardArgs = {'X-Pt-Id'?: string | undefined, 'X-Partner-Pt-Id'?: string | undefined, 'X-Hip-Id'?: string | undefined, oid?: string | undefined}; export type GetApiAbdmV1ProfileAssetCardOptions = {baseUrl?: string | undefined, authApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Fetch the ABHA card.Please cache these results locally. We do not recommend calling this API on every page load. Evict the cache when there is profile update. * * GET /abdm/v1/profile/asset/card */ export const getApiAbdmV1ProfileAssetCard = async (args: GetApiAbdmV1ProfileAssetCardArgs, options?: GetApiAbdmV1ProfileAssetCardOptions) => { const {baseUrl = "https://api.eka.care", fetch: fetchFn = fetch, authApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "image/png") if (args['X-Pt-Id'] != null) headers.set("X-Pt-Id", String(args['X-Pt-Id'])) if (args['X-Partner-Pt-Id'] != null) headers.set("X-Partner-Pt-Id", String(args['X-Partner-Pt-Id'])) if (args['X-Hip-Id'] != null) headers.set("X-Hip-Id", String(args['X-Hip-Id'])) if (args.oid != null) query.append("oid", String(args.oid)) if (authApiKey !== undefined) headers.set('authorization', `Bearer ${authApiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/abdm/v1/profile/asset/card${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() };