import {z} from 'zod' export type ObjectIDFilter = string | {_type: 'EqualTo', value: string} | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'EqualToOrNull', value: string} | {_type: 'Includes', value: Array}; export type DateFilter = string | {_type: 'EqualTo', value: string} | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'EqualToOrNull', value: string} | {_type: 'GreaterThan', value: string} | {_type: 'LessThan', value: string} | {_type: 'GreaterThanOrEqual', value: string} | {_type: 'LessThanOrEqual', value: string} | {_type: 'InBetween', startValue: string, endValue: string}; export type ShortTextFilter = string | {_type: 'EqualTo', value: string} | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'EqualToOrNull', value: string} | {_type: 'Search', value: string} | {_type: 'Includes', value: Array}; export type VeryLongTextFilter = string | {_type: 'EqualTo', value: string} | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'EqualToOrNull', value: string} | {_type: 'Search', value: string} | {_type: 'Includes', value: Array}; export type SlugFilter = string | {_type: 'EqualTo', value: string} | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'EqualToOrNull', value: string} | {_type: 'Includes', value: Array}; export type BooleanFilter = boolean | {_type: 'EqualTo', value: boolean} | {_type: 'NotEqual', value: boolean} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'EqualToOrNull', value: boolean}; export type EntityArrayFilter = Array | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'Includes', value: Array}; export type MonitorTypeFilter = string | {_type: 'EqualTo', value: string} | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'EqualToOrNull', value: string}; export type MonitorStepsFilter = {_type: 'IsNull'} | {_type: 'NotNull'}; export type JSONFilter = {_type: 'IsNull'} | {_type: 'NotNull'} | {[key: string]: string | number | boolean | {_type: 'EqualTo', value: string | number | boolean} | {_type: 'NotEqual', value: string | number | boolean} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'EqualToOrNull', value: string | number | boolean} | {_type: 'Search', value: string} | {_type: 'Includes', value: Array} | {_type: 'GreaterThan', value: string | number | boolean} | {_type: 'LessThan', value: string | number | boolean} | {_type: 'GreaterThanOrEqual', value: string | number | boolean} | {_type: 'LessThanOrEqual', value: string | number | boolean} | {_type: 'InBetween', startValue: string | number | boolean, endValue: string | number | boolean}}; export type NumberFilter = number | {_type: 'EqualTo', value: number} | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'EqualToOrNull', value: number} | {_type: 'GreaterThan', value: number} | {_type: 'LessThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}; export type MonitorQuerySchema = {_id?: ObjectIDFilter | undefined, createdAt?: DateFilter | undefined, updatedAt?: DateFilter | undefined, deletedAt?: DateFilter | undefined, projectId?: ObjectIDFilter | undefined, name?: ShortTextFilter | undefined, description?: VeryLongTextFilter | undefined, slug?: SlugFilter | undefined, createdByUserId?: ObjectIDFilter | undefined, isArchived?: BooleanFilter | undefined, archivedAt?: DateFilter | undefined, archivedByUserId?: ObjectIDFilter | undefined, labels?: EntityArrayFilter | undefined, dependsOnMonitors?: EntityArrayFilter | undefined, suppressAlertsWhenParentMonitorStatuses?: EntityArrayFilter | undefined, hosts?: EntityArrayFilter | undefined, kubernetesClusters?: EntityArrayFilter | undefined, dockerHosts?: EntityArrayFilter | undefined, podmanHosts?: EntityArrayFilter | undefined, proxmoxClusters?: EntityArrayFilter | undefined, openStackClouds?: EntityArrayFilter | undefined, vmwareVCenters?: EntityArrayFilter | undefined, cephClusters?: EntityArrayFilter | undefined, storageArrays?: EntityArrayFilter | undefined, cloudResources?: EntityArrayFilter | undefined, dockerSwarmClusters?: EntityArrayFilter | undefined, iotFleets?: EntityArrayFilter | undefined, databaseServers?: EntityArrayFilter | undefined, services?: EntityArrayFilter | undefined, monitorTemplateId?: ObjectIDFilter | undefined, autoProvisionedNetworkDeviceId?: ObjectIDFilter | undefined, networkAlertPolicyId?: ObjectIDFilter | undefined, monitorType?: MonitorTypeFilter | undefined, currentMonitorStatusId?: ObjectIDFilter | undefined, monitorSteps?: MonitorStepsFilter | undefined, monitoringInterval?: ShortTextFilter | undefined, customFields?: JSONFilter | undefined, disableActiveMonitoring?: BooleanFilter | undefined, incomingRequestMonitorHeartbeatCheckedAt?: DateFilter | undefined, telemetryMonitorNextMonitorAt?: DateFilter | undefined, telemetryMonitorLastMonitorAt?: DateFilter | undefined, disableActiveMonitoringBecauseOfScheduledMaintenanceEvent?: BooleanFilter | undefined, disableActiveMonitoringBecauseOfManualIncident?: BooleanFilter | undefined, serverMonitorRequestReceivedAt?: DateFilter | undefined, serverMonitorSecretKey?: ObjectIDFilter | undefined, incomingRequestSecretKey?: ObjectIDFilter | undefined, incomingMonitorRequest?: JSONFilter | undefined, incomingEmailSecretKey?: ObjectIDFilter | undefined, incomingEmailCustomLocalPart?: ShortTextFilter | undefined, incomingEmailMonitorLastEmailReceivedAt?: DateFilter | undefined, incomingEmailMonitorRequest?: JSONFilter | undefined, incomingEmailMonitorHeartbeatCheckedAt?: DateFilter | undefined, serverMonitorResponse?: JSONFilter | undefined, isAllProbesDisconnectedFromThisMonitor?: BooleanFilter | undefined, isNoProbeEnabledOnThisMonitor?: BooleanFilter | undefined, minimumProbeAgreement?: NumberFilter | undefined}; export type LabelRelationSelectSchema = {_id?: boolean | undefined, createdAt?: boolean | undefined, updatedAt?: boolean | undefined, deletedAt?: boolean | undefined, name?: boolean | undefined, projectId?: boolean | undefined, color?: boolean | undefined, isArchived?: boolean | undefined}; export type MonitorRelationSelectSchema = {_id?: boolean | undefined, createdAt?: boolean | undefined, updatedAt?: boolean | undefined, deletedAt?: boolean | undefined, projectId?: boolean | undefined, name?: boolean | undefined, monitorTemplateId?: boolean | undefined, autoProvisionedNetworkDeviceId?: boolean | undefined, networkAlertPolicyId?: boolean | undefined, monitorType?: boolean | undefined, currentMonitorStatusId?: boolean | undefined, monitorSteps?: boolean | undefined}; export type MonitorStatusRelationSelectSchema = {_id?: boolean | undefined, createdAt?: boolean | undefined, updatedAt?: boolean | undefined, deletedAt?: boolean | undefined, projectId?: boolean | undefined, name?: boolean | undefined, color?: boolean | undefined, isOperationalState?: boolean | undefined, isOfflineState?: boolean | undefined, priority?: boolean | undefined, isArchived?: boolean | undefined}; export type HostRelationSelectSchema = {_id?: boolean | undefined, createdAt?: boolean | undefined, updatedAt?: boolean | undefined, deletedAt?: boolean | undefined, projectId?: boolean | undefined, name?: boolean | undefined, description?: boolean | undefined, hostIdentifier?: boolean | undefined, otelCollectorStatus?: boolean | undefined, agentVersion?: boolean | undefined, lastSeenAt?: boolean | undefined, osType?: boolean | undefined, osVersion?: boolean | undefined, hostId?: boolean | undefined, hostArch?: boolean | undefined, hostType?: boolean | undefined, hostIpAddresses?: boolean | undefined, cpuCores?: boolean | undefined, totalMemoryBytes?: boolean | undefined, processCount?: boolean | undefined, containerRuntime?: boolean | undefined, deploymentEnvironment?: boolean | undefined, runtimeName?: boolean | undefined, runtimeVersion?: boolean | undefined, cloudProvider?: boolean | undefined, cloudPlatform?: boolean | undefined, cloudRegion?: boolean | undefined, cloudAccountId?: boolean | undefined, latestCpuPercent?: boolean | undefined, latestMemoryPercent?: boolean | undefined, latestSwapPercent?: boolean | undefined, latestDiskPercent?: boolean | undefined, latestDiskMountpoint?: boolean | undefined, latestInodesPercent?: boolean | undefined, latestInodesMountpoint?: boolean | undefined, latestLoadAverage15m?: boolean | undefined, bootedAt?: boolean | undefined, failedSystemdUnitCount?: boolean | undefined, failedSystemdUnits?: boolean | undefined, readingsUpdatedAt?: boolean | undefined}; export type KubernetesClusterRelationSelectSchema = {_id?: boolean | undefined, createdAt?: boolean | undefined, updatedAt?: boolean | undefined, deletedAt?: boolean | undefined, projectId?: boolean | undefined, name?: boolean | undefined, description?: boolean | undefined, clusterIdentifier?: boolean | undefined, provider?: boolean | undefined, otelCollectorStatus?: boolean | undefined, agentVersion?: boolean | undefined, lastSeenAt?: boolean | undefined, aiAccessRunnerId?: boolean | undefined}; export type DockerHostRelationSelectSchema = {_id?: boolean | undefined, createdAt?: boolean | undefined, updatedAt?: boolean | undefined, deletedAt?: boolean | undefined, projectId?: boolean | undefined, name?: boolean | undefined, description?: boolean | undefined, hostIdentifier?: boolean | undefined, otelCollectorStatus?: boolean | undefined, agentVersion?: boolean | undefined, lastSeenAt?: boolean | undefined, osType?: boolean | undefined, osVersion?: boolean | undefined}; export type PodmanHostRelationSelectSchema = {_id?: boolean | undefined, createdAt?: boolean | undefined, updatedAt?: boolean | undefined, deletedAt?: boolean | undefined, projectId?: boolean | undefined, name?: boolean | undefined, description?: boolean | undefined, hostIdentifier?: boolean | undefined, otelCollectorStatus?: boolean | undefined, agentVersion?: boolean | undefined, lastSeenAt?: boolean | undefined, osType?: boolean | undefined, osVersion?: boolean | undefined}; export type ProxmoxClusterRelationSelectSchema = {_id?: boolean | undefined, createdAt?: boolean | undefined, updatedAt?: boolean | undefined, deletedAt?: boolean | undefined, projectId?: boolean | undefined, name?: boolean | undefined, description?: boolean | undefined, otelCollectorStatus?: boolean | undefined, agentVersion?: boolean | undefined, pveVersion?: boolean | undefined, lastSeenAt?: boolean | undefined}; export type OpenStackCloudRelationSelectSchema = {_id?: boolean | undefined, createdAt?: boolean | undefined, updatedAt?: boolean | undefined, deletedAt?: boolean | undefined, projectId?: boolean | undefined, name?: boolean | undefined, description?: boolean | undefined, otelCollectorStatus?: boolean | undefined, agentVersion?: boolean | undefined, lastSeenAt?: boolean | undefined, collectionMethod?: boolean | undefined}; export type VMwareVCenterRelationSelectSchema = {_id?: boolean | undefined, createdAt?: boolean | undefined, updatedAt?: boolean | undefined, deletedAt?: boolean | undefined, projectId?: boolean | undefined, name?: boolean | undefined, description?: boolean | undefined, otelCollectorStatus?: boolean | undefined, agentVersion?: boolean | undefined, lastSeenAt?: boolean | undefined, collectionMethod?: boolean | undefined}; export type CephClusterRelationSelectSchema = {_id?: boolean | undefined, createdAt?: boolean | undefined, updatedAt?: boolean | undefined, deletedAt?: boolean | undefined, projectId?: boolean | undefined, name?: boolean | undefined, description?: boolean | undefined, fsid?: boolean | undefined, otelCollectorStatus?: boolean | undefined, agentVersion?: boolean | undefined, cephVersion?: boolean | undefined, lastSeenAt?: boolean | undefined}; export type StorageArrayRelationSelectSchema = {_id?: boolean | undefined, createdAt?: boolean | undefined, updatedAt?: boolean | undefined, deletedAt?: boolean | undefined, projectId?: boolean | undefined, name?: boolean | undefined, description?: boolean | undefined, storageSystem?: boolean | undefined, reportedName?: boolean | undefined, systemId?: boolean | undefined, osName?: boolean | undefined, osVersion?: boolean | undefined, otelCollectorStatus?: boolean | undefined, agentVersion?: boolean | undefined, lastSeenAt?: boolean | undefined, capacityBytes?: boolean | undefined, usedBytes?: boolean | undefined}; export type CloudResourceRelationSelectSchema = {_id?: boolean | undefined, createdAt?: boolean | undefined, updatedAt?: boolean | undefined, deletedAt?: boolean | undefined, projectId?: boolean | undefined, name?: boolean | undefined, description?: boolean | undefined, resourceIdentifier?: boolean | undefined, cloudPlatform?: boolean | undefined, cloudProvider?: boolean | undefined, cloudRegion?: boolean | undefined, cloudAccountId?: boolean | undefined, cloudResourceKind?: boolean | undefined, cloudResourceType?: boolean | undefined, cloudResourceGroup?: boolean | undefined, healthSeverity?: boolean | undefined, cloudConnectionId?: boolean | undefined, runtimeName?: boolean | undefined, runtimeVersion?: boolean | undefined, lastSeenAt?: boolean | undefined}; export type DockerSwarmClusterRelationSelectSchema = {_id?: boolean | undefined, createdAt?: boolean | undefined, updatedAt?: boolean | undefined, deletedAt?: boolean | undefined, projectId?: boolean | undefined, name?: boolean | undefined, description?: boolean | undefined, otelCollectorStatus?: boolean | undefined, agentVersion?: boolean | undefined, dockerVersion?: boolean | undefined, lastSeenAt?: boolean | undefined, swarmId?: boolean | undefined}; export type IoTFleetRelationSelectSchema = {_id?: boolean | undefined, createdAt?: boolean | undefined, updatedAt?: boolean | undefined, deletedAt?: boolean | undefined, projectId?: boolean | undefined, name?: boolean | undefined, description?: boolean | undefined, otelCollectorStatus?: boolean | undefined, agentVersion?: boolean | undefined, lastSeenAt?: boolean | undefined}; export type DatabaseServerRelationSelectSchema = {_id?: boolean | undefined, createdAt?: boolean | undefined, updatedAt?: boolean | undefined, deletedAt?: boolean | undefined, projectId?: boolean | undefined, name?: boolean | undefined, description?: boolean | undefined, databaseIdentifier?: boolean | undefined, dbSystem?: boolean | undefined, serverAddress?: boolean | undefined, serverPort?: boolean | undefined, discoverySource?: boolean | undefined, otelCollectorStatus?: boolean | undefined, lastSeenAt?: boolean | undefined}; export type ServiceRelationSelectSchema = {_id?: boolean | undefined, createdAt?: boolean | undefined, updatedAt?: boolean | undefined, deletedAt?: boolean | undefined, projectId?: boolean | undefined, name?: boolean | undefined, description?: boolean | undefined, serviceColor?: boolean | undefined, serviceLanguage?: boolean | undefined, techStack?: boolean | undefined, lastSeenAt?: boolean | undefined, serviceVersion?: boolean | undefined, deploymentEnvironment?: boolean | undefined, serviceNamespace?: boolean | undefined, runtimeName?: boolean | undefined, runtimeVersion?: boolean | undefined, telemetrySdkLanguage?: boolean | undefined, cloudProvider?: boolean | undefined, cloudPlatform?: boolean | undefined, cloudRegion?: boolean | undefined, cloudAccountId?: boolean | undefined}; export type MonitorSelectSchema = {_id?: boolean | undefined, createdAt?: boolean | undefined, updatedAt?: boolean | undefined, deletedAt?: boolean | undefined, projectId?: boolean | undefined, name?: boolean | undefined, description?: boolean | undefined, slug?: boolean | undefined, createdByUserId?: boolean | undefined, isArchived?: boolean | undefined, archivedAt?: boolean | undefined, archivedByUserId?: boolean | undefined, labels?: LabelRelationSelectSchema | undefined, dependsOnMonitors?: MonitorRelationSelectSchema | undefined, suppressAlertsWhenParentMonitorStatuses?: MonitorStatusRelationSelectSchema | undefined, hosts?: HostRelationSelectSchema | undefined, kubernetesClusters?: KubernetesClusterRelationSelectSchema | undefined, dockerHosts?: DockerHostRelationSelectSchema | undefined, podmanHosts?: PodmanHostRelationSelectSchema | undefined, proxmoxClusters?: ProxmoxClusterRelationSelectSchema | undefined, openStackClouds?: OpenStackCloudRelationSelectSchema | undefined, vmwareVCenters?: VMwareVCenterRelationSelectSchema | undefined, cephClusters?: CephClusterRelationSelectSchema | undefined, storageArrays?: StorageArrayRelationSelectSchema | undefined, cloudResources?: CloudResourceRelationSelectSchema | undefined, dockerSwarmClusters?: DockerSwarmClusterRelationSelectSchema | undefined, iotFleets?: IoTFleetRelationSelectSchema | undefined, databaseServers?: DatabaseServerRelationSelectSchema | undefined, services?: ServiceRelationSelectSchema | undefined, monitorTemplateId?: boolean | undefined, autoProvisionedNetworkDeviceId?: boolean | undefined, networkAlertPolicyId?: boolean | undefined, monitorType?: boolean | undefined, currentMonitorStatusId?: boolean | undefined, monitorSteps?: boolean | undefined, monitoringInterval?: boolean | undefined, customFields?: boolean | undefined, disableActiveMonitoring?: boolean | undefined, incomingRequestMonitorHeartbeatCheckedAt?: boolean | undefined, telemetryMonitorNextMonitorAt?: boolean | undefined, telemetryMonitorLastMonitorAt?: boolean | undefined, disableActiveMonitoringBecauseOfScheduledMaintenanceEvent?: boolean | undefined, disableActiveMonitoringBecauseOfManualIncident?: boolean | undefined, serverMonitorRequestReceivedAt?: boolean | undefined, serverMonitorSecretKey?: boolean | undefined, incomingRequestSecretKey?: boolean | undefined, incomingMonitorRequest?: boolean | undefined, incomingEmailSecretKey?: boolean | undefined, incomingEmailCustomLocalPart?: boolean | undefined, incomingEmailMonitorLastEmailReceivedAt?: boolean | undefined, incomingEmailMonitorRequest?: boolean | undefined, incomingEmailMonitorHeartbeatCheckedAt?: boolean | undefined, serverMonitorResponse?: boolean | undefined, isAllProbesDisconnectedFromThisMonitor?: boolean | undefined, isNoProbeEnabledOnThisMonitor?: boolean | undefined, minimumProbeAgreement?: boolean | undefined}; export type SortOrder = 'ASC' | 'DESC'; export type MonitorSortSchema = {_id?: SortOrder | undefined, createdAt?: SortOrder | undefined, updatedAt?: SortOrder | undefined, deletedAt?: SortOrder | undefined, projectId?: SortOrder | undefined, name?: SortOrder | undefined, description?: SortOrder | undefined, slug?: SortOrder | undefined, createdByUserId?: SortOrder | undefined, isArchived?: SortOrder | undefined, archivedAt?: SortOrder | undefined, archivedByUserId?: SortOrder | undefined, monitorTemplateId?: SortOrder | undefined, autoProvisionedNetworkDeviceId?: SortOrder | undefined, networkAlertPolicyId?: SortOrder | undefined, currentMonitorStatusId?: SortOrder | undefined, monitoringInterval?: SortOrder | undefined, disableActiveMonitoring?: SortOrder | undefined, incomingRequestMonitorHeartbeatCheckedAt?: SortOrder | undefined, telemetryMonitorNextMonitorAt?: SortOrder | undefined, telemetryMonitorLastMonitorAt?: SortOrder | undefined, disableActiveMonitoringBecauseOfScheduledMaintenanceEvent?: SortOrder | undefined, disableActiveMonitoringBecauseOfManualIncident?: SortOrder | undefined, serverMonitorRequestReceivedAt?: SortOrder | undefined, serverMonitorSecretKey?: SortOrder | undefined, incomingRequestSecretKey?: SortOrder | undefined, incomingEmailSecretKey?: SortOrder | undefined, incomingEmailCustomLocalPart?: SortOrder | undefined, incomingEmailMonitorLastEmailReceivedAt?: SortOrder | undefined, incomingEmailMonitorHeartbeatCheckedAt?: SortOrder | undefined, isAllProbesDisconnectedFromThisMonitor?: SortOrder | undefined, isNoProbeEnabledOnThisMonitor?: SortOrder | undefined, minimumProbeAgreement?: SortOrder | undefined}; export type CreateApiMonitorGetListArgs = {body: {query?: MonitorQuerySchema | undefined, select?: MonitorSelectSchema | undefined, sort?: MonitorSortSchema | undefined, limit?: number | undefined, skip?: number | undefined}}; export type CreateApiMonitorGetListOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; export const monitor = z.object({_id: z.string().optional(), createdAt: z.object({}).optional(), updatedAt: z.object({}).optional(), deletedAt: z.object({}).optional(), version: z.number().optional(), projectId: z.string(), name: z.string(), description: z.string().optional(), slug: z.string(), createdByUserId: z.string().optional(), isArchived: z.boolean(), archivedAt: z.object({}).optional(), archivedByUserId: z.string().optional(), labels: z.array(z.object({_id: z.string().optional()})).optional(), dependsOnMonitors: z.array(z.object({_id: z.string().optional()})).optional(), suppressAlertsWhenParentMonitorStatuses: z.array(z.object({_id: z.string().optional()})).optional(), hosts: z.array(z.object({_id: z.string().optional()})).optional(), kubernetesClusters: z.array(z.object({_id: z.string().optional()})).optional(), dockerHosts: z.array(z.object({_id: z.string().optional()})).optional(), podmanHosts: z.array(z.object({_id: z.string().optional()})).optional(), proxmoxClusters: z.array(z.object({_id: z.string().optional()})).optional(), openStackClouds: z.array(z.object({_id: z.string().optional()})).optional(), vmwareVCenters: z.array(z.object({_id: z.string().optional()})).optional(), cephClusters: z.array(z.object({_id: z.string().optional()})).optional(), storageArrays: z.array(z.object({_id: z.string().optional()})).optional(), cloudResources: z.array(z.object({_id: z.string().optional()})).optional(), dockerSwarmClusters: z.array(z.object({_id: z.string().optional()})).optional(), iotFleets: z.array(z.object({_id: z.string().optional()})).optional(), databaseServers: z.array(z.object({_id: z.string().optional()})).optional(), services: z.array(z.object({_id: z.string().optional()})).optional(), monitorTemplateId: z.string().optional(), autoProvisionedNetworkDeviceId: z.string().optional(), networkAlertPolicyId: z.string().optional(), monitorType: z.enum(["Manual", "Website", "API", "Ping", "Kubernetes", "Docker", "Host", "Podman", "Docker Swarm", "Proxmox", "OpenStack", "VMware", "Ceph", "Storage Array", "IoT Device", "IP", "Incoming Request", "Incoming Email", "Port", "Server", "SSL Certificate", "SQL Query", "Database", "Synthetic Monitor", "Custom JavaScript Code", "Logs", "Metrics", "Traces", "Exceptions", "Profiles", "Security Events", "AI / LLM", "Network Device", "DNS", "DNSSEC", "NTP", "Domain", "External Status Page", "Probe Status"]), currentMonitorStatusId: z.string(), monitorSteps: z.object({}).optional(), monitoringInterval: z.string().optional(), customFields: z.object({}).optional(), isOwnerNotifiedOfResourceCreation: z.boolean(), disableActiveMonitoring: z.boolean(), incomingRequestMonitorHeartbeatCheckedAt: z.object({}).optional(), telemetryMonitorNextMonitorAt: z.object({}).optional(), telemetryMonitorLastMonitorAt: z.object({}).optional(), disableActiveMonitoringBecauseOfScheduledMaintenanceEvent: z.boolean(), disableActiveMonitoringBecauseOfManualIncident: z.boolean(), serverMonitorRequestReceivedAt: z.object({}).optional(), serverMonitorSecretKey: z.string().optional(), incomingRequestSecretKey: z.string().optional(), incomingMonitorRequest: z.object({}).optional(), incomingEmailSecretKey: z.string().optional(), incomingEmailCustomLocalPart: z.string().optional(), incomingEmailMonitorLastEmailReceivedAt: z.object({}).optional(), incomingEmailMonitorRequest: z.object({}).optional(), incomingEmailMonitorHeartbeatCheckedAt: z.object({}).optional(), serverMonitorResponse: z.object({}).optional(), isAllProbesDisconnectedFromThisMonitor: z.boolean().optional(), isNoProbeEnabledOnThisMonitor: z.boolean().optional(), minimumProbeAgreement: z.number().optional()}); export const createApiMonitorGetListResponse = z.object({data: z.array(monitor).optional(), count: z.number().optional()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * List Monitor * * POST /monitor/get-list */ export const createApiMonitorGetList = async (args: CreateApiMonitorGetListArgs, options?: CreateApiMonitorGetListOptions) => { const {baseUrl = "https://oneuptime.com/api", fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (ApiKey !== undefined) headers.set("APIKey", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/monitor/get-list${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 validateResponse(createApiMonitorGetListResponse, await res.json()) };