rcs-js 1.0.9 → 1.0.10

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 (151) 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.js +3 -3
  25. package/api/types/index.d.ts +0 -4
  26. package/api/types/index.js +0 -4
  27. package/dist/Client.d.ts +3 -69
  28. package/dist/Client.js +6 -231
  29. package/dist/api/client/requests/index.d.ts +0 -3
  30. package/dist/api/resources/company/client/Client.d.ts +96 -0
  31. package/dist/api/resources/company/client/Client.js +289 -0
  32. package/dist/api/resources/company/client/index.d.ts +1 -0
  33. package/dist/api/resources/company/client/index.js +17 -0
  34. package/dist/api/{client/requests/GetCompanyRequest.d.ts → resources/company/client/requests/CompanyGetRequest.d.ts} +1 -1
  35. package/{api/client/requests/RegisterCompanyRequest.d.ts → dist/api/resources/company/client/requests/CompanyRegisterRequest.d.ts} +2 -2
  36. package/dist/api/{client/requests/UpdateCompanyRequest.d.ts → resources/company/client/requests/CompanyUpdateRequest.d.ts} +2 -2
  37. package/dist/api/resources/company/client/requests/index.d.ts +3 -0
  38. package/dist/api/resources/company/client/requests/index.js +2 -0
  39. package/dist/api/resources/company/index.d.ts +2 -0
  40. package/dist/api/resources/company/index.js +18 -0
  41. package/dist/api/resources/company/types/CompanyRegisterResponse.d.ts +7 -0
  42. package/dist/api/{types/RegisterCompanyResponseBrand.d.ts → resources/company/types/CompanyRegisterResponseBrand.d.ts} +1 -1
  43. package/dist/api/resources/company/types/CompanyUpdateResponse.d.ts +7 -0
  44. package/dist/api/{types/UpdateCompanyResponseBrand.d.ts → resources/company/types/CompanyUpdateResponseBrand.d.ts} +1 -1
  45. package/dist/api/resources/company/types/index.d.ts +4 -0
  46. package/dist/api/resources/company/types/index.js +20 -0
  47. package/dist/api/resources/index.d.ts +3 -0
  48. package/dist/api/resources/index.js +4 -1
  49. package/dist/api/resources/send/client/Client.js +3 -3
  50. package/dist/api/types/index.d.ts +0 -4
  51. package/dist/api/types/index.js +0 -4
  52. package/dist/serialization/index.d.ts +0 -1
  53. package/dist/serialization/index.js +0 -1
  54. package/dist/serialization/resources/company/client/get.d.ts +11 -0
  55. package/dist/serialization/{client/getCompany.js → resources/company/client/get.js} +2 -2
  56. package/dist/serialization/resources/company/client/index.d.ts +2 -0
  57. package/{serialization → dist/serialization/resources/company}/client/index.js +2 -2
  58. package/dist/serialization/resources/company/client/requests/CompanyRegisterRequest.d.ts +19 -0
  59. package/dist/serialization/{client/requests/RegisterCompanyRequest.js → resources/company/client/requests/CompanyRegisterRequest.js} +7 -7
  60. package/dist/serialization/resources/company/client/requests/CompanyUpdateRequest.d.ts +20 -0
  61. package/dist/serialization/{client/requests/UpdateCompanyRequest.js → resources/company/client/requests/CompanyUpdateRequest.js} +7 -7
  62. package/dist/serialization/resources/company/client/requests/index.d.ts +2 -0
  63. package/dist/serialization/resources/company/client/requests/index.js +7 -0
  64. package/dist/serialization/resources/company/index.d.ts +2 -0
  65. package/dist/serialization/resources/company/index.js +18 -0
  66. package/dist/serialization/resources/company/types/CompanyRegisterResponse.d.ts +13 -0
  67. package/dist/serialization/{types/RegisterCompanyResponse.js → resources/company/types/CompanyRegisterResponse.js} +5 -5
  68. package/dist/serialization/resources/company/types/CompanyRegisterResponseBrand.d.ts +13 -0
  69. package/{serialization/types/RegisterCompanyResponseBrand.js → dist/serialization/resources/company/types/CompanyRegisterResponseBrand.js} +3 -3
  70. package/dist/serialization/resources/company/types/CompanyUpdateResponse.d.ts +13 -0
  71. package/{serialization/types/UpdateCompanyResponse.js → dist/serialization/resources/company/types/CompanyUpdateResponse.js} +5 -5
  72. package/dist/serialization/resources/company/types/CompanyUpdateResponseBrand.d.ts +13 -0
  73. package/dist/serialization/{types/UpdateCompanyResponseBrand.js → resources/company/types/CompanyUpdateResponseBrand.js} +3 -3
  74. package/dist/serialization/resources/company/types/index.d.ts +4 -0
  75. package/dist/serialization/resources/company/types/index.js +20 -0
  76. package/dist/serialization/resources/index.d.ts +3 -0
  77. package/dist/serialization/resources/index.js +4 -1
  78. package/dist/serialization/types/index.d.ts +0 -4
  79. package/dist/serialization/types/index.js +0 -4
  80. package/dist/version.d.ts +1 -1
  81. package/dist/version.js +1 -1
  82. package/package.json +1 -1
  83. package/reference.md +222 -6
  84. package/serialization/index.d.ts +0 -1
  85. package/serialization/index.js +0 -1
  86. package/serialization/resources/company/client/get.d.ts +11 -0
  87. package/serialization/{client/getCompany.js → resources/company/client/get.js} +2 -2
  88. package/serialization/resources/company/client/index.d.ts +2 -0
  89. package/{dist/serialization → serialization/resources/company}/client/index.js +2 -2
  90. package/serialization/resources/company/client/requests/CompanyRegisterRequest.d.ts +19 -0
  91. package/serialization/{client/requests/RegisterCompanyRequest.js → resources/company/client/requests/CompanyRegisterRequest.js} +7 -7
  92. package/serialization/resources/company/client/requests/CompanyUpdateRequest.d.ts +20 -0
  93. package/serialization/{client/requests/UpdateCompanyRequest.js → resources/company/client/requests/CompanyUpdateRequest.js} +7 -7
  94. package/serialization/resources/company/client/requests/index.d.ts +2 -0
  95. package/serialization/resources/company/client/requests/index.js +7 -0
  96. package/serialization/resources/company/index.d.ts +2 -0
  97. package/serialization/resources/company/index.js +18 -0
  98. package/serialization/resources/company/types/CompanyRegisterResponse.d.ts +13 -0
  99. package/serialization/{types/RegisterCompanyResponse.js → resources/company/types/CompanyRegisterResponse.js} +5 -5
  100. package/serialization/resources/company/types/CompanyRegisterResponseBrand.d.ts +13 -0
  101. package/{dist/serialization/types/RegisterCompanyResponseBrand.js → serialization/resources/company/types/CompanyRegisterResponseBrand.js} +3 -3
  102. package/serialization/resources/company/types/CompanyUpdateResponse.d.ts +13 -0
  103. package/{dist/serialization/types/UpdateCompanyResponse.js → serialization/resources/company/types/CompanyUpdateResponse.js} +5 -5
  104. package/serialization/resources/company/types/CompanyUpdateResponseBrand.d.ts +13 -0
  105. package/serialization/{types/UpdateCompanyResponseBrand.js → resources/company/types/CompanyUpdateResponseBrand.js} +3 -3
  106. package/serialization/resources/company/types/index.d.ts +4 -0
  107. package/serialization/resources/company/types/index.js +20 -0
  108. package/serialization/resources/index.d.ts +3 -0
  109. package/serialization/resources/index.js +4 -1
  110. package/serialization/types/index.d.ts +0 -4
  111. package/serialization/types/index.js +0 -4
  112. package/version.d.ts +1 -1
  113. package/version.js +1 -1
  114. package/api/types/RegisterCompanyResponse.d.ts +0 -7
  115. package/api/types/UpdateCompanyResponse.d.ts +0 -7
  116. package/dist/api/types/RegisterCompanyResponse.d.ts +0 -7
  117. package/dist/api/types/UpdateCompanyResponse.d.ts +0 -7
  118. package/dist/serialization/client/getCompany.d.ts +0 -11
  119. package/dist/serialization/client/index.d.ts +0 -2
  120. package/dist/serialization/client/requests/RegisterCompanyRequest.d.ts +0 -19
  121. package/dist/serialization/client/requests/UpdateCompanyRequest.d.ts +0 -20
  122. package/dist/serialization/client/requests/index.d.ts +0 -2
  123. package/dist/serialization/client/requests/index.js +0 -7
  124. package/dist/serialization/types/RegisterCompanyResponse.d.ts +0 -13
  125. package/dist/serialization/types/RegisterCompanyResponseBrand.d.ts +0 -13
  126. package/dist/serialization/types/UpdateCompanyResponse.d.ts +0 -13
  127. package/dist/serialization/types/UpdateCompanyResponseBrand.d.ts +0 -13
  128. package/serialization/client/getCompany.d.ts +0 -11
  129. package/serialization/client/index.d.ts +0 -2
  130. package/serialization/client/requests/RegisterCompanyRequest.d.ts +0 -19
  131. package/serialization/client/requests/UpdateCompanyRequest.d.ts +0 -20
  132. package/serialization/client/requests/index.d.ts +0 -2
  133. package/serialization/client/requests/index.js +0 -7
  134. package/serialization/types/RegisterCompanyResponse.d.ts +0 -13
  135. package/serialization/types/RegisterCompanyResponseBrand.d.ts +0 -13
  136. package/serialization/types/UpdateCompanyResponse.d.ts +0 -13
  137. package/serialization/types/UpdateCompanyResponseBrand.d.ts +0 -13
  138. /package/api/{client/requests/GetCompanyRequest.js → resources/company/client/requests/CompanyGetRequest.js} +0 -0
  139. /package/api/{client/requests/RegisterCompanyRequest.js → resources/company/client/requests/CompanyRegisterRequest.js} +0 -0
  140. /package/api/{client/requests/UpdateCompanyRequest.js → resources/company/client/requests/CompanyUpdateRequest.js} +0 -0
  141. /package/api/{types/RegisterCompanyResponse.js → resources/company/types/CompanyRegisterResponse.js} +0 -0
  142. /package/api/{types/RegisterCompanyResponseBrand.js → resources/company/types/CompanyRegisterResponseBrand.js} +0 -0
  143. /package/api/{types/UpdateCompanyResponse.js → resources/company/types/CompanyUpdateResponse.js} +0 -0
  144. /package/api/{types/UpdateCompanyResponseBrand.js → resources/company/types/CompanyUpdateResponseBrand.js} +0 -0
  145. /package/dist/api/{client/requests/GetCompanyRequest.js → resources/company/client/requests/CompanyGetRequest.js} +0 -0
  146. /package/dist/api/{client/requests/RegisterCompanyRequest.js → resources/company/client/requests/CompanyRegisterRequest.js} +0 -0
  147. /package/dist/api/{client/requests/UpdateCompanyRequest.js → resources/company/client/requests/CompanyUpdateRequest.js} +0 -0
  148. /package/dist/api/{types/RegisterCompanyResponse.js → resources/company/types/CompanyRegisterResponse.js} +0 -0
  149. /package/dist/api/{types/RegisterCompanyResponseBrand.js → resources/company/types/CompanyRegisterResponseBrand.js} +0 -0
  150. /package/dist/api/{types/UpdateCompanyResponse.js → resources/company/types/CompanyUpdateResponse.js} +0 -0
  151. /package/dist/api/{types/UpdateCompanyResponseBrand.js → resources/company/types/CompanyUpdateResponseBrand.js} +0 -0
