rcs-js 1.0.15 → 1.0.16

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 (90) hide show
  1. package/Client.d.ts +3 -0
  2. package/Client.js +6 -1
  3. package/api/resources/company/client/Client.js +3 -3
  4. package/api/resources/index.d.ts +3 -0
  5. package/api/resources/index.js +4 -1
  6. package/api/resources/send/client/Client.js +3 -3
  7. package/api/resources/tools/client/Client.d.ts +61 -0
  8. package/api/resources/tools/client/Client.js +195 -0
  9. package/api/resources/tools/client/index.d.ts +1 -0
  10. package/api/resources/tools/client/index.js +17 -0
  11. package/api/resources/tools/client/requests/ToolsShortenUrlRequest.d.ts +15 -0
  12. package/api/resources/tools/client/requests/ToolsShortenUrlRequest.js +5 -0
  13. package/api/resources/tools/client/requests/ToolsUploadUrlRequest.d.ts +24 -0
  14. package/api/resources/tools/client/requests/ToolsUploadUrlRequest.js +5 -0
  15. package/api/resources/tools/client/requests/index.d.ts +2 -0
  16. package/api/resources/tools/client/requests/index.js +2 -0
  17. package/api/resources/tools/index.d.ts +2 -0
  18. package/api/resources/tools/index.js +18 -0
  19. package/api/resources/tools/types/ToolsShortenUrlResponse.d.ts +9 -0
  20. package/api/resources/tools/types/ToolsShortenUrlResponse.js +5 -0
  21. package/api/resources/tools/types/ToolsUploadUrlResponse.d.ts +9 -0
  22. package/api/resources/tools/types/ToolsUploadUrlResponse.js +5 -0
  23. package/api/resources/tools/types/index.d.ts +2 -0
  24. package/api/resources/tools/types/index.js +18 -0
  25. package/dist/Client.d.ts +3 -0
  26. package/dist/Client.js +6 -1
  27. package/dist/api/resources/company/client/Client.js +3 -3
  28. package/dist/api/resources/index.d.ts +3 -0
  29. package/dist/api/resources/index.js +4 -1
  30. package/dist/api/resources/send/client/Client.js +3 -3
  31. package/dist/api/resources/tools/client/Client.d.ts +61 -0
  32. package/dist/api/resources/tools/client/Client.js +195 -0
  33. package/dist/api/resources/tools/client/index.d.ts +1 -0
  34. package/dist/api/resources/tools/client/index.js +17 -0
  35. package/dist/api/resources/tools/client/requests/ToolsShortenUrlRequest.d.ts +15 -0
  36. package/dist/api/resources/tools/client/requests/ToolsShortenUrlRequest.js +5 -0
  37. package/dist/api/resources/tools/client/requests/ToolsUploadUrlRequest.d.ts +24 -0
  38. package/dist/api/resources/tools/client/requests/ToolsUploadUrlRequest.js +5 -0
  39. package/dist/api/resources/tools/client/requests/index.d.ts +2 -0
  40. package/dist/api/resources/tools/client/requests/index.js +2 -0
  41. package/dist/api/resources/tools/index.d.ts +2 -0
  42. package/dist/api/resources/tools/index.js +18 -0
  43. package/dist/api/resources/tools/types/ToolsShortenUrlResponse.d.ts +9 -0
  44. package/dist/api/resources/tools/types/ToolsShortenUrlResponse.js +5 -0
  45. package/dist/api/resources/tools/types/ToolsUploadUrlResponse.d.ts +9 -0
  46. package/dist/api/resources/tools/types/ToolsUploadUrlResponse.js +5 -0
  47. package/dist/api/resources/tools/types/index.d.ts +2 -0
  48. package/dist/api/resources/tools/types/index.js +18 -0
  49. package/dist/serialization/resources/index.d.ts +3 -0
  50. package/dist/serialization/resources/index.js +4 -1
  51. package/dist/serialization/resources/tools/client/index.d.ts +1 -0
  52. package/dist/serialization/resources/tools/client/index.js +17 -0
  53. package/dist/serialization/resources/tools/client/requests/ToolsShortenUrlRequest.d.ts +13 -0
  54. package/dist/serialization/resources/tools/client/requests/ToolsShortenUrlRequest.js +34 -0
  55. package/dist/serialization/resources/tools/client/requests/ToolsUploadUrlRequest.d.ts +14 -0
  56. package/dist/serialization/resources/tools/client/requests/ToolsUploadUrlRequest.js +35 -0
  57. package/dist/serialization/resources/tools/client/requests/index.d.ts +2 -0
  58. package/dist/serialization/resources/tools/client/requests/index.js +7 -0
  59. package/dist/serialization/resources/tools/index.d.ts +2 -0
  60. package/dist/serialization/resources/tools/index.js +18 -0
  61. package/dist/serialization/resources/tools/types/ToolsShortenUrlResponse.d.ts +13 -0
  62. package/dist/serialization/resources/tools/types/ToolsShortenUrlResponse.js +34 -0
  63. package/dist/serialization/resources/tools/types/ToolsUploadUrlResponse.d.ts +13 -0
  64. package/dist/serialization/resources/tools/types/ToolsUploadUrlResponse.js +34 -0
  65. package/dist/serialization/resources/tools/types/index.d.ts +2 -0
  66. package/dist/serialization/resources/tools/types/index.js +18 -0
  67. package/dist/version.d.ts +1 -1
  68. package/dist/version.js +1 -1
  69. package/package.json +5 -3
  70. package/reference.md +134 -0
  71. package/serialization/resources/index.d.ts +3 -0
  72. package/serialization/resources/index.js +4 -1
  73. package/serialization/resources/tools/client/index.d.ts +1 -0
  74. package/serialization/resources/tools/client/index.js +17 -0
  75. package/serialization/resources/tools/client/requests/ToolsShortenUrlRequest.d.ts +13 -0
  76. package/serialization/resources/tools/client/requests/ToolsShortenUrlRequest.js +34 -0
  77. package/serialization/resources/tools/client/requests/ToolsUploadUrlRequest.d.ts +14 -0
  78. package/serialization/resources/tools/client/requests/ToolsUploadUrlRequest.js +35 -0
  79. package/serialization/resources/tools/client/requests/index.d.ts +2 -0
  80. package/serialization/resources/tools/client/requests/index.js +7 -0
  81. package/serialization/resources/tools/index.d.ts +2 -0
  82. package/serialization/resources/tools/index.js +18 -0
  83. package/serialization/resources/tools/types/ToolsShortenUrlResponse.d.ts +13 -0
  84. package/serialization/resources/tools/types/ToolsShortenUrlResponse.js +34 -0
  85. package/serialization/resources/tools/types/ToolsUploadUrlResponse.d.ts +13 -0
  86. package/serialization/resources/tools/types/ToolsUploadUrlResponse.js +34 -0
  87. package/serialization/resources/tools/types/index.d.ts +2 -0
  88. package/serialization/resources/tools/types/index.js +18 -0
  89. package/version.d.ts +1 -1
  90. package/version.js +1 -1
