@workbuddy/piece-workbuddy-vnext 1.0.91 → 1.0.93

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.
Files changed (50) hide show
  1. package/package.json +1 -1
  2. package/src/index.d.ts.map +1 -1
  3. package/src/index.js +21 -0
  4. package/src/index.js.map +1 -1
  5. package/src/index.ts +42 -0
  6. package/src/lib/actions/crm-contractors.d.ts +1 -0
  7. package/src/lib/actions/crm-contractors.d.ts.map +1 -1
  8. package/src/lib/actions/crm-contractors.js +6 -0
  9. package/src/lib/actions/crm-contractors.js.map +1 -1
  10. package/src/lib/actions/crm-contractors.ts +6 -0
  11. package/src/lib/actions/crm-customers.d.ts +1 -0
  12. package/src/lib/actions/crm-customers.d.ts.map +1 -1
  13. package/src/lib/actions/crm-customers.js +6 -0
  14. package/src/lib/actions/crm-customers.js.map +1 -1
  15. package/src/lib/actions/crm-customers.ts +6 -0
  16. package/src/lib/actions/crm-suppliers.d.ts +1 -0
  17. package/src/lib/actions/crm-suppliers.d.ts.map +1 -1
  18. package/src/lib/actions/crm-suppliers.js +6 -0
  19. package/src/lib/actions/crm-suppliers.js.map +1 -1
  20. package/src/lib/actions/crm-suppliers.ts +6 -0
  21. package/src/lib/actions/index.d.ts +4 -0
  22. package/src/lib/actions/index.d.ts.map +1 -1
  23. package/src/lib/actions/index.js +4 -0
  24. package/src/lib/actions/index.js.map +1 -1
  25. package/src/lib/actions/index.ts +4 -0
  26. package/src/lib/actions/jobs.d.ts +2 -2
  27. package/src/lib/actions/jobs.d.ts.map +1 -1
  28. package/src/lib/actions/jobs.js +4 -24
  29. package/src/lib/actions/jobs.js.map +1 -1
  30. package/src/lib/actions/jobs.ts +4 -24
  31. package/src/lib/actions/service-plans-lines-tasks-subtasks.d.ts +52 -0
  32. package/src/lib/actions/service-plans-lines-tasks-subtasks.d.ts.map +1 -0
  33. package/src/lib/actions/service-plans-lines-tasks-subtasks.js +257 -0
  34. package/src/lib/actions/service-plans-lines-tasks-subtasks.js.map +1 -0
  35. package/src/lib/actions/service-plans-lines-tasks-subtasks.ts +274 -0
  36. package/src/lib/actions/service-plans-lines-tasks.d.ts +51 -0
  37. package/src/lib/actions/service-plans-lines-tasks.d.ts.map +1 -0
  38. package/src/lib/actions/service-plans-lines-tasks.js +255 -0
  39. package/src/lib/actions/service-plans-lines-tasks.js.map +1 -0
  40. package/src/lib/actions/service-plans-lines-tasks.ts +272 -0
  41. package/src/lib/actions/service-plans-lines.d.ts +48 -0
  42. package/src/lib/actions/service-plans-lines.d.ts.map +1 -0
  43. package/src/lib/actions/service-plans-lines.js +262 -0
  44. package/src/lib/actions/service-plans-lines.js.map +1 -0
  45. package/src/lib/actions/service-plans-lines.ts +278 -0
  46. package/src/lib/actions/service-plans.d.ts +47 -0
  47. package/src/lib/actions/service-plans.d.ts.map +1 -0
  48. package/src/lib/actions/service-plans.js +241 -0
  49. package/src/lib/actions/service-plans.js.map +1 -0
  50. package/src/lib/actions/service-plans.ts +262 -0
