export type CreateApiPipelineAccountLocalDeployMetricUsageArgs = {edge_id?: string | undefined, body: Array<{event_ts: number, pipeline_id: string, component_id: string, processor: string, total_count: number, total_size: number}>}; export type CreateApiPipelineAccountLocalDeployMetricUsageOptions = {baseUrl?: string | undefined, PipelineServiceKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get usage metrics * * POST /pipeline/account/local-deploy/metric/usage */ export const createApiPipelineAccountLocalDeployMetricUsage = async (args: CreateApiPipelineAccountLocalDeployMetricUsageArgs, options?: CreateApiPipelineAccountLocalDeployMetricUsageOptions) => { const {baseUrl = "https://api.mezmo.com/v3", fetch: fetchFn = fetch, PipelineServiceKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.edge_id != null) query.append("edge_id", String(args.edge_id)) if (PipelineServiceKey !== undefined) headers.set("Authorization", PipelineServiceKey) const url = `${baseUrl.replace(/\/+$/, '')}/pipeline/account/local-deploy/metric/usage${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };