@surgeapi/node 0.25.3 → 0.25.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/Client.d.ts +6 -0
  2. package/Client.js +20 -10
  3. package/README.md +3 -5
  4. package/api/index.d.ts +1 -1
  5. package/api/index.js +1 -1
  6. package/api/resources/accounts/client/Client.d.ts +57 -0
  7. package/api/resources/accounts/client/Client.js +167 -0
  8. package/api/resources/accounts/client/index.d.ts +1 -0
  9. package/api/resources/accounts/client/index.js +17 -0
  10. package/api/resources/accounts/client/requests/CreateAccountRequest.d.ts +16 -0
  11. package/api/resources/accounts/client/requests/CreateAccountRequest.js +5 -0
  12. package/api/resources/accounts/client/requests/UpdateAccountRequest.d.ts +16 -0
  13. package/api/resources/accounts/client/requests/UpdateAccountRequest.js +5 -0
  14. package/api/resources/accounts/client/requests/index.d.ts +2 -0
  15. package/api/resources/accounts/client/requests/index.js +2 -0
  16. package/api/resources/accounts/index.d.ts +1 -0
  17. package/api/resources/accounts/index.js +17 -0
  18. package/api/resources/blasts/client/Client.js +1 -1
  19. package/api/resources/contacts/client/Client.d.ts +2 -2
  20. package/api/resources/contacts/client/Client.js +7 -7
  21. package/api/resources/index.d.ts +5 -0
  22. package/api/resources/index.js +6 -1
  23. package/api/resources/messages/client/Client.d.ts +1 -3
  24. package/api/resources/messages/client/Client.js +2 -4
  25. package/api/resources/messages/client/requests/MessageRequest.d.ts +3 -3
  26. package/api/resources/phoneNumbers/client/Client.d.ts +44 -0
  27. package/api/resources/phoneNumbers/client/Client.js +117 -0
  28. package/api/resources/phoneNumbers/client/index.d.ts +1 -0
  29. package/api/resources/phoneNumbers/client/index.js +17 -0
  30. package/api/resources/phoneNumbers/client/requests/CreatePhoneNumberRequest.d.ts +17 -0
  31. package/api/resources/phoneNumbers/client/requests/CreatePhoneNumberRequest.js +5 -0
  32. package/api/resources/phoneNumbers/client/requests/index.d.ts +1 -0
  33. package/api/resources/phoneNumbers/client/requests/index.js +2 -0
  34. package/api/resources/phoneNumbers/index.d.ts +2 -0
  35. package/api/resources/phoneNumbers/index.js +18 -0
  36. package/api/resources/phoneNumbers/types/CreatePhoneNumberRequestType.d.ts +11 -0
  37. package/api/resources/phoneNumbers/types/CreatePhoneNumberRequestType.js +10 -0
  38. package/api/resources/phoneNumbers/types/index.d.ts +1 -0
  39. package/api/resources/phoneNumbers/types/index.js +17 -0
  40. package/api/resources/users/client/Client.d.ts +2 -2
  41. package/api/resources/users/client/Client.js +4 -4
  42. package/api/resources/verifications/client/Client.js +2 -2
  43. package/api/types/AccountResponse.d.ts +14 -0
  44. package/api/types/AccountResponse.js +5 -0
  45. package/api/types/Conversation.d.ts +1 -0
  46. package/api/types/ConversationPhoneNumber.d.ts +15 -0
  47. package/api/types/ConversationPhoneNumber.js +5 -0
  48. package/api/types/ConversationPhoneNumberType.d.ts +13 -0
  49. package/api/types/ConversationPhoneNumberType.js +12 -0
  50. package/api/types/MessageConversationContactParams.d.ts +0 -2
  51. package/api/types/MessageConversationParams.d.ts +3 -3
  52. package/api/types/PhoneNumber.d.ts +15 -0
  53. package/api/types/PhoneNumber.js +5 -0
  54. package/api/types/PhoneNumberType.d.ts +11 -0
  55. package/api/types/PhoneNumberType.js +10 -0
  56. package/api/types/index.d.ts +5 -0
  57. package/api/types/index.js +5 -0
  58. package/dist/Client.d.ts +6 -0
  59. package/dist/Client.js +20 -10
  60. package/dist/api/index.d.ts +1 -1
  61. package/dist/api/index.js +1 -1
  62. package/dist/api/resources/accounts/client/Client.d.ts +57 -0
  63. package/dist/api/resources/accounts/client/Client.js +167 -0
  64. package/dist/api/resources/accounts/client/index.d.ts +1 -0
  65. package/dist/api/resources/accounts/client/index.js +17 -0
  66. package/dist/api/resources/accounts/client/requests/CreateAccountRequest.d.ts +16 -0
  67. package/dist/api/resources/accounts/client/requests/CreateAccountRequest.js +5 -0
  68. package/dist/api/resources/accounts/client/requests/UpdateAccountRequest.d.ts +16 -0
  69. package/dist/api/resources/accounts/client/requests/UpdateAccountRequest.js +5 -0
  70. package/dist/api/resources/accounts/client/requests/index.d.ts +2 -0
  71. package/dist/api/resources/accounts/client/requests/index.js +2 -0
  72. package/dist/api/resources/accounts/index.d.ts +1 -0
  73. package/dist/api/resources/accounts/index.js +17 -0
  74. package/dist/api/resources/blasts/client/Client.js +1 -1
  75. package/dist/api/resources/contacts/client/Client.d.ts +2 -2
  76. package/dist/api/resources/contacts/client/Client.js +7 -7
  77. package/dist/api/resources/index.d.ts +5 -0
  78. package/dist/api/resources/index.js +6 -1
  79. package/dist/api/resources/messages/client/Client.d.ts +1 -3
  80. package/dist/api/resources/messages/client/Client.js +2 -4
  81. package/dist/api/resources/messages/client/requests/MessageRequest.d.ts +3 -3
  82. package/dist/api/resources/phoneNumbers/client/Client.d.ts +44 -0
  83. package/dist/api/resources/phoneNumbers/client/Client.js +117 -0
  84. package/dist/api/resources/phoneNumbers/client/index.d.ts +1 -0
  85. package/dist/api/resources/phoneNumbers/client/index.js +17 -0
  86. package/dist/api/resources/phoneNumbers/client/requests/CreatePhoneNumberRequest.d.ts +17 -0
  87. package/dist/api/resources/phoneNumbers/client/requests/CreatePhoneNumberRequest.js +5 -0
  88. package/dist/api/resources/phoneNumbers/client/requests/index.d.ts +1 -0
  89. package/dist/api/resources/phoneNumbers/client/requests/index.js +2 -0
  90. package/dist/api/resources/phoneNumbers/index.d.ts +2 -0
  91. package/dist/api/resources/phoneNumbers/index.js +18 -0
  92. package/dist/api/resources/phoneNumbers/types/CreatePhoneNumberRequestType.d.ts +11 -0
  93. package/dist/api/resources/phoneNumbers/types/CreatePhoneNumberRequestType.js +10 -0
  94. package/dist/api/resources/phoneNumbers/types/index.d.ts +1 -0
  95. package/dist/api/resources/phoneNumbers/types/index.js +17 -0
  96. package/dist/api/resources/users/client/Client.d.ts +2 -2
  97. package/dist/api/resources/users/client/Client.js +4 -4
  98. package/dist/api/resources/verifications/client/Client.js +2 -2
  99. package/dist/api/types/AccountResponse.d.ts +14 -0
  100. package/dist/api/types/AccountResponse.js +5 -0
  101. package/dist/api/types/Conversation.d.ts +1 -0
  102. package/dist/api/types/ConversationPhoneNumber.d.ts +15 -0
  103. package/dist/api/types/ConversationPhoneNumber.js +5 -0
  104. package/dist/api/types/ConversationPhoneNumberType.d.ts +13 -0
  105. package/dist/api/types/ConversationPhoneNumberType.js +12 -0
  106. package/dist/api/types/MessageConversationContactParams.d.ts +0 -2
  107. package/dist/api/types/MessageConversationParams.d.ts +3 -3
  108. package/dist/api/types/PhoneNumber.d.ts +15 -0
  109. package/dist/api/types/PhoneNumber.js +5 -0
  110. package/dist/api/types/PhoneNumberType.d.ts +11 -0
  111. package/dist/api/types/PhoneNumberType.js +10 -0
  112. package/dist/api/types/index.d.ts +5 -0
  113. package/dist/api/types/index.js +5 -0
  114. package/dist/version.d.ts +1 -1
  115. package/dist/version.js +1 -1
  116. package/package.json +2 -2
  117. package/reference.md +222 -6
  118. package/version.d.ts +1 -1
  119. package/version.js +1 -1
