import type { ApiError, ApiTimestamps, Endpoint } from '../../api.js'; import type { ApiPlan } from '../../plans/http.api.js'; import type { DBEnvironment, DBExternalWebhook } from '../db.js'; import type { ApiEnvironmentVariable } from '../variable/api.js'; import type { Merge } from 'type-fest'; export type ApiEnvironment = Merge; export type ApiWebhooks = Omit; export type GetEnvironments = Endpoint<{ Method: 'GET'; Path: '/api/v1/environments'; Success: { data: Pick[]; }; }>; export type PostEnvironment = Endpoint<{ Method: 'POST'; Path: '/api/v1/environments'; Body: { name: string; }; Success: { data: Pick; }; }>; export type GetEnvironment = Endpoint<{ Method: 'GET'; Path: '/api/v1/environments/current'; Success: { plan: ApiPlan | null; environmentAndAccount: { environment: ApiEnvironment; env_variables: ApiEnvironmentVariable[]; webhook_settings: ApiWebhooks; uuid: string; name: string; email: string; slack_notifications_channel: string | null; }; }; }>; export type PatchEnvironment = Endpoint<{ Method: 'PATCH'; Path: '/api/v1/environments'; Body: { name?: string | undefined; is_production?: boolean | undefined; callback_url?: string | undefined; hmac_key?: string | undefined; hmac_enabled?: boolean | undefined; slack_notifications?: boolean | undefined; otlp_endpoint?: string | undefined; otlp_headers?: { name: string; value: string; }[] | undefined; }; Success: { data: ApiEnvironment; }; Error: ApiError<'conflict' | 'cannot_toggle_prod_environment'>; }>; export type DeleteEnvironment = Endpoint<{ Method: 'DELETE'; Path: '/api/v1/environments'; Success: never; Error: ApiError<'cannot_delete_prod_environment'>; }>; export type GetPublicEnvironmentVariables = Endpoint<{ Method: 'GET'; Path: '/api/v1/environment-variables'; Success: { name: string; value: string; }[]; }>;