/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
import { ClosedEnum } from "../types/enums.js";
import {
IncidentEntityPaginated,
IncidentEntityPaginated$zodSchema,
} from "./incidententitypaginated.js";
/**
* A matching strategy for the tags provided
*/
export const ListIncidentsTagMatchStrategy = {
Any: "any",
MatchAll: "match_all",
Exclude: "exclude",
} as const;
/**
* A matching strategy for the tags provided
*/
export type ListIncidentsTagMatchStrategy = ClosedEnum<
typeof ListIncidentsTagMatchStrategy
>;
export const ListIncidentsTagMatchStrategy$zodSchema = z.enum([
"any",
"match_all",
"exclude",
]).describe("A matching strategy for the tags provided");
export type ListIncidentsRequest = {
page?: number | null | undefined;
per_page?: number | null | undefined;
conditions?: string | null | undefined;
environments?: string | null | undefined;
services?: string | null | undefined;
functionalities?: string | null | undefined;
excluded_infrastructure_ids?: string | null | undefined;
teams?: string | null | undefined;
assigned_teams?: string | null | undefined;
status?: string | null | undefined;
start_date?: string | null | undefined;
end_date?: string | null | undefined;
resolved_at_or_after?: string | null | undefined;
resolved_at_or_before?: string | null | undefined;
closed_at_or_after?: string | null | undefined;
closed_at_or_before?: string | null | undefined;
created_at_or_after?: string | null | undefined;
created_at_or_before?: string | null | undefined;
query?: string | null | undefined;
name?: string | null | undefined;
saved_search_id?: string | null | undefined;
priorities?: string | null | undefined;
priority_not_set?: boolean | null | undefined;
severities?: string | null | undefined;
severity_not_set?: boolean | null | undefined;
current_milestones?: string | null | undefined;
tags?: string | null | undefined;
tag_match_strategy?: ListIncidentsTagMatchStrategy | null | undefined;
archived?: boolean | null | undefined;
updated_after?: string | null | undefined;
updated_before?: string | null | undefined;
incident_type_id?: string | null | undefined;
retrospective_templates?: string | null | undefined;
attached_runbooks?: string | null | undefined;
};
export const ListIncidentsRequest$zodSchema: z.ZodType<ListIncidentsRequest> = z
.object({
archived: z.boolean().describe("Return archived incidents").nullable()
.optional(),
assigned_teams: z.string().describe(
"A comma separated list of IDs for assigned teams or 'is_empty' to filter for incidents with no active team assignments",
).nullable().optional(),
attached_runbooks: z.string().describe(
"A comma separated list of runbook IDs",
).nullable().optional(),
closed_at_or_after: z.iso.datetime({ offset: true }).describe(
"Filters for incidents that were closed at or after this time",
).nullable().optional(),
closed_at_or_before: z.iso.datetime({ offset: true }).describe(
"Filters for incidents that were closed at or before this time",
).nullable().optional(),
conditions: z.string().describe(
"A JSON string that defines 'logic' and 'user_data'",
).nullable().optional(),
created_at_or_after: z.iso.datetime({ offset: true }).describe(
"Filters for incidents that were created at or after this time",
).nullable().optional(),
created_at_or_before: z.iso.datetime({ offset: true }).describe(
"Filters for incidents that were created at or before this time",
).nullable().optional(),
current_milestones: z.string().describe(
"A comma separated list of current milestones",
).nullable().optional(),
end_date: z.iso.datetime({ offset: true }).describe(
"Filters for incidents that started on or before this date",
).nullable().optional(),
environments: z.string().describe(
"A comma separated list of environment IDs or 'is_empty' to filter for incidents with no impacted environments",
).nullable().optional(),
excluded_infrastructure_ids: z.string().describe(
"A comma separated list of infrastructure IDs. Returns incidents that do not have the following infrastructure ids associated with them.",
).nullable().optional(),
functionalities: z.string().describe(
"A comma separated list of functionality IDs or 'is_empty' to filter for incidents with no impacted functionalities",
).nullable().optional(),
incident_type_id: z.string().describe(
"A comma separated list of incident type IDs",
).nullable().optional(),
name: z.string().describe("A query to search incidents by their name")
.nullable().optional(),
page: z.int().nullable().optional(),
per_page: z.int().nullable().optional(),
priorities: z.string().describe("A text value of priority").nullable()
.optional(),
priority_not_set: z.boolean().describe(
"Flag for including incidents where priority has not been set",
).nullable().optional(),
query: z.string().describe(
"A text query for an incident that searches on name, summary, and desciption",
).nullable().optional(),
resolved_at_or_after: z.iso.datetime({ offset: true }).describe(
"Filters for incidents that were resolved at or after this time. Combine this with the `current_milestones` parameter if you wish to omit incidents that were re-opened and are still active.",
).nullable().optional(),
resolved_at_or_before: z.iso.datetime({ offset: true }).describe(
"Filters for incidents that were resolved at or before this time. Combine this with the `current_milestones` parameter if you wish to omit incidents that were re-opened and are still active.",
).nullable().optional(),
retrospective_templates: z.string().describe(
"A comma separated list of retrospective template IDs",
).nullable().optional(),
saved_search_id: z.string().describe("The id of a previously saved search.")
.nullable().optional(),
services: z.string().describe(
"A comma separated list of service IDs or 'is_empty' to filter for incidents with no impacted services",
).nullable().optional(),
severities: z.string().describe("A text value of severity").nullable()
.optional(),
severity_not_set: z.boolean().describe(
"Flag for including incidents where severity has not been set",
).nullable().optional(),
start_date: z.iso.datetime({ offset: true }).describe(
"Filters for incidents that started on or after this date",
).nullable().optional(),
status: z.string().describe("Incident status").nullable().optional(),
tag_match_strategy: ListIncidentsTagMatchStrategy$zodSchema.nullable()
.optional(),
tags: z.string().describe("A comma separated list of tags").nullable()
.optional(),
teams: z.string().describe("A comma separated list of team IDs").nullable()
.optional(),
updated_after: z.iso.datetime({ offset: true }).describe(
"Filters for incidents that were updated after this date",
).nullable().optional(),
updated_before: z.iso.datetime({ offset: true }).describe(
"Filters for incidents that were updated before this date",
).nullable().optional(),
});
export type ListIncidentsResponse = {
ContentType: string;
StatusCode: number;
RawResponse: Response;
IncidentEntityPaginated?: IncidentEntityPaginated | undefined;
};
export const ListIncidentsResponse$zodSchema: z.ZodType<ListIncidentsResponse> =
z.object({
ContentType: z.string(),
IncidentEntityPaginated: IncidentEntityPaginated$zodSchema.optional(),
RawResponse: z.custom<Response>(x => x instanceof Response),
StatusCode: z.int(),
});