export type GetApiApiPartnerCommunicationsArgs = {name?: string | undefined, offset?: number | undefined, size?: string | undefined, cursor?: string | undefined}; export type GetApiApiPartnerCommunicationsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Retrieve a collection of partner communications. * * GET /api/partner_communications */ export const getApiApiPartnerCommunications = async (args: GetApiApiPartnerCommunicationsArgs, options: GetApiApiPartnerCommunicationsOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.name != null) query.append("name", String(args.name)) if (args.offset != null) query.append("offset", String(args.offset)) if (args.size != null) query.append("size", String(args.size)) if (args.cursor != null) query.append("cursor", String(args.cursor)) const url = `${baseUrl.replace(/\/+$/, '')}/api/partner_communications${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 };