@apideck/unify 0.23.0 → 0.23.1
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/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/models/components/note.d.ts +5 -0
- package/models/components/note.d.ts.map +1 -1
- package/models/components/note.js +4 -0
- package/models/components/note.js.map +1 -1
- package/models/components/noteinput.d.ts +5 -0
- package/models/components/noteinput.d.ts.map +1 -1
- package/models/components/noteinput.js +4 -0
- package/models/components/noteinput.js.map +1 -1
- package/package.json +5 -1
- package/src/__tests__/activities.test.ts +783 -0
- package/src/__tests__/agedcreditors.test.ts +279 -0
- package/src/__tests__/ageddebtors.test.ts +279 -0
- package/src/__tests__/apideckcompanies.test.ts +712 -0
- package/src/__tests__/apideckcustomers.test.ts +360 -0
- package/src/__tests__/apideckdepartments.test.ts +319 -0
- package/src/__tests__/apiresources.test.ts +61 -0
- package/src/__tests__/apis.test.ts +214 -0
- package/src/__tests__/applicants.test.ts +976 -0
- package/src/__tests__/applications.test.ts +329 -0
- package/src/__tests__/assertions.ts +13 -0
- package/src/__tests__/attachments.test.ts +363 -0
- package/src/__tests__/balancesheet.test.ts +451 -0
- package/src/__tests__/billpayments.test.ts +666 -0
- package/src/__tests__/bills.test.ts +1133 -0
- package/src/__tests__/collections.test.ts +115 -0
- package/src/__tests__/collectiontags.test.ts +66 -0
- package/src/__tests__/collectionticketcomments.test.ts +318 -0
- package/src/__tests__/collectiontickets.test.ts +436 -0
- package/src/__tests__/collectionusers.test.ts +122 -0
- package/src/__tests__/companies.test.ts +1059 -0
- package/src/__tests__/companyinfo.test.ts +218 -0
- package/src/__tests__/connectioncustommappings.test.ts +67 -0
- package/src/__tests__/connections.test.ts +1713 -0
- package/src/__tests__/connectionsettings.test.ts +280 -0
- package/src/__tests__/connectordocs.test.ts +28 -0
- package/src/__tests__/connectors.test.ts +751 -0
- package/src/__tests__/consumerrequestcounts.test.ts +41 -0
- package/src/__tests__/consumers.test.ts +517 -0
- package/src/__tests__/contacts.test.ts +957 -0
- package/src/__tests__/createcallback.test.ts +34 -0
- package/src/__tests__/creditnotes.test.ts +1362 -0
- package/src/__tests__/customers.test.ts +1089 -0
- package/src/__tests__/customfields.test.ts +50 -0
- package/src/__tests__/custommappings.test.ts +63 -0
- package/src/__tests__/departments.test.ts +359 -0
- package/src/__tests__/drivegroups.test.ts +318 -0
- package/src/__tests__/drives.test.ts +311 -0
- package/src/__tests__/employeepayrolls.test.ts +487 -0
- package/src/__tests__/employees.test.ts +1682 -0
- package/src/__tests__/employeeschedules.test.ts +456 -0
- package/src/__tests__/eventlogs.test.ts +157 -0
- package/src/__tests__/expenses.test.ts +566 -0
- package/src/__tests__/files.test.ts +392 -0
- package/src/__tests__/files.ts +56 -0
- package/src/__tests__/folders.test.ts +103 -0
- package/src/__tests__/invoiceitems.test.ts +586 -0
- package/src/__tests__/invoices.test.ts +1561 -0
- package/src/__tests__/jobs.test.ts +837 -0
- package/src/__tests__/journalentries.test.ts +1053 -0
- package/src/__tests__/leads.test.ts +897 -0
- package/src/__tests__/ledgeraccounts.test.ts +594 -0
- package/src/__tests__/locations.test.ts +561 -0
- package/src/__tests__/logs.test.ts +135 -0
- package/src/__tests__/messages.test.ts +396 -0
- package/src/__tests__/mockserver/README.md +52 -0
- package/src/__tests__/notes.test.ts +335 -0
- package/src/__tests__/opportunities.test.ts +503 -0
- package/src/__tests__/orders.test.ts +849 -0
- package/src/__tests__/payments.test.ts +557 -0
- package/src/__tests__/payrolls.test.ts +481 -0
- package/src/__tests__/pipelines.test.ts +383 -0
- package/src/__tests__/products.test.ts +505 -0
- package/src/__tests__/profitandloss.test.ts +221 -0
- package/src/__tests__/purchaseorders.test.ts +1464 -0
- package/src/__tests__/sessions.test.ts +70 -0
- package/src/__tests__/sharedlinks.test.ts +331 -0
- package/src/__tests__/stores.test.ts +39 -0
- package/src/__tests__/subsidiaries.test.ts +316 -0
- package/src/__tests__/suppliers.test.ts +1071 -0
- package/src/__tests__/taxrates.test.ts +472 -0
- package/src/__tests__/testclient.ts +48 -0
- package/src/__tests__/timeoffrequests.test.ts +381 -0
- package/src/__tests__/trackingcategories.test.ts +329 -0
- package/src/__tests__/uploadsessions.test.ts +142 -0
- package/src/__tests__/users.test.ts +667 -0
- package/src/__tests__/validateconnection.test.ts +32 -0
- package/src/__tests__/webhooks.test.ts +248 -0
- package/src/lib/config.ts +3 -3
- package/src/models/components/note.ts +9 -0
- package/src/models/components/noteinput.ts +9 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { assert, expect, it, test } from "vitest";
|
|
6
|
+
import { Apideck } from "../index.js";
|
|
7
|
+
import { createTestHTTPClient } from "./testclient.js";
|
|
8
|
+
|
|
9
|
+
test("Messages Sms Messages All", async () => {
|
|
10
|
+
const testHttpClient = createTestHTTPClient("sms.messagesAll");
|
|
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.sms.messages.list({
|
|
19
|
+
serviceId: "salesforce",
|
|
20
|
+
fields: "id,updated_at",
|
|
21
|
+
});
|
|
22
|
+
expect(result.httpMeta.response.status).toBe(200);
|
|
23
|
+
expect(result.getMessagesResponse).toBeDefined();
|
|
24
|
+
expect(result.getMessagesResponse).toEqual({
|
|
25
|
+
statusCode: 200,
|
|
26
|
+
status: "OK",
|
|
27
|
+
service: "twilio",
|
|
28
|
+
resource: "Messages",
|
|
29
|
+
operation: "all",
|
|
30
|
+
data: [
|
|
31
|
+
{
|
|
32
|
+
id: "12345",
|
|
33
|
+
from: "+15017122661",
|
|
34
|
+
to: "+15017122662",
|
|
35
|
+
subject: "Picture",
|
|
36
|
+
body: "Hi! How are you doing?",
|
|
37
|
+
type: "sms",
|
|
38
|
+
numberOfUnits: 1,
|
|
39
|
+
numberOfMediaFiles: 1,
|
|
40
|
+
direction: "outbound-api",
|
|
41
|
+
status: "sent",
|
|
42
|
+
scheduledAt: new Date("2020-09-30T07:43:32.000Z"),
|
|
43
|
+
sentAt: new Date("2020-09-30T07:43:32.000Z"),
|
|
44
|
+
webhookUrl:
|
|
45
|
+
"https://unify.apideck.com/webhook/webhooks/eyz329dkffdl4949/x/sms",
|
|
46
|
+
reference: "CUST001",
|
|
47
|
+
price: {
|
|
48
|
+
perUnit: "0.01",
|
|
49
|
+
totalAmount: "0.01",
|
|
50
|
+
currency: "USD",
|
|
51
|
+
},
|
|
52
|
+
error: {
|
|
53
|
+
code: "X1",
|
|
54
|
+
message: "Something went wrong",
|
|
55
|
+
},
|
|
56
|
+
messagingServiceId: "123456",
|
|
57
|
+
updatedBy: "12345",
|
|
58
|
+
createdBy: "12345",
|
|
59
|
+
updatedAt: new Date("2020-09-30T07:43:32.000Z"),
|
|
60
|
+
createdAt: new Date("2020-09-30T07:43:32.000Z"),
|
|
61
|
+
passThrough: [
|
|
62
|
+
{
|
|
63
|
+
serviceId: "<id>",
|
|
64
|
+
extendPaths: [
|
|
65
|
+
{
|
|
66
|
+
path: "$.nested.property",
|
|
67
|
+
value: {
|
|
68
|
+
"TaxClassificationRef": {
|
|
69
|
+
"value": "EUC-99990201-V1-00020000",
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
path: "$.nested.property",
|
|
75
|
+
value: {
|
|
76
|
+
"TaxClassificationRef": {
|
|
77
|
+
"value": "EUC-99990201-V1-00020000",
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
path: "$.nested.property",
|
|
83
|
+
value: {
|
|
84
|
+
"TaxClassificationRef": {
|
|
85
|
+
"value": "EUC-99990201-V1-00020000",
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
serviceId: "<id>",
|
|
93
|
+
extendPaths: [
|
|
94
|
+
{
|
|
95
|
+
path: "$.nested.property",
|
|
96
|
+
value: {
|
|
97
|
+
"TaxClassificationRef": {
|
|
98
|
+
"value": "EUC-99990201-V1-00020000",
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
id: "12345",
|
|
108
|
+
from: "+15017122661",
|
|
109
|
+
to: "+15017122662",
|
|
110
|
+
subject: "Picture",
|
|
111
|
+
body: "Hi! How are you doing?",
|
|
112
|
+
type: "sms",
|
|
113
|
+
numberOfUnits: 1,
|
|
114
|
+
numberOfMediaFiles: 1,
|
|
115
|
+
direction: "outbound-api",
|
|
116
|
+
status: "sent",
|
|
117
|
+
scheduledAt: new Date("2020-09-30T07:43:32.000Z"),
|
|
118
|
+
sentAt: new Date("2020-09-30T07:43:32.000Z"),
|
|
119
|
+
webhookUrl:
|
|
120
|
+
"https://unify.apideck.com/webhook/webhooks/eyz329dkffdl4949/x/sms",
|
|
121
|
+
reference: "CUST001",
|
|
122
|
+
price: {
|
|
123
|
+
perUnit: "0.01",
|
|
124
|
+
totalAmount: "0.01",
|
|
125
|
+
currency: "USD",
|
|
126
|
+
},
|
|
127
|
+
error: {
|
|
128
|
+
code: "X1",
|
|
129
|
+
message: "Something went wrong",
|
|
130
|
+
},
|
|
131
|
+
messagingServiceId: "123456",
|
|
132
|
+
updatedBy: "12345",
|
|
133
|
+
createdBy: "12345",
|
|
134
|
+
updatedAt: new Date("2020-09-30T07:43:32.000Z"),
|
|
135
|
+
createdAt: new Date("2020-09-30T07:43:32.000Z"),
|
|
136
|
+
passThrough: [
|
|
137
|
+
{
|
|
138
|
+
serviceId: "<id>",
|
|
139
|
+
extendPaths: [
|
|
140
|
+
{
|
|
141
|
+
path: "$.nested.property",
|
|
142
|
+
value: {
|
|
143
|
+
"TaxClassificationRef": {
|
|
144
|
+
"value": "EUC-99990201-V1-00020000",
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: "12345",
|
|
154
|
+
from: "+15017122661",
|
|
155
|
+
to: "+15017122662",
|
|
156
|
+
subject: "Picture",
|
|
157
|
+
body: "Hi! How are you doing?",
|
|
158
|
+
type: "sms",
|
|
159
|
+
numberOfUnits: 1,
|
|
160
|
+
numberOfMediaFiles: 1,
|
|
161
|
+
direction: "outbound-api",
|
|
162
|
+
status: "sent",
|
|
163
|
+
scheduledAt: new Date("2020-09-30T07:43:32.000Z"),
|
|
164
|
+
sentAt: new Date("2020-09-30T07:43:32.000Z"),
|
|
165
|
+
webhookUrl:
|
|
166
|
+
"https://unify.apideck.com/webhook/webhooks/eyz329dkffdl4949/x/sms",
|
|
167
|
+
reference: "CUST001",
|
|
168
|
+
price: {
|
|
169
|
+
perUnit: "0.01",
|
|
170
|
+
totalAmount: "0.01",
|
|
171
|
+
currency: "USD",
|
|
172
|
+
},
|
|
173
|
+
error: {
|
|
174
|
+
code: "X1",
|
|
175
|
+
message: "Something went wrong",
|
|
176
|
+
},
|
|
177
|
+
messagingServiceId: "123456",
|
|
178
|
+
updatedBy: "12345",
|
|
179
|
+
createdBy: "12345",
|
|
180
|
+
updatedAt: new Date("2020-09-30T07:43:32.000Z"),
|
|
181
|
+
createdAt: new Date("2020-09-30T07:43:32.000Z"),
|
|
182
|
+
passThrough: [
|
|
183
|
+
{
|
|
184
|
+
serviceId: "<id>",
|
|
185
|
+
extendPaths: [
|
|
186
|
+
{
|
|
187
|
+
path: "$.nested.property",
|
|
188
|
+
value: {
|
|
189
|
+
"TaxClassificationRef": {
|
|
190
|
+
"value": "EUC-99990201-V1-00020000",
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
path: "$.nested.property",
|
|
196
|
+
value: {
|
|
197
|
+
"TaxClassificationRef": {
|
|
198
|
+
"value": "EUC-99990201-V1-00020000",
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
serviceId: "<id>",
|
|
206
|
+
extendPaths: [
|
|
207
|
+
{
|
|
208
|
+
path: "$.nested.property",
|
|
209
|
+
value: {
|
|
210
|
+
"TaxClassificationRef": {
|
|
211
|
+
"value": "EUC-99990201-V1-00020000",
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
],
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
},
|
|
219
|
+
],
|
|
220
|
+
meta: {
|
|
221
|
+
itemsOnPage: 50,
|
|
222
|
+
cursors: {
|
|
223
|
+
previous: "em9oby1jcm06OnBhZ2U6OjE=",
|
|
224
|
+
current: "em9oby1jcm06OnBhZ2U6OjI=",
|
|
225
|
+
next: "em9oby1jcm06OnBhZ2U6OjM=",
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
links: {
|
|
229
|
+
previous:
|
|
230
|
+
"https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D",
|
|
231
|
+
current: "https://unify.apideck.com/crm/companies",
|
|
232
|
+
next:
|
|
233
|
+
"https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM",
|
|
234
|
+
},
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
it.skip("Messages Sms Messages Add", async () => {
|
|
239
|
+
assert.fail(
|
|
240
|
+
"incomplete test found please make sure to address the following errors: [`workflow step sms.messagesAdd.test referencing operation sms.messagesAdd with expression in requestBody with type not currently supported`, `workflow step sms.messagesAdd.test referencing operation sms.messagesAdd with expression in requestBody with type not currently supported`, `workflow step sms.messagesAdd.test referencing operation sms.messagesAdd with expression in requestBody with type not currently supported`, `workflow step sms.messagesAdd.test referencing operation sms.messagesAdd with expression in requestBody with type not currently supported`]",
|
|
241
|
+
);
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
test("Messages Sms Messages One", async () => {
|
|
245
|
+
const testHttpClient = createTestHTTPClient("sms.messagesOne");
|
|
246
|
+
|
|
247
|
+
const apideck = new Apideck({
|
|
248
|
+
serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
|
|
249
|
+
httpClient: testHttpClient,
|
|
250
|
+
apiKey: process.env["APIDECK_API_KEY"] ?? "value",
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
const result = await apideck.sms.messages.get({
|
|
254
|
+
id: "<id>",
|
|
255
|
+
serviceId: "salesforce",
|
|
256
|
+
fields: "id,updated_at",
|
|
257
|
+
});
|
|
258
|
+
expect(result.httpMeta.response.status).toBe(200);
|
|
259
|
+
expect(result.getMessageResponse).toBeDefined();
|
|
260
|
+
expect(result.getMessageResponse).toEqual({
|
|
261
|
+
statusCode: 200,
|
|
262
|
+
status: "OK",
|
|
263
|
+
service: "twilio",
|
|
264
|
+
resource: "Messages",
|
|
265
|
+
operation: "one",
|
|
266
|
+
data: {
|
|
267
|
+
id: "12345",
|
|
268
|
+
from: "+15017122661",
|
|
269
|
+
to: "+15017122662",
|
|
270
|
+
subject: "Picture",
|
|
271
|
+
body: "Hi! How are you doing?",
|
|
272
|
+
type: "sms",
|
|
273
|
+
numberOfUnits: 1,
|
|
274
|
+
numberOfMediaFiles: 1,
|
|
275
|
+
direction: "outbound-api",
|
|
276
|
+
status: "sent",
|
|
277
|
+
scheduledAt: new Date("2020-09-30T07:43:32.000Z"),
|
|
278
|
+
sentAt: new Date("2020-09-30T07:43:32.000Z"),
|
|
279
|
+
webhookUrl:
|
|
280
|
+
"https://unify.apideck.com/webhook/webhooks/eyz329dkffdl4949/x/sms",
|
|
281
|
+
reference: "CUST001",
|
|
282
|
+
price: {
|
|
283
|
+
perUnit: "0.01",
|
|
284
|
+
totalAmount: "0.01",
|
|
285
|
+
currency: "USD",
|
|
286
|
+
},
|
|
287
|
+
error: {
|
|
288
|
+
code: "X1",
|
|
289
|
+
message: "Something went wrong",
|
|
290
|
+
},
|
|
291
|
+
messagingServiceId: "123456",
|
|
292
|
+
updatedBy: "12345",
|
|
293
|
+
createdBy: "12345",
|
|
294
|
+
updatedAt: new Date("2020-09-30T07:43:32.000Z"),
|
|
295
|
+
createdAt: new Date("2020-09-30T07:43:32.000Z"),
|
|
296
|
+
passThrough: [
|
|
297
|
+
{
|
|
298
|
+
serviceId: "<id>",
|
|
299
|
+
extendPaths: [
|
|
300
|
+
{
|
|
301
|
+
path: "$.nested.property",
|
|
302
|
+
value: {
|
|
303
|
+
"TaxClassificationRef": {
|
|
304
|
+
"value": "EUC-99990201-V1-00020000",
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
path: "$.nested.property",
|
|
310
|
+
value: {
|
|
311
|
+
"TaxClassificationRef": {
|
|
312
|
+
"value": "EUC-99990201-V1-00020000",
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
],
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
serviceId: "<id>",
|
|
320
|
+
extendPaths: [
|
|
321
|
+
{
|
|
322
|
+
path: "$.nested.property",
|
|
323
|
+
value: {
|
|
324
|
+
"TaxClassificationRef": {
|
|
325
|
+
"value": "EUC-99990201-V1-00020000",
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
path: "$.nested.property",
|
|
331
|
+
value: {
|
|
332
|
+
"TaxClassificationRef": {
|
|
333
|
+
"value": "EUC-99990201-V1-00020000",
|
|
334
|
+
},
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
],
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
serviceId: "<id>",
|
|
341
|
+
extendPaths: [
|
|
342
|
+
{
|
|
343
|
+
path: "$.nested.property",
|
|
344
|
+
value: {
|
|
345
|
+
"TaxClassificationRef": {
|
|
346
|
+
"value": "EUC-99990201-V1-00020000",
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
path: "$.nested.property",
|
|
352
|
+
value: {
|
|
353
|
+
"TaxClassificationRef": {
|
|
354
|
+
"value": "EUC-99990201-V1-00020000",
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
],
|
|
359
|
+
},
|
|
360
|
+
],
|
|
361
|
+
},
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
it.skip("Messages Sms Messages Update", async () => {
|
|
366
|
+
assert.fail(
|
|
367
|
+
"incomplete test found please make sure to address the following errors: [`workflow step sms.messagesUpdate.test referencing operation sms.messagesUpdate with expression in requestBody with type not currently supported`, `workflow step sms.messagesUpdate.test referencing operation sms.messagesUpdate with expression in requestBody with type not currently supported`, `workflow step sms.messagesUpdate.test referencing operation sms.messagesUpdate with expression in requestBody with type not currently supported`, `workflow step sms.messagesUpdate.test referencing operation sms.messagesUpdate with expression in requestBody with type not currently supported`, `workflow step sms.messagesUpdate.test referencing operation sms.messagesUpdate with expression in requestBody with type not currently supported`, `workflow step sms.messagesUpdate.test referencing operation sms.messagesUpdate with expression in requestBody with type not currently supported`, `workflow step sms.messagesUpdate.test referencing operation sms.messagesUpdate with expression in requestBody with type not currently supported`]",
|
|
368
|
+
);
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
test("Messages Sms Messages Delete", async () => {
|
|
372
|
+
const testHttpClient = createTestHTTPClient("sms.messagesDelete");
|
|
373
|
+
|
|
374
|
+
const apideck = new Apideck({
|
|
375
|
+
serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
|
|
376
|
+
httpClient: testHttpClient,
|
|
377
|
+
apiKey: process.env["APIDECK_API_KEY"] ?? "value",
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
const result = await apideck.sms.messages.delete({
|
|
381
|
+
id: "<id>",
|
|
382
|
+
serviceId: "salesforce",
|
|
383
|
+
});
|
|
384
|
+
expect(result.httpMeta.response.status).toBe(200);
|
|
385
|
+
expect(result.deleteMessageResponse).toBeDefined();
|
|
386
|
+
expect(result.deleteMessageResponse).toEqual({
|
|
387
|
+
statusCode: 200,
|
|
388
|
+
status: "OK",
|
|
389
|
+
service: "twilio",
|
|
390
|
+
resource: "Messages",
|
|
391
|
+
operation: "delete",
|
|
392
|
+
data: {
|
|
393
|
+
id: "12345",
|
|
394
|
+
},
|
|
395
|
+
});
|
|
396
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Mock Server
|
|
2
|
+
|
|
3
|
+
A generated HTTP mock server based on your OpenAPI Specification (OAS). Use this mock server for integration and contract testing.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
The server can be built and started via the [Go programming language toolchain](https://go.dev/) or [Docker](https://www.docker.com/).
|
|
8
|
+
|
|
9
|
+
If you have Go installed, start the server directly via:
|
|
10
|
+
|
|
11
|
+
```shell
|
|
12
|
+
go run .
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Otherwise, if you have Docker installed, build and run the server via:
|
|
16
|
+
|
|
17
|
+
```shell
|
|
18
|
+
docker build -t mockserver .
|
|
19
|
+
docker run -i -p 18080:18080 -t --rm mockserver
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
By default, the server runs on port `18080`.
|
|
23
|
+
|
|
24
|
+
### Server Paths
|
|
25
|
+
|
|
26
|
+
The server contains generated paths from the OAS and the following additional built-in paths.
|
|
27
|
+
|
|
28
|
+
| Path | Description |
|
|
29
|
+
|---|---|
|
|
30
|
+
| [`/_mockserver/health`](https://localhost:18080/_mockserver/health) | verify server is running |
|
|
31
|
+
| [`/_mockserver/log`](https://localhost:18080/_mockserver/log) | view per-OAS-operation logs |
|
|
32
|
+
|
|
33
|
+
Any request outside the generated and built-in paths will return a `404 Not Found` response.
|
|
34
|
+
|
|
35
|
+
### Server Customization
|
|
36
|
+
|
|
37
|
+
The server supports the following flags for customization.
|
|
38
|
+
|
|
39
|
+
| Flag | Default | Description |
|
|
40
|
+
|---|---|---|
|
|
41
|
+
| `-address` | `:18080` | server listen address |
|
|
42
|
+
| `-log-format` | `text` | logging format (supported: `JSON`, `text`) |
|
|
43
|
+
| `-log-level` | `INFO` | logging level (supported: `DEBUG`, `INFO`, `WARN`, `ERROR`) |
|
|
44
|
+
|
|
45
|
+
For example, enabling server debug logging:
|
|
46
|
+
|
|
47
|
+
```shell
|
|
48
|
+
# via `go run`
|
|
49
|
+
go run . -log-level=DEBUG
|
|
50
|
+
# via `docker run`
|
|
51
|
+
docker run -i -p 18080:18080 -t --rm mockserver -log-level=DEBUG
|
|
52
|
+
```
|