export type GetApiApiPublicEventMetricsUrlTrackingArgs = {urlPattern: string, eventKey: string, startDate?: string | undefined, endDate?: string | undefined, phoneNumber?: string | undefined, includeCustomerDetails?: string | undefined, 'x-api-key': string}; export type GetApiApiPublicEventMetricsUrlTrackingOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get URL tracking metrics * * GET /api/public/event-metrics/url-tracking */ export const getApiApiPublicEventMetricsUrlTracking = async (args: GetApiApiPublicEventMetricsUrlTrackingArgs, options?: GetApiApiPublicEventMetricsUrlTrackingOptions) => { const {baseUrl = "https://api.vambe.me", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.urlPattern != null) query.append("urlPattern", String(args.urlPattern)) if (args.eventKey != null) query.append("eventKey", String(args.eventKey)) if (args.startDate != null) query.append("startDate", String(args.startDate)) if (args.endDate != null) query.append("endDate", String(args.endDate)) if (args.phoneNumber != null) query.append("phoneNumber", String(args.phoneNumber)) if (args.includeCustomerDetails != null) query.append("includeCustomerDetails", String(args.includeCustomerDetails)) if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) const url = `${baseUrl.replace(/\/+$/, '')}/api/public/event-metrics/url-tracking${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 };