@superoffice/webapi 11.12.675 → 11.13.921

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 (87) hide show
  1. package/dist/cjs/AIAgent.d.ts +19 -0
  2. package/dist/cjs/AIAgent.d.ts.map +1 -1
  3. package/dist/cjs/AIAgent.js +37 -0
  4. package/dist/cjs/AIAgent.js.map +1 -1
  5. package/dist/cjs/Carriers.d.ts +196 -3
  6. package/dist/cjs/Carriers.d.ts.map +1 -1
  7. package/dist/cjs/ContactAgent.d.ts +17 -0
  8. package/dist/cjs/ContactAgent.d.ts.map +1 -1
  9. package/dist/cjs/ContactAgent.js +35 -0
  10. package/dist/cjs/ContactAgent.js.map +1 -1
  11. package/dist/cjs/Converters.d.ts +9 -0
  12. package/dist/cjs/Converters.d.ts.map +1 -1
  13. package/dist/cjs/Converters.js +109 -17
  14. package/dist/cjs/Converters.js.map +1 -1
  15. package/dist/cjs/DiagnosticsAgent.d.ts +15 -0
  16. package/dist/cjs/DiagnosticsAgent.d.ts.map +1 -1
  17. package/dist/cjs/DiagnosticsAgent.js +33 -0
  18. package/dist/cjs/DiagnosticsAgent.js.map +1 -1
  19. package/dist/cjs/Enums.d.ts +4 -0
  20. package/dist/cjs/Enums.d.ts.map +1 -1
  21. package/dist/cjs/Enums.js +4 -0
  22. package/dist/cjs/Enums.js.map +1 -1
  23. package/dist/cjs/PersonAgent.d.ts +17 -0
  24. package/dist/cjs/PersonAgent.d.ts.map +1 -1
  25. package/dist/cjs/PersonAgent.js +35 -0
  26. package/dist/cjs/PersonAgent.js.map +1 -1
  27. package/dist/cjs/PreferenceAgent.d.ts +22 -0
  28. package/dist/cjs/PreferenceAgent.d.ts.map +1 -1
  29. package/dist/cjs/PreferenceAgent.js +57 -0
  30. package/dist/cjs/PreferenceAgent.js.map +1 -1
  31. package/dist/cjs/TicketAgent.d.ts +31 -0
  32. package/dist/cjs/TicketAgent.d.ts.map +1 -1
  33. package/dist/cjs/TicketAgent.js +67 -0
  34. package/dist/cjs/TicketAgent.js.map +1 -1
  35. package/dist/cjs/UserAgent.d.ts +19 -0
  36. package/dist/cjs/UserAgent.d.ts.map +1 -1
  37. package/dist/cjs/UserAgent.js +37 -0
  38. package/dist/cjs/UserAgent.js.map +1 -1
  39. package/dist/esm/AIAgent.d.ts +19 -0
  40. package/dist/esm/AIAgent.d.ts.map +1 -1
  41. package/dist/esm/AIAgent.js +37 -0
  42. package/dist/esm/AIAgent.js.map +1 -1
  43. package/dist/esm/Carriers.d.ts +196 -3
  44. package/dist/esm/Carriers.d.ts.map +1 -1
  45. package/dist/esm/ContactAgent.d.ts +17 -0
  46. package/dist/esm/ContactAgent.d.ts.map +1 -1
  47. package/dist/esm/ContactAgent.js +35 -0
  48. package/dist/esm/ContactAgent.js.map +1 -1
  49. package/dist/esm/Converters.d.ts +9 -0
  50. package/dist/esm/Converters.d.ts.map +1 -1
  51. package/dist/esm/Converters.js +83 -0
  52. package/dist/esm/Converters.js.map +1 -1
  53. package/dist/esm/DiagnosticsAgent.d.ts +15 -0
  54. package/dist/esm/DiagnosticsAgent.d.ts.map +1 -1
  55. package/dist/esm/DiagnosticsAgent.js +33 -0
  56. package/dist/esm/DiagnosticsAgent.js.map +1 -1
  57. package/dist/esm/Enums.d.ts +4 -0
  58. package/dist/esm/Enums.d.ts.map +1 -1
  59. package/dist/esm/Enums.js +4 -0
  60. package/dist/esm/Enums.js.map +1 -1
  61. package/dist/esm/PersonAgent.d.ts +17 -0
  62. package/dist/esm/PersonAgent.d.ts.map +1 -1
  63. package/dist/esm/PersonAgent.js +35 -0
  64. package/dist/esm/PersonAgent.js.map +1 -1
  65. package/dist/esm/PreferenceAgent.d.ts +22 -0
  66. package/dist/esm/PreferenceAgent.d.ts.map +1 -1
  67. package/dist/esm/PreferenceAgent.js +57 -0
  68. package/dist/esm/PreferenceAgent.js.map +1 -1
  69. package/dist/esm/TicketAgent.d.ts +31 -0
  70. package/dist/esm/TicketAgent.d.ts.map +1 -1
  71. package/dist/esm/TicketAgent.js +67 -0
  72. package/dist/esm/TicketAgent.js.map +1 -1
  73. package/dist/esm/UserAgent.d.ts +19 -0
  74. package/dist/esm/UserAgent.d.ts.map +1 -1
  75. package/dist/esm/UserAgent.js +37 -0
  76. package/dist/esm/UserAgent.js.map +1 -1
  77. package/package.json +4 -4
  78. package/src/AIAgent.ts +64 -0
  79. package/src/Carriers.ts +262 -3
  80. package/src/ContactAgent.ts +60 -0
  81. package/src/Converters.ts +105 -0
  82. package/src/DiagnosticsAgent.ts +56 -0
  83. package/src/Enums.ts +4 -0
  84. package/src/PersonAgent.ts +60 -0
  85. package/src/PreferenceAgent.ts +86 -0
  86. package/src/TicketAgent.ts +114 -0
  87. package/src/UserAgent.ts +64 -0
