/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { ClosedEnum } from "../../types/enums.js"; import { ActorV2, ActorV2$inboundSchema, ActorV2$Outbound, ActorV2$outboundSchema, } from "./actorv2.js"; import { CustomFieldEntryV1, CustomFieldEntryV1$inboundSchema, CustomFieldEntryV1$Outbound, CustomFieldEntryV1$outboundSchema, } from "./customfieldentryv1.js"; import { ExternalIssueReferenceV2, ExternalIssueReferenceV2$inboundSchema, ExternalIssueReferenceV2$Outbound, ExternalIssueReferenceV2$outboundSchema, } from "./externalissuereferencev2.js"; import { IncidentDurationMetricWithValueV2, IncidentDurationMetricWithValueV2$inboundSchema, IncidentDurationMetricWithValueV2$Outbound, IncidentDurationMetricWithValueV2$outboundSchema, } from "./incidentdurationmetricwithvaluev2.js"; import { IncidentRoleAssignmentV1, IncidentRoleAssignmentV1$inboundSchema, IncidentRoleAssignmentV1$Outbound, IncidentRoleAssignmentV1$outboundSchema, } from "./incidentroleassignmentv1.js"; import { IncidentStatusV1, IncidentStatusV1$inboundSchema, IncidentStatusV1$Outbound, IncidentStatusV1$outboundSchema, } from "./incidentstatusv1.js"; import { IncidentTimestampWithValueV2, IncidentTimestampWithValueV2$inboundSchema, IncidentTimestampWithValueV2$Outbound, IncidentTimestampWithValueV2$outboundSchema, } from "./incidenttimestampwithvaluev2.js"; import { IncidentTypeV1, IncidentTypeV1$inboundSchema, IncidentTypeV1$Outbound, IncidentTypeV1$outboundSchema, } from "./incidenttypev1.js"; import { SeverityV2, SeverityV2$inboundSchema, SeverityV2$Outbound, SeverityV2$outboundSchema, } from "./severityv2.js"; /** * Whether the incident is real, a test, a tutorial, or importing as a retrospective incident */ export const IncidentV2Mode = { Standard: "standard", Retrospective: "retrospective", Test: "test", Tutorial: "tutorial", } as const; /** * Whether the incident is real, a test, a tutorial, or importing as a retrospective incident */ export type IncidentV2Mode = ClosedEnum; /** * Whether the incident should be open to anyone in your Slack workspace (public), or invite-only (private). For more information on Private Incidents see our [help centre](https://help.incident.io/en/articles/5947963-can-we-mark-incidents-as-sensitive-and-restrict-access). */ export const IncidentV2Visibility = { Public: "public", Private: "private", } as const; /** * Whether the incident should be open to anyone in your Slack workspace (public), or invite-only (private). For more information on Private Incidents see our [help centre](https://help.incident.io/en/articles/5947963-can-we-mark-incidents-as-sensitive-and-restrict-access). */ export type IncidentV2Visibility = ClosedEnum; export type IncidentV2 = { /** * The call URL attached to this incident */ callUrl?: string | undefined; /** * When the incident was created */ createdAt: Date; creator: ActorV2; /** * Custom field entries for this incident */ customFieldEntries: Array; /** * Incident duration metrics and their measurements for this incident */ durationMetrics?: Array | undefined; externalIssueReference?: ExternalIssueReferenceV2 | undefined; /** * Unique identifier for the incident */ id: string; /** * A list of who is assigned to each role for this incident */ incidentRoleAssignments: Array; incidentStatus: IncidentStatusV1; /** * Incident lifecycle events and when they occurred */ incidentTimestampValues?: Array | undefined; incidentType?: IncidentTypeV1 | undefined; /** * Whether the incident is real, a test, a tutorial, or importing as a retrospective incident */ mode: IncidentV2Mode; /** * Explanation of the incident */ name: string; /** * A permanent link to the homepage for this incident */ permalink?: string | undefined; /** * Description of the incident */ postmortemDocumentUrl?: string | undefined; /** * Reference to this incident, as displayed across the product */ reference: string; severity?: SeverityV2 | undefined; /** * ID of the Slack channel in the organisation Slack workspace. Note that the channel is sometimes created asynchronously, so may not be present when the incident is just created. */ slackChannelId: string; /** * Name of the slack channel */ slackChannelName?: string | undefined; /** * ID of the Slack team / workspace. This is only required if you are using a Slack Enterprise Grid with multiple teams. */ slackTeamId: string; /** * Detailed description of the incident */ summary?: string | undefined; /** * When the incident was last updated */ updatedAt: Date; /** * Whether the incident should be open to anyone in your Slack workspace (public), or invite-only (private). For more information on Private Incidents see our [help centre](https://help.incident.io/en/articles/5947963-can-we-mark-incidents-as-sensitive-and-restrict-access). */ visibility: IncidentV2Visibility; /** * Amount of time spent on the incident in late hours */ workloadMinutesLate?: number | undefined; /** * Amount of time spent on the incident in sleeping hours */ workloadMinutesSleeping?: number | undefined; /** * Amount of time spent on the incident in total */ workloadMinutesTotal?: number | undefined; /** * Amount of time spent on the incident in working hours */ workloadMinutesWorking?: number | undefined; }; /** @internal */ export const IncidentV2Mode$inboundSchema: z.ZodNativeEnum< typeof IncidentV2Mode > = z.nativeEnum(IncidentV2Mode); /** @internal */ export const IncidentV2Mode$outboundSchema: z.ZodNativeEnum< typeof IncidentV2Mode > = IncidentV2Mode$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace IncidentV2Mode$ { /** @deprecated use `IncidentV2Mode$inboundSchema` instead. */ export const inboundSchema = IncidentV2Mode$inboundSchema; /** @deprecated use `IncidentV2Mode$outboundSchema` instead. */ export const outboundSchema = IncidentV2Mode$outboundSchema; } /** @internal */ export const IncidentV2Visibility$inboundSchema: z.ZodNativeEnum< typeof IncidentV2Visibility > = z.nativeEnum(IncidentV2Visibility); /** @internal */ export const IncidentV2Visibility$outboundSchema: z.ZodNativeEnum< typeof IncidentV2Visibility > = IncidentV2Visibility$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace IncidentV2Visibility$ { /** @deprecated use `IncidentV2Visibility$inboundSchema` instead. */ export const inboundSchema = IncidentV2Visibility$inboundSchema; /** @deprecated use `IncidentV2Visibility$outboundSchema` instead. */ export const outboundSchema = IncidentV2Visibility$outboundSchema; } /** @internal */ export const IncidentV2$inboundSchema: z.ZodType< IncidentV2, z.ZodTypeDef, unknown > = z.object({ call_url: z.string().optional(), created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)), creator: ActorV2$inboundSchema, custom_field_entries: z.array(CustomFieldEntryV1$inboundSchema), duration_metrics: z.array(IncidentDurationMetricWithValueV2$inboundSchema) .optional(), external_issue_reference: ExternalIssueReferenceV2$inboundSchema.optional(), id: z.string(), incident_role_assignments: z.array(IncidentRoleAssignmentV1$inboundSchema), incident_status: IncidentStatusV1$inboundSchema, incident_timestamp_values: z.array(IncidentTimestampWithValueV2$inboundSchema) .optional(), incident_type: IncidentTypeV1$inboundSchema.optional(), mode: IncidentV2Mode$inboundSchema, name: z.string(), permalink: z.string().optional(), postmortem_document_url: z.string().optional(), reference: z.string(), severity: SeverityV2$inboundSchema.optional(), slack_channel_id: z.string(), slack_channel_name: z.string().optional(), slack_team_id: z.string(), summary: z.string().optional(), updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v)), visibility: IncidentV2Visibility$inboundSchema, workload_minutes_late: z.number().optional(), workload_minutes_sleeping: z.number().optional(), workload_minutes_total: z.number().optional(), workload_minutes_working: z.number().optional(), }).transform((v) => { return remap$(v, { "call_url": "callUrl", "created_at": "createdAt", "custom_field_entries": "customFieldEntries", "duration_metrics": "durationMetrics", "external_issue_reference": "externalIssueReference", "incident_role_assignments": "incidentRoleAssignments", "incident_status": "incidentStatus", "incident_timestamp_values": "incidentTimestampValues", "incident_type": "incidentType", "postmortem_document_url": "postmortemDocumentUrl", "slack_channel_id": "slackChannelId", "slack_channel_name": "slackChannelName", "slack_team_id": "slackTeamId", "updated_at": "updatedAt", "workload_minutes_late": "workloadMinutesLate", "workload_minutes_sleeping": "workloadMinutesSleeping", "workload_minutes_total": "workloadMinutesTotal", "workload_minutes_working": "workloadMinutesWorking", }); }); /** @internal */ export type IncidentV2$Outbound = { call_url?: string | undefined; created_at: string; creator: ActorV2$Outbound; custom_field_entries: Array; duration_metrics?: | Array | undefined; external_issue_reference?: ExternalIssueReferenceV2$Outbound | undefined; id: string; incident_role_assignments: Array; incident_status: IncidentStatusV1$Outbound; incident_timestamp_values?: | Array | undefined; incident_type?: IncidentTypeV1$Outbound | undefined; mode: string; name: string; permalink?: string | undefined; postmortem_document_url?: string | undefined; reference: string; severity?: SeverityV2$Outbound | undefined; slack_channel_id: string; slack_channel_name?: string | undefined; slack_team_id: string; summary?: string | undefined; updated_at: string; visibility: string; workload_minutes_late?: number | undefined; workload_minutes_sleeping?: number | undefined; workload_minutes_total?: number | undefined; workload_minutes_working?: number | undefined; }; /** @internal */ export const IncidentV2$outboundSchema: z.ZodType< IncidentV2$Outbound, z.ZodTypeDef, IncidentV2 > = z.object({ callUrl: z.string().optional(), createdAt: z.date().transform(v => v.toISOString()), creator: ActorV2$outboundSchema, customFieldEntries: z.array(CustomFieldEntryV1$outboundSchema), durationMetrics: z.array(IncidentDurationMetricWithValueV2$outboundSchema) .optional(), externalIssueReference: ExternalIssueReferenceV2$outboundSchema.optional(), id: z.string(), incidentRoleAssignments: z.array(IncidentRoleAssignmentV1$outboundSchema), incidentStatus: IncidentStatusV1$outboundSchema, incidentTimestampValues: z.array(IncidentTimestampWithValueV2$outboundSchema) .optional(), incidentType: IncidentTypeV1$outboundSchema.optional(), mode: IncidentV2Mode$outboundSchema, name: z.string(), permalink: z.string().optional(), postmortemDocumentUrl: z.string().optional(), reference: z.string(), severity: SeverityV2$outboundSchema.optional(), slackChannelId: z.string(), slackChannelName: z.string().optional(), slackTeamId: z.string(), summary: z.string().optional(), updatedAt: z.date().transform(v => v.toISOString()), visibility: IncidentV2Visibility$outboundSchema, workloadMinutesLate: z.number().optional(), workloadMinutesSleeping: z.number().optional(), workloadMinutesTotal: z.number().optional(), workloadMinutesWorking: z.number().optional(), }).transform((v) => { return remap$(v, { callUrl: "call_url", createdAt: "created_at", customFieldEntries: "custom_field_entries", durationMetrics: "duration_metrics", externalIssueReference: "external_issue_reference", incidentRoleAssignments: "incident_role_assignments", incidentStatus: "incident_status", incidentTimestampValues: "incident_timestamp_values", incidentType: "incident_type", postmortemDocumentUrl: "postmortem_document_url", slackChannelId: "slack_channel_id", slackChannelName: "slack_channel_name", slackTeamId: "slack_team_id", updatedAt: "updated_at", workloadMinutesLate: "workload_minutes_late", workloadMinutesSleeping: "workload_minutes_sleeping", workloadMinutesTotal: "workload_minutes_total", workloadMinutesWorking: "workload_minutes_working", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace IncidentV2$ { /** @deprecated use `IncidentV2$inboundSchema` instead. */ export const inboundSchema = IncidentV2$inboundSchema; /** @deprecated use `IncidentV2$outboundSchema` instead. */ export const outboundSchema = IncidentV2$outboundSchema; /** @deprecated use `IncidentV2$Outbound` instead. */ export type Outbound = IncidentV2$Outbound; }