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.
- package/Client.d.ts +3 -69
- package/Client.js +6 -231
- package/README.md +6 -6
- package/api/client/requests/index.d.ts +0 -3
- package/api/resources/company/client/Client.d.ts +96 -0
- package/api/resources/company/client/Client.js +289 -0
- package/api/resources/company/client/index.d.ts +1 -0
- package/api/resources/company/client/index.js +17 -0
- package/api/{client/requests/GetCompanyRequest.d.ts → resources/company/client/requests/CompanyGetRequest.d.ts} +1 -1
- package/{dist/api/client/requests/RegisterCompanyRequest.d.ts → api/resources/company/client/requests/CompanyRegisterRequest.d.ts} +2 -2
- package/api/{client/requests/UpdateCompanyRequest.d.ts → resources/company/client/requests/CompanyUpdateRequest.d.ts} +2 -2
- package/api/resources/company/client/requests/index.d.ts +3 -0
- package/api/resources/company/client/requests/index.js +2 -0
- package/api/resources/company/index.d.ts +2 -0
- package/api/resources/company/index.js +18 -0
- package/api/resources/company/types/CompanyRegisterResponse.d.ts +7 -0
- package/api/{types/RegisterCompanyResponseBrand.d.ts → resources/company/types/CompanyRegisterResponseBrand.d.ts} +1 -1
- package/api/resources/company/types/CompanyUpdateResponse.d.ts +7 -0
- package/api/{types/UpdateCompanyResponseBrand.d.ts → resources/company/types/CompanyUpdateResponseBrand.d.ts} +1 -1
- package/api/resources/company/types/index.d.ts +4 -0
- package/api/resources/company/types/index.js +20 -0
- package/api/resources/index.d.ts +3 -0
- package/api/resources/index.js +4 -1
- package/api/resources/send/client/Client.d.ts +0 -1
- package/api/resources/send/client/Client.js +3 -4
- package/api/resources/send/client/requests/SendMmsRequest.d.ts +1 -2
- package/api/types/index.d.ts +0 -4
- package/api/types/index.js +0 -4
- package/dist/Client.d.ts +3 -69
- package/dist/Client.js +6 -231
- package/dist/api/client/requests/index.d.ts +0 -3
- package/dist/api/resources/company/client/Client.d.ts +96 -0
- package/dist/api/resources/company/client/Client.js +289 -0
- package/dist/api/resources/company/client/index.d.ts +1 -0
- package/dist/api/resources/company/client/index.js +17 -0
- package/dist/api/{client/requests/GetCompanyRequest.d.ts → resources/company/client/requests/CompanyGetRequest.d.ts} +1 -1
- package/{api/client/requests/RegisterCompanyRequest.d.ts → dist/api/resources/company/client/requests/CompanyRegisterRequest.d.ts} +2 -2
- package/dist/api/{client/requests/UpdateCompanyRequest.d.ts → resources/company/client/requests/CompanyUpdateRequest.d.ts} +2 -2
- package/dist/api/resources/company/client/requests/index.d.ts +3 -0
- package/dist/api/resources/company/client/requests/index.js +2 -0
- package/dist/api/resources/company/index.d.ts +2 -0
- package/dist/api/resources/company/index.js +18 -0
- package/dist/api/resources/company/types/CompanyRegisterResponse.d.ts +7 -0
- package/dist/api/{types/RegisterCompanyResponseBrand.d.ts → resources/company/types/CompanyRegisterResponseBrand.d.ts} +1 -1
- package/dist/api/resources/company/types/CompanyUpdateResponse.d.ts +7 -0
- package/dist/api/{types/UpdateCompanyResponseBrand.d.ts → resources/company/types/CompanyUpdateResponseBrand.d.ts} +1 -1
- package/dist/api/resources/company/types/index.d.ts +4 -0
- package/dist/api/resources/company/types/index.js +20 -0
- package/dist/api/resources/index.d.ts +3 -0
- package/dist/api/resources/index.js +4 -1
- package/dist/api/resources/send/client/Client.d.ts +0 -1
- package/dist/api/resources/send/client/Client.js +3 -4
- package/dist/api/resources/send/client/requests/SendMmsRequest.d.ts +1 -2
- package/dist/api/types/index.d.ts +0 -4
- package/dist/api/types/index.js +0 -4
- package/dist/serialization/index.d.ts +0 -1
- package/dist/serialization/index.js +0 -1
- package/dist/serialization/resources/company/client/get.d.ts +11 -0
- package/dist/serialization/{client/getCompany.js → resources/company/client/get.js} +2 -2
- package/dist/serialization/resources/company/client/index.d.ts +2 -0
- package/{serialization → dist/serialization/resources/company}/client/index.js +2 -2
- package/dist/serialization/resources/company/client/requests/CompanyRegisterRequest.d.ts +19 -0
- package/dist/serialization/{client/requests/RegisterCompanyRequest.js → resources/company/client/requests/CompanyRegisterRequest.js} +7 -7
- package/dist/serialization/resources/company/client/requests/CompanyUpdateRequest.d.ts +20 -0
- package/dist/serialization/{client/requests/UpdateCompanyRequest.js → resources/company/client/requests/CompanyUpdateRequest.js} +7 -7
- package/dist/serialization/resources/company/client/requests/index.d.ts +2 -0
- package/dist/serialization/resources/company/client/requests/index.js +7 -0
- package/dist/serialization/resources/company/index.d.ts +2 -0
- package/dist/serialization/resources/company/index.js +18 -0
- package/dist/serialization/resources/company/types/CompanyRegisterResponse.d.ts +13 -0
- package/dist/serialization/{types/RegisterCompanyResponse.js → resources/company/types/CompanyRegisterResponse.js} +5 -5
- package/dist/serialization/resources/company/types/CompanyRegisterResponseBrand.d.ts +13 -0
- package/{serialization/types/RegisterCompanyResponseBrand.js → dist/serialization/resources/company/types/CompanyRegisterResponseBrand.js} +3 -3
- package/dist/serialization/resources/company/types/CompanyUpdateResponse.d.ts +13 -0
- package/{serialization/types/UpdateCompanyResponse.js → dist/serialization/resources/company/types/CompanyUpdateResponse.js} +5 -5
- package/dist/serialization/resources/company/types/CompanyUpdateResponseBrand.d.ts +13 -0
- package/dist/serialization/{types/UpdateCompanyResponseBrand.js → resources/company/types/CompanyUpdateResponseBrand.js} +3 -3
- package/dist/serialization/resources/company/types/index.d.ts +4 -0
- package/dist/serialization/resources/company/types/index.js +20 -0
- package/dist/serialization/resources/index.d.ts +3 -0
- package/dist/serialization/resources/index.js +4 -1
- package/dist/serialization/resources/send/client/requests/SendMmsRequest.d.ts +1 -1
- package/dist/serialization/resources/send/client/requests/SendMmsRequest.js +1 -1
- package/dist/serialization/types/index.d.ts +0 -4
- package/dist/serialization/types/index.js +0 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/reference.md +222 -7
- package/serialization/index.d.ts +0 -1
- package/serialization/index.js +0 -1
- package/serialization/resources/company/client/get.d.ts +11 -0
- package/serialization/{client/getCompany.js → resources/company/client/get.js} +2 -2
- package/serialization/resources/company/client/index.d.ts +2 -0
- package/{dist/serialization → serialization/resources/company}/client/index.js +2 -2
- package/serialization/resources/company/client/requests/CompanyRegisterRequest.d.ts +19 -0
- package/serialization/{client/requests/RegisterCompanyRequest.js → resources/company/client/requests/CompanyRegisterRequest.js} +7 -7
- package/serialization/resources/company/client/requests/CompanyUpdateRequest.d.ts +20 -0
- package/serialization/{client/requests/UpdateCompanyRequest.js → resources/company/client/requests/CompanyUpdateRequest.js} +7 -7
- package/serialization/resources/company/client/requests/index.d.ts +2 -0
- package/serialization/resources/company/client/requests/index.js +7 -0
- package/serialization/resources/company/index.d.ts +2 -0
- package/serialization/resources/company/index.js +18 -0
- package/serialization/resources/company/types/CompanyRegisterResponse.d.ts +13 -0
- package/serialization/{types/RegisterCompanyResponse.js → resources/company/types/CompanyRegisterResponse.js} +5 -5
- package/serialization/resources/company/types/CompanyRegisterResponseBrand.d.ts +13 -0
- package/{dist/serialization/types/RegisterCompanyResponseBrand.js → serialization/resources/company/types/CompanyRegisterResponseBrand.js} +3 -3
- package/serialization/resources/company/types/CompanyUpdateResponse.d.ts +13 -0
- package/{dist/serialization/types/UpdateCompanyResponse.js → serialization/resources/company/types/CompanyUpdateResponse.js} +5 -5
- package/serialization/resources/company/types/CompanyUpdateResponseBrand.d.ts +13 -0
- package/serialization/{types/UpdateCompanyResponseBrand.js → resources/company/types/CompanyUpdateResponseBrand.js} +3 -3
- package/serialization/resources/company/types/index.d.ts +4 -0
- package/serialization/resources/company/types/index.js +20 -0
- package/serialization/resources/index.d.ts +3 -0
- package/serialization/resources/index.js +4 -1
- package/serialization/resources/send/client/requests/SendMmsRequest.d.ts +1 -1
- package/serialization/resources/send/client/requests/SendMmsRequest.js +1 -1
- package/serialization/types/index.d.ts +0 -4
- package/serialization/types/index.js +0 -4
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/api/types/RegisterCompanyResponse.d.ts +0 -7
- package/api/types/UpdateCompanyResponse.d.ts +0 -7
- package/dist/api/types/RegisterCompanyResponse.d.ts +0 -7
- package/dist/api/types/UpdateCompanyResponse.d.ts +0 -7
- package/dist/serialization/client/getCompany.d.ts +0 -11
- package/dist/serialization/client/index.d.ts +0 -2
- package/dist/serialization/client/requests/RegisterCompanyRequest.d.ts +0 -19
- package/dist/serialization/client/requests/UpdateCompanyRequest.d.ts +0 -20
- package/dist/serialization/client/requests/index.d.ts +0 -2
- package/dist/serialization/client/requests/index.js +0 -7
- package/dist/serialization/types/RegisterCompanyResponse.d.ts +0 -13
- package/dist/serialization/types/RegisterCompanyResponseBrand.d.ts +0 -13
- package/dist/serialization/types/UpdateCompanyResponse.d.ts +0 -13
- package/dist/serialization/types/UpdateCompanyResponseBrand.d.ts +0 -13
- package/serialization/client/getCompany.d.ts +0 -11
- package/serialization/client/index.d.ts +0 -2
- package/serialization/client/requests/RegisterCompanyRequest.d.ts +0 -19
- package/serialization/client/requests/UpdateCompanyRequest.d.ts +0 -20
- package/serialization/client/requests/index.d.ts +0 -2
- package/serialization/client/requests/index.js +0 -7
- package/serialization/types/RegisterCompanyResponse.d.ts +0 -13
- package/serialization/types/RegisterCompanyResponseBrand.d.ts +0 -13
- package/serialization/types/UpdateCompanyResponse.d.ts +0 -13
- package/serialization/types/UpdateCompanyResponseBrand.d.ts +0 -13
- /package/api/{client/requests/GetCompanyRequest.js → resources/company/client/requests/CompanyGetRequest.js} +0 -0
- /package/api/{client/requests/RegisterCompanyRequest.js → resources/company/client/requests/CompanyRegisterRequest.js} +0 -0
- /package/api/{client/requests/UpdateCompanyRequest.js → resources/company/client/requests/CompanyUpdateRequest.js} +0 -0
- /package/api/{types/RegisterCompanyResponse.js → resources/company/types/CompanyRegisterResponse.js} +0 -0
- /package/api/{types/RegisterCompanyResponseBrand.js → resources/company/types/CompanyRegisterResponseBrand.js} +0 -0
- /package/api/{types/UpdateCompanyResponse.js → resources/company/types/CompanyUpdateResponse.js} +0 -0
- /package/api/{types/UpdateCompanyResponseBrand.js → resources/company/types/CompanyUpdateResponseBrand.js} +0 -0
- /package/dist/api/{client/requests/GetCompanyRequest.js → resources/company/client/requests/CompanyGetRequest.js} +0 -0
- /package/dist/api/{client/requests/RegisterCompanyRequest.js → resources/company/client/requests/CompanyRegisterRequest.js} +0 -0
- /package/dist/api/{client/requests/UpdateCompanyRequest.js → resources/company/client/requests/CompanyUpdateRequest.js} +0 -0
- /package/dist/api/{types/RegisterCompanyResponse.js → resources/company/types/CompanyRegisterResponse.js} +0 -0
- /package/dist/api/{types/RegisterCompanyResponseBrand.js → resources/company/types/CompanyRegisterResponseBrand.js} +0 -0
- /package/dist/api/{types/UpdateCompanyResponse.js → resources/company/types/CompanyUpdateResponse.js} +0 -0
- /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
|
-
|
|
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/
|
|
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.
|
|
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
|
|
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
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
+
}
|