Skip to content

Commit c3411d4

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add GetScheduleOnCallUser specs (#2221)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent e37b988 commit c3411d4

File tree

20 files changed

+978
-4
lines changed

20 files changed

+978
-4
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-05-12 09:40:18.957439",
8-
"spec_repo_commit": "c4d0aeef"
7+
"regenerated": "2025-05-13 01:19:26.799719",
8+
"spec_repo_commit": "dc3b522f"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-05-12 09:40:19.013366",
13-
"spec_repo_commit": "c4d0aeef"
12+
"regenerated": "2025-05-13 01:19:26.816799",
13+
"spec_repo_commit": "dc3b522f"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36060,6 +36060,115 @@ components:
3606036060
description: Link to the Incident created on ServiceNow
3606136061
type: string
3606236062
type: object
36063+
Shift:
36064+
description: The definition of `Shift` object.
36065+
example:
36066+
data:
36067+
attributes:
36068+
end: '2025-05-07T03:53:01.206662873Z'
36069+
start: '2025-05-07T02:53:01.206662814Z'
36070+
id: 00000000-0000-0000-0000-000000000000
36071+
relationships:
36072+
user:
36073+
data:
36074+
id: 00000000-aba1-0000-0000-000000000000
36075+
type: users
36076+
type: shifts
36077+
included:
36078+
- attributes:
36079+
email: foo@bar.com
36080+
name: User 1
36081+
status: ''
36082+
id: 00000000-aba1-0000-0000-000000000000
36083+
type: users
36084+
properties:
36085+
data:
36086+
$ref: '#/components/schemas/ShiftData'
36087+
nullable: true
36088+
included:
36089+
description: The `Shift` `included`.
36090+
items:
36091+
$ref: '#/components/schemas/ShiftIncluded'
36092+
type: array
36093+
type: object
36094+
ShiftData:
36095+
description: The definition of `ShiftData` object.
36096+
properties:
36097+
attributes:
36098+
$ref: '#/components/schemas/ShiftDataAttributes'
36099+
id:
36100+
description: The `ShiftData` `id`.
36101+
type: string
36102+
relationships:
36103+
$ref: '#/components/schemas/ShiftDataRelationships'
36104+
type:
36105+
$ref: '#/components/schemas/ShiftDataType'
36106+
required:
36107+
- type
36108+
type: object
36109+
ShiftDataAttributes:
36110+
description: The definition of `ShiftDataAttributes` object.
36111+
properties:
36112+
end:
36113+
description: The end time of the shift.
36114+
format: date-time
36115+
type: string
36116+
start:
36117+
description: The start time of the shift.
36118+
format: date-time
36119+
type: string
36120+
type: object
36121+
ShiftDataRelationships:
36122+
description: The definition of `ShiftDataRelationships` object.
36123+
properties:
36124+
user:
36125+
$ref: '#/components/schemas/ShiftDataRelationshipsUser'
36126+
type: object
36127+
ShiftDataRelationshipsUser:
36128+
description: Defines the relationship between a shift and the user who is working
36129+
that shift.
36130+
properties:
36131+
data:
36132+
$ref: '#/components/schemas/ShiftDataRelationshipsUserData'
36133+
required:
36134+
- data
36135+
type: object
36136+
ShiftDataRelationshipsUserData:
36137+
description: Represents a reference to the user assigned to this shift, containing
36138+
the user's ID and resource type.
36139+
properties:
36140+
id:
36141+
description: Specifies the unique identifier of the user.
36142+
example: 00000000-0000-0000-0000-000000000000
36143+
type: string
36144+
type:
36145+
$ref: '#/components/schemas/ShiftDataRelationshipsUserDataType'
36146+
required:
36147+
- type
36148+
- id
36149+
type: object
36150+
ShiftDataRelationshipsUserDataType:
36151+
default: users
36152+
description: Indicates that the related resource is of type 'users'.
36153+
enum:
36154+
- users
36155+
example: users
36156+
type: string
36157+
x-enum-varnames:
36158+
- USERS
36159+
ShiftDataType:
36160+
default: shifts
36161+
description: Indicates that the resource is of type 'shifts'.
36162+
enum:
36163+
- shifts
36164+
example: shifts
36165+
type: string
36166+
x-enum-varnames:
36167+
- SHIFTS
36168+
ShiftIncluded:
36169+
description: The definition of `ShiftIncluded` object.
36170+
oneOf:
36171+
- $ref: '#/components/schemas/ScheduleUser'
3606336172
SingleAggregatedConnectionResponseArray:
3606436173
description: List of aggregated connections.
3606536174
example:
@@ -51922,6 +52031,56 @@ paths:
5192252031
operator: AND
5192352032
permissions:
5192452033
- on_call_write
52034+
/api/v2/on-call/schedules/{schedule_id}/on-call:
52035+
get:
52036+
description: Retrieves the user who is on-call for the specified schedule at
52037+
a given time.
52038+
operationId: GetScheduleOnCallUser
52039+
parameters:
52040+
- description: 'Specifies related resources to include in the response as a
52041+
comma-separated list. Allowed value: `user`.'
52042+
in: query
52043+
name: include
52044+
schema:
52045+
type: string
52046+
- description: The ID of the schedule.
52047+
in: path
52048+
name: schedule_id
52049+
required: true
52050+
schema:
52051+
example: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d
52052+
type: string
52053+
- description: Retrieves the on-call user at the given timestamp (ISO-8601).
52054+
Defaults to the current time if omitted."
52055+
in: query
52056+
name: filter[at_ts]
52057+
schema:
52058+
example: '2025-05-07T02:53:01Z'
52059+
type: string
52060+
responses:
52061+
'200':
52062+
content:
52063+
application/json:
52064+
schema:
52065+
$ref: '#/components/schemas/Shift'
52066+
description: OK
52067+
'400':
52068+
$ref: '#/components/responses/BadRequestResponse'
52069+
'401':
52070+
$ref: '#/components/responses/UnauthorizedResponse'
52071+
'403':
52072+
$ref: '#/components/responses/ForbiddenResponse'
52073+
'404':
52074+
$ref: '#/components/responses/NotFoundResponse'
52075+
'429':
52076+
$ref: '#/components/responses/TooManyRequestsResponse'
52077+
security:
52078+
- apiKeyAuth: []
52079+
appKeyAuth: []
52080+
- AuthZ: []
52081+
summary: Get the schedule of an on-call user
52082+
tags:
52083+
- On-Call
5192552084
/api/v2/on-call/teams/{team_id}/routing-rules:
5192652085
get:
5192752086
description: Get a team's on-call routing rules
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2025-05-13T00:41:58.620Z"
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
{
2+
"log": {
3+
"_recordingName": "On-Call/Get the schedule of an on-call user returns \"OK\" response",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "7554e56668358a89b7c941cae81fa1a5",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 627,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json"
22+
},
23+
{
24+
"_fromType": "array",
25+
"name": "content-type",
26+
"value": "application/json"
27+
}
28+
],
29+
"headersSize": 572,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"data\":{\"attributes\":{\"layers\":[{\"effective_date\":\"2025-05-03T00:41:58.620Z\",\"end_date\":\"2025-05-23T00:41:58.620Z\",\"interval\":{\"days\":1},\"members\":[{\"user\":{\"id\":\"890f29d4-0b7a-11f0-aeb2-760fcae4f596\"}}],\"name\":\"Layer 1\",\"restrictions\":[{\"end_day\":\"friday\",\"end_time\":\"17:00:00\",\"start_day\":\"monday\",\"start_time\":\"09:00:00\"}],\"rotation_start\":\"2025-05-08T00:41:58.620Z\"}],\"name\":\"Test-Get_the_schedule_of_an_on_call_user_returns_OK_response-1747096918\",\"tags\":[\"tag1\",\"tag2\"],\"time_zone\":\"America/New_York\"},\"relationships\":{\"teams\":{\"data\":[{\"id\":\"65aea9d0-941c-4607-bf8a-14fc0dac2820\",\"type\":\"teams\"}]}},\"type\":\"schedules\"}}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v2/on-call/schedules"
39+
},
40+
"response": {
41+
"bodySize": 403,
42+
"content": {
43+
"mimeType": "application/vnd.api+json",
44+
"size": 403,
45+
"text": "{\"data\":{\"id\":\"a69018b0-28a9-4ec1-ad13-dd74bb82ad3c\",\"type\":\"schedules\",\"attributes\":{\"name\":\"Test-Get_the_schedule_of_an_on_call_user_returns_OK_response-1747096918\",\"tags\":[\"tag1\",\"tag2\"],\"time_zone\":\"America/New_York\"},\"relationships\":{\"layers\":{\"data\":[{\"id\":\"133a579b-0b88-4732-91bd-7eb4a75271ab\",\"type\":\"layers\"}]},\"teams\":{\"data\":[{\"id\":\"65aea9d0-941c-4607-bf8a-14fc0dac2820\",\"type\":\"teams\"}]}}}}"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/vnd.api+json"
52+
}
53+
],
54+
"headersSize": 525,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 201,
58+
"statusText": "Created"
59+
},
60+
"startedDateTime": "2025-05-13T00:41:58.625Z",
61+
"time": 867
62+
},
63+
{
64+
"_id": "949e4e7b25729405116dd9cf1f7caa6d",
65+
"_order": 0,
66+
"cache": {},
67+
"request": {
68+
"bodySize": 0,
69+
"cookies": [],
70+
"headers": [
71+
{
72+
"_fromType": "array",
73+
"name": "accept",
74+
"value": "application/json"
75+
}
76+
],
77+
"headersSize": 564,
78+
"httpVersion": "HTTP/1.1",
79+
"method": "GET",
80+
"queryString": [],
81+
"url": "https://api.datadoghq.com/api/v2/on-call/schedules/a69018b0-28a9-4ec1-ad13-dd74bb82ad3c/on-call"
82+
},
83+
"response": {
84+
"bodySize": 309,
85+
"content": {
86+
"mimeType": "application/vnd.api+json",
87+
"size": 309,
88+
"text": "{\"data\":{\"id\":\"890f29d4-0b7a-11f0-aeb2-760fcae4f596-2025-05-12T20:41:59-04:00-2025-05-13T20:41:58-04:00\",\"type\":\"shifts\",\"attributes\":{\"end\":\"2025-05-13T20:41:58-04:00\",\"start\":\"2025-05-12T20:41:59.394997-04:00\"},\"relationships\":{\"user\":{\"data\":{\"id\":\"890f29d4-0b7a-11f0-aeb2-760fcae4f596\",\"type\":\"users\"}}}}}"
89+
},
90+
"cookies": [],
91+
"headers": [
92+
{
93+
"name": "content-type",
94+
"value": "application/vnd.api+json"
95+
}
96+
],
97+
"headersSize": 525,
98+
"httpVersion": "HTTP/1.1",
99+
"redirectURL": "",
100+
"status": 200,
101+
"statusText": "OK"
102+
},
103+
"startedDateTime": "2025-05-13T00:41:59.502Z",
104+
"time": 810
105+
},
106+
{
107+
"_id": "efca463abd71f6a8b32656f203b69b7d",
108+
"_order": 0,
109+
"cache": {},
110+
"request": {
111+
"bodySize": 0,
112+
"cookies": [],
113+
"headers": [
114+
{
115+
"_fromType": "array",
116+
"name": "accept",
117+
"value": "*/*"
118+
}
119+
],
120+
"headersSize": 545,
121+
"httpVersion": "HTTP/1.1",
122+
"method": "DELETE",
123+
"queryString": [],
124+
"url": "https://api.datadoghq.com/api/v2/on-call/schedules/a69018b0-28a9-4ec1-ad13-dd74bb82ad3c"
125+
},
126+
"response": {
127+
"bodySize": 0,
128+
"content": {
129+
"mimeType": "text/plain",
130+
"size": 0
131+
},
132+
"cookies": [],
133+
"headers": [],
134+
"headersSize": 464,
135+
"httpVersion": "HTTP/1.1",
136+
"redirectURL": "",
137+
"status": 204,
138+
"statusText": "No Content"
139+
},
140+
"startedDateTime": "2025-05-13T00:42:00.323Z",
141+
"time": 271
142+
}
143+
],
144+
"pages": [],
145+
"version": "1.2"
146+
}
147+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* Get the schedule of an on-call user returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v2.OnCallApi(configuration);
9+
10+
// there is a valid "schedule" in the system
11+
const SCHEDULE_DATA_ID = process.env.SCHEDULE_DATA_ID as string;
12+
13+
const params: v2.OnCallApiGetScheduleOnCallUserRequest = {
14+
scheduleId: SCHEDULE_DATA_ID,
15+
};
16+
17+
apiInstance
18+
.getScheduleOnCallUser(params)
19+
.then((data: v2.Shift) => {
20+
console.log(
21+
"API called successfully. Returned data: " + JSON.stringify(data)
22+
);
23+
})
24+
.catch((error: any) => console.error(error));

features/support/scenarios_model_mapping.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5879,6 +5879,21 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
58795879
},
58805880
"operationResponseType": "Schedule",
58815881
},
5882+
"v2.GetScheduleOnCallUser": {
5883+
"include": {
5884+
"type": "string",
5885+
"format": "",
5886+
},
5887+
"scheduleId": {
5888+
"type": "string",
5889+
"format": "",
5890+
},
5891+
"filterAtTs": {
5892+
"type": "string",
5893+
"format": "",
5894+
},
5895+
"operationResponseType": "Shift",
5896+
},
58825897
"v2.GetOnCallTeamRoutingRules": {
58835898
"teamId": {
58845899
"type": "string",

0 commit comments

Comments
 (0)