ultracart_rest_api_v2_typescript 4.0.34-RC → 4.0.35-RC

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 (41) hide show
  1. package/.openapi-generator/FILES +9 -0
  2. package/README.md +3 -2
  3. package/dist/apis/ConversationApi.d.ts +186 -0
  4. package/dist/apis/ConversationApi.js +433 -0
  5. package/dist/apis/OauthApi.js +2 -2
  6. package/dist/apis/index.d.ts +1 -0
  7. package/dist/apis/index.js +1 -0
  8. package/dist/models/Activity.d.ts +12 -0
  9. package/dist/models/Activity.js +4 -0
  10. package/dist/models/Conversation.d.ts +53 -0
  11. package/dist/models/Conversation.js +52 -0
  12. package/dist/models/ConversationAgentAuthResponse.d.ts +39 -0
  13. package/dist/models/ConversationAgentAuthResponse.js +46 -0
  14. package/dist/models/ConversationMessage.d.ts +51 -0
  15. package/dist/models/ConversationMessage.js +50 -0
  16. package/dist/models/ConversationParticipant.d.ts +63 -0
  17. package/dist/models/ConversationParticipant.js +54 -0
  18. package/dist/models/ConversationStartRequest.d.ts +33 -0
  19. package/dist/models/ConversationStartRequest.js +44 -0
  20. package/dist/models/ConversationStartResponse.d.ts +33 -0
  21. package/dist/models/ConversationStartResponse.js +44 -0
  22. package/dist/models/ConversationSummary.d.ts +75 -0
  23. package/dist/models/ConversationSummary.js +58 -0
  24. package/dist/models/ConversationsResponse.d.ts +55 -0
  25. package/dist/models/ConversationsResponse.js +54 -0
  26. package/dist/models/index.d.ts +8 -0
  27. package/dist/models/index.js +8 -0
  28. package/package.json +1 -1
  29. package/src/apis/ConversationApi.ts +416 -0
  30. package/src/apis/OauthApi.ts +2 -2
  31. package/src/apis/index.ts +1 -0
  32. package/src/models/Activity.ts +16 -0
  33. package/src/models/Conversation.ts +101 -0
  34. package/src/models/ConversationAgentAuthResponse.ts +72 -0
  35. package/src/models/ConversationMessage.ts +88 -0
  36. package/src/models/ConversationParticipant.ts +104 -0
  37. package/src/models/ConversationStartRequest.ts +64 -0
  38. package/src/models/ConversationStartResponse.ts +64 -0
  39. package/src/models/ConversationSummary.ts +120 -0
  40. package/src/models/ConversationsResponse.ts +113 -0
  41. package/src/models/index.ts +8 -0
@@ -7,6 +7,7 @@ src/apis/AutoOrderApi.ts
7
7
  src/apis/ChannelPartnerApi.ts
8
8
  src/apis/ChargebackApi.ts
9
9
  src/apis/CheckoutApi.ts
10
+ src/apis/ConversationApi.ts
10
11
  src/apis/CouponApi.ts
11
12
  src/apis/CustomerApi.ts
12
13
  src/apis/FulfillmentApi.ts
@@ -138,6 +139,14 @@ src/models/CheckoutSetupBrowserKeyRequest.ts
138
139
  src/models/CheckoutSetupBrowserKeyResponse.ts
139
140
  src/models/CheckoutStateProvinceResponse.ts
140
141
  src/models/CityStateZip.ts
142
+ src/models/Conversation.ts
143
+ src/models/ConversationAgentAuthResponse.ts
144
+ src/models/ConversationMessage.ts
145
+ src/models/ConversationParticipant.ts
146
+ src/models/ConversationStartRequest.ts
147
+ src/models/ConversationStartResponse.ts
148
+ src/models/ConversationSummary.ts
149
+ src/models/ConversationsResponse.ts
141
150
  src/models/CountriesResponse.ts
142
151
  src/models/Country.ts
143
152
  src/models/Coupon.ts
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ## ultracart_rest_api_v2_typescript@4.0.34-RC
1
+ ## ultracart_rest_api_v2_typescript@4.0.35-RC
2
2
 
3
3
  This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments:
4
4
 
@@ -36,7 +36,7 @@ navigate to the folder of your consuming project and run one of the following co
36
36
  _published:_
37
37
 
