export type GetApiV1AppsAppIdLogsArgs = {id: number, page: number, limit: number, fromDate: string, toDate: string, providerIdentifier: string, userIdentifier: Array, event: string, channel: string}; export type GetApiV1AppsAppIdLogsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * GET /v1/apps/{appId}/logs */ export const getApiV1AppsAppIdLogs = async (args: GetApiV1AppsAppIdLogsArgs, options: GetApiV1AppsAppIdLogsOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.page != null) query.append("page", String(args.page)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.fromDate != null) query.append("fromDate", String(args.fromDate)) if (args.toDate != null) query.append("toDate", String(args.toDate)) if (args.providerIdentifier != null) query.append("providerIdentifier", String(args.providerIdentifier)) for (const item of args.userIdentifier ?? []) query.append("userIdentifier", String(item)) if (args.event != null) query.append("event", String(args.event)) if (args.channel != null) query.append("channel", String(args.channel)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/apps/${encodeURIComponent(String(args.appId))}/logs${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 };