export type GetApiV1ConversationStatusesAccountIdGraphArgs = {account_id: number, provider?: string | undefined, past_days?: number | undefined, 'x-api-key': string}; export type GetApiV1ConversationStatusesAccountIdGraphOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get graph of conversation status * * GET /v1/conversation_statuses/{account_id}/graph */ export const getApiV1ConversationStatusesAccountIdGraph = async (args: GetApiV1ConversationStatusesAccountIdGraphArgs, options?: GetApiV1ConversationStatusesAccountIdGraphOptions) => { const {baseUrl = "https://api.mailreach.co/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.provider != null) query.append("provider", String(args.provider)) if (args.past_days != null) query.append("past_days", String(args.past_days)) if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/conversation_statuses/${encodeURIComponent(String(args.account_id))}/graph${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 };