@workbuddy/piece-workbuddy-edge 1.0.32 → 1.0.34
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/package.json +1 -1
- package/src/index.d.ts.map +1 -1
- package/src/index.js +76 -14
- package/src/index.js.map +1 -1
- package/src/index.ts +139 -10
- package/src/lib/actions/crm-companies.d.ts +1 -0
- package/src/lib/actions/crm-companies.d.ts.map +1 -1
- package/src/lib/actions/crm-companies.js +9 -0
- package/src/lib/actions/crm-companies.js.map +1 -1
- package/src/lib/actions/crm-companies.ts +11 -0
- package/src/lib/actions/crm-contacts.d.ts +25 -0
- package/src/lib/actions/crm-contacts.d.ts.map +1 -1
- package/src/lib/actions/crm-contacts.js +135 -3
- package/src/lib/actions/crm-contacts.js.map +1 -1
- package/src/lib/actions/crm-contacts.ts +149 -2
- package/src/lib/actions/crm-contractors.d.ts +110 -0
- package/src/lib/actions/crm-contractors.d.ts.map +1 -1
- package/src/lib/actions/crm-contractors.js +585 -2
- package/src/lib/actions/crm-contractors.js.map +1 -1
- package/src/lib/actions/crm-contractors.ts +631 -1
- package/src/lib/actions/crm-customers.d.ts +94 -0
- package/src/lib/actions/crm-customers.d.ts.map +1 -1
- package/src/lib/actions/crm-customers.js +504 -3
- package/src/lib/actions/crm-customers.js.map +1 -1
- package/src/lib/actions/crm-customers.ts +545 -2
- package/src/lib/actions/crm-external-users.js +1 -1
- package/src/lib/actions/crm-external-users.js.map +1 -1
- package/src/lib/actions/crm-external-users.ts +1 -1
- package/src/lib/actions/crm-invites.d.ts +1 -0
- package/src/lib/actions/crm-invites.d.ts.map +1 -1
- package/src/lib/actions/crm-invites.js +9 -0
- package/src/lib/actions/crm-invites.js.map +1 -1
- package/src/lib/actions/crm-invites.ts +11 -0
- package/src/lib/actions/crm-sites.d.ts +10 -0
- package/src/lib/actions/crm-sites.d.ts.map +1 -1
- package/src/lib/actions/crm-sites.js +59 -3
- package/src/lib/actions/crm-sites.js.map +1 -1
- package/src/lib/actions/crm-sites.ts +70 -2
- package/src/lib/actions/crm-suppliers.d.ts +64 -0
- package/src/lib/actions/crm-suppliers.d.ts.map +1 -1
- package/src/lib/actions/crm-suppliers.js +352 -2
- package/src/lib/actions/crm-suppliers.js.map +1 -1
- package/src/lib/actions/crm-suppliers.ts +376 -1
- package/src/lib/actions/index.d.ts +7 -1
- package/src/lib/actions/index.d.ts.map +1 -1
- package/src/lib/actions/index.js +7 -1
- package/src/lib/actions/index.js.map +1 -1
- package/src/lib/actions/index.ts +7 -1
- package/src/lib/actions/items.d.ts +8 -0
- package/src/lib/actions/items.d.ts.map +1 -0
- package/src/lib/actions/items.js +42 -0
- package/src/lib/actions/items.js.map +1 -0
- package/src/lib/actions/items.ts +45 -0
- package/src/lib/actions/jobs-activities.d.ts +4 -3
- package/src/lib/actions/jobs-activities.d.ts.map +1 -1
- package/src/lib/actions/jobs-activities.js +19 -12
- package/src/lib/actions/jobs-activities.js.map +1 -1
- package/src/lib/actions/jobs-activities.ts +19 -12
- package/src/lib/actions/jobs-tasks.d.ts +0 -2
- package/src/lib/actions/jobs-tasks.d.ts.map +1 -1
- package/src/lib/actions/jobs-tasks.js +0 -12
- package/src/lib/actions/jobs-tasks.js.map +1 -1
- package/src/lib/actions/jobs-tasks.ts +0 -12
- package/src/lib/actions/jobs.d.ts +87 -1
- package/src/lib/actions/jobs.d.ts.map +1 -1
- package/src/lib/actions/jobs.js +495 -7
- package/src/lib/actions/jobs.js.map +1 -1
- package/src/lib/actions/jobs.ts +523 -6
- package/src/lib/actions/mcp.d.ts +3 -3
- package/src/lib/actions/mcp.d.ts.map +1 -1
- package/src/lib/actions/mcp.js +9 -9
- package/src/lib/actions/mcp.js.map +1 -1
- package/src/lib/actions/mcp.ts +8 -8
- package/src/lib/actions/pending-items.d.ts +8 -0
- package/src/lib/actions/pending-items.d.ts.map +1 -0
- package/src/lib/actions/pending-items.js +42 -0
- package/src/lib/actions/pending-items.js.map +1 -0
- package/src/lib/actions/pending-items.ts +45 -0
- package/src/lib/actions/settings-custom-fields.d.ts +21 -0
- package/src/lib/actions/settings-custom-fields.d.ts.map +1 -0
- package/src/lib/actions/settings-custom-fields.js +95 -0
- package/src/lib/actions/settings-custom-fields.js.map +1 -0
- package/src/lib/actions/settings-custom-fields.ts +107 -0
- package/src/lib/actions/settings-items.d.ts +136 -0
- package/src/lib/actions/settings-items.d.ts.map +1 -0
- package/src/lib/actions/settings-items.js +772 -0
- package/src/lib/actions/settings-items.js.map +1 -0
- package/src/lib/actions/settings-items.ts +818 -0
- package/src/lib/actions/{settings.d.ts → settings-reference-data.d.ts} +33 -10
- package/src/lib/actions/settings-reference-data.d.ts.map +1 -0
- package/src/lib/actions/settings-reference-data.js +423 -0
- package/src/lib/actions/settings-reference-data.js.map +1 -0
- package/src/lib/actions/settings-reference-data.ts +496 -0
- package/src/lib/actions/settings-templates.d.ts +15 -0
- package/src/lib/actions/settings-templates.d.ts.map +1 -0
- package/src/lib/actions/settings-templates.js +75 -0
- package/src/lib/actions/settings-templates.js.map +1 -0
- package/src/lib/actions/settings-templates.ts +79 -0
- package/src/lib/actions/stages-activities.d.ts +4 -3
- package/src/lib/actions/stages-activities.d.ts.map +1 -1
- package/src/lib/actions/stages-activities.js +19 -12
- package/src/lib/actions/stages-activities.js.map +1 -1
- package/src/lib/actions/stages-activities.ts +19 -12
- package/src/lib/actions/stages-pending-items.d.ts +75 -0
- package/src/lib/actions/stages-pending-items.d.ts.map +1 -0
- package/src/lib/actions/stages-pending-items.js +370 -0
- package/src/lib/actions/stages-pending-items.js.map +1 -0
- package/src/lib/actions/stages-pending-items.ts +404 -0
- package/src/lib/actions/stages-resources.d.ts.map +1 -1
- package/src/lib/actions/stages-resources.js +5 -8
- package/src/lib/actions/stages-resources.js.map +1 -1
- package/src/lib/actions/stages-resources.ts +8 -8
- package/src/lib/actions/stages-tasks.d.ts +0 -2
- package/src/lib/actions/stages-tasks.d.ts.map +1 -1
- package/src/lib/actions/stages-tasks.js +0 -12
- package/src/lib/actions/stages-tasks.js.map +1 -1
- package/src/lib/actions/stages-tasks.ts +0 -12
- package/src/lib/actions/stages.d.ts +20 -3
- package/src/lib/actions/stages.d.ts.map +1 -1
- package/src/lib/actions/stages.js +103 -21
- package/src/lib/actions/stages.js.map +1 -1
- package/src/lib/actions/stages.ts +116 -20
- package/src/lib/actions/webhooks-v2.js +11 -11
- package/src/lib/actions/webhooks-v2.js.map +1 -1
- package/src/lib/actions/webhooks-v2.ts +11 -11
- package/src/lib/actions/settings.d.ts.map +0 -1
- package/src/lib/actions/settings.js +0 -257
- package/src/lib/actions/settings.js.map +0 -1
- package/src/lib/actions/settings.ts +0 -301
|
@@ -8,6 +8,11 @@ export const PublicCrmContractorController_list = createAction({
|
|
|
8
8
|
displayName: 'List contractors',
|
|
9
9
|
description: '',
|
|
10
10
|
props: {
|
|
11
|
+
search: Property.ShortText({
|
|
12
|
+
displayName: 'Search',
|
|
13
|
+
description: 'Search by name, phone, email or legal name',
|
|
14
|
+
required: false,
|
|
15
|
+
}),
|
|
11
16
|
cursor: Property.ShortText({
|
|
12
17
|
displayName: 'Cursor',
|
|
13
18
|
description: '',
|
|
@@ -26,6 +31,12 @@ export const PublicCrmContractorController_list = createAction({
|
|
|
26
31
|
const url = `${baseUrl}/contractors`;
|
|
27
32
|
|
|
28
33
|
const queryParams = new URLSearchParams();
|
|
34
|
+
if (
|
|
35
|
+
context.propsValue.search !== undefined &&
|
|
36
|
+
context.propsValue.search !== null &&
|
|
37
|
+
context.propsValue.search !== ''
|
|
38
|
+
)
|
|
39
|
+
queryParams.append('search', String(context.propsValue.search));
|
|
29
40
|
if (
|
|
30
41
|
context.propsValue.cursor !== undefined &&
|
|
31
42
|
context.propsValue.cursor !== null &&
|
|
@@ -51,6 +62,110 @@ export const PublicCrmContractorController_list = createAction({
|
|
|
51
62
|
},
|
|
52
63
|
});
|
|
53
64
|
|
|
65
|
+
export const PublicCrmContractorController_create = createAction({
|
|
66
|
+
name: 'PublicCrmContractorController_create',
|
|
67
|
+
auth: workbuddyAuth,
|
|
68
|
+
displayName: 'Create contractor',
|
|
69
|
+
description: '',
|
|
70
|
+
props: {
|
|
71
|
+
name: Property.ShortText({
|
|
72
|
+
displayName: 'Name',
|
|
73
|
+
description: 'Display name',
|
|
74
|
+
required: true,
|
|
75
|
+
}),
|
|
76
|
+
address: Property.Json({
|
|
77
|
+
displayName: 'Address',
|
|
78
|
+
description: '',
|
|
79
|
+
required: true,
|
|
80
|
+
}),
|
|
81
|
+
contact: Property.Json({
|
|
82
|
+
displayName: 'Contact',
|
|
83
|
+
description: 'Inline contact object — alternative to contactId',
|
|
84
|
+
required: true,
|
|
85
|
+
}),
|
|
86
|
+
legalName: Property.ShortText({
|
|
87
|
+
displayName: 'Legal Name',
|
|
88
|
+
description: '',
|
|
89
|
+
required: false,
|
|
90
|
+
}),
|
|
91
|
+
phone: Property.ShortText({
|
|
92
|
+
displayName: 'Phone',
|
|
93
|
+
description: 'Phone number',
|
|
94
|
+
required: false,
|
|
95
|
+
}),
|
|
96
|
+
email: Property.ShortText({
|
|
97
|
+
displayName: 'Email',
|
|
98
|
+
description: 'Email address',
|
|
99
|
+
required: false,
|
|
100
|
+
}),
|
|
101
|
+
website: Property.ShortText({
|
|
102
|
+
displayName: 'Website',
|
|
103
|
+
description: '',
|
|
104
|
+
required: false,
|
|
105
|
+
}),
|
|
106
|
+
integrationId: Property.ShortText({
|
|
107
|
+
displayName: 'Integration Id',
|
|
108
|
+
description: 'integration ID',
|
|
109
|
+
required: false,
|
|
110
|
+
}),
|
|
111
|
+
notes: Property.LongText({
|
|
112
|
+
displayName: 'Notes',
|
|
113
|
+
description: 'Additional notes or comments',
|
|
114
|
+
required: false,
|
|
115
|
+
}),
|
|
116
|
+
customFields: Property.Json({
|
|
117
|
+
displayName: 'Custom Fields',
|
|
118
|
+
description: 'Custom fields as key-value pairs — validated against tenant field definitions',
|
|
119
|
+
required: false,
|
|
120
|
+
}),
|
|
121
|
+
socialNetwork: Property.Json({
|
|
122
|
+
displayName: 'Social Network',
|
|
123
|
+
description: '',
|
|
124
|
+
required: false,
|
|
125
|
+
}),
|
|
126
|
+
hidePrices: Property.Checkbox({
|
|
127
|
+
displayName: 'Hide Prices',
|
|
128
|
+
description: '',
|
|
129
|
+
required: false,
|
|
130
|
+
}),
|
|
131
|
+
},
|
|
132
|
+
async run(context) {
|
|
133
|
+
const token = await getAccessToken(context.auth);
|
|
134
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
135
|
+
|
|
136
|
+
const url = `${baseUrl}/api/v2/public/contractors`;
|
|
137
|
+
|
|
138
|
+
const rawBody: Record<string, unknown> = {
|
|
139
|
+
name: context.propsValue.name,
|
|
140
|
+
legalName: context.propsValue.legalName,
|
|
141
|
+
phone: context.propsValue.phone,
|
|
142
|
+
email: context.propsValue.email,
|
|
143
|
+
website: context.propsValue.website,
|
|
144
|
+
integrationId: context.propsValue.integrationId,
|
|
145
|
+
address: context.propsValue.address,
|
|
146
|
+
contact: context.propsValue.contact,
|
|
147
|
+
notes: context.propsValue.notes,
|
|
148
|
+
customFields: context.propsValue.customFields,
|
|
149
|
+
socialNetwork: context.propsValue.socialNetwork,
|
|
150
|
+
hidePrices: context.propsValue.hidePrices,
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const body = rawBody;
|
|
154
|
+
const response = await httpClient.sendRequest({
|
|
155
|
+
method: HttpMethod.POST,
|
|
156
|
+
url: `${baseUrl}/api/v2/public/contractors`,
|
|
157
|
+
headers: {
|
|
158
|
+
Authorization: `Bearer ${token}`,
|
|
159
|
+
'Content-Type': 'application/json',
|
|
160
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
161
|
+
},
|
|
162
|
+
body: body,
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
return response.body;
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
|
|
54
169
|
export const PublicCrmContractorController_getById = createAction({
|
|
55
170
|
name: 'PublicCrmContractorController_getById',
|
|
56
171
|
auth: workbuddyAuth,
|
|
@@ -59,7 +174,7 @@ export const PublicCrmContractorController_getById = createAction({
|
|
|
59
174
|
props: {
|
|
60
175
|
id: Property.ShortText({
|
|
61
176
|
displayName: 'Id',
|
|
62
|
-
description: 'Contractor ID',
|
|
177
|
+
description: 'Contractor ID or integration ID',
|
|
63
178
|
required: true,
|
|
64
179
|
}),
|
|
65
180
|
},
|
|
@@ -82,3 +197,518 @@ export const PublicCrmContractorController_getById = createAction({
|
|
|
82
197
|
return response.body;
|
|
83
198
|
},
|
|
84
199
|
});
|
|
200
|
+
|
|
201
|
+
export const PublicCrmContractorController_update = createAction({
|
|
202
|
+
name: 'PublicCrmContractorController_update',
|
|
203
|
+
auth: workbuddyAuth,
|
|
204
|
+
displayName: 'Update contractor',
|
|
205
|
+
description: '',
|
|
206
|
+
props: {
|
|
207
|
+
id: Property.ShortText({
|
|
208
|
+
displayName: 'Id',
|
|
209
|
+
description: 'Contractor ID or integration ID',
|
|
210
|
+
required: true,
|
|
211
|
+
}),
|
|
212
|
+
name: Property.ShortText({
|
|
213
|
+
displayName: 'Name',
|
|
214
|
+
description: 'Display name',
|
|
215
|
+
required: false,
|
|
216
|
+
}),
|
|
217
|
+
legalName: Property.ShortText({
|
|
218
|
+
displayName: 'Legal Name',
|
|
219
|
+
description: '',
|
|
220
|
+
required: false,
|
|
221
|
+
}),
|
|
222
|
+
phone: Property.ShortText({
|
|
223
|
+
displayName: 'Phone',
|
|
224
|
+
description: 'Phone number',
|
|
225
|
+
required: false,
|
|
226
|
+
}),
|
|
227
|
+
email: Property.ShortText({
|
|
228
|
+
displayName: 'Email',
|
|
229
|
+
description: 'Email address',
|
|
230
|
+
required: false,
|
|
231
|
+
}),
|
|
232
|
+
website: Property.ShortText({
|
|
233
|
+
displayName: 'Website',
|
|
234
|
+
description: '',
|
|
235
|
+
required: false,
|
|
236
|
+
}),
|
|
237
|
+
integrationId: Property.ShortText({
|
|
238
|
+
displayName: 'Integration Id',
|
|
239
|
+
description: 'integration ID',
|
|
240
|
+
required: false,
|
|
241
|
+
}),
|
|
242
|
+
address: Property.Json({
|
|
243
|
+
displayName: 'Address',
|
|
244
|
+
description: '',
|
|
245
|
+
required: false,
|
|
246
|
+
}),
|
|
247
|
+
primarySite: Property.Json({
|
|
248
|
+
displayName: 'Primary Site',
|
|
249
|
+
description: '',
|
|
250
|
+
required: false,
|
|
251
|
+
}),
|
|
252
|
+
owner: Property.Json({
|
|
253
|
+
displayName: 'Owner',
|
|
254
|
+
description: '',
|
|
255
|
+
required: false,
|
|
256
|
+
}),
|
|
257
|
+
labels: Property.Json({
|
|
258
|
+
displayName: 'Labels',
|
|
259
|
+
description: '',
|
|
260
|
+
required: false,
|
|
261
|
+
defaultValue: [],
|
|
262
|
+
}),
|
|
263
|
+
notes: Property.LongText({
|
|
264
|
+
displayName: 'Notes',
|
|
265
|
+
description: 'Additional notes or comments',
|
|
266
|
+
required: false,
|
|
267
|
+
}),
|
|
268
|
+
customFields: Property.Json({
|
|
269
|
+
displayName: 'Custom Fields',
|
|
270
|
+
description: 'Custom fields as key-value pairs — validated against tenant field definitions',
|
|
271
|
+
required: false,
|
|
272
|
+
}),
|
|
273
|
+
socialNetwork: Property.Json({
|
|
274
|
+
displayName: 'Social Network',
|
|
275
|
+
description: '',
|
|
276
|
+
required: false,
|
|
277
|
+
}),
|
|
278
|
+
zones: Property.Json({
|
|
279
|
+
displayName: 'Zones',
|
|
280
|
+
description: '',
|
|
281
|
+
required: false,
|
|
282
|
+
defaultValue: [],
|
|
283
|
+
}),
|
|
284
|
+
companies: Property.Json({
|
|
285
|
+
displayName: 'Companies',
|
|
286
|
+
description: '',
|
|
287
|
+
required: false,
|
|
288
|
+
defaultValue: [],
|
|
289
|
+
}),
|
|
290
|
+
workCategories: Property.Json({
|
|
291
|
+
displayName: 'Work Categories',
|
|
292
|
+
description: '',
|
|
293
|
+
required: false,
|
|
294
|
+
defaultValue: [],
|
|
295
|
+
}),
|
|
296
|
+
scheduling: Property.Json({
|
|
297
|
+
displayName: 'Scheduling',
|
|
298
|
+
description: '',
|
|
299
|
+
required: false,
|
|
300
|
+
}),
|
|
301
|
+
dispatching: Property.Json({
|
|
302
|
+
displayName: 'Dispatching',
|
|
303
|
+
description: '',
|
|
304
|
+
required: false,
|
|
305
|
+
}),
|
|
306
|
+
timesheet: Property.Json({
|
|
307
|
+
displayName: 'Timesheet',
|
|
308
|
+
description: '',
|
|
309
|
+
required: false,
|
|
310
|
+
}),
|
|
311
|
+
hidePrices: Property.Checkbox({
|
|
312
|
+
displayName: 'Hide Prices',
|
|
313
|
+
description: '',
|
|
314
|
+
required: false,
|
|
315
|
+
}),
|
|
316
|
+
pricebook: Property.Json({
|
|
317
|
+
displayName: 'Pricebook',
|
|
318
|
+
description: '',
|
|
319
|
+
required: false,
|
|
320
|
+
}),
|
|
321
|
+
},
|
|
322
|
+
async run(context) {
|
|
323
|
+
const token = await getAccessToken(context.auth);
|
|
324
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
325
|
+
|
|
326
|
+
const url = `${baseUrl}/api/v2/public/contractors/${context.propsValue.id}`;
|
|
327
|
+
|
|
328
|
+
// Build body with only defined values (for partial updates)
|
|
329
|
+
const rawBody: Record<string, unknown> = {
|
|
330
|
+
name: context.propsValue.name,
|
|
331
|
+
legalName: context.propsValue.legalName,
|
|
332
|
+
phone: context.propsValue.phone,
|
|
333
|
+
email: context.propsValue.email,
|
|
334
|
+
website: context.propsValue.website,
|
|
335
|
+
integrationId: context.propsValue.integrationId,
|
|
336
|
+
address: context.propsValue.address,
|
|
337
|
+
primarySite: context.propsValue.primarySite,
|
|
338
|
+
owner: context.propsValue.owner,
|
|
339
|
+
labels: context.propsValue.labels,
|
|
340
|
+
notes: context.propsValue.notes,
|
|
341
|
+
customFields: context.propsValue.customFields,
|
|
342
|
+
socialNetwork: context.propsValue.socialNetwork,
|
|
343
|
+
zones: context.propsValue.zones,
|
|
344
|
+
companies: context.propsValue.companies,
|
|
345
|
+
workCategories: context.propsValue.workCategories,
|
|
346
|
+
scheduling: context.propsValue.scheduling,
|
|
347
|
+
dispatching: context.propsValue.dispatching,
|
|
348
|
+
timesheet: context.propsValue.timesheet,
|
|
349
|
+
hidePrices: context.propsValue.hidePrices,
|
|
350
|
+
pricebook: context.propsValue.pricebook,
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
const body = Object.fromEntries(
|
|
354
|
+
Object.entries(rawBody).filter(([_, v]) => v !== undefined && v !== null && v !== '')
|
|
355
|
+
);
|
|
356
|
+
const response = await httpClient.sendRequest({
|
|
357
|
+
method: HttpMethod.PATCH,
|
|
358
|
+
url: `${baseUrl}/api/v2/public/contractors/${context.propsValue.id}`,
|
|
359
|
+
headers: {
|
|
360
|
+
Authorization: `Bearer ${token}`,
|
|
361
|
+
'Content-Type': 'application/json',
|
|
362
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
363
|
+
},
|
|
364
|
+
body: body,
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
return response.body;
|
|
368
|
+
},
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
export const PublicCrmContractorController_delete = createAction({
|
|
372
|
+
name: 'PublicCrmContractorController_delete',
|
|
373
|
+
auth: workbuddyAuth,
|
|
374
|
+
displayName: 'Delete contractor',
|
|
375
|
+
description: '',
|
|
376
|
+
props: {
|
|
377
|
+
id: Property.ShortText({
|
|
378
|
+
displayName: 'Id',
|
|
379
|
+
description: 'Contractor ID or integration ID',
|
|
380
|
+
required: true,
|
|
381
|
+
}),
|
|
382
|
+
},
|
|
383
|
+
async run(context) {
|
|
384
|
+
const token = await getAccessToken(context.auth);
|
|
385
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
386
|
+
|
|
387
|
+
const url = `${baseUrl}/api/v2/public/contractors/${context.propsValue.id}`;
|
|
388
|
+
|
|
389
|
+
const response = await httpClient.sendRequest({
|
|
390
|
+
method: HttpMethod.DELETE,
|
|
391
|
+
url: `${baseUrl}/api/v2/public/contractors/${context.propsValue.id}`,
|
|
392
|
+
headers: {
|
|
393
|
+
Authorization: `Bearer ${token}`,
|
|
394
|
+
'Content-Type': 'application/json',
|
|
395
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
396
|
+
},
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
return response.body;
|
|
400
|
+
},
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
export const PublicCrmContractorController_updateStatus = createAction({
|
|
404
|
+
name: 'PublicCrmContractorController_updateStatus',
|
|
405
|
+
auth: workbuddyAuth,
|
|
406
|
+
displayName: 'Update contractor status',
|
|
407
|
+
description: '',
|
|
408
|
+
props: {
|
|
409
|
+
id: Property.ShortText({
|
|
410
|
+
displayName: 'Id',
|
|
411
|
+
description: 'Contractor ID or integration ID',
|
|
412
|
+
required: true,
|
|
413
|
+
}),
|
|
414
|
+
statusId: Property.ShortText({
|
|
415
|
+
displayName: 'Status Id',
|
|
416
|
+
description: 'status ID',
|
|
417
|
+
required: true,
|
|
418
|
+
}),
|
|
419
|
+
note: Property.ShortText({
|
|
420
|
+
displayName: 'Note',
|
|
421
|
+
description: '',
|
|
422
|
+
required: false,
|
|
423
|
+
}),
|
|
424
|
+
},
|
|
425
|
+
async run(context) {
|
|
426
|
+
const token = await getAccessToken(context.auth);
|
|
427
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
428
|
+
|
|
429
|
+
const url = `${baseUrl}/api/v2/public/contractors/${context.propsValue.id}/status`;
|
|
430
|
+
|
|
431
|
+
// Build body with only defined values (for partial updates)
|
|
432
|
+
const rawBody: Record<string, unknown> = {
|
|
433
|
+
statusId: context.propsValue.statusId,
|
|
434
|
+
note: context.propsValue.note,
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
const body = Object.fromEntries(
|
|
438
|
+
Object.entries(rawBody).filter(([_, v]) => v !== undefined && v !== null && v !== '')
|
|
439
|
+
);
|
|
440
|
+
const response = await httpClient.sendRequest({
|
|
441
|
+
method: HttpMethod.PATCH,
|
|
442
|
+
url: `${baseUrl}/api/v2/public/contractors/${context.propsValue.id}/status`,
|
|
443
|
+
headers: {
|
|
444
|
+
Authorization: `Bearer ${token}`,
|
|
445
|
+
'Content-Type': 'application/json',
|
|
446
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
447
|
+
},
|
|
448
|
+
body: body,
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
return response.body;
|
|
452
|
+
},
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
export const PublicCrmContractorController_listContacts = createAction({
|
|
456
|
+
name: 'PublicCrmContractorController_listContacts',
|
|
457
|
+
auth: workbuddyAuth,
|
|
458
|
+
displayName: 'List contacts for contractor (contacts + external users)',
|
|
459
|
+
description: '',
|
|
460
|
+
props: {
|
|
461
|
+
contractorId: Property.ShortText({
|
|
462
|
+
displayName: 'Contractor Id',
|
|
463
|
+
description: 'Contractor ID',
|
|
464
|
+
required: true,
|
|
465
|
+
}),
|
|
466
|
+
cursor: Property.ShortText({
|
|
467
|
+
displayName: 'Cursor',
|
|
468
|
+
description: '',
|
|
469
|
+
required: false,
|
|
470
|
+
}),
|
|
471
|
+
limit: Property.Number({
|
|
472
|
+
displayName: 'Limit',
|
|
473
|
+
description: '',
|
|
474
|
+
required: false,
|
|
475
|
+
}),
|
|
476
|
+
},
|
|
477
|
+
async run(context) {
|
|
478
|
+
const token = await getAccessToken(context.auth);
|
|
479
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
480
|
+
|
|
481
|
+
const url = `${baseUrl}/contractors/{contractorId}/contacts`;
|
|
482
|
+
|
|
483
|
+
const queryParams = new URLSearchParams();
|
|
484
|
+
if (
|
|
485
|
+
context.propsValue.cursor !== undefined &&
|
|
486
|
+
context.propsValue.cursor !== null &&
|
|
487
|
+
context.propsValue.cursor !== ''
|
|
488
|
+
)
|
|
489
|
+
queryParams.append('cursor', String(context.propsValue.cursor));
|
|
490
|
+
if (context.propsValue.limit !== undefined && context.propsValue.limit !== null)
|
|
491
|
+
queryParams.append('limit', String(context.propsValue.limit));
|
|
492
|
+
const queryString = queryParams.toString();
|
|
493
|
+
const urlWithQuery = queryString ? `${url}?${queryString}` : url;
|
|
494
|
+
|
|
495
|
+
const response = await httpClient.sendRequest({
|
|
496
|
+
method: HttpMethod.GET,
|
|
497
|
+
url: urlWithQuery,
|
|
498
|
+
headers: {
|
|
499
|
+
Authorization: `Bearer ${token}`,
|
|
500
|
+
'Content-Type': 'application/json',
|
|
501
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
502
|
+
},
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
return response.body;
|
|
506
|
+
},
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
export const PublicCrmContractorController_createContact = createAction({
|
|
510
|
+
name: 'PublicCrmContractorController_createContact',
|
|
511
|
+
auth: workbuddyAuth,
|
|
512
|
+
displayName: 'Create contractor contact',
|
|
513
|
+
description: '',
|
|
514
|
+
props: {
|
|
515
|
+
contractorId: Property.ShortText({
|
|
516
|
+
displayName: 'Contractor Id',
|
|
517
|
+
description: 'Contractor ID',
|
|
518
|
+
required: true,
|
|
519
|
+
}),
|
|
520
|
+
firstName: Property.ShortText({
|
|
521
|
+
displayName: 'First Name',
|
|
522
|
+
description: 'First name',
|
|
523
|
+
required: true,
|
|
524
|
+
}),
|
|
525
|
+
lastName: Property.ShortText({
|
|
526
|
+
displayName: 'Last Name',
|
|
527
|
+
description: 'Last name',
|
|
528
|
+
required: true,
|
|
529
|
+
}),
|
|
530
|
+
login: Property.Checkbox({
|
|
531
|
+
displayName: 'Login',
|
|
532
|
+
description: 'false = basic contact. true = external user with portal login (requires email and roleId).',
|
|
533
|
+
required: true,
|
|
534
|
+
}),
|
|
535
|
+
email: Property.ShortText({
|
|
536
|
+
displayName: 'Email',
|
|
537
|
+
description: 'Email address. Required when login is true.',
|
|
538
|
+
required: false,
|
|
539
|
+
}),
|
|
540
|
+
phone: Property.ShortText({
|
|
541
|
+
displayName: 'Phone',
|
|
542
|
+
description: 'Phone',
|
|
543
|
+
required: false,
|
|
544
|
+
}),
|
|
545
|
+
mobile: Property.ShortText({
|
|
546
|
+
displayName: 'Mobile',
|
|
547
|
+
description: 'Mobile',
|
|
548
|
+
required: false,
|
|
549
|
+
}),
|
|
550
|
+
title: Property.ShortText({
|
|
551
|
+
displayName: 'Title',
|
|
552
|
+
description: 'Job title',
|
|
553
|
+
required: false,
|
|
554
|
+
}),
|
|
555
|
+
note: Property.ShortText({
|
|
556
|
+
displayName: 'Note',
|
|
557
|
+
description: 'Note',
|
|
558
|
+
required: false,
|
|
559
|
+
}),
|
|
560
|
+
integrationId: Property.ShortText({
|
|
561
|
+
displayName: 'Integration Id',
|
|
562
|
+
description: 'External integration identifier',
|
|
563
|
+
required: false,
|
|
564
|
+
}),
|
|
565
|
+
roleId: Property.ShortText({
|
|
566
|
+
displayName: 'Role Id',
|
|
567
|
+
description:
|
|
568
|
+
'Portal security role id. Required when login is true. List via GET /settings/roles/client-portal or /settings/roles/contractor-portal.',
|
|
569
|
+
required: false,
|
|
570
|
+
}),
|
|
571
|
+
sendEmail: Property.Checkbox({
|
|
572
|
+
displayName: 'Send Email',
|
|
573
|
+
description: 'Send invite email when login is true. Default true.',
|
|
574
|
+
required: false,
|
|
575
|
+
}),
|
|
576
|
+
autoDispatch: Property.Checkbox({
|
|
577
|
+
displayName: 'Auto Dispatch',
|
|
578
|
+
description: 'Automatically dispatch when contractor is assigned. Only for external users under a contractor.',
|
|
579
|
+
required: false,
|
|
580
|
+
}),
|
|
581
|
+
},
|
|
582
|
+
async run(context) {
|
|
583
|
+
const token = await getAccessToken(context.auth);
|
|
584
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
585
|
+
|
|
586
|
+
const url = `${baseUrl}/api/v2/public/contractors/${context.propsValue.contractorId}/contacts`;
|
|
587
|
+
|
|
588
|
+
const rawBody: Record<string, unknown> = {
|
|
589
|
+
firstName: context.propsValue.firstName,
|
|
590
|
+
lastName: context.propsValue.lastName,
|
|
591
|
+
email: context.propsValue.email,
|
|
592
|
+
phone: context.propsValue.phone,
|
|
593
|
+
mobile: context.propsValue.mobile,
|
|
594
|
+
title: context.propsValue.title,
|
|
595
|
+
note: context.propsValue.note,
|
|
596
|
+
integrationId: context.propsValue.integrationId,
|
|
597
|
+
login: context.propsValue.login,
|
|
598
|
+
roleId: context.propsValue.roleId,
|
|
599
|
+
sendEmail: context.propsValue.sendEmail,
|
|
600
|
+
autoDispatch: context.propsValue.autoDispatch,
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
const body = rawBody;
|
|
604
|
+
const response = await httpClient.sendRequest({
|
|
605
|
+
method: HttpMethod.POST,
|
|
606
|
+
url: `${baseUrl}/api/v2/public/contractors/${context.propsValue.contractorId}/contacts`,
|
|
607
|
+
headers: {
|
|
608
|
+
Authorization: `Bearer ${token}`,
|
|
609
|
+
'Content-Type': 'application/json',
|
|
610
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
611
|
+
},
|
|
612
|
+
body: body,
|
|
613
|
+
});
|
|
614
|
+
|
|
615
|
+
return response.body;
|
|
616
|
+
},
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
export const PublicCrmContractorController_deleteContact = createAction({
|
|
620
|
+
name: 'PublicCrmContractorController_deleteContact',
|
|
621
|
+
auth: workbuddyAuth,
|
|
622
|
+
displayName: 'Delete contractor contact',
|
|
623
|
+
description: '',
|
|
624
|
+
props: {
|
|
625
|
+
contractorId: Property.ShortText({
|
|
626
|
+
displayName: 'Contractor Id',
|
|
627
|
+
description: 'Contractor ID',
|
|
628
|
+
required: true,
|
|
629
|
+
}),
|
|
630
|
+
contactId: Property.ShortText({
|
|
631
|
+
displayName: 'Contact Id',
|
|
632
|
+
description: 'Contact ID',
|
|
633
|
+
required: true,
|
|
634
|
+
}),
|
|
635
|
+
},
|
|
636
|
+
async run(context) {
|
|
637
|
+
const token = await getAccessToken(context.auth);
|
|
638
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
639
|
+
|
|
640
|
+
const url = `${baseUrl}/api/v2/public/contractors/${context.propsValue.contractorId}/contacts/${context.propsValue.contactId}`;
|
|
641
|
+
|
|
642
|
+
const response = await httpClient.sendRequest({
|
|
643
|
+
method: HttpMethod.DELETE,
|
|
644
|
+
url: `${baseUrl}/api/v2/public/contractors/${context.propsValue.contractorId}/contacts/${context.propsValue.contactId}`,
|
|
645
|
+
headers: {
|
|
646
|
+
Authorization: `Bearer ${token}`,
|
|
647
|
+
'Content-Type': 'application/json',
|
|
648
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
649
|
+
},
|
|
650
|
+
});
|
|
651
|
+
|
|
652
|
+
return response.body;
|
|
653
|
+
},
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
export const PublicCrmContractorController_inviteContact = createAction({
|
|
657
|
+
name: 'PublicCrmContractorController_inviteContact',
|
|
658
|
+
auth: workbuddyAuth,
|
|
659
|
+
displayName: 'Invite contact (CRM > Contractors)',
|
|
660
|
+
description: '',
|
|
661
|
+
props: {
|
|
662
|
+
contractorId: Property.ShortText({
|
|
663
|
+
displayName: 'Contractor Id',
|
|
664
|
+
description: 'Contractor ID',
|
|
665
|
+
required: true,
|
|
666
|
+
}),
|
|
667
|
+
contactId: Property.ShortText({
|
|
668
|
+
displayName: 'Contact Id',
|
|
669
|
+
description: 'Contact ID',
|
|
670
|
+
required: true,
|
|
671
|
+
}),
|
|
672
|
+
roleId: Property.ShortText({
|
|
673
|
+
displayName: 'Role Id',
|
|
674
|
+
description: 'role ID',
|
|
675
|
+
required: true,
|
|
676
|
+
}),
|
|
677
|
+
email: Property.ShortText({
|
|
678
|
+
displayName: 'Email',
|
|
679
|
+
description: 'Email address',
|
|
680
|
+
required: false,
|
|
681
|
+
}),
|
|
682
|
+
sendEmail: Property.Checkbox({
|
|
683
|
+
displayName: 'Send Email',
|
|
684
|
+
description: '',
|
|
685
|
+
required: false,
|
|
686
|
+
}),
|
|
687
|
+
},
|
|
688
|
+
async run(context) {
|
|
689
|
+
const token = await getAccessToken(context.auth);
|
|
690
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
691
|
+
|
|
692
|
+
const url = `${baseUrl}/api/v2/public/contractors/${context.propsValue.contractorId}/contacts/${context.propsValue.contactId}/invite`;
|
|
693
|
+
|
|
694
|
+
const rawBody: Record<string, unknown> = {
|
|
695
|
+
email: context.propsValue.email,
|
|
696
|
+
roleId: context.propsValue.roleId,
|
|
697
|
+
sendEmail: context.propsValue.sendEmail,
|
|
698
|
+
};
|
|
699
|
+
|
|
700
|
+
const body = rawBody;
|
|
701
|
+
const response = await httpClient.sendRequest({
|
|
702
|
+
method: HttpMethod.POST,
|
|
703
|
+
url: `${baseUrl}/api/v2/public/contractors/${context.propsValue.contractorId}/contacts/${context.propsValue.contactId}/invite`,
|
|
704
|
+
headers: {
|
|
705
|
+
Authorization: `Bearer ${token}`,
|
|
706
|
+
'Content-Type': 'application/json',
|
|
707
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
708
|
+
},
|
|
709
|
+
body: body,
|
|
710
|
+
});
|
|
711
|
+
|
|
712
|
+
return response.body;
|
|
713
|
+
},
|
|
714
|
+
});
|