@@ -0,0 +1,278 @@
1
+ import { createAction, Property } from '@activepieces/pieces-framework';
2
+ import { HttpMethod, httpClient } from '@activepieces/pieces-common';
3
+ import { workbuddyAuth, getAccessToken } from '../auth';
4
+
5
+ export const PublicServiceLineController_list = createAction({
6
+ name: 'PublicServiceLineController_list',
7
+ auth: workbuddyAuth,
8
+ displayName: 'List Service Lines',
9
+ description: '',
10
+ props: {
11
+ planId: Property.ShortText({
12
+ displayName: 'Plan Id',
13
+ description: 'WorkBuddy Service Plan ID',
14
+ required: true,
15
+ }),
16
+ },
17
+ async run(context) {
18
+ const token = await getAccessToken(context.auth);
19
+ const baseUrl = context.auth.props.baseUrl;
20
+
21
+ const url = `${baseUrl}/api/v2/public/service-plans/${context.propsValue.planId}/lines`;
22
+
23
+ const response = await httpClient.sendRequest({
24
+ method: HttpMethod.GET,
25
+ url: `${baseUrl}/api/v2/public/service-plans/${context.propsValue.planId}/lines`,
26
+ headers: {
27
+ Authorization: `Bearer ${token}`,
28
+ 'Content-Type': 'application/json',
29
+ 'X-WorkBuddy-Version': '2026-01',
30
+ },
31
+ });
32
+
33
+ return response.body;
34
+ },
35
+ });
36
+
37
+ export const PublicServiceLineController_create = createAction({
38
+ name: 'PublicServiceLineController_create',
39
+ auth: workbuddyAuth,
40
+ displayName: 'Create a Service Line',
41
+ description: '',
42
+ props: {
43
+ planId: Property.ShortText({
44
+ displayName: 'Plan Id',
45
+ description: 'plan ID',
46
+ required: true,
47
+ }),
48
+ integrationId: Property.ShortText({
49
+ displayName: 'Integration Id',
50
+ description: 'integration ID',
51
+ required: true,
52
+ }),
53
+ name: Property.ShortText({
54
+ displayName: 'Name',
55
+ description: 'Display name',
56
+ required: true,
57
+ }),
58
+ workCategoryId: Property.ShortText({
59
+ displayName: 'Work Category Id',
60
+ description: 'Work category ID — use /settings/work-types to look up',
61
+ required: true,
62
+ }),
63
+ defaultWindow: Property.Json({
64
+ displayName: 'Default Window',
65
+ description: '',
66
+ required: true,
67
+ }),
68
+ description: Property.LongText({
69
+ displayName: 'Description',
70
+ description: 'Detailed description',
71
+ required: false,
72
+ }),
73
+ dateStart: Property.ShortText({
74
+ displayName: 'Date Start',
75
+ description: '',
76
+ required: false,
77
+ }),
78
+ dateEnd: Property.ShortText({
79
+ displayName: 'Date End',
80
+ description: '',
81
+ required: false,
82
+ }),
83
+ workingDays: Property.StaticMultiSelectDropdown({
84
+ displayName: 'Working Days',
85
+ description: '',
86
+ required: false,
87
+ options: {
88
+ options: [
89
+ { label: 'Mon', value: 'Mon' },
90
+ { label: 'Tue', value: 'Tue' },
91
+ { label: 'Wed', value: 'Wed' },
92
+ { label: 'Thu', value: 'Thu' },
93
+ { label: 'Fri', value: 'Fri' },
94
+ { label: 'Sat', value: 'Sat' },
95
+ { label: 'Sun', value: 'Sun' },
96
+ ],
97
+ },
98
+ }),
99
+ jobDefaults: Property.Json({
100
+ displayName: 'Job Defaults',
101
+ description: '',
102
+ required: false,
103
+ }),
104
+ },
105
+ async run(context) {
106
+ const token = await getAccessToken(context.auth);
107
+ const baseUrl = context.auth.props.baseUrl;
108
+
109
+ const url = `${baseUrl}/api/v2/public/service-plans/${context.propsValue.planId}/lines`;
110
+
111
+ const rawBody: Record<string, unknown> = {
112
+ integrationId: context.propsValue.integrationId,
113
+ name: context.propsValue.name,
114
+ description: context.propsValue.description,
115
+ workCategoryId: context.propsValue.workCategoryId,
116
+ dateStart: context.propsValue.dateStart,
117
+ dateEnd: context.propsValue.dateEnd,
118
+ defaultWindow: context.propsValue.defaultWindow,
119
+ workingDays: context.propsValue.workingDays,
120
+ jobDefaults: context.propsValue.jobDefaults,
121
+ };
122
+
123
+ const body = rawBody;
124
+ const response = await httpClient.sendRequest({
125
+ method: HttpMethod.POST,
126
+ url: `${baseUrl}/api/v2/public/service-plans/${context.propsValue.planId}/lines`,
127
+ headers: {
128
+ Authorization: `Bearer ${token}`,
129
+ 'Content-Type': 'application/json',
130
+ 'X-WorkBuddy-Version': '2026-01',
131
+ },
132
+ body: body,
133
+ });
134
+
135
+ return response.body;
136
+ },
137
+ });
138
+
139
+ export const PublicServiceLineController_get = createAction({
140
+ name: 'PublicServiceLineController_get',
141
+ auth: workbuddyAuth,
142
+ displayName: 'Get a Service Line',
143
+ description: '',
144
+ props: {
145
+ planId: Property.ShortText({
146
+ displayName: 'Plan Id',
147
+ description: 'plan ID',
148
+ required: true,
149
+ }),
150
+ identifier: Property.ShortText({
151
+ displayName: 'Identifier',
152
+ description: 'WorkBuddy Service Line ID or caller integrationId',
153
+ required: true,
154
+ }),
155
+ },
156
+ async run(context) {
157
+ const token = await getAccessToken(context.auth);
158
+ const baseUrl = context.auth.props.baseUrl;
159
+
160
+ const url = `${baseUrl}/api/v2/public/service-plans/${context.propsValue.planId}/lines/${context.propsValue.identifier}`;
161
+
162
+ const response = await httpClient.sendRequest({
163
+ method: HttpMethod.GET,
164
+ url: `${baseUrl}/api/v2/public/service-plans/${context.propsValue.planId}/lines/${context.propsValue.identifier}`,
165
+ headers: {
166
+ Authorization: `Bearer ${token}`,
167
+ 'Content-Type': 'application/json',
168
+ 'X-WorkBuddy-Version': '2026-01',
169
+ },
170
+ });
171
+
172
+ return response.body;
173
+ },
174
+ });
175
+
176
+ export const PublicServiceLineController_patch = createAction({
177
+ name: 'PublicServiceLineController_patch',
178
+ auth: workbuddyAuth,
179
+ displayName: 'Update a Service Line',
180
+ description: '',
181
+ props: {
182
+ planId: Property.ShortText({
183
+ displayName: 'Plan Id',
184
+ description: 'plan ID',
185
+ required: true,
186
+ }),
187
+ identifier: Property.ShortText({
188
+ displayName: 'Identifier',
189
+ description: 'Entity ID or human-readable number',
190
+ required: true,
191
+ }),
192
+ name: Property.ShortText({
193
+ displayName: 'Name',
194
+ description: 'Display name',
195
+ required: false,
196
+ }),
197
+ description: Property.LongText({
198
+ displayName: 'Description',
199
+ description: 'Detailed description',
200
+ required: false,
201
+ }),
202
+ workCategoryId: Property.ShortText({
203
+ displayName: 'Work Category Id',
204
+ description: 'Work category ID — use /settings/work-types to look up',
205
+ required: false,
206
+ }),
207
+ dateStart: Property.ShortText({
208
+ displayName: 'Date Start',
209
+ description: '',
210
+ required: false,
211
+ }),
212
+ dateEnd: Property.ShortText({
213
+ displayName: 'Date End',
214
+ description: '',
215
+ required: false,
216
+ }),
217
+ defaultWindow: Property.Json({
218
+ displayName: 'Default Window',
219
+ description: '',
220
+ required: false,
221
+ }),
222
+ workingDays: Property.StaticMultiSelectDropdown({
223
+ displayName: 'Working Days',
224
+ description: '',
225
+ required: false,
226
+ options: {
227
+ options: [
228
+ { label: 'Mon', value: 'Mon' },
229
+ { label: 'Tue', value: 'Tue' },
230
+ { label: 'Wed', value: 'Wed' },
231
+ { label: 'Thu', value: 'Thu' },
232
+ { label: 'Fri', value: 'Fri' },
233
+ { label: 'Sat', value: 'Sat' },
234
+ { label: 'Sun', value: 'Sun' },
235
+ ],
236
+ },
237
+ }),
238
+ jobDefaults: Property.Json({
239
+ displayName: 'Job Defaults',
240
+ description: '',
241
+ required: false,
242
+ }),
243
+ },
244
+ async run(context) {
245
+ const token = await getAccessToken(context.auth);
246
+ const baseUrl = context.auth.props.baseUrl;
247
+
248
+ const url = `${baseUrl}/api/v2/public/service-plans/${context.propsValue.planId}/lines/${context.propsValue.identifier}`;
249
+
250
+ // Build body with only defined values (for partial updates)
251
+ const rawBody: Record<string, unknown> = {
252
+ name: context.propsValue.name,
253
+ description: context.propsValue.description,
254
+ workCategoryId: context.propsValue.workCategoryId,
255
+ dateStart: context.propsValue.dateStart,
256
+ dateEnd: context.propsValue.dateEnd,
257
+ defaultWindow: context.propsValue.defaultWindow,
258
+ workingDays: context.propsValue.workingDays,
259
+ jobDefaults: context.propsValue.jobDefaults,
260
+ };
261
+
262
+ const body = Object.fromEntries(
263
+ Object.entries(rawBody).filter(([_, v]) => v !== undefined && v !== null && v !== '')
264
+ );
265
+ const response = await httpClient.sendRequest({
266
+ method: HttpMethod.PATCH,
267
+ url: `${baseUrl}/api/v2/public/service-plans/${context.propsValue.planId}/lines/${context.propsValue.identifier}`,
268
+ headers: {
269
+ Authorization: `Bearer ${token}`,
270
+ 'Content-Type': 'application/json',
271
+ 'X-WorkBuddy-Version': '2026-01',
272
+ },
273
+ body: body,
274
+ });
275
+
276
+ return response.body;
277
+ },
278
+ });
@@ -0,0 +1,47 @@
1
+ export declare const PublicServicePlanController_create: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
+ }>, {
6
+ integrationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
8
+ customerId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
9
+ siteId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
10
+ serviceTypeId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
11
+ serviceScopeId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
12
+ dateStart: import("@activepieces/pieces-framework").ShortTextProperty<true>;
13
+ dateEnd: import("@activepieces/pieces-framework").ShortTextProperty<false>;
14
+ workingDays: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, false>;
15
+ }>;
16
+ export declare const PublicServicePlanController_get: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
17
+ baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
18
+ clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
19
+ clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
20
+ }>, {
21
+ identifier: import("@activepieces/pieces-framework").ShortTextProperty<true>;
22
+ }>;
23
+ export declare const PublicServicePlanController_activate: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
24
+ baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
25
+ clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
26
+ clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
27
+ }>, {
28
+ identifier: import("@activepieces/pieces-framework").ShortTextProperty<true>;
29
+ reason: import("@activepieces/pieces-framework").ShortTextProperty<false>;
30
+ }>;
31
+ export declare const PublicServicePlanController_suspend: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
32
+ baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
33
+ clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
34
+ clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
35
+ }>, {
36
+ identifier: import("@activepieces/pieces-framework").ShortTextProperty<true>;
37
+ reason: import("@activepieces/pieces-framework").ShortTextProperty<false>;
38
+ }>;
39
+ export declare const PublicServicePlanController_archive: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
40
+ baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
41
+ clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
42
+ clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
43
+ }>, {
44
+ identifier: import("@activepieces/pieces-framework").ShortTextProperty<true>;
45
+ reason: import("@activepieces/pieces-framework").ShortTextProperty<false>;
46
+ }>;
47
+ //# sourceMappingURL=service-plans.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-plans.d.ts","sourceRoot":"","sources":["service-plans.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;EAgG7C,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;;;EA8B1C,CAAC;AAEH,eAAO,MAAM,oCAAoC;;;;;;;EAyC/C,CAAC;AAEH,eAAO,MAAM,mCAAmC;;;;;;;EAyC9C,CAAC;AAEH,eAAO,MAAM,mCAAmC;;;;;;;EAyC9C,CAAC"}
@@ -0,0 +1,241 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PublicServicePlanController_archive = exports.PublicServicePlanController_suspend = exports.PublicServicePlanController_activate = exports.PublicServicePlanController_get = exports.PublicServicePlanController_create = void 0;
4
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
5
+ const pieces_common_1 = require("@activepieces/pieces-common");
6
+ const auth_1 = require("../auth");
7
+ exports.PublicServicePlanController_create = (0, pieces_framework_1.createAction)({
8
+ name: 'PublicServicePlanController_create',
9
+ auth: auth_1.workbuddyAuth,
10
+ displayName: 'Create a Service Plan',
11
+ description: 'Creates only the Service Plan contract header. Lines and Tasks are added through their nested endpoints.',
12
+ props: {
13
+ integrationId: pieces_framework_1.Property.ShortText({
14
+ displayName: 'Integration Id',
15
+ description: 'integration ID',
16
+ required: true,
17
+ }),
18
+ name: pieces_framework_1.Property.ShortText({
19
+ displayName: 'Name',
20
+ description: 'Display name',
21
+ required: true,
22
+ }),
23
+ customerId: pieces_framework_1.Property.ShortText({
24
+ displayName: 'Customer Id',
25
+ description: 'Customer ID — use /crm/customers to look up',
26
+ required: true,
27
+ }),
28
+ siteId: pieces_framework_1.Property.ShortText({
29
+ displayName: 'Site Id',
30
+ description: 'Site ID — use /crm/sites to look up',
31
+ required: true,
32
+ }),
33
+ serviceTypeId: pieces_framework_1.Property.ShortText({
34
+ displayName: 'Service Type Id',
35
+ description: 'service type ID',
36
+ required: true,
37
+ }),
38
+ serviceScopeId: pieces_framework_1.Property.ShortText({
39
+ displayName: 'Service Scope Id',
40
+ description: 'service scope ID',
41
+ required: true,
42
+ }),
43
+ dateStart: pieces_framework_1.Property.ShortText({
44
+ displayName: 'Date Start',
45
+ description: '',
46
+ required: true,
47
+ }),
48
+ dateEnd: pieces_framework_1.Property.ShortText({
49
+ displayName: 'Date End',
50
+ description: '',
51
+ required: false,
52
+ }),
53
+ workingDays: pieces_framework_1.Property.StaticMultiSelectDropdown({
54
+ displayName: 'Working Days',
55
+ description: '',
56
+ required: false,
57
+ options: {
58
+ options: [
59
+ { label: 'Mon', value: 'Mon' },
60
+ { label: 'Tue', value: 'Tue' },
61
+ { label: 'Wed', value: 'Wed' },
62
+ { label: 'Thu', value: 'Thu' },
63
+ { label: 'Fri', value: 'Fri' },
64
+ { label: 'Sat', value: 'Sat' },
65
+ { label: 'Sun', value: 'Sun' },
66
+ ],
67
+ },
68
+ }),
69
+ },
70
+ async run(context) {
71
+ const token = await (0, auth_1.getAccessToken)(context.auth);
72
+ const baseUrl = context.auth.props.baseUrl;
73
+ const url = `${baseUrl}/api/v2/public/service-plans`;
74
+ const rawBody = {
75
+ integrationId: context.propsValue.integrationId,
76
+ name: context.propsValue.name,
77
+ customerId: context.propsValue.customerId,
78
+ siteId: context.propsValue.siteId,
79
+ serviceTypeId: context.propsValue.serviceTypeId,
80
+ serviceScopeId: context.propsValue.serviceScopeId,
81
+ dateStart: context.propsValue.dateStart,
82
+ dateEnd: context.propsValue.dateEnd,
83
+ workingDays: context.propsValue.workingDays,
84
+ };
85
+ const body = rawBody;
86
+ const response = await pieces_common_1.httpClient.sendRequest({
87
+ method: pieces_common_1.HttpMethod.POST,
88
+ url: `${baseUrl}/api/v2/public/service-plans`,
89
+ headers: {
90
+ Authorization: `Bearer ${token}`,
91
+ 'Content-Type': 'application/json',
92
+ 'X-WorkBuddy-Version': '2026-01',
93
+ },
94
+ body: body,
95
+ });
96
+ return response.body;
97
+ },
98
+ });
99
+ exports.PublicServicePlanController_get = (0, pieces_framework_1.createAction)({
100
+ name: 'PublicServicePlanController_get',
101
+ auth: auth_1.workbuddyAuth,
102
+ displayName: 'Get a Service Plan',
103
+ description: "Resolves a WorkBuddy ID first, then the authenticated caller's integrationId.",
104
+ props: {
105
+ identifier: pieces_framework_1.Property.ShortText({
106
+ displayName: 'Identifier',
107
+ description: 'WorkBuddy Service Plan ID or caller integrationId',
108
+ required: true,
109
+ }),
110
+ },
111
+ async run(context) {
112
+ const token = await (0, auth_1.getAccessToken)(context.auth);
113
+ const baseUrl = context.auth.props.baseUrl;
114
+ const url = `${baseUrl}/api/v2/public/service-plans/${context.propsValue.identifier}`;
115
+ const response = await pieces_common_1.httpClient.sendRequest({
116
+ method: pieces_common_1.HttpMethod.GET,
117
+ url: `${baseUrl}/api/v2/public/service-plans/${context.propsValue.identifier}`,
118
+ headers: {
119
+ Authorization: `Bearer ${token}`,
120
+ 'Content-Type': 'application/json',
121
+ 'X-WorkBuddy-Version': '2026-01',
122
+ },
123
+ });
124
+ return response.body;
125
+ },
126
+ });
127
+ exports.PublicServicePlanController_activate = (0, pieces_framework_1.createAction)({
128
+ name: 'PublicServicePlanController_activate',
129
+ auth: auth_1.workbuddyAuth,
130
+ displayName: 'Activate a Service Plan',
131
+ description: 'Validates and publishes a fully assembled Service Plan.',
132
+ props: {
133
+ identifier: pieces_framework_1.Property.ShortText({
134
+ displayName: 'Identifier',
135
+ description: 'Entity ID or human-readable number',
136
+ required: true,
137
+ }),
138
+ reason: pieces_framework_1.Property.ShortText({
139
+ displayName: 'Reason',
140
+ description: 'Reason for the action (e.g. cancellation reason)',
141
+ required: false,
142
+ }),
143
+ },
144
+ async run(context) {
145
+ const token = await (0, auth_1.getAccessToken)(context.auth);
146
+ const baseUrl = context.auth.props.baseUrl;
147
+ const url = `${baseUrl}/api/v2/public/service-plans/${context.propsValue.identifier}/activate`;
148
+ const rawBody = {
149
+ reason: context.propsValue.reason,
150
+ };
151
+ const body = rawBody;
152
+ const response = await pieces_common_1.httpClient.sendRequest({
153
+ method: pieces_common_1.HttpMethod.POST,
154
+ url: `${baseUrl}/api/v2/public/service-plans/${context.propsValue.identifier}/activate`,
155
+ headers: {
156
+ Authorization: `Bearer ${token}`,
157
+ 'Content-Type': 'application/json',
158
+ 'X-WorkBuddy-Version': '2026-01',
159
+ },
160
+ body: body,
161
+ });
162
+ return response.body;
163
+ },
164
+ });
165
+ exports.PublicServicePlanController_suspend = (0, pieces_framework_1.createAction)({
166
+ name: 'PublicServicePlanController_suspend',
167
+ auth: auth_1.workbuddyAuth,
168
+ displayName: 'Suspend a Service Plan',
169
+ description: 'Stops future scheduled work while preserving history.',
170
+ props: {
171
+ identifier: pieces_framework_1.Property.ShortText({
172
+ displayName: 'Identifier',
173
+ description: 'Entity ID or human-readable number',
174
+ required: true,
175
+ }),
176
+ reason: pieces_framework_1.Property.ShortText({
177
+ displayName: 'Reason',
178
+ description: 'Reason for the action (e.g. cancellation reason)',
179
+ required: false,
180
+ }),
181
+ },
182
+ async run(context) {
183
+ const token = await (0, auth_1.getAccessToken)(context.auth);
184
+ const baseUrl = context.auth.props.baseUrl;
185
+ const url = `${baseUrl}/api/v2/public/service-plans/${context.propsValue.identifier}/suspend`;
186
+ const rawBody = {
187
+ reason: context.propsValue.reason,
188
+ };
189
+ const body = rawBody;
190
+ const response = await pieces_common_1.httpClient.sendRequest({
191
+ method: pieces_common_1.HttpMethod.POST,
192
+ url: `${baseUrl}/api/v2/public/service-plans/${context.propsValue.identifier}/suspend`,
193
+ headers: {
194
+ Authorization: `Bearer ${token}`,
195
+ 'Content-Type': 'application/json',
196
+ 'X-WorkBuddy-Version': '2026-01',
197
+ },
198
+ body: body,
199
+ });
200
+ return response.body;
201
+ },
202
+ });
203
+ exports.PublicServicePlanController_archive = (0, pieces_framework_1.createAction)({
204
+ name: 'PublicServicePlanController_archive',
205
+ auth: auth_1.workbuddyAuth,
206
+ displayName: 'Archive a Service Plan',
207
+ description: 'Archives a suspended Service Plan and reconciles future scheduled work.',
208
+ props: {
209
+ identifier: pieces_framework_1.Property.ShortText({
210
+ displayName: 'Identifier',
211
+ description: 'Entity ID or human-readable number',
212
+ required: true,
213
+ }),
214
+ reason: pieces_framework_1.Property.ShortText({
215
+ displayName: 'Reason',
216
+ description: 'Reason for the action (e.g. cancellation reason)',
217
+ required: false,
218
+ }),
219
+ },
220
+ async run(context) {
221
+ const token = await (0, auth_1.getAccessToken)(context.auth);
222
+ const baseUrl = context.auth.props.baseUrl;
223
+ const url = `${baseUrl}/api/v2/public/service-plans/${context.propsValue.identifier}/archive`;
224
+ const rawBody = {
225
+ reason: context.propsValue.reason,
226
+ };
227
+ const body = rawBody;
228
+ const response = await pieces_common_1.httpClient.sendRequest({
229
+ method: pieces_common_1.HttpMethod.POST,
230
+ url: `${baseUrl}/api/v2/public/service-plans/${context.propsValue.identifier}/archive`,
231
+ headers: {
232
+ Authorization: `Bearer ${token}`,
233
+ 'Content-Type': 'application/json',
234
+ 'X-WorkBuddy-Version': '2026-01',
235
+ },
236
+ body: body,
237
+ });
238
+ return response.body;
239
+ },
240
+ });
241
+ //# sourceMappingURL=service-plans.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-plans.js","sourceRoot":"","sources":["service-plans.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,kCAAwD;AAE3C,QAAA,kCAAkC,GAAG,IAAA,+BAAY,EAAC;IAC7D,IAAI,EAAE,oCAAoC;IAC1C,IAAI,EAAE,oBAAa;IACnB,WAAW,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