@surgeapi/node 0.25.3 → 0.25.4
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/Client.d.ts +6 -0
- package/Client.js +20 -10
- package/README.md +3 -5
- package/api/index.d.ts +1 -1
- package/api/index.js +1 -1
- package/api/resources/accounts/client/Client.d.ts +57 -0
- package/api/resources/accounts/client/Client.js +167 -0
- package/api/resources/accounts/client/index.d.ts +1 -0
- package/api/resources/accounts/client/index.js +17 -0
- package/api/resources/accounts/client/requests/CreateAccountRequest.d.ts +16 -0
- package/api/resources/accounts/client/requests/CreateAccountRequest.js +5 -0
- package/api/resources/accounts/client/requests/UpdateAccountRequest.d.ts +16 -0
- package/api/resources/accounts/client/requests/UpdateAccountRequest.js +5 -0
- package/api/resources/accounts/client/requests/index.d.ts +2 -0
- package/api/resources/accounts/client/requests/index.js +2 -0
- package/api/resources/accounts/index.d.ts +1 -0
- package/api/resources/accounts/index.js +17 -0
- package/api/resources/blasts/client/Client.js +1 -1
- package/api/resources/contacts/client/Client.d.ts +2 -2
- package/api/resources/contacts/client/Client.js +7 -7
- package/api/resources/index.d.ts +5 -0
- package/api/resources/index.js +6 -1
- package/api/resources/messages/client/Client.d.ts +1 -3
- package/api/resources/messages/client/Client.js +2 -4
- package/api/resources/messages/client/requests/MessageRequest.d.ts +3 -3
- package/api/resources/phoneNumbers/client/Client.d.ts +44 -0
- package/api/resources/phoneNumbers/client/Client.js +117 -0
- package/api/resources/phoneNumbers/client/index.d.ts +1 -0
- package/api/resources/phoneNumbers/client/index.js +17 -0
- package/api/resources/phoneNumbers/client/requests/CreatePhoneNumberRequest.d.ts +17 -0
- package/api/resources/phoneNumbers/client/requests/CreatePhoneNumberRequest.js +5 -0
- package/api/resources/phoneNumbers/client/requests/index.d.ts +1 -0
- package/api/resources/phoneNumbers/client/requests/index.js +2 -0
- package/api/resources/phoneNumbers/index.d.ts +2 -0
- package/api/resources/phoneNumbers/index.js +18 -0
- package/api/resources/phoneNumbers/types/CreatePhoneNumberRequestType.d.ts +11 -0
- package/api/resources/phoneNumbers/types/CreatePhoneNumberRequestType.js +10 -0
- package/api/resources/phoneNumbers/types/index.d.ts +1 -0
- package/api/resources/phoneNumbers/types/index.js +17 -0
- package/api/resources/users/client/Client.d.ts +2 -2
- package/api/resources/users/client/Client.js +4 -4
- package/api/resources/verifications/client/Client.js +2 -2
- package/api/types/AccountResponse.d.ts +14 -0
- package/api/types/AccountResponse.js +5 -0
- package/api/types/Conversation.d.ts +1 -0
- package/api/types/ConversationPhoneNumber.d.ts +15 -0
- package/api/types/ConversationPhoneNumber.js +5 -0
- package/api/types/ConversationPhoneNumberType.d.ts +13 -0
- package/api/types/ConversationPhoneNumberType.js +12 -0
- package/api/types/MessageConversationContactParams.d.ts +0 -2
- package/api/types/MessageConversationParams.d.ts +3 -3
- package/api/types/PhoneNumber.d.ts +15 -0
- package/api/types/PhoneNumber.js +5 -0
- package/api/types/PhoneNumberType.d.ts +11 -0
- package/api/types/PhoneNumberType.js +10 -0
- package/api/types/index.d.ts +5 -0
- package/api/types/index.js +5 -0
- package/dist/Client.d.ts +6 -0
- package/dist/Client.js +20 -10
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/resources/accounts/client/Client.d.ts +57 -0
- package/dist/api/resources/accounts/client/Client.js +167 -0
- package/dist/api/resources/accounts/client/index.d.ts +1 -0
- package/dist/api/resources/accounts/client/index.js +17 -0
- package/dist/api/resources/accounts/client/requests/CreateAccountRequest.d.ts +16 -0
- package/dist/api/resources/accounts/client/requests/CreateAccountRequest.js +5 -0
- package/dist/api/resources/accounts/client/requests/UpdateAccountRequest.d.ts +16 -0
- package/dist/api/resources/accounts/client/requests/UpdateAccountRequest.js +5 -0
- package/dist/api/resources/accounts/client/requests/index.d.ts +2 -0
- package/dist/api/resources/accounts/client/requests/index.js +2 -0
- package/dist/api/resources/accounts/index.d.ts +1 -0
- package/dist/api/resources/accounts/index.js +17 -0
- package/dist/api/resources/blasts/client/Client.js +1 -1
- package/dist/api/resources/contacts/client/Client.d.ts +2 -2
- package/dist/api/resources/contacts/client/Client.js +7 -7
- package/dist/api/resources/index.d.ts +5 -0
- package/dist/api/resources/index.js +6 -1
- package/dist/api/resources/messages/client/Client.d.ts +1 -3
- package/dist/api/resources/messages/client/Client.js +2 -4
- package/dist/api/resources/messages/client/requests/MessageRequest.d.ts +3 -3
- package/dist/api/resources/phoneNumbers/client/Client.d.ts +44 -0
- package/dist/api/resources/phoneNumbers/client/Client.js +117 -0
- package/dist/api/resources/phoneNumbers/client/index.d.ts +1 -0
- package/dist/api/resources/phoneNumbers/client/index.js +17 -0
- package/dist/api/resources/phoneNumbers/client/requests/CreatePhoneNumberRequest.d.ts +17 -0
- package/dist/api/resources/phoneNumbers/client/requests/CreatePhoneNumberRequest.js +5 -0
- package/dist/api/resources/phoneNumbers/client/requests/index.d.ts +1 -0
- package/dist/api/resources/phoneNumbers/client/requests/index.js +2 -0
- package/dist/api/resources/phoneNumbers/index.d.ts +2 -0
- package/dist/api/resources/phoneNumbers/index.js +18 -0
- package/dist/api/resources/phoneNumbers/types/CreatePhoneNumberRequestType.d.ts +11 -0
- package/dist/api/resources/phoneNumbers/types/CreatePhoneNumberRequestType.js +10 -0
- package/dist/api/resources/phoneNumbers/types/index.d.ts +1 -0
- package/dist/api/resources/phoneNumbers/types/index.js +17 -0
- package/dist/api/resources/users/client/Client.d.ts +2 -2
- package/dist/api/resources/users/client/Client.js +4 -4
- package/dist/api/resources/verifications/client/Client.js +2 -2
- package/dist/api/types/AccountResponse.d.ts +14 -0
- package/dist/api/types/AccountResponse.js +5 -0
- package/dist/api/types/Conversation.d.ts +1 -0
- package/dist/api/types/ConversationPhoneNumber.d.ts +15 -0
- package/dist/api/types/ConversationPhoneNumber.js +5 -0
- package/dist/api/types/ConversationPhoneNumberType.d.ts +13 -0
- package/dist/api/types/ConversationPhoneNumberType.js +12 -0
- package/dist/api/types/MessageConversationContactParams.d.ts +0 -2
- package/dist/api/types/MessageConversationParams.d.ts +3 -3
- package/dist/api/types/PhoneNumber.d.ts +15 -0
- package/dist/api/types/PhoneNumber.js +5 -0
- package/dist/api/types/PhoneNumberType.d.ts +11 -0
- package/dist/api/types/PhoneNumberType.js +10 -0
- package/dist/api/types/index.d.ts +5 -0
- package/dist/api/types/index.js +5 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/reference.md +222 -6
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
39
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
40
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
41
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
42
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
43
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
44
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
+
};
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.PhoneNumbers = void 0;
|
|
52
|
+
const environments = __importStar(require("../../../../environments"));
|
|
53
|
+
const core = __importStar(require("../../../../core"));
|
|
54
|
+
const url_join_1 = __importDefault(require("url-join"));
|
|
55
|
+
const errors = __importStar(require("../../../../errors/index"));
|
|
56
|
+
class PhoneNumbers {
|
|
57
|
+
constructor(_options) {
|
|
58
|
+
this._options = _options;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Create a new phone number for the account.
|
|
62
|
+
*
|
|
63
|
+
* @param {string} accountId - The account for which the phone number should be created.
|
|
64
|
+
* @param {Surge.CreatePhoneNumberRequest} request
|
|
65
|
+
* @param {PhoneNumbers.RequestOptions} requestOptions - Request-specific configuration.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* await client.phoneNumbers.create("acct_01j9a43avnfqzbjfch6pygv1td", {
|
|
69
|
+
* area_code: "801",
|
|
70
|
+
* type: "local"
|
|
71
|
+
* })
|
|
72
|
+
*/
|
|
73
|
+
create(accountId, request, requestOptions) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
var _a, _b, _c;
|
|
76
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
77
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SurgeEnvironment.Default, `accounts/${encodeURIComponent(accountId)}/phone_numbers`),
|
|
78
|
+
method: "POST",
|
|
79
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@surgeapi/node", "X-Fern-SDK-Version": "0.25.4", "User-Agent": "@surgeapi/node/0.25.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
80
|
+
contentType: "application/json",
|
|
81
|
+
requestType: "json",
|
|
82
|
+
body: request,
|
|
83
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
84
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
85
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
86
|
+
});
|
|
87
|
+
if (_response.ok) {
|
|
88
|
+
return _response.body;
|
|
89
|
+
}
|
|
90
|
+
if (_response.error.reason === "status-code") {
|
|
91
|
+
throw new errors.SurgeError({
|
|
92
|
+
statusCode: _response.error.statusCode,
|
|
93
|
+
body: _response.error.body,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
switch (_response.error.reason) {
|
|
97
|
+
case "non-json":
|
|
98
|
+
throw new errors.SurgeError({
|
|
99
|
+
statusCode: _response.error.statusCode,
|
|
100
|
+
body: _response.error.rawBody,
|
|
101
|
+
});
|
|
102
|
+
case "timeout":
|
|
103
|
+
throw new errors.SurgeTimeoutError("Timeout exceeded when calling POST /accounts/{account_id}/phone_numbers.");
|
|
104
|
+
case "unknown":
|
|
105
|
+
throw new errors.SurgeError({
|
|
106
|
+
message: _response.error.errorMessage,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
_getAuthorizationHeader() {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
return `Bearer ${yield core.Supplier.get(this._options.token)}`;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.PhoneNumbers = PhoneNumbers;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./requests"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Surge from "../../../../index";
|
|
5
|
+
/**
|
|
6
|
+
* @example
|
|
7
|
+
* {
|
|
8
|
+
* area_code: "801",
|
|
9
|
+
* type: "local"
|
|
10
|
+
* }
|
|
11
|
+
*/
|
|
12
|
+
export interface CreatePhoneNumberRequest {
|
|
13
|
+
/** The desired area code for this phone number. */
|
|
14
|
+
area_code?: string;
|
|
15
|
+
/** Whether the phone number is local or toll-free */
|
|
16
|
+
type: Surge.CreatePhoneNumberRequestType;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type CreatePhoneNumberRequest } from "./CreatePhoneNumberRequest";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./client"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Whether the phone number is local or toll-free
|
|
6
|
+
*/
|
|
7
|
+
export type CreatePhoneNumberRequestType = "local" | "toll_free";
|
|
8
|
+
export declare const CreatePhoneNumberRequestType: {
|
|
9
|
+
readonly Local: "local";
|
|
10
|
+
readonly TollFree: "toll_free";
|
|
11
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CreatePhoneNumberRequestType = void 0;
|
|
7
|
+
exports.CreatePhoneNumberRequestType = {
|
|
8
|
+
Local: "local",
|
|
9
|
+
TollFree: "toll_free",
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./CreatePhoneNumberRequestType";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./CreatePhoneNumberRequestType"), exports);
|
|
@@ -52,8 +52,8 @@ export declare class Users {
|
|
|
52
52
|
* @param {Users.RequestOptions} requestOptions - Request-specific configuration.
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
|
-
* await client.users.
|
|
55
|
+
* await client.users.getUser("usr_01j9dwavghe1ttppewekjjkfrx")
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
getUser(id: string, requestOptions?: Users.RequestOptions): Promise<Surge.UserResponse>;
|
|
58
58
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
59
59
|
}
|
|
@@ -81,7 +81,7 @@ class Users {
|
|
|
81
81
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
82
82
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SurgeEnvironment.Default, `accounts/${encodeURIComponent(accountId)}/users`),
|
|
83
83
|
method: "POST",
|
|
84
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@surgeapi/node", "X-Fern-SDK-Version": "0.25.
|
|
84
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@surgeapi/node", "X-Fern-SDK-Version": "0.25.4", "User-Agent": "@surgeapi/node/0.25.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
85
85
|
contentType: "application/json",
|
|
86
86
|
requestType: "json",
|
|
87
87
|
body: request,
|
|
@@ -120,15 +120,15 @@ class Users {
|
|
|
120
120
|
* @param {Users.RequestOptions} requestOptions - Request-specific configuration.
|
|
121
121
|
*
|
|
122
122
|
* @example
|
|
123
|
-
* await client.users.
|
|
123
|
+
* await client.users.getUser("usr_01j9dwavghe1ttppewekjjkfrx")
|
|
124
124
|
*/
|
|
125
|
-
|
|
125
|
+
getUser(id, requestOptions) {
|
|
126
126
|
return __awaiter(this, void 0, void 0, function* () {
|
|
127
127
|
var _a, _b, _c;
|
|
128
128
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
129
129
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SurgeEnvironment.Default, `users/${encodeURIComponent(id)}`),
|
|
130
130
|
method: "GET",
|
|
131
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@surgeapi/node", "X-Fern-SDK-Version": "0.25.
|
|
131
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@surgeapi/node", "X-Fern-SDK-Version": "0.25.4", "User-Agent": "@surgeapi/node/0.25.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
132
132
|
contentType: "application/json",
|
|
133
133
|
requestType: "json",
|
|
134
134
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -75,7 +75,7 @@ class Verifications {
|
|
|
75
75
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
76
76
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SurgeEnvironment.Default, "verifications"),
|
|
77
77
|
method: "POST",
|
|
78
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@surgeapi/node", "X-Fern-SDK-Version": "0.25.
|
|
78
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@surgeapi/node", "X-Fern-SDK-Version": "0.25.4", "User-Agent": "@surgeapi/node/0.25.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
79
79
|
contentType: "application/json",
|
|
80
80
|
requestType: "json",
|
|
81
81
|
body: request,
|
|
@@ -128,7 +128,7 @@ class Verifications {
|
|
|
128
128
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
129
129
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SurgeEnvironment.Default, `verifications/${encodeURIComponent(id)}/checks`),
|
|
130
130
|
method: "POST",
|
|
131
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@surgeapi/node", "X-Fern-SDK-Version": "0.25.
|
|
131
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@surgeapi/node", "X-Fern-SDK-Version": "0.25.4", "User-Agent": "@surgeapi/node/0.25.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
132
132
|
contentType: "application/json",
|
|
133
133
|
requestType: "json",
|
|
134
134
|
body: request,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Response containing account information
|
|
6
|
+
*/
|
|
7
|
+
export interface AccountResponse {
|
|
8
|
+
/** The account ID */
|
|
9
|
+
id: string;
|
|
10
|
+
/** The name of the account */
|
|
11
|
+
name: string;
|
|
12
|
+
/** The time zone for the account */
|
|
13
|
+
time_zone?: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Surge from "../index";
|
|
5
|
+
/**
|
|
6
|
+
* This is the phone number tied to the Surge account.
|
|
7
|
+
*/
|
|
8
|
+
export interface ConversationPhoneNumber {
|
|
9
|
+
/** Unique identifier for the phone number */
|
|
10
|
+
id: string;
|
|
11
|
+
/** The canonical format of the phone number. */
|
|
12
|
+
number: string;
|
|
13
|
+
/** Whether the phone number is local, toll-free, or short code */
|
|
14
|
+
type: Surge.ConversationPhoneNumberType;
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Whether the phone number is local, toll-free, or short code
|
|
6
|
+
*/
|
|
7
|
+
export type ConversationPhoneNumberType = "local" | "toll_free" | "short_code" | "demo";
|
|
8
|
+
export declare const ConversationPhoneNumberType: {
|
|
9
|
+
readonly Local: "local";
|
|
10
|
+
readonly TollFree: "toll_free";
|
|
11
|
+
readonly ShortCode: "short_code";
|
|
12
|
+
readonly Demo: "demo";
|
|
13
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ConversationPhoneNumberType = void 0;
|
|
7
|
+
exports.ConversationPhoneNumberType = {
|
|
8
|
+
Local: "local",
|
|
9
|
+
TollFree: "toll_free",
|
|
10
|
+
ShortCode: "short_code",
|
|
11
|
+
Demo: "demo",
|
|
12
|
+
};
|
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
export interface MessageConversationContactParams {
|
|
8
8
|
/** The contact's first name in case a new contact is created. */
|
|
9
9
|
first_name?: string;
|
|
10
|
-
/** The unique identifier for an existing contact. */
|
|
11
|
-
id?: string;
|
|
12
10
|
/** The message's last name in case a new contact is created. */
|
|
13
11
|
last_name?: string;
|
|
14
12
|
/** The contact's phone number in E.164 format. */
|
|
@@ -6,7 +6,7 @@ import * as Surge from "../index";
|
|
|
6
6
|
* Params for selecting or creating a new conversation. Either the id or the Contact must be given.
|
|
7
7
|
*/
|
|
8
8
|
export interface MessageConversationParams {
|
|
9
|
-
contact
|
|
10
|
-
/**
|
|
11
|
-
|
|
9
|
+
contact: Surge.MessageConversationContactParams;
|
|
10
|
+
/** The phone number from which to send the message. This can be either the phone number itself or its ID in Surge. */
|
|
11
|
+
phone_number?: string;
|
|
12
12
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Surge from "../index";
|
|
5
|
+
/**
|
|
6
|
+
* A phone number that can be used to send and receive messages and calls
|
|
7
|
+
*/
|
|
8
|
+
export interface PhoneNumber {
|
|
9
|
+
/** Unique identifier for the phone number */
|
|
10
|
+
id: string;
|
|
11
|
+
/** The phone number in E.164 format */
|
|
12
|
+
number: string;
|
|
13
|
+
/** Whether the phone number is local, toll-free, or short code */
|
|
14
|
+
type: Surge.PhoneNumberType;
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Whether the phone number is local, toll-free, or short code
|
|
6
|
+
*/
|
|
7
|
+
export type PhoneNumberType = "local" | "toll_free";
|
|
8
|
+
export declare const PhoneNumberType: {
|
|
9
|
+
readonly Local: "local";
|
|
10
|
+
readonly TollFree: "toll_free";
|
|
11
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PhoneNumberType = void 0;
|
|
7
|
+
exports.PhoneNumberType = {
|
|
8
|
+
Local: "local",
|
|
9
|
+
TollFree: "toll_free",
|
|
10
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./AccountResponse";
|
|
1
2
|
export * from "./AttachmentParams";
|
|
2
3
|
export * from "./AttachmentResponse";
|
|
3
4
|
export * from "./BlastResponseAttachmentsItem";
|
|
@@ -6,9 +7,13 @@ export * from "./Contact";
|
|
|
6
7
|
export * from "./ContactRequest";
|
|
7
8
|
export * from "./ContactResponse";
|
|
8
9
|
export * from "./Conversation";
|
|
10
|
+
export * from "./ConversationPhoneNumberType";
|
|
11
|
+
export * from "./ConversationPhoneNumber";
|
|
9
12
|
export * from "./MessageConversationContactParams";
|
|
10
13
|
export * from "./MessageConversationParams";
|
|
11
14
|
export * from "./MessageResponse";
|
|
15
|
+
export * from "./PhoneNumberType";
|
|
16
|
+
export * from "./PhoneNumber";
|
|
12
17
|
export * from "./UserResponse";
|
|
13
18
|
export * from "./VerificationStatus";
|
|
14
19
|
export * from "./Verification";
|
package/dist/api/types/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./AccountResponse"), exports);
|
|
17
18
|
__exportStar(require("./AttachmentParams"), exports);
|
|
18
19
|
__exportStar(require("./AttachmentResponse"), exports);
|
|
19
20
|
__exportStar(require("./BlastResponseAttachmentsItem"), exports);
|
|
@@ -22,9 +23,13 @@ __exportStar(require("./Contact"), exports);
|
|
|
22
23
|
__exportStar(require("./ContactRequest"), exports);
|
|
23
24
|
__exportStar(require("./ContactResponse"), exports);
|
|
24
25
|
__exportStar(require("./Conversation"), exports);
|
|
26
|
+
__exportStar(require("./ConversationPhoneNumberType"), exports);
|
|
27
|
+
__exportStar(require("./ConversationPhoneNumber"), exports);
|
|
25
28
|
__exportStar(require("./MessageConversationContactParams"), exports);
|
|
26
29
|
__exportStar(require("./MessageConversationParams"), exports);
|
|
27
30
|
__exportStar(require("./MessageResponse"), exports);
|
|
31
|
+
__exportStar(require("./PhoneNumberType"), exports);
|
|
32
|
+
__exportStar(require("./PhoneNumber"), exports);
|
|
28
33
|
__exportStar(require("./UserResponse"), exports);
|
|
29
34
|
__exportStar(require("./VerificationStatus"), exports);
|
|
30
35
|
__exportStar(require("./Verification"), exports);
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.25.
|
|
1
|
+
export declare const SDK_VERSION = "0.25.4";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@surgeapi/node",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.4",
|
|
4
4
|
"private": false,
|
|
5
|
-
"repository": "https://github.com/
|
|
5
|
+
"repository": "https://github.com/surgeapi/typescript-sdk",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"types": "./index.d.ts",
|