@@ -0,0 +1,44 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as environments from "../../../../environments";
5
+ import * as core from "../../../../core";
6
+ import * as Surge from "../../../index";
7
+ export declare namespace PhoneNumbers {
8
+ interface Options {
9
+ environment?: core.Supplier<environments.SurgeEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
12
+ token: core.Supplier<core.BearerToken>;
13
+ fetcher?: core.FetchFunction;
14
+ }
15
+ interface RequestOptions {
16
+ /** The maximum time to wait for a response in seconds. */
17
+ timeoutInSeconds?: number;
18
+ /** The number of times to retry the request. Defaults to 2. */
19
+ maxRetries?: number;
20
+ /** A hook to abort the request. */
21
+ abortSignal?: AbortSignal;
22
+ /** Additional headers to include in the request. */
23
+ headers?: Record<string, string>;
24
+ }
25
+ }
26
+ export declare class PhoneNumbers {
27
+ protected readonly _options: PhoneNumbers.Options;
28
+ constructor(_options: PhoneNumbers.Options);
29
+ /**
30
+ * Create a new phone number for the account.
31
+ *
32
+ * @param {string} accountId - The account for which the phone number should be created.
33
+ * @param {Surge.CreatePhoneNumberRequest} request
34
+ * @param {PhoneNumbers.RequestOptions} requestOptions - Request-specific configuration.
35
+ *
36
+ * @example
37
+ * await client.phoneNumbers.create("acct_01j9a43avnfqzbjfch6pygv1td", {
38
+ * area_code: "801",
39
+ * type: "local"
40
+ * })
41
+ */
42
+ create(accountId: string, request: Surge.CreatePhoneNumberRequest, requestOptions?: PhoneNumbers.RequestOptions): Promise<Surge.PhoneNumber>;
43
+ protected _getAuthorizationHeader(): Promise<string>;
44
+ }
@@ -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.5", "User-Agent": "@surgeapi/node/0.25.5", "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,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export { type CreatePhoneNumberRequest } from "./CreatePhoneNumberRequest";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export * from "./types";
2
+ export * from "./client";
@@ -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.surgeWebUserControllerShow("usr_01j9dwavghe1ttppewekjjkfrx")
55
+ * await client.users.getUser("usr_01j9dwavghe1ttppewekjjkfrx")
56
56
  */
