@realforce-software/api-client 0.0.11

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.
@@ -0,0 +1,3072 @@
1
+ "use strict";
2
+ //----------------------
3
+ // <auto-generated>
4
+ // Generated using the NSwag toolchain v14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
5
+ // </auto-generated>
6
+ //----------------------
7
+ var __importDefault = (this && this.__importDefault) || function (mod) {
8
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.ApiException = exports.UserRole = exports.TriggerSubjectType = exports.SubjectType = exports.SortDirection = exports.PublishingMode = exports.PropertyStatus = exports.PropertyFilterStatus = exports.PaidBy = exports.MarketingOpportunitySubjectType = exports.MagicLinkType = exports.LeadSubjectType = exports.LeadSource = exports.EventTimeType = exports.CampaignUrlType = exports.CampaignType = exports.CampaignStatus = exports.AssetSubjectType = exports.AssetFileType = exports.RealforceApiClient = void 0;
12
+ /* tslint:disable */
13
+ /* eslint-disable */
14
+ // ReSharper disable InconsistentNaming
15
+ const axios_1 = __importDefault(require("axios"));
16
+ class RealforceApiClient {
17
+ constructor(baseUrl, instance) {
18
+ this.jsonParseReviver = undefined;
19
+ this.instance = instance || axios_1.default.create();
20
+ this.baseUrl = baseUrl ?? "";
21
+ }
22
+ /**
23
+ * Get a specific agent by ID.
24
+ * @param agentId The agent's Realforce ID.
25
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
26
+ * @return The agent object.
27
+ */
28
+ getAgent(agentId, x_Workspace_ID, cancelToken) {
29
+ let url_ = this.baseUrl + "/v1/agents/{agentId}";
30
+ if (agentId === undefined || agentId === null)
31
+ throw new Error("The parameter 'agentId' must be defined.");
32
+ url_ = url_.replace("{agentId}", encodeURIComponent("" + agentId));
33
+ url_ = url_.replace(/[?&]$/, "");
34
+ let options_ = {
35
+ method: "GET",
36
+ url: url_,
37
+ headers: {
38
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
39
+ "Accept": "application/json"
40
+ },
41
+ cancelToken
42
+ };
43
+ return this.instance.request(options_).catch((_error) => {
44
+ if (isAxiosError(_error) && _error.response) {
45
+ return _error.response;
46
+ }
47
+ else {
48
+ throw _error;
49
+ }
50
+ }).then((_response) => {
51
+ return this.processGetAgent(_response);
52
+ });
53
+ }
54
+ processGetAgent(response) {
55
+ const status = response.status;
56
+ let _headers = {};
57
+ if (response.headers && typeof response.headers === "object") {
58
+ for (const k in response.headers) {
59
+ if (response.headers.hasOwnProperty(k)) {
60
+ _headers[k] = response.headers[k];
61
+ }
62
+ }
63
+ }
64
+ if (status === 200) {
65
+ const _responseText = response.data;
66
+ let result200 = null;
67
+ let resultData200 = _responseText;
68
+ result200 = JSON.parse(resultData200);
69
+ return Promise.resolve(result200);
70
+ }
71
+ else if (status === 401) {
72
+ const _responseText = response.data;
73
+ let result401 = null;
74
+ let resultData401 = _responseText;
75
+ result401 = JSON.parse(resultData401);
76
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
77
+ }
78
+ else if (status === 404) {
79
+ const _responseText = response.data;
80
+ let result404 = null;
81
+ let resultData404 = _responseText;
82
+ result404 = JSON.parse(resultData404);
83
+ return throwException("Agent not found.", status, _responseText, _headers, result404);
84
+ }
85
+ else if (status !== 200 && status !== 204) {
86
+ const _responseText = response.data;
87
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
88
+ }
89
+ return Promise.resolve(null);
90
+ }
91
+ /**
92
+ * Update an agent.
93
+ * @param agentId The agent's Realforce ID.
94
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
95
+ * @param body (optional) The agent fields to update. Only fields included in the body are changed.
96
+ * @return Agent updated.
97
+ */
98
+ putAgent(agentId, x_Workspace_ID, body, cancelToken) {
99
+ let url_ = this.baseUrl + "/v1/agents/{agentId}";
100
+ if (agentId === undefined || agentId === null)
101
+ throw new Error("The parameter 'agentId' must be defined.");
102
+ url_ = url_.replace("{agentId}", encodeURIComponent("" + agentId));
103
+ url_ = url_.replace(/[?&]$/, "");
104
+ const content_ = JSON.stringify(body);
105
+ let options_ = {
106
+ data: content_,
107
+ method: "PUT",
108
+ url: url_,
109
+ headers: {
110
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
111
+ "Content-Type": "application/json",
112
+ "Accept": "application/json"
113
+ },
114
+ cancelToken
115
+ };
116
+ return this.instance.request(options_).catch((_error) => {
117
+ if (isAxiosError(_error) && _error.response) {
118
+ return _error.response;
119
+ }
120
+ else {
121
+ throw _error;
122
+ }
123
+ }).then((_response) => {
124
+ return this.processPutAgent(_response);
125
+ });
126
+ }
127
+ processPutAgent(response) {
128
+ const status = response.status;
129
+ let _headers = {};
130
+ if (response.headers && typeof response.headers === "object") {
131
+ for (const k in response.headers) {
132
+ if (response.headers.hasOwnProperty(k)) {
133
+ _headers[k] = response.headers[k];
134
+ }
135
+ }
136
+ }
137
+ if (status === 200) {
138
+ const _responseText = response.data;
139
+ let result200 = null;
140
+ let resultData200 = _responseText;
141
+ result200 = JSON.parse(resultData200);
142
+ return Promise.resolve(result200);
143
+ }
144
+ else if (status === 400) {
145
+ const _responseText = response.data;
146
+ let result400 = null;
147
+ let resultData400 = _responseText;
148
+ result400 = JSON.parse(resultData400);
149
+ return throwException("Invalid coordinates, or office could not be inferred.", status, _responseText, _headers, result400);
150
+ }
151
+ else if (status === 401) {
152
+ const _responseText = response.data;
153
+ let result401 = null;
154
+ let resultData401 = _responseText;
155
+ result401 = JSON.parse(resultData401);
156
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
157
+ }
158
+ else if (status === 404) {
159
+ const _responseText = response.data;
160
+ let result404 = null;
161
+ let resultData404 = _responseText;
162
+ result404 = JSON.parse(resultData404);
163
+ return throwException("Agent not found.", status, _responseText, _headers, result404);
164
+ }
165
+ else if (status === 500) {
166
+ const _responseText = response.data;
167
+ let result500 = null;
168
+ let resultData500 = _responseText;
169
+ result500 = JSON.parse(resultData500);
170
+ return throwException("Failed to update the agent.", status, _responseText, _headers, result500);
171
+ }
172
+ else if (status !== 200 && status !== 204) {
173
+ const _responseText = response.data;
174
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
175
+ }
176
+ return Promise.resolve(null);
177
+ }
178
+ /**
179
+ * Returns a list of agents.
180
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
181
+ * @param body (optional) Filter and pagination options.
182
+ * @return Paginated list of agents.
183
+ */
184
+ queryAgents(x_Workspace_ID, body, cancelToken) {
185
+ let url_ = this.baseUrl + "/v1/agents/query";
186
+ url_ = url_.replace(/[?&]$/, "");
187
+ const content_ = JSON.stringify(body);
188
+ let options_ = {
189
+ data: content_,
190
+ method: "POST",
191
+ url: url_,
192
+ headers: {
193
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
194
+ "Content-Type": "application/json",
195
+ "Accept": "application/json"
196
+ },
197
+ cancelToken
198
+ };
199
+ return this.instance.request(options_).catch((_error) => {
200
+ if (isAxiosError(_error) && _error.response) {
201
+ return _error.response;
202
+ }
203
+ else {
204
+ throw _error;
205
+ }
206
+ }).then((_response) => {
207
+ return this.processQueryAgents(_response);
208
+ });
209
+ }
210
+ processQueryAgents(response) {
211
+ const status = response.status;
212
+ let _headers = {};
213
+ if (response.headers && typeof response.headers === "object") {
214
+ for (const k in response.headers) {
215
+ if (response.headers.hasOwnProperty(k)) {
216
+ _headers[k] = response.headers[k];
217
+ }
218
+ }
219
+ }
220
+ if (status === 200) {
221
+ const _responseText = response.data;
222
+ let result200 = null;
223
+ let resultData200 = _responseText;
224
+ result200 = JSON.parse(resultData200);
225
+ return Promise.resolve(result200);
226
+ }
227
+ else if (status === 401) {
228
+ const _responseText = response.data;
229
+ let result401 = null;
230
+ let resultData401 = _responseText;
231
+ result401 = JSON.parse(resultData401);
232
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
233
+ }
234
+ else if (status !== 200 && status !== 204) {
235
+ const _responseText = response.data;
236
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
237
+ }
238
+ return Promise.resolve(null);
239
+ }
240
+ /**
241
+ * Create an agent. If the agent already exists, the information will be updated.
242
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
243
+ * @param body (optional) The agent data to create or update.
244
+ * @return Agent created. Returns the agent ID.
245
+ */
246
+ postAgent(x_Workspace_ID, body, cancelToken) {
247
+ let url_ = this.baseUrl + "/v1/agents";
248
+ url_ = url_.replace(/[?&]$/, "");
249
+ const content_ = JSON.stringify(body);
250
+ let options_ = {
251
+ data: content_,
252
+ method: "POST",
253
+ url: url_,
254
+ headers: {
255
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
256
+ "Content-Type": "application/json",
257
+ "Accept": "application/json"
258
+ },
259
+ cancelToken
260
+ };
261
+ return this.instance.request(options_).catch((_error) => {
262
+ if (isAxiosError(_error) && _error.response) {
263
+ return _error.response;
264
+ }
265
+ else {
266
+ throw _error;
267
+ }
268
+ }).then((_response) => {
269
+ return this.processPostAgent(_response);
270
+ });
271
+ }
272
+ processPostAgent(response) {
273
+ const status = response.status;
274
+ let _headers = {};
275
+ if (response.headers && typeof response.headers === "object") {
276
+ for (const k in response.headers) {
277
+ if (response.headers.hasOwnProperty(k)) {
278
+ _headers[k] = response.headers[k];
279
+ }
280
+ }
281
+ }
282
+ if (status === 201) {
283
+ const _responseText = response.data;
284
+ let result201 = null;
285
+ let resultData201 = _responseText;
286
+ result201 = JSON.parse(resultData201);
287
+ return Promise.resolve(result201);
288
+ }
289
+ else if (status === 400) {
290
+ const _responseText = response.data;
291
+ let result400 = null;
292
+ let resultData400 = _responseText;
293
+ result400 = JSON.parse(resultData400);
294
+ return throwException("Invalid coordinates or payload.", status, _responseText, _headers, result400);
295
+ }
296
+ else if (status === 401) {
297
+ const _responseText = response.data;
298
+ let result401 = null;
299
+ let resultData401 = _responseText;
300
+ result401 = JSON.parse(resultData401);
301
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
302
+ }
303
+ else if (status === 500) {
304
+ const _responseText = response.data;
305
+ let result500 = null;
306
+ let resultData500 = _responseText;
307
+ result500 = JSON.parse(resultData500);
308
+ return throwException("Failed to create agent.", status, _responseText, _headers, result500);
309
+ }
310
+ else if (status !== 200 && status !== 204) {
311
+ const _responseText = response.data;
312
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
313
+ }
314
+ return Promise.resolve(null);
315
+ }
316
+ /**
317
+ * Delete an agent.
318
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
319
+ * @param body (optional) The agent to delete (by AgentId, ExternalId, or Email).
320
+ * @return Agent deleted.
321
+ */
322
+ deleteAgent(x_Workspace_ID, body, cancelToken) {
323
+ let url_ = this.baseUrl + "/v1/agents";
324
+ url_ = url_.replace(/[?&]$/, "");
325
+ const content_ = JSON.stringify(body);
326
+ let options_ = {
327
+ data: content_,
328
+ method: "DELETE",
329
+ url: url_,
330
+ headers: {
331
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
332
+ "Content-Type": "application/json",
333
+ "Accept": "application/json"
334
+ },
335
+ cancelToken
336
+ };
337
+ return this.instance.request(options_).catch((_error) => {
338
+ if (isAxiosError(_error) && _error.response) {
339
+ return _error.response;
340
+ }
341
+ else {
342
+ throw _error;
343
+ }
344
+ }).then((_response) => {
345
+ return this.processDeleteAgent(_response);
346
+ });
347
+ }
348
+ processDeleteAgent(response) {
349
+ const status = response.status;
350
+ let _headers = {};
351
+ if (response.headers && typeof response.headers === "object") {
352
+ for (const k in response.headers) {
353
+ if (response.headers.hasOwnProperty(k)) {
354
+ _headers[k] = response.headers[k];
355
+ }
356
+ }
357
+ }
358
+ if (status === 200) {
359
+ const _responseText = response.data;
360
+ let result200 = null;
361
+ let resultData200 = _responseText;
362
+ result200 = JSON.parse(resultData200);
363
+ return Promise.resolve(result200);
364
+ }
365
+ else if (status === 400) {
366
+ const _responseText = response.data;
367
+ let result400 = null;
368
+ let resultData400 = _responseText;
369
+ result400 = JSON.parse(resultData400);
370
+ return throwException("No identifier was provided.", status, _responseText, _headers, result400);
371
+ }
372
+ else if (status === 401) {
373
+ const _responseText = response.data;
374
+ let result401 = null;
375
+ let resultData401 = _responseText;
376
+ result401 = JSON.parse(resultData401);
377
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
378
+ }
379
+ else if (status === 404) {
380
+ const _responseText = response.data;
381
+ let result404 = null;
382
+ let resultData404 = _responseText;
383
+ result404 = JSON.parse(resultData404);
384
+ return throwException("Agent not found.", status, _responseText, _headers, result404);
385
+ }
386
+ else if (status === 500) {
387
+ const _responseText = response.data;
388
+ let result500 = null;
389
+ let resultData500 = _responseText;
390
+ result500 = JSON.parse(resultData500);
391
+ return throwException("Failed to delete the agent.", status, _responseText, _headers, result500);
392
+ }
393
+ else if (status !== 200 && status !== 204) {
394
+ const _responseText = response.data;
395
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
396
+ }
397
+ return Promise.resolve(null);
398
+ }
399
+ /**
400
+ * Upload an asset and link it to one or more subjects.
401
+ * @param body (optional) Asset name, source, file type, source URLs, and target subjects.
402
+ * @return Asset uploaded and linked.
403
+ */
404
+ createAsset(body, cancelToken) {
405
+ let url_ = this.baseUrl + "/v1/assets";
406
+ url_ = url_.replace(/[?&]$/, "");
407
+ const content_ = JSON.stringify(body);
408
+ let options_ = {
409
+ data: content_,
410
+ method: "POST",
411
+ url: url_,
412
+ headers: {
413
+ "Content-Type": "application/json",
414
+ },
415
+ cancelToken
416
+ };
417
+ return this.instance.request(options_).catch((_error) => {
418
+ if (isAxiosError(_error) && _error.response) {
419
+ return _error.response;
420
+ }
421
+ else {
422
+ throw _error;
423
+ }
424
+ }).then((_response) => {
425
+ return this.processCreateAsset(_response);
426
+ });
427
+ }
428
+ processCreateAsset(response) {
429
+ const status = response.status;
430
+ let _headers = {};
431
+ if (response.headers && typeof response.headers === "object") {
432
+ for (const k in response.headers) {
433
+ if (response.headers.hasOwnProperty(k)) {
434
+ _headers[k] = response.headers[k];
435
+ }
436
+ }
437
+ }
438
+ if (status === 204) {
439
+ const _responseText = response.data;
440
+ return Promise.resolve(null);
441
+ }
442
+ else if (status === 400) {
443
+ const _responseText = response.data;
444
+ let result400 = null;
445
+ let resultData400 = _responseText;
446
+ result400 = JSON.parse(resultData400);
447
+ return throwException("Unsupported subject type or invalid payload.", status, _responseText, _headers, result400);
448
+ }
449
+ else if (status === 401) {
450
+ const _responseText = response.data;
451
+ let result401 = null;
452
+ let resultData401 = _responseText;
453
+ result401 = JSON.parse(resultData401);
454
+ return throwException("Unable to determine user identity.", status, _responseText, _headers, result401);
455
+ }
456
+ else if (status === 403) {
457
+ const _responseText = response.data;
458
+ let result403 = null;
459
+ let resultData403 = _responseText;
460
+ result403 = JSON.parse(resultData403);
461
+ return throwException("Caller does not have access to one or more of the referenced subjects.", status, _responseText, _headers, result403);
462
+ }
463
+ else if (status === 500) {
464
+ const _responseText = response.data;
465
+ let result500 = null;
466
+ let resultData500 = _responseText;
467
+ result500 = JSON.parse(resultData500);
468
+ return throwException("Asset ingestion failed.", status, _responseText, _headers, result500);
469
+ }
470
+ else if (status !== 200 && status !== 204) {
471
+ const _responseText = response.data;
472
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
473
+ }
474
+ return Promise.resolve(null);
475
+ }
476
+ /**
477
+ * Get a list of all campaigns with optional filters.
478
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
479
+ * @param body (optional) Filter and pagination options.
480
+ * @return Paginated list of campaigns.
481
+ */
482
+ queryCampaigns(x_Workspace_ID, body, cancelToken) {
483
+ let url_ = this.baseUrl + "/v1/campaigns/query";
484
+ url_ = url_.replace(/[?&]$/, "");
485
+ const content_ = JSON.stringify(body);
486
+ let options_ = {
487
+ data: content_,
488
+ method: "POST",
489
+ url: url_,
490
+ headers: {
491
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
492
+ "Content-Type": "application/json",
493
+ "Accept": "application/json"
494
+ },
495
+ cancelToken
496
+ };
497
+ return this.instance.request(options_).catch((_error) => {
498
+ if (isAxiosError(_error) && _error.response) {
499
+ return _error.response;
500
+ }
501
+ else {
502
+ throw _error;
503
+ }
504
+ }).then((_response) => {
505
+ return this.processQueryCampaigns(_response);
506
+ });
507
+ }
508
+ processQueryCampaigns(response) {
509
+ const status = response.status;
510
+ let _headers = {};
511
+ if (response.headers && typeof response.headers === "object") {
512
+ for (const k in response.headers) {
513
+ if (response.headers.hasOwnProperty(k)) {
514
+ _headers[k] = response.headers[k];
515
+ }
516
+ }
517
+ }
518
+ if (status === 200) {
519
+ const _responseText = response.data;
520
+ let result200 = null;
521
+ let resultData200 = _responseText;
522
+ result200 = JSON.parse(resultData200);
523
+ return Promise.resolve(result200);
524
+ }
525
+ else if (status === 401) {
526
+ const _responseText = response.data;
527
+ let result401 = null;
528
+ let resultData401 = _responseText;
529
+ result401 = JSON.parse(resultData401);
530
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
531
+ }
532
+ else if (status !== 200 && status !== 204) {
533
+ const _responseText = response.data;
534
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
535
+ }
536
+ return Promise.resolve(null);
537
+ }
538
+ /**
539
+ * Get a single campaign by ID.
540
+ * @param campaignId The campaign's Realforce ID.
541
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
542
+ * @return The campaign object.
543
+ */
544
+ getCampaign(campaignId, x_Workspace_ID, cancelToken) {
545
+ let url_ = this.baseUrl + "/v1/campaigns/{campaignId}";
546
+ if (campaignId === undefined || campaignId === null)
547
+ throw new Error("The parameter 'campaignId' must be defined.");
548
+ url_ = url_.replace("{campaignId}", encodeURIComponent("" + campaignId));
549
+ url_ = url_.replace(/[?&]$/, "");
550
+ let options_ = {
551
+ method: "GET",
552
+ url: url_,
553
+ headers: {
554
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
555
+ "Accept": "application/json"
556
+ },
557
+ cancelToken
558
+ };
559
+ return this.instance.request(options_).catch((_error) => {
560
+ if (isAxiosError(_error) && _error.response) {
561
+ return _error.response;
562
+ }
563
+ else {
564
+ throw _error;
565
+ }
566
+ }).then((_response) => {
567
+ return this.processGetCampaign(_response);
568
+ });
569
+ }
570
+ processGetCampaign(response) {
571
+ const status = response.status;
572
+ let _headers = {};
573
+ if (response.headers && typeof response.headers === "object") {
574
+ for (const k in response.headers) {
575
+ if (response.headers.hasOwnProperty(k)) {
576
+ _headers[k] = response.headers[k];
577
+ }
578
+ }
579
+ }
580
+ if (status === 200) {
581
+ const _responseText = response.data;
582
+ let result200 = null;
583
+ let resultData200 = _responseText;
584
+ result200 = JSON.parse(resultData200);
585
+ return Promise.resolve(result200);
586
+ }
587
+ else if (status === 401) {
588
+ const _responseText = response.data;
589
+ let result401 = null;
590
+ let resultData401 = _responseText;
591
+ result401 = JSON.parse(resultData401);
592
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
593
+ }
594
+ else if (status === 404) {
595
+ const _responseText = response.data;
596
+ let result404 = null;
597
+ let resultData404 = _responseText;
598
+ result404 = JSON.parse(resultData404);
599
+ return throwException("Campaign not found.", status, _responseText, _headers, result404);
600
+ }
601
+ else if (status !== 200 && status !== 204) {
602
+ const _responseText = response.data;
603
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
604
+ }
605
+ return Promise.resolve(null);
606
+ }
607
+ /**
608
+ * Upsert a property together with its office and agent in a single request.
609
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
610
+ * @param body (optional) The combined property, office, and agent data to upsert.
611
+ * @return Request processed. Inspect `errorMessage` for partial-failure details.
612
+ */
613
+ postFullData(x_Workspace_ID, body, cancelToken) {
614
+ let url_ = this.baseUrl + "/v1/full-data";
615
+ url_ = url_.replace(/[?&]$/, "");
616
+ const content_ = JSON.stringify(body);
617
+ let options_ = {
618
+ data: content_,
619
+ method: "POST",
620
+ url: url_,
621
+ headers: {
622
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
623
+ "Content-Type": "application/json",
624
+ "Accept": "application/json"
625
+ },
626
+ cancelToken
627
+ };
628
+ return this.instance.request(options_).catch((_error) => {
629
+ if (isAxiosError(_error) && _error.response) {
630
+ return _error.response;
631
+ }
632
+ else {
633
+ throw _error;
634
+ }
635
+ }).then((_response) => {
636
+ return this.processPostFullData(_response);
637
+ });
638
+ }
639
+ processPostFullData(response) {
640
+ const status = response.status;
641
+ let _headers = {};
642
+ if (response.headers && typeof response.headers === "object") {
643
+ for (const k in response.headers) {
644
+ if (response.headers.hasOwnProperty(k)) {
645
+ _headers[k] = response.headers[k];
646
+ }
647
+ }
648
+ }
649
+ if (status === 200) {
650
+ const _responseText = response.data;
651
+ let result200 = null;
652
+ let resultData200 = _responseText;
653
+ result200 = JSON.parse(resultData200);
654
+ return Promise.resolve(result200);
655
+ }
656
+ else if (status === 401) {
657
+ const _responseText = response.data;
658
+ let result401 = null;
659
+ let resultData401 = _responseText;
660
+ result401 = JSON.parse(resultData401);
661
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
662
+ }
663
+ else if (status !== 200 && status !== 204) {
664
+ const _responseText = response.data;
665
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
666
+ }
667
+ return Promise.resolve(null);
668
+ }
669
+ /**
670
+ * Publish a lead against a property, agent, or office.
671
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
672
+ * @param body (optional) The lead data including subject type and identifiers.
673
+ * @return Lead published.
674
+ */
675
+ postLead(x_Workspace_ID, body, cancelToken) {
676
+ let url_ = this.baseUrl + "/v1/leads";
677
+ url_ = url_.replace(/[?&]$/, "");
678
+ const content_ = JSON.stringify(body);
679
+ let options_ = {
680
+ data: content_,
681
+ method: "POST",
682
+ url: url_,
683
+ headers: {
684
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
685
+ "Content-Type": "application/json",
686
+ "Accept": "application/json"
687
+ },
688
+ cancelToken
689
+ };
690
+ return this.instance.request(options_).catch((_error) => {
691
+ if (isAxiosError(_error) && _error.response) {
692
+ return _error.response;
693
+ }
694
+ else {
695
+ throw _error;
696
+ }
697
+ }).then((_response) => {
698
+ return this.processPostLead(_response);
699
+ });
700
+ }
701
+ processPostLead(response) {
702
+ const status = response.status;
703
+ let _headers = {};
704
+ if (response.headers && typeof response.headers === "object") {
705
+ for (const k in response.headers) {
706
+ if (response.headers.hasOwnProperty(k)) {
707
+ _headers[k] = response.headers[k];
708
+ }
709
+ }
710
+ }
711
+ if (status === 200) {
712
+ const _responseText = response.data;
713
+ let result200 = null;
714
+ let resultData200 = _responseText;
715
+ result200 = JSON.parse(resultData200);
716
+ return Promise.resolve(result200);
717
+ }
718
+ else if (status === 400) {
719
+ const _responseText = response.data;
720
+ let result400 = null;
721
+ let resultData400 = _responseText;
722
+ result400 = JSON.parse(resultData400);
723
+ return throwException("Invalid request \u2014 missing subject lookup field or unsupported lead type.", status, _responseText, _headers, result400);
724
+ }
725
+ else if (status === 401) {
726
+ const _responseText = response.data;
727
+ let result401 = null;
728
+ let resultData401 = _responseText;
729
+ result401 = JSON.parse(resultData401);
730
+ return throwException("Unauthorized", status, _responseText, _headers, result401);
731
+ }
732
+ else if (status === 404) {
733
+ const _responseText = response.data;
734
+ let result404 = null;
735
+ let resultData404 = _responseText;
736
+ result404 = JSON.parse(resultData404);
737
+ return throwException("Subject (property, agent, or office) not found.", status, _responseText, _headers, result404);
738
+ }
739
+ else if (status === 500) {
740
+ const _responseText = response.data;
741
+ let result500 = null;
742
+ let resultData500 = _responseText;
743
+ result500 = JSON.parse(resultData500);
744
+ return throwException("Failed to publish the lead.", status, _responseText, _headers, result500);
745
+ }
746
+ else if (status !== 200 && status !== 204) {
747
+ const _responseText = response.data;
748
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
749
+ }
750
+ return Promise.resolve(null);
751
+ }
752
+ /**
753
+ * Generate a magic link for a property or marketing opportunity.
754
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
755
+ * @param body (optional) The magic link type, subject ID, and target user email.
756
+ * @return Magic link generated.
757
+ */
758
+ createMagicLink(x_Workspace_ID, body, cancelToken) {
759
+ let url_ = this.baseUrl + "/v1/magic-link";
760
+ url_ = url_.replace(/[?&]$/, "");
761
+ const content_ = JSON.stringify(body);
762
+ let options_ = {
763
+ data: content_,
764
+ method: "POST",
765
+ url: url_,
766
+ headers: {
767
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
768
+ "Content-Type": "application/json",
769
+ "Accept": "application/json"
770
+ },
771
+ cancelToken
772
+ };
773
+ return this.instance.request(options_).catch((_error) => {
774
+ if (isAxiosError(_error) && _error.response) {
775
+ return _error.response;
776
+ }
777
+ else {
778
+ throw _error;
779
+ }
780
+ }).then((_response) => {
781
+ return this.processCreateMagicLink(_response);
782
+ });
783
+ }
784
+ processCreateMagicLink(response) {
785
+ const status = response.status;
786
+ let _headers = {};
787
+ if (response.headers && typeof response.headers === "object") {
788
+ for (const k in response.headers) {
789
+ if (response.headers.hasOwnProperty(k)) {
790
+ _headers[k] = response.headers[k];
791
+ }
792
+ }
793
+ }
794
+ if (status === 200) {
795
+ const _responseText = response.data;
796
+ let result200 = null;
797
+ let resultData200 = _responseText;
798
+ result200 = JSON.parse(resultData200);
799
+ return Promise.resolve(result200);
800
+ }
801
+ else if (status === 400) {
802
+ const _responseText = response.data;
803
+ let result400 = null;
804
+ let resultData400 = _responseText;
805
+ result400 = JSON.parse(resultData400);
806
+ return throwException("Invalid request payload or unsupported `type`.", status, _responseText, _headers, result400);
807
+ }
808
+ else if (status === 401) {
809
+ const _responseText = response.data;
810
+ let result401 = null;
811
+ let resultData401 = _responseText;
812
+ result401 = JSON.parse(resultData401);
813
+ return throwException("Authorization token missing.", status, _responseText, _headers, result401);
814
+ }
815
+ else if (status === 403) {
816
+ const _responseText = response.data;
817
+ let result403 = null;
818
+ let resultData403 = _responseText;
819
+ result403 = JSON.parse(resultData403);
820
+ return throwException("Token is not authorized for the target workspace, or the user does not exist in the workspace.", status, _responseText, _headers, result403);
821
+ }
822
+ else if (status === 404) {
823
+ const _responseText = response.data;
824
+ let result404 = null;
825
+ let resultData404 = _responseText;
826
+ result404 = JSON.parse(resultData404);
827
+ return throwException("Target property, marketing opportunity, or result/order page not found.", status, _responseText, _headers, result404);
828
+ }
829
+ else if (status === 500) {
830
+ const _responseText = response.data;
831
+ let result500 = null;
832
+ let resultData500 = _responseText;
833
+ result500 = JSON.parse(resultData500);
834
+ return throwException("Failed to create the authentication token.", status, _responseText, _headers, result500);
835
+ }
836
+ else if (status !== 200 && status !== 204) {
837
+ const _responseText = response.data;
838
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
839
+ }
840
+ return Promise.resolve(null);
841
+ }
842
+ /**
843
+ * Cancel autopublish of a marketing opportunity.
844
+ * @param marketingOpportunityId The marketing opportunity ID.
845
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
846
+ * @return Autopublish cancelled.
847
+ */
848
+ cancelMarketingOpportunitiesAutoPublish(marketingOpportunityId, x_Workspace_ID, cancelToken) {
849
+ let url_ = this.baseUrl + "/v1/marketing-opportunities/{marketingOpportunityId}/cancel-autopublish";
850
+ if (marketingOpportunityId === undefined || marketingOpportunityId === null)
851
+ throw new Error("The parameter 'marketingOpportunityId' must be defined.");
852
+ url_ = url_.replace("{marketingOpportunityId}", encodeURIComponent("" + marketingOpportunityId));
853
+ url_ = url_.replace(/[?&]$/, "");
854
+ let options_ = {
855
+ method: "POST",
856
+ url: url_,
857
+ headers: {
858
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
859
+ "Accept": "application/json"
860
+ },
861
+ cancelToken
862
+ };
863
+ return this.instance.request(options_).catch((_error) => {
864
+ if (isAxiosError(_error) && _error.response) {
865
+ return _error.response;
866
+ }
867
+ else {
868
+ throw _error;
869
+ }
870
+ }).then((_response) => {
871
+ return this.processCancelMarketingOpportunitiesAutoPublish(_response);
872
+ });
873
+ }
874
+ processCancelMarketingOpportunitiesAutoPublish(response) {
875
+ const status = response.status;
876
+ let _headers = {};
877
+ if (response.headers && typeof response.headers === "object") {
878
+ for (const k in response.headers) {
879
+ if (response.headers.hasOwnProperty(k)) {
880
+ _headers[k] = response.headers[k];
881
+ }
882
+ }
883
+ }
884
+ if (status === 200) {
885
+ const _responseText = response.data;
886
+ let result200 = null;
887
+ let resultData200 = _responseText;
888
+ result200 = JSON.parse(resultData200);
889
+ return Promise.resolve(result200);
890
+ }
891
+ else if (status === 401) {
892
+ const _responseText = response.data;
893
+ let result401 = null;
894
+ let resultData401 = _responseText;
895
+ result401 = JSON.parse(resultData401);
896
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
897
+ }
898
+ else if (status === 404) {
899
+ const _responseText = response.data;
900
+ let result404 = null;
901
+ let resultData404 = _responseText;
902
+ result404 = JSON.parse(resultData404);
903
+ return throwException("Marketing opportunity not found.", status, _responseText, _headers, result404);
904
+ }
905
+ else if (status === 500) {
906
+ const _responseText = response.data;
907
+ let result500 = null;
908
+ let resultData500 = _responseText;
909
+ result500 = JSON.parse(resultData500);
910
+ return throwException("Failed to cancel autopublish.", status, _responseText, _headers, result500);
911
+ }
912
+ else if (status !== 200 && status !== 204) {
913
+ const _responseText = response.data;
914
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
915
+ }
916
+ return Promise.resolve(null);
917
+ }
918
+ /**
919
+ * Make a marketing opportunity's order page available or unavailable.
920
+ * @param marketingOpportunityId The marketing opportunity ID.
921
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
922
+ * @param body (optional) The new order page availability and an optional unavailable reason.
923
+ * @return Order page availability updated.
924
+ */
925
+ setOrderPageAvailability(marketingOpportunityId, x_Workspace_ID, body, cancelToken) {
926
+ let url_ = this.baseUrl + "/v1/marketing-opportunities/{marketingOpportunityId}/order-page-availability";
927
+ if (marketingOpportunityId === undefined || marketingOpportunityId === null)
928
+ throw new Error("The parameter 'marketingOpportunityId' must be defined.");
929
+ url_ = url_.replace("{marketingOpportunityId}", encodeURIComponent("" + marketingOpportunityId));
930
+ url_ = url_.replace(/[?&]$/, "");
931
+ const content_ = JSON.stringify(body);
932
+ let options_ = {
933
+ data: content_,
934
+ method: "PUT",
935
+ url: url_,
936
+ headers: {
937
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
938
+ "Content-Type": "application/json",
939
+ "Accept": "application/json"
940
+ },
941
+ cancelToken
942
+ };
943
+ return this.instance.request(options_).catch((_error) => {
944
+ if (isAxiosError(_error) && _error.response) {
945
+ return _error.response;
946
+ }
947
+ else {
948
+ throw _error;
949
+ }
950
+ }).then((_response) => {
951
+ return this.processSetOrderPageAvailability(_response);
952
+ });
953
+ }
954
+ processSetOrderPageAvailability(response) {
955
+ const status = response.status;
956
+ let _headers = {};
957
+ if (response.headers && typeof response.headers === "object") {
958
+ for (const k in response.headers) {
959
+ if (response.headers.hasOwnProperty(k)) {
960
+ _headers[k] = response.headers[k];
961
+ }
962
+ }
963
+ }
964
+ if (status === 200) {
965
+ const _responseText = response.data;
966
+ let result200 = null;
967
+ let resultData200 = _responseText;
968
+ result200 = JSON.parse(resultData200);
969
+ return Promise.resolve(result200);
970
+ }
971
+ else if (status === 401) {
972
+ const _responseText = response.data;
973
+ let result401 = null;
974
+ let resultData401 = _responseText;
975
+ result401 = JSON.parse(resultData401);
976
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
977
+ }
978
+ else if (status === 404) {
979
+ const _responseText = response.data;
980
+ let result404 = null;
981
+ let resultData404 = _responseText;
982
+ result404 = JSON.parse(resultData404);
983
+ return throwException("Marketing opportunity not found.", status, _responseText, _headers, result404);
984
+ }
985
+ else if (status === 500) {
986
+ const _responseText = response.data;
987
+ let result500 = null;
988
+ let resultData500 = _responseText;
989
+ result500 = JSON.parse(resultData500);
990
+ return throwException("Failed to update order page availability.", status, _responseText, _headers, result500);
991
+ }
992
+ else if (status !== 200 && status !== 204) {
993
+ const _responseText = response.data;
994
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
995
+ }
996
+ return Promise.resolve(null);
997
+ }
998
+ /**
999
+ * Get available marketing opportunities with optional filters.
1000
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
1001
+ * @param body (optional) List request with pagination, sorting, and filter criteria.
1002
+ * @return Paginated list of marketing opportunities.
1003
+ */
1004
+ queryMarketingOpportunities(x_Workspace_ID, body, cancelToken) {
1005
+ let url_ = this.baseUrl + "/v1/marketing-opportunities/query";
1006
+ url_ = url_.replace(/[?&]$/, "");
1007
+ const content_ = JSON.stringify(body);
1008
+ let options_ = {
1009
+ data: content_,
1010
+ method: "POST",
1011
+ url: url_,
1012
+ headers: {
1013
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
1014
+ "Content-Type": "application/json",
1015
+ "Accept": "application/json"
1016
+ },
1017
+ cancelToken
1018
+ };
1019
+ return this.instance.request(options_).catch((_error) => {
1020
+ if (isAxiosError(_error) && _error.response) {
1021
+ return _error.response;
1022
+ }
1023
+ else {
1024
+ throw _error;
1025
+ }
1026
+ }).then((_response) => {
1027
+ return this.processQueryMarketingOpportunities(_response);
1028
+ });
1029
+ }
1030
+ processQueryMarketingOpportunities(response) {
1031
+ const status = response.status;
1032
+ let _headers = {};
1033
+ if (response.headers && typeof response.headers === "object") {
1034
+ for (const k in response.headers) {
1035
+ if (response.headers.hasOwnProperty(k)) {
1036
+ _headers[k] = response.headers[k];
1037
+ }
1038
+ }
1039
+ }
1040
+ if (status === 200) {
1041
+ const _responseText = response.data;
1042
+ let result200 = null;
1043
+ let resultData200 = _responseText;
1044
+ result200 = JSON.parse(resultData200);
1045
+ return Promise.resolve(result200);
1046
+ }
1047
+ else if (status === 401) {
1048
+ const _responseText = response.data;
1049
+ let result401 = null;
1050
+ let resultData401 = _responseText;
1051
+ result401 = JSON.parse(resultData401);
1052
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
1053
+ }
1054
+ else if (status !== 200 && status !== 204) {
1055
+ const _responseText = response.data;
1056
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1057
+ }
1058
+ return Promise.resolve(null);
1059
+ }
1060
+ /**
1061
+ * Get a specific office by ID.
1062
+ * @param officeId The office's Realforce ID.
1063
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
1064
+ * @return The office object.
1065
+ */
1066
+ getOffice(officeId, x_Workspace_ID, cancelToken) {
1067
+ let url_ = this.baseUrl + "/v1/offices/{officeId}";
1068
+ if (officeId === undefined || officeId === null)
1069
+ throw new Error("The parameter 'officeId' must be defined.");
1070
+ url_ = url_.replace("{officeId}", encodeURIComponent("" + officeId));
1071
+ url_ = url_.replace(/[?&]$/, "");
1072
+ let options_ = {
1073
+ method: "GET",
1074
+ url: url_,
1075
+ headers: {
1076
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
1077
+ "Accept": "application/json"
1078
+ },
1079
+ cancelToken
1080
+ };
1081
+ return this.instance.request(options_).catch((_error) => {
1082
+ if (isAxiosError(_error) && _error.response) {
1083
+ return _error.response;
1084
+ }
1085
+ else {
1086
+ throw _error;
1087
+ }
1088
+ }).then((_response) => {
1089
+ return this.processGetOffice(_response);
1090
+ });
1091
+ }
1092
+ processGetOffice(response) {
1093
+ const status = response.status;
1094
+ let _headers = {};
1095
+ if (response.headers && typeof response.headers === "object") {
1096
+ for (const k in response.headers) {
1097
+ if (response.headers.hasOwnProperty(k)) {
1098
+ _headers[k] = response.headers[k];
1099
+ }
1100
+ }
1101
+ }
1102
+ if (status === 200) {
1103
+ const _responseText = response.data;
1104
+ let result200 = null;
1105
+ let resultData200 = _responseText;
1106
+ result200 = JSON.parse(resultData200);
1107
+ return Promise.resolve(result200);
1108
+ }
1109
+ else if (status === 401) {
1110
+ const _responseText = response.data;
1111
+ let result401 = null;
1112
+ let resultData401 = _responseText;
1113
+ result401 = JSON.parse(resultData401);
1114
+ return throwException("Unauthorized", status, _responseText, _headers, result401);
1115
+ }
1116
+ else if (status === 404) {
1117
+ const _responseText = response.data;
1118
+ let result404 = null;
1119
+ let resultData404 = _responseText;
1120
+ result404 = JSON.parse(resultData404);
1121
+ return throwException("Office not found.", status, _responseText, _headers, result404);
1122
+ }
1123
+ else if (status !== 200 && status !== 204) {
1124
+ const _responseText = response.data;
1125
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1126
+ }
1127
+ return Promise.resolve(null);
1128
+ }
1129
+ /**
1130
+ * Update an office.
1131
+ * @param officeId The office's Realforce ID.
1132
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
1133
+ * @param body (optional) The office fields to update. Only fields included in the body are changed.
1134
+ * @return Office updated.
1135
+ */
1136
+ putOffice(officeId, x_Workspace_ID, body, cancelToken) {
1137
+ let url_ = this.baseUrl + "/v1/offices/{officeId}";
1138
+ if (officeId === undefined || officeId === null)
1139
+ throw new Error("The parameter 'officeId' must be defined.");
1140
+ url_ = url_.replace("{officeId}", encodeURIComponent("" + officeId));
1141
+ url_ = url_.replace(/[?&]$/, "");
1142
+ const content_ = JSON.stringify(body);
1143
+ let options_ = {
1144
+ data: content_,
1145
+ method: "PUT",
1146
+ url: url_,
1147
+ headers: {
1148
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
1149
+ "Content-Type": "application/json",
1150
+ "Accept": "application/json"
1151
+ },
1152
+ cancelToken
1153
+ };
1154
+ return this.instance.request(options_).catch((_error) => {
1155
+ if (isAxiosError(_error) && _error.response) {
1156
+ return _error.response;
1157
+ }
1158
+ else {
1159
+ throw _error;
1160
+ }
1161
+ }).then((_response) => {
1162
+ return this.processPutOffice(_response);
1163
+ });
1164
+ }
1165
+ processPutOffice(response) {
1166
+ const status = response.status;
1167
+ let _headers = {};
1168
+ if (response.headers && typeof response.headers === "object") {
1169
+ for (const k in response.headers) {
1170
+ if (response.headers.hasOwnProperty(k)) {
1171
+ _headers[k] = response.headers[k];
1172
+ }
1173
+ }
1174
+ }
1175
+ if (status === 200) {
1176
+ const _responseText = response.data;
1177
+ let result200 = null;
1178
+ let resultData200 = _responseText;
1179
+ result200 = JSON.parse(resultData200);
1180
+ return Promise.resolve(result200);
1181
+ }
1182
+ else if (status === 401) {
1183
+ const _responseText = response.data;
1184
+ let result401 = null;
1185
+ let resultData401 = _responseText;
1186
+ result401 = JSON.parse(resultData401);
1187
+ return throwException("Unauthorized", status, _responseText, _headers, result401);
1188
+ }
1189
+ else if (status === 404) {
1190
+ const _responseText = response.data;
1191
+ let result404 = null;
1192
+ let resultData404 = _responseText;
1193
+ result404 = JSON.parse(resultData404);
1194
+ return throwException("Office not found.", status, _responseText, _headers, result404);
1195
+ }
1196
+ else if (status === 500) {
1197
+ const _responseText = response.data;
1198
+ let result500 = null;
1199
+ let resultData500 = _responseText;
1200
+ result500 = JSON.parse(resultData500);
1201
+ return throwException("Internal Server Error", status, _responseText, _headers, result500);
1202
+ }
1203
+ else if (status !== 200 && status !== 204) {
1204
+ const _responseText = response.data;
1205
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1206
+ }
1207
+ return Promise.resolve(null);
1208
+ }
1209
+ /**
1210
+ * Get a list of all offices.
1211
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
1212
+ * @param body (optional) Filter and pagination options.
1213
+ * @return Paginated list of offices.
1214
+ */
1215
+ queryOffices(x_Workspace_ID, body, cancelToken) {
1216
+ let url_ = this.baseUrl + "/v1/offices/query";
1217
+ url_ = url_.replace(/[?&]$/, "");
1218
+ const content_ = JSON.stringify(body);
1219
+ let options_ = {
1220
+ data: content_,
1221
+ method: "POST",
1222
+ url: url_,
1223
+ headers: {
1224
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
1225
+ "Content-Type": "application/json",
1226
+ "Accept": "application/json"
1227
+ },
1228
+ cancelToken
1229
+ };
1230
+ return this.instance.request(options_).catch((_error) => {
1231
+ if (isAxiosError(_error) && _error.response) {
1232
+ return _error.response;
1233
+ }
1234
+ else {
1235
+ throw _error;
1236
+ }
1237
+ }).then((_response) => {
1238
+ return this.processQueryOffices(_response);
1239
+ });
1240
+ }
1241
+ processQueryOffices(response) {
1242
+ const status = response.status;
1243
+ let _headers = {};
1244
+ if (response.headers && typeof response.headers === "object") {
1245
+ for (const k in response.headers) {
1246
+ if (response.headers.hasOwnProperty(k)) {
1247
+ _headers[k] = response.headers[k];
1248
+ }
1249
+ }
1250
+ }
1251
+ if (status === 200) {
1252
+ const _responseText = response.data;
1253
+ let result200 = null;
1254
+ let resultData200 = _responseText;
1255
+ result200 = JSON.parse(resultData200);
1256
+ return Promise.resolve(result200);
1257
+ }
1258
+ else if (status === 401) {
1259
+ const _responseText = response.data;
1260
+ let result401 = null;
1261
+ let resultData401 = _responseText;
1262
+ result401 = JSON.parse(resultData401);
1263
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
1264
+ }
1265
+ else if (status !== 200 && status !== 204) {
1266
+ const _responseText = response.data;
1267
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1268
+ }
1269
+ return Promise.resolve(null);
1270
+ }
1271
+ /**
1272
+ * Create an office. If an office with the same ExternalId already exists, the existing office will be updated.
1273
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
1274
+ * @param body (optional) The office data to create or update.
1275
+ * @return Office created or updated. Returns the office ID.
1276
+ */
1277
+ postOffice(x_Workspace_ID, body, cancelToken) {
1278
+ let url_ = this.baseUrl + "/v1/offices";
1279
+ url_ = url_.replace(/[?&]$/, "");
1280
+ const content_ = JSON.stringify(body);
1281
+ let options_ = {
1282
+ data: content_,
1283
+ method: "POST",
1284
+ url: url_,
1285
+ headers: {
1286
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
1287
+ "Content-Type": "application/json",
1288
+ "Accept": "application/json"
1289
+ },
1290
+ cancelToken
1291
+ };
1292
+ return this.instance.request(options_).catch((_error) => {
1293
+ if (isAxiosError(_error) && _error.response) {
1294
+ return _error.response;
1295
+ }
1296
+ else {
1297
+ throw _error;
1298
+ }
1299
+ }).then((_response) => {
1300
+ return this.processPostOffice(_response);
1301
+ });
1302
+ }
1303
+ processPostOffice(response) {
1304
+ const status = response.status;
1305
+ let _headers = {};
1306
+ if (response.headers && typeof response.headers === "object") {
1307
+ for (const k in response.headers) {
1308
+ if (response.headers.hasOwnProperty(k)) {
1309
+ _headers[k] = response.headers[k];
1310
+ }
1311
+ }
1312
+ }
1313
+ if (status === 200) {
1314
+ const _responseText = response.data;
1315
+ let result200 = null;
1316
+ let resultData200 = _responseText;
1317
+ result200 = JSON.parse(resultData200);
1318
+ return Promise.resolve(result200);
1319
+ }
1320
+ else if (status === 400) {
1321
+ const _responseText = response.data;
1322
+ let result400 = null;
1323
+ let resultData400 = _responseText;
1324
+ result400 = JSON.parse(resultData400);
1325
+ return throwException("Invalid request payload.", status, _responseText, _headers, result400);
1326
+ }
1327
+ else if (status === 401) {
1328
+ const _responseText = response.data;
1329
+ let result401 = null;
1330
+ let resultData401 = _responseText;
1331
+ result401 = JSON.parse(resultData401);
1332
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
1333
+ }
1334
+ else if (status === 500) {
1335
+ const _responseText = response.data;
1336
+ let result500 = null;
1337
+ let resultData500 = _responseText;
1338
+ result500 = JSON.parse(resultData500);
1339
+ return throwException("Failed to create office.", status, _responseText, _headers, result500);
1340
+ }
1341
+ else if (status !== 200 && status !== 204) {
1342
+ const _responseText = response.data;
1343
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1344
+ }
1345
+ return Promise.resolve(null);
1346
+ }
1347
+ /**
1348
+ * Delete an office.
1349
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
1350
+ * @param body (optional) The office to delete (by OfficeId or ExternalId).
1351
+ * @return Office deleted.
1352
+ */
1353
+ deleteOffice(x_Workspace_ID, body, cancelToken) {
1354
+ let url_ = this.baseUrl + "/v1/offices";
1355
+ url_ = url_.replace(/[?&]$/, "");
1356
+ const content_ = JSON.stringify(body);
1357
+ let options_ = {
1358
+ data: content_,
1359
+ method: "DELETE",
1360
+ url: url_,
1361
+ headers: {
1362
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
1363
+ "Content-Type": "application/json",
1364
+ "Accept": "application/json"
1365
+ },
1366
+ cancelToken
1367
+ };
1368
+ return this.instance.request(options_).catch((_error) => {
1369
+ if (isAxiosError(_error) && _error.response) {
1370
+ return _error.response;
1371
+ }
1372
+ else {
1373
+ throw _error;
1374
+ }
1375
+ }).then((_response) => {
1376
+ return this.processDeleteOffice(_response);
1377
+ });
1378
+ }
1379
+ processDeleteOffice(response) {
1380
+ const status = response.status;
1381
+ let _headers = {};
1382
+ if (response.headers && typeof response.headers === "object") {
1383
+ for (const k in response.headers) {
1384
+ if (response.headers.hasOwnProperty(k)) {
1385
+ _headers[k] = response.headers[k];
1386
+ }
1387
+ }
1388
+ }
1389
+ if (status === 200) {
1390
+ const _responseText = response.data;
1391
+ let result200 = null;
1392
+ let resultData200 = _responseText;
1393
+ result200 = JSON.parse(resultData200);
1394
+ return Promise.resolve(result200);
1395
+ }
1396
+ else if (status === 401) {
1397
+ const _responseText = response.data;
1398
+ let result401 = null;
1399
+ let resultData401 = _responseText;
1400
+ result401 = JSON.parse(resultData401);
1401
+ return throwException("Unauthorized", status, _responseText, _headers, result401);
1402
+ }
1403
+ else if (status === 404) {
1404
+ const _responseText = response.data;
1405
+ let result404 = null;
1406
+ let resultData404 = _responseText;
1407
+ result404 = JSON.parse(resultData404);
1408
+ return throwException("Office not found.", status, _responseText, _headers, result404);
1409
+ }
1410
+ else if (status === 500) {
1411
+ const _responseText = response.data;
1412
+ let result500 = null;
1413
+ let resultData500 = _responseText;
1414
+ result500 = JSON.parse(resultData500);
1415
+ return throwException("Internal Server Error", status, _responseText, _headers, result500);
1416
+ }
1417
+ else if (status !== 200 && status !== 204) {
1418
+ const _responseText = response.data;
1419
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1420
+ }
1421
+ return Promise.resolve(null);
1422
+ }
1423
+ /**
1424
+ * Place an order. Creating orders may take some time and therefor an order request id is returned which can be queried to get the status of the order
1425
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
1426
+ * @param body (optional) The order details including marketing opportunity and product.
1427
+ * @return Order request accepted. Returns the request ID.
1428
+ */
1429
+ createOrder(x_Workspace_ID, body, cancelToken) {
1430
+ let url_ = this.baseUrl + "/v1/orders";
1431
+ url_ = url_.replace(/[?&]$/, "");
1432
+ const content_ = JSON.stringify(body);
1433
+ let options_ = {
1434
+ data: content_,
1435
+ method: "POST",
1436
+ url: url_,
1437
+ headers: {
1438
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
1439
+ "Content-Type": "application/json",
1440
+ "Accept": "application/json"
1441
+ },
1442
+ cancelToken
1443
+ };
1444
+ return this.instance.request(options_).catch((_error) => {
1445
+ if (isAxiosError(_error) && _error.response) {
1446
+ return _error.response;
1447
+ }
1448
+ else {
1449
+ throw _error;
1450
+ }
1451
+ }).then((_response) => {
1452
+ return this.processCreateOrder(_response);
1453
+ });
1454
+ }
1455
+ processCreateOrder(response) {
1456
+ const status = response.status;
1457
+ let _headers = {};
1458
+ if (response.headers && typeof response.headers === "object") {
1459
+ for (const k in response.headers) {
1460
+ if (response.headers.hasOwnProperty(k)) {
1461
+ _headers[k] = response.headers[k];
1462
+ }
1463
+ }
1464
+ }
1465
+ if (status === 200) {
1466
+ const _responseText = response.data;
1467
+ let result200 = null;
1468
+ let resultData200 = _responseText;
1469
+ result200 = JSON.parse(resultData200);
1470
+ return Promise.resolve(result200);
1471
+ }
1472
+ else if (status === 401) {
1473
+ const _responseText = response.data;
1474
+ let result401 = null;
1475
+ let resultData401 = _responseText;
1476
+ result401 = JSON.parse(resultData401);
1477
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
1478
+ }
1479
+ else if (status === 404) {
1480
+ const _responseText = response.data;
1481
+ let result404 = null;
1482
+ let resultData404 = _responseText;
1483
+ result404 = JSON.parse(resultData404);
1484
+ return throwException("Marketing opportunity not found.", status, _responseText, _headers, result404);
1485
+ }
1486
+ else if (status === 500) {
1487
+ const _responseText = response.data;
1488
+ let result500 = null;
1489
+ let resultData500 = _responseText;
1490
+ result500 = JSON.parse(resultData500);
1491
+ return throwException("Failed to place order.", status, _responseText, _headers, result500);
1492
+ }
1493
+ else if (status !== 200 && status !== 204) {
1494
+ const _responseText = response.data;
1495
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1496
+ }
1497
+ return Promise.resolve(null);
1498
+ }
1499
+ /**
1500
+ * Get the status of a previously placed order request.
1501
+ * @param orderRequestId The request ID returned when placing the order.
1502
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
1503
+ * @return The current order status.
1504
+ */
1505
+ getOrderStatus(orderRequestId, x_Workspace_ID, cancelToken) {
1506
+ let url_ = this.baseUrl + "/v1/orders/{orderRequestId}/status";
1507
+ if (orderRequestId === undefined || orderRequestId === null)
1508
+ throw new Error("The parameter 'orderRequestId' must be defined.");
1509
+ url_ = url_.replace("{orderRequestId}", encodeURIComponent("" + orderRequestId));
1510
+ url_ = url_.replace(/[?&]$/, "");
1511
+ let options_ = {
1512
+ method: "GET",
1513
+ url: url_,
1514
+ headers: {
1515
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
1516
+ "Accept": "application/json"
1517
+ },
1518
+ cancelToken
1519
+ };
1520
+ return this.instance.request(options_).catch((_error) => {
1521
+ if (isAxiosError(_error) && _error.response) {
1522
+ return _error.response;
1523
+ }
1524
+ else {
1525
+ throw _error;
1526
+ }
1527
+ }).then((_response) => {
1528
+ return this.processGetOrderStatus(_response);
1529
+ });
1530
+ }
1531
+ processGetOrderStatus(response) {
1532
+ const status = response.status;
1533
+ let _headers = {};
1534
+ if (response.headers && typeof response.headers === "object") {
1535
+ for (const k in response.headers) {
1536
+ if (response.headers.hasOwnProperty(k)) {
1537
+ _headers[k] = response.headers[k];
1538
+ }
1539
+ }
1540
+ }
1541
+ if (status === 200) {
1542
+ const _responseText = response.data;
1543
+ let result200 = null;
1544
+ let resultData200 = _responseText;
1545
+ result200 = JSON.parse(resultData200);
1546
+ return Promise.resolve(result200);
1547
+ }
1548
+ else if (status === 401) {
1549
+ const _responseText = response.data;
1550
+ let result401 = null;
1551
+ let resultData401 = _responseText;
1552
+ result401 = JSON.parse(resultData401);
1553
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
1554
+ }
1555
+ else if (status === 404) {
1556
+ const _responseText = response.data;
1557
+ let result404 = null;
1558
+ let resultData404 = _responseText;
1559
+ result404 = JSON.parse(resultData404);
1560
+ return throwException("Order request not found.", status, _responseText, _headers, result404);
1561
+ }
1562
+ else if (status !== 200 && status !== 204) {
1563
+ const _responseText = response.data;
1564
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1565
+ }
1566
+ return Promise.resolve(null);
1567
+ }
1568
+ /**
1569
+ * Get a list of all orders with optional filters.
1570
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
1571
+ * @param body (optional) Filter and pagination options.
1572
+ * @return Paginated list of orders.
1573
+ */
1574
+ queryOrders(x_Workspace_ID, body, cancelToken) {
1575
+ let url_ = this.baseUrl + "/v1/orders/query";
1576
+ url_ = url_.replace(/[?&]$/, "");
1577
+ const content_ = JSON.stringify(body);
1578
+ let options_ = {
1579
+ data: content_,
1580
+ method: "POST",
1581
+ url: url_,
1582
+ headers: {
1583
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
1584
+ "Content-Type": "application/json",
1585
+ "Accept": "application/json"
1586
+ },
1587
+ cancelToken
1588
+ };
1589
+ return this.instance.request(options_).catch((_error) => {
1590
+ if (isAxiosError(_error) && _error.response) {
1591
+ return _error.response;
1592
+ }
1593
+ else {
1594
+ throw _error;
1595
+ }
1596
+ }).then((_response) => {
1597
+ return this.processQueryOrders(_response);
1598
+ });
1599
+ }
1600
+ processQueryOrders(response) {
1601
+ const status = response.status;
1602
+ let _headers = {};
1603
+ if (response.headers && typeof response.headers === "object") {
1604
+ for (const k in response.headers) {
1605
+ if (response.headers.hasOwnProperty(k)) {
1606
+ _headers[k] = response.headers[k];
1607
+ }
1608
+ }
1609
+ }
1610
+ if (status === 200) {
1611
+ const _responseText = response.data;
1612
+ let result200 = null;
1613
+ let resultData200 = _responseText;
1614
+ result200 = JSON.parse(resultData200);
1615
+ return Promise.resolve(result200);
1616
+ }
1617
+ else if (status === 401) {
1618
+ const _responseText = response.data;
1619
+ let result401 = null;
1620
+ let resultData401 = _responseText;
1621
+ result401 = JSON.parse(resultData401);
1622
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
1623
+ }
1624
+ else if (status !== 200 && status !== 204) {
1625
+ const _responseText = response.data;
1626
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1627
+ }
1628
+ return Promise.resolve(null);
1629
+ }
1630
+ /**
1631
+ * Get a specific order by ID.
1632
+ * @param orderId The order's Realforce ID.
1633
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
1634
+ * @return The order object.
1635
+ */
1636
+ getOrder(orderId, x_Workspace_ID, cancelToken) {
1637
+ let url_ = this.baseUrl + "/v1/orders/{orderId}";
1638
+ if (orderId === undefined || orderId === null)
1639
+ throw new Error("The parameter 'orderId' must be defined.");
1640
+ url_ = url_.replace("{orderId}", encodeURIComponent("" + orderId));
1641
+ url_ = url_.replace(/[?&]$/, "");
1642
+ let options_ = {
1643
+ method: "GET",
1644
+ url: url_,
1645
+ headers: {
1646
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
1647
+ "Accept": "application/json"
1648
+ },
1649
+ cancelToken
1650
+ };
1651
+ return this.instance.request(options_).catch((_error) => {
1652
+ if (isAxiosError(_error) && _error.response) {
1653
+ return _error.response;
1654
+ }
1655
+ else {
1656
+ throw _error;
1657
+ }
1658
+ }).then((_response) => {
1659
+ return this.processGetOrder(_response);
1660
+ });
1661
+ }
1662
+ processGetOrder(response) {
1663
+ const status = response.status;
1664
+ let _headers = {};
1665
+ if (response.headers && typeof response.headers === "object") {
1666
+ for (const k in response.headers) {
1667
+ if (response.headers.hasOwnProperty(k)) {
1668
+ _headers[k] = response.headers[k];
1669
+ }
1670
+ }
1671
+ }
1672
+ if (status === 200) {
1673
+ const _responseText = response.data;
1674
+ let result200 = null;
1675
+ let resultData200 = _responseText;
1676
+ result200 = JSON.parse(resultData200);
1677
+ return Promise.resolve(result200);
1678
+ }
1679
+ else if (status === 401) {
1680
+ const _responseText = response.data;
1681
+ let result401 = null;
1682
+ let resultData401 = _responseText;
1683
+ result401 = JSON.parse(resultData401);
1684
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
1685
+ }
1686
+ else if (status === 404) {
1687
+ const _responseText = response.data;
1688
+ let result404 = null;
1689
+ let resultData404 = _responseText;
1690
+ result404 = JSON.parse(resultData404);
1691
+ return throwException("Order not found.", status, _responseText, _headers, result404);
1692
+ }
1693
+ else if (status !== 200 && status !== 204) {
1694
+ const _responseText = response.data;
1695
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1696
+ }
1697
+ return Promise.resolve(null);
1698
+ }
1699
+ /**
1700
+ * Get info about the personal access token used to authenticate this request.
1701
+ * @return Personal access token details.
1702
+ */
1703
+ get(cancelToken) {
1704
+ let url_ = this.baseUrl + "/v1/pats/me";
1705
+ url_ = url_.replace(/[?&]$/, "");
1706
+ let options_ = {
1707
+ method: "GET",
1708
+ url: url_,
1709
+ headers: {
1710
+ "Accept": "application/json"
1711
+ },
1712
+ cancelToken
1713
+ };
1714
+ return this.instance.request(options_).catch((_error) => {
1715
+ if (isAxiosError(_error) && _error.response) {
1716
+ return _error.response;
1717
+ }
1718
+ else {
1719
+ throw _error;
1720
+ }
1721
+ }).then((_response) => {
1722
+ return this.processGet(_response);
1723
+ });
1724
+ }
1725
+ processGet(response) {
1726
+ const status = response.status;
1727
+ let _headers = {};
1728
+ if (response.headers && typeof response.headers === "object") {
1729
+ for (const k in response.headers) {
1730
+ if (response.headers.hasOwnProperty(k)) {
1731
+ _headers[k] = response.headers[k];
1732
+ }
1733
+ }
1734
+ }
1735
+ if (status === 200) {
1736
+ const _responseText = response.data;
1737
+ let result200 = null;
1738
+ let resultData200 = _responseText;
1739
+ result200 = JSON.parse(resultData200);
1740
+ return Promise.resolve(result200);
1741
+ }
1742
+ else if (status === 401) {
1743
+ const _responseText = response.data;
1744
+ let result401 = null;
1745
+ let resultData401 = _responseText;
1746
+ result401 = JSON.parse(resultData401);
1747
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
1748
+ }
1749
+ else if (status === 403) {
1750
+ const _responseText = response.data;
1751
+ let result403 = null;
1752
+ let resultData403 = _responseText;
1753
+ result403 = JSON.parse(resultData403);
1754
+ return throwException("Request is not authenticated with a personal access token.", status, _responseText, _headers, result403);
1755
+ }
1756
+ else if (status === 404) {
1757
+ const _responseText = response.data;
1758
+ let result404 = null;
1759
+ let resultData404 = _responseText;
1760
+ result404 = JSON.parse(resultData404);
1761
+ return throwException("The token used to authenticate could not be found (e.g. it was deleted in another request).", status, _responseText, _headers, result404);
1762
+ }
1763
+ else if (status !== 200 && status !== 204) {
1764
+ const _responseText = response.data;
1765
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1766
+ }
1767
+ return Promise.resolve(null);
1768
+ }
1769
+ /**
1770
+ * Revoke the personal access token used to authenticate this request.
1771
+ * @return The token was revoked.
1772
+ */
1773
+ revoke(cancelToken) {
1774
+ let url_ = this.baseUrl + "/v1/pats/me/revoke";
1775
+ url_ = url_.replace(/[?&]$/, "");
1776
+ let options_ = {
1777
+ method: "POST",
1778
+ url: url_,
1779
+ headers: {},
1780
+ cancelToken
1781
+ };
1782
+ return this.instance.request(options_).catch((_error) => {
1783
+ if (isAxiosError(_error) && _error.response) {
1784
+ return _error.response;
1785
+ }
1786
+ else {
1787
+ throw _error;
1788
+ }
1789
+ }).then((_response) => {
1790
+ return this.processRevoke(_response);
1791
+ });
1792
+ }
1793
+ processRevoke(response) {
1794
+ const status = response.status;
1795
+ let _headers = {};
1796
+ if (response.headers && typeof response.headers === "object") {
1797
+ for (const k in response.headers) {
1798
+ if (response.headers.hasOwnProperty(k)) {
1799
+ _headers[k] = response.headers[k];
1800
+ }
1801
+ }
1802
+ }
1803
+ if (status === 204) {
1804
+ const _responseText = response.data;
1805
+ return Promise.resolve(null);
1806
+ }
1807
+ else if (status === 401) {
1808
+ const _responseText = response.data;
1809
+ let result401 = null;
1810
+ let resultData401 = _responseText;
1811
+ result401 = JSON.parse(resultData401);
1812
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
1813
+ }
1814
+ else if (status === 403) {
1815
+ const _responseText = response.data;
1816
+ let result403 = null;
1817
+ let resultData403 = _responseText;
1818
+ result403 = JSON.parse(resultData403);
1819
+ return throwException("Request is not authenticated with a personal access token.", status, _responseText, _headers, result403);
1820
+ }
1821
+ else if (status === 404) {
1822
+ const _responseText = response.data;
1823
+ let result404 = null;
1824
+ let resultData404 = _responseText;
1825
+ result404 = JSON.parse(resultData404);
1826
+ return throwException("The token used to authenticate could not be found.", status, _responseText, _headers, result404);
1827
+ }
1828
+ else if (status !== 200 && status !== 204) {
1829
+ const _responseText = response.data;
1830
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1831
+ }
1832
+ return Promise.resolve(null);
1833
+ }
1834
+ /**
1835
+ * Rotate the personal access token used to authenticate this request.
1836
+ * @return The new token was issued. The response body contains the only copy of the new secret.
1837
+ */
1838
+ rotate(cancelToken) {
1839
+ let url_ = this.baseUrl + "/v1/pats/me/rotate";
1840
+ url_ = url_.replace(/[?&]$/, "");
1841
+ let options_ = {
1842
+ method: "POST",
1843
+ url: url_,
1844
+ headers: {
1845
+ "Accept": "application/json"
1846
+ },
1847
+ cancelToken
1848
+ };
1849
+ return this.instance.request(options_).catch((_error) => {
1850
+ if (isAxiosError(_error) && _error.response) {
1851
+ return _error.response;
1852
+ }
1853
+ else {
1854
+ throw _error;
1855
+ }
1856
+ }).then((_response) => {
1857
+ return this.processRotate(_response);
1858
+ });
1859
+ }
1860
+ processRotate(response) {
1861
+ const status = response.status;
1862
+ let _headers = {};
1863
+ if (response.headers && typeof response.headers === "object") {
1864
+ for (const k in response.headers) {
1865
+ if (response.headers.hasOwnProperty(k)) {
1866
+ _headers[k] = response.headers[k];
1867
+ }
1868
+ }
1869
+ }
1870
+ if (status === 200) {
1871
+ const _responseText = response.data;
1872
+ let result200 = null;
1873
+ let resultData200 = _responseText;
1874
+ result200 = JSON.parse(resultData200);
1875
+ return Promise.resolve(result200);
1876
+ }
1877
+ else if (status === 401) {
1878
+ const _responseText = response.data;
1879
+ let result401 = null;
1880
+ let resultData401 = _responseText;
1881
+ result401 = JSON.parse(resultData401);
1882
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
1883
+ }
1884
+ else if (status === 403) {
1885
+ const _responseText = response.data;
1886
+ let result403 = null;
1887
+ let resultData403 = _responseText;
1888
+ result403 = JSON.parse(resultData403);
1889
+ return throwException("Request is not authenticated with a personal access token.", status, _responseText, _headers, result403);
1890
+ }
1891
+ else if (status === 404) {
1892
+ const _responseText = response.data;
1893
+ let result404 = null;
1894
+ let resultData404 = _responseText;
1895
+ result404 = JSON.parse(resultData404);
1896
+ return throwException("The token used to authenticate could not be found, or has already been revoked.", status, _responseText, _headers, result404);
1897
+ }
1898
+ else if (status !== 200 && status !== 204) {
1899
+ const _responseText = response.data;
1900
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1901
+ }
1902
+ return Promise.resolve(null);
1903
+ }
1904
+ /**
1905
+ * Returns a list of products.
1906
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
1907
+ * @param body (optional) Filter and pagination options.
1908
+ * @return Paginated list of products.
1909
+ */
1910
+ queryProducts(x_Workspace_ID, body, cancelToken) {
1911
+ let url_ = this.baseUrl + "/v1/products/query";
1912
+ url_ = url_.replace(/[?&]$/, "");
1913
+ const content_ = JSON.stringify(body);
1914
+ let options_ = {
1915
+ data: content_,
1916
+ method: "POST",
1917
+ url: url_,
1918
+ headers: {
1919
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
1920
+ "Content-Type": "application/json",
1921
+ "Accept": "application/json"
1922
+ },
1923
+ cancelToken
1924
+ };
1925
+ return this.instance.request(options_).catch((_error) => {
1926
+ if (isAxiosError(_error) && _error.response) {
1927
+ return _error.response;
1928
+ }
1929
+ else {
1930
+ throw _error;
1931
+ }
1932
+ }).then((_response) => {
1933
+ return this.processQueryProducts(_response);
1934
+ });
1935
+ }
1936
+ processQueryProducts(response) {
1937
+ const status = response.status;
1938
+ let _headers = {};
1939
+ if (response.headers && typeof response.headers === "object") {
1940
+ for (const k in response.headers) {
1941
+ if (response.headers.hasOwnProperty(k)) {
1942
+ _headers[k] = response.headers[k];
1943
+ }
1944
+ }
1945
+ }
1946
+ if (status === 200) {
1947
+ const _responseText = response.data;
1948
+ let result200 = null;
1949
+ let resultData200 = _responseText;
1950
+ result200 = JSON.parse(resultData200);
1951
+ return Promise.resolve(result200);
1952
+ }
1953
+ else if (status === 401) {
1954
+ const _responseText = response.data;
1955
+ let result401 = null;
1956
+ let resultData401 = _responseText;
1957
+ result401 = JSON.parse(resultData401);
1958
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
1959
+ }
1960
+ else if (status !== 200 && status !== 204) {
1961
+ const _responseText = response.data;
1962
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1963
+ }
1964
+ return Promise.resolve(null);
1965
+ }
1966
+ /**
1967
+ * Get data about a specific property.
1968
+ * @param propertyId The property's Realforce ID.
1969
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
1970
+ * @return The property object.
1971
+ */
1972
+ getProperty(propertyId, x_Workspace_ID, cancelToken) {
1973
+ let url_ = this.baseUrl + "/v1/properties/{propertyId}";
1974
+ if (propertyId === undefined || propertyId === null)
1975
+ throw new Error("The parameter 'propertyId' must be defined.");
1976
+ url_ = url_.replace("{propertyId}", encodeURIComponent("" + propertyId));
1977
+ url_ = url_.replace(/[?&]$/, "");
1978
+ let options_ = {
1979
+ method: "GET",
1980
+ url: url_,
1981
+ headers: {
1982
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
1983
+ "Accept": "application/json"
1984
+ },
1985
+ cancelToken
1986
+ };
1987
+ return this.instance.request(options_).catch((_error) => {
1988
+ if (isAxiosError(_error) && _error.response) {
1989
+ return _error.response;
1990
+ }
1991
+ else {
1992
+ throw _error;
1993
+ }
1994
+ }).then((_response) => {
1995
+ return this.processGetProperty(_response);
1996
+ });
1997
+ }
1998
+ processGetProperty(response) {
1999
+ const status = response.status;
2000
+ let _headers = {};
2001
+ if (response.headers && typeof response.headers === "object") {
2002
+ for (const k in response.headers) {
2003
+ if (response.headers.hasOwnProperty(k)) {
2004
+ _headers[k] = response.headers[k];
2005
+ }
2006
+ }
2007
+ }
2008
+ if (status === 200) {
2009
+ const _responseText = response.data;
2010
+ let result200 = null;
2011
+ let resultData200 = _responseText;
2012
+ result200 = JSON.parse(resultData200);
2013
+ return Promise.resolve(result200);
2014
+ }
2015
+ else if (status === 401) {
2016
+ const _responseText = response.data;
2017
+ let result401 = null;
2018
+ let resultData401 = _responseText;
2019
+ result401 = JSON.parse(resultData401);
2020
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
2021
+ }
2022
+ else if (status === 404) {
2023
+ const _responseText = response.data;
2024
+ let result404 = null;
2025
+ let resultData404 = _responseText;
2026
+ result404 = JSON.parse(resultData404);
2027
+ return throwException("Property not found.", status, _responseText, _headers, result404);
2028
+ }
2029
+ else if (status !== 200 && status !== 204) {
2030
+ const _responseText = response.data;
2031
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2032
+ }
2033
+ return Promise.resolve(null);
2034
+ }
2035
+ /**
2036
+ * Update a property with the specified PropertyId.
2037
+ * @param propertyId The property's Realforce ID.
2038
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
2039
+ * @param body (optional) The property fields to update. Only fields included in the body are changed.
2040
+ * @return Property updated. Returns the property ID.
2041
+ */
2042
+ putProperty(propertyId, x_Workspace_ID, body, cancelToken) {
2043
+ let url_ = this.baseUrl + "/v1/properties/{propertyId}";
2044
+ if (propertyId === undefined || propertyId === null)
2045
+ throw new Error("The parameter 'propertyId' must be defined.");
2046
+ url_ = url_.replace("{propertyId}", encodeURIComponent("" + propertyId));
2047
+ url_ = url_.replace(/[?&]$/, "");
2048
+ const content_ = JSON.stringify(body);
2049
+ let options_ = {
2050
+ data: content_,
2051
+ method: "PUT",
2052
+ url: url_,
2053
+ headers: {
2054
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
2055
+ "Content-Type": "application/json",
2056
+ "Accept": "application/json"
2057
+ },
2058
+ cancelToken
2059
+ };
2060
+ return this.instance.request(options_).catch((_error) => {
2061
+ if (isAxiosError(_error) && _error.response) {
2062
+ return _error.response;
2063
+ }
2064
+ else {
2065
+ throw _error;
2066
+ }
2067
+ }).then((_response) => {
2068
+ return this.processPutProperty(_response);
2069
+ });
2070
+ }
2071
+ processPutProperty(response) {
2072
+ const status = response.status;
2073
+ let _headers = {};
2074
+ if (response.headers && typeof response.headers === "object") {
2075
+ for (const k in response.headers) {
2076
+ if (response.headers.hasOwnProperty(k)) {
2077
+ _headers[k] = response.headers[k];
2078
+ }
2079
+ }
2080
+ }
2081
+ if (status === 200) {
2082
+ const _responseText = response.data;
2083
+ let result200 = null;
2084
+ let resultData200 = _responseText;
2085
+ result200 = JSON.parse(resultData200);
2086
+ return Promise.resolve(result200);
2087
+ }
2088
+ else if (status === 400) {
2089
+ const _responseText = response.data;
2090
+ let result400 = null;
2091
+ let resultData400 = _responseText;
2092
+ result400 = JSON.parse(resultData400);
2093
+ return throwException("Validation error.", status, _responseText, _headers, result400);
2094
+ }
2095
+ else if (status === 401) {
2096
+ const _responseText = response.data;
2097
+ let result401 = null;
2098
+ let resultData401 = _responseText;
2099
+ result401 = JSON.parse(resultData401);
2100
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
2101
+ }
2102
+ else if (status === 404) {
2103
+ const _responseText = response.data;
2104
+ let result404 = null;
2105
+ let resultData404 = _responseText;
2106
+ result404 = JSON.parse(resultData404);
2107
+ return throwException("Property not found.", status, _responseText, _headers, result404);
2108
+ }
2109
+ else if (status === 500) {
2110
+ const _responseText = response.data;
2111
+ let result500 = null;
2112
+ let resultData500 = _responseText;
2113
+ result500 = JSON.parse(resultData500);
2114
+ return throwException("Failed to update the property.", status, _responseText, _headers, result500);
2115
+ }
2116
+ else if (status !== 200 && status !== 204) {
2117
+ const _responseText = response.data;
2118
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2119
+ }
2120
+ return Promise.resolve(null);
2121
+ }
2122
+ /**
2123
+ * Create a property. If a property with the same unique identifier already exists, the existing property will be updated.
2124
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
2125
+ * @param body (optional) The property data to create or update.
2126
+ * @return Property created or updated. Returns the property ID.
2127
+ */
2128
+ postProperty(x_Workspace_ID, body, cancelToken) {
2129
+ let url_ = this.baseUrl + "/v1/properties";
2130
+ url_ = url_.replace(/[?&]$/, "");
2131
+ const content_ = JSON.stringify(body);
2132
+ let options_ = {
2133
+ data: content_,
2134
+ method: "POST",
2135
+ url: url_,
2136
+ headers: {
2137
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
2138
+ "Content-Type": "application/json",
2139
+ "Accept": "application/json"
2140
+ },
2141
+ cancelToken
2142
+ };
2143
+ return this.instance.request(options_).catch((_error) => {
2144
+ if (isAxiosError(_error) && _error.response) {
2145
+ return _error.response;
2146
+ }
2147
+ else {
2148
+ throw _error;
2149
+ }
2150
+ }).then((_response) => {
2151
+ return this.processPostProperty(_response);
2152
+ });
2153
+ }
2154
+ processPostProperty(response) {
2155
+ const status = response.status;
2156
+ let _headers = {};
2157
+ if (response.headers && typeof response.headers === "object") {
2158
+ for (const k in response.headers) {
2159
+ if (response.headers.hasOwnProperty(k)) {
2160
+ _headers[k] = response.headers[k];
2161
+ }
2162
+ }
2163
+ }
2164
+ if (status === 200) {
2165
+ const _responseText = response.data;
2166
+ let result200 = null;
2167
+ let resultData200 = _responseText;
2168
+ result200 = JSON.parse(resultData200);
2169
+ return Promise.resolve(result200);
2170
+ }
2171
+ else if (status === 400) {
2172
+ const _responseText = response.data;
2173
+ let result400 = null;
2174
+ let resultData400 = _responseText;
2175
+ result400 = JSON.parse(resultData400);
2176
+ return throwException("Validation error \u2014 check RequireEither constraints.", status, _responseText, _headers, result400);
2177
+ }
2178
+ else if (status === 401) {
2179
+ const _responseText = response.data;
2180
+ let result401 = null;
2181
+ let resultData401 = _responseText;
2182
+ result401 = JSON.parse(resultData401);
2183
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
2184
+ }
2185
+ else if (status === 500) {
2186
+ const _responseText = response.data;
2187
+ let result500 = null;
2188
+ let resultData500 = _responseText;
2189
+ result500 = JSON.parse(resultData500);
2190
+ return throwException("Failed to create or update the property.", status, _responseText, _headers, result500);
2191
+ }
2192
+ else if (status !== 200 && status !== 204) {
2193
+ const _responseText = response.data;
2194
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2195
+ }
2196
+ return Promise.resolve(null);
2197
+ }
2198
+ /**
2199
+ * Delete a property.
2200
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
2201
+ * @param body (optional) The property to delete (by PropertyId or ExternalId).
2202
+ * @return Property deleted.
2203
+ */
2204
+ deleteProperty(x_Workspace_ID, body, cancelToken) {
2205
+ let url_ = this.baseUrl + "/v1/properties";
2206
+ url_ = url_.replace(/[?&]$/, "");
2207
+ const content_ = JSON.stringify(body);
2208
+ let options_ = {
2209
+ data: content_,
2210
+ method: "DELETE",
2211
+ url: url_,
2212
+ headers: {
2213
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
2214
+ "Content-Type": "application/json",
2215
+ "Accept": "application/json"
2216
+ },
2217
+ cancelToken
2218
+ };
2219
+ return this.instance.request(options_).catch((_error) => {
2220
+ if (isAxiosError(_error) && _error.response) {
2221
+ return _error.response;
2222
+ }
2223
+ else {
2224
+ throw _error;
2225
+ }
2226
+ }).then((_response) => {
2227
+ return this.processDeleteProperty(_response);
2228
+ });
2229
+ }
2230
+ processDeleteProperty(response) {
2231
+ const status = response.status;
2232
+ let _headers = {};
2233
+ if (response.headers && typeof response.headers === "object") {
2234
+ for (const k in response.headers) {
2235
+ if (response.headers.hasOwnProperty(k)) {
2236
+ _headers[k] = response.headers[k];
2237
+ }
2238
+ }
2239
+ }
2240
+ if (status === 200) {
2241
+ const _responseText = response.data;
2242
+ let result200 = null;
2243
+ let resultData200 = _responseText;
2244
+ result200 = JSON.parse(resultData200);
2245
+ return Promise.resolve(result200);
2246
+ }
2247
+ else if (status === 401) {
2248
+ const _responseText = response.data;
2249
+ let result401 = null;
2250
+ let resultData401 = _responseText;
2251
+ result401 = JSON.parse(resultData401);
2252
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
2253
+ }
2254
+ else if (status === 404) {
2255
+ const _responseText = response.data;
2256
+ let result404 = null;
2257
+ let resultData404 = _responseText;
2258
+ result404 = JSON.parse(resultData404);
2259
+ return throwException("Property not found.", status, _responseText, _headers, result404);
2260
+ }
2261
+ else if (status === 500) {
2262
+ const _responseText = response.data;
2263
+ let result500 = null;
2264
+ let resultData500 = _responseText;
2265
+ result500 = JSON.parse(resultData500);
2266
+ return throwException("Failed to delete the property.", status, _responseText, _headers, result500);
2267
+ }
2268
+ else if (status !== 200 && status !== 204) {
2269
+ const _responseText = response.data;
2270
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2271
+ }
2272
+ return Promise.resolve(null);
2273
+ }
2274
+ /**
2275
+ * Apply a single set of values to many properties in one request.
2276
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
2277
+ * @param body (optional) Targets and the values to apply to each.
2278
+ * @return Batch processed. Inspect each `result.status` for individual outcomes.
2279
+ */
2280
+ batchUpdateProperties(x_Workspace_ID, body, cancelToken) {
2281
+ let url_ = this.baseUrl + "/v1/properties/batch";
2282
+ url_ = url_.replace(/[?&]$/, "");
2283
+ const content_ = JSON.stringify(body);
2284
+ let options_ = {
2285
+ data: content_,
2286
+ method: "POST",
2287
+ url: url_,
2288
+ headers: {
2289
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
2290
+ "Content-Type": "application/json",
2291
+ "Accept": "application/json"
2292
+ },
2293
+ cancelToken
2294
+ };
2295
+ return this.instance.request(options_).catch((_error) => {
2296
+ if (isAxiosError(_error) && _error.response) {
2297
+ return _error.response;
2298
+ }
2299
+ else {
2300
+ throw _error;
2301
+ }
2302
+ }).then((_response) => {
2303
+ return this.processBatchUpdateProperties(_response);
2304
+ });
2305
+ }
2306
+ processBatchUpdateProperties(response) {
2307
+ const status = response.status;
2308
+ let _headers = {};
2309
+ if (response.headers && typeof response.headers === "object") {
2310
+ for (const k in response.headers) {
2311
+ if (response.headers.hasOwnProperty(k)) {
2312
+ _headers[k] = response.headers[k];
2313
+ }
2314
+ }
2315
+ }
2316
+ if (status === 200) {
2317
+ const _responseText = response.data;
2318
+ let result200 = null;
2319
+ let resultData200 = _responseText;
2320
+ result200 = JSON.parse(resultData200);
2321
+ return Promise.resolve(result200);
2322
+ }
2323
+ else if (status === 400) {
2324
+ const _responseText = response.data;
2325
+ let result400 = null;
2326
+ let resultData400 = _responseText;
2327
+ result400 = JSON.parse(resultData400);
2328
+ return throwException("Request shape invalid \u2014 no targets, exceeds 500 combined identifiers, or missing `update`.", status, _responseText, _headers, result400);
2329
+ }
2330
+ else if (status === 401) {
2331
+ const _responseText = response.data;
2332
+ let result401 = null;
2333
+ let resultData401 = _responseText;
2334
+ result401 = JSON.parse(resultData401);
2335
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
2336
+ }
2337
+ else if (status !== 200 && status !== 204) {
2338
+ const _responseText = response.data;
2339
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2340
+ }
2341
+ return Promise.resolve(null);
2342
+ }
2343
+ /**
2344
+ * Get a list of all properties and their data.
2345
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
2346
+ * @param body (optional) Filter and pagination options.
2347
+ * @return Paginated list of properties.
2348
+ */
2349
+ queryProperties(x_Workspace_ID, body, cancelToken) {
2350
+ let url_ = this.baseUrl + "/v1/properties/query";
2351
+ url_ = url_.replace(/[?&]$/, "");
2352
+ const content_ = JSON.stringify(body);
2353
+ let options_ = {
2354
+ data: content_,
2355
+ method: "POST",
2356
+ url: url_,
2357
+ headers: {
2358
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
2359
+ "Content-Type": "application/json",
2360
+ "Accept": "application/json"
2361
+ },
2362
+ cancelToken
2363
+ };
2364
+ return this.instance.request(options_).catch((_error) => {
2365
+ if (isAxiosError(_error) && _error.response) {
2366
+ return _error.response;
2367
+ }
2368
+ else {
2369
+ throw _error;
2370
+ }
2371
+ }).then((_response) => {
2372
+ return this.processQueryProperties(_response);
2373
+ });
2374
+ }
2375
+ processQueryProperties(response) {
2376
+ const status = response.status;
2377
+ let _headers = {};
2378
+ if (response.headers && typeof response.headers === "object") {
2379
+ for (const k in response.headers) {
2380
+ if (response.headers.hasOwnProperty(k)) {
2381
+ _headers[k] = response.headers[k];
2382
+ }
2383
+ }
2384
+ }
2385
+ if (status === 200) {
2386
+ const _responseText = response.data;
2387
+ let result200 = null;
2388
+ let resultData200 = _responseText;
2389
+ result200 = JSON.parse(resultData200);
2390
+ return Promise.resolve(result200);
2391
+ }
2392
+ else if (status === 401) {
2393
+ const _responseText = response.data;
2394
+ let result401 = null;
2395
+ let resultData401 = _responseText;
2396
+ result401 = JSON.parse(resultData401);
2397
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
2398
+ }
2399
+ else if (status !== 200 && status !== 204) {
2400
+ const _responseText = response.data;
2401
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2402
+ }
2403
+ return Promise.resolve(null);
2404
+ }
2405
+ /**
2406
+ * Generates a URL to be returned to the customer where a token is attached.
2407
+ * @param propertyId The property's Realforce ID.
2408
+ * @param emailAddress The email address of the seller.
2409
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
2410
+ * @return Returns the invite URL.
2411
+ */
2412
+ postInviteSeller(propertyId, emailAddress, x_Workspace_ID, cancelToken) {
2413
+ let url_ = this.baseUrl + "/v1/properties/{propertyId}/invite-seller?";
2414
+ if (propertyId === undefined || propertyId === null)
2415
+ throw new Error("The parameter 'propertyId' must be defined.");
2416
+ url_ = url_.replace("{propertyId}", encodeURIComponent("" + propertyId));
2417
+ if (emailAddress === undefined || emailAddress === null)
2418
+ throw new Error("The parameter 'emailAddress' must be defined and cannot be null.");
2419
+ else
2420
+ url_ += "emailAddress=" + encodeURIComponent("" + emailAddress) + "&";
2421
+ url_ = url_.replace(/[?&]$/, "");
2422
+ let options_ = {
2423
+ method: "POST",
2424
+ url: url_,
2425
+ headers: {
2426
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
2427
+ "Accept": "application/json"
2428
+ },
2429
+ cancelToken
2430
+ };
2431
+ return this.instance.request(options_).catch((_error) => {
2432
+ if (isAxiosError(_error) && _error.response) {
2433
+ return _error.response;
2434
+ }
2435
+ else {
2436
+ throw _error;
2437
+ }
2438
+ }).then((_response) => {
2439
+ return this.processPostInviteSeller(_response);
2440
+ });
2441
+ }
2442
+ processPostInviteSeller(response) {
2443
+ const status = response.status;
2444
+ let _headers = {};
2445
+ if (response.headers && typeof response.headers === "object") {
2446
+ for (const k in response.headers) {
2447
+ if (response.headers.hasOwnProperty(k)) {
2448
+ _headers[k] = response.headers[k];
2449
+ }
2450
+ }
2451
+ }
2452
+ if (status === 200) {
2453
+ const _responseText = response.data;
2454
+ let result200 = null;
2455
+ let resultData200 = _responseText;
2456
+ result200 = JSON.parse(resultData200);
2457
+ return Promise.resolve(result200);
2458
+ }
2459
+ else if (status === 400) {
2460
+ const _responseText = response.data;
2461
+ let result400 = null;
2462
+ let resultData400 = _responseText;
2463
+ result400 = JSON.parse(resultData400);
2464
+ return throwException("Email address was not provided.", status, _responseText, _headers, result400);
2465
+ }
2466
+ else if (status === 401) {
2467
+ const _responseText = response.data;
2468
+ let result401 = null;
2469
+ let resultData401 = _responseText;
2470
+ result401 = JSON.parse(resultData401);
2471
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
2472
+ }
2473
+ else if (status === 404) {
2474
+ const _responseText = response.data;
2475
+ let result404 = null;
2476
+ let resultData404 = _responseText;
2477
+ result404 = JSON.parse(resultData404);
2478
+ return throwException("Property not found.", status, _responseText, _headers, result404);
2479
+ }
2480
+ else if (status !== 200 && status !== 204) {
2481
+ const _responseText = response.data;
2482
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2483
+ }
2484
+ return Promise.resolve(null);
2485
+ }
2486
+ /**
2487
+ * List all triggers configured for the current workspace.
2488
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
2489
+ * @return The list of configured triggers.
2490
+ */
2491
+ getTriggersForWorkspace(x_Workspace_ID, cancelToken) {
2492
+ let url_ = this.baseUrl + "/v1/triggers";
2493
+ url_ = url_.replace(/[?&]$/, "");
2494
+ let options_ = {
2495
+ method: "GET",
2496
+ url: url_,
2497
+ headers: {
2498
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
2499
+ "Accept": "application/json"
2500
+ },
2501
+ cancelToken
2502
+ };
2503
+ return this.instance.request(options_).catch((_error) => {
2504
+ if (isAxiosError(_error) && _error.response) {
2505
+ return _error.response;
2506
+ }
2507
+ else {
2508
+ throw _error;
2509
+ }
2510
+ }).then((_response) => {
2511
+ return this.processGetTriggersForWorkspace(_response);
2512
+ });
2513
+ }
2514
+ processGetTriggersForWorkspace(response) {
2515
+ const status = response.status;
2516
+ let _headers = {};
2517
+ if (response.headers && typeof response.headers === "object") {
2518
+ for (const k in response.headers) {
2519
+ if (response.headers.hasOwnProperty(k)) {
2520
+ _headers[k] = response.headers[k];
2521
+ }
2522
+ }
2523
+ }
2524
+ if (status === 200) {
2525
+ const _responseText = response.data;
2526
+ let result200 = null;
2527
+ let resultData200 = _responseText;
2528
+ result200 = JSON.parse(resultData200);
2529
+ return Promise.resolve(result200);
2530
+ }
2531
+ else if (status === 401) {
2532
+ const _responseText = response.data;
2533
+ let result401 = null;
2534
+ let resultData401 = _responseText;
2535
+ result401 = JSON.parse(resultData401);
2536
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
2537
+ }
2538
+ else if (status === 204) {
2539
+ const _responseText = response.data;
2540
+ return throwException("No triggers are configured for this workspace.", status, _responseText, _headers);
2541
+ }
2542
+ else if (status !== 200 && status !== 204) {
2543
+ const _responseText = response.data;
2544
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2545
+ }
2546
+ return Promise.resolve(null);
2547
+ }
2548
+ /**
2549
+ * Fire a trigger against a resolved subject.
2550
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
2551
+ * @param body (optional) Subject type, trigger ID, and lookup criteria (subjectId or externalId).
2552
+ * @return Trigger fired. Returns the resolved subject and request ID.
2553
+ */
2554
+ postTriggerByFilter(x_Workspace_ID, body, cancelToken) {
2555
+ let url_ = this.baseUrl + "/v1/triggers";
2556
+ url_ = url_.replace(/[?&]$/, "");
2557
+ const content_ = JSON.stringify(body);
2558
+ let options_ = {
2559
+ data: content_,
2560
+ method: "POST",
2561
+ url: url_,
2562
+ headers: {
2563
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
2564
+ "Content-Type": "application/json",
2565
+ "Accept": "application/json"
2566
+ },
2567
+ cancelToken
2568
+ };
2569
+ return this.instance.request(options_).catch((_error) => {
2570
+ if (isAxiosError(_error) && _error.response) {
2571
+ return _error.response;
2572
+ }
2573
+ else {
2574
+ throw _error;
2575
+ }
2576
+ }).then((_response) => {
2577
+ return this.processPostTriggerByFilter(_response);
2578
+ });
2579
+ }
2580
+ processPostTriggerByFilter(response) {
2581
+ const status = response.status;
2582
+ let _headers = {};
2583
+ if (response.headers && typeof response.headers === "object") {
2584
+ for (const k in response.headers) {
2585
+ if (response.headers.hasOwnProperty(k)) {
2586
+ _headers[k] = response.headers[k];
2587
+ }
2588
+ }
2589
+ }
2590
+ if (status === 200) {
2591
+ const _responseText = response.data;
2592
+ let result200 = null;
2593
+ let resultData200 = _responseText;
2594
+ result200 = JSON.parse(resultData200);
2595
+ return Promise.resolve(result200);
2596
+ }
2597
+ else if (status === 400) {
2598
+ const _responseText = response.data;
2599
+ let result400 = null;
2600
+ let resultData400 = _responseText;
2601
+ result400 = JSON.parse(resultData400);
2602
+ return throwException("Neither `subjectId` nor `externalId` was provided.", status, _responseText, _headers, result400);
2603
+ }
2604
+ else if (status === 401) {
2605
+ const _responseText = response.data;
2606
+ let result401 = null;
2607
+ let resultData401 = _responseText;
2608
+ result401 = JSON.parse(resultData401);
2609
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
2610
+ }
2611
+ else if (status === 404) {
2612
+ const _responseText = response.data;
2613
+ let result404 = null;
2614
+ let resultData404 = _responseText;
2615
+ result404 = JSON.parse(resultData404);
2616
+ return throwException("No subject matched the lookup criteria.", status, _responseText, _headers, result404);
2617
+ }
2618
+ else if (status === 500) {
2619
+ const _responseText = response.data;
2620
+ let result500 = null;
2621
+ let resultData500 = _responseText;
2622
+ result500 = JSON.parse(resultData500);
2623
+ return throwException("Failed to emit the trigger.", status, _responseText, _headers, result500);
2624
+ }
2625
+ else if (status !== 200 && status !== 204) {
2626
+ const _responseText = response.data;
2627
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2628
+ }
2629
+ return Promise.resolve(null);
2630
+ }
2631
+ /**
2632
+ * Get the profile of the authenticated user.
2633
+ * @return The user profile.
2634
+ */
2635
+ getUserProfile(cancelToken) {
2636
+ let url_ = this.baseUrl + "/v1/users/profile";
2637
+ url_ = url_.replace(/[?&]$/, "");
2638
+ let options_ = {
2639
+ method: "GET",
2640
+ url: url_,
2641
+ headers: {
2642
+ "Accept": "application/json"
2643
+ },
2644
+ cancelToken
2645
+ };
2646
+ return this.instance.request(options_).catch((_error) => {
2647
+ if (isAxiosError(_error) && _error.response) {
2648
+ return _error.response;
2649
+ }
2650
+ else {
2651
+ throw _error;
2652
+ }
2653
+ }).then((_response) => {
2654
+ return this.processGetUserProfile(_response);
2655
+ });
2656
+ }
2657
+ processGetUserProfile(response) {
2658
+ const status = response.status;
2659
+ let _headers = {};
2660
+ if (response.headers && typeof response.headers === "object") {
2661
+ for (const k in response.headers) {
2662
+ if (response.headers.hasOwnProperty(k)) {
2663
+ _headers[k] = response.headers[k];
2664
+ }
2665
+ }
2666
+ }
2667
+ if (status === 200) {
2668
+ const _responseText = response.data;
2669
+ let result200 = null;
2670
+ let resultData200 = _responseText;
2671
+ result200 = JSON.parse(resultData200);
2672
+ return Promise.resolve(result200);
2673
+ }
2674
+ else if (status === 401) {
2675
+ const _responseText = response.data;
2676
+ let result401 = null;
2677
+ let resultData401 = _responseText;
2678
+ result401 = JSON.parse(resultData401);
2679
+ return throwException("Unable to determine user identity.", status, _responseText, _headers, result401);
2680
+ }
2681
+ else if (status === 500) {
2682
+ const _responseText = response.data;
2683
+ let result500 = null;
2684
+ let resultData500 = _responseText;
2685
+ result500 = JSON.parse(resultData500);
2686
+ return throwException("Authenticated user could not be resolved on the backend.", status, _responseText, _headers, result500);
2687
+ }
2688
+ else if (status !== 200 && status !== 204) {
2689
+ const _responseText = response.data;
2690
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2691
+ }
2692
+ return Promise.resolve(null);
2693
+ }
2694
+ /**
2695
+ * Returns a list of users.
2696
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
2697
+ * @param body (optional) Filter and pagination options.
2698
+ * @return Paginated list of users.
2699
+ */
2700
+ queryUsers(x_Workspace_ID, body, cancelToken) {
2701
+ let url_ = this.baseUrl + "/v1/users/query";
2702
+ url_ = url_.replace(/[?&]$/, "");
2703
+ const content_ = JSON.stringify(body);
2704
+ let options_ = {
2705
+ data: content_,
2706
+ method: "POST",
2707
+ url: url_,
2708
+ headers: {
2709
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
2710
+ "Content-Type": "application/json",
2711
+ "Accept": "application/json"
2712
+ },
2713
+ cancelToken
2714
+ };
2715
+ return this.instance.request(options_).catch((_error) => {
2716
+ if (isAxiosError(_error) && _error.response) {
2717
+ return _error.response;
2718
+ }
2719
+ else {
2720
+ throw _error;
2721
+ }
2722
+ }).then((_response) => {
2723
+ return this.processQueryUsers(_response);
2724
+ });
2725
+ }
2726
+ processQueryUsers(response) {
2727
+ const status = response.status;
2728
+ let _headers = {};
2729
+ if (response.headers && typeof response.headers === "object") {
2730
+ for (const k in response.headers) {
2731
+ if (response.headers.hasOwnProperty(k)) {
2732
+ _headers[k] = response.headers[k];
2733
+ }
2734
+ }
2735
+ }
2736
+ if (status === 200) {
2737
+ const _responseText = response.data;
2738
+ let result200 = null;
2739
+ let resultData200 = _responseText;
2740
+ result200 = JSON.parse(resultData200);
2741
+ return Promise.resolve(result200);
2742
+ }
2743
+ else if (status === 401) {
2744
+ const _responseText = response.data;
2745
+ let result401 = null;
2746
+ let resultData401 = _responseText;
2747
+ result401 = JSON.parse(resultData401);
2748
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
2749
+ }
2750
+ else if (status !== 200 && status !== 204) {
2751
+ const _responseText = response.data;
2752
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2753
+ }
2754
+ return Promise.resolve(null);
2755
+ }
2756
+ /**
2757
+ * Create a user. If a user with the same email already exists on the workspace, the existing user will be updated.
2758
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
2759
+ * @param body (optional) The user data to create or update.
2760
+ * @return User created or updated. Returns the user ID.
2761
+ */
2762
+ postUser(x_Workspace_ID, body, cancelToken) {
2763
+ let url_ = this.baseUrl + "/v1/users";
2764
+ url_ = url_.replace(/[?&]$/, "");
2765
+ const content_ = JSON.stringify(body);
2766
+ let options_ = {
2767
+ data: content_,
2768
+ method: "POST",
2769
+ url: url_,
2770
+ headers: {
2771
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
2772
+ "Content-Type": "application/json",
2773
+ "Accept": "application/json"
2774
+ },
2775
+ cancelToken
2776
+ };
2777
+ return this.instance.request(options_).catch((_error) => {
2778
+ if (isAxiosError(_error) && _error.response) {
2779
+ return _error.response;
2780
+ }
2781
+ else {
2782
+ throw _error;
2783
+ }
2784
+ }).then((_response) => {
2785
+ return this.processPostUser(_response);
2786
+ });
2787
+ }
2788
+ processPostUser(response) {
2789
+ const status = response.status;
2790
+ let _headers = {};
2791
+ if (response.headers && typeof response.headers === "object") {
2792
+ for (const k in response.headers) {
2793
+ if (response.headers.hasOwnProperty(k)) {
2794
+ _headers[k] = response.headers[k];
2795
+ }
2796
+ }
2797
+ }
2798
+ if (status === 200) {
2799
+ const _responseText = response.data;
2800
+ let result200 = null;
2801
+ let resultData200 = _responseText;
2802
+ result200 = JSON.parse(resultData200);
2803
+ return Promise.resolve(result200);
2804
+ }
2805
+ else if (status === 400) {
2806
+ const _responseText = response.data;
2807
+ let result400 = null;
2808
+ let resultData400 = _responseText;
2809
+ result400 = JSON.parse(resultData400);
2810
+ return throwException("Invalid request payload.", status, _responseText, _headers, result400);
2811
+ }
2812
+ else if (status === 401) {
2813
+ const _responseText = response.data;
2814
+ let result401 = null;
2815
+ let resultData401 = _responseText;
2816
+ result401 = JSON.parse(resultData401);
2817
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
2818
+ }
2819
+ else if (status === 500) {
2820
+ const _responseText = response.data;
2821
+ let result500 = null;
2822
+ let resultData500 = _responseText;
2823
+ result500 = JSON.parse(resultData500);
2824
+ return throwException("Failed to create or update user.", status, _responseText, _headers, result500);
2825
+ }
2826
+ else if (status !== 200 && status !== 204) {
2827
+ const _responseText = response.data;
2828
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2829
+ }
2830
+ return Promise.resolve(null);
2831
+ }
2832
+ /**
2833
+ * Get information about the workspace associated with the current API token.
2834
+ * @param x_Workspace_ID The workspace ID (GUID) to operate on. Must match one of the workspaces your token has access to.
2835
+ * @return The workspace object.
2836
+ */
2837
+ getWorkspace(x_Workspace_ID, cancelToken) {
2838
+ let url_ = this.baseUrl + "/v1/workspaces";
2839
+ url_ = url_.replace(/[?&]$/, "");
2840
+ let options_ = {
2841
+ method: "GET",
2842
+ url: url_,
2843
+ headers: {
2844
+ "X-Workspace-ID": x_Workspace_ID !== undefined && x_Workspace_ID !== null ? "" + x_Workspace_ID : "",
2845
+ "Accept": "application/json"
2846
+ },
2847
+ cancelToken
2848
+ };
2849
+ return this.instance.request(options_).catch((_error) => {
2850
+ if (isAxiosError(_error) && _error.response) {
2851
+ return _error.response;
2852
+ }
2853
+ else {
2854
+ throw _error;
2855
+ }
2856
+ }).then((_response) => {
2857
+ return this.processGetWorkspace(_response);
2858
+ });
2859
+ }
2860
+ processGetWorkspace(response) {
2861
+ const status = response.status;
2862
+ let _headers = {};
2863
+ if (response.headers && typeof response.headers === "object") {
2864
+ for (const k in response.headers) {
2865
+ if (response.headers.hasOwnProperty(k)) {
2866
+ _headers[k] = response.headers[k];
2867
+ }
2868
+ }
2869
+ }
2870
+ if (status === 200) {
2871
+ const _responseText = response.data;
2872
+ let result200 = null;
2873
+ let resultData200 = _responseText;
2874
+ result200 = JSON.parse(resultData200);
2875
+ return Promise.resolve(result200);
2876
+ }
2877
+ else if (status === 401) {
2878
+ const _responseText = response.data;
2879
+ let result401 = null;
2880
+ let resultData401 = _responseText;
2881
+ result401 = JSON.parse(resultData401);
2882
+ return throwException("Missing or invalid credentials.", status, _responseText, _headers, result401);
2883
+ }
2884
+ else if (status === 404) {
2885
+ const _responseText = response.data;
2886
+ let result404 = null;
2887
+ let resultData404 = _responseText;
2888
+ result404 = JSON.parse(resultData404);
2889
+ return throwException("Workspace not found.", status, _responseText, _headers, result404);
2890
+ }
2891
+ else if (status !== 200 && status !== 204) {
2892
+ const _responseText = response.data;
2893
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2894
+ }
2895
+ return Promise.resolve(null);
2896
+ }
2897
+ }
2898
+ exports.RealforceApiClient = RealforceApiClient;
2899
+ /** The type of file being uploaded as an asset. */
2900
+ var AssetFileType;
2901
+ (function (AssetFileType) {
2902
+ AssetFileType["Image"] = "Image";
2903
+ AssetFileType["Video"] = "Video";
2904
+ AssetFileType["Pdf"] = "Pdf";
2905
+ })(AssetFileType || (exports.AssetFileType = AssetFileType = {}));
2906
+ /** Subject types that an asset can belong to. */
2907
+ var AssetSubjectType;
2908
+ (function (AssetSubjectType) {
2909
+ AssetSubjectType["Property"] = "Property";
2910
+ AssetSubjectType["Agent"] = "Agent";
2911
+ AssetSubjectType["Office"] = "Office";
2912
+ })(AssetSubjectType || (exports.AssetSubjectType = AssetSubjectType = {}));
2913
+ /** Lifecycle status of a campaign. */
2914
+ var CampaignStatus;
2915
+ (function (CampaignStatus) {
2916
+ CampaignStatus["New"] = "New";
2917
+ CampaignStatus["Creating"] = "Creating";
2918
+ CampaignStatus["Blocked"] = "Blocked";
2919
+ CampaignStatus["InReview"] = "InReview";
2920
+ CampaignStatus["Scheduled"] = "Scheduled";
2921
+ CampaignStatus["Rejected"] = "Rejected";
2922
+ CampaignStatus["Active"] = "Active";
2923
+ CampaignStatus["Stopped"] = "Stopped";
2924
+ CampaignStatus["Completed"] = "Completed";
2925
+ CampaignStatus["Unknown"] = "Unknown";
2926
+ })(CampaignStatus || (exports.CampaignStatus = CampaignStatus = {}));
2927
+ /** The broad channel classification of a campaign. */
2928
+ var CampaignType;
2929
+ (function (CampaignType) {
2930
+ CampaignType["Facebook"] = "Facebook";
2931
+ CampaignType["Display"] = "Display";
2932
+ CampaignType["Custom"] = "Custom";
2933
+ })(CampaignType || (exports.CampaignType = CampaignType = {}));
2934
+ var CampaignUrlType;
2935
+ (function (CampaignUrlType) {
2936
+ CampaignUrlType["Facebook"] = "Facebook";
2937
+ CampaignUrlType["Instagram"] = "Instagram";
2938
+ CampaignUrlType["DisplayAd"] = "DisplayAd";
2939
+ CampaignUrlType["Custom"] = "Custom";
2940
+ })(CampaignUrlType || (exports.CampaignUrlType = CampaignUrlType = {}));
2941
+ /** Type of event occuring */
2942
+ var EventTimeType;
2943
+ (function (EventTimeType) {
2944
+ EventTimeType["OpenHouse"] = "OpenHouse";
2945
+ EventTimeType["AddedInErp"] = "AddedInErp";
2946
+ EventTimeType["Sold"] = "Sold";
2947
+ EventTimeType["Unknown"] = "Unknown";
2948
+ EventTimeType["Auction"] = "Auction";
2949
+ EventTimeType["Start"] = "Start";
2950
+ EventTimeType["Listed"] = "Listed";
2951
+ EventTimeType["FirstListed"] = "FirstListed";
2952
+ })(EventTimeType || (exports.EventTimeType = EventTimeType = {}));
2953
+ var LeadSource;
2954
+ (function (LeadSource) {
2955
+ LeadSource["Portal"] = "Portal";
2956
+ LeadSource["PriceAlert"] = "PriceAlert";
2957
+ LeadSource["ArrangeViewing"] = "ArrangeViewing";
2958
+ LeadSource["SimilarProperties"] = "SimilarProperties";
2959
+ LeadSource["BookValuation"] = "BookValuation";
2960
+ LeadSource["StandaloneQualification"] = "StandaloneQualification";
2961
+ LeadSource["Meta"] = "Meta";
2962
+ LeadSource["Google"] = "Google";
2963
+ })(LeadSource || (exports.LeadSource = LeadSource = {}));
2964
+ /** Type of subject for the lead */
2965
+ var LeadSubjectType;
2966
+ (function (LeadSubjectType) {
2967
+ LeadSubjectType["Property"] = "Property";
2968
+ LeadSubjectType["Agent"] = "Agent";
2969
+ LeadSubjectType["Office"] = "Office";
2970
+ })(LeadSubjectType || (exports.LeadSubjectType = LeadSubjectType = {}));
2971
+ /** The kind of destination a magic link resolves to. */
2972
+ var MagicLinkType;
2973
+ (function (MagicLinkType) {
2974
+ MagicLinkType["OrderPage"] = "OrderPage";
2975
+ MagicLinkType["ResultPage"] = "ResultPage";
2976
+ MagicLinkType["SellerOrderPage"] = "SellerOrderPage";
2977
+ })(MagicLinkType || (exports.MagicLinkType = MagicLinkType = {}));
2978
+ /** Subject types that a marketing opportunity can be attached to. */
2979
+ var MarketingOpportunitySubjectType;
2980
+ (function (MarketingOpportunitySubjectType) {
2981
+ MarketingOpportunitySubjectType["Office"] = "Office";
2982
+ MarketingOpportunitySubjectType["Agent"] = "Agent";
2983
+ MarketingOpportunitySubjectType["Property"] = "Property";
2984
+ })(MarketingOpportunitySubjectType || (exports.MarketingOpportunitySubjectType = MarketingOpportunitySubjectType = {}));
2985
+ var PaidBy;
2986
+ (function (PaidBy) {
2987
+ PaidBy["Unknown"] = "Unknown";
2988
+ PaidBy["Hq"] = "Hq";
2989
+ PaidBy["Office"] = "Office";
2990
+ PaidBy["Agent"] = "Agent";
2991
+ PaidBy["Seller"] = "Seller";
2992
+ PaidBy["Orderer"] = "Orderer";
2993
+ PaidBy["Account"] = "Account";
2994
+ })(PaidBy || (exports.PaidBy = PaidBy = {}));
2995
+ /** Status values accepted when filtering properties. */
2996
+ var PropertyFilterStatus;
2997
+ (function (PropertyFilterStatus) {
2998
+ PropertyFilterStatus["Available"] = "Available";
2999
+ PropertyFilterStatus["Upcoming"] = "Upcoming";
3000
+ PropertyFilterStatus["Removed"] = "Removed";
3001
+ PropertyFilterStatus["Acquired"] = "Acquired";
3002
+ PropertyFilterStatus["Unpublished"] = "Unpublished";
3003
+ })(PropertyFilterStatus || (exports.PropertyFilterStatus = PropertyFilterStatus = {}));
3004
+ var PropertyStatus;
3005
+ (function (PropertyStatus) {
3006
+ PropertyStatus["Unknown"] = "Unknown";
3007
+ PropertyStatus["Upcoming"] = "Upcoming";
3008
+ PropertyStatus["Available"] = "Available";
3009
+ PropertyStatus["Acquired"] = "Acquired";
3010
+ PropertyStatus["Removed"] = "Removed";
3011
+ PropertyStatus["Unpublished"] = "Unpublished";
3012
+ PropertyStatus["ManuallyRemoved"] = "ManuallyRemoved";
3013
+ })(PropertyStatus || (exports.PropertyStatus = PropertyStatus = {}));
3014
+ /** Controls how a marketing opportunity is published into a campaign. */
3015
+ var PublishingMode;
3016
+ (function (PublishingMode) {
3017
+ PublishingMode["Manual"] = "Manual";
3018
+ PublishingMode["PremiumAutoPublish"] = "PremiumAutoPublish";
3019
+ PublishingMode["MachineAutoPublish"] = "MachineAutoPublish";
3020
+ PublishingMode["SellerPaid"] = "SellerPaid";
3021
+ })(PublishingMode || (exports.PublishingMode = PublishingMode = {}));
3022
+ /** Sort direction for list requests. */
3023
+ var SortDirection;
3024
+ (function (SortDirection) {
3025
+ SortDirection["Asc"] = "Asc";
3026
+ SortDirection["Desc"] = "Desc";
3027
+ })(SortDirection || (exports.SortDirection = SortDirection = {}));
3028
+ var SubjectType;
3029
+ (function (SubjectType) {
3030
+ SubjectType["Unknown"] = "Unknown";
3031
+ SubjectType["Hq"] = "Hq";
3032
+ SubjectType["Office"] = "Office";
3033
+ SubjectType["Agent"] = "Agent";
3034
+ SubjectType["Property"] = "Property";
3035
+ SubjectType["Account"] = "Account";
3036
+ })(SubjectType || (exports.SubjectType = SubjectType = {}));
3037
+ /** Subject types that can be used with the trigger API. */
3038
+ var TriggerSubjectType;
3039
+ (function (TriggerSubjectType) {
3040
+ TriggerSubjectType["Office"] = "Office";
3041
+ TriggerSubjectType["Agent"] = "Agent";
3042
+ TriggerSubjectType["Property"] = "Property";
3043
+ })(TriggerSubjectType || (exports.TriggerSubjectType = TriggerSubjectType = {}));
3044
+ /** The organizational scope at which a user operates. */
3045
+ var UserRole;
3046
+ (function (UserRole) {
3047
+ UserRole["Account"] = "Account";
3048
+ UserRole["Workspace"] = "Workspace";
3049
+ UserRole["Office"] = "Office";
3050
+ })(UserRole || (exports.UserRole = UserRole = {}));
3051
+ class ApiException extends Error {
3052
+ constructor(message, status, response, headers, result) {
3053
+ super();
3054
+ this.isApiException = true;
3055
+ this.message = message;
3056
+ this.status = status;
3057
+ this.response = response;
3058
+ this.headers = headers;
3059
+ this.result = result;
3060
+ }
3061
+ static isApiException(obj) {
3062
+ return obj.isApiException === true;
3063
+ }
3064
+ }
3065
+ exports.ApiException = ApiException;
3066
+ function throwException(message, status, response, headers, result) {
3067
+ throw new ApiException(message, status, response, headers, result);
3068
+ }
3069
+ function isAxiosError(obj) {
3070
+ return obj && obj.isAxiosError === true;
3071
+ }
3072
+ //# sourceMappingURL=client.generated.js.map