@superoffice/webapi 11.7.727 → 11.9.1204

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/LICENSE.md +15 -15
  2. package/README.md +184 -184
  3. package/__tests__/Appointment63-notz.json +1925 -1925
  4. package/__tests__/Appointment63-utctz.json +1925 -1925
  5. package/__tests__/Appointment63.json +1925 -1925
  6. package/__tests__/AppointmentTzTest.ts +115 -115
  7. package/__tests__/AxiosNockTest.ts +28 -28
  8. package/__tests__/ContactDefault.json +699 -699
  9. package/__tests__/ContactEntity.json +272 -272
  10. package/__tests__/ContactRestTest.ts +144 -144
  11. package/__tests__/ContactTest.ts +395 -395
  12. package/__tests__/ConvertersTest.ts +97 -97
  13. package/__tests__/DocumentTest.ts +101 -101
  14. package/__tests__/Person210-notz.json +1932 -1932
  15. package/__tests__/Person210-utctz.json +1932 -1932
  16. package/__tests__/Person210.json +1932 -1932
  17. package/__tests__/PersonImageData.nock +22 -22
  18. package/__tests__/PersonTest.ts +41 -41
  19. package/__tests__/PersonTzTest.ts +113 -113
  20. package/__tests__/RecurrenceInfo.json +55 -55
  21. package/__tests__/ResponseCallbackTest.ts +23 -23
  22. package/__tests__/TableRights.json +441 -441
  23. package/__tests__/WebapiTest.ts +264 -264
  24. package/__tests__/Webhook.json +16 -16
  25. package/__tests__/WebhookTest.ts +209 -209
  26. package/dist/cjs/AIAgent.d.ts +62 -0
  27. package/dist/cjs/AIAgent.d.ts.map +1 -1
  28. package/dist/cjs/AIAgent.js +149 -0
  29. package/dist/cjs/AIAgent.js.map +1 -1
  30. package/dist/cjs/Carriers.d.ts +640 -14
  31. package/dist/cjs/Carriers.d.ts.map +1 -1
  32. package/dist/cjs/Converters.d.ts +24 -0
  33. package/dist/cjs/Converters.d.ts.map +1 -1
  34. package/dist/cjs/Converters.js +388 -17
  35. package/dist/cjs/Converters.js.map +1 -1
  36. package/dist/cjs/DiagnosticsAgent.d.ts +38 -0
  37. package/dist/cjs/DiagnosticsAgent.d.ts.map +1 -1
  38. package/dist/cjs/DiagnosticsAgent.js +91 -0
  39. package/dist/cjs/DiagnosticsAgent.js.map +1 -1
  40. package/dist/cjs/Enums.d.ts +77 -1
  41. package/dist/cjs/Enums.d.ts.map +1 -1
  42. package/dist/cjs/Enums.js +83 -4
  43. package/dist/cjs/Enums.js.map +1 -1
  44. package/dist/cjs/ListAgent.d.ts +71 -6
  45. package/dist/cjs/ListAgent.d.ts.map +1 -1
  46. package/dist/cjs/ListAgent.js +157 -0
  47. package/dist/cjs/ListAgent.js.map +1 -1
  48. package/dist/cjs/MarketingAgent.d.ts +68 -0
  49. package/dist/cjs/MarketingAgent.d.ts.map +1 -1
  50. package/dist/cjs/MarketingAgent.js +157 -0
  51. package/dist/cjs/MarketingAgent.js.map +1 -1
  52. package/dist/cjs/TicketAgent.d.ts +23 -0
  53. package/dist/cjs/TicketAgent.d.ts.map +1 -1
  54. package/dist/cjs/TicketAgent.js +65 -0
  55. package/dist/cjs/TicketAgent.js.map +1 -1
  56. package/dist/esm/AIAgent.d.ts +62 -0
  57. package/dist/esm/AIAgent.d.ts.map +1 -1
  58. package/dist/esm/AIAgent.js +150 -1
  59. package/dist/esm/AIAgent.js.map +1 -1
  60. package/dist/esm/Carriers.d.ts +640 -14
  61. package/dist/esm/Carriers.d.ts.map +1 -1
  62. package/dist/esm/Converters.d.ts +24 -0
  63. package/dist/esm/Converters.d.ts.map +1 -1
  64. package/dist/esm/Converters.js +346 -0
  65. package/dist/esm/Converters.js.map +1 -1
  66. package/dist/esm/DiagnosticsAgent.d.ts +38 -0
  67. package/dist/esm/DiagnosticsAgent.d.ts.map +1 -1
  68. package/dist/esm/DiagnosticsAgent.js +91 -0
  69. package/dist/esm/DiagnosticsAgent.js.map +1 -1
  70. package/dist/esm/Enums.d.ts +77 -1
  71. package/dist/esm/Enums.d.ts.map +1 -1
  72. package/dist/esm/Enums.js +79 -0
  73. package/dist/esm/Enums.js.map +1 -1
  74. package/dist/esm/ListAgent.d.ts +71 -6
  75. package/dist/esm/ListAgent.d.ts.map +1 -1
  76. package/dist/esm/ListAgent.js +157 -0
  77. package/dist/esm/ListAgent.js.map +1 -1
  78. package/dist/esm/MarketingAgent.d.ts +68 -0
  79. package/dist/esm/MarketingAgent.d.ts.map +1 -1
  80. package/dist/esm/MarketingAgent.js +157 -0
  81. package/dist/esm/MarketingAgent.js.map +1 -1
  82. package/dist/esm/TicketAgent.d.ts +23 -0
  83. package/dist/esm/TicketAgent.d.ts.map +1 -1
  84. package/dist/esm/TicketAgent.js +65 -0
  85. package/dist/esm/TicketAgent.js.map +1 -1
  86. package/examples-js/hello.js +12 -12
  87. package/examples-ts/hello.ts +8 -8
  88. package/package.json +93 -93
  89. package/scripts/postbuild.js +22 -22
  90. package/scripts/setVersion.js +44 -44
  91. package/src/AIAgent.ts +2239 -1992
  92. package/src/AppointmentAgent.ts +6263 -6263
  93. package/src/AppointmentRestApi.ts +225 -225
  94. package/src/ArchiveAgent.ts +1950 -1950
  95. package/src/AssociateAgent.ts +422 -422
  96. package/src/AxiosCacheHandler.ts +74 -74
  97. package/src/BLOBAgent.ts +2100 -2100
  98. package/src/Base64.ts +285 -285
  99. package/src/BatchAgent.ts +910 -910
  100. package/src/BulkUpdateAgent.ts +504 -504
  101. package/src/CRMScriptAgent.ts +1390 -1390
  102. package/src/Carriers.ts +53121 -52274
  103. package/src/ChatAgent.ts +1422 -1422
  104. package/src/ConfigurationAgent.ts +2228 -2228
  105. package/src/ContactAgent.ts +1756 -1756
  106. package/src/ContactRestApi.ts +237 -237
  107. package/src/Converters.ts +23496 -23090
  108. package/src/CustomerServiceAgent.ts +1799 -1799
  109. package/src/DashAgent.ts +1674 -1674
  110. package/src/DatabaseAgent.ts +120 -120
  111. package/src/DatabaseTableAgent.ts +534 -534
  112. package/src/Day_js.ts +41 -41
  113. package/src/DiagnosticsAgent.ts +1384 -1240
  114. package/src/DocumentAgent.ts +5079 -5079
  115. package/src/DocumentMigrationAgent.ts +524 -524
  116. package/src/DocumentRestApi.ts +259 -259
  117. package/src/EMailAgent.ts +5328 -5328
  118. package/src/Enums.ts +6998 -6916
  119. package/src/ErpSyncAgent.ts +2658 -2658
  120. package/src/FavouriteAgent.ts +720 -720
  121. package/src/FindAgent.ts +2330 -2330
  122. package/src/ForeignSystemAgent.ts +1710 -1710
  123. package/src/FreeTextAgent.ts +372 -372
  124. package/src/ImportAgent.ts +304 -304
  125. package/src/LicenseAgent.ts +1230 -1230
  126. package/src/ListAgent.ts +11451 -11237
  127. package/src/MDOAgent.ts +748 -748
  128. package/src/MarketingAgent.ts +1146 -890
  129. package/src/MessagingAgent.ts +384 -384
  130. package/src/NavigatorAgent.ts +140 -140
  131. package/src/NumberAllocationAgent.ts +296 -296
  132. package/src/PersonAgent.ts +3287 -3287
  133. package/src/PersonRestApi.ts +241 -241
  134. package/src/PhoneListAgent.ts +458 -458
  135. package/src/PocketAgent.ts +780 -780
  136. package/src/PreferenceAgent.ts +1900 -1900
  137. package/src/PreviewsAgent.ts +116 -116
  138. package/src/ProjectAgent.ts +2391 -2391
  139. package/src/ProjectRestApi.ts +239 -239
  140. package/src/QuoteAgent.ts +5159 -5159
  141. package/src/RelationAgent.ts +220 -220
  142. package/src/ReportAgent.ts +154 -154
  143. package/src/ResourceAgent.ts +358 -358
  144. package/src/SaintAgent.ts +601 -601
  145. package/src/SaleAgent.ts +2034 -2034
  146. package/src/SaleRestApi.ts +233 -233
  147. package/src/SelectionAgent.ts +3195 -3195
  148. package/src/SentryAgent.ts +462 -462
  149. package/src/SoApiConstants.ts +8 -8
  150. package/src/TargetsAgent.ts +1104 -1104
  151. package/src/TicketAgent.ts +3708 -3638
  152. package/src/TimeZoneAgent.ts +528 -528
  153. package/src/TooltipsAgent.ts +116 -116
  154. package/src/UserAgent.ts +4856 -4856
  155. package/src/UserDefinedFieldInfoAgent.ts +1764 -1764
  156. package/src/ViewStateAgent.ts +858 -858
  157. package/src/WebApi.ts +872 -872
  158. package/src/WebApiBase.ts +565 -565
  159. package/src/WebhookAgent.ts +388 -388
  160. package/src/WorkflowAgent.ts +1338 -1338
  161. package/tsconfig.esm.json +8 -8
  162. package/tsconfig.jest.json +8 -8
  163. package/tsconfig.json +34 -34
