/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { expect, test } from "vitest"; import { Incidentio } from "../index.js"; test("Alert Routes Alert Routes V2 #Create", async () => { const incidentio = new Incidentio(); const result = await incidentio.alertRoutes.create({ alertSourceIds: [ "02FCNDV6P870EA6S7TK1DSYDG2", ], autoDeclineEnabled: false, conditionGroups: [ { conditions: [ { operation: "one_of", paramBindings: [ { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, ], subject: "incident.severity", }, ], }, ], deferTimeSeconds: 1, enabled: false, escalationBindings: [ { binding: { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, }, ], expressions: [ { elseBranch: { result: { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, }, label: "Team Slack channel", operations: [ { branches: { branches: [ { conditionGroups: [ { conditions: [ { operation: "one_of", paramBindings: [ { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, ], subject: "incident.severity", }, ], }, ], result: { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, }, ], returns: { array: true, type: "IncidentStatus", }, }, filter: { conditionGroups: [ { conditions: [ { operation: "one_of", paramBindings: [ { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, ], subject: "incident.severity", }, ], }, ], }, navigate: { reference: "catalog_attribute[\"01FCNDV6P870EA6S7TK1DSYD5H\"]", }, operationType: "navigate", parse: { returns: { array: true, type: "IncidentStatus", }, source: "metadata.annotations[\"github.com/repo\"]", }, }, ], reference: "abc123", rootReference: "incident.status", }, ], groupingKeys: [ { id: "01FCNDV6P870EA6S7TK1DSYDG0", }, ], groupingWindowSeconds: 1, incidentConditionGroups: [ { conditions: [ { operation: "one_of", paramBindings: [ { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, ], subject: "incident.severity", }, ], }, ], incidentEnabled: false, name: "Production incidents", template: { customFieldPriorities: { "abc123": "abc123", }, customFields: { "custom_field_10014": { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, }, incidentMode: { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, incidentType: { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, name: { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, prioritySeverity: "severity-first-wins", severity: { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, summary: { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, workspace: { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, }, }); expect(result).toBeDefined(); expect(result).toBeDefined(); expect(result).toEqual({ alertRoute: { conditionGroups: [ { conditions: [ { operation: { label: "Lawrence Jones", value: "01FCQSP07Z74QMMYPDDGQB9FTG", }, paramBindings: [ { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, ], subject: { label: "Incident Severity", reference: "incident.severity", }, }, ], }, ], deferTimeSeconds: 1, escalationBindings: [ { binding: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, }, ], expressions: [ { elseBranch: { result: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, }, label: "Team Slack channel", operations: [ { branches: { branches: [ { conditionGroups: [ { conditions: [ { operation: { label: "Lawrence Jones", value: "01FCQSP07Z74QMMYPDDGQB9FTG", }, paramBindings: [ { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, ], subject: { label: "Incident Severity", reference: "incident.severity", }, }, ], }, ], result: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, }, ], returns: { array: true, type: "IncidentStatus", }, }, filter: { conditionGroups: [ { conditions: [ { operation: { label: "Lawrence Jones", value: "01FCQSP07Z74QMMYPDDGQB9FTG", }, paramBindings: [ { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, ], subject: { label: "Incident Severity", reference: "incident.severity", }, }, ], }, ], }, navigate: { reference: "1235", referenceLabel: "Teams", }, operationType: "navigate", parse: { returns: { array: true, type: "IncidentStatus", }, source: "metadata.annotations[\"github.com/repo\"]", }, returns: { array: true, type: "IncidentStatus", }, }, ], reference: "abc123", returns: { array: true, type: "IncidentStatus", }, rootReference: "incident.status", }, ], groupingKeys: [ { id: "01FCNDV6P870EA6S7TK1DSYDG0", }, ], groupingWindowSeconds: 1, id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Production incidents", template: { customFieldPriorities: { "abc123": "first-wins", }, customFields: { "custom_field_10014": { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, }, incidentMode: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, incidentType: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, name: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, prioritySeverity: "severity-first-wins", severity: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, summary: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, workspace: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, }, }, }); }); test("Alert Routes Alert Routes V2 #Destroy", async () => { const incidentio = new Incidentio(); await incidentio.alertRoutes.delete({ id: "01FCNDV6P870EA6S7TK1DSYDG0", }); }); test("Alert Routes Alert Routes V2 #Show", async () => { const incidentio = new Incidentio(); const result = await incidentio.alertRoutes.show({ id: "01FCNDV6P870EA6S7TK1DSYDG0", }); expect(result).toBeDefined(); expect(result).toBeDefined(); expect(result).toEqual({ alertRoute: { conditionGroups: [ { conditions: [ { operation: { label: "Lawrence Jones", value: "01FCQSP07Z74QMMYPDDGQB9FTG", }, paramBindings: [ { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, ], subject: { label: "Incident Severity", reference: "incident.severity", }, }, ], }, ], deferTimeSeconds: 1, escalationBindings: [ { binding: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, }, ], expressions: [ { elseBranch: { result: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, }, label: "Team Slack channel", operations: [ { branches: { branches: [ { conditionGroups: [ { conditions: [ { operation: { label: "Lawrence Jones", value: "01FCQSP07Z74QMMYPDDGQB9FTG", }, paramBindings: [ { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, ], subject: { label: "Incident Severity", reference: "incident.severity", }, }, ], }, ], result: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, }, ], returns: { array: true, type: "IncidentStatus", }, }, filter: { conditionGroups: [ { conditions: [ { operation: { label: "Lawrence Jones", value: "01FCQSP07Z74QMMYPDDGQB9FTG", }, paramBindings: [ { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, ], subject: { label: "Incident Severity", reference: "incident.severity", }, }, ], }, ], }, navigate: { reference: "1235", referenceLabel: "Teams", }, operationType: "navigate", parse: { returns: { array: true, type: "IncidentStatus", }, source: "metadata.annotations[\"github.com/repo\"]", }, returns: { array: true, type: "IncidentStatus", }, }, ], reference: "abc123", returns: { array: true, type: "IncidentStatus", }, rootReference: "incident.status", }, ], groupingKeys: [ { id: "01FCNDV6P870EA6S7TK1DSYDG0", }, ], groupingWindowSeconds: 1, id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Production incidents", template: { customFieldPriorities: { "abc123": "first-wins", }, customFields: { "custom_field_10014": { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, }, incidentMode: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, incidentType: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, name: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, prioritySeverity: "severity-first-wins", severity: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, summary: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, workspace: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, }, }, }); }); test("Alert Routes Alert Routes V2 #Update", async () => { const incidentio = new Incidentio(); const result = await incidentio.alertRoutes.update({ id: "01FCNDV6P870EA6S7TK1DSYDG0", updateRequestBody: { alertSourceIds: [ "02FCNDV6P870EA6S7TK1DSYDG2", ], autoDeclineEnabled: false, conditionGroups: [ { conditions: [ { operation: "one_of", paramBindings: [ { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, ], subject: "incident.severity", }, ], }, ], deferTimeSeconds: 1, enabled: false, escalationBindings: [ { binding: { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, }, ], expressions: [ { elseBranch: { result: { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, }, label: "Team Slack channel", operations: [ { branches: { branches: [ { conditionGroups: [ { conditions: [ { operation: "one_of", paramBindings: [ { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, ], subject: "incident.severity", }, ], }, ], result: { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, }, ], returns: { array: true, type: "IncidentStatus", }, }, filter: { conditionGroups: [ { conditions: [ { operation: "one_of", paramBindings: [ { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, ], subject: "incident.severity", }, ], }, ], }, navigate: { reference: "catalog_attribute[\"01FCNDV6P870EA6S7TK1DSYD5H\"]", }, operationType: "navigate", parse: { returns: { array: true, type: "IncidentStatus", }, source: "metadata.annotations[\"github.com/repo\"]", }, }, ], reference: "abc123", rootReference: "incident.status", }, ], groupingKeys: [ { id: "01FCNDV6P870EA6S7TK1DSYDG0", }, ], groupingWindowSeconds: 1, incidentConditionGroups: [ { conditions: [ { operation: "one_of", paramBindings: [ { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, ], subject: "incident.severity", }, ], }, ], incidentEnabled: false, name: "Production incidents", template: { customFieldPriorities: { "abc123": "abc123", }, customFields: { "custom_field_10014": { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, }, incidentMode: { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, incidentType: { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, name: { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, prioritySeverity: "severity-first-wins", severity: { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, summary: { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, workspace: { arrayValue: [ { literal: "SEV123", reference: "incident.severity", }, ], value: { literal: "SEV123", reference: "incident.severity", }, }, }, }, }); expect(result).toBeDefined(); expect(result).toBeDefined(); expect(result).toEqual({ alertRoute: { conditionGroups: [ { conditions: [ { operation: { label: "Lawrence Jones", value: "01FCQSP07Z74QMMYPDDGQB9FTG", }, paramBindings: [ { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, ], subject: { label: "Incident Severity", reference: "incident.severity", }, }, ], }, ], deferTimeSeconds: 1, escalationBindings: [ { binding: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, }, ], expressions: [ { elseBranch: { result: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, }, label: "Team Slack channel", operations: [ { branches: { branches: [ { conditionGroups: [ { conditions: [ { operation: { label: "Lawrence Jones", value: "01FCQSP07Z74QMMYPDDGQB9FTG", }, paramBindings: [ { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, ], subject: { label: "Incident Severity", reference: "incident.severity", }, }, ], }, ], result: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, }, ], returns: { array: true, type: "IncidentStatus", }, }, filter: { conditionGroups: [ { conditions: [ { operation: { label: "Lawrence Jones", value: "01FCQSP07Z74QMMYPDDGQB9FTG", }, paramBindings: [ { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, ], subject: { label: "Incident Severity", reference: "incident.severity", }, }, ], }, ], }, navigate: { reference: "1235", referenceLabel: "Teams", }, operationType: "navigate", parse: { returns: { array: true, type: "IncidentStatus", }, source: "metadata.annotations[\"github.com/repo\"]", }, returns: { array: true, type: "IncidentStatus", }, }, ], reference: "abc123", returns: { array: true, type: "IncidentStatus", }, rootReference: "incident.status", }, ], groupingKeys: [ { id: "01FCNDV6P870EA6S7TK1DSYDG0", }, ], groupingWindowSeconds: 1, id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Production incidents", template: { customFieldPriorities: { "abc123": "first-wins", }, customFields: { "custom_field_10014": { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, }, incidentMode: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, incidentType: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, name: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, prioritySeverity: "severity-first-wins", severity: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, summary: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, workspace: { arrayValue: [ { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, ], value: { label: "Lawrence Jones", literal: "SEV123", reference: "incident.severity", }, }, }, }, }); });