/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { expect, test } from "vitest"; import { Incidentio } from "../index.js"; test("Incidents V1 Incidents V1 #List", async () => { const incidentio = new Incidentio(); const result = await incidentio.incidentsV1.list({ pageSize: 25, after: "01FDAG4SAP5TYPT98WGR2N7W91", status: [ "declined", ], }); expect(result).toBeDefined(); expect(result).toBeDefined(); expect(result).toEqual({ incidents: [ { callUrl: "https://zoom.us/foo", createdAt: new Date("2021-08-17T13:28:57.801578Z"), creator: { apiKey: { id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "My test API key", }, user: { email: "lisa@incident.io", id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Lisa Karlin Curtis", role: "viewer", slackUserId: "U02AYNF2XJM", }, }, customFieldEntries: [ { customField: { description: "Which team is impacted by this issue", fieldType: "single_select", id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Affected Team", options: [ { customFieldId: "01FCNDV6P870EA6S7TK1DSYDG0", id: "01FCNDV6P870EA6S7TK1DSYDG0", sortKey: 10, value: "Product", }, ], }, values: [ { valueCatalogEntry: { aliases: [ "lawrence@incident.io", "lawrence", ], externalId: "761722cd-d1d7-477b-ac7e-90f9e079dc33", id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Primary On-call", }, valueLink: "https://google.com/", valueNumeric: "123.456", valueOption: { customFieldId: "01FCNDV6P870EA6S7TK1DSYDG0", id: "01FCNDV6P870EA6S7TK1DSYDG0", sortKey: 10, value: "Product", }, valueText: "This is my text field, I hope you like it", }, ], }, ], id: "01FDAG4SAP5TYPT98WGR2N7W91", incidentRoleAssignments: [ { assignee: { email: "lisa@incident.io", id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Lisa Karlin Curtis", role: "viewer", slackUserId: "U02AYNF2XJM", }, role: { createdAt: new Date("2021-08-17T13:28:57.801578Z"), description: "The person currently coordinating the incident", id: "01FCNDV6P870EA6S7TK1DSYDG0", instructions: "Take point on the incident; Make sure people are clear on responsibilities", name: "Incident Lead", required: false, roleType: "lead", shortform: "lead", updatedAt: new Date("2021-08-17T13:28:57.801578Z"), }, }, ], incidentType: { createInTriage: "always", createdAt: new Date("2021-08-17T13:28:57.801578Z"), description: "Customer facing production outages", id: "01FCNDV6P870EA6S7TK1DSYDG0", isDefault: false, name: "Production Outage", privateIncidentsOnly: false, updatedAt: new Date("2021-08-17T13:28:57.801578Z"), }, mode: "real", name: "Our database is sad", permalink: "https://app.incident.io/incidents/123", postmortemDocumentUrl: "https://docs.google.com/my_doc_id", reference: "INC-123", severity: { createdAt: new Date("2021-08-17T13:28:57.801578Z"), description: "Issues with **low impact**.", id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Minor", rank: 1, updatedAt: new Date("2021-08-17T13:28:57.801578Z"), }, slackChannelId: "C02AW36C1M5", slackChannelName: "inc-165-green-parrot", slackTeamId: "T02A1FSLE8J", status: "triage", summary: "Our database is really really sad, and we don't know why yet.", timestamps: [ { lastOccurredAt: new Date("2021-08-17T13:28:57.801578Z"), name: "last_activity", }, ], updatedAt: new Date("2021-08-17T13:28:57.801578Z"), visibility: "public", }, ], paginationMeta: { after: "01FCNDV6P870EA6S7TK1DSYDG0", pageSize: 25, totalRecordCount: 238, }, }); }); test("Incidents V1 Incidents V1 #List Default", async () => { const incidentio = new Incidentio(); const result = await incidentio.incidentsV1.list({ pageSize: 25, after: "01FDAG4SAP5TYPT98WGR2N7W91", status: [ "declined", ], }); expect(result).toBeDefined(); expect(result).toBeDefined(); expect(result).toEqual({ incidents: [ { callUrl: "https://zoom.us/foo", createdAt: new Date("2021-08-17T13:28:57.801578Z"), creator: { apiKey: { id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "My test API key", }, user: { email: "lisa@incident.io", id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Lisa Karlin Curtis", role: "viewer", slackUserId: "U02AYNF2XJM", }, }, customFieldEntries: [ { customField: { description: "Which team is impacted by this issue", fieldType: "single_select", id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Affected Team", options: [ { customFieldId: "01FCNDV6P870EA6S7TK1DSYDG0", id: "01FCNDV6P870EA6S7TK1DSYDG0", sortKey: 10, value: "Product", }, ], }, values: [ { valueCatalogEntry: { aliases: [ "lawrence@incident.io", "lawrence", ], externalId: "761722cd-d1d7-477b-ac7e-90f9e079dc33", id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Primary On-call", }, valueLink: "https://google.com/", valueNumeric: "123.456", valueOption: { customFieldId: "01FCNDV6P870EA6S7TK1DSYDG0", id: "01FCNDV6P870EA6S7TK1DSYDG0", sortKey: 10, value: "Product", }, valueText: "This is my text field, I hope you like it", }, ], }, ], id: "01FDAG4SAP5TYPT98WGR2N7W91", incidentRoleAssignments: [ { assignee: { email: "lisa@incident.io", id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Lisa Karlin Curtis", role: "viewer", slackUserId: "U02AYNF2XJM", }, role: { createdAt: new Date("2021-08-17T13:28:57.801578Z"), description: "The person currently coordinating the incident", id: "01FCNDV6P870EA6S7TK1DSYDG0", instructions: "Take point on the incident; Make sure people are clear on responsibilities", name: "Incident Lead", required: false, roleType: "lead", shortform: "lead", updatedAt: new Date("2021-08-17T13:28:57.801578Z"), }, }, ], incidentType: { createInTriage: "always", createdAt: new Date("2021-08-17T13:28:57.801578Z"), description: "Customer facing production outages", id: "01FCNDV6P870EA6S7TK1DSYDG0", isDefault: false, name: "Production Outage", privateIncidentsOnly: false, updatedAt: new Date("2021-08-17T13:28:57.801578Z"), }, mode: "real", name: "Our database is sad", permalink: "https://app.incident.io/incidents/123", postmortemDocumentUrl: "https://docs.google.com/my_doc_id", reference: "INC-123", severity: { createdAt: new Date("2021-08-17T13:28:57.801578Z"), description: "Issues with **low impact**.", id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Minor", rank: 1, updatedAt: new Date("2021-08-17T13:28:57.801578Z"), }, slackChannelId: "C02AW36C1M5", slackChannelName: "inc-165-green-parrot", slackTeamId: "T02A1FSLE8J", status: "triage", summary: "Our database is really really sad, and we don't know why yet.", timestamps: [ { lastOccurredAt: new Date("2021-08-17T13:28:57.801578Z"), name: "last_activity", }, ], updatedAt: new Date("2021-08-17T13:28:57.801578Z"), visibility: "public", }, ], paginationMeta: { after: "01FCNDV6P870EA6S7TK1DSYDG0", pageSize: 25, totalRecordCount: 238, }, }); }); test("Incidents V1 Incidents V1 #Create", async () => { const incidentio = new Incidentio(); const result = await incidentio.incidentsV1.create({ customFieldEntries: [ { customFieldId: "01FCNDV6P870EA6S7TK1DSYDG0", values: [ { id: "01FCNDV6P870EA6S7TK1DSYDG0", valueCatalogEntryId: "01FCNDV6P870EA6S7TK1DSYDG0", valueLink: "https://google.com/", valueNumeric: "123.456", valueOptionId: "01FCNDV6P870EA6S7TK1DSYDG0", valueText: "This is my text field, I hope you like it", valueTimestamp: "", }, ], }, ], idempotencyKey: "alert-uuid", incidentRoleAssignments: [ { assignee: { email: "bob@example.com", id: "01G0J1EXE7AXZ2C93K61WBPYEH", slackUserId: "USER123", }, incidentRoleId: "01FH5TZRWMNAFB0DZ23FD1TV96", }, ], incidentTypeId: "01FH5TZRWMNAFB0DZ23FD1TV96", mode: "real", name: "Our database is sad", severityId: "01FH5TZRWMNAFB0DZ23FD1TV96", slackTeamId: "T02A1FSLE8J", sourceMessageChannelId: "C02AW36C1M5", sourceMessageTimestamp: "1653650280.526509", status: "triage", summary: "Our database is really really sad, and we don't know why yet.", visibility: "public", }); expect(result).toBeDefined(); expect(result).toBeDefined(); expect(result).toEqual({ incident: { callUrl: "https://zoom.us/foo", createdAt: new Date("2021-08-17T13:28:57.801578Z"), creator: { apiKey: { id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "My test API key", }, user: { email: "lisa@incident.io", id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Lisa Karlin Curtis", role: "viewer", slackUserId: "U02AYNF2XJM", }, }, customFieldEntries: [ { customField: { description: "Which team is impacted by this issue", fieldType: "single_select", id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Affected Team", options: [ { customFieldId: "01FCNDV6P870EA6S7TK1DSYDG0", id: "01FCNDV6P870EA6S7TK1DSYDG0", sortKey: 10, value: "Product", }, ], }, values: [ { valueCatalogEntry: { aliases: [ "lawrence@incident.io", "lawrence", ], externalId: "761722cd-d1d7-477b-ac7e-90f9e079dc33", id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Primary On-call", }, valueLink: "https://google.com/", valueNumeric: "123.456", valueOption: { customFieldId: "01FCNDV6P870EA6S7TK1DSYDG0", id: "01FCNDV6P870EA6S7TK1DSYDG0", sortKey: 10, value: "Product", }, valueText: "This is my text field, I hope you like it", }, ], }, ], id: "01FDAG4SAP5TYPT98WGR2N7W91", incidentRoleAssignments: [ { assignee: { email: "lisa@incident.io", id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Lisa Karlin Curtis", role: "viewer", slackUserId: "U02AYNF2XJM", }, role: { createdAt: new Date("2021-08-17T13:28:57.801578Z"), description: "The person currently coordinating the incident", id: "01FCNDV6P870EA6S7TK1DSYDG0", instructions: "Take point on the incident; Make sure people are clear on responsibilities", name: "Incident Lead", required: false, roleType: "lead", shortform: "lead", updatedAt: new Date("2021-08-17T13:28:57.801578Z"), }, }, ], incidentType: { createInTriage: "always", createdAt: new Date("2021-08-17T13:28:57.801578Z"), description: "Customer facing production outages", id: "01FCNDV6P870EA6S7TK1DSYDG0", isDefault: false, name: "Production Outage", privateIncidentsOnly: false, updatedAt: new Date("2021-08-17T13:28:57.801578Z"), }, mode: "real", name: "Our database is sad", permalink: "https://app.incident.io/incidents/123", postmortemDocumentUrl: "https://docs.google.com/my_doc_id", reference: "INC-123", severity: { createdAt: new Date("2021-08-17T13:28:57.801578Z"), description: "Issues with **low impact**.", id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Minor", rank: 1, updatedAt: new Date("2021-08-17T13:28:57.801578Z"), }, slackChannelId: "C02AW36C1M5", slackChannelName: "inc-165-green-parrot", slackTeamId: "T02A1FSLE8J", status: "triage", summary: "Our database is really really sad, and we don't know why yet.", timestamps: [ { lastOccurredAt: new Date("2021-08-17T13:28:57.801578Z"), name: "last_activity", }, ], updatedAt: new Date("2021-08-17T13:28:57.801578Z"), visibility: "public", }, }); }); test("Incidents V1 Incidents V1 #Show", async () => { const incidentio = new Incidentio(); const result = await incidentio.incidentsV1.get({ id: "01FDAG4SAP5TYPT98WGR2N7W91", }); expect(result).toBeDefined(); expect(result).toBeDefined(); expect(result).toEqual({ incident: { callUrl: "https://zoom.us/foo", createdAt: new Date("2021-08-17T13:28:57.801578Z"), creator: { apiKey: { id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "My test API key", }, user: { email: "lisa@incident.io", id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Lisa Karlin Curtis", role: "viewer", slackUserId: "U02AYNF2XJM", }, }, customFieldEntries: [ { customField: { description: "Which team is impacted by this issue", fieldType: "single_select", id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Affected Team", options: [ { customFieldId: "01FCNDV6P870EA6S7TK1DSYDG0", id: "01FCNDV6P870EA6S7TK1DSYDG0", sortKey: 10, value: "Product", }, ], }, values: [ { valueCatalogEntry: { aliases: [ "lawrence@incident.io", "lawrence", ], externalId: "761722cd-d1d7-477b-ac7e-90f9e079dc33", id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Primary On-call", }, valueLink: "https://google.com/", valueNumeric: "123.456", valueOption: { customFieldId: "01FCNDV6P870EA6S7TK1DSYDG0", id: "01FCNDV6P870EA6S7TK1DSYDG0", sortKey: 10, value: "Product", }, valueText: "This is my text field, I hope you like it", }, ], }, ], id: "01FDAG4SAP5TYPT98WGR2N7W91", incidentRoleAssignments: [ { assignee: { email: "lisa@incident.io", id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Lisa Karlin Curtis", role: "viewer", slackUserId: "U02AYNF2XJM", }, role: { createdAt: new Date("2021-08-17T13:28:57.801578Z"), description: "The person currently coordinating the incident", id: "01FCNDV6P870EA6S7TK1DSYDG0", instructions: "Take point on the incident; Make sure people are clear on responsibilities", name: "Incident Lead", required: false, roleType: "lead", shortform: "lead", updatedAt: new Date("2021-08-17T13:28:57.801578Z"), }, }, ], incidentType: { createInTriage: "always", createdAt: new Date("2021-08-17T13:28:57.801578Z"), description: "Customer facing production outages", id: "01FCNDV6P870EA6S7TK1DSYDG0", isDefault: false, name: "Production Outage", privateIncidentsOnly: false, updatedAt: new Date("2021-08-17T13:28:57.801578Z"), }, mode: "real", name: "Our database is sad", permalink: "https://app.incident.io/incidents/123", postmortemDocumentUrl: "https://docs.google.com/my_doc_id", reference: "INC-123", severity: { createdAt: new Date("2021-08-17T13:28:57.801578Z"), description: "Issues with **low impact**.", id: "01FCNDV6P870EA6S7TK1DSYDG0", name: "Minor", rank: 1, updatedAt: new Date("2021-08-17T13:28:57.801578Z"), }, slackChannelId: "C02AW36C1M5", slackChannelName: "inc-165-green-parrot", slackTeamId: "T02A1FSLE8J", status: "triage", summary: "Our database is really really sad, and we don't know why yet.", timestamps: [ { lastOccurredAt: new Date("2021-08-17T13:28:57.801578Z"), name: "last_activity", }, ], updatedAt: new Date("2021-08-17T13:28:57.801578Z"), visibility: "public", }, }); });