rcs-js 1.0.9 → 1.0.11

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 (159) hide show
  1. package/Client.d.ts +3 -69
  2. package/Client.js +6 -231
  3. package/README.md +6 -6
  4. package/api/client/requests/index.d.ts +0 -3
  5. package/api/resources/company/client/Client.d.ts +96 -0
  6. package/api/resources/company/client/Client.js +289 -0
  7. package/api/resources/company/client/index.d.ts +1 -0
  8. package/api/resources/company/client/index.js +17 -0
  9. package/api/{client/requests/GetCompanyRequest.d.ts → resources/company/client/requests/CompanyGetRequest.d.ts} +1 -1
  10. package/{dist/api/client/requests/RegisterCompanyRequest.d.ts → api/resources/company/client/requests/CompanyRegisterRequest.d.ts} +2 -2
  11. package/api/{client/requests/UpdateCompanyRequest.d.ts → resources/company/client/requests/CompanyUpdateRequest.d.ts} +2 -2
  12. package/api/resources/company/client/requests/index.d.ts +3 -0
  13. package/api/resources/company/client/requests/index.js +2 -0
  14. package/api/resources/company/index.d.ts +2 -0
  15. package/api/resources/company/index.js +18 -0
  16. package/api/resources/company/types/CompanyRegisterResponse.d.ts +7 -0
  17. package/api/{types/RegisterCompanyResponseBrand.d.ts → resources/company/types/CompanyRegisterResponseBrand.d.ts} +1 -1
  18. package/api/resources/company/types/CompanyUpdateResponse.d.ts +7 -0
  19. package/api/{types/UpdateCompanyResponseBrand.d.ts → resources/company/types/CompanyUpdateResponseBrand.d.ts} +1 -1
  20. package/api/resources/company/types/index.d.ts +4 -0
  21. package/api/resources/company/types/index.js +20 -0
  22. package/api/resources/index.d.ts +3 -0
  23. package/api/resources/index.js +4 -1
  24. package/api/resources/send/client/Client.d.ts +0 -1
  25. package/api/resources/send/client/Client.js +3 -4
  26. package/api/resources/send/client/requests/SendMmsRequest.d.ts +1 -2
  27. package/api/types/index.d.ts +0 -4
  28. package/api/types/index.js +0 -4
  29. package/dist/Client.d.ts +3 -69
  30. package/dist/Client.js +6 -231
  31. package/dist/api/client/requests/index.d.ts +0 -3
  32. package/dist/api/resources/company/client/Client.d.ts +96 -0
  33. package/dist/api/resources/company/client/Client.js +289 -0
  34. package/dist/api/resources/company/client/index.d.ts +1 -0
  35. package/dist/api/resources/company/client/index.js +17 -0
  36. package/dist/api/{client/requests/GetCompanyRequest.d.ts → resources/company/client/requests/CompanyGetRequest.d.ts} +1 -1
  37. package/{api/client/requests/RegisterCompanyRequest.d.ts → dist/api/resources/company/client/requests/CompanyRegisterRequest.d.ts} +2 -2
  38. package/dist/api/{client/requests/UpdateCompanyRequest.d.ts → resources/company/client/requests/CompanyUpdateRequest.d.ts} +2 -2
  39. package/dist/api/resources/company/client/requests/index.d.ts +3 -0
  40. package/dist/api/resources/company/client/requests/index.js +2 -0
  41. package/dist/api/resources/company/index.d.ts +2 -0
  42. package/dist/api/resources/company/index.js +18 -0
  43. package/dist/api/resources/company/types/CompanyRegisterResponse.d.ts +7 -0
  44. package/dist/api/{types/RegisterCompanyResponseBrand.d.ts → resources/company/types/CompanyRegisterResponseBrand.d.ts} +1 -1
  45. package/dist/api/resources/company/types/CompanyUpdateResponse.d.ts +7 -0
  46. package/dist/api/{types/UpdateCompanyResponseBrand.d.ts → resources/company/types/CompanyUpdateResponseBrand.d.ts} +1 -1
  47. package/dist/api/resources/company/types/index.d.ts +4 -0
  48. package/dist/api/resources/company/types/index.js +20 -0
  49. package/dist/api/resources/index.d.ts +3 -0
  50. package/dist/api/resources/index.js +4 -1
  51. package/dist/api/resources/send/client/Client.d.ts +0 -1
  52. package/dist/api/resources/send/client/Client.js +3 -4
  53. package/dist/api/resources/send/client/requests/SendMmsRequest.d.ts +1 -2
  54. package/dist/api/types/index.d.ts +0 -4
  55. package/dist/api/types/index.js +0 -4
  56. package/dist/serialization/index.d.ts +0 -1
  57. package/dist/serialization/index.js +0 -1
  58. package/dist/serialization/resources/company/client/get.d.ts +11 -0
  59. package/dist/serialization/{client/getCompany.js → resources/company/client/get.js} +2 -2
  60. package/dist/serialization/resources/company/client/index.d.ts +2 -0
  61. package/{serialization → dist/serialization/resources/company}/client/index.js +2 -2
  62. package/dist/serialization/resources/company/client/requests/CompanyRegisterRequest.d.ts +19 -0
  63. package/dist/serialization/{client/requests/RegisterCompanyRequest.js → resources/company/client/requests/CompanyRegisterRequest.js} +7 -7
  64. package/dist/serialization/resources/company/client/requests/CompanyUpdateRequest.d.ts +20 -0
  65. package/dist/serialization/{client/requests/UpdateCompanyRequest.js → resources/company/client/requests/CompanyUpdateRequest.js} +7 -7
  66. package/dist/serialization/resources/company/client/requests/index.d.ts +2 -0
  67. package/dist/serialization/resources/company/client/requests/index.js +7 -0
  68. package/dist/serialization/resources/company/index.d.ts +2 -0
  69. package/dist/serialization/resources/company/index.js +18 -0
  70. package/dist/serialization/resources/company/types/CompanyRegisterResponse.d.ts +13 -0
  71. package/dist/serialization/{types/RegisterCompanyResponse.js → resources/company/types/CompanyRegisterResponse.js} +5 -5
  72. package/dist/serialization/resources/company/types/CompanyRegisterResponseBrand.d.ts +13 -0
  73. package/{serialization/types/RegisterCompanyResponseBrand.js → dist/serialization/resources/company/types/CompanyRegisterResponseBrand.js} +3 -3
  74. package/dist/serialization/resources/company/types/CompanyUpdateResponse.d.ts +13 -0
  75. package/{serialization/types/UpdateCompanyResponse.js → dist/serialization/resources/company/types/CompanyUpdateResponse.js} +5 -5
  76. package/dist/serialization/resources/company/types/CompanyUpdateResponseBrand.d.ts +13 -0
  77. package/dist/serialization/{types/UpdateCompanyResponseBrand.js → resources/company/types/CompanyUpdateResponseBrand.js} +3 -3
  78. package/dist/serialization/resources/company/types/index.d.ts +4 -0
  79. package/dist/serialization/resources/company/types/index.js +20 -0
  80. package/dist/serialization/resources/index.d.ts +3 -0
  81. package/dist/serialization/resources/index.js +4 -1
  82. package/dist/serialization/resources/send/client/requests/SendMmsRequest.d.ts +1 -1
  83. package/dist/serialization/resources/send/client/requests/SendMmsRequest.js +1 -1
  84. package/dist/serialization/types/index.d.ts +0 -4
  85. package/dist/serialization/types/index.js +0 -4
  86. package/dist/version.d.ts +1 -1
  87. package/dist/version.js +1 -1
  88. package/package.json +1 -1
  89. package/reference.md +222 -7
  90. package/serialization/index.d.ts +0 -1
  91. package/serialization/index.js +0 -1
  92. package/serialization/resources/company/client/get.d.ts +11 -0
  93. package/serialization/{client/getCompany.js → resources/company/client/get.js} +2 -2
  94. package/serialization/resources/company/client/index.d.ts +2 -0
  95. package/{dist/serialization → serialization/resources/company}/client/index.js +2 -2
  96. package/serialization/resources/company/client/requests/CompanyRegisterRequest.d.ts +19 -0
  97. package/serialization/{client/requests/RegisterCompanyRequest.js → resources/company/client/requests/CompanyRegisterRequest.js} +7 -7
  98. package/serialization/resources/company/client/requests/CompanyUpdateRequest.d.ts +20 -0
  99. package/serialization/{client/requests/UpdateCompanyRequest.js → resources/company/client/requests/CompanyUpdateRequest.js} +7 -7
  100. package/serialization/resources/company/client/requests/index.d.ts +2 -0
  101. package/serialization/resources/company/client/requests/index.js +7 -0
  102. package/serialization/resources/company/index.d.ts +2 -0
  103. package/serialization/resources/company/index.js +18 -0
  104. package/serialization/resources/company/types/CompanyRegisterResponse.d.ts +13 -0
  105. package/serialization/{types/RegisterCompanyResponse.js → resources/company/types/CompanyRegisterResponse.js} +5 -5
  106. package/serialization/resources/company/types/CompanyRegisterResponseBrand.d.ts +13 -0
  107. package/{dist/serialization/types/RegisterCompanyResponseBrand.js → serialization/resources/company/types/CompanyRegisterResponseBrand.js} +3 -3
  108. package/serialization/resources/company/types/CompanyUpdateResponse.d.ts +13 -0
  109. package/{dist/serialization/types/UpdateCompanyResponse.js → serialization/resources/company/types/CompanyUpdateResponse.js} +5 -5
  110. package/serialization/resources/company/types/CompanyUpdateResponseBrand.d.ts +13 -0
  111. package/serialization/{types/UpdateCompanyResponseBrand.js → resources/company/types/CompanyUpdateResponseBrand.js} +3 -3
  112. package/serialization/resources/company/types/index.d.ts +4 -0
  113. package/serialization/resources/company/types/index.js +20 -0
  114. package/serialization/resources/index.d.ts +3 -0
  115. package/serialization/resources/index.js +4 -1
  116. package/serialization/resources/send/client/requests/SendMmsRequest.d.ts +1 -1
  117. package/serialization/resources/send/client/requests/SendMmsRequest.js +1 -1
  118. package/serialization/types/index.d.ts +0 -4
  119. package/serialization/types/index.js +0 -4
  120. package/version.d.ts +1 -1
  121. package/version.js +1 -1
  122. package/api/types/RegisterCompanyResponse.d.ts +0 -7
  123. package/api/types/UpdateCompanyResponse.d.ts +0 -7
  124. package/dist/api/types/RegisterCompanyResponse.d.ts +0 -7
  125. package/dist/api/types/UpdateCompanyResponse.d.ts +0 -7
  126. package/dist/serialization/client/getCompany.d.ts +0 -11
  127. package/dist/serialization/client/index.d.ts +0 -2
  128. package/dist/serialization/client/requests/RegisterCompanyRequest.d.ts +0 -19
  129. package/dist/serialization/client/requests/UpdateCompanyRequest.d.ts +0 -20
  130. package/dist/serialization/client/requests/index.d.ts +0 -2
  131. package/dist/serialization/client/requests/index.js +0 -7
  132. package/dist/serialization/types/RegisterCompanyResponse.d.ts +0 -13
  133. package/dist/serialization/types/RegisterCompanyResponseBrand.d.ts +0 -13
  134. package/dist/serialization/types/UpdateCompanyResponse.d.ts +0 -13
  135. package/dist/serialization/types/UpdateCompanyResponseBrand.d.ts +0 -13
  136. package/serialization/client/getCompany.d.ts +0 -11
  137. package/serialization/client/index.d.ts +0 -2
  138. package/serialization/client/requests/RegisterCompanyRequest.d.ts +0 -19
  139. package/serialization/client/requests/UpdateCompanyRequest.d.ts +0 -20
  140. package/serialization/client/requests/index.d.ts +0 -2
  141. package/serialization/client/requests/index.js +0 -7
  142. package/serialization/types/RegisterCompanyResponse.d.ts +0 -13
  143. package/serialization/types/RegisterCompanyResponseBrand.d.ts +0 -13
  144. package/serialization/types/UpdateCompanyResponse.d.ts +0 -13
  145. package/serialization/types/UpdateCompanyResponseBrand.d.ts +0 -13
  146. /package/api/{client/requests/GetCompanyRequest.js → resources/company/client/requests/CompanyGetRequest.js} +0 -0
  147. /package/api/{client/requests/RegisterCompanyRequest.js → resources/company/client/requests/CompanyRegisterRequest.js} +0 -0
  148. /package/api/{client/requests/UpdateCompanyRequest.js → resources/company/client/requests/CompanyUpdateRequest.js} +0 -0
  149. /package/api/{types/RegisterCompanyResponse.js → resources/company/types/CompanyRegisterResponse.js} +0 -0
  150. /package/api/{types/RegisterCompanyResponseBrand.js → resources/company/types/CompanyRegisterResponseBrand.js} +0 -0
  151. /package/api/{types/UpdateCompanyResponse.js → resources/company/types/CompanyUpdateResponse.js} +0 -0
  152. /package/api/{types/UpdateCompanyResponseBrand.js → resources/company/types/CompanyUpdateResponseBrand.js} +0 -0
  153. /package/dist/api/{client/requests/GetCompanyRequest.js → resources/company/client/requests/CompanyGetRequest.js} +0 -0
  154. /package/dist/api/{client/requests/RegisterCompanyRequest.js → resources/company/client/requests/CompanyRegisterRequest.js} +0 -0
  155. /package/dist/api/{client/requests/UpdateCompanyRequest.js → resources/company/client/requests/CompanyUpdateRequest.js} +0 -0
  156. /package/dist/api/{types/RegisterCompanyResponse.js → resources/company/types/CompanyRegisterResponse.js} +0 -0
  157. /package/dist/api/{types/RegisterCompanyResponseBrand.js → resources/company/types/CompanyRegisterResponseBrand.js} +0 -0
  158. /package/dist/api/{types/UpdateCompanyResponse.js → resources/company/types/CompanyUpdateResponse.js} +0 -0
  159. /package/dist/api/{types/UpdateCompanyResponseBrand.js → resources/company/types/CompanyUpdateResponseBrand.js} +0 -0
