@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/RelationAgent.ts
CHANGED
|
@@ -1,220 +1,220 @@
|
|
|
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/RelationAgent.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/Person relations
|
|
28
|
-
*/
|
|
29
|
-
export interface IRelationAgent {
|
|
30
|
-
createDefaultContactRelationEntityAsync(): Promise< carriers.ContactRelationEntity >;
|
|
31
|
-
getContactRelationEntityAsync(contactRelationEntityId: number) : Promise< carriers.ContactRelationEntity >;
|
|
32
|
-
saveContactRelationAsync(request: carriers.Relation_SaveContactRelationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactRelationEntity >;
|
|
33
|
-
saveContactRelationAsync(contactRelationEntity: carriers.ContactRelationEntity, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactRelationEntity >;
|
|
34
|
-
deleteContactRelationAsync(request: carriers.Relation_DeleteContactRelationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
35
|
-
deleteContactRelationAsync(contactRelationEntityId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
36
|
-
} // interface IRelationAgent
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Contact/Person relations
|
|
43
|
-
*/
|
|
44
|
-
export class RelationAgent extends base.WebApiBase implements IRelationAgent {
|
|
45
|
-
constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
|
|
46
|
-
constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
|
|
47
|
-
constructor(baseUrl: string, resourceManager:any);
|
|
48
|
-
constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
|
|
49
|
-
constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
|
|
50
|
-
constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
|
|
51
|
-
constructor(options: base.WebApiOptions);
|
|
52
|
-
|
|
53
|
-
constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
|
|
54
|
-
langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
|
|
55
|
-
langOrResourceOrRM?:string|base.ResourceParsing|any,
|
|
56
|
-
cultureCode?: string,
|
|
57
|
-
) {
|
|
58
|
-
const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
|
|
59
|
-
options.basePath = "v1/Agents/Relation/";
|
|
60
|
-
super(options);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Set default values into a new ContactRelationEntity.
|
|
67
|
-
* NetServer calculates default values on the entity, which is required when creating/storing a new instance
|
|
68
|
-
* @param options - Override language/culture codes on this request. Provide cancellation and request status values.
|
|
69
|
-
* @returns A blank entity.
|
|
70
|
-
*/
|
|
71
|
-
public async createDefaultContactRelationEntityAsync(options?:base.WebApiRequestOptions) : Promise< carriers.ContactRelationEntity > {
|
|
72
|
-
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
73
|
-
base.WebApiBase.SetPending(options);
|
|
74
|
-
return new Promise< carriers.ContactRelationEntity >(async (resolve, reject) => {
|
|
75
|
-
try {
|
|
76
|
-
const response = await this._axios.post("CreateDefaultContactRelationEntity", null, config);
|
|
77
|
-
base.WebApiBase.SetCompleted(options, response);
|
|
78
|
-
const res : carriers.ContactRelationEntity = converters.Create_ContactRelationEntity_From( response.data );
|
|
79
|
-
resolve(res);
|
|
80
|
-
}
|
|
81
|
-
catch( err ) {
|
|
82
|
-
base.WebApiBase.HandleError(options, config, err);
|
|
83
|
-
reject(err);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Gets a ContactRelationEntity object.
|
|
89
|
-
* @param contactRelationEntityId - The primary key.
|
|
90
|
-
* @param options - Override language/culture codes on this request. Provide cancellation and request status values.
|
|
91
|
-
* @returns A single ContactRelationEntity
|
|
92
|
-
*/
|
|
93
|
-
public async getContactRelationEntityAsync(contactRelationEntityId: number, options?:base.WebApiRequestOptions) : Promise< carriers.ContactRelationEntity > {
|
|
94
|
-
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
95
|
-
base.WebApiBase.SetPending(options);
|
|
96
|
-
return new Promise< carriers.ContactRelationEntity >(async (resolve, reject) => {
|
|
97
|
-
try {
|
|
98
|
-
const response = await this._axios.post("GetContactRelationEntity?contactRelationEntityId=" + contactRelationEntityId, null, config);
|
|
99
|
-
base.WebApiBase.SetCompleted(options, response);
|
|
100
|
-
const res = converters.Create_ContactRelationEntity_From( response.data );
|
|
101
|
-
resolve(res);
|
|
102
|
-
}
|
|
103
|
-
catch( err ) {
|
|
104
|
-
base.WebApiBase.HandleError(options, config, err);
|
|
105
|
-
reject(err);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
private async _saveContactRelationAsync(request: carriers.Relation_SaveContactRelationRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ContactRelationEntity > {
|
|
112
|
-
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
113
|
-
base.WebApiBase.SetPending(options);
|
|
114
|
-
return new Promise< carriers.ContactRelationEntity >(async (resolve, reject) => {
|
|
115
|
-
try {
|
|
116
|
-
config.baseURL = this._options.baseUrl;
|
|
117
|
-
const response = await this._axios.post("SaveContactRelation", request , config);
|
|
118
|
-
base.WebApiBase.SetCompleted(options, response);
|
|
119
|
-
const res : carriers.ContactRelationEntity = converters.Create_ContactRelationEntity_From( response.data );
|
|
120
|
-
resolve(res);
|
|
121
|
-
}
|
|
122
|
-
catch( err ) {
|
|
123
|
-
base.WebApiBase.HandleError(options, config, err);
|
|
124
|
-
reject(err);
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Creates a new or updates an existing contact relation.
|
|
133
|
-
* @param request - ContactRelationEntity
|
|
134
|
-
* @returns Saved relation
|
|
135
|
-
*/
|
|
136
|
-
public async saveContactRelationAsync(request: carriers.Relation_SaveContactRelationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactRelationEntity >;
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Creates a new or updates an existing contact relation.
|
|
140
|
-
* @param contactRelationEntity - Relation to save
|
|
141
|
-
* @returns Saved relation
|
|
142
|
-
*/
|
|
143
|
-
public async saveContactRelationAsync(contactRelationEntity: carriers.ContactRelationEntity, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactRelationEntity >;
|
|
144
|
-
|
|
145
|
-
public async saveContactRelationAsync(contactRelationEntity:carriers.ContactRelationEntity|carriers.Relation_SaveContactRelationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactRelationEntity > {
|
|
146
|
-
let _request : carriers.Relation_SaveContactRelationRequest = null;
|
|
147
|
-
let _options : base.WebApiRequestOptions = null;
|
|
148
|
-
const first : any = contactRelationEntity;
|
|
149
|
-
if( typeof( first ) === "object" && first && ( typeof(first.contactRelationEntity)!='undefined' ) )
|
|
150
|
-
{
|
|
151
|
-
_request = contactRelationEntity as carriers.Relation_SaveContactRelationRequest;
|
|
152
|
-
_options = webapi_options as base.WebApiRequestOptions;
|
|
153
|
-
}
|
|
154
|
-
else
|
|
155
|
-
{
|
|
156
|
-
_request = {
|
|
157
|
-
contactRelationEntity: contactRelationEntity as carriers.ContactRelationEntity,
|
|
158
|
-
};
|
|
159
|
-
_options = webapi_options;
|
|
160
|
-
}
|
|
161
|
-
return this._saveContactRelationAsync( _request, _options );
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
private async _deleteContactRelationAsync(request: carriers.Relation_DeleteContactRelationRequest, options?:base.WebApiRequestOptions) : Promise< void > {
|
|
166
|
-
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
167
|
-
base.WebApiBase.SetPending(options);
|
|
168
|
-
return new Promise< void >(async (resolve, reject) => {
|
|
169
|
-
try {
|
|
170
|
-
config.baseURL = this._options.baseUrl;
|
|
171
|
-
const response = await this._axios.post("DeleteContactRelation", request , config);
|
|
172
|
-
base.WebApiBase.SetCompleted(options, response);
|
|
173
|
-
const res = response.data;
|
|
174
|
-
resolve(res);
|
|
175
|
-
}
|
|
176
|
-
catch( err ) {
|
|
177
|
-
base.WebApiBase.HandleError(options, config, err);
|
|
178
|
-
reject(err);
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Deletes the spesified contact relation.
|
|
187
|
-
* @param request - ContactRelationEntityId
|
|
188
|
-
* @returns
|
|
189
|
-
*/
|
|
190
|
-
public async deleteContactRelationAsync(request: carriers.Relation_DeleteContactRelationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Deletes the spesified contact relation.
|
|
194
|
-
* @param contactRelationEntityId - Relation to delete
|
|
195
|
-
* @returns
|
|
196
|
-
*/
|
|
197
|
-
public async deleteContactRelationAsync(contactRelationEntityId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
198
|
-
|
|
199
|
-
public async deleteContactRelationAsync(contactRelationEntityId:number|carriers.Relation_DeleteContactRelationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
|
|
200
|
-
let _request : carriers.Relation_DeleteContactRelationRequest = null;
|
|
201
|
-
let _options : base.WebApiRequestOptions = null;
|
|
202
|
-
const first : any = contactRelationEntityId;
|
|
203
|
-
if( typeof( first ) === "object" && first && ( typeof(first.contactRelationEntityId)!='undefined' ) )
|
|
204
|
-
{
|
|
205
|
-
_request = contactRelationEntityId as carriers.Relation_DeleteContactRelationRequest;
|
|
206
|
-
_options = webapi_options as base.WebApiRequestOptions;
|
|
207
|
-
}
|
|
208
|
-
else
|
|
209
|
-
{
|
|
210
|
-
_request = {
|
|
211
|
-
contactRelationEntityId: contactRelationEntityId as number,
|
|
212
|
-
};
|
|
213
|
-
_options = webapi_options;
|
|
214
|
-
}
|
|
215
|
-
return this._deleteContactRelationAsync( _request, _options );
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
} // class v1RelationAgentController
|
|
219
|
-
|
|
220
|
-
|
|
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/RelationAgent.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/Person relations
|
|
28
|
+
*/
|
|
29
|
+
export interface IRelationAgent {
|
|
30
|
+
createDefaultContactRelationEntityAsync(): Promise< carriers.ContactRelationEntity >;
|
|
31
|
+
getContactRelationEntityAsync(contactRelationEntityId: number) : Promise< carriers.ContactRelationEntity >;
|
|
32
|
+
saveContactRelationAsync(request: carriers.Relation_SaveContactRelationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactRelationEntity >;
|
|
33
|
+
saveContactRelationAsync(contactRelationEntity: carriers.ContactRelationEntity, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactRelationEntity >;
|
|
34
|
+
deleteContactRelationAsync(request: carriers.Relation_DeleteContactRelationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
35
|
+
deleteContactRelationAsync(contactRelationEntityId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
36
|
+
} // interface IRelationAgent
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Contact/Person relations
|
|
43
|
+
*/
|
|
44
|
+
export class RelationAgent extends base.WebApiBase implements IRelationAgent {
|
|
45
|
+
constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
|
|
46
|
+
constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
|
|
47
|
+
constructor(baseUrl: string, resourceManager:any);
|
|
48
|
+
constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
|
|
49
|
+
constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
|
|
50
|
+
constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
|
|
51
|
+
constructor(options: base.WebApiOptions);
|
|
52
|
+
|
|
53
|
+
constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
|
|
54
|
+
langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
|
|
55
|
+
langOrResourceOrRM?:string|base.ResourceParsing|any,
|
|
56
|
+
cultureCode?: string,
|
|
57
|
+
) {
|
|
58
|
+
const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
|
|
59
|
+
options.basePath = "v1/Agents/Relation/";
|
|
60
|
+
super(options);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Set default values into a new ContactRelationEntity.
|
|
67
|
+
* NetServer calculates default values on the entity, which is required when creating/storing a new instance
|
|
68
|
+
* @param options - Override language/culture codes on this request. Provide cancellation and request status values.
|
|
69
|
+
* @returns A blank entity.
|
|
70
|
+
*/
|
|
71
|
+
public async createDefaultContactRelationEntityAsync(options?:base.WebApiRequestOptions) : Promise< carriers.ContactRelationEntity > {
|
|
72
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
73
|
+
base.WebApiBase.SetPending(options);
|
|
74
|
+
return new Promise< carriers.ContactRelationEntity >(async (resolve, reject) => {
|
|
75
|
+
try {
|
|
76
|
+
const response = await this._axios.post("CreateDefaultContactRelationEntity", null, config);
|
|
77
|
+
base.WebApiBase.SetCompleted(options, response);
|
|
78
|
+
const res : carriers.ContactRelationEntity = converters.Create_ContactRelationEntity_From( response.data );
|
|
79
|
+
resolve(res);
|
|
80
|
+
}
|
|
81
|
+
catch( err ) {
|
|
82
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
83
|
+
reject(err);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Gets a ContactRelationEntity object.
|
|
89
|
+
* @param contactRelationEntityId - The primary key.
|
|
90
|
+
* @param options - Override language/culture codes on this request. Provide cancellation and request status values.
|
|
91
|
+
* @returns A single ContactRelationEntity
|
|
92
|
+
*/
|
|
93
|
+
public async getContactRelationEntityAsync(contactRelationEntityId: number, options?:base.WebApiRequestOptions) : Promise< carriers.ContactRelationEntity > {
|
|
94
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
95
|
+
base.WebApiBase.SetPending(options);
|
|
96
|
+
return new Promise< carriers.ContactRelationEntity >(async (resolve, reject) => {
|
|
97
|
+
try {
|
|
98
|
+
const response = await this._axios.post("GetContactRelationEntity?contactRelationEntityId=" + contactRelationEntityId, null, config);
|
|
99
|
+
base.WebApiBase.SetCompleted(options, response);
|
|
100
|
+
const res = converters.Create_ContactRelationEntity_From( response.data );
|
|
101
|
+
resolve(res);
|
|
102
|
+
}
|
|
103
|
+
catch( err ) {
|
|
104
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
105
|
+
reject(err);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
private async _saveContactRelationAsync(request: carriers.Relation_SaveContactRelationRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ContactRelationEntity > {
|
|
112
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
113
|
+
base.WebApiBase.SetPending(options);
|
|
114
|
+
return new Promise< carriers.ContactRelationEntity >(async (resolve, reject) => {
|
|
115
|
+
try {
|
|
116
|
+
config.baseURL = this._options.baseUrl;
|
|
117
|
+
const response = await this._axios.post("SaveContactRelation", request , config);
|
|
118
|
+
base.WebApiBase.SetCompleted(options, response);
|
|
119
|
+
const res : carriers.ContactRelationEntity = converters.Create_ContactRelationEntity_From( response.data );
|
|
120
|
+
resolve(res);
|
|
121
|
+
}
|
|
122
|
+
catch( err ) {
|
|
123
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
124
|
+
reject(err);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Creates a new or updates an existing contact relation.
|
|
133
|
+
* @param request - ContactRelationEntity
|
|
134
|
+
* @returns Saved relation
|
|
135
|
+
*/
|
|
136
|
+
public async saveContactRelationAsync(request: carriers.Relation_SaveContactRelationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactRelationEntity >;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Creates a new or updates an existing contact relation.
|
|
140
|
+
* @param contactRelationEntity - Relation to save
|
|
141
|
+
* @returns Saved relation
|
|
142
|
+
*/
|
|
143
|
+
public async saveContactRelationAsync(contactRelationEntity: carriers.ContactRelationEntity, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactRelationEntity >;
|
|
144
|
+
|
|
145
|
+
public async saveContactRelationAsync(contactRelationEntity:carriers.ContactRelationEntity|carriers.Relation_SaveContactRelationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ContactRelationEntity > {
|
|
146
|
+
let _request : carriers.Relation_SaveContactRelationRequest = null;
|
|
147
|
+
let _options : base.WebApiRequestOptions = null;
|
|
148
|
+
const first : any = contactRelationEntity;
|
|
149
|
+
if( typeof( first ) === "object" && first && ( typeof(first.contactRelationEntity)!='undefined' ) )
|
|
150
|
+
{
|
|
151
|
+
_request = contactRelationEntity as carriers.Relation_SaveContactRelationRequest;
|
|
152
|
+
_options = webapi_options as base.WebApiRequestOptions;
|
|
153
|
+
}
|
|
154
|
+
else
|
|
155
|
+
{
|
|
156
|
+
_request = {
|
|
157
|
+
contactRelationEntity: contactRelationEntity as carriers.ContactRelationEntity,
|
|
158
|
+
};
|
|
159
|
+
_options = webapi_options;
|
|
160
|
+
}
|
|
161
|
+
return this._saveContactRelationAsync( _request, _options );
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
private async _deleteContactRelationAsync(request: carriers.Relation_DeleteContactRelationRequest, options?:base.WebApiRequestOptions) : Promise< void > {
|
|
166
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
167
|
+
base.WebApiBase.SetPending(options);
|
|
168
|
+
return new Promise< void >(async (resolve, reject) => {
|
|
169
|
+
try {
|
|
170
|
+
config.baseURL = this._options.baseUrl;
|
|
171
|
+
const response = await this._axios.post("DeleteContactRelation", request , config);
|
|
172
|
+
base.WebApiBase.SetCompleted(options, response);
|
|
173
|
+
const res = response.data;
|
|
174
|
+
resolve(res);
|
|
175
|
+
}
|
|
176
|
+
catch( err ) {
|
|
177
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
178
|
+
reject(err);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Deletes the spesified contact relation.
|
|
187
|
+
* @param request - ContactRelationEntityId
|
|
188
|
+
* @returns
|
|
189
|
+
*/
|
|
190
|
+
public async deleteContactRelationAsync(request: carriers.Relation_DeleteContactRelationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Deletes the spesified contact relation.
|
|
194
|
+
* @param contactRelationEntityId - Relation to delete
|
|
195
|
+
* @returns
|
|
196
|
+
*/
|
|
197
|
+
public async deleteContactRelationAsync(contactRelationEntityId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
198
|
+
|
|
199
|
+
public async deleteContactRelationAsync(contactRelationEntityId:number|carriers.Relation_DeleteContactRelationRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
|
|
200
|
+
let _request : carriers.Relation_DeleteContactRelationRequest = null;
|
|
201
|
+
let _options : base.WebApiRequestOptions = null;
|
|
202
|
+
const first : any = contactRelationEntityId;
|
|
203
|
+
if( typeof( first ) === "object" && first && ( typeof(first.contactRelationEntityId)!='undefined' ) )
|
|
204
|
+
{
|
|
205
|
+
_request = contactRelationEntityId as carriers.Relation_DeleteContactRelationRequest;
|
|
206
|
+
_options = webapi_options as base.WebApiRequestOptions;
|
|
207
|
+
}
|
|
208
|
+
else
|
|
209
|
+
{
|
|
210
|
+
_request = {
|
|
211
|
+
contactRelationEntityId: contactRelationEntityId as number,
|
|
212
|
+
};
|
|
213
|
+
_options = webapi_options;
|
|
214
|
+
}
|
|
215
|
+
return this._deleteContactRelationAsync( _request, _options );
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
} // class v1RelationAgentController
|
|
219
|
+
|
|
220
|
+
|