@37signals/basecamp 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +16 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +25 -1
- package/dist/client.js.map +1 -1
- package/dist/generated/metadata.json +319 -1
- package/dist/generated/openapi-stripped.json +5073 -1916
- package/dist/generated/path-mapping.d.ts.map +1 -1
- package/dist/generated/path-mapping.js +26 -2
- package/dist/generated/path-mapping.js.map +1 -1
- package/dist/generated/path-mapping.ts +27 -3
- package/dist/generated/schema.d.ts +2268 -150
- package/dist/generated/services/account.d.ts +66 -0
- package/dist/generated/services/account.d.ts.map +1 -0
- package/dist/generated/services/account.js +101 -0
- package/dist/generated/services/account.js.map +1 -0
- package/dist/generated/services/account.ts +144 -0
- package/dist/generated/services/campfires.d.ts +14 -0
- package/dist/generated/services/campfires.d.ts.map +1 -1
- package/dist/generated/services/campfires.js +8 -0
- package/dist/generated/services/campfires.js.map +1 -1
- package/dist/generated/services/campfires.ts +16 -0
- package/dist/generated/services/cards.d.ts +2 -0
- package/dist/generated/services/cards.d.ts.map +1 -1
- package/dist/generated/services/cards.js +1 -0
- package/dist/generated/services/cards.js.map +1 -1
- package/dist/generated/services/cards.ts +3 -0
- package/dist/generated/services/client-approvals.d.ts +7 -0
- package/dist/generated/services/client-approvals.d.ts.map +1 -1
- package/dist/generated/services/client-approvals.js +8 -1
- package/dist/generated/services/client-approvals.js.map +1 -1
- package/dist/generated/services/client-approvals.ts +10 -0
- package/dist/generated/services/client-correspondences.d.ts +7 -0
- package/dist/generated/services/client-correspondences.d.ts.map +1 -1
- package/dist/generated/services/client-correspondences.js +8 -1
- package/dist/generated/services/client-correspondences.js.map +1 -1
- package/dist/generated/services/client-correspondences.ts +10 -0
- package/dist/generated/services/forwards.d.ts +7 -0
- package/dist/generated/services/forwards.d.ts.map +1 -1
- package/dist/generated/services/forwards.js +4 -0
- package/dist/generated/services/forwards.js.map +1 -1
- package/dist/generated/services/forwards.ts +8 -0
- package/dist/generated/services/gauges.d.ts +140 -0
- package/dist/generated/services/gauges.d.ts.map +1 -0
- package/dist/generated/services/gauges.js +207 -0
- package/dist/generated/services/gauges.js.map +1 -0
- package/dist/generated/services/gauges.ts +298 -0
- package/dist/generated/services/hill-charts.d.ts +47 -0
- package/dist/generated/services/hill-charts.d.ts.map +1 -0
- package/dist/generated/services/hill-charts.js +70 -0
- package/dist/generated/services/hill-charts.js.map +1 -0
- package/dist/generated/services/hill-charts.ts +99 -0
- package/dist/generated/services/index.d.ts +5 -0
- package/dist/generated/services/index.d.ts.map +1 -1
- package/dist/generated/services/index.js +5 -0
- package/dist/generated/services/index.js.map +1 -1
- package/dist/generated/services/index.ts +5 -0
- package/dist/generated/services/my-assignments.d.ts +52 -0
- package/dist/generated/services/my-assignments.d.ts.map +1 -0
- package/dist/generated/services/my-assignments.js +74 -0
- package/dist/generated/services/my-assignments.js.map +1 -0
- package/dist/generated/services/my-assignments.ts +109 -0
- package/dist/generated/services/my-notifications.d.ts +50 -0
- package/dist/generated/services/my-notifications.d.ts.map +1 -0
- package/dist/generated/services/my-notifications.js +65 -0
- package/dist/generated/services/my-notifications.js.map +1 -0
- package/dist/generated/services/my-notifications.ts +100 -0
- package/dist/generated/services/people.d.ts +105 -0
- package/dist/generated/services/people.d.ts.map +1 -1
- package/dist/generated/services/people.js +156 -0
- package/dist/generated/services/people.js.map +1 -1
- package/dist/generated/services/people.ts +225 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/services/base.d.ts +19 -1
- package/dist/services/base.d.ts.map +1 -1
- package/dist/services/base.js +110 -1
- package/dist/services/base.js.map +1 -1
- package/package.json +1 -1
- package/src/generated/metadata.json +319 -1
- package/src/generated/openapi-stripped.json +5073 -1916
- package/src/generated/path-mapping.ts +27 -3
- package/src/generated/schema.d.ts +2268 -150
- package/src/generated/services/account.ts +144 -0
- package/src/generated/services/campfires.ts +16 -0
- package/src/generated/services/cards.ts +3 -0
- package/src/generated/services/client-approvals.ts +10 -0
- package/src/generated/services/client-correspondences.ts +10 -0
- package/src/generated/services/forwards.ts +8 -0
- package/src/generated/services/gauges.ts +298 -0
- package/src/generated/services/hill-charts.ts +99 -0
- package/src/generated/services/index.ts +5 -0
- package/src/generated/services/my-assignments.ts +109 -0
- package/src/generated/services/my-notifications.ts +100 -0
- package/src/generated/services/people.ts +225 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { AccountService } from "./account.js";
|
|
1
2
|
export { AttachmentsService } from "./attachments.js";
|
|
2
3
|
export { BoostsService } from "./boosts.js";
|
|
3
4
|
export { WebhooksService } from "./webhooks.js";
|
|
@@ -14,12 +15,15 @@ export { ClientRepliesService } from "./client-replies.js";
|
|
|
14
15
|
export { CommentsService } from "./comments.js";
|
|
15
16
|
export { ToolsService } from "./tools.js";
|
|
16
17
|
export { DocumentsService } from "./documents.js";
|
|
18
|
+
export { GaugesService } from "./gauges.js";
|
|
17
19
|
export { ForwardsService } from "./forwards.js";
|
|
18
20
|
export { AutomationService } from "./automation.js";
|
|
19
21
|
export { LineupService } from "./lineup.js";
|
|
20
22
|
export { MessageBoardsService } from "./message-boards.js";
|
|
21
23
|
export { MessagesService } from "./messages.js";
|
|
24
|
+
export { MyAssignmentsService } from "./my-assignments.js";
|
|
22
25
|
export { CheckinsService } from "./checkins.js";
|
|
26
|
+
export { MyNotificationsService } from "./my-notifications.js";
|
|
23
27
|
export { ProjectsService } from "./projects.js";
|
|
24
28
|
export { RecordingsService } from "./recordings.js";
|
|
25
29
|
export { TimelineService } from "./timeline.js";
|
|
@@ -35,5 +39,6 @@ export { TodolistGroupsService } from "./todolist-groups.js";
|
|
|
35
39
|
export { TodolistsService } from "./todolists.js";
|
|
36
40
|
export { TodosService } from "./todos.js";
|
|
37
41
|
export { TodosetsService } from "./todosets.js";
|
|
42
|
+
export { HillChartsService } from "./hill-charts.js";
|
|
38
43
|
export { UploadsService } from "./uploads.js";
|
|
39
44
|
export { VaultsService } from "./vaults.js";
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MyAssignments service for the Basecamp API.
|
|
3
|
+
*
|
|
4
|
+
* @generated from OpenAPI spec - do not edit directly
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { BaseService } from "../../services/base.js";
|
|
8
|
+
import type { components } from "../schema.js";
|
|
9
|
+
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// Types
|
|
12
|
+
// =============================================================================
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Options for myDueAssignments.
|
|
17
|
+
*/
|
|
18
|
+
export interface MyDueAssignmentsMyAssignmentOptions {
|
|
19
|
+
/** Filter by due date range: overdue, due_today, due_tomorrow,
|
|
20
|
+
due_later_this_week, due_next_week, due_later */
|
|
21
|
+
scope?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
// =============================================================================
|
|
26
|
+
// Service
|
|
27
|
+
// =============================================================================
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Service for MyAssignments operations.
|
|
31
|
+
*/
|
|
32
|
+
export class MyAssignmentsService extends BaseService {
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Get the current user's active assignments grouped into priorities and non_priorities.
|
|
36
|
+
* @returns The my_assignment
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const result = await client.myAssignments.myAssignments();
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
async myAssignments(): Promise<components["schemas"]["GetMyAssignmentsResponseContent"]> {
|
|
44
|
+
const response = await this.request(
|
|
45
|
+
{
|
|
46
|
+
service: "MyAssignments",
|
|
47
|
+
operation: "GetMyAssignments",
|
|
48
|
+
resourceType: "my_assignment",
|
|
49
|
+
isMutation: false,
|
|
50
|
+
},
|
|
51
|
+
() =>
|
|
52
|
+
this.client.GET("/my/assignments.json", {
|
|
53
|
+
})
|
|
54
|
+
);
|
|
55
|
+
return response;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Get the current user's completed assignments.
|
|
60
|
+
* @returns Array of results
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* const result = await client.myAssignments.myCompletedAssignments();
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
async myCompletedAssignments(): Promise<components["schemas"]["GetMyCompletedAssignmentsResponseContent"]> {
|
|
68
|
+
const response = await this.request(
|
|
69
|
+
{
|
|
70
|
+
service: "MyAssignments",
|
|
71
|
+
operation: "GetMyCompletedAssignments",
|
|
72
|
+
resourceType: "my_completed_assignment",
|
|
73
|
+
isMutation: false,
|
|
74
|
+
},
|
|
75
|
+
() =>
|
|
76
|
+
this.client.GET("/my/assignments/completed.json", {
|
|
77
|
+
})
|
|
78
|
+
);
|
|
79
|
+
return response ?? [];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Get the current user's assignments filtered by due date scope.
|
|
84
|
+
* @param options - Optional query parameters
|
|
85
|
+
* @returns Array of results
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* const result = await client.myAssignments.myDueAssignments();
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
async myDueAssignments(options?: MyDueAssignmentsMyAssignmentOptions): Promise<components["schemas"]["GetMyDueAssignmentsResponseContent"]> {
|
|
93
|
+
const response = await this.request(
|
|
94
|
+
{
|
|
95
|
+
service: "MyAssignments",
|
|
96
|
+
operation: "GetMyDueAssignments",
|
|
97
|
+
resourceType: "my_due_assignment",
|
|
98
|
+
isMutation: false,
|
|
99
|
+
},
|
|
100
|
+
() =>
|
|
101
|
+
this.client.GET("/my/assignments/due.json", {
|
|
102
|
+
params: {
|
|
103
|
+
query: { scope: options?.scope },
|
|
104
|
+
},
|
|
105
|
+
})
|
|
106
|
+
);
|
|
107
|
+
return response ?? [];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MyNotifications service for the Basecamp API.
|
|
3
|
+
*
|
|
4
|
+
* @generated from OpenAPI spec - do not edit directly
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { BaseService } from "../../services/base.js";
|
|
8
|
+
import type { components } from "../schema.js";
|
|
9
|
+
import { Errors } from "../../errors.js";
|
|
10
|
+
|
|
11
|
+
// =============================================================================
|
|
12
|
+
// Types
|
|
13
|
+
// =============================================================================
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Options for myNotifications.
|
|
18
|
+
*/
|
|
19
|
+
export interface MyNotificationsMyNotificationOptions {
|
|
20
|
+
/** Page number for paginating through read items. Defaults to 1. */
|
|
21
|
+
page?: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Request parameters for markAsRead.
|
|
26
|
+
*/
|
|
27
|
+
export interface MarkAsReadMyNotificationRequest {
|
|
28
|
+
/** Array of readable_sgid values identifying the items to mark as read */
|
|
29
|
+
readables: string[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
// =============================================================================
|
|
34
|
+
// Service
|
|
35
|
+
// =============================================================================
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Service for MyNotifications operations.
|
|
39
|
+
*/
|
|
40
|
+
export class MyNotificationsService extends BaseService {
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Get the current user's notification inbox (the "Hey!" menu).
|
|
44
|
+
* @param options - Optional query parameters
|
|
45
|
+
* @returns The my_notification
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const result = await client.myNotifications.myNotifications();
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
async myNotifications(options?: MyNotificationsMyNotificationOptions): Promise<components["schemas"]["GetMyNotificationsResponseContent"]> {
|
|
53
|
+
const response = await this.request(
|
|
54
|
+
{
|
|
55
|
+
service: "MyNotifications",
|
|
56
|
+
operation: "GetMyNotifications",
|
|
57
|
+
resourceType: "my_notification",
|
|
58
|
+
isMutation: false,
|
|
59
|
+
},
|
|
60
|
+
() =>
|
|
61
|
+
this.client.GET("/my/readings.json", {
|
|
62
|
+
params: {
|
|
63
|
+
query: { page: options?.page },
|
|
64
|
+
},
|
|
65
|
+
})
|
|
66
|
+
);
|
|
67
|
+
return response;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Mark specified items as read
|
|
72
|
+
* @param req - Resource request parameters
|
|
73
|
+
* @returns void
|
|
74
|
+
* @throws {BasecampError} If the request fails
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* await client.myNotifications.markAsRead({ readables: [1234] });
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
async markAsRead(req: MarkAsReadMyNotificationRequest): Promise<void> {
|
|
82
|
+
if (!req.readables) {
|
|
83
|
+
throw Errors.validation("Readables is required");
|
|
84
|
+
}
|
|
85
|
+
await this.request(
|
|
86
|
+
{
|
|
87
|
+
service: "MyNotifications",
|
|
88
|
+
operation: "MarkAsRead",
|
|
89
|
+
resourceType: "resource",
|
|
90
|
+
isMutation: true,
|
|
91
|
+
},
|
|
92
|
+
() =>
|
|
93
|
+
this.client.PUT("/my/unreads.json", {
|
|
94
|
+
body: {
|
|
95
|
+
readables: req.readables,
|
|
96
|
+
},
|
|
97
|
+
})
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -8,6 +8,7 @@ import { BaseService } from "../../services/base.js";
|
|
|
8
8
|
import type { components } from "../schema.js";
|
|
9
9
|
import { ListResult } from "../../pagination.js";
|
|
10
10
|
import type { PaginationOptions } from "../../pagination.js";
|
|
11
|
+
import { Errors } from "../../errors.js";
|
|
11
12
|
|
|
12
13
|
// =============================================================================
|
|
13
14
|
// Types
|
|
@@ -22,12 +23,50 @@ export type Person = components["schemas"]["Person"];
|
|
|
22
23
|
export interface ListPingablePeopleOptions extends PaginationOptions {
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Request parameters for updateMyPreferences.
|
|
28
|
+
*/
|
|
29
|
+
export interface UpdateMyPreferencesPeopleRequest {
|
|
30
|
+
/** Person */
|
|
31
|
+
person: components["schemas"]["PreferencesPayload"];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Request parameters for updateMyProfile.
|
|
36
|
+
*/
|
|
37
|
+
export interface UpdateMyProfilePeopleRequest {
|
|
38
|
+
/** Display name */
|
|
39
|
+
name?: string;
|
|
40
|
+
/** Email address */
|
|
41
|
+
emailAddress?: string;
|
|
42
|
+
/** Title */
|
|
43
|
+
title?: string;
|
|
44
|
+
/** Bio */
|
|
45
|
+
bio?: string;
|
|
46
|
+
/** Location */
|
|
47
|
+
location?: string;
|
|
48
|
+
/** Time zone name */
|
|
49
|
+
timeZoneName?: string;
|
|
50
|
+
/** First week day */
|
|
51
|
+
firstWeekDay?: components["schemas"]["FirstWeekDay"];
|
|
52
|
+
/** Time format */
|
|
53
|
+
timeFormat?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
25
56
|
/**
|
|
26
57
|
* Options for list.
|
|
27
58
|
*/
|
|
28
59
|
export interface ListPeopleOptions extends PaginationOptions {
|
|
29
60
|
}
|
|
30
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Request parameters for enableOutOfOffice.
|
|
64
|
+
*/
|
|
65
|
+
export interface EnableOutOfOfficePeopleRequest {
|
|
66
|
+
/** Out of office */
|
|
67
|
+
outOfOffice: components["schemas"]["OutOfOfficePayload"];
|
|
68
|
+
}
|
|
69
|
+
|
|
31
70
|
/**
|
|
32
71
|
* Options for listForProject.
|
|
33
72
|
*/
|
|
@@ -81,6 +120,62 @@ export class PeopleService extends BaseService {
|
|
|
81
120
|
);
|
|
82
121
|
}
|
|
83
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Get the current user's preferences
|
|
125
|
+
* @returns The my_preference
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts
|
|
129
|
+
* const result = await client.people.myPreferences();
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
async myPreferences(): Promise<components["schemas"]["GetMyPreferencesResponseContent"]> {
|
|
133
|
+
const response = await this.request(
|
|
134
|
+
{
|
|
135
|
+
service: "People",
|
|
136
|
+
operation: "GetMyPreferences",
|
|
137
|
+
resourceType: "my_preference",
|
|
138
|
+
isMutation: false,
|
|
139
|
+
},
|
|
140
|
+
() =>
|
|
141
|
+
this.client.GET("/my/preferences.json", {
|
|
142
|
+
})
|
|
143
|
+
);
|
|
144
|
+
return response;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Update the current user's preferences
|
|
149
|
+
* @param req - My_preference update parameters
|
|
150
|
+
* @returns The my_preference
|
|
151
|
+
* @throws {BasecampError} If the resource is not found or fields are invalid
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```ts
|
|
155
|
+
* const result = await client.people.updateMyPreferences({ person: "example" });
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
async updateMyPreferences(req: UpdateMyPreferencesPeopleRequest): Promise<components["schemas"]["UpdateMyPreferencesResponseContent"]> {
|
|
159
|
+
if (!req.person) {
|
|
160
|
+
throw Errors.validation("Person is required");
|
|
161
|
+
}
|
|
162
|
+
const response = await this.request(
|
|
163
|
+
{
|
|
164
|
+
service: "People",
|
|
165
|
+
operation: "UpdateMyPreferences",
|
|
166
|
+
resourceType: "my_preference",
|
|
167
|
+
isMutation: true,
|
|
168
|
+
},
|
|
169
|
+
() =>
|
|
170
|
+
this.client.PUT("/my/preferences.json", {
|
|
171
|
+
body: {
|
|
172
|
+
person: req.person,
|
|
173
|
+
},
|
|
174
|
+
})
|
|
175
|
+
);
|
|
176
|
+
return response;
|
|
177
|
+
}
|
|
178
|
+
|
|
84
179
|
/**
|
|
85
180
|
* Get the current authenticated user's profile
|
|
86
181
|
* @returns The Person
|
|
@@ -105,6 +200,41 @@ export class PeopleService extends BaseService {
|
|
|
105
200
|
return response;
|
|
106
201
|
}
|
|
107
202
|
|
|
203
|
+
/**
|
|
204
|
+
* Update the current authenticated user's profile
|
|
205
|
+
* @param req - My_profile update parameters
|
|
206
|
+
* @returns void
|
|
207
|
+
* @throws {BasecampError} If the resource is not found or fields are invalid
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```ts
|
|
211
|
+
* await client.people.updateMyProfile({ });
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
214
|
+
async updateMyProfile(req: UpdateMyProfilePeopleRequest): Promise<void> {
|
|
215
|
+
await this.request(
|
|
216
|
+
{
|
|
217
|
+
service: "People",
|
|
218
|
+
operation: "UpdateMyProfile",
|
|
219
|
+
resourceType: "my_profile",
|
|
220
|
+
isMutation: true,
|
|
221
|
+
},
|
|
222
|
+
() =>
|
|
223
|
+
this.client.PUT("/my/profile.json", {
|
|
224
|
+
body: {
|
|
225
|
+
name: req.name,
|
|
226
|
+
email_address: req.emailAddress,
|
|
227
|
+
title: req.title,
|
|
228
|
+
bio: req.bio,
|
|
229
|
+
location: req.location,
|
|
230
|
+
time_zone_name: req.timeZoneName,
|
|
231
|
+
first_week_day: req.firstWeekDay,
|
|
232
|
+
time_format: req.timeFormat,
|
|
233
|
+
},
|
|
234
|
+
})
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
|
|
108
238
|
/**
|
|
109
239
|
* List all people visible to the current user
|
|
110
240
|
* @param options - Optional query parameters
|
|
@@ -160,6 +290,101 @@ export class PeopleService extends BaseService {
|
|
|
160
290
|
return response;
|
|
161
291
|
}
|
|
162
292
|
|
|
293
|
+
/**
|
|
294
|
+
* Get the out of office status for a person
|
|
295
|
+
* @param personId - The person ID
|
|
296
|
+
* @returns The out_of_office
|
|
297
|
+
*
|
|
298
|
+
* @example
|
|
299
|
+
* ```ts
|
|
300
|
+
* const result = await client.people.outOfOffice(123);
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
async outOfOffice(personId: number): Promise<components["schemas"]["GetOutOfOfficeResponseContent"]> {
|
|
304
|
+
const response = await this.request(
|
|
305
|
+
{
|
|
306
|
+
service: "People",
|
|
307
|
+
operation: "GetOutOfOffice",
|
|
308
|
+
resourceType: "out_of_office",
|
|
309
|
+
isMutation: false,
|
|
310
|
+
resourceId: personId,
|
|
311
|
+
},
|
|
312
|
+
() =>
|
|
313
|
+
this.client.GET("/people/{personId}/out_of_office.json", {
|
|
314
|
+
params: {
|
|
315
|
+
path: { personId },
|
|
316
|
+
},
|
|
317
|
+
})
|
|
318
|
+
);
|
|
319
|
+
return response;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Enable or replace out of office for a person.
|
|
324
|
+
* @param personId - The person ID
|
|
325
|
+
* @param req - Out_of_office request parameters
|
|
326
|
+
* @returns The out_of_office
|
|
327
|
+
* @throws {BasecampError} If the request fails
|
|
328
|
+
*
|
|
329
|
+
* @example
|
|
330
|
+
* ```ts
|
|
331
|
+
* const result = await client.people.enableOutOfOffice(123, { outOfOffice: "example" });
|
|
332
|
+
* ```
|
|
333
|
+
*/
|
|
334
|
+
async enableOutOfOffice(personId: number, req: EnableOutOfOfficePeopleRequest): Promise<components["schemas"]["EnableOutOfOfficeResponseContent"]> {
|
|
335
|
+
if (!req.outOfOffice) {
|
|
336
|
+
throw Errors.validation("Out of office is required");
|
|
337
|
+
}
|
|
338
|
+
const response = await this.request(
|
|
339
|
+
{
|
|
340
|
+
service: "People",
|
|
341
|
+
operation: "EnableOutOfOffice",
|
|
342
|
+
resourceType: "out_of_office",
|
|
343
|
+
isMutation: true,
|
|
344
|
+
resourceId: personId,
|
|
345
|
+
},
|
|
346
|
+
() =>
|
|
347
|
+
this.client.POST("/people/{personId}/out_of_office.json", {
|
|
348
|
+
params: {
|
|
349
|
+
path: { personId },
|
|
350
|
+
},
|
|
351
|
+
body: {
|
|
352
|
+
out_of_office: req.outOfOffice,
|
|
353
|
+
},
|
|
354
|
+
})
|
|
355
|
+
);
|
|
356
|
+
return response;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Disable out of office for a person.
|
|
361
|
+
* @param personId - The person ID
|
|
362
|
+
* @returns void
|
|
363
|
+
* @throws {BasecampError} If the request fails
|
|
364
|
+
*
|
|
365
|
+
* @example
|
|
366
|
+
* ```ts
|
|
367
|
+
* await client.people.disableOutOfOffice(123);
|
|
368
|
+
* ```
|
|
369
|
+
*/
|
|
370
|
+
async disableOutOfOffice(personId: number): Promise<void> {
|
|
371
|
+
await this.request(
|
|
372
|
+
{
|
|
373
|
+
service: "People",
|
|
374
|
+
operation: "DisableOutOfOffice",
|
|
375
|
+
resourceType: "out_of_office",
|
|
376
|
+
isMutation: true,
|
|
377
|
+
resourceId: personId,
|
|
378
|
+
},
|
|
379
|
+
() =>
|
|
380
|
+
this.client.DELETE("/people/{personId}/out_of_office.json", {
|
|
381
|
+
params: {
|
|
382
|
+
path: { personId },
|
|
383
|
+
},
|
|
384
|
+
})
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
|
|
163
388
|
/**
|
|
164
389
|
* List all active people on a project
|
|
165
390
|
* @param projectId - The project ID
|