export type AssemblyInfo = {name?: string | undefined, version?: string | undefined}; export type Item = {key?: string | undefined, value?: string | undefined}; export type ConfigFile = {name?: string | undefined, content?: string | undefined, contentType?: string | undefined}; export type LoggerInfo = {type?: string | undefined, assemblies?: Array | undefined, properties?: Array | undefined, configFiles?: Array | undefined}; export type CreateInstallation = {name?: string | undefined, type?: string | undefined, loggers?: Array | undefined}; export type CreateApiV3InstallationsLogIdArgs = {logId: string, body: CreateInstallation}; export type CreateApiV3InstallationsLogIdOptions = {baseUrl: string, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a new installation. * * POST /v3/installations/{logId} */ export const createApiV3InstallationsLogId = async (args: CreateApiV3InstallationsLogIdArgs, options: CreateApiV3InstallationsLogIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) query.set("api_key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v3/installations/${encodeURIComponent(String(args.logId))}${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 };