@@ -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.10", "User-Agent": "rcs-js/1.0.10", "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.10", "User-Agent": "rcs-js/1.0.10", "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.10", "User-Agent": "rcs-js/1.0.10", "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);
@@ -5,7 +5,7 @@
5
5
  * @example
6
6
  * {}
7
7
  */
8
- export interface GetCompanyRequest {
8
+ export interface CompanyGetRequest {
9
9
  /**
10
10
  * The unique identifier for the company
11
11
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- import * as Pinnacle from "../../index";
4
+ import * as Pinnacle from "../../../../index";
5
5
  /**
6
6
  * @example
7
7
  * {
@@ -31,7 +31,7 @@ import * as Pinnacle from "../../index";
31
31
  * }
32
32
  * }
33
33
  */
34
- export interface RegisterCompanyRequest {
34
+ export interface CompanyRegisterRequest {
35
35
  company: Pinnacle.CompanyDetails;
36
36
  companyContact: Pinnacle.CompanyContact;
37
37
  pointOfContact: Pinnacle.PointOfContact;
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- import * as Pinnacle from "../../index";
4
+ import * as Pinnacle from "../../../../index";
5
5
  /**
6
6
  * @example
7
7
  * {
8
8
  * companyId: "companyId"
9
9
  * }
10
10
  */
11
- export interface UpdateCompanyRequest {
11
+ export interface CompanyUpdateRequest {
12
12
  companyId: string;
13
13
  company?: Pinnacle.Company;
14
14
  companyContact?: Pinnacle.CompanyContact;
@@ -0,0 +1,3 @@
1
+ export { type CompanyGetRequest } from "./CompanyGetRequest";
2
+ export { type CompanyRegisterRequest } from "./CompanyRegisterRequest";
3
+ export { type CompanyUpdateRequest } from "./CompanyUpdateRequest";
@@ -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,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Pinnacle from "../../../index";
5
+ export interface CompanyRegisterResponse {
6
+ brand: Pinnacle.CompanyRegisterResponseBrand;
7
+ }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- export interface RegisterCompanyResponseBrand {
4
+ export interface CompanyRegisterResponseBrand {
5
5
  name: string;
6
6
  id: number;
7
7
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Pinnacle from "../../../index";
5
+ export interface CompanyUpdateResponse {
6
+ brand: Pinnacle.CompanyUpdateResponseBrand;
7
+ }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- export interface UpdateCompanyResponseBrand {
4
+ export interface CompanyUpdateResponseBrand {
5
5
  name: string;
6
6
  id: number;
7
7
  }
@@ -0,0 +1,4 @@
1
+ export * from "./CompanyRegisterResponseBrand";
2
+ export * from "./CompanyRegisterResponse";
3
+ export * from "./CompanyUpdateResponseBrand";
4
+ export * from "./CompanyUpdateResponse";
@@ -0,0 +1,20 @@
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("./CompanyRegisterResponseBrand"), exports);
18
+ __exportStar(require("./CompanyRegisterResponse"), exports);
19
+ __exportStar(require("./CompanyUpdateResponseBrand"), exports);
20
+ __exportStar(require("./CompanyUpdateResponse"), exports);
@@ -1,3 +1,6 @@
1
+ export * as company from "./company";
2
+ export * from "./company/types";
1
3
  export * as send from "./send";
2
4
  export * from "./send/types";
5
+ export * from "./company/client/requests";
3
6
  export * from "./send/client/requests";
@@ -26,7 +26,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
26
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.send = void 0;
29
+ exports.send = exports.company = void 0;
30
+ exports.company = __importStar(require("./company"));
31
+ __exportStar(require("./company/types"), exports);
30
32
  exports.send = __importStar(require("./send"));
31
33
  __exportStar(require("./send/types"), exports);
34
+ __exportStar(require("./company/client/requests"), exports);
32
35
  __exportStar(require("./send/client/requests"), exports);
@@ -74,7 +74,7 @@ class Send {
74
74
  const _response = yield core.fetcher({
75
75
  url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "send/rcs"),
76
76
  method: "POST",
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())),
77
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.10", "User-Agent": "rcs-js/1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
78
78
  contentType: "application/json",
79
79
  requestType: "json",
80
80
  body: serializers.Rcs.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -146,7 +146,7 @@ class Send {
146
146
  const _response = yield core.fetcher({
147
147
  url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "send/sms"),
148
148
  method: "POST",
149
- 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())),
149
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.10", "User-Agent": "rcs-js/1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
150
150
  contentType: "application/json",
151
151
  requestType: "json",
152
152
  body: serializers.SendSmsRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -219,7 +219,7 @@ class Send {
219
219
  const _response = yield core.fetcher({
220
220
  url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "send/mms"),
221
221
  method: "POST",
222
- 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())),
222
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.10", "User-Agent": "rcs-js/1.0.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
223
223
  contentType: "application/json",
224
224
  requestType: "json",
225
225
  body: serializers.SendMmsRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -1,10 +1,6 @@
1
1
  export * from "./BadRequestErrorBody";
2
2
  export * from "./UnauthorizedErrorBody";
3
3
  export * from "./InternalServerErrorBody";
4
- export * from "./RegisterCompanyResponseBrand";
5
- export * from "./RegisterCompanyResponse";
6
- export * from "./UpdateCompanyResponseBrand";
7
- export * from "./UpdateCompanyResponse";
8
4
  export * from "./ForbiddenErrorBody";
9
5
  export * from "./RcsFunctionalities";
10
6
  export * from "./CompanyAdditionalWebsitesItem";
@@ -17,10 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./BadRequestErrorBody"), exports);
18
18
  __exportStar(require("./UnauthorizedErrorBody"), exports);
19
19
  __exportStar(require("./InternalServerErrorBody"), exports);
20
- __exportStar(require("./RegisterCompanyResponseBrand"), exports);
21
- __exportStar(require("./RegisterCompanyResponse"), exports);
22
- __exportStar(require("./UpdateCompanyResponseBrand"), exports);
23
- __exportStar(require("./UpdateCompanyResponse"), exports);
24
20
  __exportStar(require("./ForbiddenErrorBody"), exports);
25
21
  __exportStar(require("./RcsFunctionalities"), exports);
26
22
  __exportStar(require("./CompanyAdditionalWebsitesItem"), exports);
package/dist/Client.d.ts CHANGED
@@ -4,6 +4,7 @@
4
4
  import * as environments from "./environments";
5
5
  import * as core from "./core";
6
6
  import * as Pinnacle from "./api/index";
7
+ import { Company } from "./api/resources/company/client/Client";
7
8
  import { Send } from "./api/resources/send/client/Client";
8
9
  export declare namespace PinnacleClient {
9
10
  interface Options {
@@ -36,75 +37,8 @@ export declare class PinnacleClient {
36
37
  * await client.getRcsFunctionality()
37
38
  */
38
39
  getRcsFunctionality(request?: Pinnacle.GetRcsFunctionalityRequest, requestOptions?: PinnacleClient.RequestOptions): Promise<Pinnacle.RcsFunctionalities>;
39
- /**
40
- * Retrieve the company's information (i.e. approval status, company name, etc.). Search by company ID or company name.
41
- *
42
- * @param {Pinnacle.GetCompanyRequest} request
43
- * @param {PinnacleClient.RequestOptions} requestOptions - Request-specific configuration.
44
- *
45
- * @throws {@link Pinnacle.BadRequestError}
46
- * @throws {@link Pinnacle.UnauthorizedError}
47
- * @throws {@link Pinnacle.InternalServerError}
48
- *
49
- * @example
50
- * await client.getCompany()
51
- */
52
- getCompany(request?: Pinnacle.GetCompanyRequest, requestOptions?: PinnacleClient.RequestOptions): Promise<Pinnacle.Company[]>;
53
- /**
54
- * Register a company for RCS with the Pinnacle platform
55
- *
56
- * @param {Pinnacle.RegisterCompanyRequest} request
57
- * @param {PinnacleClient.RequestOptions} requestOptions - Request-specific configuration.
58
- *
59
- * @throws {@link Pinnacle.BadRequestError}
60
- * @throws {@link Pinnacle.UnauthorizedError}
61
- * @throws {@link Pinnacle.InternalServerError}
62
- *
63
- * @example
64
- * await client.registerCompany({
65
- * company: {
66
- * name: "name",
67
- * address: "address",
68
- * ein: "ein",
69
- * description: "description",
70
- * brandColor: "brandColor",
71
- * logoUrl: "logoUrl",
72
- * heroUrl: "heroUrl"
73
- * },
74
- * companyContact: {
75
- * primaryWebsiteUrl: "primaryWebsiteUrl",
76
- * primaryWebsiteLabel: "primaryWebsiteLabel",
77
- * primaryPhone: "primaryPhone",
78
- * primaryPhoneLabel: "primaryPhoneLabel",
79
- * primaryEmail: "primaryEmail",
80
- * primaryEmailLabel: "primaryEmailLabel",
81
- * privacyPolicyUrl: "privacyPolicyUrl",
82
- * tosUrl: "tosUrl"
83
- * },
84
- * pointOfContact: {
85
- * pocName: "pocName",
86
- * pocTitle: "pocTitle",
87
- * pocEmail: "pocEmail"
88
- * }
89
- * })
90
- */
91
- registerCompany(request: Pinnacle.RegisterCompanyRequest, requestOptions?: PinnacleClient.RequestOptions): Promise<Pinnacle.RegisterCompanyResponse>;
92
- /**
93
- * Update a company on the Pinnacle platform
94
- *
95
- * @param {Pinnacle.UpdateCompanyRequest} request
96
- * @param {PinnacleClient.RequestOptions} requestOptions - Request-specific configuration.
97
- *
98
- * @throws {@link Pinnacle.BadRequestError}
99
- * @throws {@link Pinnacle.UnauthorizedError}
100
- * @throws {@link Pinnacle.InternalServerError}
101
- *
102
- * @example
103
- * await client.updateCompany({
104
- * companyId: "companyId"
105
- * })
106
- */
107
- updateCompany(request: Pinnacle.UpdateCompanyRequest, requestOptions?: PinnacleClient.RequestOptions): Promise<Pinnacle.UpdateCompanyResponse>;
40
+ protected _company: Company | undefined;
41
+ get company(): Company;
108
42
  protected _send: Send | undefined;
109
43
  get send(): Send;
110
44
  protected _getCustomAuthorizationHeaders(): Promise<{