@@ -1,1756 +1,1756 @@
1
- // <auto-generated>
2
- // SuperOffice Code Generator
3
- // modelling\templates\servicestswebapi\tswebapiagents.tt
4
- // </auto-generated>
5
-
6
-
7
- /* tslint:disable */
8
- //----------------------------------------------------------------------------
9
- // G E N E R A T E D F I L E ! D O N O T E D I T !
10
- //----------------------------------------------------------------------------
11
- //
12
- // File: WebApi/ContactAgent.ts
13
- //
14
- //----------------------------------------------------------------------------
15
- // Copyright (C) SuperOffice AS
16
- //----------------------------------------------------------------------------
17
-
18
- import { AxiosRequestConfig } from 'axios';
19
- import { Duration } from 'dayjs/plugin/duration';
20
- import * as enums from './Enums';
21
- import * as base from './WebApiBase';
22
- import * as carriers from './Carriers';
23
- import * as converters from './Converters';
24
- import { FromBase64ToString, ToBase64 } from './Base64';
25
-
26
- /**
27
- * Contact (company) data services.
28
- */
29
- export interface IContactAgent {
30
- createDefaultContactEntityAsync(): Promise< carriers.ContactEntity >;
31
- saveContactEntityAsync(entity: carriers.ContactEntity) : Promise< carriers.ContactEntity >;
32
- deleteContactEntityAsync(ContactEntityId: number) : Promise<void>;
33
- createDefaultPreviewContactAsync(): Promise< carriers.PreviewContact >;
34
- getContactAsync(contactId: number) : Promise< carriers.Contact >;
35
- getMyActiveContactsAsync(request: carriers.Contact_GetMyActiveContactsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactActivity[] >;
36
- getMyActiveContactsAsync(activityStartTime: Date, contactCategories: number[], actionType: enums.ContactAction, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactActivity[] >;
37
- getContactEntityAsync(contactEntityId: number) : Promise< carriers.ContactEntity >;
38
- undeleteAsync(request: carriers.Contact_UndeleteRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
39
- undeleteAsync(id: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
40
- getPersonsAsync(request: carriers.Contact_GetPersonsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Person[] >;
41
- getPersonsAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Person[] >;
42
- getContactWithPersonsAsync(request: carriers.Contact_GetContactWithPersonsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
43
- getContactWithPersonsAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
44
- getMyContactAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
45
- getMyBizCardAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
46
- changeCountryAsync(request: carriers.Contact_ChangeCountryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
47
- changeCountryAsync(contactEntity: carriers.ContactEntity, toCountryId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
48
- getAddressAsync(request: carriers.Contact_GetAddressRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
49
- getAddressAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
50
- getAddressByCountryAsync(request: carriers.Contact_GetAddressByCountryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
51
- getAddressByCountryAsync(contactId: number, countryId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
52
- addPersonAsync(request: carriers.Contact_AddPersonRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PersonEntity >;
53
- addPersonAsync(contactId: number, newPersonEntity: carriers.PersonEntity, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PersonEntity >;
54
- getDuplicatesAsync(request: carriers.Contact_GetDuplicatesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
55
- getDuplicatesAsync(name: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
56
- createNewEntryAsync(request: carriers.Contact_CreateNewEntryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
57
- createNewEntryAsync(duplicate: carriers.DuplicateEntry, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
58
- getDuplicateRulesAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateRule[] >;
59
- setDuplicateRulesStatusAsync(request: carriers.Contact_SetDuplicateRulesStatusRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
60
- setDuplicateRulesStatusAsync(rules: carriers.DuplicateRule[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
61
- mergeAsync(request: carriers.Contact_MergeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
62
- mergeAsync(sourceContactId: number, destinationContactId: number, mergeIdenticalPersons: boolean, replaceEmptyFieldsOnDestination: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
63
- copyAsync(request: carriers.Contact_CopyRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
64
- copyAsync(sourceContactId: number, destinationContactName: string, destinationContactDepartment: string, copyPersons: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
65
- getNameDepartmentDuplicatesAsync(request: carriers.Contact_GetNameDepartmentDuplicatesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
66
- getNameDepartmentDuplicatesAsync(name: string, department: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
67
- getDomainDuplicatesAsync(request: carriers.Contact_GetDomainDuplicatesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
68
- getDomainDuplicatesAsync(domain: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
69
- isNumberValidAsync(request: carriers.Contact_IsNumberValidRequest, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
70
- isNumberValidAsync(contactId: number, number: string, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
71
- getQuoteVersionAddressesAsync(request: carriers.Contact_GetQuoteVersionAddressesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address[] >;
72
- getQuoteVersionAddressesAsync(quoteVersionId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address[] >;
73
- saveQuoteVersionAddressAsync(request: carriers.Contact_SaveQuoteVersionAddressRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
74
- saveQuoteVersionAddressAsync(quoteVersionId: number, address: carriers.Address, addressType: enums.AddressType, countryId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
75
- deleteExpiredAsync(webapi_options?:base.WebApiRequestOptions) : Promise< void >;
76
- getContactSummaryAsync(request: carriers.Contact_GetContactSummaryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactSummary >;
77
- getContactSummaryAsync(contactId: number, limit: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactSummary >;
78
- validateContactEntityAsync(request: carriers.Contact_ValidateContactEntityRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
79
- validateContactEntityAsync(contactEntity: carriers.ContactEntity, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
80
- enrichContactEntityAsync(request: carriers.Contact_EnrichContactEntityRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
81
- enrichContactEntityAsync(contactEntity: carriers.ContactEntity, enrichId: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
82
- getContactListAsync(contactIds: number[]) : Promise< carriers.Contact[] >;
83
- getMyContactsAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Contact[] >;
84
- getMyRecentContactsAsync(request: carriers.Contact_GetMyRecentContactsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Contact[] >;
85
- getMyRecentContactsAsync(sourceType: enums.ContactSourceType, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Contact[] >;
86
- getPreviewContactAsync(request: carriers.Contact_GetPreviewContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact >;
87
- getPreviewContactAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact >;
88
- getPreviewEnrichContactAsync(request: carriers.Contact_GetPreviewEnrichContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact >;
89
- getPreviewEnrichContactAsync(enrichId: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact >;
90
- } // interface IContactAgent
91
-
92
-
93
-
94
-
95
- /**
96
- * Contact (company) data services.
97
- */
98
- export class ContactAgent extends base.WebApiBase implements IContactAgent {
99
- constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
100
- constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
101
- constructor(baseUrl: string, resourceManager:any);
102
- constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
103
- constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
104
- constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
105
- constructor(options: base.WebApiOptions);
106
-
107
- constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
108
- langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
109
- langOrResourceOrRM?:string|base.ResourceParsing|any,
110
- cultureCode?: string,
111
- ) {
112
- const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
113
- options.basePath = "v1/Agents/Contact/";
114
- super(options);
115
- }
116
-
117
-
118
-
119
- /**
120
- * Set default values into a new ContactEntity.
121
- * NetServer calculates default values on the entity, which is required when creating/storing a new instance
122
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
123
- * @returns A blank entity.
124
- */
125
- public async createDefaultContactEntityAsync(options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
126
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
127
- base.WebApiBase.SetPending(options);
128
- return new Promise< carriers.ContactEntity >(async (resolve, reject) => {
129
- try {
130
- const response = await this._axios.post("CreateDefaultContactEntity", null, config);
131
- base.WebApiBase.SetCompleted(options, response);
132
- const res : carriers.ContactEntity = converters.Create_ContactEntity_From( response.data );
133
- resolve(res);
134
- }
135
- catch( err ) {
136
- base.WebApiBase.HandleError(options, config, err);
137
- reject(err);
138
- }
139
- });
140
- }
141
- /**
142
- * Replace the existing ContactEntity or creates a new ContactEntity if the id parameter is empty
143
- * @param entity - The ContactEntity to be saved.
144
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
145
- * @returns New or updated ContactEntity
146
- */
147
- public async saveContactEntityAsync(entity: carriers.ContactEntity, options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
148
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
149
- base.WebApiBase.SetPending(options);
150
- return new Promise< carriers.ContactEntity >(async (resolve, reject) => {
151
- try {
152
- const response = await this._axios.post("SaveContactEntity", entity, config);
153
- base.WebApiBase.SetCompleted(options, response);
154
- const res : carriers.ContactEntity = converters.Create_ContactEntity_From( response.data );
155
- resolve(res);
156
- }
157
- catch( err ) {
158
- base.WebApiBase.HandleError(options, config, err);
159
- reject(err);
160
- }
161
- });
162
- }
163
-
164
- /**
165
- * Deletes the ContactEntity
166
- * @param ContactEntityId - The id of the ContactEntity to be deleted.
167
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
168
- */
169
- public async deleteContactEntityAsync(ContactEntityId: number, options?:base.WebApiRequestOptions) : Promise< void > {
170
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
171
- base.WebApiBase.SetPending(options);
172
- return new Promise< void >(async (resolve, reject) => {
173
- try {
174
- const response = await this._axios.post("DeleteContactEntity?ContactEntityId=" + ContactEntityId, null, config );
175
- base.WebApiBase.SetCompleted(options, response);
176
- const res = response.data;
177
- resolve(res);
178
- }
179
- catch( err ) {
180
- base.WebApiBase.HandleError(options, config, err);
181
- reject(err);
182
- }
183
- });
184
- }
185
-
186
- /**
187
- * Set default values into a new PreviewContact.
188
- * NetServer calculates default values on the entity, which is required when creating/storing a new instance
189
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
190
- * @returns A blank entity.
191
- */
192
- public async createDefaultPreviewContactAsync(options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact > {
193
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
194
- base.WebApiBase.SetPending(options);
195
- return new Promise< carriers.PreviewContact >(async (resolve, reject) => {
196
- try {
197
- const response = await this._axios.post("CreateDefaultPreviewContact", null, config);
198
- base.WebApiBase.SetCompleted(options, response);
199
- const res : carriers.PreviewContact = converters.Create_PreviewContact_From( response.data );
200
- resolve(res);
201
- }
202
- catch( err ) {
203
- base.WebApiBase.HandleError(options, config, err);
204
- reject(err);
205
- }
206
- });
207
- }
208
- /**
209
- * Gets a Contact object.
210
- * @param contactId - The primary key.
211
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
212
- * @returns A single Contact
213
- */
214
- public async getContactAsync(contactId: number, options?:base.WebApiRequestOptions) : Promise< carriers.Contact > {
215
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
216
- base.WebApiBase.SetPending(options);
217
- return new Promise< carriers.Contact >(async (resolve, reject) => {
218
- try {
219
- const response = await this._axios.post("GetContact?contactId=" + contactId, null, config);
220
- base.WebApiBase.SetCompleted(options, response);
221
- const res = converters.Create_Contact_From( response.data );
222
- resolve(res);
223
- }
224
- catch( err ) {
225
- base.WebApiBase.HandleError(options, config, err);
226
- reject(err);
227
- }
228
- });
229
- }
230
-
231
-
232
- private async _getMyActiveContactsAsync(request: carriers.Contact_GetMyActiveContactsRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ContactActivity[] > {
233
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
234
- base.WebApiBase.SetPending(options);
235
- return new Promise< carriers.ContactActivity[] >(async (resolve, reject) => {
236
- try {
237
- config.baseURL = this._options.baseUrl;
238
- const response = await this._axios.post("GetMyActiveContacts", request , config);
239
- base.WebApiBase.SetCompleted(options, response);
240
- const res : carriers.ContactActivity[] = converters.Create_ContactActivityArray_From( response.data );
241
- resolve(res);
242
- }
243
- catch( err ) {
244
- base.WebApiBase.HandleError(options, config, err);
245
- reject(err);
246
- }
247
- });
248
- }
249
-
250
-
251
-
252
- /**
253
- * Returns the contacts where there has been activity since activityStartTime. If activityStartTime is larger than the current date, all contacts with activity since last log-out are returned. The result set can be filtered by category and action type.
254
- * @param request - ActivityStartTime, ContactCategories, ActionType
255
- * @returns Array of contacts where there have been activity in the period.
256
- */
257
- public async getMyActiveContactsAsync(request: carriers.Contact_GetMyActiveContactsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactActivity[] >;
258
-
259
- /**
260
- * Returns the contacts where there has been activity since activityStartTime. If activityStartTime is larger than the current date, all contacts with activity since last log-out are returned. The result set can be filtered by category and action type.
261
- * @param activityStartTime - The start time of the activities. If the start time is set to a future date; activites since the user last logged out are returned.
262
- * @param contactCategories - Integer array of categories to filter on. If the array is empty contacts from all categories will be selected.
263
- * @param actionType - The type of action that has occured. E.g. updates, deletes, new appointments, etc.
264
- * @returns Array of contacts where there have been activity in the period.
265
- */
266
- public async getMyActiveContactsAsync(activityStartTime: Date, contactCategories: number[], actionType: enums.ContactAction, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactActivity[] >;
267
-
268
- public async getMyActiveContactsAsync(activityStartTime:Date|carriers.Contact_GetMyActiveContactsRequest, contactCategories?:number[]|base.WebApiRequestOptions, actionType?:enums.ContactAction, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactActivity[] > {
269
- let _request : carriers.Contact_GetMyActiveContactsRequest = null;
270
- let _options : base.WebApiRequestOptions = null;
271
- const first : any = activityStartTime;
272
- if( typeof( first ) === "object" && first && ( typeof(first.activityStartTime)!='undefined' || typeof(first.contactCategories)!='undefined' || typeof(first.actionType)!='undefined' ) )
273
- {
274
- _request = activityStartTime as carriers.Contact_GetMyActiveContactsRequest;
275
- _options = contactCategories as base.WebApiRequestOptions;
276
- }
277
- else
278
- {
279
- _request = {
280
- activityStartTime: activityStartTime as Date,
281
- contactCategories: contactCategories as number[],
282
- actionType: actionType as enums.ContactAction,
283
- };
284
- _options = webapi_options;
285
- }
286
- return this._getMyActiveContactsAsync( _request, _options );
287
- }
288
-
289
- /**
290
- * Gets a ContactEntity object.
291
- * @param contactEntityId - The primary key.
292
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
293
- * @returns A single ContactEntity
294
- */
295
- public async getContactEntityAsync(contactEntityId: number, options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
296
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
297
- base.WebApiBase.SetPending(options);
298
- return new Promise< carriers.ContactEntity >(async (resolve, reject) => {
299
- try {
300
- const response = await this._axios.post("GetContactEntity?contactEntityId=" + contactEntityId, null, config);
301
- base.WebApiBase.SetCompleted(options, response);
302
- const res = converters.Create_ContactEntity_From( response.data );
303
- resolve(res);
304
- }
305
- catch( err ) {
306
- base.WebApiBase.HandleError(options, config, err);
307
- reject(err);
308
- }
309
- });
310
- }
311
-
312
-
313
- private async _undeleteAsync(request: carriers.Contact_UndeleteRequest, options?:base.WebApiRequestOptions) : Promise< void > {
314
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
315
- base.WebApiBase.SetPending(options);
316
- return new Promise< void >(async (resolve, reject) => {
317
- try {
318
- config.baseURL = this._options.baseUrl;
319
- const response = await this._axios.post("Undelete", request , config);
320
- base.WebApiBase.SetCompleted(options, response);
321
- const res = response.data;
322
- resolve(res);
323
- }
324
- catch( err ) {
325
- base.WebApiBase.HandleError(options, config, err);
326
- reject(err);
327
- }
328
- });
329
- }
330
-
331
-
332
-
333
- /**
334
- * This entity supports Soft Delete. Call this method to Undelete a previously soft-deleted record
335
- * @param request - Id
336
- * @returns This method has no return value
337
- */
338
- public async undeleteAsync(request: carriers.Contact_UndeleteRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
339
-
340
- /**
341
- * This entity supports Soft Delete. Call this method to Undelete a previously soft-deleted record
342
- * @param id - The primary key of the entity to undelete
343
- * @returns This method has no return value
344
- */
345
- public async undeleteAsync(id: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
346
-
347
- public async undeleteAsync(id:number|carriers.Contact_UndeleteRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
348
- let _request : carriers.Contact_UndeleteRequest = null;
349
- let _options : base.WebApiRequestOptions = null;
350
- const first : any = id;
351
- if( typeof( first ) === "object" && first && ( typeof(first.id)!='undefined' ) )
352
- {
353
- _request = id as carriers.Contact_UndeleteRequest;
354
- _options = webapi_options as base.WebApiRequestOptions;
355
- }
356
- else
357
- {
358
- _request = {
359
- id: id as number,
360
- };
361
- _options = webapi_options;
362
- }
363
- return this._undeleteAsync( _request, _options );
364
- }
365
-
366
-
367
- private async _getPersonsAsync(request: carriers.Contact_GetPersonsRequest, options?:base.WebApiRequestOptions) : Promise< carriers.Person[] > {
368
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
369
- base.WebApiBase.SetPending(options);
370
- return new Promise< carriers.Person[] >(async (resolve, reject) => {
371
- try {
372
- config.baseURL = this._options.baseUrl;
373
- const response = await this._axios.post("GetPersons", request , config);
374
- base.WebApiBase.SetCompleted(options, response);
375
- const res : carriers.Person[] = converters.Create_PersonArray_From( response.data );
376
- resolve(res);
377
- }
378
- catch( err ) {
379
- base.WebApiBase.HandleError(options, config, err);
380
- reject(err);
381
- }
382
- });
383
- }
384
-
385
-
386
-
387
- /**
388
- * Returns an array of all the contact persons for the company card.
389
- * @param request - ContactId
390
- * @returns Array of Persons
391
- */
392
- public async getPersonsAsync(request: carriers.Contact_GetPersonsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Person[] >;
393
-
394
- /**
395
- * Returns an array of all the contact persons for the company card.
396
- * @param contactId -
397
- * @returns Array of Persons
398
- */
399
- public async getPersonsAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Person[] >;
400
-
401
- public async getPersonsAsync(contactId:number|carriers.Contact_GetPersonsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Person[] > {
402
- let _request : carriers.Contact_GetPersonsRequest = null;
403
- let _options : base.WebApiRequestOptions = null;
404
- const first : any = contactId;
405
- if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' ) )
406
- {
407
- _request = contactId as carriers.Contact_GetPersonsRequest;
408
- _options = webapi_options as base.WebApiRequestOptions;
409
- }
410
- else
411
- {
412
- _request = {
413
- contactId: contactId as number,
414
- };
415
- _options = webapi_options;
416
- }
417
- return this._getPersonsAsync( _request, _options );
418
- }
419
-
420
-
421
- private async _getContactWithPersonsAsync(request: carriers.Contact_GetContactWithPersonsRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
422
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
423
- base.WebApiBase.SetPending(options);
424
- return new Promise< carriers.ContactEntity >(async (resolve, reject) => {
425
- try {
426
- config.baseURL = this._options.baseUrl;
427
- const response = await this._axios.post("GetContactWithPersons", request , config);
428
- base.WebApiBase.SetCompleted(options, response);
429
- const res : carriers.ContactEntity = converters.Create_ContactEntity_From( response.data );
430
- resolve(res);
431
- }
432
- catch( err ) {
433
- base.WebApiBase.HandleError(options, config, err);
434
- reject(err);
435
- }
436
- });
437
- }
438
-
439
-
440
-
441
- /**
442
- * Returns the contact with all the contact persons belonging to the contact
443
- * @param request - ContactId
444
- * @returns ContactEntity with all data and persons.
445
- */
446
- public async getContactWithPersonsAsync(request: carriers.Contact_GetContactWithPersonsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
447
-
448
- /**
449
- * Returns the contact with all the contact persons belonging to the contact
450
- * @param contactId - The id of the contact.
451
- * @returns ContactEntity with all data and persons.
452
- */
453
- public async getContactWithPersonsAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
454
-
455
- public async getContactWithPersonsAsync(contactId:number|carriers.Contact_GetContactWithPersonsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
456
- let _request : carriers.Contact_GetContactWithPersonsRequest = null;
457
- let _options : base.WebApiRequestOptions = null;
458
- const first : any = contactId;
459
- if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' ) )
460
- {
461
- _request = contactId as carriers.Contact_GetContactWithPersonsRequest;
462
- _options = webapi_options as base.WebApiRequestOptions;
463
- }
464
- else
465
- {
466
- _request = {
467
- contactId: contactId as number,
468
- };
469
- _options = webapi_options;
470
- }
471
- return this._getContactWithPersonsAsync( _request, _options );
472
- }
473
-
474
-
475
- private async _getMyContactAsync( options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
476
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
477
- base.WebApiBase.SetPending(options);
478
- return new Promise< carriers.ContactEntity >(async (resolve, reject) => {
479
- try {
480
- config.baseURL = this._options.baseUrl;
481
- const response = await this._axios.post("GetMyContact", undefined , config);
482
- base.WebApiBase.SetCompleted(options, response);
483
- const res : carriers.ContactEntity = converters.Create_ContactEntity_From( response.data );
484
- resolve(res);
485
- }
486
- catch( err ) {
487
- base.WebApiBase.HandleError(options, config, err);
488
- reject(err);
489
- }
490
- });
491
- }
492
-
493
-
494
- /**
495
- * Gets the contact belonging to the currently logged on user.
496
- * @returns The Contact
497
- */
498
- public async getMyContactAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >
499
- {
500
- return this._getMyContactAsync(webapi_options);
501
- }
502
-
503
-
504
- private async _getMyBizCardAsync( options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
505
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
506
- base.WebApiBase.SetPending(options);
507
- return new Promise< carriers.ContactEntity >(async (resolve, reject) => {
508
- try {
509
- config.baseURL = this._options.baseUrl;
510
- const response = await this._axios.post("GetMyBizCard", undefined , config);
511
- base.WebApiBase.SetCompleted(options, response);
512
- const res : carriers.ContactEntity = converters.Create_ContactEntity_From( response.data );
513
- resolve(res);
514
- }
515
- catch( err ) {
516
- base.WebApiBase.HandleError(options, config, err);
517
- reject(err);
518
- }
519
- });
520
- }
521
-
522
-
523
- /**
524
- * Returns all data needed to display the logged on person&apos;s business card. That is company, person, and company interest data.
525
- * @returns The contact object with persons and interests
526
- */
527
- public async getMyBizCardAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >
528
- {
529
- return this._getMyBizCardAsync(webapi_options);
530
- }
531
-
532
-
533
- private async _changeCountryAsync(request: carriers.Contact_ChangeCountryRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
534
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
535
- base.WebApiBase.SetPending(options);
536
- return new Promise< carriers.ContactEntity >(async (resolve, reject) => {
537
- try {
538
- config.baseURL = this._options.baseUrl;
539
- const response = await this._axios.post("ChangeCountry", request , config);
540
- base.WebApiBase.SetCompleted(options, response);
541
- const res : carriers.ContactEntity = converters.Create_ContactEntity_From( response.data );
542
- resolve(res);
543
- }
544
- catch( err ) {
545
- base.WebApiBase.HandleError(options, config, err);
546
- reject(err);
547
- }
548
- });
549
- }
550
-
551
-
552
-
553
- /**
554
- * Change country regenerates the default values and localized information such as phone number and address format
555
- * @param request - ContactEntity, ToCountryId
556
- * @returns
557
- */
558
- public async changeCountryAsync(request: carriers.Contact_ChangeCountryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
559
-
560
- /**
561
- * Change country regenerates the default values and localized information such as phone number and address format
562
- * @param contactEntity -
563
- * @param toCountryId - The country to switch to
564
- * @returns
565
- */
566
- public async changeCountryAsync(contactEntity: carriers.ContactEntity, toCountryId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
567
-
568
- public async changeCountryAsync(contactEntity:carriers.ContactEntity|carriers.Contact_ChangeCountryRequest, toCountryId?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
569
- let _request : carriers.Contact_ChangeCountryRequest = null;
570
- let _options : base.WebApiRequestOptions = null;
571
- const first : any = contactEntity;
572
- if( typeof( first ) === "object" && first && ( typeof(first.contactEntity)!='undefined' || typeof(first.toCountryId)!='undefined' ) )
573
- {
574
- _request = contactEntity as carriers.Contact_ChangeCountryRequest;
575
- _options = toCountryId as base.WebApiRequestOptions;
576
- }
577
- else
578
- {
579
- _request = {
580
- contactEntity: contactEntity as carriers.ContactEntity,
581
- toCountryId: toCountryId as number,
582
- };
583
- _options = webapi_options;
584
- }
585
- return this._changeCountryAsync( _request, _options );
586
- }
587
-
588
-
589
- private async _getAddressAsync(request: carriers.Contact_GetAddressRequest, options?:base.WebApiRequestOptions) : Promise< carriers.Address > {
590
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
591
- base.WebApiBase.SetPending(options);
592
- return new Promise< carriers.Address >(async (resolve, reject) => {
593
- try {
594
- config.baseURL = this._options.baseUrl;
595
- const response = await this._axios.post("GetAddress", request , config);
596
- base.WebApiBase.SetCompleted(options, response);
597
- const res : carriers.Address = converters.Create_Address_From( response.data );
598
- resolve(res);
599
- }
600
- catch( err ) {
601
- base.WebApiBase.HandleError(options, config, err);
602
- reject(err);
603
- }
604
- });
605
- }
606
-
607
-
608
-
609
- /**
610
- * Gets the contact&apos;s localized address.
611
- * @param request - ContactId
612
- * @returns The address as LocalizedField[][].
613
- */
614
- public async getAddressAsync(request: carriers.Contact_GetAddressRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
615
-
616
- /**
617
- * Gets the contact&apos;s localized address.
618
- * @param contactId - The contact id
619
- * @returns The address as LocalizedField[][].
620
- */
621
- public async getAddressAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
622
-
623
- public async getAddressAsync(contactId:number|carriers.Contact_GetAddressRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address > {
624
- let _request : carriers.Contact_GetAddressRequest = null;
625
- let _options : base.WebApiRequestOptions = null;
626
- const first : any = contactId;
627
- if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' ) )
628
- {
629
- _request = contactId as carriers.Contact_GetAddressRequest;
630
- _options = webapi_options as base.WebApiRequestOptions;
631
- }
632
- else
633
- {
634
- _request = {
635
- contactId: contactId as number,
636
- };
637
- _options = webapi_options;
638
- }
639
- return this._getAddressAsync( _request, _options );
640
- }
641
-
642
-
643
- private async _getAddressByCountryAsync(request: carriers.Contact_GetAddressByCountryRequest, options?:base.WebApiRequestOptions) : Promise< carriers.Address > {
644
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
645
- base.WebApiBase.SetPending(options);
646
- return new Promise< carriers.Address >(async (resolve, reject) => {
647
- try {
648
- config.baseURL = this._options.baseUrl;
649
- const response = await this._axios.post("GetAddressByCountry", request , config);
650
- base.WebApiBase.SetCompleted(options, response);
651
- const res : carriers.Address = converters.Create_Address_From( response.data );
652
- resolve(res);
653
- }
654
- catch( err ) {
655
- base.WebApiBase.HandleError(options, config, err);
656
- reject(err);
657
- }
658
- });
659
- }
660
-
661
-
662
-
663
- /**
664
- * Gets the contact&apos;s localized address.
665
- * @param request - ContactId, CountryId
666
- * @returns The address as LocalizedField[][].
667
- */
668
- public async getAddressByCountryAsync(request: carriers.Contact_GetAddressByCountryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
669
-
670
- /**
671
- * Gets the contact&apos;s localized address.
672
- * @param contactId - The contact id
673
- * @param countryId -
674
- * @returns The address as LocalizedField[][].
675
- */
676
- public async getAddressByCountryAsync(contactId: number, countryId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
677
-
678
- public async getAddressByCountryAsync(contactId:number|carriers.Contact_GetAddressByCountryRequest, countryId?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address > {
679
- let _request : carriers.Contact_GetAddressByCountryRequest = null;
680
- let _options : base.WebApiRequestOptions = null;
681
- const first : any = contactId;
682
- if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' || typeof(first.countryId)!='undefined' ) )
683
- {
684
- _request = contactId as carriers.Contact_GetAddressByCountryRequest;
685
- _options = countryId as base.WebApiRequestOptions;
686
- }
687
- else
688
- {
689
- _request = {
690
- contactId: contactId as number,
691
- countryId: countryId as number,
692
- };
693
- _options = webapi_options;
694
- }
695
- return this._getAddressByCountryAsync( _request, _options );
696
- }
697
-
698
-
699
- private async _addPersonAsync(request: carriers.Contact_AddPersonRequest, options?:base.WebApiRequestOptions) : Promise< carriers.PersonEntity > {
700
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
701
- base.WebApiBase.SetPending(options);
702
- return new Promise< carriers.PersonEntity >(async (resolve, reject) => {
703
- try {
704
- config.baseURL = this._options.baseUrl;
705
- const response = await this._axios.post("AddPerson", request , config);
706
- base.WebApiBase.SetCompleted(options, response);
707
- const res : carriers.PersonEntity = converters.Create_PersonEntity_From( response.data );
708
- resolve(res);
709
- }
710
- catch( err ) {
711
- base.WebApiBase.HandleError(options, config, err);
712
- reject(err);
713
- }
714
- });
715
- }
716
-
717
-
718
-
719
- /**
720
- * Add a person to the given contact
721
- * @param request - ContactId, NewPersonEntity
722
- * @returns Updated person object
723
- */
724
- public async addPersonAsync(request: carriers.Contact_AddPersonRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PersonEntity >;
725
-
726
- /**
727
- * Add a person to the given contact
728
- * @param contactId - Contact to add person to
729
- * @param newPersonEntity - Person object to add
730
- * @returns Updated person object
731
- */
732
- public async addPersonAsync(contactId: number, newPersonEntity: carriers.PersonEntity, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PersonEntity >;
733
-
734
- public async addPersonAsync(contactId:number|carriers.Contact_AddPersonRequest, newPersonEntity?:carriers.PersonEntity|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PersonEntity > {
735
- let _request : carriers.Contact_AddPersonRequest = null;
736
- let _options : base.WebApiRequestOptions = null;
737
- const first : any = contactId;
738
- if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' || typeof(first.newPersonEntity)!='undefined' ) )
739
- {
740
- _request = contactId as carriers.Contact_AddPersonRequest;
741
- _options = newPersonEntity as base.WebApiRequestOptions;
742
- }
743
- else
744
- {
745
- _request = {
746
- contactId: contactId as number,
747
- newPersonEntity: newPersonEntity as carriers.PersonEntity,
748
- };
749
- _options = webapi_options;
750
- }
751
- return this._addPersonAsync( _request, _options );
752
- }
753
-
754
-
755
- private async _getDuplicatesAsync(request: carriers.Contact_GetDuplicatesRequest, options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] > {
756
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
757
- base.WebApiBase.SetPending(options);
758
- return new Promise< carriers.DuplicateEntry[] >(async (resolve, reject) => {
759
- try {
760
- config.baseURL = this._options.baseUrl;
761
- const response = await this._axios.post("GetDuplicates", request , config);
762
- base.WebApiBase.SetCompleted(options, response);
763
- const res : carriers.DuplicateEntry[] = converters.Create_DuplicateEntryArray_From( response.data );
764
- resolve(res);
765
- }
766
- catch( err ) {
767
- base.WebApiBase.HandleError(options, config, err);
768
- reject(err);
769
- }
770
- });
771
- }
772
-
773
-
774
-
775
- /**
776
- * Get duplicates (exact or similar in the database) based on the name
777
- * @param request - Name
778
- * @returns Any records matching the specified name
779
- */
780
- public async getDuplicatesAsync(request: carriers.Contact_GetDuplicatesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
781
-
782
- /**
783
- * Get duplicates (exact or similar in the database) based on the name
784
- * @param name - Name used for lookup
785
- * @returns Any records matching the specified name
786
- */
787
- public async getDuplicatesAsync(name: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
788
-
789
- public async getDuplicatesAsync(name:string|carriers.Contact_GetDuplicatesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] > {
790
- let _request : carriers.Contact_GetDuplicatesRequest = null;
791
- let _options : base.WebApiRequestOptions = null;
792
- const first : any = name;
793
- if( typeof( first ) === "object" && first && ( typeof(first.name)!='undefined' ) )
794
- {
795
- _request = name as carriers.Contact_GetDuplicatesRequest;
796
- _options = webapi_options as base.WebApiRequestOptions;
797
- }
798
- else
799
- {
800
- _request = {
801
- name: name as string,
802
- };
803
- _options = webapi_options;
804
- }
805
- return this._getDuplicatesAsync( _request, _options );
806
- }
807
-
808
-
809
- private async _createNewEntryAsync(request: carriers.Contact_CreateNewEntryRequest, options?:base.WebApiRequestOptions) : Promise< number > {
810
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
811
- base.WebApiBase.SetPending(options);
812
- return new Promise< number >(async (resolve, reject) => {
813
- try {
814
- config.baseURL = this._options.baseUrl;
815
- const response = await this._axios.post("CreateNewEntry", request , config);
816
- base.WebApiBase.SetCompleted(options, response);
817
- const res : number = response.data as number;
818
- resolve(res);
819
- }
820
- catch( err ) {
821
- base.WebApiBase.HandleError(options, config, err);
822
- reject(err);
823
- }
824
- });
825
- }
826
-
827
-
828
-
829
- /**
830
- * Creates a new contact based on external duplicate
831
- * @param request - Duplicate
832
- * @returns The database identity of the newly created entry
833
- */
834
- public async createNewEntryAsync(request: carriers.Contact_CreateNewEntryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
835
-
836
- /**
837
- * Creates a new contact based on external duplicate
838
- * @param duplicate - The duplicate to create a new entry based upon
839
- * @returns The database identity of the newly created entry
840
- */
841
- public async createNewEntryAsync(duplicate: carriers.DuplicateEntry, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
842
-
843
- public async createNewEntryAsync(duplicate:carriers.DuplicateEntry|carriers.Contact_CreateNewEntryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number > {
844
- let _request : carriers.Contact_CreateNewEntryRequest = null;
845
- let _options : base.WebApiRequestOptions = null;
846
- const first : any = duplicate;
847
- if( typeof( first ) === "object" && first && ( typeof(first.duplicate)!='undefined' ) )
848
- {
849
- _request = duplicate as carriers.Contact_CreateNewEntryRequest;
850
- _options = webapi_options as base.WebApiRequestOptions;
851
- }
852
- else
853
- {
854
- _request = {
855
- duplicate: duplicate as carriers.DuplicateEntry,
856
- };
857
- _options = webapi_options;
858
- }
859
- return this._createNewEntryAsync( _request, _options );
860
- }
861
-
862
-
863
- private async _getDuplicateRulesAsync( options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateRule[] > {
864
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
865
- base.WebApiBase.SetPending(options);
866
- return new Promise< carriers.DuplicateRule[] >(async (resolve, reject) => {
867
- try {
868
- config.baseURL = this._options.baseUrl;
869
- const response = await this._axios.post("GetDuplicateRules", undefined , config);
870
- base.WebApiBase.SetCompleted(options, response);
871
- const res : carriers.DuplicateRule[] = converters.Create_DuplicateRuleArray_From( response.data );
872
- resolve(res);
873
- }
874
- catch( err ) {
875
- base.WebApiBase.HandleError(options, config, err);
876
- reject(err);
877
- }
878
- });
879
- }
880
-
881
-
882
- /**
883
- * Retrieve all available duplicate rules for contact
884
- * @returns All available duplicate rules
885
- */
886
- public async getDuplicateRulesAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateRule[] >
887
- {
888
- return this._getDuplicateRulesAsync(webapi_options);
889
- }
890
-
891
-
892
- private async _setDuplicateRulesStatusAsync(request: carriers.Contact_SetDuplicateRulesStatusRequest, options?:base.WebApiRequestOptions) : Promise< void > {
893
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
894
- base.WebApiBase.SetPending(options);
895
- return new Promise< void >(async (resolve, reject) => {
896
- try {
897
- config.baseURL = this._options.baseUrl;
898
- const response = await this._axios.post("SetDuplicateRulesStatus", request , config);
899
- base.WebApiBase.SetCompleted(options, response);
900
- const res = response.data;
901
- resolve(res);
902
- }
903
- catch( err ) {
904
- base.WebApiBase.HandleError(options, config, err);
905
- reject(err);
906
- }
907
- });
908
- }
909
-
910
-
911
-
912
- /**
913
- * Set which duplicate rules should be active or not
914
- * @param request - Rules
915
- * @returns
916
- */
917
- public async setDuplicateRulesStatusAsync(request: carriers.Contact_SetDuplicateRulesStatusRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
918
-
919
- /**
920
- * Set which duplicate rules should be active or not
921
- * @param rules - Duplicate rules to update active status for
922
- * @returns
923
- */
924
- public async setDuplicateRulesStatusAsync(rules: carriers.DuplicateRule[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
925
-
926
- public async setDuplicateRulesStatusAsync(rules:carriers.DuplicateRule[]|carriers.Contact_SetDuplicateRulesStatusRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
927
- let _request : carriers.Contact_SetDuplicateRulesStatusRequest = null;
928
- let _options : base.WebApiRequestOptions = null;
929
- const first : any = rules;
930
- if( typeof( first ) === "object" && first && ( typeof(first.rules)!='undefined' ) )
931
- {
932
- _request = rules as carriers.Contact_SetDuplicateRulesStatusRequest;
933
- _options = webapi_options as base.WebApiRequestOptions;
934
- }
935
- else
936
- {
937
- _request = {
938
- rules: rules as carriers.DuplicateRule[],
939
- };
940
- _options = webapi_options;
941
- }
942
- return this._setDuplicateRulesStatusAsync( _request, _options );
943
- }
944
-
945
-
946
- private async _mergeAsync(request: carriers.Contact_MergeRequest, options?:base.WebApiRequestOptions) : Promise< void > {
947
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
948
- base.WebApiBase.SetPending(options);
949
- return new Promise< void >(async (resolve, reject) => {
950
- try {
951
- config.baseURL = this._options.baseUrl;
952
- const response = await this._axios.post("Merge", request , config);
953
- base.WebApiBase.SetCompleted(options, response);
954
- const res = response.data;
955
- resolve(res);
956
- }
957
- catch( err ) {
958
- base.WebApiBase.HandleError(options, config, err);
959
- reject(err);
960
- }
961
- });
962
- }
963
-
964
-
965
-
966
- /**
967
- * Merge two contacts. The destination contact will remain.
968
- * @param request - SourceContactId, DestinationContactId, MergeIdenticalPersons, ReplaceEmptyFieldsOnDestination
969
- * @returns
970
- */
971
- public async mergeAsync(request: carriers.Contact_MergeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
972
-
973
- /**
974
- * Merge two contacts. The destination contact will remain.
975
- * @param sourceContactId - Source contact to merge from. This contact will disappear after the merge.
976
- * @param destinationContactId - Destination contact to merge into
977
- * @param mergeIdenticalPersons - Persons with identical names will be merged
978
- * @param replaceEmptyFieldsOnDestination - If true, empty fields on destination will be replaced by values from source.
979
- * @returns
980
- */
981
- public async mergeAsync(sourceContactId: number, destinationContactId: number, mergeIdenticalPersons: boolean, replaceEmptyFieldsOnDestination: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
982
-
983
- public async mergeAsync(sourceContactId:number|carriers.Contact_MergeRequest, destinationContactId?:number|base.WebApiRequestOptions, mergeIdenticalPersons?:boolean, replaceEmptyFieldsOnDestination?:boolean, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
984
- let _request : carriers.Contact_MergeRequest = null;
985
- let _options : base.WebApiRequestOptions = null;
986
- const first : any = sourceContactId;
987
- if( typeof( first ) === "object" && first && ( typeof(first.sourceContactId)!='undefined' || typeof(first.destinationContactId)!='undefined' || typeof(first.mergeIdenticalPersons)!='undefined' || typeof(first.replaceEmptyFieldsOnDestination)!='undefined' ) )
988
- {
989
- _request = sourceContactId as carriers.Contact_MergeRequest;
990
- _options = destinationContactId as base.WebApiRequestOptions;
991
- }
992
- else
993
- {
994
- _request = {
995
- sourceContactId: sourceContactId as number,
996
- destinationContactId: destinationContactId as number,
997
- mergeIdenticalPersons: mergeIdenticalPersons as boolean,
998
- replaceEmptyFieldsOnDestination: replaceEmptyFieldsOnDestination as boolean,
999
- };
1000
- _options = webapi_options;
1001
- }
1002
- return this._mergeAsync( _request, _options );
1003
- }
1004
-
1005
-
1006
- private async _copyAsync(request: carriers.Contact_CopyRequest, options?:base.WebApiRequestOptions) : Promise< number > {
1007
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1008
- base.WebApiBase.SetPending(options);
1009
- return new Promise< number >(async (resolve, reject) => {
1010
- try {
1011
- config.baseURL = this._options.baseUrl;
1012
- const response = await this._axios.post("Copy", request , config);
1013
- base.WebApiBase.SetCompleted(options, response);
1014
- const res : number = response.data as number;
1015
- resolve(res);
1016
- }
1017
- catch( err ) {
1018
- base.WebApiBase.HandleError(options, config, err);
1019
- reject(err);
1020
- }
1021
- });
1022
- }
1023
-
1024
-
1025
-
1026
- /**
1027
- * Copy a contact. Activities and related data will be ignored
1028
- * @param request - SourceContactId, DestinationContactName, DestinationContactDepartment, CopyPersons
1029
- * @returns Id of copied contact
1030
- */
1031
- public async copyAsync(request: carriers.Contact_CopyRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
1032
-
1033
- /**
1034
- * Copy a contact. Activities and related data will be ignored
1035
- * @param sourceContactId - The id of the contact to copy
1036
- * @param destinationContactName - The name of the destination contact
1037
- * @param destinationContactDepartment - The department of the destination contact
1038
- * @param copyPersons - If true, persons will be copied from source contact
1039
- * @returns Id of copied contact
1040
- */
1041
- public async copyAsync(sourceContactId: number, destinationContactName: string, destinationContactDepartment: string, copyPersons: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
1042
-
1043
- public async copyAsync(sourceContactId:number|carriers.Contact_CopyRequest, destinationContactName?:string|base.WebApiRequestOptions, destinationContactDepartment?:string, copyPersons?:boolean, webapi_options?:base.WebApiRequestOptions) : Promise< number > {
1044
- let _request : carriers.Contact_CopyRequest = null;
1045
- let _options : base.WebApiRequestOptions = null;
1046
- const first : any = sourceContactId;
1047
- if( typeof( first ) === "object" && first && ( typeof(first.sourceContactId)!='undefined' || typeof(first.destinationContactName)!='undefined' || typeof(first.destinationContactDepartment)!='undefined' || typeof(first.copyPersons)!='undefined' ) )
1048
- {
1049
- _request = sourceContactId as carriers.Contact_CopyRequest;
1050
- _options = destinationContactName as base.WebApiRequestOptions;
1051
- }
1052
- else
1053
- {
1054
- _request = {
1055
- sourceContactId: sourceContactId as number,
1056
- destinationContactName: destinationContactName as string,
1057
- destinationContactDepartment: destinationContactDepartment as string,
1058
- copyPersons: copyPersons as boolean,
1059
- };
1060
- _options = webapi_options;
1061
- }
1062
- return this._copyAsync( _request, _options );
1063
- }
1064
-
1065
-
1066
- private async _getNameDepartmentDuplicatesAsync(request: carriers.Contact_GetNameDepartmentDuplicatesRequest, options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] > {
1067
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1068
- base.WebApiBase.SetPending(options);
1069
- return new Promise< carriers.DuplicateEntry[] >(async (resolve, reject) => {
1070
- try {
1071
- config.baseURL = this._options.baseUrl;
1072
- const response = await this._axios.post("GetNameDepartmentDuplicates", request , config);
1073
- base.WebApiBase.SetCompleted(options, response);
1074
- const res : carriers.DuplicateEntry[] = converters.Create_DuplicateEntryArray_From( response.data );
1075
- resolve(res);
1076
- }
1077
- catch( err ) {
1078
- base.WebApiBase.HandleError(options, config, err);
1079
- reject(err);
1080
- }
1081
- });
1082
- }
1083
-
1084
-
1085
-
1086
- /**
1087
- * Get duplicates based on the contact name and department
1088
- * @param request - Name, Department
1089
- * @returns Any records matching the specified name and department
1090
- */
1091
- public async getNameDepartmentDuplicatesAsync(request: carriers.Contact_GetNameDepartmentDuplicatesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
1092
-
1093
- /**
1094
- * Get duplicates based on the contact name and department
1095
- * @param name - Name used for lookup
1096
- * @param department - Department used for lookup (if any)
1097
- * @returns Any records matching the specified name and department
1098
- */
1099
- public async getNameDepartmentDuplicatesAsync(name: string, department: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
1100
-
1101
- public async getNameDepartmentDuplicatesAsync(name:string|carriers.Contact_GetNameDepartmentDuplicatesRequest, department?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] > {
1102
- let _request : carriers.Contact_GetNameDepartmentDuplicatesRequest = null;
1103
- let _options : base.WebApiRequestOptions = null;
1104
- const first : any = name;
1105
- if( typeof( first ) === "object" && first && ( typeof(first.name)!='undefined' || typeof(first.department)!='undefined' ) )
1106
- {
1107
- _request = name as carriers.Contact_GetNameDepartmentDuplicatesRequest;
1108
- _options = department as base.WebApiRequestOptions;
1109
- }
1110
- else
1111
- {
1112
- _request = {
1113
- name: name as string,
1114
- department: department as string,
1115
- };
1116
- _options = webapi_options;
1117
- }
1118
- return this._getNameDepartmentDuplicatesAsync( _request, _options );
1119
- }
1120
-
1121
-
1122
- private async _getDomainDuplicatesAsync(request: carriers.Contact_GetDomainDuplicatesRequest, options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] > {
1123
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1124
- base.WebApiBase.SetPending(options);
1125
- return new Promise< carriers.DuplicateEntry[] >(async (resolve, reject) => {
1126
- try {
1127
- config.baseURL = this._options.baseUrl;
1128
- const response = await this._axios.post("GetDomainDuplicates", request , config);
1129
- base.WebApiBase.SetCompleted(options, response);
1130
- const res : carriers.DuplicateEntry[] = converters.Create_DuplicateEntryArray_From( response.data );
1131
- resolve(res);
1132
- }
1133
- catch( err ) {
1134
- base.WebApiBase.HandleError(options, config, err);
1135
- reject(err);
1136
- }
1137
- });
1138
- }
1139
-
1140
-
1141
-
1142
- /**
1143
- * Get duplicates based on the domain
1144
- * @param request - Domain
1145
- * @returns Any records matching the specified domain
1146
- */
1147
- public async getDomainDuplicatesAsync(request: carriers.Contact_GetDomainDuplicatesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
1148
-
1149
- /**
1150
- * Get duplicates based on the domain
1151
- * @param domain - Domain used for lookup
1152
- * @returns Any records matching the specified domain
1153
- */
1154
- public async getDomainDuplicatesAsync(domain: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
1155
-
1156
- public async getDomainDuplicatesAsync(domain:string|carriers.Contact_GetDomainDuplicatesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] > {
1157
- let _request : carriers.Contact_GetDomainDuplicatesRequest = null;
1158
- let _options : base.WebApiRequestOptions = null;
1159
- const first : any = domain;
1160
- if( typeof( first ) === "object" && first && ( typeof(first.domain)!='undefined' ) )
1161
- {
1162
- _request = domain as carriers.Contact_GetDomainDuplicatesRequest;
1163
- _options = webapi_options as base.WebApiRequestOptions;
1164
- }
1165
- else
1166
- {
1167
- _request = {
1168
- domain: domain as string,
1169
- };
1170
- _options = webapi_options;
1171
- }
1172
- return this._getDomainDuplicatesAsync( _request, _options );
1173
- }
1174
-
1175
-
1176
- private async _isNumberValidAsync(request: carriers.Contact_IsNumberValidRequest, options?:base.WebApiRequestOptions) : Promise< boolean > {
1177
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1178
- base.WebApiBase.SetPending(options);
1179
- return new Promise< boolean >(async (resolve, reject) => {
1180
- try {
1181
- config.baseURL = this._options.baseUrl;
1182
- const response = await this._axios.post("IsNumberValid", request , config);
1183
- base.WebApiBase.SetCompleted(options, response);
1184
- const res : boolean = response.data as boolean;
1185
- resolve(res);
1186
- }
1187
- catch( err ) {
1188
- base.WebApiBase.HandleError(options, config, err);
1189
- reject(err);
1190
- }
1191
- });
1192
- }
1193
-
1194
-
1195
-
1196
- /**
1197
- * Checks if the number is unique or required. The setting is configured from admin under system options.
1198
- * @param request - ContactId, Number
1199
- * @returns True if the number satisifies the configured rules for uniqueness.
1200
- */
1201
- public async isNumberValidAsync(request: carriers.Contact_IsNumberValidRequest, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
1202
-
1203
- /**
1204
- * Checks if the number is unique or required. The setting is configured from admin under system options.
1205
- * @param contactId - Primary key
1206
- * @param number - Number field value to check.
1207
- * @returns True if the number satisifies the configured rules for uniqueness.
1208
- */
1209
- public async isNumberValidAsync(contactId: number, number: string, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
1210
-
1211
- public async isNumberValidAsync(contactId:number|carriers.Contact_IsNumberValidRequest, number?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< boolean > {
1212
- let _request : carriers.Contact_IsNumberValidRequest = null;
1213
- let _options : base.WebApiRequestOptions = null;
1214
- const first : any = contactId;
1215
- if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' || typeof(first.number)!='undefined' ) )
1216
- {
1217
- _request = contactId as carriers.Contact_IsNumberValidRequest;
1218
- _options = number as base.WebApiRequestOptions;
1219
- }
1220
- else
1221
- {
1222
- _request = {
1223
- contactId: contactId as number,
1224
- number: number as string,
1225
- };
1226
- _options = webapi_options;
1227
- }
1228
- return this._isNumberValidAsync( _request, _options );
1229
- }
1230
-
1231
-
1232
- private async _getQuoteVersionAddressesAsync(request: carriers.Contact_GetQuoteVersionAddressesRequest, options?:base.WebApiRequestOptions) : Promise< carriers.Address[] > {
1233
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1234
- base.WebApiBase.SetPending(options);
1235
- return new Promise< carriers.Address[] >(async (resolve, reject) => {
1236
- try {
1237
- config.baseURL = this._options.baseUrl;
1238
- const response = await this._axios.post("GetQuoteVersionAddresses", request , config);
1239
- base.WebApiBase.SetCompleted(options, response);
1240
- const res : carriers.Address[] = converters.Create_AddressArray_From( response.data );
1241
- resolve(res);
1242
- }
1243
- catch( err ) {
1244
- base.WebApiBase.HandleError(options, config, err);
1245
- reject(err);
1246
- }
1247
- });
1248
- }
1249
-
1250
-
1251
-
1252
- /**
1253
- * Get the associated billing and invoice quote version addresses. These addresses might be address on the contact, or a custom address.
1254
- * @param request - QuoteVersionId
1255
- * @returns The quote version addresses. Invoice and billing address, in that order.
1256
- */
1257
- public async getQuoteVersionAddressesAsync(request: carriers.Contact_GetQuoteVersionAddressesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address[] >;
1258
-
1259
- /**
1260
- * Get the associated billing and invoice quote version addresses. These addresses might be address on the contact, or a custom address.
1261
- * @param quoteVersionId - The version to get the addresses for.
1262
- * @returns The quote version addresses. Invoice and billing address, in that order.
1263
- */
1264
- public async getQuoteVersionAddressesAsync(quoteVersionId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address[] >;
1265
-
1266
- public async getQuoteVersionAddressesAsync(quoteVersionId:number|carriers.Contact_GetQuoteVersionAddressesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address[] > {
1267
- let _request : carriers.Contact_GetQuoteVersionAddressesRequest = null;
1268
- let _options : base.WebApiRequestOptions = null;
1269
- const first : any = quoteVersionId;
1270
- if( typeof( first ) === "object" && first && ( typeof(first.quoteVersionId)!='undefined' ) )
1271
- {
1272
- _request = quoteVersionId as carriers.Contact_GetQuoteVersionAddressesRequest;
1273
- _options = webapi_options as base.WebApiRequestOptions;
1274
- }
1275
- else
1276
- {
1277
- _request = {
1278
- quoteVersionId: quoteVersionId as number,
1279
- };
1280
- _options = webapi_options;
1281
- }
1282
- return this._getQuoteVersionAddressesAsync( _request, _options );
1283
- }
1284
-
1285
-
1286
- private async _saveQuoteVersionAddressAsync(request: carriers.Contact_SaveQuoteVersionAddressRequest, options?:base.WebApiRequestOptions) : Promise< carriers.Address > {
1287
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1288
- base.WebApiBase.SetPending(options);
1289
- return new Promise< carriers.Address >(async (resolve, reject) => {
1290
- try {
1291
- config.baseURL = this._options.baseUrl;
1292
- const response = await this._axios.post("SaveQuoteVersionAddress", request , config);
1293
- base.WebApiBase.SetCompleted(options, response);
1294
- const res : carriers.Address = converters.Create_Address_From( response.data );
1295
- resolve(res);
1296
- }
1297
- catch( err ) {
1298
- base.WebApiBase.HandleError(options, config, err);
1299
- reject(err);
1300
- }
1301
- });
1302
- }
1303
-
1304
-
1305
-
1306
- /**
1307
- * Save a custom quote version address.
1308
- * @param request - QuoteVersionId, Address, AddressType, CountryId
1309
- * @returns The saved addresses.
1310
- */
1311
- public async saveQuoteVersionAddressAsync(request: carriers.Contact_SaveQuoteVersionAddressRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
1312
-
1313
- /**
1314
- * Save a custom quote version address.
1315
- * @param quoteVersionId - The version to save the address on.
1316
- * @param address - The address to save on the quote version.
1317
- * @param addressType - Should be either QuoteBillingAddress or QuoteShippingAddress
1318
- * @param countryId - The country for the custom address
1319
- * @returns The saved addresses.
1320
- */
1321
- public async saveQuoteVersionAddressAsync(quoteVersionId: number, address: carriers.Address, addressType: enums.AddressType, countryId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
1322
-
1323
- public async saveQuoteVersionAddressAsync(quoteVersionId:number|carriers.Contact_SaveQuoteVersionAddressRequest, address?:carriers.Address|base.WebApiRequestOptions, addressType?:enums.AddressType, countryId?:number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address > {
1324
- let _request : carriers.Contact_SaveQuoteVersionAddressRequest = null;
1325
- let _options : base.WebApiRequestOptions = null;
1326
- const first : any = quoteVersionId;
1327
- if( typeof( first ) === "object" && first && ( typeof(first.quoteVersionId)!='undefined' || typeof(first.address)!='undefined' || typeof(first.addressType)!='undefined' || typeof(first.countryId)!='undefined' ) )
1328
- {
1329
- _request = quoteVersionId as carriers.Contact_SaveQuoteVersionAddressRequest;
1330
- _options = address as base.WebApiRequestOptions;
1331
- }
1332
- else
1333
- {
1334
- _request = {
1335
- quoteVersionId: quoteVersionId as number,
1336
- address: address as carriers.Address,
1337
- addressType: addressType as enums.AddressType,
1338
- countryId: countryId as number,
1339
- };
1340
- _options = webapi_options;
1341
- }
1342
- return this._saveQuoteVersionAddressAsync( _request, _options );
1343
- }
1344
-
1345
-
1346
- private async _deleteExpiredAsync( options?:base.WebApiRequestOptions) : Promise< void > {
1347
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1348
- base.WebApiBase.SetPending(options);
1349
- return new Promise< void >(async (resolve, reject) => {
1350
- try {
1351
- config.baseURL = this._options.baseUrl;
1352
- const response = await this._axios.post("DeleteExpired", undefined , config);
1353
- base.WebApiBase.SetCompleted(options, response);
1354
- const res = response.data;
1355
- resolve(res);
1356
- }
1357
- catch( err ) {
1358
- base.WebApiBase.HandleError(options, config, err);
1359
- reject(err);
1360
- }
1361
- });
1362
- }
1363
-
1364
-
1365
- /**
1366
- * Trigger deletion of contacts (companies) that has been (soft) deleted and have timed out the expiry period (the SoftDeleteRetention preference).
1367
- * @returns
1368
- */
1369
- public async deleteExpiredAsync(webapi_options?:base.WebApiRequestOptions) : Promise< void >
1370
- {
1371
- return this._deleteExpiredAsync(webapi_options);
1372
- }
1373
-
1374
-
1375
- private async _getContactSummaryAsync(request: carriers.Contact_GetContactSummaryRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ContactSummary > {
1376
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1377
- base.WebApiBase.SetPending(options);
1378
- return new Promise< carriers.ContactSummary >(async (resolve, reject) => {
1379
- try {
1380
- config.baseURL = this._options.baseUrl;
1381
- const response = await this._axios.post("GetContactSummary", request , config);
1382
- base.WebApiBase.SetCompleted(options, response);
1383
- const res : carriers.ContactSummary = converters.Create_ContactSummary_From( response.data );
1384
- resolve(res);
1385
- }
1386
- catch( err ) {
1387
- base.WebApiBase.HandleError(options, config, err);
1388
- reject(err);
1389
- }
1390
- });
1391
- }
1392
-
1393
-
1394
-
1395
- /**
1396
- * Get summary of contact and its recent activity.
1397
- * @param request - ContactId, Limit
1398
- * @returns Summary of contact, with recent requests, sales, follow-ups, chats.
1399
- */
1400
- public async getContactSummaryAsync(request: carriers.Contact_GetContactSummaryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactSummary >;
1401
-
1402
- /**
1403
- * Get summary of contact and its recent activity.
1404
- * @param contactId - The contact id to summarize.
1405
- * @param limit - Max number of items to include in summary lists.
1406
- * @returns Summary of contact, with recent requests, sales, follow-ups, chats.
1407
- */
1408
- public async getContactSummaryAsync(contactId: number, limit: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactSummary >;
1409
-
1410
- public async getContactSummaryAsync(contactId:number|carriers.Contact_GetContactSummaryRequest, limit?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactSummary > {
1411
- let _request : carriers.Contact_GetContactSummaryRequest = null;
1412
- let _options : base.WebApiRequestOptions = null;
1413
- const first : any = contactId;
1414
- if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' || typeof(first.limit)!='undefined' ) )
1415
- {
1416
- _request = contactId as carriers.Contact_GetContactSummaryRequest;
1417
- _options = limit as base.WebApiRequestOptions;
1418
- }
1419
- else
1420
- {
1421
- _request = {
1422
- contactId: contactId as number,
1423
- limit: limit as number,
1424
- };
1425
- _options = webapi_options;
1426
- }
1427
- return this._getContactSummaryAsync( _request, _options );
1428
- }
1429
-
1430
-
1431
- private async _validateContactEntityAsync(request: carriers.Contact_ValidateContactEntityRequest, options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary > {
1432
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1433
- base.WebApiBase.SetPending(options);
1434
- return new Promise< carriers.StringDictionary >(async (resolve, reject) => {
1435
- try {
1436
- config.baseURL = this._options.baseUrl;
1437
- const response = await this._axios.post("ValidateContactEntity", request , config);
1438
- base.WebApiBase.SetCompleted(options, response);
1439
- const res : carriers.StringDictionary = converters.Create_StringDictionary_From( response.data );
1440
- resolve(res);
1441
- }
1442
- catch( err ) {
1443
- base.WebApiBase.HandleError(options, config, err);
1444
- reject(err);
1445
- }
1446
- });
1447
- }
1448
-
1449
-
1450
-
1451
- /**
1452
- * Check that entity is ready for saving, return error messages by field.
1453
- * @param request - ContactEntity
1454
- * @returns Error messages tagged by field.
1455
- */
1456
- public async validateContactEntityAsync(request: carriers.Contact_ValidateContactEntityRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
1457
-
1458
- /**
1459
- * Check that entity is ready for saving, return error messages by field.
1460
- * @param contactEntity - Entity to be checked for errors.
1461
- * @returns Error messages tagged by field.
1462
- */
1463
- public async validateContactEntityAsync(contactEntity: carriers.ContactEntity, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
1464
-
1465
- public async validateContactEntityAsync(contactEntity:carriers.ContactEntity|carriers.Contact_ValidateContactEntityRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary > {
1466
- let _request : carriers.Contact_ValidateContactEntityRequest = null;
1467
- let _options : base.WebApiRequestOptions = null;
1468
- const first : any = contactEntity;
1469
- if( typeof( first ) === "object" && first && ( typeof(first.contactEntity)!='undefined' ) )
1470
- {
1471
- _request = contactEntity as carriers.Contact_ValidateContactEntityRequest;
1472
- _options = webapi_options as base.WebApiRequestOptions;
1473
- }
1474
- else
1475
- {
1476
- _request = {
1477
- contactEntity: contactEntity as carriers.ContactEntity,
1478
- };
1479
- _options = webapi_options;
1480
- }
1481
- return this._validateContactEntityAsync( _request, _options );
1482
- }
1483
-
1484
-
1485
- private async _enrichContactEntityAsync(request: carriers.Contact_EnrichContactEntityRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
1486
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1487
- base.WebApiBase.SetPending(options);
1488
- return new Promise< carriers.ContactEntity >(async (resolve, reject) => {
1489
- try {
1490
- config.baseURL = this._options.baseUrl;
1491
- const response = await this._axios.post("EnrichContactEntity", request , config);
1492
- base.WebApiBase.SetCompleted(options, response);
1493
- const res : carriers.ContactEntity = converters.Create_ContactEntity_From( response.data );
1494
- resolve(res);
1495
- }
1496
- catch( err ) {
1497
- base.WebApiBase.HandleError(options, config, err);
1498
- reject(err);
1499
- }
1500
- });
1501
- }
1502
-
1503
-
1504
-
1505
- /**
1506
- * Enrich a contact with data from the AI Enrichment service. This will update the contact with address, phone number, and email.
1507
- * @param request - ContactEntity, EnrichId
1508
- * @returns Enriched contact entity with address, phone number, and email updated.
1509
- */
1510
- public async enrichContactEntityAsync(request: carriers.Contact_EnrichContactEntityRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
1511
-
1512
- /**
1513
- * Enrich a contact with data from the AI Enrichment service. This will update the contact with address, phone number, and email.
1514
- * @param contactEntity - The contact entity to enrich.
1515
- * @param enrichId - Id from the EnrichContact provider
1516
- * @returns Enriched contact entity with address, phone number, and email updated.
1517
- */
1518
- public async enrichContactEntityAsync(contactEntity: carriers.ContactEntity, enrichId: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
1519
-
1520
- public async enrichContactEntityAsync(contactEntity:carriers.ContactEntity|carriers.Contact_EnrichContactEntityRequest, enrichId?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
1521
- let _request : carriers.Contact_EnrichContactEntityRequest = null;
1522
- let _options : base.WebApiRequestOptions = null;
1523
- const first : any = contactEntity;
1524
- if( typeof( first ) === "object" && first && ( typeof(first.contactEntity)!='undefined' || typeof(first.enrichId)!='undefined' ) )
1525
- {
1526
- _request = contactEntity as carriers.Contact_EnrichContactEntityRequest;
1527
- _options = enrichId as base.WebApiRequestOptions;
1528
- }
1529
- else
1530
- {
1531
- _request = {
1532
- contactEntity: contactEntity as carriers.ContactEntity,
1533
- enrichId: enrichId as string,
1534
- };
1535
- _options = webapi_options;
1536
- }
1537
- return this._enrichContactEntityAsync( _request, _options );
1538
- }
1539
-
1540
- /**
1541
- * Gets an array of Contact objects.
1542
- * @param contactIds - The primary keys.
1543
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
1544
- * @returns An array of Contact
1545
- */
1546
- public async getContactListAsync(contactIds: number[], options?:base.WebApiRequestOptions) : Promise< carriers.Contact[] > {
1547
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1548
- base.WebApiBase.SetPending(options);
1549
- return new Promise< carriers.Contact[] >(async (resolve, reject) => {
1550
- try {
1551
- const response = await this._axios.post("GetContactList", contactIds, config);
1552
- base.WebApiBase.SetCompleted(options, response);
1553
- const res = converters.Create_ContactArray_From( response.data );
1554
- resolve(res);
1555
- }
1556
- catch( err ) {
1557
- base.WebApiBase.HandleError(options, config, err);
1558
- reject(err);
1559
- }
1560
- });
1561
- }
1562
-
1563
-
1564
- private async _getMyContactsAsync( options?:base.WebApiRequestOptions) : Promise< carriers.Contact[] > {
1565
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1566
- base.WebApiBase.SetPending(options);
1567
- return new Promise< carriers.Contact[] >(async (resolve, reject) => {
1568
- try {
1569
- config.baseURL = this._options.baseUrl;
1570
- const response = await this._axios.post("GetMyContacts", undefined , config);
1571
- base.WebApiBase.SetCompleted(options, response);
1572
- const res : carriers.Contact[] = converters.Create_ContactArray_From( response.data );
1573
- resolve(res);
1574
- }
1575
- catch( err ) {
1576
- base.WebApiBase.HandleError(options, config, err);
1577
- reject(err);
1578
- }
1579
- });
1580
- }
1581
-
1582
-
1583
- /**
1584
- * Getting the contacts where the user currently logged in is set as contact owner.
1585
- * @returns Array of contacts
1586
- */
1587
- public async getMyContactsAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Contact[] >
1588
- {
1589
- return this._getMyContactsAsync(webapi_options);
1590
- }
1591
-
1592
-
1593
- private async _getMyRecentContactsAsync(request: carriers.Contact_GetMyRecentContactsRequest, options?:base.WebApiRequestOptions) : Promise< carriers.Contact[] > {
1594
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1595
- base.WebApiBase.SetPending(options);
1596
- return new Promise< carriers.Contact[] >(async (resolve, reject) => {
1597
- try {
1598
- config.baseURL = this._options.baseUrl;
1599
- const response = await this._axios.post("GetMyRecentContacts", request , config);
1600
- base.WebApiBase.SetCompleted(options, response);
1601
- const res : carriers.Contact[] = converters.Create_ContactArray_From( response.data );
1602
- resolve(res);
1603
- }
1604
- catch( err ) {
1605
- base.WebApiBase.HandleError(options, config, err);
1606
- reject(err);
1607
- }
1608
- });
1609
- }
1610
-
1611
-
1612
-
1613
- /**
1614
- * Method that returns a set of initial contacts. This could be the contacts in a favorites selection, the history list, the diary, or from all sources. If retrieved from the diary it will get appointments for the current and the next day.
1615
- * @param request - SourceType
1616
- * @returns Arrayof contacts
1617
- */
1618
- public async getMyRecentContactsAsync(request: carriers.Contact_GetMyRecentContactsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Contact[] >;
1619
-
1620
- /**
1621
- * Method that returns a set of initial contacts. This could be the contacts in a favorites selection, the history list, the diary, or from all sources. If retrieved from the diary it will get appointments for the current and the next day.
1622
- * @param sourceType - The source where the contacts are retrieved from (Favorites, History, Diary)
1623
- * @returns Arrayof contacts
1624
- */
1625
- public async getMyRecentContactsAsync(sourceType: enums.ContactSourceType, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Contact[] >;
1626
-
1627
- public async getMyRecentContactsAsync(sourceType:enums.ContactSourceType|carriers.Contact_GetMyRecentContactsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Contact[] > {
1628
- let _request : carriers.Contact_GetMyRecentContactsRequest = null;
1629
- let _options : base.WebApiRequestOptions = null;
1630
- const first : any = sourceType;
1631
- if( typeof( first ) === "object" && first && ( typeof(first.sourceType)!='undefined' ) )
1632
- {
1633
- _request = sourceType as carriers.Contact_GetMyRecentContactsRequest;
1634
- _options = webapi_options as base.WebApiRequestOptions;
1635
- }
1636
- else
1637
- {
1638
- _request = {
1639
- sourceType: sourceType as enums.ContactSourceType,
1640
- };
1641
- _options = webapi_options;
1642
- }
1643
- return this._getMyRecentContactsAsync( _request, _options );
1644
- }
1645
-
1646
-
1647
- private async _getPreviewContactAsync(request: carriers.Contact_GetPreviewContactRequest, options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact > {
1648
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1649
- base.WebApiBase.SetPending(options);
1650
- return new Promise< carriers.PreviewContact >(async (resolve, reject) => {
1651
- try {
1652
- config.baseURL = this._options.baseUrl;
1653
- const response = await this._axios.post("GetPreviewContact", request , config);
1654
- base.WebApiBase.SetCompleted(options, response);
1655
- const res : carriers.PreviewContact = converters.Create_PreviewContact_From( response.data );
1656
- resolve(res);
1657
- }
1658
- catch( err ) {
1659
- base.WebApiBase.HandleError(options, config, err);
1660
- reject(err);
1661
- }
1662
- });
1663
- }
1664
-
1665
-
1666
-
1667
- /**
1668
- * Get a contact from its ID
1669
- * @param request - ContactId
1670
- * @returns Minimal contact suitable for preview
1671
- */
1672
- public async getPreviewContactAsync(request: carriers.Contact_GetPreviewContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact >;
1673
-
1674
- /**
1675
- * Get a contact from its ID
1676
- * @param contactId - Contact ID
1677
- * @returns Minimal contact suitable for preview
1678
- */
1679
- public async getPreviewContactAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact >;
1680
-
1681
- public async getPreviewContactAsync(contactId:number|carriers.Contact_GetPreviewContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact > {
1682
- let _request : carriers.Contact_GetPreviewContactRequest = null;
1683
- let _options : base.WebApiRequestOptions = null;
1684
- const first : any = contactId;
1685
- if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' ) )
1686
- {
1687
- _request = contactId as carriers.Contact_GetPreviewContactRequest;
1688
- _options = webapi_options as base.WebApiRequestOptions;
1689
- }
1690
- else
1691
- {
1692
- _request = {
1693
- contactId: contactId as number,
1694
- };
1695
- _options = webapi_options;
1696
- }
1697
- return this._getPreviewContactAsync( _request, _options );
1698
- }
1699
-
1700
-
1701
- private async _getPreviewEnrichContactAsync(request: carriers.Contact_GetPreviewEnrichContactRequest, options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact > {
1702
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1703
- base.WebApiBase.SetPending(options);
1704
- return new Promise< carriers.PreviewContact >(async (resolve, reject) => {
1705
- try {
1706
- config.baseURL = this._options.baseUrl;
1707
- const response = await this._axios.post("GetPreviewEnrichContact", request , config);
1708
- base.WebApiBase.SetCompleted(options, response);
1709
- const res : carriers.PreviewContact = converters.Create_PreviewContact_From( response.data );
1710
- resolve(res);
1711
- }
1712
- catch( err ) {
1713
- base.WebApiBase.HandleError(options, config, err);
1714
- reject(err);
1715
- }
1716
- });
1717
- }
1718
-
1719
-
1720
-
1721
- /**
1722
- * Get a contact from its ID
1723
- * @param request - EnrichId
1724
- * @returns Minimal contact suitable for preview
1725
- */
1726
- public async getPreviewEnrichContactAsync(request: carriers.Contact_GetPreviewEnrichContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact >;
1727
-
1728
- /**
1729
- * Get a contact from its ID
1730
- * @param enrichId - Enrich Contact ID from the EnrichContact MDO list provider
1731
- * @returns Minimal contact suitable for preview
1732
- */
1733
- public async getPreviewEnrichContactAsync(enrichId: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact >;
1734
-
1735
- public async getPreviewEnrichContactAsync(enrichId:string|carriers.Contact_GetPreviewEnrichContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact > {
1736
- let _request : carriers.Contact_GetPreviewEnrichContactRequest = null;
1737
- let _options : base.WebApiRequestOptions = null;
1738
- const first : any = enrichId;
1739
- if( typeof( first ) === "object" && first && ( typeof(first.enrichId)!='undefined' ) )
1740
- {
1741
- _request = enrichId as carriers.Contact_GetPreviewEnrichContactRequest;
1742
- _options = webapi_options as base.WebApiRequestOptions;
1743
- }
1744
- else
1745
- {
1746
- _request = {
1747
- enrichId: enrichId as string,
1748
- };
1749
- _options = webapi_options;
1750
- }
1751
- return this._getPreviewEnrichContactAsync( _request, _options );
1752
- }
1753
-
1754
- } // class v1ContactAgentController
1755
-
1756
-
1
+ // <auto-generated>
2
+ // SuperOffice Code Generator
3
+ // modelling\templates\servicestswebapi\tswebapiagents.tt
4
+ // </auto-generated>
5
+
6
+
7
+ /* tslint:disable */
8
+ //----------------------------------------------------------------------------
9
+ // G E N E R A T E D F I L E ! D O N O T E D I T !
10
+ //----------------------------------------------------------------------------
11
+ //
12
+ // File: WebApi/ContactAgent.ts
13
+ //
14
+ //----------------------------------------------------------------------------
15
+ // Copyright (C) SuperOffice AS
16
+ //----------------------------------------------------------------------------
17
+
18
+ import { AxiosRequestConfig } from 'axios';
19
+ import { Duration } from 'dayjs/plugin/duration';
20
+ import * as enums from './Enums';
21
+ import * as base from './WebApiBase';
22
+ import * as carriers from './Carriers';
23
+ import * as converters from './Converters';
24
+ import { FromBase64ToString, ToBase64 } from './Base64';
25
+
26
+ /**
27
+ * Contact (company) data services.
28
+ */
29
+ export interface IContactAgent {
30
+ createDefaultContactEntityAsync(): Promise< carriers.ContactEntity >;
31
+ saveContactEntityAsync(entity: carriers.ContactEntity) : Promise< carriers.ContactEntity >;
32
+ deleteContactEntityAsync(ContactEntityId: number) : Promise<void>;
33
+ createDefaultPreviewContactAsync(): Promise< carriers.PreviewContact >;
34
+ getContactAsync(contactId: number) : Promise< carriers.Contact >;
35
+ getMyActiveContactsAsync(request: carriers.Contact_GetMyActiveContactsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactActivity[] >;
36
+ getMyActiveContactsAsync(activityStartTime: Date, contactCategories: number[], actionType: enums.ContactAction, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactActivity[] >;
37
+ getContactEntityAsync(contactEntityId: number) : Promise< carriers.ContactEntity >;
38
+ undeleteAsync(request: carriers.Contact_UndeleteRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
39
+ undeleteAsync(id: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
40
+ getPersonsAsync(request: carriers.Contact_GetPersonsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Person[] >;
41
+ getPersonsAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Person[] >;
42
+ getContactWithPersonsAsync(request: carriers.Contact_GetContactWithPersonsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
43
+ getContactWithPersonsAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
44
+ getMyContactAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
45
+ getMyBizCardAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
46
+ changeCountryAsync(request: carriers.Contact_ChangeCountryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
47
+ changeCountryAsync(contactEntity: carriers.ContactEntity, toCountryId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
48
+ getAddressAsync(request: carriers.Contact_GetAddressRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
49
+ getAddressAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
50
+ getAddressByCountryAsync(request: carriers.Contact_GetAddressByCountryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
51
+ getAddressByCountryAsync(contactId: number, countryId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
52
+ addPersonAsync(request: carriers.Contact_AddPersonRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PersonEntity >;
53
+ addPersonAsync(contactId: number, newPersonEntity: carriers.PersonEntity, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PersonEntity >;
54
+ getDuplicatesAsync(request: carriers.Contact_GetDuplicatesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
55
+ getDuplicatesAsync(name: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
56
+ createNewEntryAsync(request: carriers.Contact_CreateNewEntryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
57
+ createNewEntryAsync(duplicate: carriers.DuplicateEntry, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
58
+ getDuplicateRulesAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateRule[] >;
59
+ setDuplicateRulesStatusAsync(request: carriers.Contact_SetDuplicateRulesStatusRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
60
+ setDuplicateRulesStatusAsync(rules: carriers.DuplicateRule[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
61
+ mergeAsync(request: carriers.Contact_MergeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
62
+ mergeAsync(sourceContactId: number, destinationContactId: number, mergeIdenticalPersons: boolean, replaceEmptyFieldsOnDestination: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
63
+ copyAsync(request: carriers.Contact_CopyRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
64
+ copyAsync(sourceContactId: number, destinationContactName: string, destinationContactDepartment: string, copyPersons: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
65
+ getNameDepartmentDuplicatesAsync(request: carriers.Contact_GetNameDepartmentDuplicatesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
66
+ getNameDepartmentDuplicatesAsync(name: string, department: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
67
+ getDomainDuplicatesAsync(request: carriers.Contact_GetDomainDuplicatesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
68
+ getDomainDuplicatesAsync(domain: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
69
+ isNumberValidAsync(request: carriers.Contact_IsNumberValidRequest, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
70
+ isNumberValidAsync(contactId: number, number: string, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
71
+ getQuoteVersionAddressesAsync(request: carriers.Contact_GetQuoteVersionAddressesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address[] >;
72
+ getQuoteVersionAddressesAsync(quoteVersionId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address[] >;
73
+ saveQuoteVersionAddressAsync(request: carriers.Contact_SaveQuoteVersionAddressRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
74
+ saveQuoteVersionAddressAsync(quoteVersionId: number, address: carriers.Address, addressType: enums.AddressType, countryId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
75
+ deleteExpiredAsync(webapi_options?:base.WebApiRequestOptions) : Promise< void >;
76
+ getContactSummaryAsync(request: carriers.Contact_GetContactSummaryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactSummary >;
77
+ getContactSummaryAsync(contactId: number, limit: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactSummary >;
78
+ validateContactEntityAsync(request: carriers.Contact_ValidateContactEntityRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
79
+ validateContactEntityAsync(contactEntity: carriers.ContactEntity, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
80
+ enrichContactEntityAsync(request: carriers.Contact_EnrichContactEntityRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
81
+ enrichContactEntityAsync(contactEntity: carriers.ContactEntity, enrichId: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
82
+ getContactListAsync(contactIds: number[]) : Promise< carriers.Contact[] >;
83
+ getMyContactsAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Contact[] >;
84
+ getMyRecentContactsAsync(request: carriers.Contact_GetMyRecentContactsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Contact[] >;
85
+ getMyRecentContactsAsync(sourceType: enums.ContactSourceType, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Contact[] >;
86
+ getPreviewContactAsync(request: carriers.Contact_GetPreviewContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact >;
87
+ getPreviewContactAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact >;
88
+ getPreviewEnrichContactAsync(request: carriers.Contact_GetPreviewEnrichContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact >;
89
+ getPreviewEnrichContactAsync(enrichId: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact >;
90
+ } // interface IContactAgent
91
+
92
+
93
+
94
+
95
+ /**
96
+ * Contact (company) data services.
97
+ */
98
+ export class ContactAgent extends base.WebApiBase implements IContactAgent {
99
+ constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
100
+ constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
101
+ constructor(baseUrl: string, resourceManager:any);
102
+ constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
103
+ constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
104
+ constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
105
+ constructor(options: base.WebApiOptions);
106
+
107
+ constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
108
+ langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
109
+ langOrResourceOrRM?:string|base.ResourceParsing|any,
110
+ cultureCode?: string,
111
+ ) {
112
+ const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
113
+ options.basePath = "v1/Agents/Contact/";
114
+ super(options);
115
+ }
116
+
117
+
118
+
119
+ /**
120
+ * Set default values into a new ContactEntity.
121
+ * NetServer calculates default values on the entity, which is required when creating/storing a new instance
122
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
123
+ * @returns A blank entity.
124
+ */
125
+ public async createDefaultContactEntityAsync(options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
126
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
127
+ base.WebApiBase.SetPending(options);
128
+ return new Promise< carriers.ContactEntity >(async (resolve, reject) => {
129
+ try {
130
+ const response = await this._axios.post("CreateDefaultContactEntity", null, config);
131
+ base.WebApiBase.SetCompleted(options, response);
132
+ const res : carriers.ContactEntity = converters.Create_ContactEntity_From( response.data );
133
+ resolve(res);
134
+ }
135
+ catch( err ) {
136
+ base.WebApiBase.HandleError(options, config, err);
137
+ reject(err);
138
+ }
139
+ });
140
+ }
141
+ /**
142
+ * Replace the existing ContactEntity or creates a new ContactEntity if the id parameter is empty
143
+ * @param entity - The ContactEntity to be saved.
144
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
145
+ * @returns New or updated ContactEntity
146
+ */
147
+ public async saveContactEntityAsync(entity: carriers.ContactEntity, options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
148
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
149
+ base.WebApiBase.SetPending(options);
150
+ return new Promise< carriers.ContactEntity >(async (resolve, reject) => {
151
+ try {
152
+ const response = await this._axios.post("SaveContactEntity", entity, config);
153
+ base.WebApiBase.SetCompleted(options, response);
154
+ const res : carriers.ContactEntity = converters.Create_ContactEntity_From( response.data );
155
+ resolve(res);
156
+ }
157
+ catch( err ) {
158
+ base.WebApiBase.HandleError(options, config, err);
159
+ reject(err);
160
+ }
161
+ });
162
+ }
163
+
164
+ /**
165
+ * Deletes the ContactEntity
166
+ * @param ContactEntityId - The id of the ContactEntity to be deleted.
167
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
168
+ */
169
+ public async deleteContactEntityAsync(ContactEntityId: number, options?:base.WebApiRequestOptions) : Promise< void > {
170
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
171
+ base.WebApiBase.SetPending(options);
172
+ return new Promise< void >(async (resolve, reject) => {
173
+ try {
174
+ const response = await this._axios.post("DeleteContactEntity?ContactEntityId=" + ContactEntityId, null, config );
175
+ base.WebApiBase.SetCompleted(options, response);
176
+ const res = response.data;
177
+ resolve(res);
178
+ }
179
+ catch( err ) {
180
+ base.WebApiBase.HandleError(options, config, err);
181
+ reject(err);
182
+ }
183
+ });
184
+ }
185
+
186
+ /**
187
+ * Set default values into a new PreviewContact.
188
+ * NetServer calculates default values on the entity, which is required when creating/storing a new instance
189
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
190
+ * @returns A blank entity.
191
+ */
192
+ public async createDefaultPreviewContactAsync(options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact > {
193
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
194
+ base.WebApiBase.SetPending(options);
195
+ return new Promise< carriers.PreviewContact >(async (resolve, reject) => {
196
+ try {
197
+ const response = await this._axios.post("CreateDefaultPreviewContact", null, config);
198
+ base.WebApiBase.SetCompleted(options, response);
199
+ const res : carriers.PreviewContact = converters.Create_PreviewContact_From( response.data );
200
+ resolve(res);
201
+ }
202
+ catch( err ) {
203
+ base.WebApiBase.HandleError(options, config, err);
204
+ reject(err);
205
+ }
206
+ });
207
+ }
208
+ /**
209
+ * Gets a Contact object.
210
+ * @param contactId - The primary key.
211
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
212
+ * @returns A single Contact
213
+ */
214
+ public async getContactAsync(contactId: number, options?:base.WebApiRequestOptions) : Promise< carriers.Contact > {
215
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
216
+ base.WebApiBase.SetPending(options);
217
+ return new Promise< carriers.Contact >(async (resolve, reject) => {
218
+ try {
219
+ const response = await this._axios.post("GetContact?contactId=" + contactId, null, config);
220
+ base.WebApiBase.SetCompleted(options, response);
221
+ const res = converters.Create_Contact_From( response.data );
222
+ resolve(res);
223
+ }
224
+ catch( err ) {
225
+ base.WebApiBase.HandleError(options, config, err);
226
+ reject(err);
227
+ }
228
+ });
229
+ }
230
+
231
+
232
+ private async _getMyActiveContactsAsync(request: carriers.Contact_GetMyActiveContactsRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ContactActivity[] > {
233
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
234
+ base.WebApiBase.SetPending(options);
235
+ return new Promise< carriers.ContactActivity[] >(async (resolve, reject) => {
236
+ try {
237
+ config.baseURL = this._options.baseUrl;
238
+ const response = await this._axios.post("GetMyActiveContacts", request , config);
239
+ base.WebApiBase.SetCompleted(options, response);
240
+ const res : carriers.ContactActivity[] = converters.Create_ContactActivityArray_From( response.data );
241
+ resolve(res);
242
+ }
243
+ catch( err ) {
244
+ base.WebApiBase.HandleError(options, config, err);
245
+ reject(err);
246
+ }
247
+ });
248
+ }
249
+
250
+
251
+
252
+ /**
253
+ * Returns the contacts where there has been activity since activityStartTime. If activityStartTime is larger than the current date, all contacts with activity since last log-out are returned. The result set can be filtered by category and action type.
254
+ * @param request - ActivityStartTime, ContactCategories, ActionType
255
+ * @returns Array of contacts where there have been activity in the period.
256
+ */
257
+ public async getMyActiveContactsAsync(request: carriers.Contact_GetMyActiveContactsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactActivity[] >;
258
+
259
+ /**
260
+ * Returns the contacts where there has been activity since activityStartTime. If activityStartTime is larger than the current date, all contacts with activity since last log-out are returned. The result set can be filtered by category and action type.
261
+ * @param activityStartTime - The start time of the activities. If the start time is set to a future date; activites since the user last logged out are returned.
262
+ * @param contactCategories - Integer array of categories to filter on. If the array is empty contacts from all categories will be selected.
263
+ * @param actionType - The type of action that has occured. E.g. updates, deletes, new appointments, etc.
264
+ * @returns Array of contacts where there have been activity in the period.
265
+ */
266
+ public async getMyActiveContactsAsync(activityStartTime: Date, contactCategories: number[], actionType: enums.ContactAction, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactActivity[] >;
267
+
268
+ public async getMyActiveContactsAsync(activityStartTime:Date|carriers.Contact_GetMyActiveContactsRequest, contactCategories?:number[]|base.WebApiRequestOptions, actionType?:enums.ContactAction, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactActivity[] > {
269
+ let _request : carriers.Contact_GetMyActiveContactsRequest = null;
270
+ let _options : base.WebApiRequestOptions = null;
271
+ const first : any = activityStartTime;
272
+ if( typeof( first ) === "object" && first && ( typeof(first.activityStartTime)!='undefined' || typeof(first.contactCategories)!='undefined' || typeof(first.actionType)!='undefined' ) )
273
+ {
274
+ _request = activityStartTime as carriers.Contact_GetMyActiveContactsRequest;
275
+ _options = contactCategories as base.WebApiRequestOptions;
276
+ }
277
+ else
278
+ {
279
+ _request = {
280
+ activityStartTime: activityStartTime as Date,
281
+ contactCategories: contactCategories as number[],
282
+ actionType: actionType as enums.ContactAction,
283
+ };
284
+ _options = webapi_options;
285
+ }
286
+ return this._getMyActiveContactsAsync( _request, _options );
287
+ }
288
+
289
+ /**
290
+ * Gets a ContactEntity object.
291
+ * @param contactEntityId - The primary key.
292
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
293
+ * @returns A single ContactEntity
294
+ */
295
+ public async getContactEntityAsync(contactEntityId: number, options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
296
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
297
+ base.WebApiBase.SetPending(options);
298
+ return new Promise< carriers.ContactEntity >(async (resolve, reject) => {
299
+ try {
300
+ const response = await this._axios.post("GetContactEntity?contactEntityId=" + contactEntityId, null, config);
301
+ base.WebApiBase.SetCompleted(options, response);
302
+ const res = converters.Create_ContactEntity_From( response.data );
303
+ resolve(res);
304
+ }
305
+ catch( err ) {
306
+ base.WebApiBase.HandleError(options, config, err);
307
+ reject(err);
308
+ }
309
+ });
310
+ }
311
+
312
+
313
+ private async _undeleteAsync(request: carriers.Contact_UndeleteRequest, options?:base.WebApiRequestOptions) : Promise< void > {
314
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
315
+ base.WebApiBase.SetPending(options);
316
+ return new Promise< void >(async (resolve, reject) => {
317
+ try {
318
+ config.baseURL = this._options.baseUrl;
319
+ const response = await this._axios.post("Undelete", request , config);
320
+ base.WebApiBase.SetCompleted(options, response);
321
+ const res = response.data;
322
+ resolve(res);
323
+ }
324
+ catch( err ) {
325
+ base.WebApiBase.HandleError(options, config, err);
326
+ reject(err);
327
+ }
328
+ });
329
+ }
330
+
331
+
332
+
333
+ /**
334
+ * This entity supports Soft Delete. Call this method to Undelete a previously soft-deleted record
335
+ * @param request - Id
336
+ * @returns This method has no return value
337
+ */
338
+ public async undeleteAsync(request: carriers.Contact_UndeleteRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
339
+
340
+ /**
341
+ * This entity supports Soft Delete. Call this method to Undelete a previously soft-deleted record
342
+ * @param id - The primary key of the entity to undelete
343
+ * @returns This method has no return value
344
+ */
345
+ public async undeleteAsync(id: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
346
+
347
+ public async undeleteAsync(id:number|carriers.Contact_UndeleteRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
348
+ let _request : carriers.Contact_UndeleteRequest = null;
349
+ let _options : base.WebApiRequestOptions = null;
350
+ const first : any = id;
351
+ if( typeof( first ) === "object" && first && ( typeof(first.id)!='undefined' ) )
352
+ {
353
+ _request = id as carriers.Contact_UndeleteRequest;
354
+ _options = webapi_options as base.WebApiRequestOptions;
355
+ }
356
+ else
357
+ {
358
+ _request = {
359
+ id: id as number,
360
+ };
361
+ _options = webapi_options;
362
+ }
363
+ return this._undeleteAsync( _request, _options );
364
+ }
365
+
366
+
367
+ private async _getPersonsAsync(request: carriers.Contact_GetPersonsRequest, options?:base.WebApiRequestOptions) : Promise< carriers.Person[] > {
368
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
369
+ base.WebApiBase.SetPending(options);
370
+ return new Promise< carriers.Person[] >(async (resolve, reject) => {
371
+ try {
372
+ config.baseURL = this._options.baseUrl;
373
+ const response = await this._axios.post("GetPersons", request , config);
374
+ base.WebApiBase.SetCompleted(options, response);
375
+ const res : carriers.Person[] = converters.Create_PersonArray_From( response.data );
376
+ resolve(res);
377
+ }
378
+ catch( err ) {
379
+ base.WebApiBase.HandleError(options, config, err);
380
+ reject(err);
381
+ }
382
+ });
383
+ }
384
+
385
+
386
+
387
+ /**
388
+ * Returns an array of all the contact persons for the company card.
389
+ * @param request - ContactId
390
+ * @returns Array of Persons
391
+ */
392
+ public async getPersonsAsync(request: carriers.Contact_GetPersonsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Person[] >;
393
+
394
+ /**
395
+ * Returns an array of all the contact persons for the company card.
396
+ * @param contactId -
397
+ * @returns Array of Persons
398
+ */
399
+ public async getPersonsAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Person[] >;
400
+
401
+ public async getPersonsAsync(contactId:number|carriers.Contact_GetPersonsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Person[] > {
402
+ let _request : carriers.Contact_GetPersonsRequest = null;
403
+ let _options : base.WebApiRequestOptions = null;
404
+ const first : any = contactId;
405
+ if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' ) )
406
+ {
407
+ _request = contactId as carriers.Contact_GetPersonsRequest;
408
+ _options = webapi_options as base.WebApiRequestOptions;
409
+ }
410
+ else
411
+ {
412
+ _request = {
413
+ contactId: contactId as number,
414
+ };
415
+ _options = webapi_options;
416
+ }
417
+ return this._getPersonsAsync( _request, _options );
418
+ }
419
+
420
+
421
+ private async _getContactWithPersonsAsync(request: carriers.Contact_GetContactWithPersonsRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
422
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
423
+ base.WebApiBase.SetPending(options);
424
+ return new Promise< carriers.ContactEntity >(async (resolve, reject) => {
425
+ try {
426
+ config.baseURL = this._options.baseUrl;
427
+ const response = await this._axios.post("GetContactWithPersons", request , config);
428
+ base.WebApiBase.SetCompleted(options, response);
429
+ const res : carriers.ContactEntity = converters.Create_ContactEntity_From( response.data );
430
+ resolve(res);
431
+ }
432
+ catch( err ) {
433
+ base.WebApiBase.HandleError(options, config, err);
434
+ reject(err);
435
+ }
436
+ });
437
+ }
438
+
439
+
440
+
441
+ /**
442
+ * Returns the contact with all the contact persons belonging to the contact
443
+ * @param request - ContactId
444
+ * @returns ContactEntity with all data and persons.
445
+ */
446
+ public async getContactWithPersonsAsync(request: carriers.Contact_GetContactWithPersonsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
447
+
448
+ /**
449
+ * Returns the contact with all the contact persons belonging to the contact
450
+ * @param contactId - The id of the contact.
451
+ * @returns ContactEntity with all data and persons.
452
+ */
453
+ public async getContactWithPersonsAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
454
+
455
+ public async getContactWithPersonsAsync(contactId:number|carriers.Contact_GetContactWithPersonsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
456
+ let _request : carriers.Contact_GetContactWithPersonsRequest = null;
457
+ let _options : base.WebApiRequestOptions = null;
458
+ const first : any = contactId;
459
+ if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' ) )
460
+ {
461
+ _request = contactId as carriers.Contact_GetContactWithPersonsRequest;
462
+ _options = webapi_options as base.WebApiRequestOptions;
463
+ }
464
+ else
465
+ {
466
+ _request = {
467
+ contactId: contactId as number,
468
+ };
469
+ _options = webapi_options;
470
+ }
471
+ return this._getContactWithPersonsAsync( _request, _options );
472
+ }
473
+
474
+
475
+ private async _getMyContactAsync( options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
476
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
477
+ base.WebApiBase.SetPending(options);
478
+ return new Promise< carriers.ContactEntity >(async (resolve, reject) => {
479
+ try {
480
+ config.baseURL = this._options.baseUrl;
481
+ const response = await this._axios.post("GetMyContact", undefined , config);
482
+ base.WebApiBase.SetCompleted(options, response);
483
+ const res : carriers.ContactEntity = converters.Create_ContactEntity_From( response.data );
484
+ resolve(res);
485
+ }
486
+ catch( err ) {
487
+ base.WebApiBase.HandleError(options, config, err);
488
+ reject(err);
489
+ }
490
+ });
491
+ }
492
+
493
+
494
+ /**
495
+ * Gets the contact belonging to the currently logged on user.
496
+ * @returns The Contact
497
+ */
498
+ public async getMyContactAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >
499
+ {
500
+ return this._getMyContactAsync(webapi_options);
501
+ }
502
+
503
+
504
+ private async _getMyBizCardAsync( options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
505
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
506
+ base.WebApiBase.SetPending(options);
507
+ return new Promise< carriers.ContactEntity >(async (resolve, reject) => {
508
+ try {
509
+ config.baseURL = this._options.baseUrl;
510
+ const response = await this._axios.post("GetMyBizCard", undefined , config);
511
+ base.WebApiBase.SetCompleted(options, response);
512
+ const res : carriers.ContactEntity = converters.Create_ContactEntity_From( response.data );
513
+ resolve(res);
514
+ }
515
+ catch( err ) {
516
+ base.WebApiBase.HandleError(options, config, err);
517
+ reject(err);
518
+ }
519
+ });
520
+ }
521
+
522
+
523
+ /**
524
+ * Returns all data needed to display the logged on person&apos;s business card. That is company, person, and company interest data.
525
+ * @returns The contact object with persons and interests
526
+ */
527
+ public async getMyBizCardAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >
528
+ {
529
+ return this._getMyBizCardAsync(webapi_options);
530
+ }
531
+
532
+
533
+ private async _changeCountryAsync(request: carriers.Contact_ChangeCountryRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
534
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
535
+ base.WebApiBase.SetPending(options);
536
+ return new Promise< carriers.ContactEntity >(async (resolve, reject) => {
537
+ try {
538
+ config.baseURL = this._options.baseUrl;
539
+ const response = await this._axios.post("ChangeCountry", request , config);
540
+ base.WebApiBase.SetCompleted(options, response);
541
+ const res : carriers.ContactEntity = converters.Create_ContactEntity_From( response.data );
542
+ resolve(res);
543
+ }
544
+ catch( err ) {
545
+ base.WebApiBase.HandleError(options, config, err);
546
+ reject(err);
547
+ }
548
+ });
549
+ }
550
+
551
+
552
+
553
+ /**
554
+ * Change country regenerates the default values and localized information such as phone number and address format
555
+ * @param request - ContactEntity, ToCountryId
556
+ * @returns
557
+ */
558
+ public async changeCountryAsync(request: carriers.Contact_ChangeCountryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
559
+
560
+ /**
561
+ * Change country regenerates the default values and localized information such as phone number and address format
562
+ * @param contactEntity -
563
+ * @param toCountryId - The country to switch to
564
+ * @returns
565
+ */
566
+ public async changeCountryAsync(contactEntity: carriers.ContactEntity, toCountryId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
567
+
568
+ public async changeCountryAsync(contactEntity:carriers.ContactEntity|carriers.Contact_ChangeCountryRequest, toCountryId?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
569
+ let _request : carriers.Contact_ChangeCountryRequest = null;
570
+ let _options : base.WebApiRequestOptions = null;
571
+ const first : any = contactEntity;
572
+ if( typeof( first ) === "object" && first && ( typeof(first.contactEntity)!='undefined' || typeof(first.toCountryId)!='undefined' ) )
573
+ {
574
+ _request = contactEntity as carriers.Contact_ChangeCountryRequest;
575
+ _options = toCountryId as base.WebApiRequestOptions;
576
+ }
577
+ else
578
+ {
579
+ _request = {
580
+ contactEntity: contactEntity as carriers.ContactEntity,
581
+ toCountryId: toCountryId as number,
582
+ };
583
+ _options = webapi_options;
584
+ }
585
+ return this._changeCountryAsync( _request, _options );
586
+ }
587
+
588
+
589
+ private async _getAddressAsync(request: carriers.Contact_GetAddressRequest, options?:base.WebApiRequestOptions) : Promise< carriers.Address > {
590
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
591
+ base.WebApiBase.SetPending(options);
592
+ return new Promise< carriers.Address >(async (resolve, reject) => {
593
+ try {
594
+ config.baseURL = this._options.baseUrl;
595
+ const response = await this._axios.post("GetAddress", request , config);
596
+ base.WebApiBase.SetCompleted(options, response);
597
+ const res : carriers.Address = converters.Create_Address_From( response.data );
598
+ resolve(res);
599
+ }
600
+ catch( err ) {
601
+ base.WebApiBase.HandleError(options, config, err);
602
+ reject(err);
603
+ }
604
+ });
605
+ }
606
+
607
+
608
+
609
+ /**
610
+ * Gets the contact&apos;s localized address.
611
+ * @param request - ContactId
612
+ * @returns The address as LocalizedField[][].
613
+ */
614
+ public async getAddressAsync(request: carriers.Contact_GetAddressRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
615
+
616
+ /**
617
+ * Gets the contact&apos;s localized address.
618
+ * @param contactId - The contact id
619
+ * @returns The address as LocalizedField[][].
620
+ */
621
+ public async getAddressAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
622
+
623
+ public async getAddressAsync(contactId:number|carriers.Contact_GetAddressRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address > {
624
+ let _request : carriers.Contact_GetAddressRequest = null;
625
+ let _options : base.WebApiRequestOptions = null;
626
+ const first : any = contactId;
627
+ if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' ) )
628
+ {
629
+ _request = contactId as carriers.Contact_GetAddressRequest;
630
+ _options = webapi_options as base.WebApiRequestOptions;
631
+ }
632
+ else
633
+ {
634
+ _request = {
635
+ contactId: contactId as number,
636
+ };
637
+ _options = webapi_options;
638
+ }
639
+ return this._getAddressAsync( _request, _options );
640
+ }
641
+
642
+
643
+ private async _getAddressByCountryAsync(request: carriers.Contact_GetAddressByCountryRequest, options?:base.WebApiRequestOptions) : Promise< carriers.Address > {
644
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
645
+ base.WebApiBase.SetPending(options);
646
+ return new Promise< carriers.Address >(async (resolve, reject) => {
647
+ try {
648
+ config.baseURL = this._options.baseUrl;
649
+ const response = await this._axios.post("GetAddressByCountry", request , config);
650
+ base.WebApiBase.SetCompleted(options, response);
651
+ const res : carriers.Address = converters.Create_Address_From( response.data );
652
+ resolve(res);
653
+ }
654
+ catch( err ) {
655
+ base.WebApiBase.HandleError(options, config, err);
656
+ reject(err);
657
+ }
658
+ });
659
+ }
660
+
661
+
662
+
663
+ /**
664
+ * Gets the contact&apos;s localized address.
665
+ * @param request - ContactId, CountryId
666
+ * @returns The address as LocalizedField[][].
667
+ */
668
+ public async getAddressByCountryAsync(request: carriers.Contact_GetAddressByCountryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
669
+
670
+ /**
671
+ * Gets the contact&apos;s localized address.
672
+ * @param contactId - The contact id
673
+ * @param countryId -
674
+ * @returns The address as LocalizedField[][].
675
+ */
676
+ public async getAddressByCountryAsync(contactId: number, countryId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
677
+
678
+ public async getAddressByCountryAsync(contactId:number|carriers.Contact_GetAddressByCountryRequest, countryId?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address > {
679
+ let _request : carriers.Contact_GetAddressByCountryRequest = null;
680
+ let _options : base.WebApiRequestOptions = null;
681
+ const first : any = contactId;
682
+ if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' || typeof(first.countryId)!='undefined' ) )
683
+ {
684
+ _request = contactId as carriers.Contact_GetAddressByCountryRequest;
685
+ _options = countryId as base.WebApiRequestOptions;
686
+ }
687
+ else
688
+ {
689
+ _request = {
690
+ contactId: contactId as number,
691
+ countryId: countryId as number,
692
+ };
693
+ _options = webapi_options;
694
+ }
695
+ return this._getAddressByCountryAsync( _request, _options );
696
+ }
697
+
698
+
699
+ private async _addPersonAsync(request: carriers.Contact_AddPersonRequest, options?:base.WebApiRequestOptions) : Promise< carriers.PersonEntity > {
700
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
701
+ base.WebApiBase.SetPending(options);
702
+ return new Promise< carriers.PersonEntity >(async (resolve, reject) => {
703
+ try {
704
+ config.baseURL = this._options.baseUrl;
705
+ const response = await this._axios.post("AddPerson", request , config);
706
+ base.WebApiBase.SetCompleted(options, response);
707
+ const res : carriers.PersonEntity = converters.Create_PersonEntity_From( response.data );
708
+ resolve(res);
709
+ }
710
+ catch( err ) {
711
+ base.WebApiBase.HandleError(options, config, err);
712
+ reject(err);
713
+ }
714
+ });
715
+ }
716
+
717
+
718
+
719
+ /**
720
+ * Add a person to the given contact
721
+ * @param request - ContactId, NewPersonEntity
722
+ * @returns Updated person object
723
+ */
724
+ public async addPersonAsync(request: carriers.Contact_AddPersonRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PersonEntity >;
725
+
726
+ /**
727
+ * Add a person to the given contact
728
+ * @param contactId - Contact to add person to
729
+ * @param newPersonEntity - Person object to add
730
+ * @returns Updated person object
731
+ */
732
+ public async addPersonAsync(contactId: number, newPersonEntity: carriers.PersonEntity, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PersonEntity >;
733
+
734
+ public async addPersonAsync(contactId:number|carriers.Contact_AddPersonRequest, newPersonEntity?:carriers.PersonEntity|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PersonEntity > {
735
+ let _request : carriers.Contact_AddPersonRequest = null;
736
+ let _options : base.WebApiRequestOptions = null;
737
+ const first : any = contactId;
738
+ if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' || typeof(first.newPersonEntity)!='undefined' ) )
739
+ {
740
+ _request = contactId as carriers.Contact_AddPersonRequest;
741
+ _options = newPersonEntity as base.WebApiRequestOptions;
742
+ }
743
+ else
744
+ {
745
+ _request = {
746
+ contactId: contactId as number,
747
+ newPersonEntity: newPersonEntity as carriers.PersonEntity,
748
+ };
749
+ _options = webapi_options;
750
+ }
751
+ return this._addPersonAsync( _request, _options );
752
+ }
753
+
754
+
755
+ private async _getDuplicatesAsync(request: carriers.Contact_GetDuplicatesRequest, options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] > {
756
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
757
+ base.WebApiBase.SetPending(options);
758
+ return new Promise< carriers.DuplicateEntry[] >(async (resolve, reject) => {
759
+ try {
760
+ config.baseURL = this._options.baseUrl;
761
+ const response = await this._axios.post("GetDuplicates", request , config);
762
+ base.WebApiBase.SetCompleted(options, response);
763
+ const res : carriers.DuplicateEntry[] = converters.Create_DuplicateEntryArray_From( response.data );
764
+ resolve(res);
765
+ }
766
+ catch( err ) {
767
+ base.WebApiBase.HandleError(options, config, err);
768
+ reject(err);
769
+ }
770
+ });
771
+ }
772
+
773
+
774
+
775
+ /**
776
+ * Get duplicates (exact or similar in the database) based on the name
777
+ * @param request - Name
778
+ * @returns Any records matching the specified name
779
+ */
780
+ public async getDuplicatesAsync(request: carriers.Contact_GetDuplicatesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
781
+
782
+ /**
783
+ * Get duplicates (exact or similar in the database) based on the name
784
+ * @param name - Name used for lookup
785
+ * @returns Any records matching the specified name
786
+ */
787
+ public async getDuplicatesAsync(name: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
788
+
789
+ public async getDuplicatesAsync(name:string|carriers.Contact_GetDuplicatesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] > {
790
+ let _request : carriers.Contact_GetDuplicatesRequest = null;
791
+ let _options : base.WebApiRequestOptions = null;
792
+ const first : any = name;
793
+ if( typeof( first ) === "object" && first && ( typeof(first.name)!='undefined' ) )
794
+ {
795
+ _request = name as carriers.Contact_GetDuplicatesRequest;
796
+ _options = webapi_options as base.WebApiRequestOptions;
797
+ }
798
+ else
799
+ {
800
+ _request = {
801
+ name: name as string,
802
+ };
803
+ _options = webapi_options;
804
+ }
805
+ return this._getDuplicatesAsync( _request, _options );
806
+ }
807
+
808
+
809
+ private async _createNewEntryAsync(request: carriers.Contact_CreateNewEntryRequest, options?:base.WebApiRequestOptions) : Promise< number > {
810
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
811
+ base.WebApiBase.SetPending(options);
812
+ return new Promise< number >(async (resolve, reject) => {
813
+ try {
814
+ config.baseURL = this._options.baseUrl;
815
+ const response = await this._axios.post("CreateNewEntry", request , config);
816
+ base.WebApiBase.SetCompleted(options, response);
817
+ const res : number = response.data as number;
818
+ resolve(res);
819
+ }
820
+ catch( err ) {
821
+ base.WebApiBase.HandleError(options, config, err);
822
+ reject(err);
823
+ }
824
+ });
825
+ }
826
+
827
+
828
+
829
+ /**
830
+ * Creates a new contact based on external duplicate
831
+ * @param request - Duplicate
832
+ * @returns The database identity of the newly created entry
833
+ */
834
+ public async createNewEntryAsync(request: carriers.Contact_CreateNewEntryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
835
+
836
+ /**
837
+ * Creates a new contact based on external duplicate
838
+ * @param duplicate - The duplicate to create a new entry based upon
839
+ * @returns The database identity of the newly created entry
840
+ */
841
+ public async createNewEntryAsync(duplicate: carriers.DuplicateEntry, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
842
+
843
+ public async createNewEntryAsync(duplicate:carriers.DuplicateEntry|carriers.Contact_CreateNewEntryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number > {
844
+ let _request : carriers.Contact_CreateNewEntryRequest = null;
845
+ let _options : base.WebApiRequestOptions = null;
846
+ const first : any = duplicate;
847
+ if( typeof( first ) === "object" && first && ( typeof(first.duplicate)!='undefined' ) )
848
+ {
849
+ _request = duplicate as carriers.Contact_CreateNewEntryRequest;
850
+ _options = webapi_options as base.WebApiRequestOptions;
851
+ }
852
+ else
853
+ {
854
+ _request = {
855
+ duplicate: duplicate as carriers.DuplicateEntry,
856
+ };
857
+ _options = webapi_options;
858
+ }
859
+ return this._createNewEntryAsync( _request, _options );
860
+ }
861
+
862
+
863
+ private async _getDuplicateRulesAsync( options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateRule[] > {
864
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
865
+ base.WebApiBase.SetPending(options);
866
+ return new Promise< carriers.DuplicateRule[] >(async (resolve, reject) => {
867
+ try {
868
+ config.baseURL = this._options.baseUrl;
869
+ const response = await this._axios.post("GetDuplicateRules", undefined , config);
870
+ base.WebApiBase.SetCompleted(options, response);
871
+ const res : carriers.DuplicateRule[] = converters.Create_DuplicateRuleArray_From( response.data );
872
+ resolve(res);
873
+ }
874
+ catch( err ) {
875
+ base.WebApiBase.HandleError(options, config, err);
876
+ reject(err);
877
+ }
878
+ });
879
+ }
880
+
881
+
882
+ /**
883
+ * Retrieve all available duplicate rules for contact
884
+ * @returns All available duplicate rules
885
+ */
886
+ public async getDuplicateRulesAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateRule[] >
887
+ {
888
+ return this._getDuplicateRulesAsync(webapi_options);
889
+ }
890
+
891
+
892
+ private async _setDuplicateRulesStatusAsync(request: carriers.Contact_SetDuplicateRulesStatusRequest, options?:base.WebApiRequestOptions) : Promise< void > {
893
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
894
+ base.WebApiBase.SetPending(options);
895
+ return new Promise< void >(async (resolve, reject) => {
896
+ try {
897
+ config.baseURL = this._options.baseUrl;
898
+ const response = await this._axios.post("SetDuplicateRulesStatus", request , config);
899
+ base.WebApiBase.SetCompleted(options, response);
900
+ const res = response.data;
901
+ resolve(res);
902
+ }
903
+ catch( err ) {
904
+ base.WebApiBase.HandleError(options, config, err);
905
+ reject(err);
906
+ }
907
+ });
908
+ }
909
+
910
+
911
+
912
+ /**
913
+ * Set which duplicate rules should be active or not
914
+ * @param request - Rules
915
+ * @returns
916
+ */
917
+ public async setDuplicateRulesStatusAsync(request: carriers.Contact_SetDuplicateRulesStatusRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
918
+
919
+ /**
920
+ * Set which duplicate rules should be active or not
921
+ * @param rules - Duplicate rules to update active status for
922
+ * @returns
923
+ */
924
+ public async setDuplicateRulesStatusAsync(rules: carriers.DuplicateRule[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
925
+
926
+ public async setDuplicateRulesStatusAsync(rules:carriers.DuplicateRule[]|carriers.Contact_SetDuplicateRulesStatusRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
927
+ let _request : carriers.Contact_SetDuplicateRulesStatusRequest = null;
928
+ let _options : base.WebApiRequestOptions = null;
929
+ const first : any = rules;
930
+ if( typeof( first ) === "object" && first && ( typeof(first.rules)!='undefined' ) )
931
+ {
932
+ _request = rules as carriers.Contact_SetDuplicateRulesStatusRequest;
933
+ _options = webapi_options as base.WebApiRequestOptions;
934
+ }
935
+ else
936
+ {
937
+ _request = {
938
+ rules: rules as carriers.DuplicateRule[],
939
+ };
940
+ _options = webapi_options;
941
+ }
942
+ return this._setDuplicateRulesStatusAsync( _request, _options );
943
+ }
944
+
945
+
946
+ private async _mergeAsync(request: carriers.Contact_MergeRequest, options?:base.WebApiRequestOptions) : Promise< void > {
947
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
948
+ base.WebApiBase.SetPending(options);
949
+ return new Promise< void >(async (resolve, reject) => {
950
+ try {
951
+ config.baseURL = this._options.baseUrl;
952
+ const response = await this._axios.post("Merge", request , config);
953
+ base.WebApiBase.SetCompleted(options, response);
954
+ const res = response.data;
955
+ resolve(res);
956
+ }
957
+ catch( err ) {
958
+ base.WebApiBase.HandleError(options, config, err);
959
+ reject(err);
960
+ }
961
+ });
962
+ }
963
+
964
+
965
+
966
+ /**
967
+ * Merge two contacts. The destination contact will remain.
968
+ * @param request - SourceContactId, DestinationContactId, MergeIdenticalPersons, ReplaceEmptyFieldsOnDestination
969
+ * @returns
970
+ */
971
+ public async mergeAsync(request: carriers.Contact_MergeRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
972
+
973
+ /**
974
+ * Merge two contacts. The destination contact will remain.
975
+ * @param sourceContactId - Source contact to merge from. This contact will disappear after the merge.
976
+ * @param destinationContactId - Destination contact to merge into
977
+ * @param mergeIdenticalPersons - Persons with identical names will be merged
978
+ * @param replaceEmptyFieldsOnDestination - If true, empty fields on destination will be replaced by values from source.
979
+ * @returns
980
+ */
981
+ public async mergeAsync(sourceContactId: number, destinationContactId: number, mergeIdenticalPersons: boolean, replaceEmptyFieldsOnDestination: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
982
+
983
+ public async mergeAsync(sourceContactId:number|carriers.Contact_MergeRequest, destinationContactId?:number|base.WebApiRequestOptions, mergeIdenticalPersons?:boolean, replaceEmptyFieldsOnDestination?:boolean, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
984
+ let _request : carriers.Contact_MergeRequest = null;
985
+ let _options : base.WebApiRequestOptions = null;
986
+ const first : any = sourceContactId;
987
+ if( typeof( first ) === "object" && first && ( typeof(first.sourceContactId)!='undefined' || typeof(first.destinationContactId)!='undefined' || typeof(first.mergeIdenticalPersons)!='undefined' || typeof(first.replaceEmptyFieldsOnDestination)!='undefined' ) )
988
+ {
989
+ _request = sourceContactId as carriers.Contact_MergeRequest;
990
+ _options = destinationContactId as base.WebApiRequestOptions;
991
+ }
992
+ else
993
+ {
994
+ _request = {
995
+ sourceContactId: sourceContactId as number,
996
+ destinationContactId: destinationContactId as number,
997
+ mergeIdenticalPersons: mergeIdenticalPersons as boolean,
998
+ replaceEmptyFieldsOnDestination: replaceEmptyFieldsOnDestination as boolean,
999
+ };
1000
+ _options = webapi_options;
1001
+ }
1002
+ return this._mergeAsync( _request, _options );
1003
+ }
1004
+
1005
+
1006
+ private async _copyAsync(request: carriers.Contact_CopyRequest, options?:base.WebApiRequestOptions) : Promise< number > {
1007
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1008
+ base.WebApiBase.SetPending(options);
1009
+ return new Promise< number >(async (resolve, reject) => {
1010
+ try {
1011
+ config.baseURL = this._options.baseUrl;
1012
+ const response = await this._axios.post("Copy", request , config);
1013
+ base.WebApiBase.SetCompleted(options, response);
1014
+ const res : number = response.data as number;
1015
+ resolve(res);
1016
+ }
1017
+ catch( err ) {
1018
+ base.WebApiBase.HandleError(options, config, err);
1019
+ reject(err);
1020
+ }
1021
+ });
1022
+ }
1023
+
1024
+
1025
+
1026
+ /**
1027
+ * Copy a contact. Activities and related data will be ignored
1028
+ * @param request - SourceContactId, DestinationContactName, DestinationContactDepartment, CopyPersons
1029
+ * @returns Id of copied contact
1030
+ */
1031
+ public async copyAsync(request: carriers.Contact_CopyRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
1032
+
1033
+ /**
1034
+ * Copy a contact. Activities and related data will be ignored
1035
+ * @param sourceContactId - The id of the contact to copy
1036
+ * @param destinationContactName - The name of the destination contact
1037
+ * @param destinationContactDepartment - The department of the destination contact
1038
+ * @param copyPersons - If true, persons will be copied from source contact
1039
+ * @returns Id of copied contact
1040
+ */
1041
+ public async copyAsync(sourceContactId: number, destinationContactName: string, destinationContactDepartment: string, copyPersons: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
1042
+
1043
+ public async copyAsync(sourceContactId:number|carriers.Contact_CopyRequest, destinationContactName?:string|base.WebApiRequestOptions, destinationContactDepartment?:string, copyPersons?:boolean, webapi_options?:base.WebApiRequestOptions) : Promise< number > {
1044
+ let _request : carriers.Contact_CopyRequest = null;
1045
+ let _options : base.WebApiRequestOptions = null;
1046
+ const first : any = sourceContactId;
1047
+ if( typeof( first ) === "object" && first && ( typeof(first.sourceContactId)!='undefined' || typeof(first.destinationContactName)!='undefined' || typeof(first.destinationContactDepartment)!='undefined' || typeof(first.copyPersons)!='undefined' ) )
1048
+ {
1049
+ _request = sourceContactId as carriers.Contact_CopyRequest;
1050
+ _options = destinationContactName as base.WebApiRequestOptions;
1051
+ }
1052
+ else
1053
+ {
1054
+ _request = {
1055
+ sourceContactId: sourceContactId as number,
1056
+ destinationContactName: destinationContactName as string,
1057
+ destinationContactDepartment: destinationContactDepartment as string,
1058
+ copyPersons: copyPersons as boolean,
1059
+ };
1060
+ _options = webapi_options;
1061
+ }
1062
+ return this._copyAsync( _request, _options );
1063
+ }
1064
+
1065
+
1066
+ private async _getNameDepartmentDuplicatesAsync(request: carriers.Contact_GetNameDepartmentDuplicatesRequest, options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] > {
1067
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1068
+ base.WebApiBase.SetPending(options);
1069
+ return new Promise< carriers.DuplicateEntry[] >(async (resolve, reject) => {
1070
+ try {
1071
+ config.baseURL = this._options.baseUrl;
1072
+ const response = await this._axios.post("GetNameDepartmentDuplicates", request , config);
1073
+ base.WebApiBase.SetCompleted(options, response);
1074
+ const res : carriers.DuplicateEntry[] = converters.Create_DuplicateEntryArray_From( response.data );
1075
+ resolve(res);
1076
+ }
1077
+ catch( err ) {
1078
+ base.WebApiBase.HandleError(options, config, err);
1079
+ reject(err);
1080
+ }
1081
+ });
1082
+ }
1083
+
1084
+
1085
+
1086
+ /**
1087
+ * Get duplicates based on the contact name and department
1088
+ * @param request - Name, Department
1089
+ * @returns Any records matching the specified name and department
1090
+ */
1091
+ public async getNameDepartmentDuplicatesAsync(request: carriers.Contact_GetNameDepartmentDuplicatesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
1092
+
1093
+ /**
1094
+ * Get duplicates based on the contact name and department
1095
+ * @param name - Name used for lookup
1096
+ * @param department - Department used for lookup (if any)
1097
+ * @returns Any records matching the specified name and department
1098
+ */
1099
+ public async getNameDepartmentDuplicatesAsync(name: string, department: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
1100
+
1101
+ public async getNameDepartmentDuplicatesAsync(name:string|carriers.Contact_GetNameDepartmentDuplicatesRequest, department?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] > {
1102
+ let _request : carriers.Contact_GetNameDepartmentDuplicatesRequest = null;
1103
+ let _options : base.WebApiRequestOptions = null;
1104
+ const first : any = name;
1105
+ if( typeof( first ) === "object" && first && ( typeof(first.name)!='undefined' || typeof(first.department)!='undefined' ) )
1106
+ {
1107
+ _request = name as carriers.Contact_GetNameDepartmentDuplicatesRequest;
1108
+ _options = department as base.WebApiRequestOptions;
1109
+ }
1110
+ else
1111
+ {
1112
+ _request = {
1113
+ name: name as string,
1114
+ department: department as string,
1115
+ };
1116
+ _options = webapi_options;
1117
+ }
1118
+ return this._getNameDepartmentDuplicatesAsync( _request, _options );
1119
+ }
1120
+
1121
+
1122
+ private async _getDomainDuplicatesAsync(request: carriers.Contact_GetDomainDuplicatesRequest, options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] > {
1123
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1124
+ base.WebApiBase.SetPending(options);
1125
+ return new Promise< carriers.DuplicateEntry[] >(async (resolve, reject) => {
1126
+ try {
1127
+ config.baseURL = this._options.baseUrl;
1128
+ const response = await this._axios.post("GetDomainDuplicates", request , config);
1129
+ base.WebApiBase.SetCompleted(options, response);
1130
+ const res : carriers.DuplicateEntry[] = converters.Create_DuplicateEntryArray_From( response.data );
1131
+ resolve(res);
1132
+ }
1133
+ catch( err ) {
1134
+ base.WebApiBase.HandleError(options, config, err);
1135
+ reject(err);
1136
+ }
1137
+ });
1138
+ }
1139
+
1140
+
1141
+
1142
+ /**
1143
+ * Get duplicates based on the domain
1144
+ * @param request - Domain
1145
+ * @returns Any records matching the specified domain
1146
+ */
1147
+ public async getDomainDuplicatesAsync(request: carriers.Contact_GetDomainDuplicatesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
1148
+
1149
+ /**
1150
+ * Get duplicates based on the domain
1151
+ * @param domain - Domain used for lookup
1152
+ * @returns Any records matching the specified domain
1153
+ */
1154
+ public async getDomainDuplicatesAsync(domain: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] >;
1155
+
1156
+ public async getDomainDuplicatesAsync(domain:string|carriers.Contact_GetDomainDuplicatesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.DuplicateEntry[] > {
1157
+ let _request : carriers.Contact_GetDomainDuplicatesRequest = null;
1158
+ let _options : base.WebApiRequestOptions = null;
1159
+ const first : any = domain;
1160
+ if( typeof( first ) === "object" && first && ( typeof(first.domain)!='undefined' ) )
1161
+ {
1162
+ _request = domain as carriers.Contact_GetDomainDuplicatesRequest;
1163
+ _options = webapi_options as base.WebApiRequestOptions;
1164
+ }
1165
+ else
1166
+ {
1167
+ _request = {
1168
+ domain: domain as string,
1169
+ };
1170
+ _options = webapi_options;
1171
+ }
1172
+ return this._getDomainDuplicatesAsync( _request, _options );
1173
+ }
1174
+
1175
+
1176
+ private async _isNumberValidAsync(request: carriers.Contact_IsNumberValidRequest, options?:base.WebApiRequestOptions) : Promise< boolean > {
1177
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1178
+ base.WebApiBase.SetPending(options);
1179
+ return new Promise< boolean >(async (resolve, reject) => {
1180
+ try {
1181
+ config.baseURL = this._options.baseUrl;
1182
+ const response = await this._axios.post("IsNumberValid", request , config);
1183
+ base.WebApiBase.SetCompleted(options, response);
1184
+ const res : boolean = response.data as boolean;
1185
+ resolve(res);
1186
+ }
1187
+ catch( err ) {
1188
+ base.WebApiBase.HandleError(options, config, err);
1189
+ reject(err);
1190
+ }
1191
+ });
1192
+ }
1193
+
1194
+
1195
+
1196
+ /**
1197
+ * Checks if the number is unique or required. The setting is configured from admin under system options.
1198
+ * @param request - ContactId, Number
1199
+ * @returns True if the number satisifies the configured rules for uniqueness.
1200
+ */
1201
+ public async isNumberValidAsync(request: carriers.Contact_IsNumberValidRequest, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
1202
+
1203
+ /**
1204
+ * Checks if the number is unique or required. The setting is configured from admin under system options.
1205
+ * @param contactId - Primary key
1206
+ * @param number - Number field value to check.
1207
+ * @returns True if the number satisifies the configured rules for uniqueness.
1208
+ */
1209
+ public async isNumberValidAsync(contactId: number, number: string, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
1210
+
1211
+ public async isNumberValidAsync(contactId:number|carriers.Contact_IsNumberValidRequest, number?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< boolean > {
1212
+ let _request : carriers.Contact_IsNumberValidRequest = null;
1213
+ let _options : base.WebApiRequestOptions = null;
1214
+ const first : any = contactId;
1215
+ if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' || typeof(first.number)!='undefined' ) )
1216
+ {
1217
+ _request = contactId as carriers.Contact_IsNumberValidRequest;
1218
+ _options = number as base.WebApiRequestOptions;
1219
+ }
1220
+ else
1221
+ {
1222
+ _request = {
1223
+ contactId: contactId as number,
1224
+ number: number as string,
1225
+ };
1226
+ _options = webapi_options;
1227
+ }
1228
+ return this._isNumberValidAsync( _request, _options );
1229
+ }
1230
+
1231
+
1232
+ private async _getQuoteVersionAddressesAsync(request: carriers.Contact_GetQuoteVersionAddressesRequest, options?:base.WebApiRequestOptions) : Promise< carriers.Address[] > {
1233
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1234
+ base.WebApiBase.SetPending(options);
1235
+ return new Promise< carriers.Address[] >(async (resolve, reject) => {
1236
+ try {
1237
+ config.baseURL = this._options.baseUrl;
1238
+ const response = await this._axios.post("GetQuoteVersionAddresses", request , config);
1239
+ base.WebApiBase.SetCompleted(options, response);
1240
+ const res : carriers.Address[] = converters.Create_AddressArray_From( response.data );
1241
+ resolve(res);
1242
+ }
1243
+ catch( err ) {
1244
+ base.WebApiBase.HandleError(options, config, err);
1245
+ reject(err);
1246
+ }
1247
+ });
1248
+ }
1249
+
1250
+
1251
+
1252
+ /**
1253
+ * Get the associated billing and invoice quote version addresses. These addresses might be address on the contact, or a custom address.
1254
+ * @param request - QuoteVersionId
1255
+ * @returns The quote version addresses. Invoice and billing address, in that order.
1256
+ */
1257
+ public async getQuoteVersionAddressesAsync(request: carriers.Contact_GetQuoteVersionAddressesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address[] >;
1258
+
1259
+ /**
1260
+ * Get the associated billing and invoice quote version addresses. These addresses might be address on the contact, or a custom address.
1261
+ * @param quoteVersionId - The version to get the addresses for.
1262
+ * @returns The quote version addresses. Invoice and billing address, in that order.
1263
+ */
1264
+ public async getQuoteVersionAddressesAsync(quoteVersionId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address[] >;
1265
+
1266
+ public async getQuoteVersionAddressesAsync(quoteVersionId:number|carriers.Contact_GetQuoteVersionAddressesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address[] > {
1267
+ let _request : carriers.Contact_GetQuoteVersionAddressesRequest = null;
1268
+ let _options : base.WebApiRequestOptions = null;
1269
+ const first : any = quoteVersionId;
1270
+ if( typeof( first ) === "object" && first && ( typeof(first.quoteVersionId)!='undefined' ) )
1271
+ {
1272
+ _request = quoteVersionId as carriers.Contact_GetQuoteVersionAddressesRequest;
1273
+ _options = webapi_options as base.WebApiRequestOptions;
1274
+ }
1275
+ else
1276
+ {
1277
+ _request = {
1278
+ quoteVersionId: quoteVersionId as number,
1279
+ };
1280
+ _options = webapi_options;
1281
+ }
1282
+ return this._getQuoteVersionAddressesAsync( _request, _options );
1283
+ }
1284
+
1285
+
1286
+ private async _saveQuoteVersionAddressAsync(request: carriers.Contact_SaveQuoteVersionAddressRequest, options?:base.WebApiRequestOptions) : Promise< carriers.Address > {
1287
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1288
+ base.WebApiBase.SetPending(options);
1289
+ return new Promise< carriers.Address >(async (resolve, reject) => {
1290
+ try {
1291
+ config.baseURL = this._options.baseUrl;
1292
+ const response = await this._axios.post("SaveQuoteVersionAddress", request , config);
1293
+ base.WebApiBase.SetCompleted(options, response);
1294
+ const res : carriers.Address = converters.Create_Address_From( response.data );
1295
+ resolve(res);
1296
+ }
1297
+ catch( err ) {
1298
+ base.WebApiBase.HandleError(options, config, err);
1299
+ reject(err);
1300
+ }
1301
+ });
1302
+ }
1303
+
1304
+
1305
+
1306
+ /**
1307
+ * Save a custom quote version address.
1308
+ * @param request - QuoteVersionId, Address, AddressType, CountryId
1309
+ * @returns The saved addresses.
1310
+ */
1311
+ public async saveQuoteVersionAddressAsync(request: carriers.Contact_SaveQuoteVersionAddressRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
1312
+
1313
+ /**
1314
+ * Save a custom quote version address.
1315
+ * @param quoteVersionId - The version to save the address on.
1316
+ * @param address - The address to save on the quote version.
1317
+ * @param addressType - Should be either QuoteBillingAddress or QuoteShippingAddress
1318
+ * @param countryId - The country for the custom address
1319
+ * @returns The saved addresses.
1320
+ */
1321
+ public async saveQuoteVersionAddressAsync(quoteVersionId: number, address: carriers.Address, addressType: enums.AddressType, countryId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address >;
1322
+
1323
+ public async saveQuoteVersionAddressAsync(quoteVersionId:number|carriers.Contact_SaveQuoteVersionAddressRequest, address?:carriers.Address|base.WebApiRequestOptions, addressType?:enums.AddressType, countryId?:number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Address > {
1324
+ let _request : carriers.Contact_SaveQuoteVersionAddressRequest = null;
1325
+ let _options : base.WebApiRequestOptions = null;
1326
+ const first : any = quoteVersionId;
1327
+ if( typeof( first ) === "object" && first && ( typeof(first.quoteVersionId)!='undefined' || typeof(first.address)!='undefined' || typeof(first.addressType)!='undefined' || typeof(first.countryId)!='undefined' ) )
1328
+ {
1329
+ _request = quoteVersionId as carriers.Contact_SaveQuoteVersionAddressRequest;
1330
+ _options = address as base.WebApiRequestOptions;
1331
+ }
1332
+ else
1333
+ {
1334
+ _request = {
1335
+ quoteVersionId: quoteVersionId as number,
1336
+ address: address as carriers.Address,
1337
+ addressType: addressType as enums.AddressType,
1338
+ countryId: countryId as number,
1339
+ };
1340
+ _options = webapi_options;
1341
+ }
1342
+ return this._saveQuoteVersionAddressAsync( _request, _options );
1343
+ }
1344
+
1345
+
1346
+ private async _deleteExpiredAsync( options?:base.WebApiRequestOptions) : Promise< void > {
1347
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1348
+ base.WebApiBase.SetPending(options);
1349
+ return new Promise< void >(async (resolve, reject) => {
1350
+ try {
1351
+ config.baseURL = this._options.baseUrl;
1352
+ const response = await this._axios.post("DeleteExpired", undefined , config);
1353
+ base.WebApiBase.SetCompleted(options, response);
1354
+ const res = response.data;
1355
+ resolve(res);
1356
+ }
1357
+ catch( err ) {
1358
+ base.WebApiBase.HandleError(options, config, err);
1359
+ reject(err);
1360
+ }
1361
+ });
1362
+ }
1363
+
1364
+
1365
+ /**
1366
+ * Trigger deletion of contacts (companies) that has been (soft) deleted and have timed out the expiry period (the SoftDeleteRetention preference).
1367
+ * @returns
1368
+ */
1369
+ public async deleteExpiredAsync(webapi_options?:base.WebApiRequestOptions) : Promise< void >
1370
+ {
1371
+ return this._deleteExpiredAsync(webapi_options);
1372
+ }
1373
+
1374
+
1375
+ private async _getContactSummaryAsync(request: carriers.Contact_GetContactSummaryRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ContactSummary > {
1376
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1377
+ base.WebApiBase.SetPending(options);
1378
+ return new Promise< carriers.ContactSummary >(async (resolve, reject) => {
1379
+ try {
1380
+ config.baseURL = this._options.baseUrl;
1381
+ const response = await this._axios.post("GetContactSummary", request , config);
1382
+ base.WebApiBase.SetCompleted(options, response);
1383
+ const res : carriers.ContactSummary = converters.Create_ContactSummary_From( response.data );
1384
+ resolve(res);
1385
+ }
1386
+ catch( err ) {
1387
+ base.WebApiBase.HandleError(options, config, err);
1388
+ reject(err);
1389
+ }
1390
+ });
1391
+ }
1392
+
1393
+
1394
+
1395
+ /**
1396
+ * Get summary of contact and its recent activity.
1397
+ * @param request - ContactId, Limit
1398
+ * @returns Summary of contact, with recent requests, sales, follow-ups, chats.
1399
+ */
1400
+ public async getContactSummaryAsync(request: carriers.Contact_GetContactSummaryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactSummary >;
1401
+
1402
+ /**
1403
+ * Get summary of contact and its recent activity.
1404
+ * @param contactId - The contact id to summarize.
1405
+ * @param limit - Max number of items to include in summary lists.
1406
+ * @returns Summary of contact, with recent requests, sales, follow-ups, chats.
1407
+ */
1408
+ public async getContactSummaryAsync(contactId: number, limit: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactSummary >;
1409
+
1410
+ public async getContactSummaryAsync(contactId:number|carriers.Contact_GetContactSummaryRequest, limit?:number|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactSummary > {
1411
+ let _request : carriers.Contact_GetContactSummaryRequest = null;
1412
+ let _options : base.WebApiRequestOptions = null;
1413
+ const first : any = contactId;
1414
+ if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' || typeof(first.limit)!='undefined' ) )
1415
+ {
1416
+ _request = contactId as carriers.Contact_GetContactSummaryRequest;
1417
+ _options = limit as base.WebApiRequestOptions;
1418
+ }
1419
+ else
1420
+ {
1421
+ _request = {
1422
+ contactId: contactId as number,
1423
+ limit: limit as number,
1424
+ };
1425
+ _options = webapi_options;
1426
+ }
1427
+ return this._getContactSummaryAsync( _request, _options );
1428
+ }
1429
+
1430
+
1431
+ private async _validateContactEntityAsync(request: carriers.Contact_ValidateContactEntityRequest, options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary > {
1432
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1433
+ base.WebApiBase.SetPending(options);
1434
+ return new Promise< carriers.StringDictionary >(async (resolve, reject) => {
1435
+ try {
1436
+ config.baseURL = this._options.baseUrl;
1437
+ const response = await this._axios.post("ValidateContactEntity", request , config);
1438
+ base.WebApiBase.SetCompleted(options, response);
1439
+ const res : carriers.StringDictionary = converters.Create_StringDictionary_From( response.data );
1440
+ resolve(res);
1441
+ }
1442
+ catch( err ) {
1443
+ base.WebApiBase.HandleError(options, config, err);
1444
+ reject(err);
1445
+ }
1446
+ });
1447
+ }
1448
+
1449
+
1450
+
1451
+ /**
1452
+ * Check that entity is ready for saving, return error messages by field.
1453
+ * @param request - ContactEntity
1454
+ * @returns Error messages tagged by field.
1455
+ */
1456
+ public async validateContactEntityAsync(request: carriers.Contact_ValidateContactEntityRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
1457
+
1458
+ /**
1459
+ * Check that entity is ready for saving, return error messages by field.
1460
+ * @param contactEntity - Entity to be checked for errors.
1461
+ * @returns Error messages tagged by field.
1462
+ */
1463
+ public async validateContactEntityAsync(contactEntity: carriers.ContactEntity, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
1464
+
1465
+ public async validateContactEntityAsync(contactEntity:carriers.ContactEntity|carriers.Contact_ValidateContactEntityRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary > {
1466
+ let _request : carriers.Contact_ValidateContactEntityRequest = null;
1467
+ let _options : base.WebApiRequestOptions = null;
1468
+ const first : any = contactEntity;
1469
+ if( typeof( first ) === "object" && first && ( typeof(first.contactEntity)!='undefined' ) )
1470
+ {
1471
+ _request = contactEntity as carriers.Contact_ValidateContactEntityRequest;
1472
+ _options = webapi_options as base.WebApiRequestOptions;
1473
+ }
1474
+ else
1475
+ {
1476
+ _request = {
1477
+ contactEntity: contactEntity as carriers.ContactEntity,
1478
+ };
1479
+ _options = webapi_options;
1480
+ }
1481
+ return this._validateContactEntityAsync( _request, _options );
1482
+ }
1483
+
1484
+
1485
+ private async _enrichContactEntityAsync(request: carriers.Contact_EnrichContactEntityRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
1486
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1487
+ base.WebApiBase.SetPending(options);
1488
+ return new Promise< carriers.ContactEntity >(async (resolve, reject) => {
1489
+ try {
1490
+ config.baseURL = this._options.baseUrl;
1491
+ const response = await this._axios.post("EnrichContactEntity", request , config);
1492
+ base.WebApiBase.SetCompleted(options, response);
1493
+ const res : carriers.ContactEntity = converters.Create_ContactEntity_From( response.data );
1494
+ resolve(res);
1495
+ }
1496
+ catch( err ) {
1497
+ base.WebApiBase.HandleError(options, config, err);
1498
+ reject(err);
1499
+ }
1500
+ });
1501
+ }
1502
+
1503
+
1504
+
1505
+ /**
1506
+ * Enrich a contact with data from the AI Enrichment service. This will update the contact with address, phone number, and email.
1507
+ * @param request - ContactEntity, EnrichId
1508
+ * @returns Enriched contact entity with address, phone number, and email updated.
1509
+ */
1510
+ public async enrichContactEntityAsync(request: carriers.Contact_EnrichContactEntityRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
1511
+
1512
+ /**
1513
+ * Enrich a contact with data from the AI Enrichment service. This will update the contact with address, phone number, and email.
1514
+ * @param contactEntity - The contact entity to enrich.
1515
+ * @param enrichId - Id from the EnrichContact provider
1516
+ * @returns Enriched contact entity with address, phone number, and email updated.
1517
+ */
1518
+ public async enrichContactEntityAsync(contactEntity: carriers.ContactEntity, enrichId: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity >;
1519
+
1520
+ public async enrichContactEntityAsync(contactEntity:carriers.ContactEntity|carriers.Contact_EnrichContactEntityRequest, enrichId?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactEntity > {
1521
+ let _request : carriers.Contact_EnrichContactEntityRequest = null;
1522
+ let _options : base.WebApiRequestOptions = null;
1523
+ const first : any = contactEntity;
1524
+ if( typeof( first ) === "object" && first && ( typeof(first.contactEntity)!='undefined' || typeof(first.enrichId)!='undefined' ) )
1525
+ {
1526
+ _request = contactEntity as carriers.Contact_EnrichContactEntityRequest;
1527
+ _options = enrichId as base.WebApiRequestOptions;
1528
+ }
1529
+ else
1530
+ {
1531
+ _request = {
1532
+ contactEntity: contactEntity as carriers.ContactEntity,
1533
+ enrichId: enrichId as string,
1534
+ };
1535
+ _options = webapi_options;
1536
+ }
1537
+ return this._enrichContactEntityAsync( _request, _options );
1538
+ }
1539
+
1540
+ /**
1541
+ * Gets an array of Contact objects.
1542
+ * @param contactIds - The primary keys.
1543
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
1544
+ * @returns An array of Contact
1545
+ */
1546
+ public async getContactListAsync(contactIds: number[], options?:base.WebApiRequestOptions) : Promise< carriers.Contact[] > {
1547
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1548
+ base.WebApiBase.SetPending(options);
1549
+ return new Promise< carriers.Contact[] >(async (resolve, reject) => {
1550
+ try {
1551
+ const response = await this._axios.post("GetContactList", contactIds, config);
1552
+ base.WebApiBase.SetCompleted(options, response);
1553
+ const res = converters.Create_ContactArray_From( response.data );
1554
+ resolve(res);
1555
+ }
1556
+ catch( err ) {
1557
+ base.WebApiBase.HandleError(options, config, err);
1558
+ reject(err);
1559
+ }
1560
+ });
1561
+ }
1562
+
1563
+
1564
+ private async _getMyContactsAsync( options?:base.WebApiRequestOptions) : Promise< carriers.Contact[] > {
1565
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1566
+ base.WebApiBase.SetPending(options);
1567
+ return new Promise< carriers.Contact[] >(async (resolve, reject) => {
1568
+ try {
1569
+ config.baseURL = this._options.baseUrl;
1570
+ const response = await this._axios.post("GetMyContacts", undefined , config);
1571
+ base.WebApiBase.SetCompleted(options, response);
1572
+ const res : carriers.Contact[] = converters.Create_ContactArray_From( response.data );
1573
+ resolve(res);
1574
+ }
1575
+ catch( err ) {
1576
+ base.WebApiBase.HandleError(options, config, err);
1577
+ reject(err);
1578
+ }
1579
+ });
1580
+ }
1581
+
1582
+
1583
+ /**
1584
+ * Getting the contacts where the user currently logged in is set as contact owner.
1585
+ * @returns Array of contacts
1586
+ */
1587
+ public async getMyContactsAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Contact[] >
1588
+ {
1589
+ return this._getMyContactsAsync(webapi_options);
1590
+ }
1591
+
1592
+
1593
+ private async _getMyRecentContactsAsync(request: carriers.Contact_GetMyRecentContactsRequest, options?:base.WebApiRequestOptions) : Promise< carriers.Contact[] > {
1594
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1595
+ base.WebApiBase.SetPending(options);
1596
+ return new Promise< carriers.Contact[] >(async (resolve, reject) => {
1597
+ try {
1598
+ config.baseURL = this._options.baseUrl;
1599
+ const response = await this._axios.post("GetMyRecentContacts", request , config);
1600
+ base.WebApiBase.SetCompleted(options, response);
1601
+ const res : carriers.Contact[] = converters.Create_ContactArray_From( response.data );
1602
+ resolve(res);
1603
+ }
1604
+ catch( err ) {
1605
+ base.WebApiBase.HandleError(options, config, err);
1606
+ reject(err);
1607
+ }
1608
+ });
1609
+ }
1610
+
1611
+
1612
+
1613
+ /**
1614
+ * Method that returns a set of initial contacts. This could be the contacts in a favorites selection, the history list, the diary, or from all sources. If retrieved from the diary it will get appointments for the current and the next day.
1615
+ * @param request - SourceType
1616
+ * @returns Arrayof contacts
1617
+ */
1618
+ public async getMyRecentContactsAsync(request: carriers.Contact_GetMyRecentContactsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Contact[] >;
1619
+
1620
+ /**
1621
+ * Method that returns a set of initial contacts. This could be the contacts in a favorites selection, the history list, the diary, or from all sources. If retrieved from the diary it will get appointments for the current and the next day.
1622
+ * @param sourceType - The source where the contacts are retrieved from (Favorites, History, Diary)
1623
+ * @returns Arrayof contacts
1624
+ */
1625
+ public async getMyRecentContactsAsync(sourceType: enums.ContactSourceType, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Contact[] >;
1626
+
1627
+ public async getMyRecentContactsAsync(sourceType:enums.ContactSourceType|carriers.Contact_GetMyRecentContactsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Contact[] > {
1628
+ let _request : carriers.Contact_GetMyRecentContactsRequest = null;
1629
+ let _options : base.WebApiRequestOptions = null;
1630
+ const first : any = sourceType;
1631
+ if( typeof( first ) === "object" && first && ( typeof(first.sourceType)!='undefined' ) )
1632
+ {
1633
+ _request = sourceType as carriers.Contact_GetMyRecentContactsRequest;
1634
+ _options = webapi_options as base.WebApiRequestOptions;
1635
+ }
1636
+ else
1637
+ {
1638
+ _request = {
1639
+ sourceType: sourceType as enums.ContactSourceType,
1640
+ };
1641
+ _options = webapi_options;
1642
+ }
1643
+ return this._getMyRecentContactsAsync( _request, _options );
1644
+ }
1645
+
1646
+
1647
+ private async _getPreviewContactAsync(request: carriers.Contact_GetPreviewContactRequest, options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact > {
1648
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1649
+ base.WebApiBase.SetPending(options);
1650
+ return new Promise< carriers.PreviewContact >(async (resolve, reject) => {
1651
+ try {
1652
+ config.baseURL = this._options.baseUrl;
1653
+ const response = await this._axios.post("GetPreviewContact", request , config);
1654
+ base.WebApiBase.SetCompleted(options, response);
1655
+ const res : carriers.PreviewContact = converters.Create_PreviewContact_From( response.data );
1656
+ resolve(res);
1657
+ }
1658
+ catch( err ) {
1659
+ base.WebApiBase.HandleError(options, config, err);
1660
+ reject(err);
1661
+ }
1662
+ });
1663
+ }
1664
+
1665
+
1666
+
1667
+ /**
1668
+ * Get a contact from its ID
1669
+ * @param request - ContactId
1670
+ * @returns Minimal contact suitable for preview
1671
+ */
1672
+ public async getPreviewContactAsync(request: carriers.Contact_GetPreviewContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact >;
1673
+
1674
+ /**
1675
+ * Get a contact from its ID
1676
+ * @param contactId - Contact ID
1677
+ * @returns Minimal contact suitable for preview
1678
+ */
1679
+ public async getPreviewContactAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact >;
1680
+
1681
+ public async getPreviewContactAsync(contactId:number|carriers.Contact_GetPreviewContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact > {
1682
+ let _request : carriers.Contact_GetPreviewContactRequest = null;
1683
+ let _options : base.WebApiRequestOptions = null;
1684
+ const first : any = contactId;
1685
+ if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' ) )
1686
+ {
1687
+ _request = contactId as carriers.Contact_GetPreviewContactRequest;
1688
+ _options = webapi_options as base.WebApiRequestOptions;
1689
+ }
1690
+ else
1691
+ {
1692
+ _request = {
1693
+ contactId: contactId as number,
1694
+ };
1695
+ _options = webapi_options;
1696
+ }
1697
+ return this._getPreviewContactAsync( _request, _options );
1698
+ }
1699
+
1700
+
1701
+ private async _getPreviewEnrichContactAsync(request: carriers.Contact_GetPreviewEnrichContactRequest, options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact > {
1702
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1703
+ base.WebApiBase.SetPending(options);
1704
+ return new Promise< carriers.PreviewContact >(async (resolve, reject) => {
1705
+ try {
1706
+ config.baseURL = this._options.baseUrl;
1707
+ const response = await this._axios.post("GetPreviewEnrichContact", request , config);
1708
+ base.WebApiBase.SetCompleted(options, response);
1709
+ const res : carriers.PreviewContact = converters.Create_PreviewContact_From( response.data );
1710
+ resolve(res);
1711
+ }
1712
+ catch( err ) {
1713
+ base.WebApiBase.HandleError(options, config, err);
1714
+ reject(err);
1715
+ }
1716
+ });
1717
+ }
1718
+
1719
+
1720
+
1721
+ /**
1722
+ * Get a contact from its ID
1723
+ * @param request - EnrichId
1724
+ * @returns Minimal contact suitable for preview
1725
+ */
1726
+ public async getPreviewEnrichContactAsync(request: carriers.Contact_GetPreviewEnrichContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact >;
1727
+
1728
+ /**
1729
+ * Get a contact from its ID
1730
+ * @param enrichId - Enrich Contact ID from the EnrichContact MDO list provider
1731
+ * @returns Minimal contact suitable for preview
1732
+ */
1733
+ public async getPreviewEnrichContactAsync(enrichId: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact >;
1734
+
1735
+ public async getPreviewEnrichContactAsync(enrichId:string|carriers.Contact_GetPreviewEnrichContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreviewContact > {
1736
+ let _request : carriers.Contact_GetPreviewEnrichContactRequest = null;
1737
+ let _options : base.WebApiRequestOptions = null;
1738
+ const first : any = enrichId;
1739
+ if( typeof( first ) === "object" && first && ( typeof(first.enrichId)!='undefined' ) )
1740
+ {
1741
+ _request = enrichId as carriers.Contact_GetPreviewEnrichContactRequest;
1742
+ _options = webapi_options as base.WebApiRequestOptions;
1743
+ }
1744
+ else
1745
+ {
1746
+ _request = {
1747
+ enrichId: enrichId as string,
1748
+ };
1749
+ _options = webapi_options;
1750
+ }
1751
+ return this._getPreviewEnrichContactAsync( _request, _options );
1752
+ }
1753
+
1754
+ } // class v1ContactAgentController
1755
+
1756
+