57
- surgeWebUserControllerShow(id: string, requestOptions?: Users.RequestOptions): Promise<Surge.UserResponse>;
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.3", "User-Agent": "@surgeapi/node/0.25.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
84
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@surgeapi/node", "X-Fern-SDK-Version": "0.25.5", "User-Agent": "@surgeapi/node/0.25.5", "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.surgeWebUserControllerShow("usr_01j9dwavghe1ttppewekjjkfrx")
123
+ * await client.users.getUser("usr_01j9dwavghe1ttppewekjjkfrx")
124
124
  */
125
- surgeWebUserControllerShow(id, requestOptions) {
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.3", "User-Agent": "@surgeapi/node/0.25.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
131
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@surgeapi/node", "X-Fern-SDK-Version": "0.25.5", "User-Agent": "@surgeapi/node/0.25.5", "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.3", "User-Agent": "@surgeapi/node/0.25.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
78
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@surgeapi/node", "X-Fern-SDK-Version": "0.25.5", "User-Agent": "@surgeapi/node/0.25.5", "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.3", "User-Agent": "@surgeapi/node/0.25.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
131
+ headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@surgeapi/node", "X-Fern-SDK-Version": "0.25.5", "User-Agent": "@surgeapi/node/0.25.5", "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,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -9,4 +9,5 @@ export interface Conversation {
9
9
  contact: Surge.Contact;
10
10
  /** Unique identifier for the object. */
11
11
  id: string;
12
+ phone_number?: Surge.ConversationPhoneNumber;
12
13
  }
@@ -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,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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?: Surge.MessageConversationContactParams;
10
- /** Unique identifier for the object. */
11
- id?: string;
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,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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";
@@ -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/Client.d.ts CHANGED
@@ -3,9 +3,11 @@
3
3
  */
4
4
  import * as environments from "./environments";
5
5
  import * as core from "./core";
6
+ import { Accounts } from "./api/resources/accounts/client/Client";
6
7
  import { Blasts } from "./api/resources/blasts/client/Client";
7
8
  import { Contacts } from "./api/resources/contacts/client/Client";
8
9
  import { Messages } from "./api/resources/messages/client/Client";
10
+ import { PhoneNumbers } from "./api/resources/phoneNumbers/client/Client";
9
11
  import { Users } from "./api/resources/users/client/Client";
10
12
  import { Verifications } from "./api/resources/verifications/client/Client";
11
13
  export declare namespace SurgeClient {
@@ -29,15 +31,19 @@ export declare namespace SurgeClient {
29
31
  }
30
32
  export declare class SurgeClient {
31
33
  protected readonly _options: SurgeClient.Options;
34
+ protected _accounts: Accounts | undefined;
32
35
  protected _blasts: Blasts | undefined;
33
36
  protected _contacts: Contacts | undefined;
34
37
  protected _messages: Messages | undefined;
38
+ protected _phoneNumbers: PhoneNumbers | undefined;
35
39
  protected _users: Users | undefined;
36
40
  protected _verifications: Verifications | undefined;
37
41
  constructor(_options: SurgeClient.Options);
42
+ get accounts(): Accounts;
38
43
  get blasts(): Blasts;
39
44
  get contacts(): Contacts;
40
45
  get messages(): Messages;
46
+ get phoneNumbers(): PhoneNumbers;
41
47
  get users(): Users;
42
48
  get verifications(): Verifications;
43
49
  }
package/dist/Client.js CHANGED
@@ -4,34 +4,44 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.SurgeClient = void 0;
7
- const Client_1 = require("./api/resources/blasts/client/Client");
8
- const Client_2 = require("./api/resources/contacts/client/Client");
9
- const Client_3 = require("./api/resources/messages/client/Client");
10
- const Client_4 = require("./api/resources/users/client/Client");
11
- const Client_5 = require("./api/resources/verifications/client/Client");
7
+ const Client_1 = require("./api/resources/accounts/client/Client");
8
+ const Client_2 = require("./api/resources/blasts/client/Client");
9
+ const Client_3 = require("./api/resources/contacts/client/Client");
10
+ const Client_4 = require("./api/resources/messages/client/Client");
11
+ const Client_5 = require("./api/resources/phoneNumbers/client/Client");
12
+ const Client_6 = require("./api/resources/users/client/Client");
13
+ const Client_7 = require("./api/resources/verifications/client/Client");
12
14
  class SurgeClient {
13
15
  constructor(_options) {
14
16
  this._options = _options;
15
17
  }
18
+ get accounts() {
19
+ var _a;
20
+ return ((_a = this._accounts) !== null && _a !== void 0 ? _a : (this._accounts = new Client_1.Accounts(this._options)));
21
+ }
16
22
  get blasts() {
17
23
  var _a;
18
- return ((_a = this._blasts) !== null && _a !== void 0 ? _a : (this._blasts = new Client_1.Blasts(this._options)));
24
+ return ((_a = this._blasts) !== null && _a !== void 0 ? _a : (this._blasts = new Client_2.Blasts(this._options)));
19
25
  }
20
26
  get contacts() {
21
27
  var _a;
22
- return ((_a = this._contacts) !== null && _a !== void 0 ? _a : (this._contacts = new Client_2.Contacts(this._options)));
28
+ return ((_a = this._contacts) !== null && _a !== void 0 ? _a : (this._contacts = new Client_3.Contacts(this._options)));
23
29
  }
24
30
  get messages() {
25
31
  var _a;
26
- return ((_a = this._messages) !== null && _a !== void 0 ? _a : (this._messages = new Client_3.Messages(this._options)));
32
+ return ((_a = this._messages) !== null && _a !== void 0 ? _a : (this._messages = new Client_4.Messages(this._options)));
33
+ }
34
+ get phoneNumbers() {
35
+ var _a;
36
+ return ((_a = this._phoneNumbers) !== null && _a !== void 0 ? _a : (this._phoneNumbers = new Client_5.PhoneNumbers(this._options)));
27
37
  }
28
38
  get users() {
29
39
  var _a;
30
- return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new Client_4.Users(this._options)));
40
+ return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new Client_6.Users(this._options)));
31
41
  }
32
42
  get verifications() {
33
43
  var _a;
34
- return ((_a = this._verifications) !== null && _a !== void 0 ? _a : (this._verifications = new Client_5.Verifications(this._options)));
44
+ return ((_a = this._verifications) !== null && _a !== void 0 ? _a : (this._verifications = new Client_7.Verifications(this._options)));
35
45
  }
36
46
  }
37
47
  exports.SurgeClient = SurgeClient;