export type GetApiPipelineMetricUsageProfileLogClusteringArgs = {from: string, to?: string | undefined, id: string, limit?: number | undefined}; export type GetApiPipelineMetricUsageProfileLogClusteringOptions = {baseUrl?: string | undefined, PipelineServiceKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Fetch log usage metrics * * GET /pipeline/metric/usage/profile/log-clustering */ export const getApiPipelineMetricUsageProfileLogClustering = async (args: GetApiPipelineMetricUsageProfileLogClusteringArgs, options?: GetApiPipelineMetricUsageProfileLogClusteringOptions) => { const {baseUrl = "https://api.mezmo.com/v3", fetch: fetchFn = fetch, PipelineServiceKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.from != null) query.append("from", String(args.from)) if (args.to != null) query.append("to", String(args.to)) if (args.id != null) query.append("id", String(args.id)) if (args.limit != null) query.append("limit", String(args.limit)) if (PipelineServiceKey !== undefined) headers.set("Authorization", PipelineServiceKey) const url = `${baseUrl.replace(/\/+$/, '')}/pipeline/metric/usage/profile/log-clustering${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 };