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/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<{
package/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* () {
package/README.md CHANGED
@@ -19,7 +19,7 @@ Instantiate and use the client with the following:
19
19
  import { PinnacleClient } from "rcs-js";
20
20
 
21
21
  const client = new PinnacleClient({ apiKey: "YOUR_API_KEY" });
22
- await client.registerCompany({
22
+ await client.company.register({
23
23
  company: {
24
24
  name: "name",
25
25
  address: "address",
@@ -55,7 +55,7 @@ following namespace:
55
55
  ```typescript
56
56
  import { Pinnacle } from "rcs-js";
57
57
 
58
- const request: Pinnacle.Rcs = {
58
+ const request: Pinnacle.CompanyGetRequest = {
59
59
  ...
60
60
  };
61
61
  ```
@@ -69,7 +69,7 @@ will be thrown.
69
69
  import { PinnacleError } from "rcs-js";
70
70
 
71
71
  try {
72
- await client.registerCompany(...);
72
+ await client.company.register(...);
73
73
  } catch (err) {
74
74
  if (err instanceof PinnacleError) {
75
75
  console.log(err.statusCode);
@@ -96,7 +96,7 @@ A request is deemed retriable when any of the following HTTP status codes is ret
96
96
  Use the `maxRetries` request option to configure this behavior.
97
97
 
98
98
  ```typescript
99
- const response = await client.registerCompany(..., {
99
+ const response = await client.company.register(..., {
100
100
  maxRetries: 0 // override maxRetries at the request level
101
101
  });
102
102
  ```
@@ -106,7 +106,7 @@ const response = await client.registerCompany(..., {
106
106
  The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
107
107
 
108
108
  ```typescript
109
- const response = await client.registerCompany(..., {
109
+ const response = await client.company.register(..., {
110
110
  timeoutInSeconds: 30 // override timeout to 30s
111
111
  });
112
112
  ```
@@ -117,7 +117,7 @@ The SDK allows users to abort requests at any point by passing in an abort signa
117
117
 
118
118
  ```typescript
119
119
  const controller = new AbortController();
120
- const response = await client.registerCompany(..., {
120
+ const response = await client.company.register(..., {
121
121
  abortSignal: controller.signal
122
122
  });
123
123
  controller.abort(); // aborts the request
@@ -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
+ }