package/dist/Client.js CHANGED
@@ -45,7 +45,8 @@ const Pinnacle = __importStar(require("./api/index"));
45
45
  const url_join_1 = __importDefault(require("url-join"));
46
46
  const serializers = __importStar(require("./serialization/index"));
47
47
  const errors = __importStar(require("./errors/index"));
48
- const Client_1 = require("./api/resources/send/client/Client");
48
+ const Client_1 = require("./api/resources/company/client/Client");
49
+ const Client_2 = require("./api/resources/send/client/Client");
49
50
  class PinnacleClient {
50
51
  constructor(_options) {
51
52
  this._options = _options;
@@ -74,7 +75,7 @@ class PinnacleClient {
74
75
  const _response = yield core.fetcher({
75
76
  url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "rcs_functionality"),
76
77
  method: "GET",
77
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.9", "User-Agent": "rcs-js/1.0.9", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
78
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.11", "User-Agent": "rcs-js/1.0.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
78
79
  contentType: "application/json",
79
80
  queryParameters: _queryParams,
80
81
  requestType: "json",
@@ -120,239 +121,13 @@ class PinnacleClient {
120
121
  }
121
122
  });
122
123
  }
123
- /**
124
- * Retrieve the company's information (i.e. approval status, company name, etc.). Search by company ID or company name.
125
- *
126
- * @param {Pinnacle.GetCompanyRequest} request
127
- * @param {PinnacleClient.RequestOptions} requestOptions - Request-specific configuration.
128
- *
129
- * @throws {@link Pinnacle.BadRequestError}
130
- * @throws {@link Pinnacle.UnauthorizedError}
131
- * @throws {@link Pinnacle.InternalServerError}
132
- *
133
- * @example
134
- * await client.getCompany()
135
- */
136
- getCompany(request = {}, requestOptions) {
137
- var _a;
138
- return __awaiter(this, void 0, void 0, function* () {
139
- const { companyId, companyName } = request;
140
- const _queryParams = {};
141
- if (companyId != null) {
142
- _queryParams["companyId"] = companyId.toString();
143
- }
144
- if (companyName != null) {
145
- _queryParams["companyName"] = companyName;
146
- }
147
- const _response = yield core.fetcher({
148
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "company"),
149
- method: "GET",
150
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.9", "User-Agent": "rcs-js/1.0.9", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
151
- contentType: "application/json",
152
- queryParameters: _queryParams,
153
- requestType: "json",
154
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
155
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
156
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
157
- });
158
- if (_response.ok) {
159
- return serializers.getCompany.Response.parseOrThrow(_response.body, {
160
- unrecognizedObjectKeys: "passthrough",
161
- allowUnrecognizedUnionMembers: true,
162
- allowUnrecognizedEnumValues: true,
163
- breadcrumbsPrefix: ["response"],
164
- });
165
- }
166
- if (_response.error.reason === "status-code") {
167
- switch (_response.error.statusCode) {
168
- case 400:
169
- throw new Pinnacle.BadRequestError(_response.error.body);
170
- case 401:
171
- throw new Pinnacle.UnauthorizedError(_response.error.body);
172
- case 500:
173
- throw new Pinnacle.InternalServerError(_response.error.body);
174
- default:
175
- throw new errors.PinnacleError({
176
- statusCode: _response.error.statusCode,
177
- body: _response.error.body,
178
- });
179
- }
180
- }
181
- switch (_response.error.reason) {
182
- case "non-json":
183
- throw new errors.PinnacleError({
184
- statusCode: _response.error.statusCode,
185
- body: _response.error.rawBody,
186
- });
187
- case "timeout":
188
- throw new errors.PinnacleTimeoutError();
189
- case "unknown":
190
- throw new errors.PinnacleError({
191
- message: _response.error.errorMessage,
192
- });
193
- }
194
- });
195
- }
196
- /**
197
- * Register a company for RCS with the Pinnacle platform
198
- *
199
- * @param {Pinnacle.RegisterCompanyRequest} request
200
- * @param {PinnacleClient.RequestOptions} requestOptions - Request-specific configuration.
201
- *
202
- * @throws {@link Pinnacle.BadRequestError}
203
- * @throws {@link Pinnacle.UnauthorizedError}
204
- * @throws {@link Pinnacle.InternalServerError}
205
- *
206
- * @example
207
- * await client.registerCompany({
208
- * company: {
209
- * name: "name",
210
- * address: "address",
211
- * ein: "ein",
212
- * description: "description",
213
- * brandColor: "brandColor",
214
- * logoUrl: "logoUrl",
215
- * heroUrl: "heroUrl"
216
- * },
217
- * companyContact: {
218
- * primaryWebsiteUrl: "primaryWebsiteUrl",
219
- * primaryWebsiteLabel: "primaryWebsiteLabel",
220
- * primaryPhone: "primaryPhone",
221
- * primaryPhoneLabel: "primaryPhoneLabel",
222
- * primaryEmail: "primaryEmail",
223
- * primaryEmailLabel: "primaryEmailLabel",
224
- * privacyPolicyUrl: "privacyPolicyUrl",
225
- * tosUrl: "tosUrl"
226
- * },
227
- * pointOfContact: {
228
- * pocName: "pocName",
229
- * pocTitle: "pocTitle",
230
- * pocEmail: "pocEmail"
231
- * }
232
- * })
233
- */
234
- registerCompany(request, requestOptions) {
124
+ get company() {
235
125
  var _a;
236
- return __awaiter(this, void 0, void 0, function* () {
237
- const _response = yield core.fetcher({
238
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "company/register"),
239
- method: "POST",
240
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.9", "User-Agent": "rcs-js/1.0.9", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
241
- contentType: "application/json",
242
- requestType: "json",
243
- body: serializers.RegisterCompanyRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
244
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
245
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
246
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
247
- });
248
- if (_response.ok) {
249
- return serializers.RegisterCompanyResponse.parseOrThrow(_response.body, {
250
- unrecognizedObjectKeys: "passthrough",
251
- allowUnrecognizedUnionMembers: true,
252
- allowUnrecognizedEnumValues: true,
253
- breadcrumbsPrefix: ["response"],
254
- });
255
- }
256
- if (_response.error.reason === "status-code") {
257
- switch (_response.error.statusCode) {
258
- case 400:
259
- throw new Pinnacle.BadRequestError(_response.error.body);
260
- case 401:
261
- throw new Pinnacle.UnauthorizedError(_response.error.body);
262
- case 500:
263
- throw new Pinnacle.InternalServerError(_response.error.body);
264
- default:
265
- throw new errors.PinnacleError({
266
- statusCode: _response.error.statusCode,
267
- body: _response.error.body,
268
- });
269
- }
270
- }
271
- switch (_response.error.reason) {
272
- case "non-json":
273
- throw new errors.PinnacleError({
274
- statusCode: _response.error.statusCode,
275
- body: _response.error.rawBody,
276
- });
277
- case "timeout":
278
- throw new errors.PinnacleTimeoutError();
279
- case "unknown":
280
- throw new errors.PinnacleError({
281
- message: _response.error.errorMessage,
282
- });
283
- }
284
- });
285
- }
286
- /**
287
- * Update a company on the Pinnacle platform
288
- *
289
- * @param {Pinnacle.UpdateCompanyRequest} request
290
- * @param {PinnacleClient.RequestOptions} requestOptions - Request-specific configuration.
291
- *
292
- * @throws {@link Pinnacle.BadRequestError}
293
- * @throws {@link Pinnacle.UnauthorizedError}
294
- * @throws {@link Pinnacle.InternalServerError}
295
- *
296
- * @example
297
- * await client.updateCompany({
298
- * companyId: "companyId"
299
- * })
300
- */
301
- updateCompany(request, requestOptions) {
302
- var _a;
303
- return __awaiter(this, void 0, void 0, function* () {
304
- const _response = yield core.fetcher({
305
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "company/update"),
306
- method: "POST",
307
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.9", "User-Agent": "rcs-js/1.0.9", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
308
- contentType: "application/json",
309
- requestType: "json",
310
- body: serializers.UpdateCompanyRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
311
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
312
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
313
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
314
- });
315
- if (_response.ok) {
316
- return serializers.UpdateCompanyResponse.parseOrThrow(_response.body, {
317
- unrecognizedObjectKeys: "passthrough",
318
- allowUnrecognizedUnionMembers: true,
319
- allowUnrecognizedEnumValues: true,
320
- breadcrumbsPrefix: ["response"],
321
- });
322
- }
323
- if (_response.error.reason === "status-code") {
324
- switch (_response.error.statusCode) {
325
- case 400:
326
- throw new Pinnacle.BadRequestError(_response.error.body);
327
- case 401:
328
- throw new Pinnacle.UnauthorizedError(_response.error.body);
329
- case 500:
330
- throw new Pinnacle.InternalServerError(_response.error.body);
331
- default:
332
- throw new errors.PinnacleError({
333
- statusCode: _response.error.statusCode,
334
- body: _response.error.body,
335
- });
336
- }
337
- }
338
- switch (_response.error.reason) {
339
- case "non-json":
340
- throw new errors.PinnacleError({
341
- statusCode: _response.error.statusCode,
342
- body: _response.error.rawBody,
343
- });
344
- case "timeout":
345
- throw new errors.PinnacleTimeoutError();
346
- case "unknown":
347
- throw new errors.PinnacleError({
348
- message: _response.error.errorMessage,
349
- });
350
- }
351
- });
126
+ return ((_a = this._company) !== null && _a !== void 0 ? _a : (this._company = new Client_1.Company(this._options)));
352
127
  }
