@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.
- package/LICENSE.md +15 -15
- package/README.md +184 -184
- package/__tests__/Appointment63-notz.json +1925 -1925
- package/__tests__/Appointment63-utctz.json +1925 -1925
- package/__tests__/Appointment63.json +1925 -1925
- package/__tests__/AppointmentTzTest.ts +115 -115
- package/__tests__/AxiosNockTest.ts +28 -28
- package/__tests__/ContactDefault.json +699 -699
- package/__tests__/ContactEntity.json +272 -272
- package/__tests__/ContactRestTest.ts +144 -144
- package/__tests__/ContactTest.ts +395 -395
- package/__tests__/ConvertersTest.ts +97 -97
- package/__tests__/DocumentTest.ts +101 -101
- package/__tests__/Person210-notz.json +1932 -1932
- package/__tests__/Person210-utctz.json +1932 -1932
- package/__tests__/Person210.json +1932 -1932
- package/__tests__/PersonImageData.nock +22 -22
- package/__tests__/PersonTest.ts +41 -41
- package/__tests__/PersonTzTest.ts +113 -113
- package/__tests__/RecurrenceInfo.json +55 -55
- package/__tests__/ResponseCallbackTest.ts +23 -23
- package/__tests__/TableRights.json +441 -441
- package/__tests__/WebapiTest.ts +264 -264
- package/__tests__/Webhook.json +16 -16
- package/__tests__/WebhookTest.ts +209 -209
- package/dist/cjs/AIAgent.d.ts +62 -0
- package/dist/cjs/AIAgent.d.ts.map +1 -1
- package/dist/cjs/AIAgent.js +149 -0
- package/dist/cjs/AIAgent.js.map +1 -1
- package/dist/cjs/Carriers.d.ts +640 -14
- package/dist/cjs/Carriers.d.ts.map +1 -1
- package/dist/cjs/Converters.d.ts +24 -0
- package/dist/cjs/Converters.d.ts.map +1 -1
- package/dist/cjs/Converters.js +388 -17
- package/dist/cjs/Converters.js.map +1 -1
- package/dist/cjs/DiagnosticsAgent.d.ts +38 -0
- package/dist/cjs/DiagnosticsAgent.d.ts.map +1 -1
- package/dist/cjs/DiagnosticsAgent.js +91 -0
- package/dist/cjs/DiagnosticsAgent.js.map +1 -1
- package/dist/cjs/Enums.d.ts +77 -1
- package/dist/cjs/Enums.d.ts.map +1 -1
- package/dist/cjs/Enums.js +83 -4
- package/dist/cjs/Enums.js.map +1 -1
- package/dist/cjs/ListAgent.d.ts +71 -6
- package/dist/cjs/ListAgent.d.ts.map +1 -1
- package/dist/cjs/ListAgent.js +157 -0
- package/dist/cjs/ListAgent.js.map +1 -1
- package/dist/cjs/MarketingAgent.d.ts +68 -0
- package/dist/cjs/MarketingAgent.d.ts.map +1 -1
- package/dist/cjs/MarketingAgent.js +157 -0
- package/dist/cjs/MarketingAgent.js.map +1 -1
- package/dist/cjs/TicketAgent.d.ts +23 -0
- package/dist/cjs/TicketAgent.d.ts.map +1 -1
- package/dist/cjs/TicketAgent.js +65 -0
- package/dist/cjs/TicketAgent.js.map +1 -1
- package/dist/esm/AIAgent.d.ts +62 -0
- package/dist/esm/AIAgent.d.ts.map +1 -1
- package/dist/esm/AIAgent.js +150 -1
- package/dist/esm/AIAgent.js.map +1 -1
- package/dist/esm/Carriers.d.ts +640 -14
- package/dist/esm/Carriers.d.ts.map +1 -1
- package/dist/esm/Converters.d.ts +24 -0
- package/dist/esm/Converters.d.ts.map +1 -1
- package/dist/esm/Converters.js +346 -0
- package/dist/esm/Converters.js.map +1 -1
- package/dist/esm/DiagnosticsAgent.d.ts +38 -0
- package/dist/esm/DiagnosticsAgent.d.ts.map +1 -1
- package/dist/esm/DiagnosticsAgent.js +91 -0
- package/dist/esm/DiagnosticsAgent.js.map +1 -1
- package/dist/esm/Enums.d.ts +77 -1
- package/dist/esm/Enums.d.ts.map +1 -1
- package/dist/esm/Enums.js +79 -0
- package/dist/esm/Enums.js.map +1 -1
- package/dist/esm/ListAgent.d.ts +71 -6
- package/dist/esm/ListAgent.d.ts.map +1 -1
- package/dist/esm/ListAgent.js +157 -0
- package/dist/esm/ListAgent.js.map +1 -1
- package/dist/esm/MarketingAgent.d.ts +68 -0
- package/dist/esm/MarketingAgent.d.ts.map +1 -1
- package/dist/esm/MarketingAgent.js +157 -0
- package/dist/esm/MarketingAgent.js.map +1 -1
- package/dist/esm/TicketAgent.d.ts +23 -0
- package/dist/esm/TicketAgent.d.ts.map +1 -1
- package/dist/esm/TicketAgent.js +65 -0
- package/dist/esm/TicketAgent.js.map +1 -1
- package/examples-js/hello.js +12 -12
- package/examples-ts/hello.ts +8 -8
- package/package.json +93 -93
- package/scripts/postbuild.js +22 -22
- package/scripts/setVersion.js +44 -44
- package/src/AIAgent.ts +2239 -1992
- package/src/AppointmentAgent.ts +6263 -6263
- package/src/AppointmentRestApi.ts +225 -225
- package/src/ArchiveAgent.ts +1950 -1950
- package/src/AssociateAgent.ts +422 -422
- package/src/AxiosCacheHandler.ts +74 -74
- package/src/BLOBAgent.ts +2100 -2100
- package/src/Base64.ts +285 -285
- package/src/BatchAgent.ts +910 -910
- package/src/BulkUpdateAgent.ts +504 -504
- package/src/CRMScriptAgent.ts +1390 -1390
- package/src/Carriers.ts +53121 -52274
- package/src/ChatAgent.ts +1422 -1422
- package/src/ConfigurationAgent.ts +2228 -2228
- package/src/ContactAgent.ts +1756 -1756
- package/src/ContactRestApi.ts +237 -237
- package/src/Converters.ts +23496 -23090
- package/src/CustomerServiceAgent.ts +1799 -1799
- package/src/DashAgent.ts +1674 -1674
- package/src/DatabaseAgent.ts +120 -120
- package/src/DatabaseTableAgent.ts +534 -534
- package/src/Day_js.ts +41 -41
- package/src/DiagnosticsAgent.ts +1384 -1240
- package/src/DocumentAgent.ts +5079 -5079
- package/src/DocumentMigrationAgent.ts +524 -524
- package/src/DocumentRestApi.ts +259 -259
- package/src/EMailAgent.ts +5328 -5328
- package/src/Enums.ts +6998 -6916
- package/src/ErpSyncAgent.ts +2658 -2658
- package/src/FavouriteAgent.ts +720 -720
- package/src/FindAgent.ts +2330 -2330
- package/src/ForeignSystemAgent.ts +1710 -1710
- package/src/FreeTextAgent.ts +372 -372
- package/src/ImportAgent.ts +304 -304
- package/src/LicenseAgent.ts +1230 -1230
- package/src/ListAgent.ts +11451 -11237
- package/src/MDOAgent.ts +748 -748
- package/src/MarketingAgent.ts +1146 -890
- package/src/MessagingAgent.ts +384 -384
- package/src/NavigatorAgent.ts +140 -140
- package/src/NumberAllocationAgent.ts +296 -296
- package/src/PersonAgent.ts +3287 -3287
- package/src/PersonRestApi.ts +241 -241
- package/src/PhoneListAgent.ts +458 -458
- package/src/PocketAgent.ts +780 -780
- package/src/PreferenceAgent.ts +1900 -1900
- package/src/PreviewsAgent.ts +116 -116
- package/src/ProjectAgent.ts +2391 -2391
- package/src/ProjectRestApi.ts +239 -239
- package/src/QuoteAgent.ts +5159 -5159
- package/src/RelationAgent.ts +220 -220
- package/src/ReportAgent.ts +154 -154
- package/src/ResourceAgent.ts +358 -358
- package/src/SaintAgent.ts +601 -601
- package/src/SaleAgent.ts +2034 -2034
- package/src/SaleRestApi.ts +233 -233
- package/src/SelectionAgent.ts +3195 -3195
- package/src/SentryAgent.ts +462 -462
- package/src/SoApiConstants.ts +8 -8
- package/src/TargetsAgent.ts +1104 -1104
- package/src/TicketAgent.ts +3708 -3638
- package/src/TimeZoneAgent.ts +528 -528
- package/src/TooltipsAgent.ts +116 -116
- package/src/UserAgent.ts +4856 -4856
- package/src/UserDefinedFieldInfoAgent.ts +1764 -1764
- package/src/ViewStateAgent.ts +858 -858
- package/src/WebApi.ts +872 -872
- package/src/WebApiBase.ts +565 -565
- package/src/WebhookAgent.ts +388 -388
- package/src/WorkflowAgent.ts +1338 -1338
- package/tsconfig.esm.json +8 -8
- package/tsconfig.jest.json +8 -8
- package/tsconfig.json +34 -34
package/src/PhoneListAgent.ts
CHANGED
|
@@ -1,458 +1,458 @@
|
|
|
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/PhoneListAgent.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
|
-
* Collection of all services for searching for person or contact (company) phone numbers.
|
|
28
|
-
*/
|
|
29
|
-
export interface IPhoneListAgent {
|
|
30
|
-
searchAsync(request: carriers.PhoneList_SearchRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
31
|
-
searchAsync(searchString: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
32
|
-
searchWithPreferencesAsync(request: carriers.PhoneList_SearchWithPreferencesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
33
|
-
searchWithPreferencesAsync(searchString: string, preferences: carriers.PhoneListPreferences, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
34
|
-
getDepartmentPhonesAsync(request: carriers.PhoneList_GetDepartmentPhonesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
35
|
-
getDepartmentPhonesAsync(departmentId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
36
|
-
getFavoritesPhonesAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
37
|
-
getContactPhonesAsync(request: carriers.PhoneList_GetContactPhonesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
38
|
-
getContactPhonesAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
39
|
-
addToFavoritesAsync(request: carriers.PhoneList_AddToFavoritesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
|
|
40
|
-
addToFavoritesAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
|
|
41
|
-
getPreferencesAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListPreferences >;
|
|
42
|
-
setPreferencesAsync(request: carriers.PhoneList_SetPreferencesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
43
|
-
setPreferencesAsync(preferences: carriers.PhoneListPreferences, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
44
|
-
} // interface IPhoneListAgent
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Collection of all services for searching for person or contact (company) phone numbers.
|
|
51
|
-
*/
|
|
52
|
-
export class PhoneListAgent extends base.WebApiBase implements IPhoneListAgent {
|
|
53
|
-
constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
|
|
54
|
-
constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
|
|
55
|
-
constructor(baseUrl: string, resourceManager:any);
|
|
56
|
-
constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
|
|
57
|
-
constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
|
|
58
|
-
constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
|
|
59
|
-
constructor(options: base.WebApiOptions);
|
|
60
|
-
|
|
61
|
-
constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
|
|
62
|
-
langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
|
|
63
|
-
langOrResourceOrRM?:string|base.ResourceParsing|any,
|
|
64
|
-
cultureCode?: string,
|
|
65
|
-
) {
|
|
66
|
-
const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
|
|
67
|
-
options.basePath = "v1/Agents/PhoneList/";
|
|
68
|
-
super(options);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
private async _searchAsync(request: carriers.PhoneList_SearchRequest, options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] > {
|
|
74
|
-
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
75
|
-
base.WebApiBase.SetPending(options);
|
|
76
|
-
return new Promise< carriers.PhoneListItem[] >(async (resolve, reject) => {
|
|
77
|
-
try {
|
|
78
|
-
config.baseURL = this._options.baseUrl;
|
|
79
|
-
const response = await this._axios.post("Search", request , config);
|
|
80
|
-
base.WebApiBase.SetCompleted(options, response);
|
|
81
|
-
const res : carriers.PhoneListItem[] = converters.Create_PhoneListItemArray_From( response.data );
|
|
82
|
-
resolve(res);
|
|
83
|
-
}
|
|
84
|
-
catch( err ) {
|
|
85
|
-
base.WebApiBase.HandleError(options, config, err);
|
|
86
|
-
reject(err);
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Searching the phone list. Using default search preferences or the preferences already set by the PhoneListPreferences Service
|
|
95
|
-
* @param request - SearchString
|
|
96
|
-
* @returns The resulting phone list
|
|
97
|
-
*/
|
|
98
|
-
public async searchAsync(request: carriers.PhoneList_SearchRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Searching the phone list. Using default search preferences or the preferences already set by the PhoneListPreferences Service
|
|
102
|
-
* @param searchString - The search string
|
|
103
|
-
* @returns The resulting phone list
|
|
104
|
-
*/
|
|
105
|
-
public async searchAsync(searchString: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
106
|
-
|
|
107
|
-
public async searchAsync(searchString:string|carriers.PhoneList_SearchRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] > {
|
|
108
|
-
let _request : carriers.PhoneList_SearchRequest = null;
|
|
109
|
-
let _options : base.WebApiRequestOptions = null;
|
|
110
|
-
const first : any = searchString;
|
|
111
|
-
if( typeof( first ) === "object" && first && ( typeof(first.searchString)!='undefined' ) )
|
|
112
|
-
{
|
|
113
|
-
_request = searchString as carriers.PhoneList_SearchRequest;
|
|
114
|
-
_options = webapi_options as base.WebApiRequestOptions;
|
|
115
|
-
}
|
|
116
|
-
else
|
|
117
|
-
{
|
|
118
|
-
_request = {
|
|
119
|
-
searchString: searchString as string,
|
|
120
|
-
};
|
|
121
|
-
_options = webapi_options;
|
|
122
|
-
}
|
|
123
|
-
return this._searchAsync( _request, _options );
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
private async _searchWithPreferencesAsync(request: carriers.PhoneList_SearchWithPreferencesRequest, options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] > {
|
|
128
|
-
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
129
|
-
base.WebApiBase.SetPending(options);
|
|
130
|
-
return new Promise< carriers.PhoneListItem[] >(async (resolve, reject) => {
|
|
131
|
-
try {
|
|
132
|
-
config.baseURL = this._options.baseUrl;
|
|
133
|
-
const response = await this._axios.post("SearchWithPreferences", request , config);
|
|
134
|
-
base.WebApiBase.SetCompleted(options, response);
|
|
135
|
-
const res : carriers.PhoneListItem[] = converters.Create_PhoneListItemArray_From( response.data );
|
|
136
|
-
resolve(res);
|
|
137
|
-
}
|
|
138
|
-
catch( err ) {
|
|
139
|
-
base.WebApiBase.HandleError(options, config, err);
|
|
140
|
-
reject(err);
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Searching the phone list. Search is based on the supplied preferences.
|
|
149
|
-
* @param request - SearchString, Preferences
|
|
150
|
-
* @returns The resulting phone list.
|
|
151
|
-
*/
|
|
152
|
-
public async searchWithPreferencesAsync(request: carriers.PhoneList_SearchWithPreferencesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Searching the phone list. Search is based on the supplied preferences.
|
|
156
|
-
* @param searchString - The search string.
|
|
157
|
-
* @param preferences - The search preferences
|
|
158
|
-
* @returns The resulting phone list.
|
|
159
|
-
*/
|
|
160
|
-
public async searchWithPreferencesAsync(searchString: string, preferences: carriers.PhoneListPreferences, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
161
|
-
|
|
162
|
-
public async searchWithPreferencesAsync(searchString:string|carriers.PhoneList_SearchWithPreferencesRequest, preferences?:carriers.PhoneListPreferences|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] > {
|
|
163
|
-
let _request : carriers.PhoneList_SearchWithPreferencesRequest = null;
|
|
164
|
-
let _options : base.WebApiRequestOptions = null;
|
|
165
|
-
const first : any = searchString;
|
|
166
|
-
if( typeof( first ) === "object" && first && ( typeof(first.searchString)!='undefined' || typeof(first.preferences)!='undefined' ) )
|
|
167
|
-
{
|
|
168
|
-
_request = searchString as carriers.PhoneList_SearchWithPreferencesRequest;
|
|
169
|
-
_options = preferences as base.WebApiRequestOptions;
|
|
170
|
-
}
|
|
171
|
-
else
|
|
172
|
-
{
|
|
173
|
-
_request = {
|
|
174
|
-
searchString: searchString as string,
|
|
175
|
-
preferences: preferences as carriers.PhoneListPreferences,
|
|
176
|
-
};
|
|
177
|
-
_options = webapi_options;
|
|
178
|
-
}
|
|
179
|
-
return this._searchWithPreferencesAsync( _request, _options );
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
private async _getDepartmentPhonesAsync(request: carriers.PhoneList_GetDepartmentPhonesRequest, options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] > {
|
|
184
|
-
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
185
|
-
base.WebApiBase.SetPending(options);
|
|
186
|
-
return new Promise< carriers.PhoneListItem[] >(async (resolve, reject) => {
|
|
187
|
-
try {
|
|
188
|
-
config.baseURL = this._options.baseUrl;
|
|
189
|
-
const response = await this._axios.post("GetDepartmentPhones", request , config);
|
|
190
|
-
base.WebApiBase.SetCompleted(options, response);
|
|
191
|
-
const res : carriers.PhoneListItem[] = converters.Create_PhoneListItemArray_From( response.data );
|
|
192
|
-
resolve(res);
|
|
193
|
-
}
|
|
194
|
-
catch( err ) {
|
|
195
|
-
base.WebApiBase.HandleError(options, config, err);
|
|
196
|
-
reject(err);
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Returns an array of phone list items with the in-parameter as restriction. The in-parameter must be a valid department id (UserGroupId).
|
|
205
|
-
* @param request - DepartmentId
|
|
206
|
-
* @returns The department phone list
|
|
207
|
-
*/
|
|
208
|
-
public async getDepartmentPhonesAsync(request: carriers.PhoneList_GetDepartmentPhonesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Returns an array of phone list items with the in-parameter as restriction. The in-parameter must be a valid department id (UserGroupId).
|
|
212
|
-
* @param departmentId - The department to get the phone list for
|
|
213
|
-
* @returns The department phone list
|
|
214
|
-
*/
|
|
215
|
-
public async getDepartmentPhonesAsync(departmentId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
216
|
-
|
|
217
|
-
public async getDepartmentPhonesAsync(departmentId:number|carriers.PhoneList_GetDepartmentPhonesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] > {
|
|
218
|
-
let _request : carriers.PhoneList_GetDepartmentPhonesRequest = null;
|
|
219
|
-
let _options : base.WebApiRequestOptions = null;
|
|
220
|
-
const first : any = departmentId;
|
|
221
|
-
if( typeof( first ) === "object" && first && ( typeof(first.departmentId)!='undefined' ) )
|
|
222
|
-
{
|
|
223
|
-
_request = departmentId as carriers.PhoneList_GetDepartmentPhonesRequest;
|
|
224
|
-
_options = webapi_options as base.WebApiRequestOptions;
|
|
225
|
-
}
|
|
226
|
-
else
|
|
227
|
-
{
|
|
228
|
-
_request = {
|
|
229
|
-
departmentId: departmentId as number,
|
|
230
|
-
};
|
|
231
|
-
_options = webapi_options;
|
|
232
|
-
}
|
|
233
|
-
return this._getDepartmentPhonesAsync( _request, _options );
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
private async _getFavoritesPhonesAsync( options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] > {
|
|
238
|
-
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
239
|
-
base.WebApiBase.SetPending(options);
|
|
240
|
-
return new Promise< carriers.PhoneListItem[] >(async (resolve, reject) => {
|
|
241
|
-
try {
|
|
242
|
-
config.baseURL = this._options.baseUrl;
|
|
243
|
-
const response = await this._axios.post("GetFavoritesPhones", undefined , config);
|
|
244
|
-
base.WebApiBase.SetCompleted(options, response);
|
|
245
|
-
const res : carriers.PhoneListItem[] = converters.Create_PhoneListItemArray_From( response.data );
|
|
246
|
-
resolve(res);
|
|
247
|
-
}
|
|
248
|
-
catch( err ) {
|
|
249
|
-
base.WebApiBase.HandleError(options, config, err);
|
|
250
|
-
reject(err);
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Returns an array of phone list items with the Contacts in the users favorites dropdown list.
|
|
258
|
-
* @returns The favorite contact phone list
|
|
259
|
-
*/
|
|
260
|
-
public async getFavoritesPhonesAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >
|
|
261
|
-
{
|
|
262
|
-
return this._getFavoritesPhonesAsync(webapi_options);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
private async _getContactPhonesAsync(request: carriers.PhoneList_GetContactPhonesRequest, options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] > {
|
|
267
|
-
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
268
|
-
base.WebApiBase.SetPending(options);
|
|
269
|
-
return new Promise< carriers.PhoneListItem[] >(async (resolve, reject) => {
|
|
270
|
-
try {
|
|
271
|
-
config.baseURL = this._options.baseUrl;
|
|
272
|
-
const response = await this._axios.post("GetContactPhones", request , config);
|
|
273
|
-
base.WebApiBase.SetCompleted(options, response);
|
|
274
|
-
const res : carriers.PhoneListItem[] = converters.Create_PhoneListItemArray_From( response.data );
|
|
275
|
-
resolve(res);
|
|
276
|
-
}
|
|
277
|
-
catch( err ) {
|
|
278
|
-
base.WebApiBase.HandleError(options, config, err);
|
|
279
|
-
reject(err);
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Returns an array of phone list items for all the persons belonging to a contact (company). The in-parameter must be a valid contact-id.
|
|
288
|
-
* @param request - ContactId
|
|
289
|
-
* @returns The contacts phone list.
|
|
290
|
-
*/
|
|
291
|
-
public async getContactPhonesAsync(request: carriers.PhoneList_GetContactPhonesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Returns an array of phone list items for all the persons belonging to a contact (company). The in-parameter must be a valid contact-id.
|
|
295
|
-
* @param contactId - The contact id
|
|
296
|
-
* @returns The contacts phone list.
|
|
297
|
-
*/
|
|
298
|
-
public async getContactPhonesAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
299
|
-
|
|
300
|
-
public async getContactPhonesAsync(contactId:number|carriers.PhoneList_GetContactPhonesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] > {
|
|
301
|
-
let _request : carriers.PhoneList_GetContactPhonesRequest = null;
|
|
302
|
-
let _options : base.WebApiRequestOptions = null;
|
|
303
|
-
const first : any = contactId;
|
|
304
|
-
if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' ) )
|
|
305
|
-
{
|
|
306
|
-
_request = contactId as carriers.PhoneList_GetContactPhonesRequest;
|
|
307
|
-
_options = webapi_options as base.WebApiRequestOptions;
|
|
308
|
-
}
|
|
309
|
-
else
|
|
310
|
-
{
|
|
311
|
-
_request = {
|
|
312
|
-
contactId: contactId as number,
|
|
313
|
-
};
|
|
314
|
-
_options = webapi_options;
|
|
315
|
-
}
|
|
316
|
-
return this._getContactPhonesAsync( _request, _options );
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
private async _addToFavoritesAsync(request: carriers.PhoneList_AddToFavoritesRequest, options?:base.WebApiRequestOptions) : Promise< number > {
|
|
321
|
-
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
322
|
-
base.WebApiBase.SetPending(options);
|
|
323
|
-
return new Promise< number >(async (resolve, reject) => {
|
|
324
|
-
try {
|
|
325
|
-
config.baseURL = this._options.baseUrl;
|
|
326
|
-
const response = await this._axios.post("AddToFavorites", request , config);
|
|
327
|
-
base.WebApiBase.SetCompleted(options, response);
|
|
328
|
-
const res : number = response.data as number;
|
|
329
|
-
resolve(res);
|
|
330
|
-
}
|
|
331
|
-
catch( err ) {
|
|
332
|
-
base.WebApiBase.HandleError(options, config, err);
|
|
333
|
-
reject(err);
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Adds a new contact to the history/favorites. Returns the rank of the new history item. If the contact already existed in the history, it isn't added but the rank is updated.
|
|
342
|
-
* @param request - ContactId
|
|
343
|
-
* @returns The rank of the history item
|
|
344
|
-
*/
|
|
345
|
-
public async addToFavoritesAsync(request: carriers.PhoneList_AddToFavoritesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
|
|
346
|
-
|
|
347
|
-
/**
|
|
348
|
-
* Adds a new contact to the history/favorites. Returns the rank of the new history item. If the contact already existed in the history, it isn't added but the rank is updated.
|
|
349
|
-
* @param contactId - The contact id
|
|
350
|
-
* @returns The rank of the history item
|
|
351
|
-
*/
|
|
352
|
-
public async addToFavoritesAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
|
|
353
|
-
|
|
354
|
-
public async addToFavoritesAsync(contactId:number|carriers.PhoneList_AddToFavoritesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number > {
|
|
355
|
-
let _request : carriers.PhoneList_AddToFavoritesRequest = null;
|
|
356
|
-
let _options : base.WebApiRequestOptions = null;
|
|
357
|
-
const first : any = contactId;
|
|
358
|
-
if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' ) )
|
|
359
|
-
{
|
|
360
|
-
_request = contactId as carriers.PhoneList_AddToFavoritesRequest;
|
|
361
|
-
_options = webapi_options as base.WebApiRequestOptions;
|
|
362
|
-
}
|
|
363
|
-
else
|
|
364
|
-
{
|
|
365
|
-
_request = {
|
|
366
|
-
contactId: contactId as number,
|
|
367
|
-
};
|
|
368
|
-
_options = webapi_options;
|
|
369
|
-
}
|
|
370
|
-
return this._addToFavoritesAsync( _request, _options );
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
private async _getPreferencesAsync( options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListPreferences > {
|
|
375
|
-
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
376
|
-
base.WebApiBase.SetPending(options);
|
|
377
|
-
return new Promise< carriers.PhoneListPreferences >(async (resolve, reject) => {
|
|
378
|
-
try {
|
|
379
|
-
config.baseURL = this._options.baseUrl;
|
|
380
|
-
const response = await this._axios.post("GetPreferences", undefined , config);
|
|
381
|
-
base.WebApiBase.SetCompleted(options, response);
|
|
382
|
-
const res : carriers.PhoneListPreferences = converters.Create_PhoneListPreferences_From( response.data );
|
|
383
|
-
resolve(res);
|
|
384
|
-
}
|
|
385
|
-
catch( err ) {
|
|
386
|
-
base.WebApiBase.HandleError(options, config, err);
|
|
387
|
-
reject(err);
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
/**
|
|
394
|
-
* Getting Phone List Preferences from the CRM 5 user preferences
|
|
395
|
-
* @returns The Phone List Preferences
|
|
396
|
-
*/
|
|
397
|
-
public async getPreferencesAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListPreferences >
|
|
398
|
-
{
|
|
399
|
-
return this._getPreferencesAsync(webapi_options);
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
private async _setPreferencesAsync(request: carriers.PhoneList_SetPreferencesRequest, options?:base.WebApiRequestOptions) : Promise< void > {
|
|
404
|
-
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
405
|
-
base.WebApiBase.SetPending(options);
|
|
406
|
-
return new Promise< void >(async (resolve, reject) => {
|
|
407
|
-
try {
|
|
408
|
-
config.baseURL = this._options.baseUrl;
|
|
409
|
-
const response = await this._axios.post("SetPreferences", request , config);
|
|
410
|
-
base.WebApiBase.SetCompleted(options, response);
|
|
411
|
-
const res = response.data;
|
|
412
|
-
resolve(res);
|
|
413
|
-
}
|
|
414
|
-
catch( err ) {
|
|
415
|
-
base.WebApiBase.HandleError(options, config, err);
|
|
416
|
-
reject(err);
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
/**
|
|
424
|
-
* Setting Phone List Preferences to the CRM 5 user preferences
|
|
425
|
-
* @param request - Preferences
|
|
426
|
-
* @returns
|
|
427
|
-
*/
|
|
428
|
-
public async setPreferencesAsync(request: carriers.PhoneList_SetPreferencesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* Setting Phone List Preferences to the CRM 5 user preferences
|
|
432
|
-
* @param preferences - The preference that is set as user preferences
|
|
433
|
-
* @returns
|
|
434
|
-
*/
|
|
435
|
-
public async setPreferencesAsync(preferences: carriers.PhoneListPreferences, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
436
|
-
|
|
437
|
-
public async setPreferencesAsync(preferences:carriers.PhoneListPreferences|carriers.PhoneList_SetPreferencesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
|
|
438
|
-
let _request : carriers.PhoneList_SetPreferencesRequest = null;
|
|
439
|
-
let _options : base.WebApiRequestOptions = null;
|
|
440
|
-
const first : any = preferences;
|
|
441
|
-
if( typeof( first ) === "object" && first && ( typeof(first.preferences)!='undefined' ) )
|
|
442
|
-
{
|
|
443
|
-
_request = preferences as carriers.PhoneList_SetPreferencesRequest;
|
|
444
|
-
_options = webapi_options as base.WebApiRequestOptions;
|
|
445
|
-
}
|
|
446
|
-
else
|
|
447
|
-
{
|
|
448
|
-
_request = {
|
|
449
|
-
preferences: preferences as carriers.PhoneListPreferences,
|
|
450
|
-
};
|
|
451
|
-
_options = webapi_options;
|
|
452
|
-
}
|
|
453
|
-
return this._setPreferencesAsync( _request, _options );
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
} // class v1PhoneListAgentController
|
|
457
|
-
|
|
458
|
-
|
|
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/PhoneListAgent.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
|
+
* Collection of all services for searching for person or contact (company) phone numbers.
|
|
28
|
+
*/
|
|
29
|
+
export interface IPhoneListAgent {
|
|
30
|
+
searchAsync(request: carriers.PhoneList_SearchRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
31
|
+
searchAsync(searchString: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
32
|
+
searchWithPreferencesAsync(request: carriers.PhoneList_SearchWithPreferencesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
33
|
+
searchWithPreferencesAsync(searchString: string, preferences: carriers.PhoneListPreferences, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
34
|
+
getDepartmentPhonesAsync(request: carriers.PhoneList_GetDepartmentPhonesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
35
|
+
getDepartmentPhonesAsync(departmentId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
36
|
+
getFavoritesPhonesAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
37
|
+
getContactPhonesAsync(request: carriers.PhoneList_GetContactPhonesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
38
|
+
getContactPhonesAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
39
|
+
addToFavoritesAsync(request: carriers.PhoneList_AddToFavoritesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
|
|
40
|
+
addToFavoritesAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
|
|
41
|
+
getPreferencesAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListPreferences >;
|
|
42
|
+
setPreferencesAsync(request: carriers.PhoneList_SetPreferencesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
43
|
+
setPreferencesAsync(preferences: carriers.PhoneListPreferences, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
44
|
+
} // interface IPhoneListAgent
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Collection of all services for searching for person or contact (company) phone numbers.
|
|
51
|
+
*/
|
|
52
|
+
export class PhoneListAgent extends base.WebApiBase implements IPhoneListAgent {
|
|
53
|
+
constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
|
|
54
|
+
constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
|
|
55
|
+
constructor(baseUrl: string, resourceManager:any);
|
|
56
|
+
constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
|
|
57
|
+
constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
|
|
58
|
+
constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
|
|
59
|
+
constructor(options: base.WebApiOptions);
|
|
60
|
+
|
|
61
|
+
constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
|
|
62
|
+
langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
|
|
63
|
+
langOrResourceOrRM?:string|base.ResourceParsing|any,
|
|
64
|
+
cultureCode?: string,
|
|
65
|
+
) {
|
|
66
|
+
const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
|
|
67
|
+
options.basePath = "v1/Agents/PhoneList/";
|
|
68
|
+
super(options);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
private async _searchAsync(request: carriers.PhoneList_SearchRequest, options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] > {
|
|
74
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
75
|
+
base.WebApiBase.SetPending(options);
|
|
76
|
+
return new Promise< carriers.PhoneListItem[] >(async (resolve, reject) => {
|
|
77
|
+
try {
|
|
78
|
+
config.baseURL = this._options.baseUrl;
|
|
79
|
+
const response = await this._axios.post("Search", request , config);
|
|
80
|
+
base.WebApiBase.SetCompleted(options, response);
|
|
81
|
+
const res : carriers.PhoneListItem[] = converters.Create_PhoneListItemArray_From( response.data );
|
|
82
|
+
resolve(res);
|
|
83
|
+
}
|
|
84
|
+
catch( err ) {
|
|
85
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
86
|
+
reject(err);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Searching the phone list. Using default search preferences or the preferences already set by the PhoneListPreferences Service
|
|
95
|
+
* @param request - SearchString
|
|
96
|
+
* @returns The resulting phone list
|
|
97
|
+
*/
|
|
98
|
+
public async searchAsync(request: carriers.PhoneList_SearchRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Searching the phone list. Using default search preferences or the preferences already set by the PhoneListPreferences Service
|
|
102
|
+
* @param searchString - The search string
|
|
103
|
+
* @returns The resulting phone list
|
|
104
|
+
*/
|
|
105
|
+
public async searchAsync(searchString: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
106
|
+
|
|
107
|
+
public async searchAsync(searchString:string|carriers.PhoneList_SearchRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] > {
|
|
108
|
+
let _request : carriers.PhoneList_SearchRequest = null;
|
|
109
|
+
let _options : base.WebApiRequestOptions = null;
|
|
110
|
+
const first : any = searchString;
|
|
111
|
+
if( typeof( first ) === "object" && first && ( typeof(first.searchString)!='undefined' ) )
|
|
112
|
+
{
|
|
113
|
+
_request = searchString as carriers.PhoneList_SearchRequest;
|
|
114
|
+
_options = webapi_options as base.WebApiRequestOptions;
|
|
115
|
+
}
|
|
116
|
+
else
|
|
117
|
+
{
|
|
118
|
+
_request = {
|
|
119
|
+
searchString: searchString as string,
|
|
120
|
+
};
|
|
121
|
+
_options = webapi_options;
|
|
122
|
+
}
|
|
123
|
+
return this._searchAsync( _request, _options );
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
private async _searchWithPreferencesAsync(request: carriers.PhoneList_SearchWithPreferencesRequest, options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] > {
|
|
128
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
129
|
+
base.WebApiBase.SetPending(options);
|
|
130
|
+
return new Promise< carriers.PhoneListItem[] >(async (resolve, reject) => {
|
|
131
|
+
try {
|
|
132
|
+
config.baseURL = this._options.baseUrl;
|
|
133
|
+
const response = await this._axios.post("SearchWithPreferences", request , config);
|
|
134
|
+
base.WebApiBase.SetCompleted(options, response);
|
|
135
|
+
const res : carriers.PhoneListItem[] = converters.Create_PhoneListItemArray_From( response.data );
|
|
136
|
+
resolve(res);
|
|
137
|
+
}
|
|
138
|
+
catch( err ) {
|
|
139
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
140
|
+
reject(err);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Searching the phone list. Search is based on the supplied preferences.
|
|
149
|
+
* @param request - SearchString, Preferences
|
|
150
|
+
* @returns The resulting phone list.
|
|
151
|
+
*/
|
|
152
|
+
public async searchWithPreferencesAsync(request: carriers.PhoneList_SearchWithPreferencesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Searching the phone list. Search is based on the supplied preferences.
|
|
156
|
+
* @param searchString - The search string.
|
|
157
|
+
* @param preferences - The search preferences
|
|
158
|
+
* @returns The resulting phone list.
|
|
159
|
+
*/
|
|
160
|
+
public async searchWithPreferencesAsync(searchString: string, preferences: carriers.PhoneListPreferences, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
161
|
+
|
|
162
|
+
public async searchWithPreferencesAsync(searchString:string|carriers.PhoneList_SearchWithPreferencesRequest, preferences?:carriers.PhoneListPreferences|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] > {
|
|
163
|
+
let _request : carriers.PhoneList_SearchWithPreferencesRequest = null;
|
|
164
|
+
let _options : base.WebApiRequestOptions = null;
|
|
165
|
+
const first : any = searchString;
|
|
166
|
+
if( typeof( first ) === "object" && first && ( typeof(first.searchString)!='undefined' || typeof(first.preferences)!='undefined' ) )
|
|
167
|
+
{
|
|
168
|
+
_request = searchString as carriers.PhoneList_SearchWithPreferencesRequest;
|
|
169
|
+
_options = preferences as base.WebApiRequestOptions;
|
|
170
|
+
}
|
|
171
|
+
else
|
|
172
|
+
{
|
|
173
|
+
_request = {
|
|
174
|
+
searchString: searchString as string,
|
|
175
|
+
preferences: preferences as carriers.PhoneListPreferences,
|
|
176
|
+
};
|
|
177
|
+
_options = webapi_options;
|
|
178
|
+
}
|
|
179
|
+
return this._searchWithPreferencesAsync( _request, _options );
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
private async _getDepartmentPhonesAsync(request: carriers.PhoneList_GetDepartmentPhonesRequest, options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] > {
|
|
184
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
185
|
+
base.WebApiBase.SetPending(options);
|
|
186
|
+
return new Promise< carriers.PhoneListItem[] >(async (resolve, reject) => {
|
|
187
|
+
try {
|
|
188
|
+
config.baseURL = this._options.baseUrl;
|
|
189
|
+
const response = await this._axios.post("GetDepartmentPhones", request , config);
|
|
190
|
+
base.WebApiBase.SetCompleted(options, response);
|
|
191
|
+
const res : carriers.PhoneListItem[] = converters.Create_PhoneListItemArray_From( response.data );
|
|
192
|
+
resolve(res);
|
|
193
|
+
}
|
|
194
|
+
catch( err ) {
|
|
195
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
196
|
+
reject(err);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Returns an array of phone list items with the in-parameter as restriction. The in-parameter must be a valid department id (UserGroupId).
|
|
205
|
+
* @param request - DepartmentId
|
|
206
|
+
* @returns The department phone list
|
|
207
|
+
*/
|
|
208
|
+
public async getDepartmentPhonesAsync(request: carriers.PhoneList_GetDepartmentPhonesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Returns an array of phone list items with the in-parameter as restriction. The in-parameter must be a valid department id (UserGroupId).
|
|
212
|
+
* @param departmentId - The department to get the phone list for
|
|
213
|
+
* @returns The department phone list
|
|
214
|
+
*/
|
|
215
|
+
public async getDepartmentPhonesAsync(departmentId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
216
|
+
|
|
217
|
+
public async getDepartmentPhonesAsync(departmentId:number|carriers.PhoneList_GetDepartmentPhonesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] > {
|
|
218
|
+
let _request : carriers.PhoneList_GetDepartmentPhonesRequest = null;
|
|
219
|
+
let _options : base.WebApiRequestOptions = null;
|
|
220
|
+
const first : any = departmentId;
|
|
221
|
+
if( typeof( first ) === "object" && first && ( typeof(first.departmentId)!='undefined' ) )
|
|
222
|
+
{
|
|
223
|
+
_request = departmentId as carriers.PhoneList_GetDepartmentPhonesRequest;
|
|
224
|
+
_options = webapi_options as base.WebApiRequestOptions;
|
|
225
|
+
}
|
|
226
|
+
else
|
|
227
|
+
{
|
|
228
|
+
_request = {
|
|
229
|
+
departmentId: departmentId as number,
|
|
230
|
+
};
|
|
231
|
+
_options = webapi_options;
|
|
232
|
+
}
|
|
233
|
+
return this._getDepartmentPhonesAsync( _request, _options );
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
private async _getFavoritesPhonesAsync( options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] > {
|
|
238
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
239
|
+
base.WebApiBase.SetPending(options);
|
|
240
|
+
return new Promise< carriers.PhoneListItem[] >(async (resolve, reject) => {
|
|
241
|
+
try {
|
|
242
|
+
config.baseURL = this._options.baseUrl;
|
|
243
|
+
const response = await this._axios.post("GetFavoritesPhones", undefined , config);
|
|
244
|
+
base.WebApiBase.SetCompleted(options, response);
|
|
245
|
+
const res : carriers.PhoneListItem[] = converters.Create_PhoneListItemArray_From( response.data );
|
|
246
|
+
resolve(res);
|
|
247
|
+
}
|
|
248
|
+
catch( err ) {
|
|
249
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
250
|
+
reject(err);
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Returns an array of phone list items with the Contacts in the users favorites dropdown list.
|
|
258
|
+
* @returns The favorite contact phone list
|
|
259
|
+
*/
|
|
260
|
+
public async getFavoritesPhonesAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >
|
|
261
|
+
{
|
|
262
|
+
return this._getFavoritesPhonesAsync(webapi_options);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
private async _getContactPhonesAsync(request: carriers.PhoneList_GetContactPhonesRequest, options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] > {
|
|
267
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
268
|
+
base.WebApiBase.SetPending(options);
|
|
269
|
+
return new Promise< carriers.PhoneListItem[] >(async (resolve, reject) => {
|
|
270
|
+
try {
|
|
271
|
+
config.baseURL = this._options.baseUrl;
|
|
272
|
+
const response = await this._axios.post("GetContactPhones", request , config);
|
|
273
|
+
base.WebApiBase.SetCompleted(options, response);
|
|
274
|
+
const res : carriers.PhoneListItem[] = converters.Create_PhoneListItemArray_From( response.data );
|
|
275
|
+
resolve(res);
|
|
276
|
+
}
|
|
277
|
+
catch( err ) {
|
|
278
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
279
|
+
reject(err);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Returns an array of phone list items for all the persons belonging to a contact (company). The in-parameter must be a valid contact-id.
|
|
288
|
+
* @param request - ContactId
|
|
289
|
+
* @returns The contacts phone list.
|
|
290
|
+
*/
|
|
291
|
+
public async getContactPhonesAsync(request: carriers.PhoneList_GetContactPhonesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Returns an array of phone list items for all the persons belonging to a contact (company). The in-parameter must be a valid contact-id.
|
|
295
|
+
* @param contactId - The contact id
|
|
296
|
+
* @returns The contacts phone list.
|
|
297
|
+
*/
|
|
298
|
+
public async getContactPhonesAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] >;
|
|
299
|
+
|
|
300
|
+
public async getContactPhonesAsync(contactId:number|carriers.PhoneList_GetContactPhonesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListItem[] > {
|
|
301
|
+
let _request : carriers.PhoneList_GetContactPhonesRequest = null;
|
|
302
|
+
let _options : base.WebApiRequestOptions = null;
|
|
303
|
+
const first : any = contactId;
|
|
304
|
+
if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' ) )
|
|
305
|
+
{
|
|
306
|
+
_request = contactId as carriers.PhoneList_GetContactPhonesRequest;
|
|
307
|
+
_options = webapi_options as base.WebApiRequestOptions;
|
|
308
|
+
}
|
|
309
|
+
else
|
|
310
|
+
{
|
|
311
|
+
_request = {
|
|
312
|
+
contactId: contactId as number,
|
|
313
|
+
};
|
|
314
|
+
_options = webapi_options;
|
|
315
|
+
}
|
|
316
|
+
return this._getContactPhonesAsync( _request, _options );
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
private async _addToFavoritesAsync(request: carriers.PhoneList_AddToFavoritesRequest, options?:base.WebApiRequestOptions) : Promise< number > {
|
|
321
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
322
|
+
base.WebApiBase.SetPending(options);
|
|
323
|
+
return new Promise< number >(async (resolve, reject) => {
|
|
324
|
+
try {
|
|
325
|
+
config.baseURL = this._options.baseUrl;
|
|
326
|
+
const response = await this._axios.post("AddToFavorites", request , config);
|
|
327
|
+
base.WebApiBase.SetCompleted(options, response);
|
|
328
|
+
const res : number = response.data as number;
|
|
329
|
+
resolve(res);
|
|
330
|
+
}
|
|
331
|
+
catch( err ) {
|
|
332
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
333
|
+
reject(err);
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Adds a new contact to the history/favorites. Returns the rank of the new history item. If the contact already existed in the history, it isn't added but the rank is updated.
|
|
342
|
+
* @param request - ContactId
|
|
343
|
+
* @returns The rank of the history item
|
|
344
|
+
*/
|
|
345
|
+
public async addToFavoritesAsync(request: carriers.PhoneList_AddToFavoritesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Adds a new contact to the history/favorites. Returns the rank of the new history item. If the contact already existed in the history, it isn't added but the rank is updated.
|
|
349
|
+
* @param contactId - The contact id
|
|
350
|
+
* @returns The rank of the history item
|
|
351
|
+
*/
|
|
352
|
+
public async addToFavoritesAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
|
|
353
|
+
|
|
354
|
+
public async addToFavoritesAsync(contactId:number|carriers.PhoneList_AddToFavoritesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number > {
|
|
355
|
+
let _request : carriers.PhoneList_AddToFavoritesRequest = null;
|
|
356
|
+
let _options : base.WebApiRequestOptions = null;
|
|
357
|
+
const first : any = contactId;
|
|
358
|
+
if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' ) )
|
|
359
|
+
{
|
|
360
|
+
_request = contactId as carriers.PhoneList_AddToFavoritesRequest;
|
|
361
|
+
_options = webapi_options as base.WebApiRequestOptions;
|
|
362
|
+
}
|
|
363
|
+
else
|
|
364
|
+
{
|
|
365
|
+
_request = {
|
|
366
|
+
contactId: contactId as number,
|
|
367
|
+
};
|
|
368
|
+
_options = webapi_options;
|
|
369
|
+
}
|
|
370
|
+
return this._addToFavoritesAsync( _request, _options );
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
private async _getPreferencesAsync( options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListPreferences > {
|
|
375
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
376
|
+
base.WebApiBase.SetPending(options);
|
|
377
|
+
return new Promise< carriers.PhoneListPreferences >(async (resolve, reject) => {
|
|
378
|
+
try {
|
|
379
|
+
config.baseURL = this._options.baseUrl;
|
|
380
|
+
const response = await this._axios.post("GetPreferences", undefined , config);
|
|
381
|
+
base.WebApiBase.SetCompleted(options, response);
|
|
382
|
+
const res : carriers.PhoneListPreferences = converters.Create_PhoneListPreferences_From( response.data );
|
|
383
|
+
resolve(res);
|
|
384
|
+
}
|
|
385
|
+
catch( err ) {
|
|
386
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
387
|
+
reject(err);
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Getting Phone List Preferences from the CRM 5 user preferences
|
|
395
|
+
* @returns The Phone List Preferences
|
|
396
|
+
*/
|
|
397
|
+
public async getPreferencesAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PhoneListPreferences >
|
|
398
|
+
{
|
|
399
|
+
return this._getPreferencesAsync(webapi_options);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
private async _setPreferencesAsync(request: carriers.PhoneList_SetPreferencesRequest, options?:base.WebApiRequestOptions) : Promise< void > {
|
|
404
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
405
|
+
base.WebApiBase.SetPending(options);
|
|
406
|
+
return new Promise< void >(async (resolve, reject) => {
|
|
407
|
+
try {
|
|
408
|
+
config.baseURL = this._options.baseUrl;
|
|
409
|
+
const response = await this._axios.post("SetPreferences", request , config);
|
|
410
|
+
base.WebApiBase.SetCompleted(options, response);
|
|
411
|
+
const res = response.data;
|
|
412
|
+
resolve(res);
|
|
413
|
+
}
|
|
414
|
+
catch( err ) {
|
|
415
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
416
|
+
reject(err);
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Setting Phone List Preferences to the CRM 5 user preferences
|
|
425
|
+
* @param request - Preferences
|
|
426
|
+
* @returns
|
|
427
|
+
*/
|
|
428
|
+
public async setPreferencesAsync(request: carriers.PhoneList_SetPreferencesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Setting Phone List Preferences to the CRM 5 user preferences
|
|
432
|
+
* @param preferences - The preference that is set as user preferences
|
|
433
|
+
* @returns
|
|
434
|
+
*/
|
|
435
|
+
public async setPreferencesAsync(preferences: carriers.PhoneListPreferences, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
436
|
+
|
|
437
|
+
public async setPreferencesAsync(preferences:carriers.PhoneListPreferences|carriers.PhoneList_SetPreferencesRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
|
|
438
|
+
let _request : carriers.PhoneList_SetPreferencesRequest = null;
|
|
439
|
+
let _options : base.WebApiRequestOptions = null;
|
|
440
|
+
const first : any = preferences;
|
|
441
|
+
if( typeof( first ) === "object" && first && ( typeof(first.preferences)!='undefined' ) )
|
|
442
|
+
{
|
|
443
|
+
_request = preferences as carriers.PhoneList_SetPreferencesRequest;
|
|
444
|
+
_options = webapi_options as base.WebApiRequestOptions;
|
|
445
|
+
}
|
|
446
|
+
else
|
|
447
|
+
{
|
|
448
|
+
_request = {
|
|
449
|
+
preferences: preferences as carriers.PhoneListPreferences,
|
|
450
|
+
};
|
|
451
|
+
_options = webapi_options;
|
|
452
|
+
}
|
|
453
|
+
return this._setPreferencesAsync( _request, _options );
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
} // class v1PhoneListAgentController
|
|
457
|
+
|
|
458
|
+
|