package/Client.d.ts CHANGED
@@ -6,6 +6,7 @@ import * as core from "./core";
6
6
  import * as Pinnacle from "./api/index";
7
7
  import { Company } from "./api/resources/company/client/Client";
8
8
  import { Send } from "./api/resources/send/client/Client";
9
+ import { Tools } from "./api/resources/tools/client/Client";
9
10
  export declare namespace PinnacleClient {
10
11
  interface Options {
11
12
  environment?: core.Supplier<environments.PinnacleEnvironment | string>;
@@ -41,6 +42,8 @@ export declare class PinnacleClient {
41
42
  get company(): Company;
42
43
  protected _send: Send | undefined;
43
44
  get send(): Send;
45
+ protected _tools: Tools | undefined;
46
+ get tools(): Tools;
44
47
  protected _getCustomAuthorizationHeaders(): Promise<{
45
48
  "PINNACLE-API-Key": string;
46
49
  }>;
package/Client.js CHANGED
@@ -47,6 +47,7 @@ const serializers = __importStar(require("./serialization/index"));
47
47
  const errors = __importStar(require("./errors/index"));
48
48
  const Client_1 = require("./api/resources/company/client/Client");
49
49
  const Client_2 = require("./api/resources/send/client/Client");
50
+ const Client_3 = require("./api/resources/tools/client/Client");
50
51
  class PinnacleClient {
51
52
  constructor(_options) {
52
53
  this._options = _options;
@@ -75,7 +76,7 @@ class PinnacleClient {
75
76
  const _response = yield core.fetcher({
76
77
  url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "rcs_functionality"),
77
78
  method: "GET",
78
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.15", "User-Agent": "rcs-js/1.0.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
79
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.16", "User-Agent": "rcs-js/1.0.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
79
80
  contentType: "application/json",
80
81
  queryParameters: _queryParams,
81
82
  requestType: "json",
@@ -129,6 +130,10 @@ class PinnacleClient {
129
130
  var _a;
130
131
  return ((_a = this._send) !== null && _a !== void 0 ? _a : (this._send = new Client_2.Send(this._options)));
131
132
  }
133
+ get tools() {
134
+ var _a;
135
+ return ((_a = this._tools) !== null && _a !== void 0 ? _a : (this._tools = new Client_3.Tools(this._options)));
136
+ }
132
137
  _getCustomAuthorizationHeaders() {
133
138
  return __awaiter(this, void 0, void 0, function* () {
134
139
  const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
@@ -76,7 +76,7 @@ class Company {
76
76
  const _response = yield core.fetcher({
77
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
78
  method: "GET",
79
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.15", "User-Agent": "rcs-js/1.0.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
79
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.16", "User-Agent": "rcs-js/1.0.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
80
80
  contentType: "application/json",
81
81
  queryParameters: _queryParams,
82
82
  requestType: "json",
@@ -175,7 +175,7 @@ class Company {
175
175
  const _response = yield core.fetcher({
176
176
  url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "company/register"),
177
177
  method: "POST",
178
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.15", "User-Agent": "rcs-js/1.0.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
178
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.16", "User-Agent": "rcs-js/1.0.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
179
179
  contentType: "application/json",
180
180
  requestType: "json",
181
181
  body: serializers.CompanyRegisterRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -244,7 +244,7 @@ class Company {
244
244
  const _response = yield core.fetcher({
245
245
  url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "company/update"),
246
246
  method: "POST",
247
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.15", "User-Agent": "rcs-js/1.0.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
247
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.16", "User-Agent": "rcs-js/1.0.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
248
248
  contentType: "application/json",
249
249
  requestType: "json",
250
250
  body: serializers.CompanyUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -2,5 +2,8 @@ export * as company from "./company";
2
2
  export * from "./company/types";
3
3
  export * as send from "./send";
4
4
  export * from "./send/types";
5
+ export * as tools from "./tools";
6
+ export * from "./tools/types";
5
7
  export * from "./company/client/requests";
6
8
  export * from "./send/client/requests";
9
+ export * from "./tools/client/requests";
@@ -26,10 +26,13 @@ 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 = exports.company = void 0;
29
+ exports.tools = exports.send = exports.company = void 0;
30
30
  exports.company = __importStar(require("./company"));
31
31
  __exportStar(require("./company/types"), exports);
32
32
  exports.send = __importStar(require("./send"));
33
33
  __exportStar(require("./send/types"), exports);
34
+ exports.tools = __importStar(require("./tools"));
35
+ __exportStar(require("./tools/types"), exports);
34
36
  __exportStar(require("./company/client/requests"), exports);
35
37
  __exportStar(require("./send/client/requests"), exports);
38
+ __exportStar(require("./tools/client/requests"), exports);
@@ -75,7 +75,7 @@ class Send {
75
75
  const _response = yield core.fetcher({
76
76
  url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "send/rcs"),
77
77
  method: "POST",
78
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.15", "User-Agent": "rcs-js/1.0.15", "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.16", "User-Agent": "rcs-js/1.0.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
79
79
  contentType: "application/json",
80
80
  requestType: "json",
81
81
  body: serializers.Rcs.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -150,7 +150,7 @@ class Send {
150
150
  const _response = yield core.fetcher({
151
151
  url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "send/sms"),
152
152
  method: "POST",
153
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.15", "User-Agent": "rcs-js/1.0.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
153
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.16", "User-Agent": "rcs-js/1.0.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
154
154
  contentType: "application/json",
155
155
  requestType: "json",
156
156
  body: serializers.SendSmsRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -225,7 +225,7 @@ class Send {
225
225
  const _response = yield core.fetcher({
226
226
  url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "send/mms"),
227
227
  method: "POST",
228
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.15", "User-Agent": "rcs-js/1.0.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
228
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.16", "User-Agent": "rcs-js/1.0.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
229
229
  contentType: "application/json",
230
230
  requestType: "json",
231
231
  body: serializers.SendMmsRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -0,0 +1,61 @@
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 Tools {
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 Tools {
22
+ protected readonly _options: Tools.Options;
23
+ constructor(_options: Tools.Options);
24
+ /**
25
+ * Create a shortened URL with an optional expiration date (default and max expiration is 90 days). The shortened URL will redirect to the original URL and will have the following format https://urls.p1n.io/ABCD5678.
26
+ *
27
+ * @param {Pinnacle.ToolsShortenUrlRequest} request
28
+ * @param {Tools.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.tools.shortenUrl({
36
+ * url: "https://example.com"
37
+ * })
38
+ */
39
+ shortenUrl(request: Pinnacle.ToolsShortenUrlRequest, requestOptions?: Tools.RequestOptions): Promise<Pinnacle.ToolsShortenUrlResponse>;
40
+ /**
41
+ * Generate signed upload (expires in 2 hours) and download URLs for a file (expires in 1 hour).
42
+ *
43
+ * @param {Pinnacle.ToolsUploadUrlRequest} request
44
+ * @param {Tools.RequestOptions} requestOptions - Request-specific configuration.
45
+ *
46
+ * @throws {@link Pinnacle.BadRequestError}
47
+ * @throws {@link Pinnacle.UnauthorizedError}
48
+ * @throws {@link Pinnacle.InternalServerError}
49
+ *
50
+ * @example
51
+ * await client.tools.uploadUrl({
52
+ * contentType: "image/png",
53
+ * size: 1024,
54
+ * name: "example.png"
55
+ * })
56
+ */
57
+ uploadUrl(request: Pinnacle.ToolsUploadUrlRequest, requestOptions?: Tools.RequestOptions): Promise<Pinnacle.ToolsUploadUrlResponse>;
58
+ protected _getCustomAuthorizationHeaders(): Promise<{
59
+ "PINNACLE-API-Key": string;
60
+ }>;
61
+ }
@@ -0,0 +1,195 @@
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.Tools = void 0;
42
+ const environments = __importStar(require("../../../../environments"));
43
+ const core = __importStar(require("../../../../core"));
44
+ const Pinnacle = __importStar(require("../../../index"));
45
+ const serializers = __importStar(require("../../../../serialization/index"));
46
+ const url_join_1 = __importDefault(require("url-join"));
47
+ const errors = __importStar(require("../../../../errors/index"));
48
+ class Tools {
49
+ constructor(_options) {
50
+ this._options = _options;
51
+ }
52
+ /**
53
+ * Create a shortened URL with an optional expiration date (default and max expiration is 90 days). The shortened URL will redirect to the original URL and will have the following format https://urls.p1n.io/ABCD5678.
54
+ *
55
+ * @param {Pinnacle.ToolsShortenUrlRequest} request
56
+ * @param {Tools.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.tools.shortenUrl({
64
+ * url: "https://example.com"
65
+ * })
66
+ */
67
+ shortenUrl(request, requestOptions) {
68
+ var _a;
69
+ return __awaiter(this, void 0, void 0, function* () {
70
+ const _response = yield core.fetcher({
71
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "tools/urls/shorten"),
72
+ method: "POST",
73
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.16", "User-Agent": "rcs-js/1.0.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
74
+ contentType: "application/json",
75
+ requestType: "json",
76
+ body: serializers.ToolsShortenUrlRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
77
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
78
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
79
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
80
+ });
81
+ if (_response.ok) {
82
+ return serializers.ToolsShortenUrlResponse.parseOrThrow(_response.body, {
83
+ unrecognizedObjectKeys: "passthrough",
84
+ allowUnrecognizedUnionMembers: true,
85
+ allowUnrecognizedEnumValues: true,
86
+ breadcrumbsPrefix: ["response"],
87
+ });
88
+ }
89
+ if (_response.error.reason === "status-code") {
90
+ switch (_response.error.statusCode) {
91
+ case 400:
92
+ throw new Pinnacle.BadRequestError(_response.error.body);
93
+ case 401:
94
+ throw new Pinnacle.UnauthorizedError(_response.error.body);
95
+ case 500:
96
+ throw new Pinnacle.InternalServerError(_response.error.body);
97
+ default:
98
+ throw new errors.PinnacleError({
99
+ statusCode: _response.error.statusCode,
100
+ body: _response.error.body,
101
+ });
102
+ }
103
+ }
104
+ switch (_response.error.reason) {
105
+ case "non-json":
106
+ throw new errors.PinnacleError({
107
+ statusCode: _response.error.statusCode,
108
+ body: _response.error.rawBody,
109
+ });
110
+ case "timeout":
111
+ throw new errors.PinnacleTimeoutError();
112
+ case "unknown":
113
+ throw new errors.PinnacleError({
114
+ message: _response.error.errorMessage,
115
+ });
116
+ }
117
+ });
118
+ }
119
+ /**
120
+ * Generate signed upload (expires in 2 hours) and download URLs for a file (expires in 1 hour).
121
+ *
122
+ * @param {Pinnacle.ToolsUploadUrlRequest} request
123
+ * @param {Tools.RequestOptions} requestOptions - Request-specific configuration.
124
+ *
125
+ * @throws {@link Pinnacle.BadRequestError}
126
+ * @throws {@link Pinnacle.UnauthorizedError}
127
+ * @throws {@link Pinnacle.InternalServerError}
128
+ *
129
+ * @example
130
+ * await client.tools.uploadUrl({
131
+ * contentType: "image/png",
132
+ * size: 1024,
133
+ * name: "example.png"
134
+ * })
135
+ */
136
+ uploadUrl(request, requestOptions) {
137
+ var _a;
138
+ return __awaiter(this, void 0, void 0, function* () {
139
+ const _response = yield core.fetcher({
140
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "tools/uploadUrl"),
141
+ method: "POST",
142
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.16", "User-Agent": "rcs-js/1.0.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
143
+ contentType: "application/json",
144
+ requestType: "json",
145
+ body: serializers.ToolsUploadUrlRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
146
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
147
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
148
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
149
+ });
150
+ if (_response.ok) {
151
+ return serializers.ToolsUploadUrlResponse.parseOrThrow(_response.body, {
152
+ unrecognizedObjectKeys: "passthrough",
153
+ allowUnrecognizedUnionMembers: true,
154
+ allowUnrecognizedEnumValues: true,
155
+ breadcrumbsPrefix: ["response"],
156
+ });
157
+ }
158
+ if (_response.error.reason === "status-code") {
159
+ switch (_response.error.statusCode) {
160
+ case 400:
161
+ throw new Pinnacle.BadRequestError(_response.error.body);
162
+ case 401:
163
+ throw new Pinnacle.UnauthorizedError(_response.error.body);
164
+ case 500:
165
+ throw new Pinnacle.InternalServerError(_response.error.body);
166
+ default:
167
+ throw new errors.PinnacleError({
168
+ statusCode: _response.error.statusCode,
169
+ body: _response.error.body,
170
+ });
171
+ }
172
+ }
173
+ switch (_response.error.reason) {
174
+ case "non-json":
175
+ throw new errors.PinnacleError({
176
+ statusCode: _response.error.statusCode,
177
+ body: _response.error.rawBody,
178
+ });
179
+ case "timeout":
180
+ throw new errors.PinnacleTimeoutError();
181
+ case "unknown":
182
+ throw new errors.PinnacleError({
183
+ message: _response.error.errorMessage,
184
+ });
185
+ }
186
+ });
187
+ }
188
+ _getCustomAuthorizationHeaders() {
189
+ return __awaiter(this, void 0, void 0, function* () {
190
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
191
+ return { "PINNACLE-API-Key": apiKeyValue };
192
+ });
193
+ }
194
+ }
195
+ exports.Tools = Tools;
@@ -0,0 +1 @@
1
+ export * from "./requests";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests"), exports);
@@ -0,0 +1,15 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * url: "https://example.com"
8
+ * }
9
+ */
10
+ export interface ToolsShortenUrlRequest {
11
+ /** The URL to be shortened. Must be a valid URL with either http or https protocol. */
12
+ url: string;
13
+ /** Optional expiration date for the shortened URL in ISO 8601 format. Default and max expiration is 90 days. */
14
+ expiresAt?: Date;
15
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,24 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * contentType: "image/png",
8
+ * size: 1024,
9
+ * name: "example.png"
10
+ * }
11
+ */
12
+ export interface ToolsUploadUrlRequest {
13
+ /**
14
+ * The MIME type of the file.
15
+ *
16
+ * Supported types are audio/basic, audio/L24, audio/mp4, audio/mpeg, audio/mpg, audio/mp3, audio/ogg, audio/aac, audio/vndrn-realaudio, audio/vndwave, audio/3gpp, audio/3gpp2, audio/ac3, audio/webm, audio/amrnb, audio/amr, video/mpeg, video/mp4, video/quicktime, video/webm, video/3gpp, video/3gpp2, video/3gpptt, video/H261, video/H263, video/H2631998, video/H2632000, video/H264, video/m4v, video/mpeg4, video/webm, image/jpeg, image/gif, image/png, image/gif, image/bmp, image/tiff, image/webp, text/vcard, text/xvcard, text/csv, text/rtf, text/richtext, text/calendar, text/directory, application/ogg, application/pdf, application/vcard, application/vndapple.pkpass.
17
+ *
18
+ */
19
+ contentType: string;
20
+ /** The size of the file in bytes. Should be less than 100 MB. */
21
+ size: number;
22
+ /** The name of the file. */
23
+ name: string;
24
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export { type ToolsShortenUrlRequest } from "./ToolsShortenUrlRequest";
2
+ export { type ToolsUploadUrlRequest } from "./ToolsUploadUrlRequest";
@@ -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,9 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface ToolsShortenUrlResponse {
5
+ /** The shortened URL. */
6
+ shortenedUrl?: string;
7
+ /** The expiration date of the shortened URL, if provided. */
8
+ expiresAt?: Date;
9
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface ToolsUploadUrlResponse {
5
+ /** The URL to upload the file. */
6
+ upload?: string;
7
+ /** The URL to download the file. */
8
+ download?: string;
9
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export * from "./ToolsShortenUrlResponse";
2
+ export * from "./ToolsUploadUrlResponse";
@@ -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("./ToolsShortenUrlResponse"), exports);
18
+ __exportStar(require("./ToolsUploadUrlResponse"), exports);
package/dist/Client.d.ts CHANGED
@@ -6,6 +6,7 @@ import * as core from "./core";
6
6
  import * as Pinnacle from "./api/index";
7
7
  import { Company } from "./api/resources/company/client/Client";
8
8
  import { Send } from "./api/resources/send/client/Client";
9
+ import { Tools } from "./api/resources/tools/client/Client";
9
10
  export declare namespace PinnacleClient {
10
11
  interface Options {
11
12
  environment?: core.Supplier<environments.PinnacleEnvironment | string>;
@@ -41,6 +42,8 @@ export declare class PinnacleClient {
41
42
  get company(): Company;
42
43
  protected _send: Send | undefined;
43
44
  get send(): Send;
45
+ protected _tools: Tools | undefined;
46
+ get tools(): Tools;
44
47
  protected _getCustomAuthorizationHeaders(): Promise<{
45
48
  "PINNACLE-API-Key": string;
46
49
  }>;
package/dist/Client.js CHANGED
@@ -47,6 +47,7 @@ const serializers = __importStar(require("./serialization/index"));
47
47
  const errors = __importStar(require("./errors/index"));
48
48
  const Client_1 = require("./api/resources/company/client/Client");
49
49
  const Client_2 = require("./api/resources/send/client/Client");
50
+ const Client_3 = require("./api/resources/tools/client/Client");
50
51
  class PinnacleClient {
51
52
  constructor(_options) {
52
53
  this._options = _options;
@@ -75,7 +76,7 @@ class PinnacleClient {
75
76
  const _response = yield core.fetcher({
76
77
  url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "rcs_functionality"),
77
78
  method: "GET",
78
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.15", "User-Agent": "rcs-js/1.0.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
79
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.16", "User-Agent": "rcs-js/1.0.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
79
80
  contentType: "application/json",
80
81
  queryParameters: _queryParams,
81
82
  requestType: "json",
@@ -129,6 +130,10 @@ class PinnacleClient {
129
130
  var _a;
130
131
  return ((_a = this._send) !== null && _a !== void 0 ? _a : (this._send = new Client_2.Send(this._options)));
131
132
  }
133
+ get tools() {
134
+ var _a;
135
+ return ((_a = this._tools) !== null && _a !== void 0 ? _a : (this._tools = new Client_3.Tools(this._options)));
136
+ }
132
137
  _getCustomAuthorizationHeaders() {
133
138
  return __awaiter(this, void 0, void 0, function* () {
134
139
  const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
@@ -76,7 +76,7 @@ class Company {
76
76
  const _response = yield core.fetcher({
77
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
78
  method: "GET",
79
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.15", "User-Agent": "rcs-js/1.0.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
79
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.16", "User-Agent": "rcs-js/1.0.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
80
80
  contentType: "application/json",
81
81
  queryParameters: _queryParams,
82
82
  requestType: "json",
@@ -175,7 +175,7 @@ class Company {
175
175
  const _response = yield core.fetcher({
176
176
  url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "company/register"),
177
177
  method: "POST",
178
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.15", "User-Agent": "rcs-js/1.0.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
178
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.16", "User-Agent": "rcs-js/1.0.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
179
179
  contentType: "application/json",
180
180
  requestType: "json",
181
181
  body: serializers.CompanyRegisterRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -244,7 +244,7 @@ class Company {
244
244
  const _response = yield core.fetcher({
245
245
  url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PinnacleEnvironment.Default, "company/update"),
246
246
  method: "POST",
247
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.15", "User-Agent": "rcs-js/1.0.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
247
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "rcs-js", "X-Fern-SDK-Version": "1.0.16", "User-Agent": "rcs-js/1.0.16", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
248
248
  contentType: "application/json",
249
249
  requestType: "json",
250
250
  body: serializers.CompanyUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),