Files
simstudioai--sim/apps/sim/tools/incidentio/schedule_overrides_create.ts
T
wehub-resource-sync d25d482dc2
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:20:55 +08:00

137 lines
4.2 KiB
TypeScript

import type {
IncidentioScheduleOverridesCreateParams,
IncidentioScheduleOverridesCreateResponse,
} from '@/tools/incidentio/types'
import type { ToolConfig } from '@/tools/types'
export const scheduleOverridesCreateTool: ToolConfig<
IncidentioScheduleOverridesCreateParams,
IncidentioScheduleOverridesCreateResponse
> = {
id: 'incidentio_schedule_overrides_create',
name: 'Create Schedule Override',
description: 'Create a new schedule override in incident.io',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'incident.io API Key',
},
rotation_id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'The ID of the rotation to override (e.g., "01FCNDV6P870EA6S7TK1DSYDG0")',
},
layer_id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'The ID of the layer this override applies to',
},
schedule_id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'The ID of the schedule (e.g., "01FCNDV6P870EA6S7TK1DSYDG0")',
},
user_id: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'The ID of the user to assign (provide one of: user_id, user_email, or user_slack_id)',
},
user_email: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'The email of the user to assign (provide one of: user_id, user_email, or user_slack_id)',
},
user_slack_id: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'The Slack ID of the user to assign (provide one of: user_id, user_email, or user_slack_id)',
},
start_at: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'When the override starts in ISO 8601 format (e.g., "2024-01-15T09:00:00Z")',
},
end_at: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'When the override ends in ISO 8601 format (e.g., "2024-01-22T09:00:00Z")',
},
},
request: {
url: 'https://api.incident.io/v2/schedule_overrides',
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/json',
Authorization: `Bearer ${params.apiKey}`,
}),
body: (params) => {
const user: { id?: string; email?: string; slack_user_id?: string } = {}
if (params.user_id) user.id = params.user_id
if (params.user_email) user.email = params.user_email
if (params.user_slack_id) user.slack_user_id = params.user_slack_id
return {
layer_id: params.layer_id.trim(),
rotation_id: params.rotation_id,
schedule_id: params.schedule_id,
user,
start_at: params.start_at,
end_at: params.end_at,
}
},
},
transformResponse: async (response: Response) => {
const data = await response.json()
return {
success: true,
output: {
override: data.override || data,
},
}
},
outputs: {
override: {
type: 'object',
description: 'The created schedule override',
properties: {
id: { type: 'string', description: 'The override ID' },
layer_id: { type: 'string', description: 'The schedule layer ID' },
rotation_id: { type: 'string', description: 'The rotation ID' },
schedule_id: { type: 'string', description: 'The schedule ID' },
user: {
type: 'object',
description: 'User assigned to this override',
properties: {
id: { type: 'string', description: 'User ID' },
name: { type: 'string', description: 'User name' },
email: { type: 'string', description: 'User email' },
},
},
start_at: { type: 'string', description: 'When the override starts' },
end_at: { type: 'string', description: 'When the override ends' },
created_at: { type: 'string', description: 'When the override was created' },
updated_at: { type: 'string', description: 'When the override was last updated' },
},
},
},
}