@apideck/unify 0.40.0 → 0.41.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.
Files changed (96) hide show
  1. package/jsr.json +1 -1
  2. package/lib/config.d.ts +4 -4
  3. package/lib/config.js +4 -4
  4. package/package.json +6 -2
  5. package/src/__tests__/activities.test.ts +1141 -0
  6. package/src/__tests__/agedcreditors.test.ts +280 -0
  7. package/src/__tests__/ageddebtors.test.ts +280 -0
  8. package/src/__tests__/apideckcompanies.test.ts +1082 -0
  9. package/src/__tests__/apideckcustomers.test.ts +364 -0
  10. package/src/__tests__/apideckdepartments.test.ts +497 -0
  11. package/src/__tests__/apiresources.test.ts +62 -0
  12. package/src/__tests__/apis.test.ts +216 -0
  13. package/src/__tests__/applicants.test.ts +1445 -0
  14. package/src/__tests__/applications.test.ts +515 -0
  15. package/src/__tests__/assertions.ts +13 -0
  16. package/src/__tests__/attachments.test.ts +371 -0
  17. package/src/__tests__/balancesheet.test.ts +453 -0
  18. package/src/__tests__/bankaccounts.test.ts +324 -0
  19. package/src/__tests__/bankfeedaccounts.test.ts +343 -0
  20. package/src/__tests__/bankfeedstatements.test.ts +408 -0
  21. package/src/__tests__/billpayments.test.ts +1031 -0
  22. package/src/__tests__/bills.test.ts +1630 -0
  23. package/src/__tests__/categories.test.ts +127 -0
  24. package/src/__tests__/collections.test.ts +120 -0
  25. package/src/__tests__/collectiontags.test.ts +68 -0
  26. package/src/__tests__/collectionticketcomments.test.ts +501 -0
  27. package/src/__tests__/collectiontickets.test.ts +627 -0
  28. package/src/__tests__/collectionusers.test.ts +126 -0
  29. package/src/__tests__/companies.test.ts +1642 -0
  30. package/src/__tests__/companyinfo.test.ts +219 -0
  31. package/src/__tests__/connectionconsent.test.ts +89 -0
  32. package/src/__tests__/connectionconsents.test.ts +31 -0
  33. package/src/__tests__/connectioncustommappings.test.ts +69 -0
  34. package/src/__tests__/connections.test.ts +2127 -0
  35. package/src/__tests__/connectionsettings.test.ts +687 -0
  36. package/src/__tests__/connectordocs.test.ts +29 -0
  37. package/src/__tests__/connectors.test.ts +753 -0
  38. package/src/__tests__/consumerrequestcounts.test.ts +42 -0
  39. package/src/__tests__/consumers.test.ts +523 -0
  40. package/src/__tests__/contacts.test.ts +1421 -0
  41. package/src/__tests__/createcallback.test.ts +36 -0
  42. package/src/__tests__/creditnotes.test.ts +2040 -0
  43. package/src/__tests__/customers.test.ts +1600 -0
  44. package/src/__tests__/customfields.test.ts +52 -0
  45. package/src/__tests__/custommappings.test.ts +65 -0
  46. package/src/__tests__/customobjects.test.ts +408 -0
  47. package/src/__tests__/customobjectschemas.test.ts +734 -0
  48. package/src/__tests__/departments.test.ts +529 -0
  49. package/src/__tests__/drivegroups.test.ts +496 -0
  50. package/src/__tests__/drives.test.ts +487 -0
  51. package/src/__tests__/employeepayrolls.test.ts +491 -0
  52. package/src/__tests__/employees.test.ts +2968 -0
  53. package/src/__tests__/employeeschedules.test.ts +457 -0
  54. package/src/__tests__/eventlogs.test.ts +158 -0
  55. package/src/__tests__/expensecategories.test.ts +324 -0
  56. package/src/__tests__/expensereports.test.ts +634 -0
  57. package/src/__tests__/expenses.test.ts +867 -0
  58. package/src/__tests__/files.test.ts +506 -0
  59. package/src/__tests__/files.ts +56 -0
  60. package/src/__tests__/folders.test.ts +390 -0
  61. package/src/__tests__/invoiceitems.test.ts +855 -0
  62. package/src/__tests__/invoices.test.ts +2173 -0
  63. package/src/__tests__/jobs.test.ts +1150 -0
  64. package/src/__tests__/journalentries.test.ts +1542 -0
  65. package/src/__tests__/leads.test.ts +1341 -0
  66. package/src/__tests__/ledgeraccounts.test.ts +829 -0
  67. package/src/__tests__/locations.test.ts +856 -0
  68. package/src/__tests__/logs.test.ts +137 -0
  69. package/src/__tests__/messages.test.ts +588 -0
  70. package/src/__tests__/notes.test.ts +523 -0
  71. package/src/__tests__/opportunities.test.ts +718 -0
  72. package/src/__tests__/orders.test.ts +854 -0
  73. package/src/__tests__/payments.test.ts +867 -0
  74. package/src/__tests__/payrolls.test.ts +485 -0
  75. package/src/__tests__/pipelines.test.ts +574 -0
  76. package/src/__tests__/products.test.ts +509 -0
  77. package/src/__tests__/profitandloss.test.ts +223 -0
  78. package/src/__tests__/projects.test.ts +480 -0
  79. package/src/__tests__/proxy.test.ts +41 -0
  80. package/src/__tests__/purchaseorders.test.ts +2139 -0
  81. package/src/__tests__/quotes.test.ts +678 -0
  82. package/src/__tests__/refunds.test.ts +812 -0
  83. package/src/__tests__/sessions.test.ts +72 -0
  84. package/src/__tests__/sharedlinks.test.ts +511 -0
  85. package/src/__tests__/stores.test.ts +41 -0
  86. package/src/__tests__/subsidiaries.test.ts +496 -0
  87. package/src/__tests__/suppliers.test.ts +1574 -0
  88. package/src/__tests__/taxrates.test.ts +701 -0
  89. package/src/__tests__/testclient.ts +48 -0
  90. package/src/__tests__/timeoffrequests.test.ts +588 -0
  91. package/src/__tests__/trackingcategories.test.ts +515 -0
  92. package/src/__tests__/uploadsessions.test.ts +221 -0
  93. package/src/__tests__/users.test.ts +1020 -0
  94. package/src/__tests__/validateconnection.test.ts +34 -0
  95. package/src/__tests__/webhooks.test.ts +254 -0
  96. package/src/lib/config.ts +4 -4
