export type GetApiApiPublicCampaignArgs = {cursor?: number | undefined, limit?: number | undefined, title?: string | undefined, status?: ('pending' | 'scheduled' | 'sending' | 'sent' | 'paused') | undefined, stage?: string | undefined, whatsapp_phone_id?: number | undefined, date?: string | undefined, sort_by?: ('created_at' | 'sent_at' | 'status') | undefined, sort_order?: ('ASC' | 'DESC') | undefined, 'x-api-key': string}; export type GetApiApiPublicCampaignOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get campaigns * * GET /api/public/campaign */ export const getApiApiPublicCampaign = async (args: GetApiApiPublicCampaignArgs, options?: GetApiApiPublicCampaignOptions) => { const {baseUrl = "https://api.vambe.me", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.cursor != null) query.append("cursor", String(args.cursor)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.title != null) query.append("title", String(args.title)) if (args.status != null) query.append("status", String(args.status)) if (args.stage != null) query.append("stage", String(args.stage)) if (args.whatsapp_phone_id != null) query.append("whatsapp_phone_id", String(args.whatsapp_phone_id)) if (args.date != null) query.append("date", String(args.date)) if (args.sort_by != null) query.append("sort_by", String(args.sort_by)) if (args.sort_order != null) query.append("sort_order", String(args.sort_order)) if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) const url = `${baseUrl.replace(/\/+$/, '')}/api/public/campaign${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 };