export type CreateInvitationRequestDto = {networkId: string, networkType: 'BILL' | 'RPPS', rppsInformation?: ({accountNumber: string, addressId?: string | undefined} | null) | undefined}; export type CreateApiV3NetworkInvitationVendorVendorIdArgs = {sessionId?: (string | null) | undefined, devKey?: (string | null) | undefined, vendorId: string, body: CreateInvitationRequestDto}; export type CreateApiV3NetworkInvitationVendorVendorIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Send connection request to a vendor * * POST /v3/network/invitation/vendor/{vendorId} */ export const createApiV3NetworkInvitationVendorVendorId = async (args: CreateApiV3NetworkInvitationVendorVendorIdArgs, options?: CreateApiV3NetworkInvitationVendorVendorIdOptions) => { const {baseUrl = "https://gateway.stage.bill.com/connect", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.sessionId != null) headers.set("sessionId", String(args.sessionId)) if (args.devKey != null) headers.set("devKey", String(args.devKey)) const url = `${baseUrl.replace(/\/+$/, '')}/v3/network/invitation/vendor/${encodeURIComponent(String(args.vendorId))}${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 };