export type GetApiSearchNotificationTextArgs = {'X-API-Key': string, q: string, start_date?: string | undefined, end_date?: string | undefined, brand?: string | undefined, genre?: string | undefined, limit?: number | undefined}; export type GetApiSearchNotificationTextOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Search Notification Text * * GET /search/notification-text */ export const getApiSearchNotificationText = async (args: GetApiSearchNotificationTextArgs, options?: GetApiSearchNotificationTextOptions) => { const {baseUrl = "https://api.notiflow.empushy.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-API-Key'] != null) headers.set("X-API-Key", String(args['X-API-Key'])) if (args.q != null) query.append("q", String(args.q)) if (args.start_date != null) query.append("start_date", String(args.start_date)) if (args.end_date != null) query.append("end_date", String(args.end_date)) if (args.brand != null) query.append("brand", String(args.brand)) if (args.genre != null) query.append("genre", String(args.genre)) if (args.limit != null) query.append("limit", String(args.limit)) const url = `${baseUrl.replace(/\/+$/, '')}/search/notification-text${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 };