ultracart_rest_api_v2_typescript 4.1.74 → 4.1.76
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/.openapi-generator/FILES +2 -0
- package/README.md +4 -2
- package/dist/apis/ConversationEmbedApi.d.ts +140 -0
- package/dist/apis/ConversationEmbedApi.js +381 -0
- package/dist/apis/index.d.ts +1 -0
- package/dist/apis/index.js +1 -0
- package/dist/models/ConversationEmbedPbxAuthResponse.d.ts +61 -0
- package/dist/models/ConversationEmbedPbxAuthResponse.js +60 -0
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +1 -0
- package/package.json +1 -1
- package/src/apis/ConversationEmbedApi.ts +379 -0
- package/src/apis/index.ts +1 -0
- package/src/models/ConversationEmbedPbxAuthResponse.ts +107 -0
- package/src/models/index.ts +1 -0
package/.openapi-generator/FILES
CHANGED
|
@@ -7,6 +7,7 @@ src/apis/AutoOrderApi.ts
|
|
|
7
7
|
src/apis/ChannelPartnerApi.ts
|
|
8
8
|
src/apis/CheckoutApi.ts
|
|
9
9
|
src/apis/ConversationApi.ts
|
|
10
|
+
src/apis/ConversationEmbedApi.ts
|
|
10
11
|
src/apis/CouponApi.ts
|
|
11
12
|
src/apis/CustomerApi.ts
|
|
12
13
|
src/apis/DatawarehouseApi.ts
|
|
@@ -175,6 +176,7 @@ src/models/ConversationDepartmentMember.ts
|
|
|
175
176
|
src/models/ConversationDepartmentMembersResponse.ts
|
|
176
177
|
src/models/ConversationDepartmentResponse.ts
|
|
177
178
|
src/models/ConversationDepartmentsResponse.ts
|
|
179
|
+
src/models/ConversationEmbedPbxAuthResponse.ts
|
|
178
180
|
src/models/ConversationEngagement.ts
|
|
179
181
|
src/models/ConversationEngagementEquation.ts
|
|
180
182
|
src/models/ConversationEngagementEquationFunction.ts
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# UltraCart Typescript SDK
|
|
2
|
-
## ultracart_rest_api_v2_typescript@4.1.
|
|
2
|
+
## ultracart_rest_api_v2_typescript@4.1.76
|
|
3
3
|
|
|
4
4
|
Every API method call has a sample for every language SDK. See https://github.com/UltraCart/sdk_samples
|
|
5
5
|
|
|
6
6
|
Installation
|
|
7
7
|
|
|
8
8
|
```
|
|
9
|
-
npm install ultracart_rest_api_v2_typescript@4.1.
|
|
9
|
+
npm install ultracart_rest_api_v2_typescript@4.1.76 --save
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
```typescript
|
|
@@ -85,6 +85,8 @@ Not every change is committed to every SDK.
|
|
|
85
85
|
|
|
86
86
|
| Version | Date | Comments |
|
|
87
87
|
| --: | :-: | --- |
|
|
88
|
+
| 4.1.76 | 04/17/2026 | conversation - embed oauth methods |
|
|
89
|
+
| 4.1.75 | 04/17/2026 | conversation - embed oauth methods |
|
|
88
90
|
| 4.1.74 | 04/15/2026 | auto order - new method cancelAutoOrderItemByReferenceOrderId |
|
|
89
91
|
| 4.1.73 | 04/13/2026 | conversation pbx - queue configuration for ai summary and call record zoho desk |
|
|
90
92
|
| 4.1.72 | 04/11/2026 | conversation pbx - voicemail notification channels |
|
|
@@ -0,0 +1,140 @@
|
|
|
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 { ConversationEmbedPbxAuthResponse } from '../models';
|
|
14
|
+
export interface EmbedOauthDeviceAuthorizeRequest {
|
|
15
|
+
clientId: string;
|
|
16
|
+
scope: string;
|
|
17
|
+
}
|
|
18
|
+
export interface EmbedOauthRevokeRequest {
|
|
19
|
+
clientId: string;
|
|
20
|
+
token: string;
|
|
21
|
+
}
|
|
22
|
+
export interface EmbedOauthTokenRequest {
|
|
23
|
+
clientId: string;
|
|
24
|
+
grantType: string;
|
|
25
|
+
deviceCode?: string;
|
|
26
|
+
refreshToken?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* ConversationEmbedApi - interface
|
|
30
|
+
*
|
|
31
|
+
* @export
|
|
32
|
+
* @interface ConversationEmbedApiInterface
|
|
33
|
+
*/
|
|
34
|
+
export interface ConversationEmbedApiInterface {
|
|
35
|
+
/**
|
|
36
|
+
* RFC 8628 device authorization. Only the embed widget\'s client_id and the crm_embed scope are accepted.
|
|
37
|
+
* @summary Initiate a device authorization flow for an embed widget.
|
|
38
|
+
* @param {string} clientId The embed widget OAuth client_id.
|
|
39
|
+
* @param {string} scope The application-level scope (must be \\\'crm_embed\\\').
|
|
40
|
+
* @param {*} [options] Override http request option.
|
|
41
|
+
* @throws {RequiredError}
|
|
42
|
+
* @memberof ConversationEmbedApiInterface
|
|
43
|
+
*/
|
|
44
|
+
embedOauthDeviceAuthorizeRaw(requestParameters: EmbedOauthDeviceAuthorizeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
45
|
+
/**
|
|
46
|
+
* RFC 8628 device authorization. Only the embed widget\'s client_id and the crm_embed scope are accepted.
|
|
47
|
+
* Initiate a device authorization flow for an embed widget.
|
|
48
|
+
*/
|
|
49
|
+
embedOauthDeviceAuthorize(requestParameters: EmbedOauthDeviceAuthorizeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* RFC 7009 style — the token itself is proof of possession. Accepts either an access token or a refresh token in the \'token\' parameter.
|
|
52
|
+
* @summary Revoke an embed widget access or refresh token.
|
|
53
|
+
* @param {string} clientId The embed widget OAuth client_id.
|
|
54
|
+
* @param {string} token The token to revoke (access token or refresh token).
|
|
55
|
+
* @param {*} [options] Override http request option.
|
|
56
|
+
* @throws {RequiredError}
|
|
57
|
+
* @memberof ConversationEmbedApiInterface
|
|
58
|
+
*/
|
|
59
|
+
embedOauthRevokeRaw(requestParameters: EmbedOauthRevokeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
60
|
+
/**
|
|
61
|
+
* RFC 7009 style — the token itself is proof of possession. Accepts either an access token or a refresh token in the \'token\' parameter.
|
|
62
|
+
* Revoke an embed widget access or refresh token.
|
|
63
|
+
*/
|
|
64
|
+
embedOauthRevoke(requestParameters: EmbedOauthRevokeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Accepts grant_type=urn:ietf:params:oauth:grant-type:device_code or grant_type=refresh_token. Other grant types are rejected. Access tokens issued here expire in 60 minutes.
|
|
67
|
+
* @summary Exchange a device_code or refresh_token for an access token (embed widget).
|
|
68
|
+
* @param {string} clientId The embed widget OAuth client_id.
|
|
69
|
+
* @param {string} grantType Grant type.
|
|
70
|
+
* @param {string} [deviceCode] The device code received from /oauth/device/authorize (required for device_code grant).
|
|
71
|
+
* @param {string} [refreshToken] The refresh token (required for refresh_token grant).
|
|
72
|
+
* @param {*} [options] Override http request option.
|
|
73
|
+
* @throws {RequiredError}
|
|
74
|
+
* @memberof ConversationEmbedApiInterface
|
|
75
|
+
*/
|
|
76
|
+
embedOauthTokenRaw(requestParameters: EmbedOauthTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
77
|
+
/**
|
|
78
|
+
* Accepts grant_type=urn:ietf:params:oauth:grant-type:device_code or grant_type=refresh_token. Other grant types are rejected. Access tokens issued here expire in 60 minutes.
|
|
79
|
+
* Exchange a device_code or refresh_token for an access token (embed widget).
|
|
80
|
+
*/
|
|
81
|
+
embedOauthToken(requestParameters: EmbedOauthTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Returns a narrow subset of agent auth fields — only what the softphone widget needs to connect to the PBX relay. Twilio tokens, conversation JWTs, and chat/customer permissions are intentionally excluded.
|
|
84
|
+
* @summary Get PBX authorization for the embedded softphone widget.
|
|
85
|
+
* @param {*} [options] Override http request option.
|
|
86
|
+
* @throws {RequiredError}
|
|
87
|
+
* @memberof ConversationEmbedApiInterface
|
|
88
|
+
*/
|
|
89
|
+
getEmbedPbxAuthRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ConversationEmbedPbxAuthResponse>>;
|
|
90
|
+
/**
|
|
91
|
+
* Returns a narrow subset of agent auth fields — only what the softphone widget needs to connect to the PBX relay. Twilio tokens, conversation JWTs, and chat/customer permissions are intentionally excluded.
|
|
92
|
+
* Get PBX authorization for the embedded softphone widget.
|
|
93
|
+
*/
|
|
94
|
+
getEmbedPbxAuth(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ConversationEmbedPbxAuthResponse>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
*
|
|
98
|
+
*/
|
|
99
|
+
export declare class ConversationEmbedApi extends runtime.BaseAPI implements ConversationEmbedApiInterface {
|
|
100
|
+
/**
|
|
101
|
+
* RFC 8628 device authorization. Only the embed widget\'s client_id and the crm_embed scope are accepted.
|
|
102
|
+
* Initiate a device authorization flow for an embed widget.
|
|
103
|
+
*/
|
|
104
|
+
embedOauthDeviceAuthorizeRaw(requestParameters: EmbedOauthDeviceAuthorizeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
105
|
+
/**
|
|
106
|
+
* RFC 8628 device authorization. Only the embed widget\'s client_id and the crm_embed scope are accepted.
|
|
107
|
+
* Initiate a device authorization flow for an embed widget.
|
|
108
|
+
*/
|
|
109
|
+
embedOauthDeviceAuthorize(requestParameters: EmbedOauthDeviceAuthorizeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* RFC 7009 style — the token itself is proof of possession. Accepts either an access token or a refresh token in the \'token\' parameter.
|
|
112
|
+
* Revoke an embed widget access or refresh token.
|
|
113
|
+
*/
|
|
114
|
+
embedOauthRevokeRaw(requestParameters: EmbedOauthRevokeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
115
|
+
/**
|
|
116
|
+
* RFC 7009 style — the token itself is proof of possession. Accepts either an access token or a refresh token in the \'token\' parameter.
|
|
117
|
+
* Revoke an embed widget access or refresh token.
|
|
118
|
+
*/
|
|
119
|
+
embedOauthRevoke(requestParameters: EmbedOauthRevokeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Accepts grant_type=urn:ietf:params:oauth:grant-type:device_code or grant_type=refresh_token. Other grant types are rejected. Access tokens issued here expire in 60 minutes.
|
|
122
|
+
* Exchange a device_code or refresh_token for an access token (embed widget).
|
|
123
|
+
*/
|
|
124
|
+
embedOauthTokenRaw(requestParameters: EmbedOauthTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
125
|
+
/**
|
|
126
|
+
* Accepts grant_type=urn:ietf:params:oauth:grant-type:device_code or grant_type=refresh_token. Other grant types are rejected. Access tokens issued here expire in 60 minutes.
|
|
127
|
+
* Exchange a device_code or refresh_token for an access token (embed widget).
|
|
128
|
+
*/
|
|
129
|
+
embedOauthToken(requestParameters: EmbedOauthTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Returns a narrow subset of agent auth fields — only what the softphone widget needs to connect to the PBX relay. Twilio tokens, conversation JWTs, and chat/customer permissions are intentionally excluded.
|
|
132
|
+
* Get PBX authorization for the embedded softphone widget.
|
|
133
|
+
*/
|
|
134
|
+
getEmbedPbxAuthRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ConversationEmbedPbxAuthResponse>>;
|
|
135
|
+
/**
|
|
136
|
+
* Returns a narrow subset of agent auth fields — only what the softphone widget needs to connect to the PBX relay. Twilio tokens, conversation JWTs, and chat/customer permissions are intentionally excluded.
|
|
137
|
+
* Get PBX authorization for the embedded softphone widget.
|
|
138
|
+
*/
|
|
139
|
+
getEmbedPbxAuth(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ConversationEmbedPbxAuthResponse>;
|
|
140
|
+
}
|
|
@@ -0,0 +1,381 @@
|
|
|
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 (g && (g = 0, op[0] && (_ = 0)), _) 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.ConversationEmbedApi = void 0;
|
|
68
|
+
var runtime = require("../runtime");
|
|
69
|
+
var models_1 = require("../models");
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
*/
|
|
73
|
+
var ConversationEmbedApi = /** @class */ (function (_super) {
|
|
74
|
+
__extends(ConversationEmbedApi, _super);
|
|
75
|
+
function ConversationEmbedApi() {
|
|
76
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* RFC 8628 device authorization. Only the embed widget\'s client_id and the crm_embed scope are accepted.
|
|
80
|
+
* Initiate a device authorization flow for an embed widget.
|
|
81
|
+
*/
|
|
82
|
+
ConversationEmbedApi.prototype.embedOauthDeviceAuthorizeRaw = function (requestParameters, initOverrides) {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
84
|
+
var queryParameters, headerParameters, _a, _b, consumes, canConsumeForm, formParams, useForm, response;
|
|
85
|
+
return __generator(this, function (_c) {
|
|
86
|
+
switch (_c.label) {
|
|
87
|
+
case 0:
|
|
88
|
+
if (requestParameters.clientId === null || requestParameters.clientId === undefined) {
|
|
89
|
+
throw new runtime.RequiredError('clientId', 'Required parameter requestParameters.clientId was null or undefined when calling embedOauthDeviceAuthorize.');
|
|
90
|
+
}
|
|
91
|
+
if (requestParameters.scope === null || requestParameters.scope === undefined) {
|
|
92
|
+
throw new runtime.RequiredError('scope', 'Required parameter requestParameters.scope was null or undefined when calling embedOauthDeviceAuthorize.');
|
|
93
|
+
}
|
|
94
|
+
queryParameters = {};
|
|
95
|
+
headerParameters = {};
|
|
96
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
97
|
+
headerParameters["x-ultracart-browser-key"] = this.configuration.apiKey("x-ultracart-browser-key"); // ultraCartBrowserApiKey authentication
|
|
98
|
+
}
|
|
99
|
+
if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
|
|
100
|
+
// oauth required
|
|
101
|
+
_a = headerParameters;
|
|
102
|
+
_b = "Authorization";
|
|
103
|
+
return [4 /*yield*/, this.configuration.accessToken("ultraCartOauth", ["affiliate_read", "affiliate_write", "auto_order_read", "auto_order_write", "channel_partner_read", "channel_partner_write", "chargeback_read", "chargeback_write", "checkout_read", "checkout_write", "configuration_read", "configuration_write", "conversation_read", "conversation_write", "coupon_read", "coupon_write", "customer_read", "customer_write", "fulfillment_read", "fulfillment_write", "gift_certificate_read", "gift_certificate_write", "integration_log_read", "integration_log_write", "order_read", "order_write", "item_read", "item_write", "storefront_read", "storefront_write", "tax_read", "tax_write", "webhook_read", "webhook_write", "ultrabooks_read", "ultrabooks_write", "user_read", "user_write", "workflow_read", "workflow_write"])];
|
|
104
|
+
case 1:
|
|
105
|
+
// oauth required
|
|
106
|
+
_a[_b] = _c.sent();
|
|
107
|
+
_c.label = 2;
|
|
108
|
+
case 2:
|
|
109
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
110
|
+
headerParameters["x-ultracart-simple-key"] = this.configuration.apiKey("x-ultracart-simple-key"); // ultraCartSimpleApiKey authentication
|
|
111
|
+
}
|
|
112
|
+
consumes = [
|
|
113
|
+
{ contentType: 'application/x-www-form-urlencoded' },
|
|
114
|
+
];
|
|
115
|
+
canConsumeForm = runtime.canConsumeForm(consumes);
|
|
116
|
+
useForm = false;
|
|
117
|
+
if (useForm) {
|
|
118
|
+
formParams = new FormData();
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
formParams = new URLSearchParams();
|
|
122
|
+
}
|
|
123
|
+
if (requestParameters.clientId !== undefined) {
|
|
124
|
+
formParams.append('client_id', requestParameters.clientId);
|
|
125
|
+
}
|
|
126
|
+
if (requestParameters.scope !== undefined) {
|
|
127
|
+
formParams.append('scope', requestParameters.scope);
|
|
128
|
+
}
|
|
129
|
+
return [4 /*yield*/, this.request({
|
|
130
|
+
path: "/conversation_embed/oauth/device/authorize",
|
|
131
|
+
method: 'POST',
|
|
132
|
+
headers: headerParameters,
|
|
133
|
+
query: queryParameters,
|
|
134
|
+
body: formParams,
|
|
135
|
+
}, initOverrides)];
|
|
136
|
+
case 3:
|
|
137
|
+
response = _c.sent();
|
|
138
|
+
return [2 /*return*/, new runtime.VoidApiResponse(response)];
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* RFC 8628 device authorization. Only the embed widget\'s client_id and the crm_embed scope are accepted.
|
|
145
|
+
* Initiate a device authorization flow for an embed widget.
|
|
146
|
+
*/
|
|
147
|
+
ConversationEmbedApi.prototype.embedOauthDeviceAuthorize = function (requestParameters, initOverrides) {
|
|
148
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
149
|
+
return __generator(this, function (_a) {
|
|
150
|
+
switch (_a.label) {
|
|
151
|
+
case 0: return [4 /*yield*/, this.embedOauthDeviceAuthorizeRaw(requestParameters, initOverrides)];
|
|
152
|
+
case 1:
|
|
153
|
+
_a.sent();
|
|
154
|
+
return [2 /*return*/];
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* RFC 7009 style — the token itself is proof of possession. Accepts either an access token or a refresh token in the \'token\' parameter.
|
|
161
|
+
* Revoke an embed widget access or refresh token.
|
|
162
|
+
*/
|
|
163
|
+
ConversationEmbedApi.prototype.embedOauthRevokeRaw = function (requestParameters, initOverrides) {
|
|
164
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
165
|
+
var queryParameters, headerParameters, _a, _b, consumes, canConsumeForm, formParams, useForm, response;
|
|
166
|
+
return __generator(this, function (_c) {
|
|
167
|
+
switch (_c.label) {
|
|
168
|
+
case 0:
|
|
169
|
+
if (requestParameters.clientId === null || requestParameters.clientId === undefined) {
|
|
170
|
+
throw new runtime.RequiredError('clientId', 'Required parameter requestParameters.clientId was null or undefined when calling embedOauthRevoke.');
|
|
171
|
+
}
|
|
172
|
+
if (requestParameters.token === null || requestParameters.token === undefined) {
|
|
173
|
+
throw new runtime.RequiredError('token', 'Required parameter requestParameters.token was null or undefined when calling embedOauthRevoke.');
|
|
174
|
+
}
|
|
175
|
+
queryParameters = {};
|
|
176
|
+
headerParameters = {};
|
|
177
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
178
|
+
headerParameters["x-ultracart-browser-key"] = this.configuration.apiKey("x-ultracart-browser-key"); // ultraCartBrowserApiKey authentication
|
|
179
|
+
}
|
|
180
|
+
if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
|
|
181
|
+
// oauth required
|
|
182
|
+
_a = headerParameters;
|
|
183
|
+
_b = "Authorization";
|
|
184
|
+
return [4 /*yield*/, this.configuration.accessToken("ultraCartOauth", ["affiliate_read", "affiliate_write", "auto_order_read", "auto_order_write", "channel_partner_read", "channel_partner_write", "chargeback_read", "chargeback_write", "checkout_read", "checkout_write", "configuration_read", "configuration_write", "conversation_read", "conversation_write", "coupon_read", "coupon_write", "customer_read", "customer_write", "fulfillment_read", "fulfillment_write", "gift_certificate_read", "gift_certificate_write", "integration_log_read", "integration_log_write", "order_read", "order_write", "item_read", "item_write", "storefront_read", "storefront_write", "tax_read", "tax_write", "webhook_read", "webhook_write", "ultrabooks_read", "ultrabooks_write", "user_read", "user_write", "workflow_read", "workflow_write"])];
|
|
185
|
+
case 1:
|
|
186
|
+
// oauth required
|
|
187
|
+
_a[_b] = _c.sent();
|
|
188
|
+
_c.label = 2;
|
|
189
|
+
case 2:
|
|
190
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
191
|
+
headerParameters["x-ultracart-simple-key"] = this.configuration.apiKey("x-ultracart-simple-key"); // ultraCartSimpleApiKey authentication
|
|
192
|
+
}
|
|
193
|
+
consumes = [
|
|
194
|
+
{ contentType: 'application/x-www-form-urlencoded' },
|
|
195
|
+
];
|
|
196
|
+
canConsumeForm = runtime.canConsumeForm(consumes);
|
|
197
|
+
useForm = false;
|
|
198
|
+
if (useForm) {
|
|
199
|
+
formParams = new FormData();
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
formParams = new URLSearchParams();
|
|
203
|
+
}
|
|
204
|
+
if (requestParameters.clientId !== undefined) {
|
|
205
|
+
formParams.append('client_id', requestParameters.clientId);
|
|
206
|
+
}
|
|
207
|
+
if (requestParameters.token !== undefined) {
|
|
208
|
+
formParams.append('token', requestParameters.token);
|
|
209
|
+
}
|
|
210
|
+
return [4 /*yield*/, this.request({
|
|
211
|
+
path: "/conversation_embed/oauth/device/revoke",
|
|
212
|
+
method: 'POST',
|
|
213
|
+
headers: headerParameters,
|
|
214
|
+
query: queryParameters,
|
|
215
|
+
body: formParams,
|
|
216
|
+
}, initOverrides)];
|
|
217
|
+
case 3:
|
|
218
|
+
response = _c.sent();
|
|
219
|
+
return [2 /*return*/, new runtime.VoidApiResponse(response)];
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* RFC 7009 style — the token itself is proof of possession. Accepts either an access token or a refresh token in the \'token\' parameter.
|
|
226
|
+
* Revoke an embed widget access or refresh token.
|
|
227
|
+
*/
|
|
228
|
+
ConversationEmbedApi.prototype.embedOauthRevoke = function (requestParameters, initOverrides) {
|
|
229
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
230
|
+
return __generator(this, function (_a) {
|
|
231
|
+
switch (_a.label) {
|
|
232
|
+
case 0: return [4 /*yield*/, this.embedOauthRevokeRaw(requestParameters, initOverrides)];
|
|
233
|
+
case 1:
|
|
234
|
+
_a.sent();
|
|
235
|
+
return [2 /*return*/];
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* Accepts grant_type=urn:ietf:params:oauth:grant-type:device_code or grant_type=refresh_token. Other grant types are rejected. Access tokens issued here expire in 60 minutes.
|
|
242
|
+
* Exchange a device_code or refresh_token for an access token (embed widget).
|
|
243
|
+
*/
|
|
244
|
+
ConversationEmbedApi.prototype.embedOauthTokenRaw = function (requestParameters, initOverrides) {
|
|
245
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
246
|
+
var queryParameters, headerParameters, _a, _b, consumes, canConsumeForm, formParams, useForm, response;
|
|
247
|
+
return __generator(this, function (_c) {
|
|
248
|
+
switch (_c.label) {
|
|
249
|
+
case 0:
|
|
250
|
+
if (requestParameters.clientId === null || requestParameters.clientId === undefined) {
|
|
251
|
+
throw new runtime.RequiredError('clientId', 'Required parameter requestParameters.clientId was null or undefined when calling embedOauthToken.');
|
|
252
|
+
}
|
|
253
|
+
if (requestParameters.grantType === null || requestParameters.grantType === undefined) {
|
|
254
|
+
throw new runtime.RequiredError('grantType', 'Required parameter requestParameters.grantType was null or undefined when calling embedOauthToken.');
|
|
255
|
+
}
|
|
256
|
+
queryParameters = {};
|
|
257
|
+
headerParameters = {};
|
|
258
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
259
|
+
headerParameters["x-ultracart-browser-key"] = this.configuration.apiKey("x-ultracart-browser-key"); // ultraCartBrowserApiKey authentication
|
|
260
|
+
}
|
|
261
|
+
if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
|
|
262
|
+
// oauth required
|
|
263
|
+
_a = headerParameters;
|
|
264
|
+
_b = "Authorization";
|
|
265
|
+
return [4 /*yield*/, this.configuration.accessToken("ultraCartOauth", ["affiliate_read", "affiliate_write", "auto_order_read", "auto_order_write", "channel_partner_read", "channel_partner_write", "chargeback_read", "chargeback_write", "checkout_read", "checkout_write", "configuration_read", "configuration_write", "conversation_read", "conversation_write", "coupon_read", "coupon_write", "customer_read", "customer_write", "fulfillment_read", "fulfillment_write", "gift_certificate_read", "gift_certificate_write", "integration_log_read", "integration_log_write", "order_read", "order_write", "item_read", "item_write", "storefront_read", "storefront_write", "tax_read", "tax_write", "webhook_read", "webhook_write", "ultrabooks_read", "ultrabooks_write", "user_read", "user_write", "workflow_read", "workflow_write"])];
|
|
266
|
+
case 1:
|
|
267
|
+
// oauth required
|
|
268
|
+
_a[_b] = _c.sent();
|
|
269
|
+
_c.label = 2;
|
|
270
|
+
case 2:
|
|
271
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
272
|
+
headerParameters["x-ultracart-simple-key"] = this.configuration.apiKey("x-ultracart-simple-key"); // ultraCartSimpleApiKey authentication
|
|
273
|
+
}
|
|
274
|
+
consumes = [
|
|
275
|
+
{ contentType: 'application/x-www-form-urlencoded' },
|
|
276
|
+
];
|
|
277
|
+
canConsumeForm = runtime.canConsumeForm(consumes);
|
|
278
|
+
useForm = false;
|
|
279
|
+
if (useForm) {
|
|
280
|
+
formParams = new FormData();
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
formParams = new URLSearchParams();
|
|
284
|
+
}
|
|
285
|
+
if (requestParameters.clientId !== undefined) {
|
|
286
|
+
formParams.append('client_id', requestParameters.clientId);
|
|
287
|
+
}
|
|
288
|
+
if (requestParameters.grantType !== undefined) {
|
|
289
|
+
formParams.append('grant_type', requestParameters.grantType);
|
|
290
|
+
}
|
|
291
|
+
if (requestParameters.deviceCode !== undefined) {
|
|
292
|
+
formParams.append('device_code', requestParameters.deviceCode);
|
|
293
|
+
}
|
|
294
|
+
if (requestParameters.refreshToken !== undefined) {
|
|
295
|
+
formParams.append('refresh_token', requestParameters.refreshToken);
|
|
296
|
+
}
|
|
297
|
+
return [4 /*yield*/, this.request({
|
|
298
|
+
path: "/conversation_embed/oauth/device/token",
|
|
299
|
+
method: 'POST',
|
|
300
|
+
headers: headerParameters,
|
|
301
|
+
query: queryParameters,
|
|
302
|
+
body: formParams,
|
|
303
|
+
}, initOverrides)];
|
|
304
|
+
case 3:
|
|
305
|
+
response = _c.sent();
|
|
306
|
+
return [2 /*return*/, new runtime.VoidApiResponse(response)];
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* Accepts grant_type=urn:ietf:params:oauth:grant-type:device_code or grant_type=refresh_token. Other grant types are rejected. Access tokens issued here expire in 60 minutes.
|
|
313
|
+
* Exchange a device_code or refresh_token for an access token (embed widget).
|
|
314
|
+
*/
|
|
315
|
+
ConversationEmbedApi.prototype.embedOauthToken = function (requestParameters, initOverrides) {
|
|
316
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
317
|
+
return __generator(this, function (_a) {
|
|
318
|
+
switch (_a.label) {
|
|
319
|
+
case 0: return [4 /*yield*/, this.embedOauthTokenRaw(requestParameters, initOverrides)];
|
|
320
|
+
case 1:
|
|
321
|
+
_a.sent();
|
|
322
|
+
return [2 /*return*/];
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* Returns a narrow subset of agent auth fields — only what the softphone widget needs to connect to the PBX relay. Twilio tokens, conversation JWTs, and chat/customer permissions are intentionally excluded.
|
|
329
|
+
* Get PBX authorization for the embedded softphone widget.
|
|
330
|
+
*/
|
|
331
|
+
ConversationEmbedApi.prototype.getEmbedPbxAuthRaw = function (initOverrides) {
|
|
332
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
333
|
+
var queryParameters, headerParameters, _a, _b, response;
|
|
334
|
+
return __generator(this, function (_c) {
|
|
335
|
+
switch (_c.label) {
|
|
336
|
+
case 0:
|
|
337
|
+
queryParameters = {};
|
|
338
|
+
headerParameters = {};
|
|
339
|
+
if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
|
|
340
|
+
// oauth required
|
|
341
|
+
_a = headerParameters;
|
|
342
|
+
_b = "Authorization";
|
|
343
|
+
return [4 /*yield*/, this.configuration.accessToken("ultraCartOauth", ["conversation_write"])];
|
|
344
|
+
case 1:
|
|
345
|
+
// oauth required
|
|
346
|
+
_a[_b] = _c.sent();
|
|
347
|
+
_c.label = 2;
|
|
348
|
+
case 2: return [4 /*yield*/, this.request({
|
|
349
|
+
path: "/conversation_embed/pbx-auth",
|
|
350
|
+
method: 'PUT',
|
|
351
|
+
headers: headerParameters,
|
|
352
|
+
query: queryParameters,
|
|
353
|
+
}, initOverrides)];
|
|
354
|
+
case 3:
|
|
355
|
+
response = _c.sent();
|
|
356
|
+
return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, models_1.ConversationEmbedPbxAuthResponseFromJSON)(jsonValue); })];
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
};
|
|
361
|
+
/**
|
|
362
|
+
* Returns a narrow subset of agent auth fields — only what the softphone widget needs to connect to the PBX relay. Twilio tokens, conversation JWTs, and chat/customer permissions are intentionally excluded.
|
|
363
|
+
* Get PBX authorization for the embedded softphone widget.
|
|
364
|
+
*/
|
|
365
|
+
ConversationEmbedApi.prototype.getEmbedPbxAuth = function (initOverrides) {
|
|
366
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
367
|
+
var response;
|
|
368
|
+
return __generator(this, function (_a) {
|
|
369
|
+
switch (_a.label) {
|
|
370
|
+
case 0: return [4 /*yield*/, this.getEmbedPbxAuthRaw(initOverrides)];
|
|
371
|
+
case 1:
|
|
372
|
+
response = _a.sent();
|
|
373
|
+
return [4 /*yield*/, response.value()];
|
|
374
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
});
|
|
378
|
+
};
|
|
379
|
+
return ConversationEmbedApi;
|
|
380
|
+
}(runtime.BaseAPI));
|
|
381
|
+
exports.ConversationEmbedApi = ConversationEmbedApi;
|
package/dist/apis/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './AutoOrderApi';
|
|
|
3
3
|
export * from './ChannelPartnerApi';
|
|
4
4
|
export * from './CheckoutApi';
|
|
5
5
|
export * from './ConversationApi';
|
|
6
|
+
export * from './ConversationEmbedApi';
|
|
6
7
|
export * from './CouponApi';
|
|
7
8
|
export * from './CustomerApi';
|
|
8
9
|
export * from './DatawarehouseApi';
|
package/dist/apis/index.js
CHANGED
|
@@ -21,6 +21,7 @@ __exportStar(require("./AutoOrderApi"), exports);
|
|
|
21
21
|
__exportStar(require("./ChannelPartnerApi"), exports);
|
|
22
22
|
__exportStar(require("./CheckoutApi"), exports);
|
|
23
23
|
__exportStar(require("./ConversationApi"), exports);
|
|
24
|
+
__exportStar(require("./ConversationEmbedApi"), exports);
|
|
24
25
|
__exportStar(require("./CouponApi"), exports);
|
|
25
26
|
__exportStar(require("./CustomerApi"), exports);
|
|
26
27
|
__exportStar(require("./DatawarehouseApi"), exports);
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @interface ConversationEmbedPbxAuthResponse
|
|
16
|
+
*/
|
|
17
|
+
export interface ConversationEmbedPbxAuthResponse {
|
|
18
|
+
/**
|
|
19
|
+
* Merchant identifier the agent belongs to.
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof ConversationEmbedPbxAuthResponse
|
|
22
|
+
*/
|
|
23
|
+
merchant_id?: string;
|
|
24
|
+
/**
|
|
25
|
+
* True if this agent has PBX admin privileges.
|
|
26
|
+
* @type {boolean}
|
|
27
|
+
* @memberof ConversationEmbedPbxAuthResponse
|
|
28
|
+
*/
|
|
29
|
+
pbx_admin?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* JWT used by the softphone widget to authenticate to the PBX WebSocket relay.
|
|
32
|
+
* @type {string}
|
|
33
|
+
* @memberof ConversationEmbedPbxAuthResponse
|
|
34
|
+
*/
|
|
35
|
+
pbx_jwt?: string;
|
|
36
|
+
/**
|
|
37
|
+
* True if this agent has PBX supervisor privileges.
|
|
38
|
+
* @type {boolean}
|
|
39
|
+
* @memberof ConversationEmbedPbxAuthResponse
|
|
40
|
+
*/
|
|
41
|
+
pbx_supervisor?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* True if this agent has baseline PBX access.
|
|
44
|
+
* @type {boolean}
|
|
45
|
+
* @memberof ConversationEmbedPbxAuthResponse
|
|
46
|
+
*/
|
|
47
|
+
pbx_user?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Voice identity string identifying this agent to the PBX (e.g., client:user_123).
|
|
50
|
+
* @type {string}
|
|
51
|
+
* @memberof ConversationEmbedPbxAuthResponse
|
|
52
|
+
*/
|
|
53
|
+
pbx_voice_identity?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Check if a given object implements the ConversationEmbedPbxAuthResponse interface.
|
|
57
|
+
*/
|
|
58
|
+
export declare function instanceOfConversationEmbedPbxAuthResponse(value: object): boolean;
|
|
59
|
+
export declare function ConversationEmbedPbxAuthResponseFromJSON(json: any): ConversationEmbedPbxAuthResponse;
|
|
60
|
+
export declare function ConversationEmbedPbxAuthResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ConversationEmbedPbxAuthResponse;
|
|
61
|
+
export declare function ConversationEmbedPbxAuthResponseToJSON(value?: ConversationEmbedPbxAuthResponse | null): any;
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.ConversationEmbedPbxAuthResponseToJSON = exports.ConversationEmbedPbxAuthResponseFromJSONTyped = exports.ConversationEmbedPbxAuthResponseFromJSON = exports.instanceOfConversationEmbedPbxAuthResponse = void 0;
|
|
17
|
+
var runtime_1 = require("../runtime");
|
|
18
|
+
/**
|
|
19
|
+
* Check if a given object implements the ConversationEmbedPbxAuthResponse interface.
|
|
20
|
+
*/
|
|
21
|
+
function instanceOfConversationEmbedPbxAuthResponse(value) {
|
|
22
|
+
var isInstance = true;
|
|
23
|
+
return isInstance;
|
|
24
|
+
}
|
|
25
|
+
exports.instanceOfConversationEmbedPbxAuthResponse = instanceOfConversationEmbedPbxAuthResponse;
|
|
26
|
+
function ConversationEmbedPbxAuthResponseFromJSON(json) {
|
|
27
|
+
return ConversationEmbedPbxAuthResponseFromJSONTyped(json, false);
|
|
28
|
+
}
|
|
29
|
+
exports.ConversationEmbedPbxAuthResponseFromJSON = ConversationEmbedPbxAuthResponseFromJSON;
|
|
30
|
+
function ConversationEmbedPbxAuthResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
31
|
+
if ((json === undefined) || (json === null)) {
|
|
32
|
+
return json;
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
'merchant_id': !(0, runtime_1.exists)(json, 'merchant_id') ? undefined : json['merchant_id'],
|
|
36
|
+
'pbx_admin': !(0, runtime_1.exists)(json, 'pbx_admin') ? undefined : json['pbx_admin'],
|
|
37
|
+
'pbx_jwt': !(0, runtime_1.exists)(json, 'pbx_jwt') ? undefined : json['pbx_jwt'],
|
|
38
|
+
'pbx_supervisor': !(0, runtime_1.exists)(json, 'pbx_supervisor') ? undefined : json['pbx_supervisor'],
|
|
39
|
+
'pbx_user': !(0, runtime_1.exists)(json, 'pbx_user') ? undefined : json['pbx_user'],
|
|
40
|
+
'pbx_voice_identity': !(0, runtime_1.exists)(json, 'pbx_voice_identity') ? undefined : json['pbx_voice_identity'],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
exports.ConversationEmbedPbxAuthResponseFromJSONTyped = ConversationEmbedPbxAuthResponseFromJSONTyped;
|
|
44
|
+
function ConversationEmbedPbxAuthResponseToJSON(value) {
|
|
45
|
+
if (value === undefined) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
if (value === null) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
'merchant_id': value.merchant_id,
|
|
53
|
+
'pbx_admin': value.pbx_admin,
|
|
54
|
+
'pbx_jwt': value.pbx_jwt,
|
|
55
|
+
'pbx_supervisor': value.pbx_supervisor,
|
|
56
|
+
'pbx_user': value.pbx_user,
|
|
57
|
+
'pbx_voice_identity': value.pbx_voice_identity,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
exports.ConversationEmbedPbxAuthResponseToJSON = ConversationEmbedPbxAuthResponseToJSON;
|
package/dist/models/index.d.ts
CHANGED
|
@@ -149,6 +149,7 @@ export * from './ConversationDepartmentMember';
|
|
|
149
149
|
export * from './ConversationDepartmentMembersResponse';
|
|
150
150
|
export * from './ConversationDepartmentResponse';
|
|
151
151
|
export * from './ConversationDepartmentsResponse';
|
|
152
|
+
export * from './ConversationEmbedPbxAuthResponse';
|
|
152
153
|
export * from './ConversationEngagement';
|
|
153
154
|
export * from './ConversationEngagementEquation';
|
|
154
155
|
export * from './ConversationEngagementEquationFunction';
|
package/dist/models/index.js
CHANGED
|
@@ -167,6 +167,7 @@ __exportStar(require("./ConversationDepartmentMember"), exports);
|
|
|
167
167
|
__exportStar(require("./ConversationDepartmentMembersResponse"), exports);
|
|
168
168
|
__exportStar(require("./ConversationDepartmentResponse"), exports);
|
|
169
169
|
__exportStar(require("./ConversationDepartmentsResponse"), exports);
|
|
170
|
+
__exportStar(require("./ConversationEmbedPbxAuthResponse"), exports);
|
|
170
171
|
__exportStar(require("./ConversationEngagement"), exports);
|
|
171
172
|
__exportStar(require("./ConversationEngagementEquation"), exports);
|
|
172
173
|
__exportStar(require("./ConversationEngagementEquationFunction"), exports);
|
package/package.json
CHANGED
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* UltraCart Rest API V2
|
|
5
|
+
* UltraCart REST API Version 2
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 2.0.0
|
|
8
|
+
* Contact: support@ultracart.com
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
import * as runtime from '../runtime';
|
|
17
|
+
import {
|
|
18
|
+
ConversationEmbedPbxAuthResponse,
|
|
19
|
+
ConversationEmbedPbxAuthResponseFromJSON,
|
|
20
|
+
ConversationEmbedPbxAuthResponseToJSON,
|
|
21
|
+
ErrorResponse,
|
|
22
|
+
ErrorResponseFromJSON,
|
|
23
|
+
ErrorResponseToJSON,
|
|
24
|
+
} from '../models';
|
|
25
|
+
|
|
26
|
+
export interface EmbedOauthDeviceAuthorizeRequest {
|
|
27
|
+
clientId: string;
|
|
28
|
+
scope: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface EmbedOauthRevokeRequest {
|
|
32
|
+
clientId: string;
|
|
33
|
+
token: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface EmbedOauthTokenRequest {
|
|
37
|
+
clientId: string;
|
|
38
|
+
grantType: string;
|
|
39
|
+
deviceCode?: string;
|
|
40
|
+
refreshToken?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* ConversationEmbedApi - interface
|
|
45
|
+
*
|
|
46
|
+
* @export
|
|
47
|
+
* @interface ConversationEmbedApiInterface
|
|
48
|
+
*/
|
|
49
|
+
export interface ConversationEmbedApiInterface {
|
|
50
|
+
/**
|
|
51
|
+
* RFC 8628 device authorization. Only the embed widget\'s client_id and the crm_embed scope are accepted.
|
|
52
|
+
* @summary Initiate a device authorization flow for an embed widget.
|
|
53
|
+
* @param {string} clientId The embed widget OAuth client_id.
|
|
54
|
+
* @param {string} scope The application-level scope (must be \\\'crm_embed\\\').
|
|
55
|
+
* @param {*} [options] Override http request option.
|
|
56
|
+
* @throws {RequiredError}
|
|
57
|
+
* @memberof ConversationEmbedApiInterface
|
|
58
|
+
*/
|
|
59
|
+
embedOauthDeviceAuthorizeRaw(requestParameters: EmbedOauthDeviceAuthorizeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* RFC 8628 device authorization. Only the embed widget\'s client_id and the crm_embed scope are accepted.
|
|
63
|
+
* Initiate a device authorization flow for an embed widget.
|
|
64
|
+
*/
|
|
65
|
+
embedOauthDeviceAuthorize(requestParameters: EmbedOauthDeviceAuthorizeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* RFC 7009 style — the token itself is proof of possession. Accepts either an access token or a refresh token in the \'token\' parameter.
|
|
69
|
+
* @summary Revoke an embed widget access or refresh token.
|
|
70
|
+
* @param {string} clientId The embed widget OAuth client_id.
|
|
71
|
+
* @param {string} token The token to revoke (access token or refresh token).
|
|
72
|
+
* @param {*} [options] Override http request option.
|
|
73
|
+
* @throws {RequiredError}
|
|
74
|
+
* @memberof ConversationEmbedApiInterface
|
|
75
|
+
*/
|
|
76
|
+
embedOauthRevokeRaw(requestParameters: EmbedOauthRevokeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* RFC 7009 style — the token itself is proof of possession. Accepts either an access token or a refresh token in the \'token\' parameter.
|
|
80
|
+
* Revoke an embed widget access or refresh token.
|
|
81
|
+
*/
|
|
82
|
+
embedOauthRevoke(requestParameters: EmbedOauthRevokeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Accepts grant_type=urn:ietf:params:oauth:grant-type:device_code or grant_type=refresh_token. Other grant types are rejected. Access tokens issued here expire in 60 minutes.
|
|
86
|
+
* @summary Exchange a device_code or refresh_token for an access token (embed widget).
|
|
87
|
+
* @param {string} clientId The embed widget OAuth client_id.
|
|
88
|
+
* @param {string} grantType Grant type.
|
|
89
|
+
* @param {string} [deviceCode] The device code received from /oauth/device/authorize (required for device_code grant).
|
|
90
|
+
* @param {string} [refreshToken] The refresh token (required for refresh_token grant).
|
|
91
|
+
* @param {*} [options] Override http request option.
|
|
92
|
+
* @throws {RequiredError}
|
|
93
|
+
* @memberof ConversationEmbedApiInterface
|
|
94
|
+
*/
|
|
95
|
+
embedOauthTokenRaw(requestParameters: EmbedOauthTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Accepts grant_type=urn:ietf:params:oauth:grant-type:device_code or grant_type=refresh_token. Other grant types are rejected. Access tokens issued here expire in 60 minutes.
|
|
99
|
+
* Exchange a device_code or refresh_token for an access token (embed widget).
|
|
100
|
+
*/
|
|
101
|
+
embedOauthToken(requestParameters: EmbedOauthTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Returns a narrow subset of agent auth fields — only what the softphone widget needs to connect to the PBX relay. Twilio tokens, conversation JWTs, and chat/customer permissions are intentionally excluded.
|
|
105
|
+
* @summary Get PBX authorization for the embedded softphone widget.
|
|
106
|
+
* @param {*} [options] Override http request option.
|
|
107
|
+
* @throws {RequiredError}
|
|
108
|
+
* @memberof ConversationEmbedApiInterface
|
|
109
|
+
*/
|
|
110
|
+
getEmbedPbxAuthRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ConversationEmbedPbxAuthResponse>>;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Returns a narrow subset of agent auth fields — only what the softphone widget needs to connect to the PBX relay. Twilio tokens, conversation JWTs, and chat/customer permissions are intentionally excluded.
|
|
114
|
+
* Get PBX authorization for the embedded softphone widget.
|
|
115
|
+
*/
|
|
116
|
+
getEmbedPbxAuth(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ConversationEmbedPbxAuthResponse>;
|
|
117
|
+
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
*
|
|
122
|
+
*/
|
|
123
|
+
export class ConversationEmbedApi extends runtime.BaseAPI implements ConversationEmbedApiInterface {
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* RFC 8628 device authorization. Only the embed widget\'s client_id and the crm_embed scope are accepted.
|
|
127
|
+
* Initiate a device authorization flow for an embed widget.
|
|
128
|
+
*/
|
|
129
|
+
async embedOauthDeviceAuthorizeRaw(requestParameters: EmbedOauthDeviceAuthorizeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
130
|
+
if (requestParameters.clientId === null || requestParameters.clientId === undefined) {
|
|
131
|
+
throw new runtime.RequiredError('clientId','Required parameter requestParameters.clientId was null or undefined when calling embedOauthDeviceAuthorize.');
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (requestParameters.scope === null || requestParameters.scope === undefined) {
|
|
135
|
+
throw new runtime.RequiredError('scope','Required parameter requestParameters.scope was null or undefined when calling embedOauthDeviceAuthorize.');
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const queryParameters: any = {};
|
|
139
|
+
|
|
140
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
141
|
+
|
|
142
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
143
|
+
headerParameters["x-ultracart-browser-key"] = this.configuration.apiKey("x-ultracart-browser-key"); // ultraCartBrowserApiKey authentication
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
147
|
+
// oauth required
|
|
148
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("ultraCartOauth", ["affiliate_read", "affiliate_write", "auto_order_read", "auto_order_write", "channel_partner_read", "channel_partner_write", "chargeback_read", "chargeback_write", "checkout_read", "checkout_write", "configuration_read", "configuration_write", "conversation_read", "conversation_write", "coupon_read", "coupon_write", "customer_read", "customer_write", "fulfillment_read", "fulfillment_write", "gift_certificate_read", "gift_certificate_write", "integration_log_read", "integration_log_write", "order_read", "order_write", "item_read", "item_write", "storefront_read", "storefront_write", "tax_read", "tax_write", "webhook_read", "webhook_write", "ultrabooks_read", "ultrabooks_write", "user_read", "user_write", "workflow_read", "workflow_write"]);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
152
|
+
headerParameters["x-ultracart-simple-key"] = this.configuration.apiKey("x-ultracart-simple-key"); // ultraCartSimpleApiKey authentication
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const consumes: runtime.Consume[] = [
|
|
156
|
+
{ contentType: 'application/x-www-form-urlencoded' },
|
|
157
|
+
];
|
|
158
|
+
// @ts-ignore: canConsumeForm may be unused
|
|
159
|
+
const canConsumeForm = runtime.canConsumeForm(consumes);
|
|
160
|
+
|
|
161
|
+
let formParams: { append(param: string, value: any): any };
|
|
162
|
+
let useForm = false;
|
|
163
|
+
if (useForm) {
|
|
164
|
+
formParams = new FormData();
|
|
165
|
+
} else {
|
|
166
|
+
formParams = new URLSearchParams();
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (requestParameters.clientId !== undefined) {
|
|
170
|
+
formParams.append('client_id', requestParameters.clientId as any);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (requestParameters.scope !== undefined) {
|
|
174
|
+
formParams.append('scope', requestParameters.scope as any);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const response = await this.request({
|
|
178
|
+
path: `/conversation_embed/oauth/device/authorize`,
|
|
179
|
+
method: 'POST',
|
|
180
|
+
headers: headerParameters,
|
|
181
|
+
query: queryParameters,
|
|
182
|
+
body: formParams,
|
|
183
|
+
}, initOverrides);
|
|
184
|
+
|
|
185
|
+
return new runtime.VoidApiResponse(response);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* RFC 8628 device authorization. Only the embed widget\'s client_id and the crm_embed scope are accepted.
|
|
190
|
+
* Initiate a device authorization flow for an embed widget.
|
|
191
|
+
*/
|
|
192
|
+
async embedOauthDeviceAuthorize(requestParameters: EmbedOauthDeviceAuthorizeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
193
|
+
await this.embedOauthDeviceAuthorizeRaw(requestParameters, initOverrides);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* RFC 7009 style — the token itself is proof of possession. Accepts either an access token or a refresh token in the \'token\' parameter.
|
|
198
|
+
* Revoke an embed widget access or refresh token.
|
|
199
|
+
*/
|
|
200
|
+
async embedOauthRevokeRaw(requestParameters: EmbedOauthRevokeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
201
|
+
if (requestParameters.clientId === null || requestParameters.clientId === undefined) {
|
|
202
|
+
throw new runtime.RequiredError('clientId','Required parameter requestParameters.clientId was null or undefined when calling embedOauthRevoke.');
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (requestParameters.token === null || requestParameters.token === undefined) {
|
|
206
|
+
throw new runtime.RequiredError('token','Required parameter requestParameters.token was null or undefined when calling embedOauthRevoke.');
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const queryParameters: any = {};
|
|
210
|
+
|
|
211
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
212
|
+
|
|
213
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
214
|
+
headerParameters["x-ultracart-browser-key"] = this.configuration.apiKey("x-ultracart-browser-key"); // ultraCartBrowserApiKey authentication
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
218
|
+
// oauth required
|
|
219
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("ultraCartOauth", ["affiliate_read", "affiliate_write", "auto_order_read", "auto_order_write", "channel_partner_read", "channel_partner_write", "chargeback_read", "chargeback_write", "checkout_read", "checkout_write", "configuration_read", "configuration_write", "conversation_read", "conversation_write", "coupon_read", "coupon_write", "customer_read", "customer_write", "fulfillment_read", "fulfillment_write", "gift_certificate_read", "gift_certificate_write", "integration_log_read", "integration_log_write", "order_read", "order_write", "item_read", "item_write", "storefront_read", "storefront_write", "tax_read", "tax_write", "webhook_read", "webhook_write", "ultrabooks_read", "ultrabooks_write", "user_read", "user_write", "workflow_read", "workflow_write"]);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
223
|
+
headerParameters["x-ultracart-simple-key"] = this.configuration.apiKey("x-ultracart-simple-key"); // ultraCartSimpleApiKey authentication
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const consumes: runtime.Consume[] = [
|
|
227
|
+
{ contentType: 'application/x-www-form-urlencoded' },
|
|
228
|
+
];
|
|
229
|
+
// @ts-ignore: canConsumeForm may be unused
|
|
230
|
+
const canConsumeForm = runtime.canConsumeForm(consumes);
|
|
231
|
+
|
|
232
|
+
let formParams: { append(param: string, value: any): any };
|
|
233
|
+
let useForm = false;
|
|
234
|
+
if (useForm) {
|
|
235
|
+
formParams = new FormData();
|
|
236
|
+
} else {
|
|
237
|
+
formParams = new URLSearchParams();
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (requestParameters.clientId !== undefined) {
|
|
241
|
+
formParams.append('client_id', requestParameters.clientId as any);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (requestParameters.token !== undefined) {
|
|
245
|
+
formParams.append('token', requestParameters.token as any);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
const response = await this.request({
|
|
249
|
+
path: `/conversation_embed/oauth/device/revoke`,
|
|
250
|
+
method: 'POST',
|
|
251
|
+
headers: headerParameters,
|
|
252
|
+
query: queryParameters,
|
|
253
|
+
body: formParams,
|
|
254
|
+
}, initOverrides);
|
|
255
|
+
|
|
256
|
+
return new runtime.VoidApiResponse(response);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* RFC 7009 style — the token itself is proof of possession. Accepts either an access token or a refresh token in the \'token\' parameter.
|
|
261
|
+
* Revoke an embed widget access or refresh token.
|
|
262
|
+
*/
|
|
263
|
+
async embedOauthRevoke(requestParameters: EmbedOauthRevokeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
264
|
+
await this.embedOauthRevokeRaw(requestParameters, initOverrides);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Accepts grant_type=urn:ietf:params:oauth:grant-type:device_code or grant_type=refresh_token. Other grant types are rejected. Access tokens issued here expire in 60 minutes.
|
|
269
|
+
* Exchange a device_code or refresh_token for an access token (embed widget).
|
|
270
|
+
*/
|
|
271
|
+
async embedOauthTokenRaw(requestParameters: EmbedOauthTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
272
|
+
if (requestParameters.clientId === null || requestParameters.clientId === undefined) {
|
|
273
|
+
throw new runtime.RequiredError('clientId','Required parameter requestParameters.clientId was null or undefined when calling embedOauthToken.');
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if (requestParameters.grantType === null || requestParameters.grantType === undefined) {
|
|
277
|
+
throw new runtime.RequiredError('grantType','Required parameter requestParameters.grantType was null or undefined when calling embedOauthToken.');
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const queryParameters: any = {};
|
|
281
|
+
|
|
282
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
283
|
+
|
|
284
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
285
|
+
headerParameters["x-ultracart-browser-key"] = this.configuration.apiKey("x-ultracart-browser-key"); // ultraCartBrowserApiKey authentication
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
289
|
+
// oauth required
|
|
290
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("ultraCartOauth", ["affiliate_read", "affiliate_write", "auto_order_read", "auto_order_write", "channel_partner_read", "channel_partner_write", "chargeback_read", "chargeback_write", "checkout_read", "checkout_write", "configuration_read", "configuration_write", "conversation_read", "conversation_write", "coupon_read", "coupon_write", "customer_read", "customer_write", "fulfillment_read", "fulfillment_write", "gift_certificate_read", "gift_certificate_write", "integration_log_read", "integration_log_write", "order_read", "order_write", "item_read", "item_write", "storefront_read", "storefront_write", "tax_read", "tax_write", "webhook_read", "webhook_write", "ultrabooks_read", "ultrabooks_write", "user_read", "user_write", "workflow_read", "workflow_write"]);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
294
|
+
headerParameters["x-ultracart-simple-key"] = this.configuration.apiKey("x-ultracart-simple-key"); // ultraCartSimpleApiKey authentication
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const consumes: runtime.Consume[] = [
|
|
298
|
+
{ contentType: 'application/x-www-form-urlencoded' },
|
|
299
|
+
];
|
|
300
|
+
// @ts-ignore: canConsumeForm may be unused
|
|
301
|
+
const canConsumeForm = runtime.canConsumeForm(consumes);
|
|
302
|
+
|
|
303
|
+
let formParams: { append(param: string, value: any): any };
|
|
304
|
+
let useForm = false;
|
|
305
|
+
if (useForm) {
|
|
306
|
+
formParams = new FormData();
|
|
307
|
+
} else {
|
|
308
|
+
formParams = new URLSearchParams();
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
if (requestParameters.clientId !== undefined) {
|
|
312
|
+
formParams.append('client_id', requestParameters.clientId as any);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
if (requestParameters.grantType !== undefined) {
|
|
316
|
+
formParams.append('grant_type', requestParameters.grantType as any);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (requestParameters.deviceCode !== undefined) {
|
|
320
|
+
formParams.append('device_code', requestParameters.deviceCode as any);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (requestParameters.refreshToken !== undefined) {
|
|
324
|
+
formParams.append('refresh_token', requestParameters.refreshToken as any);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
const response = await this.request({
|
|
328
|
+
path: `/conversation_embed/oauth/device/token`,
|
|
329
|
+
method: 'POST',
|
|
330
|
+
headers: headerParameters,
|
|
331
|
+
query: queryParameters,
|
|
332
|
+
body: formParams,
|
|
333
|
+
}, initOverrides);
|
|
334
|
+
|
|
335
|
+
return new runtime.VoidApiResponse(response);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Accepts grant_type=urn:ietf:params:oauth:grant-type:device_code or grant_type=refresh_token. Other grant types are rejected. Access tokens issued here expire in 60 minutes.
|
|
340
|
+
* Exchange a device_code or refresh_token for an access token (embed widget).
|
|
341
|
+
*/
|
|
342
|
+
async embedOauthToken(requestParameters: EmbedOauthTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
343
|
+
await this.embedOauthTokenRaw(requestParameters, initOverrides);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Returns a narrow subset of agent auth fields — only what the softphone widget needs to connect to the PBX relay. Twilio tokens, conversation JWTs, and chat/customer permissions are intentionally excluded.
|
|
348
|
+
* Get PBX authorization for the embedded softphone widget.
|
|
349
|
+
*/
|
|
350
|
+
async getEmbedPbxAuthRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ConversationEmbedPbxAuthResponse>> {
|
|
351
|
+
const queryParameters: any = {};
|
|
352
|
+
|
|
353
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
354
|
+
|
|
355
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
356
|
+
// oauth required
|
|
357
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("ultraCartOauth", ["conversation_write"]);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
const response = await this.request({
|
|
361
|
+
path: `/conversation_embed/pbx-auth`,
|
|
362
|
+
method: 'PUT',
|
|
363
|
+
headers: headerParameters,
|
|
364
|
+
query: queryParameters,
|
|
365
|
+
}, initOverrides);
|
|
366
|
+
|
|
367
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => ConversationEmbedPbxAuthResponseFromJSON(jsonValue));
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Returns a narrow subset of agent auth fields — only what the softphone widget needs to connect to the PBX relay. Twilio tokens, conversation JWTs, and chat/customer permissions are intentionally excluded.
|
|
372
|
+
* Get PBX authorization for the embedded softphone widget.
|
|
373
|
+
*/
|
|
374
|
+
async getEmbedPbxAuth(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ConversationEmbedPbxAuthResponse> {
|
|
375
|
+
const response = await this.getEmbedPbxAuthRaw(initOverrides);
|
|
376
|
+
return await response.value();
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
}
|
package/src/apis/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './AutoOrderApi';
|
|
|
5
5
|
export * from './ChannelPartnerApi';
|
|
6
6
|
export * from './CheckoutApi';
|
|
7
7
|
export * from './ConversationApi';
|
|
8
|
+
export * from './ConversationEmbedApi';
|
|
8
9
|
export * from './CouponApi';
|
|
9
10
|
export * from './CustomerApi';
|
|
10
11
|
export * from './DatawarehouseApi';
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* UltraCart Rest API V2
|
|
5
|
+
* UltraCart REST API Version 2
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 2.0.0
|
|
8
|
+
* Contact: support@ultracart.com
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { exists, mapValues } from '../runtime';
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @export
|
|
19
|
+
* @interface ConversationEmbedPbxAuthResponse
|
|
20
|
+
*/
|
|
21
|
+
export interface ConversationEmbedPbxAuthResponse {
|
|
22
|
+
/**
|
|
23
|
+
* Merchant identifier the agent belongs to.
|
|
24
|
+
* @type {string}
|
|
25
|
+
* @memberof ConversationEmbedPbxAuthResponse
|
|
26
|
+
*/
|
|
27
|
+
merchant_id?: string;
|
|
28
|
+
/**
|
|
29
|
+
* True if this agent has PBX admin privileges.
|
|
30
|
+
* @type {boolean}
|
|
31
|
+
* @memberof ConversationEmbedPbxAuthResponse
|
|
32
|
+
*/
|
|
33
|
+
pbx_admin?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* JWT used by the softphone widget to authenticate to the PBX WebSocket relay.
|
|
36
|
+
* @type {string}
|
|
37
|
+
* @memberof ConversationEmbedPbxAuthResponse
|
|
38
|
+
*/
|
|
39
|
+
pbx_jwt?: string;
|
|
40
|
+
/**
|
|
41
|
+
* True if this agent has PBX supervisor privileges.
|
|
42
|
+
* @type {boolean}
|
|
43
|
+
* @memberof ConversationEmbedPbxAuthResponse
|
|
44
|
+
*/
|
|
45
|
+
pbx_supervisor?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* True if this agent has baseline PBX access.
|
|
48
|
+
* @type {boolean}
|
|
49
|
+
* @memberof ConversationEmbedPbxAuthResponse
|
|
50
|
+
*/
|
|
51
|
+
pbx_user?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Voice identity string identifying this agent to the PBX (e.g., client:user_123).
|
|
54
|
+
* @type {string}
|
|
55
|
+
* @memberof ConversationEmbedPbxAuthResponse
|
|
56
|
+
*/
|
|
57
|
+
pbx_voice_identity?: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Check if a given object implements the ConversationEmbedPbxAuthResponse interface.
|
|
64
|
+
*/
|
|
65
|
+
export function instanceOfConversationEmbedPbxAuthResponse(value: object): boolean {
|
|
66
|
+
let isInstance = true;
|
|
67
|
+
|
|
68
|
+
return isInstance;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function ConversationEmbedPbxAuthResponseFromJSON(json: any): ConversationEmbedPbxAuthResponse {
|
|
72
|
+
return ConversationEmbedPbxAuthResponseFromJSONTyped(json, false);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function ConversationEmbedPbxAuthResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ConversationEmbedPbxAuthResponse {
|
|
76
|
+
if ((json === undefined) || (json === null)) {
|
|
77
|
+
return json;
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
|
|
81
|
+
'merchant_id': !exists(json, 'merchant_id') ? undefined : json['merchant_id'],
|
|
82
|
+
'pbx_admin': !exists(json, 'pbx_admin') ? undefined : json['pbx_admin'],
|
|
83
|
+
'pbx_jwt': !exists(json, 'pbx_jwt') ? undefined : json['pbx_jwt'],
|
|
84
|
+
'pbx_supervisor': !exists(json, 'pbx_supervisor') ? undefined : json['pbx_supervisor'],
|
|
85
|
+
'pbx_user': !exists(json, 'pbx_user') ? undefined : json['pbx_user'],
|
|
86
|
+
'pbx_voice_identity': !exists(json, 'pbx_voice_identity') ? undefined : json['pbx_voice_identity'],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function ConversationEmbedPbxAuthResponseToJSON(value?: ConversationEmbedPbxAuthResponse | null): any {
|
|
91
|
+
if (value === undefined) {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
if (value === null) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
|
|
99
|
+
'merchant_id': value.merchant_id,
|
|
100
|
+
'pbx_admin': value.pbx_admin,
|
|
101
|
+
'pbx_jwt': value.pbx_jwt,
|
|
102
|
+
'pbx_supervisor': value.pbx_supervisor,
|
|
103
|
+
'pbx_user': value.pbx_user,
|
|
104
|
+
'pbx_voice_identity': value.pbx_voice_identity,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
package/src/models/index.ts
CHANGED
|
@@ -151,6 +151,7 @@ export * from './ConversationDepartmentMember';
|
|
|
151
151
|
export * from './ConversationDepartmentMembersResponse';
|
|
152
152
|
export * from './ConversationDepartmentResponse';
|
|
153
153
|
export * from './ConversationDepartmentsResponse';
|
|
154
|
+
export * from './ConversationEmbedPbxAuthResponse';
|
|
154
155
|
export * from './ConversationEngagement';
|
|
155
156
|
export * from './ConversationEngagementEquation';
|
|
156
157
|
export * from './ConversationEngagementEquationFunction';
|