@workbuddy/sdk-js-vnext 1.0.6 → 1.0.8

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 (3) hide show
  1. package/index.d.ts +209 -3
  2. package/index.js +23 -2
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -738,6 +738,8 @@ export interface WorkBuddyJobsCreateParams extends WorkBuddyRequestParams {
738
738
  * integration ID
739
739
  */
740
740
  integrationId?: string;
741
+
742
+ jobNumber?: string;
741
743
  /**
742
744
  * Detailed description
743
745
  */
@@ -810,9 +812,119 @@ export interface WorkBuddyJobsCreateParams extends WorkBuddyRequestParams {
810
812
  */
811
813
  customerPO?: string;
812
814
  /**
813
- * Template ID to pre-populate fields from a template
815
+ * Start date (ISO 8601 datetime)
814
816
  */
815
- templateId?: string;
817
+ startDate?: string;
818
+ /**
819
+ * Due date (ISO 8601 datetime)
820
+ */
821
+ dueDate?: string;
822
+ /**
823
+ * Custom fields as key-value pairs — validated against tenant field definitions
824
+ */
825
+ customFields?: Record<string, unknown>;
826
+
827
+ items?: {
828
+ integrationId?: string;
829
+ code: string;
830
+ description?: string;
831
+ longDescription?: string;
832
+ quantity: number;
833
+ location?: string;
834
+ note?: string;
835
+ buyPrice?: number;
836
+ sellPrice?: number;
837
+ invoicingStatus?: 'Billable' | 'No Charge' | 'Not Billable';
838
+ suppliedBySubcontractor?: boolean;
839
+ }[];
840
+ }
841
+
842
+ export interface WorkBuddyJobsTemplateCreateFromTemplateParams extends WorkBuddyRequestParams {
843
+ /**
844
+ * Job template ID
845
+ */
846
+ templateId: string;
847
+ /**
848
+ * Display name
849
+ */
850
+ name?: string;
851
+ /**
852
+ * integration ID
853
+ */
854
+ integrationId?: string;
855
+
856
+ jobNumber?: string;
857
+ /**
858
+ * Detailed description
859
+ */
860
+ description?: string;
861
+ /**
862
+ * Customer ID — use /crm/customers to look up
863
+ */
864
+ customerId: string;
865
+ /**
866
+ * Site ID — use /crm/sites to look up
867
+ */
868
+ siteId?: string;
869
+ /**
870
+ * Inline site object — alternative to siteId
871
+ */
872
+ site?: {
873
+ name?: string;
874
+ address: { street?: string; city?: string; state?: string; postcode?: string; country?: string };
875
+ };
876
+ /**
877
+ * Contact ID — use /crm/contacts to look up
878
+ */
879
+ contactId?: string;
880
+ /**
881
+ * Inline contact object — alternative to contactId
882
+ */
883
+ contact?: { name: string; phone?: string; email?: string };
884
+ /**
885
+ * Job type ID — use /settings/job-types to look up
886
+ */
887
+ typeId?: string;
888
+ /**
889
+ * Priority ID — use /settings/priorities to look up
890
+ */
891
+ priorityId?: string;
892
+ /**
893
+ * Price book ID for job pricing
894
+ */
895
+ priceBookId?: string;
896
+ /**
897
+ * Owner (employee) ID — use /crm/employees to look up
898
+ */
899
+ ownerId?: string;
900
+ /**
901
+ * Field supervisor (employee) ID — use /crm/employees to look up
902
+ */
903
+ fieldSupervisorId?: string;
904
+ /**
905
+ * Zone ID — use /settings/zones to look up
906
+ */
907
+ zoneId?: string;
908
+ /**
909
+ * Array of tag IDs (comma-separated, e.g. "id1,id2") — use /settings/tags to look up
910
+ */
911
+ tagIds?: string[];
912
+ /**
913
+ * Additional notes or comments
914
+ */
915
+ notes?: string;
916
+ /**
917
+ * External reference number
918
+ */
919
+ reference?: string;
920
+ /**
921
+ * Customer work order reference
922
+ */
923
+ customerWO?: string;
924
+ /**
925
+ * Customer purchase order reference
926
+ */
927
+ customerPO?: string;
816
928
  /**
817
929
  * Start date (ISO 8601 datetime)
818
930
  */
@@ -3522,6 +3634,87 @@ export type WorkBuddyJobsCreateResponse = {
3522
3634
  createdAt: string;
3523
3635
  updatedAt: string;
3524
3636
  };
3637
+ export type WorkBuddyJobsTemplateCreateFromTemplateResponse = {
3638
+ id: string;
3639
+ integrationId?: string;
3640
+ jobNumber: string;
3641
+ name?: string;
3642
+ description: string;
3643
+ status: { id?: string; name?: string; systemStatus: string };
3644
+ customer: { id: string; name: string };
3645
+ site?: string;
3646
+ contact?: string;
3647
+ customerSupervisor?: string;
3648
+ type?: string;
3649
+ priority?: string;
3650
+ owner?: string;
3651
+ fieldSupervisor?: string;
3652
+ zones?: { id: string; name: string }[];
3653
+ tags?: { id: string; name: string; color?: string }[];
3654
+ systemTags?: { id: string; name: string; color?: string }[];
3655
+ notes?: string;
3656
+ reference?: string;
3657
+ customerWO?: string;
3658
+ customerPO?: string;
3659
+ priceBook?: string;
3660
+ billingCompany?: string;
3661
+ policy?: string;
3662
+ thresholds?: string;
3663
+ stages?: {
3664
+ id: string;
3665
+ stageNumber: string;
3666
+ jobId: string;
3667
+ job?: { id: string; jobNumber: string; description?: string };
3668
+ name?: string;
3669
+ description?: string;
3670
+ status: { id?: string; name?: string; systemStatus: string };
3671
+ sequence?: number;
3672
+ owner?: string;
3673
+ contractor?: string;
3674
+ technician?: string;
3675
+ resources?: string;
3676
+ startDate?: string;
3677
+ dueDate?: string;
3678
+ completedDate?: string;
3679
+ completedBy?: string;
3680
+ completedNote?: string;
3681
+ finalisedDate?: string;
3682
+ notes?: string;
3683
+ tags?: string;
3684
+ systemTags?: string;
3685
+ schedulingTags?: string;
3686
+ items?: {
3687
+ id: string;
3688
+ jobId: string;
3689
+ stageId: string;
3690
+ integrationId?: string;
3691
+ code?: string;
3692
+ description: string;
3693
+ type?: string;
3694
+ quantity: number;
3695
+ unit?: string;
3696
+ location?: string;
3697
+ note?: string;
3698
+ status?: string;
3699
+ buyPrice?: number;
3700
+ sellPrice?: number;
3701
+ invoicingStatus?: string;
3702
+ suppliedBySubcontractor: boolean;
3703
+ createdAt: string;
3704
+ updatedAt: string;
3705
+ }[];
3706
+ totals?: { sellTotal: number; buyTotal: number };
3707
+ customFields?: string;
3708
+ createdAt: string;
3709
+ updatedAt: string;
3710
+ }[];
3711
+ totals?: { sellTotal: number; buyTotal: number };
3712
+ customFields?: string;
3713
+ dueDate?: string;
3714
+ startDate?: string;
3715
+ createdAt: string;
3716
+ updatedAt: string;
3717
+ };
3525
3718
  export type WorkBuddyJobsStatusUpdateStatusResponse = {
3526
3719
  id: string;
3527
3720
  integrationId?: string;
@@ -5256,6 +5449,8 @@ export type WorkBuddyMcpCreateResponse = unknown;
5256
5449
  export type WorkBuddyMcpDeleteResponse = unknown;
5257
5450
 
5258
5451
  export interface WorkBuddyJobsResource {
5452
+ /** Template API operations. */
5453
+ template: WorkBuddyJobsTemplateResource;
5259
5454
  /** Status API operations. */
5260
5455
  status: WorkBuddyJobsStatusResource;
5261
5456
  /** Stages API operations. */
@@ -5332,6 +5527,17 @@ export interface WorkBuddyJobsResource {
5332
5527
  ): Promise<TResponse>;
5333
5528
  }
5334
5529
 
5530
+ export interface WorkBuddyJobsTemplateResource {
5531
+ /**
5532
+ * Create a job using a job template. Template-owned fields win over request values before final job validation.
5533
+ * Operation: PublicApiJobController_createFromTemplate
5534
+ */
5535
+ createFromTemplate<TResponse = WorkBuddyJobsTemplateCreateFromTemplateResponse>(
5536
+ params: WorkBuddyJobsTemplateCreateFromTemplateParams,
5537
+ options?: WorkBuddyRequestOptions
5538
+ ): Promise<TResponse>;
5539
+ }
5540
+
5335
5541
  export interface WorkBuddyJobsStatusResource {
5336
5542
  /**
5337
5543
  * Change an existing job status and cascade the change to stages through the job domain command.
@@ -6248,7 +6454,7 @@ export interface WorkBuddySettingsItemsResource {
6248
6454
  ): Promise<TResponse>;
6249
6455
 
6250
6456
  /**
6251
- * Retrieve a settings item by ID.
6457
+ * Retrieve a settings item by ID, name, or integration ID.
6252
6458
  * Operation: PublicApiItemController_getById
6253
6459
  */
6254
6460
  get<TResponse = WorkBuddySettingsItemsGetResponse>(
package/index.js CHANGED
@@ -34,6 +34,14 @@ export class WorkBuddyClient {
34
34
  }
35
35
 
36
36
  this.jobs = {
37
+ template: {
38
+ /**
39
+ * Create a job using a job template. Template-owned fields win over request values before final job validation.
40
+ * Operation: PublicApiJobController_createFromTemplate
41
+ */
42
+ createFromTemplate: (params = {}, options = {}) =>
43
+ this.request('PublicApiJobController_createFromTemplate', params, options),
44
+ },
37
45
  status: {
38
46
  /**
39
47
  * Change an existing job status and cascade the change to stages through the job domain command.
@@ -601,7 +609,7 @@ export class WorkBuddyClient {
601
609
  */
602
610
  upsert: (params = {}, options = {}) => this.request('PublicApiItemController_upsert', params, options),
603
611
  /**
604
- * Retrieve a settings item by ID.
612
+ * Retrieve a settings item by ID, name, or integration ID.
605
613
  * Operation: PublicApiItemController_getById
606
614
  */
607
615
  get: (params = {}, options = {}) => this.request('PublicApiItemController_getById', params, options),
@@ -1328,6 +1336,19 @@ export const operations = [
1328
1336
  queryParams: [],
1329
1337
  hasRequestBody: true,
1330
1338
  },
1339
+ {
1340
+ operationId: 'PublicApiJobController_createFromTemplate',
1341
+ resourcePath: ['jobs', 'template'],
1342
+ actionName: 'createFromTemplate',
1343
+ displayName: 'Create a new job from template',
1344
+ description:
1345
+ 'Create a job using a job template. Template-owned fields win over request values before final job validation.',
1346
+ method: 'POST',
1347
+ path: '/jobs/template/{templateId}',
1348
+ pathParams: ['templateId'],
1349
+ queryParams: [],
1350
+ hasRequestBody: true,
1351
+ },
1331
1352
  {
1332
1353
  operationId: 'PublicApiJobController_updateStatus',
1333
1354
  resourcePath: ['jobs', 'status'],
@@ -1817,7 +1838,7 @@ export const operations = [
1817
1838
  resourcePath: ['settings', 'items'],
1818
1839
  actionName: 'get',
1819
1840
  displayName: 'Get item',
1820
- description: 'Retrieve a settings item by ID.',
1841
+ description: 'Retrieve a settings item by ID, name, or integration ID.',
1821
1842
  method: 'GET',
1822
1843
  path: '/settings/items/{id}',
1823
1844
  pathParams: ['id'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workbuddy/sdk-js-vnext",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "WorkBuddy Public API JavaScript client",
5
5
  "license": "MIT",
6
6
  "type": "module",