@@ -119,6 +119,8 @@ export interface IPersonAgent {
119
119
  getUtmParametersAsync(personId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.UtmParameters >;
120
120
  setUtmCreatedPersonContactForFormSubmissionAsync(request: carriers.Person_SetUtmCreatedPersonContactForFormSubmissionRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
121
121
  setUtmCreatedPersonContactForFormSubmissionAsync(formSubmissionId: number, personId: number, contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
122
+ updateInterestsAsync(request: carriers.Person_UpdateInterestsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
123
+ updateInterestsAsync(personId: number, enableInterestIds: number[], disableInterestIds: number[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
122
124
  getPersonListAsync(personIds: number[]) : Promise< carriers.Person[] >;
123
125
  getPersonsFromContactAsync(request: carriers.Person_GetPersonsFromContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Person[] >;
124
126
  getPersonsFromContactAsync(contactId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Person[] >;
@@ -2763,6 +2765,64 @@ export class PersonAgent extends base.WebApiBase implements IPersonAgent {
2763
2765
  return this._setUtmCreatedPersonContactForFormSubmissionAsync( _request, _options );
2764
2766
  }
2765
2767
 
2768
+
2769
+ private async _updateInterestsAsync(request: carriers.Person_UpdateInterestsRequest, options?:base.WebApiRequestOptions) : Promise< void > {
2770
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
2771
+ base.WebApiBase.SetPending(options);
2772
+ return new Promise< void >(async (resolve, reject) => {
2773
+ try {
2774
+ config.baseURL = this._options.baseUrl;
2775
+ const response = await this._axios.post("UpdateInterests", request , config);
2776
+ base.WebApiBase.SetCompleted(options, response);
2777
+ const res = response.data;
2778
+ resolve(res);
2779
+ }
2780
+ catch( err ) {
2781
+ base.WebApiBase.HandleError(options, config, err);
2782
+ reject(err);
2783
+ }
2784
+ });
2785
+ }
2786
+
2787
+
2788
+
2789
+ /**
2790
+ * Update interests on person. Will throw exception if id is in both arrays
2791
+ * @param request - PersonId, EnableInterestIds, DisableInterestIds
2792
+ * @returns This method has no return value
2793
+ */
2794
+ public async updateInterestsAsync(request: carriers.Person_UpdateInterestsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
2795
+
2796
+ /**
2797
+ * Update interests on person. Will throw exception if id is in both arrays
2798
+ * @param personId - Person id to update interests for
2799
+ * @param enableInterestIds - The interest ids to set on the person. This will set these interests to true and not touch any other interests.
2800
+ * @param disableInterestIds - The interest ids to diable on the person. This will set these interests to false and not touch any other interests.
2801
+ * @returns This method has no return value
2802
+ */
2803
+ public async updateInterestsAsync(personId: number, enableInterestIds: number[], disableInterestIds: number[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
2804
+
2805
+ public async updateInterestsAsync(personId:number|carriers.Person_UpdateInterestsRequest, enableInterestIds?:number[]|base.WebApiRequestOptions, disableInterestIds?:number[], webapi_options?:base.WebApiRequestOptions) : Promise< void > {
2806
+ let _request : carriers.Person_UpdateInterestsRequest = null;
2807
+ let _options : base.WebApiRequestOptions = null;
2808
+ const first : any = personId;
2809
+ if( typeof( first ) === "object" && first && ( typeof(first.personId)!='undefined' || typeof(first.enableInterestIds)!='undefined' || typeof(first.disableInterestIds)!='undefined' ) )
2810
+ {
2811
+ _request = personId as carriers.Person_UpdateInterestsRequest;
2812
+ _options = enableInterestIds as base.WebApiRequestOptions;
2813
+ }
2814
+ else
2815
+ {
2816
+ _request = {
2817
+ personId: personId as number,
2818
+ enableInterestIds: enableInterestIds as number[],
2819
+ disableInterestIds: disableInterestIds as number[],
2820
+ };
2821
+ _options = webapi_options;
2822
+ }
2823
+ return this._updateInterestsAsync( _request, _options );
2824
+ }
2825
+
2766
2826
  /**
2767
2827
  * Gets an array of Person objects.
2768
2828
  * @param personIds - The primary keys.
@@ -59,6 +59,9 @@ export interface IPreferenceAgent {
59
59
  getXsrfPathsAsync(hostname: string, webapi_options?:base.WebApiRequestOptions) : Promise< string[] >;
60
60
  setXsrfPathsAsync(request: carriers.Preference_SetXsrfPathsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
61
61
  setXsrfPathsAsync(hostname: string, paths: string[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
62
+ getXsrfValueAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.XsrfValue >;
63
+ setXsrfValueAsync(request: carriers.Preference_SetXsrfValueRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
64
+ setXsrfValueAsync(xsrfValue: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
62
65
  getPreferenceDescriptionAsync(preferenceDescriptionId: number) : Promise< carriers.PreferenceDescription >;
63
66
  getFromSectionAndKeyAsync(request: carriers.Preference_GetFromSectionAndKeyRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreferenceDescription >;
64
67
  getFromSectionAndKeyAsync(section: string, key: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.PreferenceDescription >;
@@ -969,6 +972,89 @@ export class PreferenceAgent extends base.WebApiBase implements IPreferenceAgent
969
972
  return this._setXsrfPathsAsync( _request, _options );
970
973
  }
971
974
 
975
+
976
+ private async _getXsrfValueAsync( options?:base.WebApiRequestOptions) : Promise< carriers.XsrfValue > {
977
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
978
+ base.WebApiBase.SetPending(options);
979
+ return new Promise< carriers.XsrfValue >(async (resolve, reject) => {
980
+ try {
981
+ config.baseURL = this._options.baseUrl;
982
+ const response = await this._axios.post("GetXsrfValue", undefined , config);
983
+ base.WebApiBase.SetCompleted(options, response);
984
+ const res : carriers.XsrfValue = converters.Create_XsrfValue_From( response.data );
985
+ resolve(res);
986
+ }
987
+ catch( err ) {
988
+ base.WebApiBase.HandleError(options, config, err);
989
+ reject(err);
990
+ }
991
+ });
992
+ }
993
+
994
+
995
+ /**
996
+ * Returns the XSRF token value and last update time for the current user
997
+ * @returns The XSRF token value and timestamp
998
+ */
999
+ public async getXsrfValueAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.XsrfValue >
1000
+ {
1001
+ return this._getXsrfValueAsync(webapi_options);
1002
+ }
1003
+
1004
+
1005
+ private async _setXsrfValueAsync(request: carriers.Preference_SetXsrfValueRequest, options?:base.WebApiRequestOptions) : Promise< void > {
1006
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1007
+ base.WebApiBase.SetPending(options);
1008
+ return new Promise< void >(async (resolve, reject) => {
1009
+ try {
1010
+ config.baseURL = this._options.baseUrl;
1011
+ const response = await this._axios.post("SetXsrfValue", request , config);
1012
+ base.WebApiBase.SetCompleted(options, response);
1013
+ const res = response.data;
1014
+ resolve(res);
1015
+ }
1016
+ catch( err ) {
1017
+ base.WebApiBase.HandleError(options, config, err);
1018
+ reject(err);
1019
+ }
1020
+ });
1021
+ }
1022
+
1023
+
1024
+
1025
+ /**
1026
+ * Sets the XSRF token value for the current user
1027
+ * @param request - XsrfValue
1028
+ * @returns This method has no return value
1029
+ */
1030
+ public async setXsrfValueAsync(request: carriers.Preference_SetXsrfValueRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1031
+
1032
+ /**
1033
+ * Sets the XSRF token value for the current user
1034
+ * @param xsrfValue - The XSRF value to store
1035
+ * @returns This method has no return value
1036
+ */
1037
+ public async setXsrfValueAsync(xsrfValue: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1038
+
1039
+ public async setXsrfValueAsync(xsrfValue:string|carriers.Preference_SetXsrfValueRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
1040
+ let _request : carriers.Preference_SetXsrfValueRequest = null;
1041
+ let _options : base.WebApiRequestOptions = null;
1042
+ const first : any = xsrfValue;
1043
+ if( typeof( first ) === "object" && first && ( typeof(first.xsrfValue)!='undefined' ) )
1044
+ {
1045
+ _request = xsrfValue as carriers.Preference_SetXsrfValueRequest;
1046
+ _options = webapi_options as base.WebApiRequestOptions;
1047
+ }
1048
+ else
1049
+ {
1050
+ _request = {
1051
+ xsrfValue: xsrfValue as string,
1052
+ };
1053
+ _options = webapi_options;
1054
+ }
1055
+ return this._setXsrfValueAsync( _request, _options );
1056
+ }
1057
+
972
1058
  /**
973
1059
  * Gets a PreferenceDescription object.
974
1060
  * @param preferenceDescriptionId - The primary key.
@@ -102,6 +102,10 @@ export interface ITicketAgent {
102
102
  getHotlistEjUsersAsync(ticketId: number, skipAssociateIds: number[], notifyType: enums.NotifyType, channel: enums.NotifyChannel, webapi_options?:base.WebApiRequestOptions) : Promise< number[] >;
103
103
  acceptTicketsAsync(request: carriers.Ticket_AcceptTicketsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
104
104
  acceptTicketsAsync(ticketIds: number[], webapi_options?:base.WebApiRequestOptions) : Promise< void >;
105
+ setSpamStatusByIdsAsync(request: carriers.Ticket_SetSpamStatusByIdsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number[] >;
106
+ setSpamStatusByIdsAsync(ticketIds: number[], webapi_options?:base.WebApiRequestOptions) : Promise< number[] >;
107
+ setSpamStatusByProviderAsync(request: carriers.Ticket_SetSpamStatusByProviderRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number[] >;
108
+ setSpamStatusByProviderAsync(providerName: string, restrictions: carriers.ArchiveRestrictionInfo[], webapi_options?:base.WebApiRequestOptions) : Promise< number[] >;
105
109
  getTicketMessageAsync(ticketMessageId: number) : Promise< carriers.TicketMessage >;
106
110
  getTicketMessageEntityAsync(ticketMessageEntityId: number) : Promise< carriers.TicketMessageEntity >;
107
111
  deleteTicketMessageEntityAsync(request: carriers.Ticket_DeleteTicketMessageEntityRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
@@ -2230,6 +2234,116 @@ export class TicketAgent extends base.WebApiBase implements ITicketAgent {
2230
2234
  return this._acceptTicketsAsync( _request, _options );
2231
2235
  }
2232
2236
 
2237
+
2238
+ private async _setSpamStatusByIdsAsync(request: carriers.Ticket_SetSpamStatusByIdsRequest, options?:base.WebApiRequestOptions) : Promise< number[] > {
2239
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
2240
+ base.WebApiBase.SetPending(options);
2241
+ return new Promise< number[] >(async (resolve, reject) => {
2242
+ try {
2243
+ config.baseURL = this._options.baseUrl;
2244
+ const response = await this._axios.post("SetSpamStatusByIds", request , config);
2245
+ base.WebApiBase.SetCompleted(options, response);
2246
+ const res : number[] = response.data as number[];
2247
+ resolve(res);
2248
+ }
2249
+ catch( err ) {
2250
+ base.WebApiBase.HandleError(options, config, err);
2251
+ reject(err);
2252
+ }
2253
+ });
2254
+ }
2255
+
2256
+
2257
+
2258
+ /**
2259
+ * Sets tickets&apos; status to SPAM. After a grace period these tickets will be deleted by a background job.
2260
+ * @param request - TicketIds
2261
+ * @returns Ids of tickets set for SPAM.
2262
+ */
2263
+ public async setSpamStatusByIdsAsync(request: carriers.Ticket_SetSpamStatusByIdsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number[] >;
2264
+
2265
+ /**
2266
+ * Sets tickets&apos; status to SPAM. After a grace period these tickets will be deleted by a background job.
2267
+ * @param ticketIds - Ids of tickets to be set for SPAM.
2268
+ * @returns Ids of tickets set for SPAM.
2269
+ */
2270
+ public async setSpamStatusByIdsAsync(ticketIds: number[], webapi_options?:base.WebApiRequestOptions) : Promise< number[] >;
2271
+
2272
+ public async setSpamStatusByIdsAsync(ticketIds:number[]|carriers.Ticket_SetSpamStatusByIdsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number[] > {
2273
+ let _request : carriers.Ticket_SetSpamStatusByIdsRequest = null;
2274
+ let _options : base.WebApiRequestOptions = null;
2275
+ const first : any = ticketIds;
2276
+ if( typeof( first ) === "object" && first && ( typeof(first.ticketIds)!='undefined' ) )
2277
+ {
2278
+ _request = ticketIds as carriers.Ticket_SetSpamStatusByIdsRequest;
2279
+ _options = webapi_options as base.WebApiRequestOptions;
2280
+ }
2281
+ else
2282
+ {
2283
+ _request = {
2284
+ ticketIds: ticketIds as number[],
2285
+ };
2286
+ _options = webapi_options;
2287
+ }
2288
+ return this._setSpamStatusByIdsAsync( _request, _options );
2289
+ }
2290
+
2291
+
2292
+ private async _setSpamStatusByProviderAsync(request: carriers.Ticket_SetSpamStatusByProviderRequest, options?:base.WebApiRequestOptions) : Promise< number[] > {
2293
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
2294
+ base.WebApiBase.SetPending(options);
2295
+ return new Promise< number[] >(async (resolve, reject) => {
2296
+ try {
2297
+ config.baseURL = this._options.baseUrl;
2298
+ const response = await this._axios.post("SetSpamStatusByProvider", request , config);
2299
+ base.WebApiBase.SetCompleted(options, response);
2300
+ const res : number[] = response.data as number[];
2301
+ resolve(res);
2302
+ }
2303
+ catch( err ) {
2304
+ base.WebApiBase.HandleError(options, config, err);
2305
+ reject(err);
2306
+ }
2307
+ });
2308
+ }
2309
+
2310
+
2311
+
2312
+ /**
2313
+ * Sets tickets&apos; status to SPAM. After a grace period these tickets will be deleted by a background job.
2314
+ * @param request - ProviderName, Restrictions
2315
+ * @returns Ids of tickets set for deletion.
2316
+ */
2317
+ public async setSpamStatusByProviderAsync(request: carriers.Ticket_SetSpamStatusByProviderRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number[] >;
2318
+
2319
+ /**
2320
+ * Sets tickets&apos; status to SPAM. After a grace period these tickets will be deleted by a background job.
2321
+ * @param providerName - Name of the provider that returns ticket rows.
2322
+ * @param restrictions - Query restrictions to be added to provider. Fixed providers, such as LastTicketsProvider, FavouriteTicketsProvider etc. already have mandatory restrictions setup - in such case extra restrictions will be combined, however for general use case for fixed providers you can pass an empty array and provider will return default results. For selection providers generally you should pass selectionId as a restriction.
2323
+ * @returns Ids of tickets set for deletion.
2324
+ */
2325
+ public async setSpamStatusByProviderAsync(providerName: string, restrictions: carriers.ArchiveRestrictionInfo[], webapi_options?:base.WebApiRequestOptions) : Promise< number[] >;
2326
+
2327
+ public async setSpamStatusByProviderAsync(providerName:string|carriers.Ticket_SetSpamStatusByProviderRequest, restrictions?:carriers.ArchiveRestrictionInfo[]|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< number[] > {
2328
+ let _request : carriers.Ticket_SetSpamStatusByProviderRequest = null;
2329
+ let _options : base.WebApiRequestOptions = null;
2330
+ const first : any = providerName;
2331
+ if( typeof( first ) === "object" && first && ( typeof(first.providerName)!='undefined' || typeof(first.restrictions)!='undefined' ) )
2332
+ {
2333
+ _request = providerName as carriers.Ticket_SetSpamStatusByProviderRequest;
2334
+ _options = restrictions as base.WebApiRequestOptions;
2335
+ }
2336
+ else
2337
+ {
2338
+ _request = {
2339
+ providerName: providerName as string,
2340
+ restrictions: restrictions as carriers.ArchiveRestrictionInfo[],
2341
+ };
2342
+ _options = webapi_options;
2343
+ }
2344
+ return this._setSpamStatusByProviderAsync( _request, _options );
2345
+ }
2346
+
2233
2347
  /**
2234
2348
  * Gets a TicketMessage object.
2235
2349
  * @param ticketMessageId - The primary key.
package/src/UserAgent.ts CHANGED
@@ -44,6 +44,8 @@ export interface IUserAgent {
44
44
  registerWithAccessGatewayAsync(request: carriers.User_RegisterWithAccessGatewayRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.AccessGatewayInfo >;
45
45
  registerWithAccessGatewayAsync(redirectUri: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.AccessGatewayInfo >;
46
46
  checkAccessGatewayRegistrationAsync(webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
47
+ exchangeCodeAndSaveTokensAsync(request: carriers.User_ExchangeCodeAndSaveTokensRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
48
+ exchangeCodeAndSaveTokensAsync(provider: string, authorizationCode: string, nonce: string, pkceVerifier: string, redirectUri: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
47
49
  saveCredentialAsync(request: carriers.User_SaveCredentialRequest, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
48
50
  saveCredentialAsync(userId: number, credential: carriers.Credential, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
49
51
  deleteCredentialAsync(request: carriers.User_DeleteCredentialRequest, webapi_options?:base.WebApiRequestOptions) : Promise< boolean >;
@@ -638,6 +640,68 @@ export class UserAgent extends base.WebApiBase implements IUserAgent {
638
640
  }
639
641
 
640
642
 
643
+ private async _exchangeCodeAndSaveTokensAsync(request: carriers.User_ExchangeCodeAndSaveTokensRequest, options?:base.WebApiRequestOptions) : Promise< string > {
644
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
645
+ base.WebApiBase.SetPending(options);
646
+ return new Promise< string >(async (resolve, reject) => {
647
+ try {
648
+ config.baseURL = this._options.baseUrl;
649
+ const response = await this._axios.post("ExchangeCodeAndSaveTokens", request , config);
650
+ base.WebApiBase.SetCompleted(options, response);
651
+ const res : string = response.data as string;
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
+ * Exchanges an authorization code for tokens.
665
+ * @param request - Provider, AuthorizationCode, Nonce, PkceVerifier, RedirectUri
666
+ * @returns Reference to the key for the tokens in the database, and extracted claims.
667
+ */
668
+ public async exchangeCodeAndSaveTokensAsync(request: carriers.User_ExchangeCodeAndSaveTokensRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
669
+
670
+ /**
671
+ * Exchanges an authorization code for tokens.
672
+ * @param provider - The provider of the underlying data.
673
+ * @param authorizationCode - The authorization code to exchange for a token.
674
+ * @param nonce - The nonce to verify against the id_token's nonce if present.
675
+ * @param pkceVerifier - The cryptographic proof for the client to verify.
676
+ * @param redirectUri - We need to be able to dynamically inject the redirect based on location(app.superoffice.com vs online2.superoffice.com)
677
+ * @returns Reference to the key for the tokens in the database, and extracted claims.
678
+ */
679
+ public async exchangeCodeAndSaveTokensAsync(provider: string, authorizationCode: string, nonce: string, pkceVerifier: string, redirectUri: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
680
+
681
+ public async exchangeCodeAndSaveTokensAsync(provider:string|carriers.User_ExchangeCodeAndSaveTokensRequest, authorizationCode?:string|base.WebApiRequestOptions, nonce?:string, pkceVerifier?:string, redirectUri?:string, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
682
+ let _request : carriers.User_ExchangeCodeAndSaveTokensRequest = null;
683
+ let _options : base.WebApiRequestOptions = null;
684
+ const first : any = provider;
685
+ if( typeof( first ) === "object" && first && ( typeof(first.provider)!='undefined' || typeof(first.authorizationCode)!='undefined' || typeof(first.nonce)!='undefined' || typeof(first.pkceVerifier)!='undefined' || typeof(first.redirectUri)!='undefined' ) )
686
+ {
687
+ _request = provider as carriers.User_ExchangeCodeAndSaveTokensRequest;
688
+ _options = authorizationCode as base.WebApiRequestOptions;
689
+ }
690
+ else
691
+ {
692
+ _request = {
693
+ provider: provider as string,
694
+ authorizationCode: authorizationCode as string,
695
+ nonce: nonce as string,
696
+ pkceVerifier: pkceVerifier as string,
697
+ redirectUri: redirectUri as string,
698
+ };
699
+ _options = webapi_options;
700
+ }
701
+ return this._exchangeCodeAndSaveTokensAsync( _request, _options );
702
+ }
703
+
704
+
641
705
  private async _saveCredentialAsync(request: carriers.User_SaveCredentialRequest, options?:base.WebApiRequestOptions) : Promise< boolean > {
642
706
  const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
643
707
  base.WebApiBase.SetPending(options);