export type GroupResourceType = 'USER' | 'WALLET' | 'CARD'; export type GroupResource = {id?: string | undefined, type?: GroupResourceType | undefined}; export type CreateApiBusinessV2GroupsGroupIdResourceArgs = {groupId: string, 'X-Soldo-Fingerprint': string, 'X-Soldo-Fingerprint-Signature': string, body: GroupResource}; export type CreateApiBusinessV2GroupsGroupIdResourceOptions = {baseUrl?: string | undefined, standardAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add Resource To Group * * POST /business/v2/groups/{groupId}/resource */ export const createApiBusinessV2GroupsGroupIdResource = async (args: CreateApiBusinessV2GroupsGroupIdResourceArgs, options?: CreateApiBusinessV2GroupsGroupIdResourceOptions) => { const {baseUrl = "https://api.soldo.com", fetch: fetchFn = fetch, standardAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['X-Soldo-Fingerprint'] != null) headers.set("X-Soldo-Fingerprint", String(args['X-Soldo-Fingerprint'])) if (args['X-Soldo-Fingerprint-Signature'] != null) headers.set("X-Soldo-Fingerprint-Signature", String(args['X-Soldo-Fingerprint-Signature'])) if (standardAuth !== undefined) headers.set('authorization', `Bearer ${standardAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/business/v2/groups/${encodeURIComponent(String(args.groupId))}/resource${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 undefined };