import {z} from 'zod' export type ProjectSelectSchema = {_id?: boolean | undefined, createdAt?: boolean | undefined, updatedAt?: boolean | undefined, deletedAt?: boolean | undefined, name?: boolean | undefined, slug?: boolean | undefined, paymentProviderPlanId?: boolean | undefined, paymentProviderSubscriptionId?: boolean | undefined, paymentProviderMeteredSubscriptionId?: boolean | undefined, paymentProviderSubscriptionSeats?: boolean | undefined, trialEndsAt?: boolean | undefined, paymentProviderCustomerId?: boolean | undefined, businessDetails?: boolean | undefined, businessDetailsCountry?: boolean | undefined, financeAccountingEmail?: boolean | undefined, paymentProviderSubscriptionStatus?: boolean | undefined, paymentProviderMeteredSubscriptionStatus?: boolean | undefined, paymentProviderPromoCode?: boolean | undefined, createdByUserId?: boolean | undefined, deletedByUserId?: boolean | undefined, isFeatureFlagMonitorGroupsEnabled?: boolean | undefined, workflowRunsInLast30Days?: boolean | undefined, requireSsoForLogin?: boolean | undefined, requireSsoWithSsoProviderId?: boolean | undefined, incidentNumberPrefix?: boolean | undefined, alertNumberPrefix?: boolean | undefined, scheduledMaintenanceNumberPrefix?: boolean | undefined, securityCaseNumberPrefix?: boolean | undefined, incidentEpisodeNumberPrefix?: boolean | undefined, alertEpisodeNumberPrefix?: boolean | undefined, incidentNumbersStartAt?: boolean | undefined, incidentEpisodeNumbersStartAt?: boolean | undefined, alertNumbersStartAt?: boolean | undefined, alertEpisodeNumbersStartAt?: boolean | undefined, scheduledMaintenanceNumbersStartAt?: boolean | undefined, securityCaseNumbersStartAt?: boolean | undefined, smsOrCallCurrentBalanceInUSDCents?: boolean | undefined, autoRechargeSmsOrCallByBalanceInUSD?: boolean | undefined, autoRechargeSmsOrCallWhenCurrentBalanceFallsInUSD?: boolean | undefined, enableSmsNotifications?: boolean | undefined, enableWhatsAppNotifications?: boolean | undefined, enableTelegramNotifications?: boolean | undefined, enableCallNotifications?: boolean | undefined, disableOnCallNotificationFallback?: boolean | undefined, enableAutoRechargeSmsOrCallBalance?: boolean | undefined, aiCurrentBalanceInUSDCents?: boolean | undefined, autoAiRechargeByBalanceInUSD?: boolean | undefined, autoRechargeAiWhenCurrentBalanceFallsInUSD?: boolean | undefined, enableAi?: boolean | undefined, aiContext?: boolean | undefined, aiDailyTokenLimit?: boolean | undefined, aiDailySpendLimitInUSD?: boolean | undefined, enableAutomaticIncidentInvestigation?: boolean | undefined, enableAutomaticAlertInvestigation?: boolean | undefined, enableAutomaticSecurityCaseTriage?: boolean | undefined, enableSecurityRiskCases?: boolean | undefined, securityRiskCaseThreshold?: boolean | undefined, enableAutomaticIncidentRemediation?: boolean | undefined, enableAutomaticAlertRemediation?: boolean | undefined, enableAutomaticPostmortemDraft?: boolean | undefined, acknowledgeLinkedAlertsWhenIncidentAcknowledged?: boolean | undefined, resolveLinkedAlertsWhenIncidentResolved?: boolean | undefined, limitIncidentsToOneEpisode?: boolean | undefined, limitAlertsToOneEpisode?: boolean | undefined, defaultNetworkTopologyLayout?: boolean | undefined, enableAiInsights?: boolean | undefined, enableInsightFixTasks?: boolean | undefined, enableAutomaticProfileRemediation?: boolean | undefined, enableAutomaticTraceRemediation?: boolean | undefined, enableAutomaticExceptionRemediation?: boolean | undefined, enableAutomaticMetricRemediation?: boolean | undefined, enableAutomaticLogRemediation?: boolean | undefined, autoArchiveNonActionableExceptions?: boolean | undefined, alertInvestigationMinimumSeverityId?: boolean | undefined, aiDailyAutonomousTokenLimit?: boolean | undefined, incidentAiDailyAutonomousTokenLimit?: boolean | undefined, alertAiDailyAutonomousTokenLimit?: boolean | undefined, aiDailyFixTaskLimit?: boolean | undefined, incidentAiDailyFixTaskLimit?: boolean | undefined, alertAiDailyFixTaskLimit?: boolean | undefined, alertInvestigationDedupeWindowMinutes?: boolean | undefined, incidentInvestigationMinimumSeverityId?: boolean | undefined, incidentInvestigationDedupeWindowMinutes?: boolean | undefined, aiMaxConcurrentInvestigations?: boolean | undefined, incidentAiMaxConcurrentInvestigations?: boolean | undefined, alertAiMaxConcurrentInvestigations?: boolean | undefined, incidentAiInvestigationTimeLimitInMinutes?: boolean | undefined, alertAiInvestigationTimeLimitInMinutes?: boolean | undefined, enableAutoRechargeAiBalance?: boolean | undefined, sendInvoicesByEmail?: boolean | undefined, doNotAddGlobalProbesByDefaultOnNewMonitors?: boolean | undefined, useGlobalRunners?: boolean | undefined, gitHubAppInstallationId?: boolean | undefined, defaultMetricCardinalityBudget?: boolean | undefined, defaultTelemetryRetentionInDays?: boolean | undefined, telemetryRetentionConfig?: boolean | undefined, defaultMetricDownsamplingRetentionDays?: boolean | undefined, enableAuditLogs?: boolean | undefined, isSessionReplayAllowed?: boolean | undefined, auditLogsRetentionInDays?: boolean | undefined, storeSystemEventsInAuditLogs?: boolean | undefined, recordAndTranscribeIncidentCalls?: boolean | undefined}; export type CreateApiProjectIdGetItemArgs = {id: string, body: {select?: ProjectSelectSchema | undefined}}; export type CreateApiProjectIdGetItemOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; export const project = z.object({_id: z.string().optional(), createdAt: z.object({}).optional(), updatedAt: z.object({}).optional(), deletedAt: z.object({}).optional(), version: z.number().optional(), name: z.string(), slug: z.string(), paymentProviderPlanId: z.string().optional(), paymentProviderSubscriptionId: z.string().optional(), paymentProviderMeteredSubscriptionId: z.string().optional(), paymentProviderSubscriptionSeats: z.number().optional(), trialEndsAt: z.object({}).optional(), paymentProviderCustomerId: z.string().optional(), businessDetails: z.string().optional(), businessDetailsCountry: z.string().optional(), financeAccountingEmail: z.string().optional(), paymentProviderSubscriptionStatus: z.enum(["incomplete", "incomplete_expired", "trialing", "active", "past_due", "canceled", "unpaid", "expired", "paused"]).optional(), paymentProviderMeteredSubscriptionStatus: z.enum(["incomplete", "incomplete_expired", "trialing", "active", "past_due", "canceled", "unpaid", "expired", "paused"]).optional(), paymentProviderPromoCode: z.string().optional(), createdByUserId: z.string().optional(), deletedByUserId: z.string().optional(), isFeatureFlagMonitorGroupsEnabled: z.boolean().optional(), workflowRunsInLast30Days: z.number().optional(), requireSsoForLogin: z.boolean(), requireSsoWithSsoProviderId: z.string().optional(), incidentNumberPrefix: z.string().optional(), alertNumberPrefix: z.string().optional(), scheduledMaintenanceNumberPrefix: z.string().optional(), securityCaseNumberPrefix: z.string().optional(), incidentEpisodeNumberPrefix: z.string().optional(), alertEpisodeNumberPrefix: z.string().optional(), incidentNumbersStartAt: z.number().optional(), incidentEpisodeNumbersStartAt: z.number().optional(), alertNumbersStartAt: z.number().optional(), alertEpisodeNumbersStartAt: z.number().optional(), scheduledMaintenanceNumbersStartAt: z.number().optional(), securityCaseNumbersStartAt: z.number().optional(), smsOrCallCurrentBalanceInUSDCents: z.number(), autoRechargeSmsOrCallByBalanceInUSD: z.number(), autoRechargeSmsOrCallWhenCurrentBalanceFallsInUSD: z.number(), enableSmsNotifications: z.boolean(), enableWhatsAppNotifications: z.boolean(), enableTelegramNotifications: z.boolean(), enableCallNotifications: z.boolean(), disableOnCallNotificationFallback: z.boolean(), enableAutoRechargeSmsOrCallBalance: z.boolean(), aiCurrentBalanceInUSDCents: z.number(), autoAiRechargeByBalanceInUSD: z.number(), autoRechargeAiWhenCurrentBalanceFallsInUSD: z.number(), enableAi: z.boolean(), aiContext: z.string().optional(), aiDailyTokenLimit: z.number().optional(), aiDailySpendLimitInUSD: z.number().optional(), enableAutomaticIncidentInvestigation: z.boolean(), enableAutomaticAlertInvestigation: z.boolean(), enableAutomaticSecurityCaseTriage: z.boolean(), enableSecurityRiskCases: z.boolean(), securityRiskCaseThreshold: z.number(), enableAutomaticIncidentRemediation: z.boolean(), enableAutomaticAlertRemediation: z.boolean(), enableAutomaticPostmortemDraft: z.boolean(), acknowledgeLinkedAlertsWhenIncidentAcknowledged: z.boolean(), resolveLinkedAlertsWhenIncidentResolved: z.boolean(), limitIncidentsToOneEpisode: z.boolean(), limitAlertsToOneEpisode: z.boolean(), defaultNetworkTopologyLayout: z.enum(["force", "tiered", "radial", "star", "parentChild"]).optional(), enableAiInsights: z.boolean(), enableInsightFixTasks: z.boolean(), enableAutomaticProfileRemediation: z.boolean(), enableAutomaticTraceRemediation: z.boolean(), enableAutomaticExceptionRemediation: z.boolean(), enableAutomaticMetricRemediation: z.boolean(), enableAutomaticLogRemediation: z.boolean(), autoArchiveNonActionableExceptions: z.boolean(), alertInvestigationMinimumSeverityId: z.string().optional(), aiDailyAutonomousTokenLimit: z.number().optional(), incidentAiDailyAutonomousTokenLimit: z.number().optional(), alertAiDailyAutonomousTokenLimit: z.number().optional(), aiDailyFixTaskLimit: z.number().optional(), incidentAiDailyFixTaskLimit: z.number().optional(), alertAiDailyFixTaskLimit: z.number().optional(), alertInvestigationDedupeWindowMinutes: z.number().optional(), incidentInvestigationMinimumSeverityId: z.string().optional(), incidentInvestigationDedupeWindowMinutes: z.number().optional(), aiMaxConcurrentInvestigations: z.number().optional(), incidentAiMaxConcurrentInvestigations: z.number().optional(), alertAiMaxConcurrentInvestigations: z.number().optional(), incidentAiInvestigationTimeLimitInMinutes: z.number().optional(), alertAiInvestigationTimeLimitInMinutes: z.number().optional(), enableAutoRechargeAiBalance: z.boolean(), sendInvoicesByEmail: z.boolean(), planName: z.enum(["Free", "Growth", "Enterprise", "Scale"]).optional(), dataResidency: z.string().optional(), resellerId: z.string().optional(), resellerPlanId: z.string().optional(), billingMarketplace: z.enum(["AWS", "Azure", "GoogleCloud", "Vercel"]).optional(), letCustomerSupportAccessProject: z.boolean().optional(), doNotAddGlobalProbesByDefaultOnNewMonitors: z.boolean().optional(), useGlobalRunners: z.boolean(), gitHubAppInstallationId: z.string().optional(), defaultMetricCardinalityBudget: z.number().optional(), defaultTelemetryRetentionInDays: z.number().optional(), telemetryRetentionConfig: z.object({}).optional(), defaultMetricDownsamplingRetentionDays: z.object({}).optional(), enableAuditLogs: z.boolean(), isSessionReplayAllowed: z.boolean(), auditLogsRetentionInDays: z.number().optional(), storeSystemEventsInAuditLogs: z.boolean(), recordAndTranscribeIncidentCalls: z.boolean()}); export const createApiProjectIdGetItemResponse = z.object({data: project.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 }; /** * Get Project * * POST /project/{id}/get-item */ export const createApiProjectIdGetItem = async (args: CreateApiProjectIdGetItemArgs, options?: CreateApiProjectIdGetItemOptions) => { 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(/\/+$/, '')}/project/${encodeURIComponent(String(args.id))}/get-item${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(createApiProjectIdGetItemResponse, await res.json()) };