@@ -0,0 +1,223 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { expect, test } from "vitest";
6
+ import { Apideck } from "../index.js";
7
+ import { createTestHTTPClient } from "./testclient.js";
8
+
9
+ test("Profitandloss Accounting Profit And Loss One", async () => {
10
+ const testHttpClient = createTestHTTPClient("accounting.profitAndLossOne");
11
+
12
+ const apideck = new Apideck({
13
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
14
+ httpClient: testHttpClient,
15
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
16
+ });
17
+
18
+ const result = await apideck.accounting.profitAndLoss.get({
19
+ consumerId: "test-consumer",
20
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
21
+ serviceId: "salesforce",
22
+ filter: {
23
+ customerId: "123abc",
24
+ startDate: "2021-01-01",
25
+ endDate: "2021-12-31",
26
+ },
27
+ passThrough: {
28
+ "search": "San Francisco",
29
+ },
30
+ fields: "id,updated_at",
31
+ });
32
+ expect(result.httpMeta.response.status).toBe(200);
33
+ expect(result.getProfitAndLossResponse).toBeDefined();
34
+ expect(result.getProfitAndLossResponse).toEqual({
35
+ statusCode: 200,
36
+ status: "OK",
37
+ service: "quickbooks",
38
+ resource: "ProfitAndLosses",
39
+ operation: "one",
40
+ data: {
41
+ id: "12345",
42
+ reportName: "ProfitAndLoss",
43
+ startDate: "2017-01-01",
44
+ endDate: "2017-01-31",
45
+ currency: "USD",
46
+ income: {
47
+ id: "123",
48
+ code: "123",
49
+ title: "Operating Income",
50
+ type: "Section",
51
+ total: 60000,
52
+ records: [
53
+ {
54
+ "id": "137",
55
+ "title": "Sales of products",
56
+ "code": "137",
57
+ "type": "Section",
58
+ "total": 20000,
59
+ "records": [
60
+ {
61
+ "id": "13701",
62
+ "title": "Sales of products",
63
+ "code": "13701",
64
+ "type": "Record",
65
+ "total": 20000,
66
+ },
67
+ ],
68
+ },
69
+ {
70
+ "id": "138",
71
+ "title": "Sales of services",
72
+ "code": "138",
73
+ "type": "Section",
74
+ "total": 40000,
75
+ "records": [
76
+ {
77
+ "id": "789",
78
+ "code": "789",
79
+ "title": "Sales of External Services",
80
+ "type": "Record",
81
+ "total": 10000,
82
+ },
83
+ {
84
+ "id": "101",
85
+ "code": "101",
86
+ "title": "Sales of Internal Services",
87
+ "type": "Record",
88
+ "total": 30000,
89
+ },
90
+ ],
91
+ },
92
+ ],
93
+ },
94
+ costOfGoodsSold: {
95
+ id: "123",
96
+ code: "123",
97
+ title: "Cost of Goods Sold",
98
+ type: "Section",
99
+ total: 12000,
100
+ records: [
101
+ {
102
+ "id": "123",
103
+ "code": "123",
104
+ "title": "COGS Sales",
105
+ "type": "Record",
106
+ "total": 12000,
107
+ },
108
+ ],
109
+ },
110
+ expenses: {
111
+ id: "123",
112
+ code: "123",
113
+ title: "Operating Expenses",
114
+ type: "Section",
115
+ total: 14000,
116
+ records: [
117
+ {
118
+ "id": "137",
119
+ "title": "Maintenance",
120
+ "code": "137",
121
+ "type": "Record",
122
+ "total": 1000,
123
+ },
124
+ {
125
+ "id": "138",
126
+ "title": "Rent",
127
+ "code": "138",
128
+ "type": "Record",
129
+ "total": 10000,
130
+ },
131
+ {
132
+ "id": "789",
133
+ "code": "789",
134
+ "title": "Utilities",
135
+ "type": "Section",
136
+ "total": 3000,
137
+ "records": [
138
+ {
139
+ "id": "101",
140
+ "code": "101",
141
+ "title": "Electricity",
142
+ "type": "Record",
143
+ "total": 2000,
144
+ },
145
+ {
146
+ "id": "102",
147
+ "code": "102",
148
+ "title": "Telephone",
149
+ "type": "Record",
150
+ "total": 1000,
151
+ },
152
+ ],
153
+ },
154
+ ],
155
+ },
156
+ otherIncome: {
157
+ id: "123",
158
+ code: "123",
159
+ title: "Other Income",
160
+ type: "Section",
161
+ total: 3000,
162
+ records: [
163
+ {
164
+ "id": "123",
165
+ "code": "123",
166
+ "title": "Interest Income",
167
+ "type": "Record",
168
+ "total": 2000,
169
+ },
170
+ {
171
+ "id": "123",
172
+ "code": "123",
173
+ "title": "Foreign Exchange Gain",
174
+ "type": "Record",
175
+ "total": 1000,
176
+ },
177
+ ],
178
+ },
179
+ otherExpenses: {
180
+ id: "123",
181
+ code: "123",
182
+ title: "Other Expenses",
183
+ type: "Section",
184
+ total: 1000,
185
+ records: [
186
+ {
187
+ "id": "123",
188
+ "code": "123",
189
+ "title": "Unrealized Gain/Loss",
190
+ "type": "Record",
191
+ "total": 1000,
192
+ },
193
+ ],
194
+ },
195
+ uncategorizedAccounts: {
196
+ id: "123",
197
+ code: "123",
198
+ title: "Uncategorized Accounts",
199
+ type: "Section",
200
+ total: 0,
201
+ records: [
202
+ {
203
+ "id": "123",
204
+ "code": "123",
205
+ "title": "Elimination Adjustments",
206
+ "type": "Record",
207
+ "total": 0,
208
+ },
209
+ ],
210
+ },
211
+ grossProfit: {
212
+ total: 10000,
213
+ },
214
+ netOperatingIncome: {
215
+ total: 10000,
216
+ },
217
+ netIncome: {
218
+ total: 10000,
219
+ },
220
+ customer: "123",
221
+ },
222
+ });
223
+ });
@@ -0,0 +1,480 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { expect, test } from "vitest";
6
+ import { Apideck } from "../index.js";
7
+ import { createTestHTTPClient } from "./testclient.js";
8
+
9
+ test("Projects Accounting Projects All", async () => {
10
+ const testHttpClient = createTestHTTPClient("accounting.projectsAll");
11
+
12
+ const apideck = new Apideck({
13
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
14
+ httpClient: testHttpClient,
15
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
16
+ });
17
+
18
+ const result = await apideck.accounting.projects.list({
19
+ consumerId: "test-consumer",
20
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
21
+ serviceId: "salesforce",
22
+ companyId: "12345",
23
+ filter: {
24
+ name: "Website Redesign",
25
+ status: "active",
26
+ customerId: "12345",
27
+ updatedSince: new Date("2020-09-30T07:43:32.000Z"),
28
+ },
29
+ sort: {
30
+ by: "name",
31
+ },
32
+ passThrough: {
33
+ "search": "San Francisco",
34
+ },
35
+ fields: "id,updated_at",
36
+ });
37
+ expect(result.httpMeta.response.status).toBe(200);
38
+ expect(result.getProjectsResponse).toBeDefined();
39
+ expect(result.getProjectsResponse).toEqual({
40
+ statusCode: 200,
41
+ status: "OK",
42
+ service: "quickbooks",
43
+ resource: "Projects",
44
+ operation: "all",
45
+ data: [],
46
+ meta: {
47
+ itemsOnPage: 50,
48
+ cursors: {
49
+ previous: "em9oby1jcm06OnBhZ2U6OjE=",
50
+ current: "em9oby1jcm06OnBhZ2U6OjI=",
51
+ next: "em9oby1jcm06OnBhZ2U6OjM=",
52
+ },
53
+ },
54
+ links: {
55
+ previous:
56
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D",
57
+ current: "https://unify.apideck.com/crm/companies",
58
+ next:
59
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM",
60
+ },
61
+ });
62
+ });
63
+
64
+ test("Projects Accounting Projects Add", async () => {
65
+ const testHttpClient = createTestHTTPClient("accounting.projectsAdd");
66
+
67
+ const apideck = new Apideck({
68
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
69
+ httpClient: testHttpClient,
70
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
71
+ });
72
+
73
+ const result = await apideck.accounting.projects.create({
74
+ consumerId: "test-consumer",
75
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
76
+ serviceId: "salesforce",
77
+ companyId: "12345",
78
+ project: {
79
+ name: "Website Redesign Project",
80
+ displayId: "PROJ-001",
81
+ referenceId: "WD-REF-2024-001",
82
+ description:
83
+ "Complete redesign of the company website including new branding and improved user experience",
84
+ status: "active",
85
+ active: true,
86
+ projectType: "client_project",
87
+ priority: "high",
88
+ completionPercentage: 75.5,
89
+ startDate: new Date("2024-01-15"),
90
+ endDate: new Date("2024-06-30"),
91
+ completionDate: new Date("2024-08-06"),
92
+ customer: {
93
+ id: "12345",
94
+ displayName: "Windsurf Shop",
95
+ email: "boring@boring.com",
96
+ },
97
+ department: {
98
+ id: "DEPT-001",
99
+ name: "Marketing",
100
+ },
101
+ companyId: "12345",
102
+ ownerId: "12345",
103
+ parentProject: {
104
+ id: "PROJ-PARENT-001",
105
+ name: "Company Website Overhaul",
106
+ },
107
+ currency: "USD",
108
+ budgetAmount: 50000,
109
+ approvedAmount: 48000,
110
+ budgetHours: 400,
111
+ hourlyRate: 125,
112
+ billingMethod: "time_and_materials",
113
+ phase: "execution",
114
+ taxRate: {
115
+ id: "123456",
116
+ code: "N-T",
117
+ rate: 10,
118
+ },
119
+ trackingCategories: [
120
+ {
121
+ id: "123456",
122
+ name: "New York",
123
+ parentId: "123456",
124
+ parentName: "New York",
125
+ },
126
+ ],
127
+ tags: [
128
+ "website",
129
+ "redesign",
130
+ "urgent",
131
+ ],
132
+ notes: "Client has requested modern design with mobile-first approach",
133
+ contractNumber: "CNT-2024-001",
134
+ profitMargin: 15.5,
135
+ scheduleStatus: "on_schedule",
136
+ addresses: [
137
+ {
138
+ id: "123",
139
+ type: "primary",
140
+ string: "25 Spring Street, Blackburn, VIC 3130",
141
+ name: "HQ US",
142
+ line1: "Main street",
143
+ line2: "apt #",
144
+ line3: "Suite #",
145
+ line4: "delivery instructions",
146
+ line5: "Attention: Finance Dept",
147
+ streetNumber: "25",
148
+ city: "San Francisco",
149
+ state: "CA",
150
+ postalCode: "94104",
151
+ country: "US",
152
+ latitude: "40.759211",
153
+ longitude: "-73.984638",
154
+ county: "Santa Clara",
155
+ contactName: "Elon Musk",
156
+ salutation: "Mr",
157
+ phoneNumber: "111-111-1111",
158
+ fax: "122-111-1111",
159
+ email: "elon@musk.com",
160
+ website: "https://elonmusk.com",
161
+ notes: "Address notes or delivery instructions.",
162
+ rowVersion: "1-12345",
163
+ },
164
+ ],
165
+ teamSize: 8,
166
+ customFields: [
167
+ {
168
+ id: "2389328923893298",
169
+ name: "employee_level",
170
+ description: "Employee Level",
171
+ value: "Uses Salesforce and Marketo",
172
+ },
173
+ ],
174
+ rowVersion: "1-12345",
175
+ },
176
+ });
177
+ expect(result.httpMeta.response.status).toBe(201);
178
+ expect(result.createProjectResponse).toBeDefined();
179
+ expect(result.createProjectResponse).toEqual({
180
+ statusCode: 200,
181
+ status: "OK",
182
+ service: "quickbooks",
183
+ resource: "Projects",
184
+ operation: "add",
185
+ data: {
186
+ id: "12345",
187
+ },
188
+ });
189
+ });
190
+
191
+ test("Projects Accounting Projects One", async () => {
192
+ const testHttpClient = createTestHTTPClient("accounting.projectsOne");
193
+
194
+ const apideck = new Apideck({
195
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
196
+ httpClient: testHttpClient,
197
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
198
+ });
199
+
200
+ const result = await apideck.accounting.projects.get({
201
+ id: "<id>",
202
+ consumerId: "test-consumer",
203
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
204
+ serviceId: "salesforce",
205
+ companyId: "12345",
206
+ });
207
+ expect(result.httpMeta.response.status).toBe(200);
208
+ expect(result.getProjectResponse).toBeDefined();
209
+ expect(result.getProjectResponse).toEqual({
210
+ statusCode: 200,
211
+ status: "OK",
212
+ service: "quickbooks",
213
+ resource: "Projects",
214
+ operation: "one",
215
+ data: {
216
+ id: "12345",
217
+ downstreamId: "12345",
218
+ name: "Website Redesign Project",
219
+ displayId: "PROJ-001",
220
+ referenceId: "WD-REF-2024-001",
221
+ description:
222
+ "Complete redesign of the company website including new branding and improved user experience",
223
+ status: "active",
224
+ active: true,
225
+ projectType: "client_project",
226
+ priority: "high",
227
+ completionPercentage: 75.5,
228
+ startDate: new Date("2024-01-15"),
229
+ endDate: new Date("2024-06-30"),
230
+ completionDate: new Date("2024-08-06"),
231
+ customer: {
232
+ id: "12345",
233
+ displayId: "CUST00101",
234
+ displayName: "Windsurf Shop",
235
+ companyName: "The boring company",
236
+ email: "boring@boring.com",
237
+ },
238
+ department: {
239
+ id: "DEPT-001",
240
+ name: "Marketing",
241
+ },
242
+ companyId: "12345",
243
+ ownerId: "12345",
244
+ parentProject: {
245
+ id: "PROJ-PARENT-001",
246
+ name: "Company Website Overhaul",
247
+ },
248
+ currency: "USD",
249
+ budgetAmount: 50000,
250
+ approvedAmount: 48000,
251
+ actualAmount: 45250.75,
252
+ budgetHours: 400,
253
+ actualHours: 385.5,
254
+ hourlyRate: 125,
255
+ billingMethod: "time_and_materials",
256
+ isBillable: true,
257
+ phase: "execution",
258
+ taxRate: {
259
+ id: "123456",
260
+ code: "N-T",
261
+ name: "GST on Purchases",
262
+ rate: 10,
263
+ },
264
+ trackingCategories: [
265
+ {
266
+ id: "123456",
267
+ name: "New York",
268
+ parentId: "123456",
269
+ parentName: "New York",
270
+ },
271
+ ],
272
+ tags: [
273
+ "website",
274
+ "redesign",
275
+ "urgent",
276
+ ],
277
+ notes: "Client has requested modern design with mobile-first approach",
278
+ contractNumber: "CNT-2024-001",
279
+ profitMargin: 15.5,
280
+ scheduleStatus: "on_schedule",
281
+ addresses: [
282
+ {
283
+ id: "123",
284
+ type: "primary",
285
+ string: "25 Spring Street, Blackburn, VIC 3130",
286
+ name: "HQ US",
287
+ line1: "Main street",
288
+ line2: "apt #",
289
+ line3: "Suite #",
290
+ line4: "delivery instructions",
291
+ line5: "Attention: Finance Dept",
292
+ streetNumber: "25",
293
+ city: "San Francisco",
294
+ state: "CA",
295
+ postalCode: "94104",
296
+ country: "US",
297
+ latitude: "40.759211",
298
+ longitude: "-73.984638",
299
+ county: "Santa Clara",
300
+ contactName: "Elon Musk",
301
+ salutation: "Mr",
302
+ phoneNumber: "111-111-1111",
303
+ fax: "122-111-1111",
304
+ email: "elon@musk.com",
305
+ website: "https://elonmusk.com",
306
+ notes: "Address notes or delivery instructions.",
307
+ rowVersion: "1-12345",
308
+ },
309
+ ],
310
+ teamSize: 8,
311
+ customFields: [
312
+ {
313
+ id: "2389328923893298",
314
+ name: "employee_level",
315
+ description: "Employee Level",
316
+ value: "Uses Salesforce and Marketo",
317
+ },
318
+ ],
319
+ rowVersion: "1-12345",
320
+ updatedBy: "12345",
321
+ createdBy: "12345",
322
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
323
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
324
+ },
325
+ });
326
+ });
327
+
328
+ test("Projects Accounting Projects Update", async () => {
329
+ const testHttpClient = createTestHTTPClient("accounting.projectsUpdate");
330
+
331
+ const apideck = new Apideck({
332
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
333
+ httpClient: testHttpClient,
334
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
335
+ });
336
+
337
+ const result = await apideck.accounting.projects.update({
338
+ id: "<id>",
339
+ consumerId: "test-consumer",
340
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
341
+ serviceId: "salesforce",
342
+ companyId: "12345",
343
+ project: {
344
+ name: "Website Redesign Project",
345
+ displayId: "PROJ-001",
346
+ referenceId: "WD-REF-2024-001",
347
+ description:
348
+ "Complete redesign of the company website including new branding and improved user experience",
349
+ status: "active",
350
+ active: true,
351
+ projectType: "client_project",
352
+ priority: "high",
353
+ completionPercentage: 75.5,
354
+ startDate: new Date("2024-01-15"),
355
+ endDate: new Date("2024-06-30"),
356
+ completionDate: new Date("2024-08-06"),
357
+ customer: null,
358
+ department: {
359
+ id: "DEPT-001",
360
+ name: "Marketing",
361
+ },
362
+ companyId: "12345",
363
+ ownerId: "12345",
364
+ parentProject: {
365
+ id: "PROJ-PARENT-001",
366
+ name: "Company Website Overhaul",
367
+ },
368
+ currency: "USD",
369
+ budgetAmount: 50000,
370
+ approvedAmount: 48000,
371
+ budgetHours: 400,
372
+ hourlyRate: 125,
373
+ billingMethod: "time_and_materials",
374
+ phase: "execution",
375
+ taxRate: {
376
+ id: "123456",
377
+ code: "N-T",
378
+ rate: 10,
379
+ },
380
+ trackingCategories: [
381
+ {
382
+ id: "123456",
383
+ name: "New York",
384
+ parentId: "123456",
385
+ parentName: "New York",
386
+ },
387
+ ],
388
+ tags: [
389
+ "website",
390
+ "redesign",
391
+ "urgent",
392
+ ],
393
+ notes: "Client has requested modern design with mobile-first approach",
394
+ contractNumber: "CNT-2024-001",
395
+ profitMargin: 15.5,
396
+ scheduleStatus: "on_schedule",
397
+ addresses: [
398
+ {
399
+ id: "123",
400
+ type: "primary",
401
+ string: "25 Spring Street, Blackburn, VIC 3130",
402
+ name: "HQ US",
403
+ line1: "Main street",
404
+ line2: "apt #",
405
+ line3: "Suite #",
406
+ line4: "delivery instructions",
407
+ line5: "Attention: Finance Dept",
408
+ streetNumber: "25",
409
+ city: "San Francisco",
410
+ state: "CA",
411
+ postalCode: "94104",
412
+ country: "US",
413
+ latitude: "40.759211",
414
+ longitude: "-73.984638",
415
+ county: "Santa Clara",
416
+ contactName: "Elon Musk",
417
+ salutation: "Mr",
418
+ phoneNumber: "111-111-1111",
419
+ fax: "122-111-1111",
420
+ email: "elon@musk.com",
421
+ website: "https://elonmusk.com",
422
+ notes: "Address notes or delivery instructions.",
423
+ rowVersion: "1-12345",
424
+ },
425
+ ],
426
+ teamSize: 8,
427
+ customFields: [
428
+ {
429
+ id: "2389328923893298",
430
+ name: "employee_level",
431
+ description: "Employee Level",
432
+ value: "Uses Salesforce and Marketo",
433
+ },
434
+ ],
435
+ rowVersion: "1-12345",
436
+ },
437
+ });
438
+ expect(result.httpMeta.response.status).toBe(200);
439
+ expect(result.updateProjectResponse).toBeDefined();
440
+ expect(result.updateProjectResponse).toEqual({
441
+ statusCode: 200,
442
+ status: "OK",
443
+ service: "quickbooks",
444
+ resource: "Projects",
445
+ operation: "update",
446
+ data: {
447
+ id: "12345",
448
+ },
449
+ });
450
+ });
451
+
452
+ test("Projects Accounting Projects Delete", async () => {
453
+ const testHttpClient = createTestHTTPClient("accounting.projectsDelete");
454
+
455
+ const apideck = new Apideck({
456
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
457
+ httpClient: testHttpClient,
458
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
459
+ });
460
+
461
+ const result = await apideck.accounting.projects.delete({
462
+ id: "<id>",
463
+ consumerId: "test-consumer",
464
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
465
+ serviceId: "salesforce",
466
+ companyId: "12345",
467
+ });
468
+ expect(result.httpMeta.response.status).toBe(200);
469
+ expect(result.deleteProjectResponse).toBeDefined();
470
+ expect(result.deleteProjectResponse).toEqual({
471
+ statusCode: 200,
472
+ status: "OK",
473
+ service: "quickbooks",
474
+ resource: "Projects",
475
+ operation: "delete",
476
+ data: {
477
+ id: "12345",
478
+ },
479
+ });
480
+ });