353
128
  get send() {
354
129
  var _a;
355
- return ((_a = this._send) !== null && _a !== void 0 ? _a : (this._send = new Client_1.Send(this._options)));
130
+ return ((_a = this._send) !== null && _a !== void 0 ? _a : (this._send = new Client_2.Send(this._options)));
356
131
  }
357
132
  _getCustomAuthorizationHeaders() {
358
133
  return __awaiter(this, void 0, void 0, function* () {
@@ -1,4 +1 @@
1
1
  export { type GetRcsFunctionalityRequest } from "./GetRcsFunctionalityRequest";
2
- export { type GetCompanyRequest } from "./GetCompanyRequest";
3
- export { type RegisterCompanyRequest } from "./RegisterCompanyRequest";
4
- export { type UpdateCompanyRequest } from "./UpdateCompanyRequest";
@@ -0,0 +1,96 @@
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 Pinnacle from "../../../index";
7
+ export declare namespace Company {
8
+ interface Options {
9
+ environment?: core.Supplier<environments.PinnacleEnvironment | string>;
10
+ apiKey: core.Supplier<string>;
11
+ }
12
+ interface RequestOptions {
13
+ /** The maximum time to wait for a response in seconds. */
14
+ timeoutInSeconds?: number;
15
+ /** The number of times to retry the request. Defaults to 2. */
16
+ maxRetries?: number;
17
+ /** A hook to abort the request. */
18
+ abortSignal?: AbortSignal;
19
+ }
20
+ }
21
+ export declare class Company {
22
+ protected readonly _options: Company.Options;
23
+ constructor(_options: Company.Options);
24
+ /**
25
+ * Retrieve the company's information (i.e. approval status, company name, etc.). Search by company ID or company name.
26
+ *
27
+ * @param {Pinnacle.CompanyGetRequest} request
28
+ * @param {Company.RequestOptions} requestOptions - Request-specific configuration.
29
+ *
30
+ * @throws {@link Pinnacle.BadRequestError}
31
+ * @throws {@link Pinnacle.UnauthorizedError}
32
+ * @throws {@link Pinnacle.InternalServerError}
33
+ *
34
+ * @example
35
+ * await client.company.get()
36
+ */
37
+ get(request?: Pinnacle.CompanyGetRequest, requestOptions?: Company.RequestOptions): Promise<Pinnacle.Company[]>;
38
+ /**
39
+ * Register a company for RCS with the Pinnacle platform
40
+ *
41
+ * @param {Pinnacle.CompanyRegisterRequest} request
42
+ * @param {Company.RequestOptions} requestOptions - Request-specific configuration.
43
+ *
44
+ * @throws {@link Pinnacle.BadRequestError}
45
+ * @throws {@link Pinnacle.UnauthorizedError}
46
+ * @throws {@link Pinnacle.InternalServerError}
47
+ *
48
+ * @example
49
+ * await client.company.register({
50
+ * company: {
51
+ * name: "name",
52
+ * address: "address",
53
+ * ein: "ein",
54
+ * description: "description",
55
+ * brandColor: "brandColor",
56
+ * logoUrl: "logoUrl",
57
+ * heroUrl: "heroUrl"
58
+ * },
59
+ * companyContact: {
60
+ * primaryWebsiteUrl: "primaryWebsiteUrl",
61
+ * primaryWebsiteLabel: "primaryWebsiteLabel",
62
+ * primaryPhone: "primaryPhone",
63
+ * primaryPhoneLabel: "primaryPhoneLabel",
64
+ * primaryEmail: "primaryEmail",
65
+ * primaryEmailLabel: "primaryEmailLabel",
66
+ * privacyPolicyUrl: "privacyPolicyUrl",
67
+ * tosUrl: "tosUrl"
68
+ * },
69
+ * pointOfContact: {
70
+ * pocName: "pocName",
71
+ * pocTitle: "pocTitle",
72
+ * pocEmail: "pocEmail"
73
+ * }
74
+ * })
75
+ */
76
+ register(request: Pinnacle.CompanyRegisterRequest, requestOptions?: Company.RequestOptions): Promise<Pinnacle.CompanyRegisterResponse>;
77
+ /**
78
+ * Update a company on the Pinnacle platform
79
+ *
80
+ * @param {Pinnacle.CompanyUpdateRequest} request
81
+ * @param {Company.RequestOptions} requestOptions - Request-specific configuration.
82
+ *
83
+ * @throws {@link Pinnacle.BadRequestError}
84
+ * @throws {@link Pinnacle.UnauthorizedError}
85
+ * @throws {@link Pinnacle.InternalServerError}
86
+ *
87
+ * @example
88
+ * await client.company.update({
89
+ * companyId: "companyId"
90
+ * })
91
+ */
92
+ update(request: Pinnacle.CompanyUpdateRequest, requestOptions?: Company.RequestOptions): Promise<Pinnacle.CompanyUpdateResponse>;
93
+ protected _getCustomAuthorizationHeaders(): Promise<{
94
+ "PINNACLE-API-Key": string;
95
+ }>;
96
+ }
@@ -0,0 +1,289 @@
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 (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
+ return new (P || (P = Promise))(function (resolve, reject) {
31
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
35
+ });
36
+ };
37
+ var __importDefault = (this && this.__importDefault) || function (mod) {
38
+ return (mod && mod.__esModule) ? mod : { "default": mod };
39
+ };
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.Company = void 0;
42
+ const environments = __importStar(require("../../../../environments"));
43
+ const core = __importStar(require("../../../../core"));
44
+ const Pinnacle = __importStar(require("../../../index"));
45
+ const url_join_1 = __importDefault(require("url-join"));
46
+ const serializers = __importStar(require("../../../../serialization/index"));
47
+ const errors = __importStar(require("../../../../errors/index"));
48
+ class Company {
49
+ constructor(_options) {
50
+ this._options = _options;
51
+ }
52
+ /**
53
+ * Retrieve the company's information (i.e. approval status, company name, etc.). Search by company ID or company name.
54
+ *
55
+ * @param {Pinnacle.CompanyGetRequest} request
56
+ * @param {Company.RequestOptions} requestOptions - Request-specific configuration.
57
+ *
58
+ * @throws {@link Pinnacle.BadRequestError}
59
+ * @throws {@link Pinnacle.UnauthorizedError}
60
+ * @throws {@link Pinnacle.InternalServerError}
61
+ *
62
+ * @example
63
+ * await client.company.get()
64
+ */
65
+ get(request = {}, requestOptions) {
66
+ var _a;
67
+ return __awaiter(this, void 0, void 0, function* () {
68
+ const { companyId, companyName } = request;
69
+ const _queryParams = {};
70
+ if (companyId != null) {
71
+ _queryParams["companyId"] = companyId.toString();
72
+ }
73
+ if (companyName != null) {
74
+ _queryParams["companyName"] = companyName;
75
+ }
76
+ const _response = yield core.fetcher({
77
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "company"),
78
+ method: "GET",
79
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.11", "User-Agent": "rcs-js/1.0.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
80
+ contentType: "application/json",
81
+ queryParameters: _queryParams,
82
+ requestType: "json",
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 serializers.company.get.Response.parseOrThrow(_response.body, {
89
+ unrecognizedObjectKeys: "passthrough",
90
+ allowUnrecognizedUnionMembers: true,
91
+ allowUnrecognizedEnumValues: true,
92
+ breadcrumbsPrefix: ["response"],
93
+ });
94
+ }
95
+ if (_response.error.reason === "status-code") {
96
+ switch (_response.error.statusCode) {
97
+ case 400:
98
+ throw new Pinnacle.BadRequestError(_response.error.body);
99
+ case 401:
100
+ throw new Pinnacle.UnauthorizedError(_response.error.body);
101
+ case 500:
102
+ throw new Pinnacle.InternalServerError(_response.error.body);
103
+ default:
104
+ throw new errors.PinnacleError({
105
+ statusCode: _response.error.statusCode,
106
+ body: _response.error.body,
107
+ });
108
+ }
109
+ }
110
+ switch (_response.error.reason) {
111
+ case "non-json":
112
+ throw new errors.PinnacleError({
113
+ statusCode: _response.error.statusCode,
114
+ body: _response.error.rawBody,
115
+ });
116
+ case "timeout":
117
+ throw new errors.PinnacleTimeoutError();
118
+ case "unknown":
119
+ throw new errors.PinnacleError({
120
+ message: _response.error.errorMessage,
121
+ });
122
+ }
123
+ });
124
+ }
125
+ /**
126
+ * Register a company for RCS with the Pinnacle platform
127
+ *
128
+ * @param {Pinnacle.CompanyRegisterRequest} request
129
+ * @param {Company.RequestOptions} requestOptions - Request-specific configuration.
130
+ *
131
+ * @throws {@link Pinnacle.BadRequestError}
132
+ * @throws {@link Pinnacle.UnauthorizedError}
133
+ * @throws {@link Pinnacle.InternalServerError}
134
+ *
135
+ * @example
136
+ * await client.company.register({
137
+ * company: {
138
+ * name: "name",
139
+ * address: "address",
140
+ * ein: "ein",
141
+ * description: "description",
142
+ * brandColor: "brandColor",
143
+ * logoUrl: "logoUrl",
144
+ * heroUrl: "heroUrl"
145
+ * },
146
+ * companyContact: {
147
+ * primaryWebsiteUrl: "primaryWebsiteUrl",
148
+ * primaryWebsiteLabel: "primaryWebsiteLabel",
149
+ * primaryPhone: "primaryPhone",
150
+ * primaryPhoneLabel: "primaryPhoneLabel",
151
+ * primaryEmail: "primaryEmail",
152
+ * primaryEmailLabel: "primaryEmailLabel",
153
+ * privacyPolicyUrl: "privacyPolicyUrl",
154
+ * tosUrl: "tosUrl"
155
+ * },
156
+ * pointOfContact: {
157
+ * pocName: "pocName",
158
+ * pocTitle: "pocTitle",
159
+ * pocEmail: "pocEmail"
160
+ * }
161
+ * })
162
+ */
163
+ register(request, requestOptions) {
164
+ var _a;
165
+ return __awaiter(this, void 0, void 0, function* () {
166
+ const _response = yield core.fetcher({
167
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "company/register"),
168
+ method: "POST",
169
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.11", "User-Agent": "rcs-js/1.0.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
170
+ contentType: "application/json",
171
+ requestType: "json",
172
+ body: serializers.CompanyRegisterRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
173
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
174
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
175
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
176
+ });
177
+ if (_response.ok) {
178
+ return serializers.CompanyRegisterResponse.parseOrThrow(_response.body, {
179
+ unrecognizedObjectKeys: "passthrough",
180
+ allowUnrecognizedUnionMembers: true,
181
+ allowUnrecognizedEnumValues: true,
182
+ breadcrumbsPrefix: ["response"],
183
+ });
184
+ }
185
+ if (_response.error.reason === "status-code") {
186
+ switch (_response.error.statusCode) {
187
+ case 400:
188
+ throw new Pinnacle.BadRequestError(_response.error.body);
189
+ case 401:
190
+ throw new Pinnacle.UnauthorizedError(_response.error.body);
191
+ case 500:
192
+ throw new Pinnacle.InternalServerError(_response.error.body);
193
+ default:
194
+ throw new errors.PinnacleError({
195
+ statusCode: _response.error.statusCode,
196
+ body: _response.error.body,
197
+ });
198
+ }
199
+ }
200
+ switch (_response.error.reason) {
201
+ case "non-json":
202
+ throw new errors.PinnacleError({
203
+ statusCode: _response.error.statusCode,
204
+ body: _response.error.rawBody,
205
+ });
206
+ case "timeout":
207
+ throw new errors.PinnacleTimeoutError();
208
+ case "unknown":
209
+ throw new errors.PinnacleError({
210
+ message: _response.error.errorMessage,
211
+ });
212
+ }
213
+ });
214
+ }
215
+ /**
216
+ * Update a company on the Pinnacle platform
217
+ *
218
+ * @param {Pinnacle.CompanyUpdateRequest} request
219
+ * @param {Company.RequestOptions} requestOptions - Request-specific configuration.
220
+ *
221
+ * @throws {@link Pinnacle.BadRequestError}
222
+ * @throws {@link Pinnacle.UnauthorizedError}
223
+ * @throws {@link Pinnacle.InternalServerError}
224
+ *
225
+ * @example
226
+ * await client.company.update({
227
+ * companyId: "companyId"
228
+ * })
229
+ */
230
+ update(request, requestOptions) {
231
+ var _a;
232
+ return __awaiter(this, void 0, void 0, function* () {
233
+ const _response = yield core.fetcher({
234
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "company/update"),
235
+ method: "POST",
236
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.11", "User-Agent": "rcs-js/1.0.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
237
+ contentType: "application/json",
238
+ requestType: "json",
239
+ body: serializers.CompanyUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
240
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
241
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
242
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
243
+ });
244
+ if (_response.ok) {
245
+ return serializers.CompanyUpdateResponse.parseOrThrow(_response.body, {
246
+ unrecognizedObjectKeys: "passthrough",
247
+ allowUnrecognizedUnionMembers: true,
248
+ allowUnrecognizedEnumValues: true,
249
+ breadcrumbsPrefix: ["response"],
250
+ });
251
+ }
252
+ if (_response.error.reason === "status-code") {
253
+ switch (_response.error.statusCode) {
254
+ case 400:
255
+ throw new Pinnacle.BadRequestError(_response.error.body);
256
+ case 401:
257
+ throw new Pinnacle.UnauthorizedError(_response.error.body);
258
+ case 500:
259
+ throw new Pinnacle.InternalServerError(_response.error.body);
260
+ default:
261
+ throw new errors.PinnacleError({
262
+ statusCode: _response.error.statusCode,
263
+ body: _response.error.body,
264
+ });
265
+ }
266
+ }
267
+ switch (_response.error.reason) {
268
+ case "non-json":
269
+ throw new errors.PinnacleError({
270
+ statusCode: _response.error.statusCode,
271
+ body: _response.error.rawBody,
272
+ });
273
+ case "timeout":
274
+ throw new errors.PinnacleTimeoutError();
275
+ case "unknown":
276
+ throw new errors.PinnacleError({
277
+ message: _response.error.errorMessage,
278
+ });
279
+ }
280
+ });
281
+ }
282
+ _getCustomAuthorizationHeaders() {
283
+ return __awaiter(this, void 0, void 0, function* () {
284
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
285
+ return { "PINNACLE-API-Key": apiKeyValue };
286
+ });
287
+ }
288
+ }
289
+ exports.Company = Company;
@@ -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);