38
38
  ```
39
- npm install ultracart_rest_api_v2_typescript@4.0.34-RC --save
39
+ npm install ultracart_rest_api_v2_typescript@4.0.35-RC --save
40
40
  ```
41
41
 
42
42
  _unPublished (not recommended):_
@@ -54,6 +54,7 @@ Not every change is committed to every SDK.
54
54
 
55
55
  | Version | Date | Comments |
56
56
  | --: | :-: | --- |
57
+ | 4.0.35-RC | 07/14/2022 | Add channel storefront_oid to the customer activity record |
57
58
  | 4.0.34-RC | 07/11/2022 | Customer API - mergeCustomer method |
58
59
  | 4.0.33-RC | 07/05/2022 | docs update |
59
60
  | 4.0.32-RC | 06/24/2022 | removed unneeded consumes declarations on several api calls (yaml fix) |
@@ -0,0 +1,186 @@
1
+ /**
2
+ * UltraCart Rest API V2
3
+ * UltraCart REST API Version 2
4
+ *
5
+ * The version of the OpenAPI document: 2.0.0
6
+ * Contact: support@ultracart.com
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import * as runtime from '../runtime';
13
+ import { Conversation, ConversationAgentAuthResponse, ConversationStartRequest, ConversationStartResponse, ConversationsResponse } from '../models';
14
+ export interface GetConversationRequest {
15
+ conversationUuid: string;
16
+ }
17
+ export interface GetConversationsRequest {
18
+ limit?: number;
19
+ offset?: number;
20
+ }
21
+ export interface JoinConversationRequest {
22
+ conversationUuid: string;
23
+ }
24
+ export interface LeaveConversationRequest {
25
+ conversationUuid: string;
26
+ }
27
+ export interface StartConversationRequest {
28
+ startRequest: ConversationStartRequest;
29
+ }
30
+ /**
31
+ * ConversationApi - interface
32
+ *
33
+ * @export
34
+ * @interface ConversationApiInterface
35
+ */
36
+ export interface ConversationApiInterface {
37
+ /**
38
+ * Retrieve a JWT to authorize an agent to make a websocket connection.
39
+ * @summary Get agent websocket authorization
40
+ * @param {*} [options] Override http request option.
41
+ * @throws {RequiredError}
42
+ * @memberof ConversationApiInterface
43
+ */
44
+ getAgentWebsocketAuthorizationRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ConversationAgentAuthResponse>>;
45
+ /**
46
+ * Retrieve a JWT to authorize an agent to make a websocket connection.
47
+ * Get agent websocket authorization
48
+ */
49
+ getAgentWebsocketAuthorization(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ConversationAgentAuthResponse>;
50
+ /**
51
+ * Retrieve a conversation including the participants and messages
52
+ * @summary Retrieve a conversation
53
+ * @param {string} conversationUuid
54
+ * @param {*} [options] Override http request option.
55
+ * @throws {RequiredError}
56
+ * @memberof ConversationApiInterface
57
+ */
58
+ getConversationRaw(requestParameters: GetConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Conversation>>;
59
+ /**
60
+ * Retrieve a conversation including the participants and messages
61
+ * Retrieve a conversation
62
+ */
63
+ getConversation(requestParameters: GetConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Conversation>;
64
+ /**
65
+ * Retrieve a list of conversation summaries that are ordered newest to oldest, include the most recent message and whether its been read.
66
+ * @summary Retrieve a list of conversation summaries newest to oldest
67
+ * @param {number} [limit] The maximum number of records to return on this one API call. (Max 200)
68
+ * @param {number} [offset] Pagination of the record set. Offset is a zero based index.
69
+ * @param {*} [options] Override http request option.
70
+ * @throws {RequiredError}
71
+ * @memberof ConversationApiInterface
72
+ */
73
+ getConversationsRaw(requestParameters: GetConversationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ConversationsResponse>>;
74
+ /**
75
+ * Retrieve a list of conversation summaries that are ordered newest to oldest, include the most recent message and whether its been read.
76
+ * Retrieve a list of conversation summaries newest to oldest
77
+ */
78
+ getConversations(requestParameters: GetConversationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ConversationsResponse>;
79
+ /**
80
+ * Join a conversation
81
+ * @summary Join a conversation
82
+ * @param {string} conversationUuid
83
+ * @param {*} [options] Override http request option.
84
+ * @throws {RequiredError}
85
+ * @memberof ConversationApiInterface
86
+ */
87
+ joinConversationRaw(requestParameters: JoinConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
88
+ /**
89
+ * Join a conversation
90
+ * Join a conversation
91
+ */
92
+ joinConversation(requestParameters: JoinConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
93
+ /**
94
+ * Leave a conversation
95
+ * @summary Leave a conversation
96
+ * @param {string} conversationUuid
97
+ * @param {*} [options] Override http request option.
98
+ * @throws {RequiredError}
99
+ * @memberof ConversationApiInterface
100
+ */
101
+ leaveConversationRaw(requestParameters: LeaveConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
102
+ /**
103
+ * Leave a conversation
104
+ * Leave a conversation
105
+ */
106
+ leaveConversation(requestParameters: LeaveConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
107
+ /**
108
+ * Start a new conversation
109
+ * @summary Start a conversation
110
+ * @param {ConversationStartRequest} startRequest Start request
111
+ * @param {*} [options] Override http request option.
112
+ * @throws {RequiredError}
113
+ * @memberof ConversationApiInterface
114
+ */
115
+ startConversationRaw(requestParameters: StartConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ConversationStartResponse>>;
116
+ /**
117
+ * Start a new conversation
118
+ * Start a conversation
119
+ */
120
+ startConversation(requestParameters: StartConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ConversationStartResponse>;
121
+ }
122
+ /**
123
+ *
124
+ */
125
+ export declare class ConversationApi extends runtime.BaseAPI implements ConversationApiInterface {
126
+ /**
127
+ * Retrieve a JWT to authorize an agent to make a websocket connection.
128
+ * Get agent websocket authorization
129
+ */
130
+ getAgentWebsocketAuthorizationRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ConversationAgentAuthResponse>>;
131
+ /**
132
+ * Retrieve a JWT to authorize an agent to make a websocket connection.
133
+ * Get agent websocket authorization
134
+ */
135
+ getAgentWebsocketAuthorization(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ConversationAgentAuthResponse>;
136
+ /**
137
+ * Retrieve a conversation including the participants and messages
138
+ * Retrieve a conversation
139
+ */
140
+ getConversationRaw(requestParameters: GetConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Conversation>>;
141
+ /**
142
+ * Retrieve a conversation including the participants and messages
143
+ * Retrieve a conversation
144
+ */
145
+ getConversation(requestParameters: GetConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Conversation>;
146
+ /**
147
+ * Retrieve a list of conversation summaries that are ordered newest to oldest, include the most recent message and whether its been read.
148
+ * Retrieve a list of conversation summaries newest to oldest
149
+ */
150
+ getConversationsRaw(requestParameters: GetConversationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ConversationsResponse>>;
151
+ /**
152
+ * Retrieve a list of conversation summaries that are ordered newest to oldest, include the most recent message and whether its been read.
153
+ * Retrieve a list of conversation summaries newest to oldest
154
+ */
155
+ getConversations(requestParameters?: GetConversationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ConversationsResponse>;
156
+ /**
157
+ * Join a conversation
158
+ * Join a conversation
159
+ */
160
+ joinConversationRaw(requestParameters: JoinConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
161
+ /**
162
+ * Join a conversation
163
+ * Join a conversation
164
+ */
165
+ joinConversation(requestParameters: JoinConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
166
+ /**
167
+ * Leave a conversation
168
+ * Leave a conversation
169
+ */
170
+ leaveConversationRaw(requestParameters: LeaveConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
171
+ /**
172
+ * Leave a conversation
173
+ * Leave a conversation
174
+ */
175
+ leaveConversation(requestParameters: LeaveConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
176
+ /**
177
+ * Start a new conversation
178
+ * Start a conversation
179
+ */
180
+ startConversationRaw(requestParameters: StartConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ConversationStartResponse>>;
181
+ /**
182
+ * Start a new conversation
183
+ * Start a conversation
184
+ */
185
+ startConversation(requestParameters: StartConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ConversationStartResponse>;
186
+ }
@@ -0,0 +1,433 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * UltraCart Rest API V2
6
+ * UltraCart REST API Version 2
7
+ *
8
+ * The version of the OpenAPI document: 2.0.0
9
+ * Contact: support@ultracart.com
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ var __extends = (this && this.__extends) || (function () {
16
+ var extendStatics = function (d, b) {
17
+ extendStatics = Object.setPrototypeOf ||
18
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
19
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
20
+ return extendStatics(d, b);
21
+ };
22
+ return function (d, b) {
23
+ if (typeof b !== "function" && b !== null)
24
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
25
+ extendStatics(d, b);
26
+ function __() { this.constructor = d; }
27
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
28
+ };
29
+ })();
30
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
31
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
32
+ return new (P || (P = Promise))(function (resolve, reject) {
33
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
34
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
35
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
36
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
37
+ });
38
+ };
39
+ var __generator = (this && this.__generator) || function (thisArg, body) {
40
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
41
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
42
+ function verb(n) { return function (v) { return step([n, v]); }; }
43
+ function step(op) {
44
+ if (f) throw new TypeError("Generator is already executing.");
45
+ while (_) try {
46
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
47
+ if (y = 0, t) op = [op[0] & 2, t.value];
48
+ switch (op[0]) {
49
+ case 0: case 1: t = op; break;
50
+ case 4: _.label++; return { value: op[1], done: false };
51
+ case 5: _.label++; y = op[1]; op = [0]; continue;
52
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
53
+ default:
54
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
55
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
56
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
57
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
58
+ if (t[2]) _.ops.pop();
59
+ _.trys.pop(); continue;
60
+ }
61
+ op = body.call(thisArg, _);
62
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
63
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
64
+ }
65
+ };
66
+ Object.defineProperty(exports, "__esModule", { value: true });
67
+ exports.ConversationApi = void 0;
68
+ var runtime = require("../runtime");
69
+ var models_1 = require("../models");
70
+ /**
71
+ *
72
+ */
73
+ var ConversationApi = /** @class */ (function (_super) {
74
+ __extends(ConversationApi, _super);
75
+ function ConversationApi() {
76
+ return _super !== null && _super.apply(this, arguments) || this;
77
+ }
78
+ /**
79
+ * Retrieve a JWT to authorize an agent to make a websocket connection.
80
+ * Get agent websocket authorization
81
+ */
82
+ ConversationApi.prototype.getAgentWebsocketAuthorizationRaw = function (initOverrides) {
83
+ return __awaiter(this, void 0, void 0, function () {
84
+ var queryParameters, headerParameters, _a, _b, response;
85
+ return __generator(this, function (_c) {
86
+ switch (_c.label) {
87
+ case 0:
88
+ queryParameters = {};
89
+ headerParameters = {};
90
+ if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
91
+ // oauth required
92
+ _a = headerParameters;
93
+ _b = "Authorization";
94
+ return [4 /*yield*/, this.configuration.accessToken("ultraCartOauth", ["conversation_write"])];
95
+ case 1:
96
+ // oauth required
97
+ _a[_b] = _c.sent();
98
+ _c.label = 2;
99
+ case 2:
100
+ if (this.configuration && this.configuration.apiKey) {
101
+ headerParameters["x-ultracart-simple-key"] = this.configuration.apiKey("x-ultracart-simple-key"); // ultraCartSimpleApiKey authentication
102
+ }
103
+ return [4 /*yield*/, this.request({
104
+ path: "/conversation/agent/auth",
105
+ method: 'PUT',
106
+ headers: headerParameters,
107
+ query: queryParameters,
108
+ }, initOverrides)];
109
+ case 3:
110
+ response = _c.sent();
111
+ return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, models_1.ConversationAgentAuthResponseFromJSON)(jsonValue); })];
112
+ }
113
+ });
114
+ });
115
+ };
116
+ /**
117
+ * Retrieve a JWT to authorize an agent to make a websocket connection.
118
+ * Get agent websocket authorization
119
+ */
120
+ ConversationApi.prototype.getAgentWebsocketAuthorization = function (initOverrides) {
121
+ return __awaiter(this, void 0, void 0, function () {
122
+ var response;
123
+ return __generator(this, function (_a) {
124
+ switch (_a.label) {
125
+ case 0: return [4 /*yield*/, this.getAgentWebsocketAuthorizationRaw(initOverrides)];
126
+ case 1:
127
+ response = _a.sent();
128
+ return [4 /*yield*/, response.value()];
129
+ case 2: return [2 /*return*/, _a.sent()];
130
+ }
131
+ });
132
+ });
133
+ };
134
+ /**
135
+ * Retrieve a conversation including the participants and messages
136
+ * Retrieve a conversation
137
+ */
138
+ ConversationApi.prototype.getConversationRaw = function (requestParameters, initOverrides) {
139
+ return __awaiter(this, void 0, void 0, function () {
140
+ var queryParameters, headerParameters, _a, _b, response;
141
+ return __generator(this, function (_c) {
142
+ switch (_c.label) {
143
+ case 0:
144
+ if (requestParameters.conversationUuid === null || requestParameters.conversationUuid === undefined) {
145
+ throw new runtime.RequiredError('conversationUuid', 'Required parameter requestParameters.conversationUuid was null or undefined when calling getConversation.');
146
+ }
147
+ queryParameters = {};
148
+ headerParameters = {};
149
+ if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
150
+ // oauth required
151
+ _a = headerParameters;
152
+ _b = "Authorization";
153
+ return [4 /*yield*/, this.configuration.accessToken("ultraCartOauth", ["conversation_read"])];
154
+ case 1:
155
+ // oauth required
156
+ _a[_b] = _c.sent();
157
+ _c.label = 2;
158
+ case 2:
159
+ if (this.configuration && this.configuration.apiKey) {
160
+ headerParameters["x-ultracart-simple-key"] = this.configuration.apiKey("x-ultracart-simple-key"); // ultraCartSimpleApiKey authentication
161
+ }
162
+ return [4 /*yield*/, this.request({
163
+ path: "/conversation/conversations/{conversation_uuid}".replace("{".concat("conversation_uuid", "}"), encodeURIComponent(String(requestParameters.conversationUuid))),
164
+ method: 'GET',
165
+ headers: headerParameters,
166
+ query: queryParameters,
167
+ }, initOverrides)];
168
+ case 3:
169
+ response = _c.sent();
170
+ return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, models_1.ConversationFromJSON)(jsonValue); })];
171
+ }
172
+ });
173
+ });
174
+ };
175
+ /**
176
+ * Retrieve a conversation including the participants and messages
177
+ * Retrieve a conversation
178
+ */
179
+ ConversationApi.prototype.getConversation = function (requestParameters, initOverrides) {
180
+ return __awaiter(this, void 0, void 0, function () {
181
+ var response;
182
+ return __generator(this, function (_a) {
183
+ switch (_a.label) {
184
+ case 0: return [4 /*yield*/, this.getConversationRaw(requestParameters, initOverrides)];
185
+ case 1:
186
+ response = _a.sent();
187
+ return [4 /*yield*/, response.value()];
188
+ case 2: return [2 /*return*/, _a.sent()];
189
+ }
190
+ });
191
+ });
192
+ };
193
+ /**
194
+ * Retrieve a list of conversation summaries that are ordered newest to oldest, include the most recent message and whether its been read.
195
+ * Retrieve a list of conversation summaries newest to oldest
196
+ */
197
+ ConversationApi.prototype.getConversationsRaw = function (requestParameters, initOverrides) {
198
+ return __awaiter(this, void 0, void 0, function () {
199
+ var queryParameters, headerParameters, _a, _b, response;
200
+ return __generator(this, function (_c) {
201
+ switch (_c.label) {
202
+ case 0:
203
+ queryParameters = {};
204
+ if (requestParameters.limit !== undefined) {
205
+ queryParameters['_limit'] = requestParameters.limit;
206
+ }
207
+ if (requestParameters.offset !== undefined) {
208
+ queryParameters['_offset'] = requestParameters.offset;
209
+ }
210
+ headerParameters = {};
211
+ if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
212
+ // oauth required
213
+ _a = headerParameters;
214
+ _b = "Authorization";
215
+ return [4 /*yield*/, this.configuration.accessToken("ultraCartOauth", ["conversation_read"])];
216
+ case 1:
217
+ // oauth required
218
+ _a[_b] = _c.sent();
219
+ _c.label = 2;
220
+ case 2:
221
+ if (this.configuration && this.configuration.apiKey) {
222
+ headerParameters["x-ultracart-simple-key"] = this.configuration.apiKey("x-ultracart-simple-key"); // ultraCartSimpleApiKey authentication
223
+ }
224
+ return [4 /*yield*/, this.request({
225
+ path: "/conversation/conversations",
226
+ method: 'GET',
227
+ headers: headerParameters,
228
+ query: queryParameters,
229
+ }, initOverrides)];
230
+ case 3:
231
+ response = _c.sent();
232
+ return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, models_1.ConversationsResponseFromJSON)(jsonValue); })];
233
+ }
234
+ });
235
+ });
236
+ };
237
+ /**
238
+ * Retrieve a list of conversation summaries that are ordered newest to oldest, include the most recent message and whether its been read.
239
+ * Retrieve a list of conversation summaries newest to oldest
240
+ */
241
+ ConversationApi.prototype.getConversations = function (requestParameters, initOverrides) {
242
+ if (requestParameters === void 0) { requestParameters = {}; }
243
+ return __awaiter(this, void 0, void 0, function () {
244
+ var response;
245
+ return __generator(this, function (_a) {
246
+ switch (_a.label) {
247
+ case 0: return [4 /*yield*/, this.getConversationsRaw(requestParameters, initOverrides)];
248
+ case 1:
249
+ response = _a.sent();
250
+ return [4 /*yield*/, response.value()];
251
+ case 2: return [2 /*return*/, _a.sent()];
252
+ }
253
+ });
254
+ });
255
+ };
256
+ /**
257
+ * Join a conversation
258
+ * Join a conversation
259
+ */
260
+ ConversationApi.prototype.joinConversationRaw = function (requestParameters, initOverrides) {
261
+ return __awaiter(this, void 0, void 0, function () {
262
+ var queryParameters, headerParameters, _a, _b, response;
263
+ return __generator(this, function (_c) {
264
+ switch (_c.label) {
265
+ case 0:
266
+ if (requestParameters.conversationUuid === null || requestParameters.conversationUuid === undefined) {
267
+ throw new runtime.RequiredError('conversationUuid', 'Required parameter requestParameters.conversationUuid was null or undefined when calling joinConversation.');
268
+ }
269
+ queryParameters = {};
270
+ headerParameters = {};
271
+ if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
272
+ // oauth required
273
+ _a = headerParameters;
274
+ _b = "Authorization";
275
+ return [4 /*yield*/, this.configuration.accessToken("ultraCartOauth", ["conversation_write"])];
276
+ case 1:
277
+ // oauth required
278
+ _a[_b] = _c.sent();
279
+ _c.label = 2;
280
+ case 2:
281
+ if (this.configuration && this.configuration.apiKey) {
282
+ headerParameters["x-ultracart-simple-key"] = this.configuration.apiKey("x-ultracart-simple-key"); // ultraCartSimpleApiKey authentication
283
+ }
284
+ return [4 /*yield*/, this.request({
285
+ path: "/conversation/conversations/{conversation_uuid}/join".replace("{".concat("conversation_uuid", "}"), encodeURIComponent(String(requestParameters.conversationUuid))),
286
+ method: 'PUT',
287
+ headers: headerParameters,
288
+ query: queryParameters,
289
+ }, initOverrides)];
290
+ case 3:
291
+ response = _c.sent();
292
+ return [2 /*return*/, new runtime.VoidApiResponse(response)];
293
+ }
294
+ });
295
+ });
296
+ };
297
+ /**
298
+ * Join a conversation
299
+ * Join a conversation
300
+ */
301
+ ConversationApi.prototype.joinConversation = function (requestParameters, initOverrides) {
302
+ return __awaiter(this, void 0, void 0, function () {
303
+ return __generator(this, function (_a) {
304
+ switch (_a.label) {
305
+ case 0: return [4 /*yield*/, this.joinConversationRaw(requestParameters, initOverrides)];
306
+ case 1:
307
+ _a.sent();
308
+ return [2 /*return*/];
309
+ }
310
+ });
311
+ });
312
+ };
313
+ /**
314
+ * Leave a conversation
315
+ * Leave a conversation
316
+ */
317
+ ConversationApi.prototype.leaveConversationRaw = function (requestParameters, initOverrides) {
318
+ return __awaiter(this, void 0, void 0, function () {
319
+ var queryParameters, headerParameters, _a, _b, response;
320
+ return __generator(this, function (_c) {
321
+ switch (_c.label) {
322
+ case 0:
323
+ if (requestParameters.conversationUuid === null || requestParameters.conversationUuid === undefined) {
324
+ throw new runtime.RequiredError('conversationUuid', 'Required parameter requestParameters.conversationUuid was null or undefined when calling leaveConversation.');
325
+ }
326
+ queryParameters = {};
327
+ headerParameters = {};
328
+ if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
329
+ // oauth required
330
+ _a = headerParameters;
331
+ _b = "Authorization";
332
+ return [4 /*yield*/, this.configuration.accessToken("ultraCartOauth", ["conversation_write"])];
333
+ case 1:
334
+ // oauth required
335
+ _a[_b] = _c.sent();
336
+ _c.label = 2;
337
+ case 2:
338
+ if (this.configuration && this.configuration.apiKey) {
339
+ headerParameters["x-ultracart-simple-key"] = this.configuration.apiKey("x-ultracart-simple-key"); // ultraCartSimpleApiKey authentication
340
+ }
341
+ return [4 /*yield*/, this.request({
342
+ path: "/conversation/conversations/{conversation_uuid}/leave".replace("{".concat("conversation_uuid", "}"), encodeURIComponent(String(requestParameters.conversationUuid))),
343
+ method: 'DELETE',
344
+ headers: headerParameters,
345
+ query: queryParameters,
346
+ }, initOverrides)];
347
+ case 3:
348
+ response = _c.sent();
349
+ return [2 /*return*/, new runtime.VoidApiResponse(response)];
350
+ }
351
+ });
352
+ });
353
+ };
354
+ /**
355
+ * Leave a conversation
356
+ * Leave a conversation
357
+ */
358
+ ConversationApi.prototype.leaveConversation = function (requestParameters, initOverrides) {
359
+ return __awaiter(this, void 0, void 0, function () {
360
+ return __generator(this, function (_a) {
361
+ switch (_a.label) {
362
+ case 0: return [4 /*yield*/, this.leaveConversationRaw(requestParameters, initOverrides)];
363
+ case 1:
364
+ _a.sent();
365
+ return [2 /*return*/];
366
+ }
367
+ });
368
+ });
369
+ };
370
+ /**
371
+ * Start a new conversation
372
+ * Start a conversation
373
+ */
374
+ ConversationApi.prototype.startConversationRaw = function (requestParameters, initOverrides) {
375
+ return __awaiter(this, void 0, void 0, function () {
376
+ var queryParameters, headerParameters, _a, _b, response;
377
+ return __generator(this, function (_c) {
378
+ switch (_c.label) {
379
+ case 0:
380
+ if (requestParameters.startRequest === null || requestParameters.startRequest === undefined) {
381
+ throw new runtime.RequiredError('startRequest', 'Required parameter requestParameters.startRequest was null or undefined when calling startConversation.');
382
+ }
383
+ queryParameters = {};
384
+ headerParameters = {};
385
+ headerParameters['Content-Type'] = 'application/json';
386
+ if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
387
+ // oauth required
388
+ _a = headerParameters;
389
+ _b = "Authorization";
390
+ return [4 /*yield*/, this.configuration.accessToken("ultraCartOauth", ["conversation_write"])];
391
+ case 1:
392
+ // oauth required
393
+ _a[_b] = _c.sent();
394
+ _c.label = 2;
395
+ case 2:
396
+ if (this.configuration && this.configuration.apiKey) {
397
+ headerParameters["x-ultracart-simple-key"] = this.configuration.apiKey("x-ultracart-simple-key"); // ultraCartSimpleApiKey authentication
398
+ }
399
+ return [4 /*yield*/, this.request({
400
+ path: "/conversation/conversations",
401
+ method: 'PUT',
402
+ headers: headerParameters,
403
+ query: queryParameters,
404
+ body: (0, models_1.ConversationStartRequestToJSON)(requestParameters.startRequest),
405
+ }, initOverrides)];
406
+ case 3:
407
+ response = _c.sent();
408
+ return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, models_1.ConversationStartResponseFromJSON)(jsonValue); })];
409
+ }
410
+ });
411
+ });
412
+ };
413
+ /**
414
+ * Start a new conversation
415
+ * Start a conversation
416
+ */
417
+ ConversationApi.prototype.startConversation = function (requestParameters, initOverrides) {
418
+ return __awaiter(this, void 0, void 0, function () {
419
+ var response;
420
+ return __generator(this, function (_a) {
421
+ switch (_a.label) {
422
+ case 0: return [4 /*yield*/, this.startConversationRaw(requestParameters, initOverrides)];
423
+ case 1:
424
+ response = _a.sent();
425
+ return [4 /*yield*/, response.value()];
426
+ case 2: return [2 /*return*/, _a.sent()];
427
+ }
428
+ });
429
+ });
430
+ };
431
+ return ConversationApi;
432
+ }(runtime.BaseAPI));
433
+ exports.ConversationApi = ConversationApi;