export type Status = {hostname: string, pid: number, version: string, disk: {size: number, used: number, available: number, unit: 'B' | 'KB' | 'MB' | 'GB' | 'TB'}, jobs: {active: number, max: number}}; export type CreateApiOrgsOrgIdProjectsProjectIdScoutStatusArgs = {'x-redocly-scout-version'?: string | undefined, orgId: string, projectId: string, body: Status}; export type CreateApiOrgsOrgIdProjectsProjectIdScoutStatusOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Push status * * POST /orgs/{orgId}/projects/{projectId}/scout/status */ export const createApiOrgsOrgIdProjectsProjectIdScoutStatus = async (args: CreateApiOrgsOrgIdProjectsProjectIdScoutStatusArgs, options?: CreateApiOrgsOrgIdProjectsProjectIdScoutStatusOptions) => { const {baseUrl = "https://app.cloud.redocly.com/api", fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['x-redocly-scout-version'] != null) headers.set("x-redocly-scout-version", String(args['x-redocly-scout-version'])) if (ApiKey !== undefined) headers.set('authorization', `Bearer ${ApiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/orgs/${encodeURIComponent(String(args.orgId))}/projects/${encodeURIComponent(String(args.projectId))}/scout/status${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 };