dub 0.0.0 → 0.0.1

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 (221) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +241 -0
  3. package/_shims/MultipartBody.d.ts +9 -0
  4. package/_shims/MultipartBody.d.ts.map +1 -0
  5. package/_shims/MultipartBody.js +16 -0
  6. package/_shims/MultipartBody.js.map +1 -0
  7. package/_shims/MultipartBody.mjs +12 -0
  8. package/_shims/MultipartBody.mjs.map +1 -0
  9. package/_shims/README.md +46 -0
  10. package/_shims/auto/runtime-bun.d.ts +5 -0
  11. package/_shims/auto/runtime-bun.d.ts.map +1 -0
  12. package/_shims/auto/runtime-bun.js +21 -0
  13. package/_shims/auto/runtime-bun.js.map +1 -0
  14. package/_shims/auto/runtime-bun.mjs +2 -0
  15. package/_shims/auto/runtime-bun.mjs.map +1 -0
  16. package/_shims/auto/runtime-node.d.ts +5 -0
  17. package/_shims/auto/runtime-node.d.ts.map +1 -0
  18. package/_shims/auto/runtime-node.js +21 -0
  19. package/_shims/auto/runtime-node.js.map +1 -0
  20. package/_shims/auto/runtime-node.mjs +2 -0
  21. package/_shims/auto/runtime-node.mjs.map +1 -0
  22. package/_shims/auto/runtime.d.ts +5 -0
  23. package/_shims/auto/runtime.d.ts.map +1 -0
  24. package/_shims/auto/runtime.js +21 -0
  25. package/_shims/auto/runtime.js.map +1 -0
  26. package/_shims/auto/runtime.mjs +2 -0
  27. package/_shims/auto/runtime.mjs.map +1 -0
  28. package/_shims/auto/types-node.d.ts +5 -0
  29. package/_shims/auto/types-node.d.ts.map +1 -0
  30. package/_shims/auto/types-node.js +21 -0
  31. package/_shims/auto/types-node.js.map +1 -0
  32. package/_shims/auto/types-node.mjs +2 -0
  33. package/_shims/auto/types-node.mjs.map +1 -0
  34. package/_shims/auto/types.d.ts +101 -0
  35. package/_shims/auto/types.js +3 -0
  36. package/_shims/auto/types.mjs +3 -0
  37. package/_shims/bun-runtime.d.ts +6 -0
  38. package/_shims/bun-runtime.d.ts.map +1 -0
  39. package/_shims/bun-runtime.js +14 -0
  40. package/_shims/bun-runtime.js.map +1 -0
  41. package/_shims/bun-runtime.mjs +10 -0
  42. package/_shims/bun-runtime.mjs.map +1 -0
  43. package/_shims/index.d.ts +81 -0
  44. package/_shims/index.js +13 -0
  45. package/_shims/index.mjs +7 -0
  46. package/_shims/manual-types.d.ts +12 -0
  47. package/_shims/manual-types.js +3 -0
  48. package/_shims/manual-types.mjs +3 -0
  49. package/_shims/node-runtime.d.ts +3 -0
  50. package/_shims/node-runtime.d.ts.map +1 -0
  51. package/_shims/node-runtime.js +90 -0
  52. package/_shims/node-runtime.js.map +1 -0
  53. package/_shims/node-runtime.mjs +56 -0
  54. package/_shims/node-runtime.mjs.map +1 -0
  55. package/_shims/node-types.d.ts +42 -0
  56. package/_shims/node-types.js +3 -0
  57. package/_shims/node-types.mjs +3 -0
  58. package/_shims/registry.d.ts +37 -0
  59. package/_shims/registry.d.ts.map +1 -0
  60. package/_shims/registry.js +41 -0
  61. package/_shims/registry.js.map +1 -0
  62. package/_shims/registry.mjs +37 -0
  63. package/_shims/registry.mjs.map +1 -0
  64. package/_shims/web-runtime.d.ts +5 -0
  65. package/_shims/web-runtime.d.ts.map +1 -0
  66. package/_shims/web-runtime.js +78 -0
  67. package/_shims/web-runtime.js.map +1 -0
  68. package/_shims/web-runtime.mjs +71 -0
  69. package/_shims/web-runtime.mjs.map +1 -0
  70. package/_shims/web-types.d.ts +83 -0
  71. package/_shims/web-types.js +3 -0
  72. package/_shims/web-types.mjs +3 -0
  73. package/core.d.ts +230 -0
  74. package/core.d.ts.map +1 -0
  75. package/core.js +848 -0
  76. package/core.js.map +1 -0
  77. package/core.mjs +818 -0
  78. package/core.mjs.map +1 -0
  79. package/error.d.ts +53 -0
  80. package/error.d.ts.map +1 -0
  81. package/error.js +143 -0
  82. package/error.js.map +1 -0
  83. package/error.mjs +127 -0
  84. package/error.mjs.map +1 -0
  85. package/index.d.mts +118 -0
  86. package/index.d.ts +118 -0
  87. package/index.d.ts.map +1 -0
  88. package/index.js +109 -0
  89. package/index.js.map +1 -0
  90. package/index.mjs +81 -0
  91. package/index.mjs.map +1 -0
  92. package/package.json +100 -7
  93. package/resource.d.ts +6 -0
  94. package/resource.d.ts.map +1 -0
  95. package/resource.js +11 -0
  96. package/resource.js.map +1 -0
  97. package/resource.mjs +7 -0
  98. package/resource.mjs.map +1 -0
  99. package/resources/index.d.ts +4 -0
  100. package/resources/index.d.ts.map +1 -0
  101. package/resources/index.js +24 -0
  102. package/resources/index.js.map +1 -0
  103. package/resources/index.mjs +5 -0
  104. package/resources/index.mjs.map +1 -0
  105. package/resources/links/bulk.d.ts +101 -0
  106. package/resources/links/bulk.d.ts.map +1 -0
  107. package/resources/links/bulk.js +18 -0
  108. package/resources/links/bulk.js.map +1 -0
  109. package/resources/links/bulk.mjs +14 -0
  110. package/resources/links/bulk.mjs.map +1 -0
  111. package/resources/links/index.d.ts +4 -0
  112. package/resources/links/index.d.ts.map +1 -0
  113. package/resources/links/index.js +11 -0
  114. package/resources/links/index.js.map +1 -0
  115. package/resources/links/index.mjs +5 -0
  116. package/resources/links/index.mjs.map +1 -0
  117. package/resources/links/info.d.ts +30 -0
  118. package/resources/links/info.d.ts.map +1 -0
  119. package/resources/links/info.js +17 -0
  120. package/resources/links/info.js.map +1 -0
  121. package/resources/links/info.mjs +13 -0
  122. package/resources/links/info.mjs.map +1 -0
  123. package/resources/links/links.d.ts +253 -0
  124. package/resources/links/links.d.ts.map +1 -0
  125. package/resources/links/links.js +71 -0
  126. package/resources/links/links.js.map +1 -0
  127. package/resources/links/links.mjs +44 -0
  128. package/resources/links/links.mjs.map +1 -0
  129. package/resources/projects/index.d.ts +3 -0
  130. package/resources/projects/index.d.ts.map +1 -0
  131. package/resources/projects/index.js +9 -0
  132. package/resources/projects/index.js.map +1 -0
  133. package/resources/projects/index.mjs +4 -0
  134. package/resources/projects/index.mjs.map +1 -0
  135. package/resources/projects/projects.d.ts +98 -0
  136. package/resources/projects/projects.d.ts.map +1 -0
  137. package/resources/projects/projects.js +52 -0
  138. package/resources/projects/projects.js.map +1 -0
  139. package/resources/projects/projects.mjs +25 -0
  140. package/resources/projects/projects.mjs.map +1 -0
  141. package/resources/projects/tags.d.ts +40 -0
  142. package/resources/projects/tags.d.ts.map +1 -0
  143. package/resources/projects/tags.js +23 -0
  144. package/resources/projects/tags.js.map +1 -0
  145. package/resources/projects/tags.mjs +19 -0
  146. package/resources/projects/tags.mjs.map +1 -0
  147. package/resources/shared.d.ts +125 -0
  148. package/resources/shared.d.ts.map +1 -0
  149. package/resources/shared.js +4 -0
  150. package/resources/shared.js.map +1 -0
  151. package/resources/shared.mjs +3 -0
  152. package/resources/shared.mjs.map +1 -0
  153. package/shims/node.d.ts +29 -0
  154. package/shims/node.d.ts.map +1 -0
  155. package/shims/node.js +31 -0
  156. package/shims/node.js.map +1 -0
  157. package/shims/node.mjs +5 -0
  158. package/shims/node.mjs.map +1 -0
  159. package/shims/web.d.ts +26 -0
  160. package/shims/web.d.ts.map +1 -0
  161. package/shims/web.js +31 -0
  162. package/shims/web.js.map +1 -0
  163. package/shims/web.mjs +5 -0
  164. package/shims/web.mjs.map +1 -0
  165. package/src/_shims/MultipartBody.ts +9 -0
  166. package/src/_shims/README.md +46 -0
  167. package/src/_shims/auto/runtime-bun.ts +4 -0
  168. package/src/_shims/auto/runtime-node.ts +4 -0
  169. package/src/_shims/auto/runtime.ts +4 -0
  170. package/src/_shims/auto/types-node.ts +4 -0
  171. package/src/_shims/auto/types.d.ts +101 -0
  172. package/src/_shims/auto/types.js +3 -0
  173. package/src/_shims/auto/types.mjs +3 -0
  174. package/src/_shims/bun-runtime.ts +14 -0
  175. package/src/_shims/index.d.ts +81 -0
  176. package/src/_shims/index.js +13 -0
  177. package/src/_shims/index.mjs +7 -0
  178. package/src/_shims/manual-types.d.ts +12 -0
  179. package/src/_shims/manual-types.js +3 -0
  180. package/src/_shims/manual-types.mjs +3 -0
  181. package/src/_shims/node-runtime.ts +83 -0
  182. package/src/_shims/node-types.d.ts +42 -0
  183. package/src/_shims/node-types.js +3 -0
  184. package/src/_shims/node-types.mjs +3 -0
  185. package/src/_shims/registry.ts +63 -0
  186. package/src/_shims/web-runtime.ts +103 -0
  187. package/src/_shims/web-types.d.ts +83 -0
  188. package/src/_shims/web-types.js +3 -0
  189. package/src/_shims/web-types.mjs +3 -0
  190. package/src/core.ts +1122 -0
  191. package/src/error.ts +146 -0
  192. package/src/index.ts +195 -0
  193. package/src/lib/.keep +4 -0
  194. package/src/resource.ts +11 -0
  195. package/src/resources/index.ts +12 -0
  196. package/src/resources/links/bulk.ts +126 -0
  197. package/src/resources/links/index.ts +12 -0
  198. package/src/resources/links/info.ts +38 -0
  199. package/src/resources/links/links.ts +325 -0
  200. package/src/resources/projects/index.ts +4 -0
  201. package/src/resources/projects/projects.ts +122 -0
  202. package/src/resources/projects/tags.ts +53 -0
  203. package/src/resources/shared.ts +154 -0
  204. package/src/shims/node.ts +50 -0
  205. package/src/shims/web.ts +50 -0
  206. package/src/tsconfig.json +11 -0
  207. package/src/uploads.ts +245 -0
  208. package/src/version.ts +1 -0
  209. package/uploads.d.ts +75 -0
  210. package/uploads.d.ts.map +1 -0
  211. package/uploads.js +163 -0
  212. package/uploads.js.map +1 -0
  213. package/uploads.mjs +150 -0
  214. package/uploads.mjs.map +1 -0
  215. package/version.d.ts +2 -0
  216. package/version.d.ts.map +1 -0
  217. package/version.js +5 -0
  218. package/version.js.map +1 -0
  219. package/version.mjs +2 -0
  220. package/version.mjs.map +1 -0
  221. package/main.js +0 -8
package/index.js ADDED
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
26
+ var _a;
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.fileFromPath = exports.toFile = exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.DubError = exports.Dub = void 0;
29
+ const Core = __importStar(require("./core.js"));
30
+ const Errors = __importStar(require("./error.js"));
31
+ const Uploads = __importStar(require("./uploads.js"));
32
+ const API = __importStar(require("dub/resources/index"));
33
+ /** API Client for interfacing with the Dub API. */
34
+ class Dub extends Core.APIClient {
35
+ /**
36
+ * API Client for interfacing with the Dub API.
37
+ *
38
+ * @param {string} [opts.bearerToken=process.env['DUB_BEARER_TOKEN'] ?? undefined]
39
+ * @param {string} [opts.baseURL=process.env['DUB_BASE_URL'] ?? https://api.dub.co] - Override the default base URL for the API.
40
+ * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
41
+ * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
42
+ * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
43
+ * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
44
+ * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
45
+ * @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
46
+ */
47
+ constructor({ baseURL = Core.readEnv('DUB_BASE_URL'), bearerToken = Core.readEnv('DUB_BEARER_TOKEN'), ...opts } = {}) {
48
+ if (bearerToken === undefined) {
49
+ throw new Errors.DubError("The DUB_BEARER_TOKEN environment variable is missing or empty; either provide it, or instantiate the Dub client with an bearerToken option, like new Dub({ bearerToken: 'My Bearer Token' }).");
50
+ }
51
+ const options = {
52
+ bearerToken,
53
+ ...opts,
54
+ baseURL: baseURL ?? `https://api.dub.co`,
55
+ };
56
+ super({
57
+ baseURL: options.baseURL,
58
+ timeout: options.timeout ?? 60000 /* 1 minute */,
59
+ httpAgent: options.httpAgent,
60
+ maxRetries: options.maxRetries,
61
+ fetch: options.fetch,
62
+ });
63
+ this.links = new API.Links(this);
64
+ this.projects = new API.Projects(this);
65
+ this._options = options;
66
+ this.bearerToken = bearerToken;
67
+ }
68
+ defaultQuery() {
69
+ return this._options.defaultQuery;
70
+ }
71
+ defaultHeaders(opts) {
72
+ return {
73
+ ...super.defaultHeaders(opts),
74
+ ...this._options.defaultHeaders,
75
+ };
76
+ }
77
+ authHeaders(opts) {
78
+ return { Authorization: `Bearer ${this.bearerToken}` };
79
+ }
80
+ }
81
+ exports.Dub = Dub;
82
+ _a = Dub;
83
+ Dub.Dub = _a;
84
+ Dub.DubError = Errors.DubError;
85
+ Dub.APIError = Errors.APIError;
86
+ Dub.APIConnectionError = Errors.APIConnectionError;
87
+ Dub.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
88
+ Dub.APIUserAbortError = Errors.APIUserAbortError;
89
+ Dub.NotFoundError = Errors.NotFoundError;
90
+ Dub.ConflictError = Errors.ConflictError;
91
+ Dub.RateLimitError = Errors.RateLimitError;
92
+ Dub.BadRequestError = Errors.BadRequestError;
93
+ Dub.AuthenticationError = Errors.AuthenticationError;
94
+ Dub.InternalServerError = Errors.InternalServerError;
95
+ Dub.PermissionDeniedError = Errors.PermissionDeniedError;
96
+ Dub.UnprocessableEntityError = Errors.UnprocessableEntityError;
97
+ exports.DubError = Errors.DubError, exports.APIError = Errors.APIError, exports.APIConnectionError = Errors.APIConnectionError, exports.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError, exports.APIUserAbortError = Errors.APIUserAbortError, exports.NotFoundError = Errors.NotFoundError, exports.ConflictError = Errors.ConflictError, exports.RateLimitError = Errors.RateLimitError, exports.BadRequestError = Errors.BadRequestError, exports.AuthenticationError = Errors.AuthenticationError, exports.InternalServerError = Errors.InternalServerError, exports.PermissionDeniedError = Errors.PermissionDeniedError, exports.UnprocessableEntityError = Errors.UnprocessableEntityError;
98
+ exports.toFile = Uploads.toFile;
99
+ exports.fileFromPath = Uploads.fileFromPath;
100
+ (function (Dub) {
101
+ // Helper functions
102
+ Dub.toFile = Uploads.toFile;
103
+ Dub.fileFromPath = Uploads.fileFromPath;
104
+ Dub.Links = API.Links;
105
+ Dub.Projects = API.Projects;
106
+ })(Dub = exports.Dub || (exports.Dub = {}));
107
+ exports = module.exports = Dub;
108
+ exports.default = Dub;
109
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErD,gDAA+B;AAC/B,mDAAkC;AAElC,sDAAqC;AACrC,yDAA2C;AAiE3C,mDAAmD;AACnD,MAAa,GAAI,SAAQ,IAAI,CAAC,SAAS;IAKrC;;;;;;;;;;;OAWG;IACH,YAAY,EACV,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EACtC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAC9C,GAAG,IAA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,81 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+ var _a;
3
+ import * as Core from "./core.mjs";
4
+ import * as Errors from "./error.mjs";
5
+ import * as Uploads from "./uploads.mjs";
6
+ import * as API from 'dub/resources/index';
7
+ /** API Client for interfacing with the Dub API. */
8
+ export class Dub extends Core.APIClient {
9
+ /**
10
+ * API Client for interfacing with the Dub API.
11
+ *
12
+ * @param {string} [opts.bearerToken=process.env['DUB_BEARER_TOKEN'] ?? undefined]
13
+ * @param {string} [opts.baseURL=process.env['DUB_BASE_URL'] ?? https://api.dub.co] - Override the default base URL for the API.
14
+ * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
15
+ * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
16
+ * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
17
+ * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
18
+ * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
19
+ * @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
20
+ */
21
+ constructor({ baseURL = Core.readEnv('DUB_BASE_URL'), bearerToken = Core.readEnv('DUB_BEARER_TOKEN'), ...opts } = {}) {
22
+ if (bearerToken === undefined) {
23
+ throw new Errors.DubError("The DUB_BEARER_TOKEN environment variable is missing or empty; either provide it, or instantiate the Dub client with an bearerToken option, like new Dub({ bearerToken: 'My Bearer Token' }).");
24
+ }
25
+ const options = {
26
+ bearerToken,
27
+ ...opts,
28
+ baseURL: baseURL ?? `https://api.dub.co`,
29
+ };
30
+ super({
31
+ baseURL: options.baseURL,
32
+ timeout: options.timeout ?? 60000 /* 1 minute */,
33
+ httpAgent: options.httpAgent,
34
+ maxRetries: options.maxRetries,
35
+ fetch: options.fetch,
36
+ });
37
+ this.links = new API.Links(this);
38
+ this.projects = new API.Projects(this);
39
+ this._options = options;
40
+ this.bearerToken = bearerToken;
41
+ }
42
+ defaultQuery() {
43
+ return this._options.defaultQuery;
44
+ }
45
+ defaultHeaders(opts) {
46
+ return {
47
+ ...super.defaultHeaders(opts),
48
+ ...this._options.defaultHeaders,
49
+ };
50
+ }
51
+ authHeaders(opts) {
52
+ return { Authorization: `Bearer ${this.bearerToken}` };
53
+ }
54
+ }
55
+ _a = Dub;
56
+ Dub.Dub = _a;
57
+ Dub.DubError = Errors.DubError;
58
+ Dub.APIError = Errors.APIError;
59
+ Dub.APIConnectionError = Errors.APIConnectionError;
60
+ Dub.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
61
+ Dub.APIUserAbortError = Errors.APIUserAbortError;
62
+ Dub.NotFoundError = Errors.NotFoundError;
63
+ Dub.ConflictError = Errors.ConflictError;
64
+ Dub.RateLimitError = Errors.RateLimitError;
65
+ Dub.BadRequestError = Errors.BadRequestError;
66
+ Dub.AuthenticationError = Errors.AuthenticationError;
67
+ Dub.InternalServerError = Errors.InternalServerError;
68
+ Dub.PermissionDeniedError = Errors.PermissionDeniedError;
69
+ Dub.UnprocessableEntityError = Errors.UnprocessableEntityError;
70
+ export const { DubError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } = Errors;
71
+ export var toFile = Uploads.toFile;
72
+ export var fileFromPath = Uploads.fileFromPath;
73
+ (function (Dub) {
74
+ // Helper functions
75
+ Dub.toFile = Uploads.toFile;
76
+ Dub.fileFromPath = Uploads.fileFromPath;
77
+ Dub.Links = API.Links;
78
+ Dub.Projects = API.Projects;
79
+ })(Dub || (Dub = {}));
80
+ export default Dub;
81
+ //# sourceMappingURL=index.mjs.map
package/index.mjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;;OAE9C,KAAK,IAAI;OACT,KAAK,MAAM;OAEX,KAAK,OAAO;OACZ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AMxC,CAAC,EApBgB,GAAG,KAAH,GAAG,QAoBnB;AAED,eAAe,GAAG,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,102 @@
1
-
2
1
  {
3
- "name": "dub",
4
- "description": "A dialect of JavaScript for making web apps with minimal effort.",
5
- "homepage": "http://dubjs.org",
6
- "keywords": ["javascript", "language", "compiler"],
7
- "main": "main.js",
8
- "version": "0.0.0"
2
+ "name": "dub",
3
+ "version": "0.0.1",
4
+ "description": "The official TypeScript library for the Dub API",
5
+ "author": "Dub <support@dub.co>",
6
+ "types": "./index.d.ts",
7
+ "main": "./index.js",
8
+ "type": "commonjs",
9
+ "repository": "github:dubinc/dub-node",
10
+ "license": "Apache-2.0",
11
+ "packageManager": "yarn@1.22.21",
12
+ "private": false,
13
+ "scripts": {
14
+ "test": "bin/check-test-server && yarn jest",
15
+ "build": "bash ./build",
16
+ "format": "prettier --write --cache --cache-strategy metadata . !dist",
17
+ "tsn": "ts-node -r tsconfig-paths/register",
18
+ "lint": "eslint --ext ts,js .",
19
+ "fix": "eslint --fix --ext ts,js ."
20
+ },
21
+ "dependencies": {
22
+ "@types/node": "^18.11.18",
23
+ "@types/node-fetch": "^2.6.4",
24
+ "abort-controller": "^3.0.0",
25
+ "agentkeepalive": "^4.2.1",
26
+ "digest-fetch": "^1.3.0",
27
+ "form-data-encoder": "1.7.2",
28
+ "formdata-node": "^4.3.2",
29
+ "node-fetch": "^2.6.7",
30
+ "web-streams-polyfill": "^3.2.1"
31
+ },
32
+ "sideEffects": [
33
+ "./_shims/index.js",
34
+ "./_shims/index.mjs",
35
+ "./shims/node.js",
36
+ "./shims/node.mjs",
37
+ "./shims/web.js",
38
+ "./shims/web.mjs"
39
+ ],
40
+ "imports": {
41
+ "dub": ".",
42
+ "dub/*": "./src/*"
43
+ },
44
+ "exports": {
45
+ "./_shims/auto/*": {
46
+ "deno": {
47
+ "types": "./_shims/auto/*.d.ts",
48
+ "require": "./_shims/auto/*.js",
49
+ "default": "./_shims/auto/*.mjs"
50
+ },
51
+ "bun": {
52
+ "types": "./_shims/auto/*.d.ts",
53
+ "require": "./_shims/auto/*-bun.js",
54
+ "default": "./_shims/auto/*-bun.mjs"
55
+ },
56
+ "browser": {
57
+ "types": "./_shims/auto/*.d.ts",
58
+ "require": "./_shims/auto/*.js",
59
+ "default": "./_shims/auto/*.mjs"
60
+ },
61
+ "worker": {
62
+ "types": "./_shims/auto/*.d.ts",
63
+ "require": "./_shims/auto/*.js",
64
+ "default": "./_shims/auto/*.mjs"
65
+ },
66
+ "workerd": {
67
+ "types": "./_shims/auto/*.d.ts",
68
+ "require": "./_shims/auto/*.js",
69
+ "default": "./_shims/auto/*.mjs"
70
+ },
71
+ "node": {
72
+ "types": "./_shims/auto/*-node.d.ts",
73
+ "require": "./_shims/auto/*-node.js",
74
+ "default": "./_shims/auto/*-node.mjs"
75
+ },
76
+ "types": "./_shims/auto/*.d.ts",
77
+ "require": "./_shims/auto/*.js",
78
+ "default": "./_shims/auto/*.mjs"
79
+ },
80
+ ".": {
81
+ "require": {
82
+ "types": "./index.d.ts",
83
+ "default": "./index.js"
84
+ },
85
+ "types": "./index.d.mts",
86
+ "default": "./index.mjs"
87
+ },
88
+ "./*.mjs": {
89
+ "types": "./*.d.ts",
90
+ "default": "./*.mjs"
91
+ },
92
+ "./*.js": {
93
+ "types": "./*.d.ts",
94
+ "default": "./*.js"
95
+ },
96
+ "./*": {
97
+ "types": "./*.d.ts",
98
+ "require": "./*.js",
99
+ "default": "./*.mjs"
100
+ }
101
+ }
9
102
  }
package/resource.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import type { Dub } from "./index.js";
2
+ export declare class APIResource {
3
+ protected _client: Dub;
4
+ constructor(client: Dub);
5
+ }
6
+ //# sourceMappingURL=resource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["src/resource.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAEnC,qBAAa,WAAW;IACtB,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC;gBAEX,MAAM,EAAE,GAAG;CAGxB"}
package/resource.js ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.APIResource = void 0;
5
+ class APIResource {
6
+ constructor(client) {
7
+ this._client = client;
8
+ }
9
+ }
10
+ exports.APIResource = APIResource;
11
+ //# sourceMappingURL=resource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.js","sourceRoot":"","sources":["src/resource.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAIrD,MAAa,WAAW;IAGtB,YAAY,MAAW;QACrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;CACF;AAND,kCAMC"}
package/resource.mjs ADDED
@@ -0,0 +1,7 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+ export class APIResource {
3
+ constructor(client) {
4
+ this._client = client;
5
+ }
6
+ }
7
+ //# sourceMappingURL=resource.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.mjs","sourceRoot":"","sources":["src/resource.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAIrD,MAAM,OAAO,WAAW;IAGtB,YAAY,MAAW;QACrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ export * from "./shared.js";
2
+ export { LinkListResponse, LinkCreateParams, LinkUpdateParams, LinkListParams, LinkDeleteParams, Links, } from "./links/links.js";
3
+ export { Project, ProjectDetails, ProjectListResponse, Projects } from "./projects/projects.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAEA,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.Projects = exports.Links = void 0;
19
+ __exportStar(require("./shared.js"), exports);
20
+ var links_1 = require("./links/links.js");
21
+ Object.defineProperty(exports, "Links", { enumerable: true, get: function () { return links_1.Links; } });
22
+ var projects_1 = require("./projects/projects.js");
23
+ Object.defineProperty(exports, "Projects", { enumerable: true, get: function () { return projects_1.Projects; } });
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;;;;;;;;;;;;;;;AAErD,8CAAyB;AACzB,0CAOuB;AADrB,8FAAA,KAAK,OAAA;AAEP,mDAA6F;AAAtC,oGAAA,QAAQ,OAAA"}
@@ -0,0 +1,5 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+ export * from "./shared.mjs";
3
+ export { Links, } from "./links/links.mjs";
4
+ export { Projects } from "./projects/projects.mjs";
5
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;;OAG9C,EAML,KAAK,GACN;OACM,EAAgD,QAAQ,EAAE"}
@@ -0,0 +1,101 @@
1
+ import * as Core from 'dub/core';
2
+ import { APIResource } from 'dub/resource';
3
+ import * as BulkAPI from 'dub/resources/links/bulk';
4
+ import * as Shared from 'dub/resources/shared';
5
+ export declare class Bulk extends APIResource {
6
+ /**
7
+ * Bulk create up to 100 links for the authenticated project.
8
+ */
9
+ create(params: BulkCreateParams, options?: Core.RequestOptions): Core.APIPromise<BulkCreateResponse>;
10
+ }
11
+ export type BulkCreateResponse = Array<Shared.Link>;
12
+ export interface BulkCreateParams {
13
+ /**
14
+ * Query param: The slug for the project to create links for. E.g. for
15
+ * app.dub.co/acme, the projectSlug is 'acme'.
16
+ */
17
+ projectSlug: string;
18
+ }
19
+ export declare namespace BulkCreateParams {
20
+ interface Body {
21
+ /**
22
+ * The Android destination URL for the short link for Android device targeting.
23
+ */
24
+ android?: string | null;
25
+ /**
26
+ * Whether the short link is archived.
27
+ */
28
+ archived?: boolean;
29
+ /**
30
+ * The comments for the short link.
31
+ */
32
+ comments?: string | null;
33
+ /**
34
+ * The description of the short link generated via api.dub.co/metatags. Will be
35
+ * used for Custom Social Media Cards if `proxy` is true.
36
+ */
37
+ description?: string | null;
38
+ /**
39
+ * The domain of the short link.
40
+ */
41
+ domain?: string;
42
+ /**
43
+ * The date and time when the short link will expire in ISO-8601 format. Must be in
44
+ * the future.
45
+ */
46
+ expiresAt?: string | null;
47
+ /**
48
+ * Geo targeting information for the short link in JSON format {[COUNTRY]:
49
+ * "https://example.com" }. Learn more: https://dub.sh/geo
50
+ */
51
+ geo?: Record<string, string> | null;
52
+ /**
53
+ * The image of the short link generated via api.dub.co/metatags. Will be used for
54
+ * Custom Social Media Cards if `proxy` is true.
55
+ */
56
+ image?: string | null;
57
+ /**
58
+ * The iOS destination URL for the short link for iOS device targeting.
59
+ */
60
+ ios?: string | null;
61
+ /**
62
+ * The short link slug. If not provided, a random 7-character slug will be
63
+ * generated.
64
+ */
65
+ key?: string;
66
+ /**
67
+ * The password required to access the destination URL of the short link.
68
+ */
69
+ password?: string | null;
70
+ /**
71
+ * Whether the short link uses Custom Social Media Cards feature.
72
+ */
73
+ proxy?: boolean;
74
+ /**
75
+ * Whether the short link's stats are publicly accessible.
76
+ */
77
+ publicStats?: boolean;
78
+ /**
79
+ * Whether the short link uses link cloaking.
80
+ */
81
+ rewrite?: boolean;
82
+ /**
83
+ * The unique id of the tag assigned to the short link.
84
+ */
85
+ tagId?: string | null;
86
+ /**
87
+ * The title of the short link generated via api.dub.co/metatags. Will be used for
88
+ * Custom Social Media Cards if `proxy` is true.
89
+ */
90
+ title?: string | null;
91
+ /**
92
+ * The destination URL of the short link.
93
+ */
94
+ url?: string;
95
+ }
96
+ }
97
+ export declare namespace Bulk {
98
+ export import BulkCreateResponse = BulkAPI.BulkCreateResponse;
99
+ export import BulkCreateParams = BulkAPI.BulkCreateParams;
100
+ }
101
+ //# sourceMappingURL=bulk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bulk.d.ts","sourceRoot":"","sources":["../../src/resources/links/bulk.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAC;AAE/C,qBAAa,IAAK,SAAQ,WAAW;IACnC;;OAEG;IACH,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC;CAIrG;AAED,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AM,QAAQ,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAC9D,MAAM,QAAQ,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAC3D"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Bulk = void 0;
5
+ const resource_1 = require("dub/resource");
6
+ class Bulk extends resource_1.APIResource {
7
+ /**
8
+ * Bulk create up to 100 links for the authenticated project.
9
+ */
10
+ create(params, options) {
11
+ const { projectSlug, ...body } = params;
12
+ return this._client.post('/links/bulk', { query: { projectSlug }, body, ...options });
13
+ }
14
+ }
15
+ exports.Bulk = Bulk;
16
+ (function (Bulk) {
17
+ })(Bulk = exports.Bulk || (exports.Bulk = {}));
18
+ //# sourceMappingURL=bulk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bulk.js","sourceRoot":"","sources":["../../src/resources/links/bulk.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAGrD,2CAA2C;AAI3C,MAAa,IAAK,SAAQ,sBAAW;IACnC;;OAEG;IACH,MAAM,CAAC,MAAwB,EAAE,OAA6B;QAC5D,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACxC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxF,CAAC;CACF;AARD,oBAQC;AA2GD,WAAiB,IAAI;AAGrB,CAAC,EAHgB,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAGpB"}
@@ -0,0 +1,14 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+ import { APIResource } from 'dub/resource';
3
+ export class Bulk extends APIResource {
4
+ /**
5
+ * Bulk create up to 100 links for the authenticated project.
6
+ */
7
+ create(params, options) {
8
+ const { projectSlug, ...body } = params;
9
+ return this._client.post('/links/bulk', { query: { projectSlug }, body, ...options });
10
+ }
11
+ }
12
+ (function (Bulk) {
13
+ })(Bulk || (Bulk = {}));
14
+ //# sourceMappingURL=bulk.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bulk.mjs","sourceRoot":"","sources":["../../src/resources/links/bulk.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAE,WAAW,EAAE,MAAM,cAAc;AAI1C,MAAM,OAAO,IAAK,SAAQ,WAAW;IACnC;;OAEG;IACH,MAAM,CAAC,MAAwB,EAAE,OAA6B;QAC5D,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACxC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxF,CAAC;CACF;AA2GD,WAAiB,IAAI;AAGrB,CAAC,EAHgB,IAAI,KAAJ,IAAI,QAGpB"}
@@ -0,0 +1,4 @@
1
+ export { BulkCreateResponse, BulkCreateParams, Bulk } from "./bulk.js";
2
+ export { InfoRetrieveParams, Info } from "./info.js";
3
+ export { LinkListResponse, LinkCreateParams, LinkUpdateParams, LinkListParams, LinkDeleteParams, Links, } from "./links.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/links/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,KAAK,GACN,MAAM,SAAS,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Links = exports.Info = exports.Bulk = void 0;
5
+ var bulk_1 = require("./bulk.js");
6
+ Object.defineProperty(exports, "Bulk", { enumerable: true, get: function () { return bulk_1.Bulk; } });
7
+ var info_1 = require("./info.js");
8
+ Object.defineProperty(exports, "Info", { enumerable: true, get: function () { return info_1.Info; } });
9
+ var links_1 = require("./links.js");
10
+ Object.defineProperty(exports, "Links", { enumerable: true, get: function () { return links_1.Links; } });
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/links/index.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAErD,kCAAoE;AAArB,4FAAA,IAAI,OAAA;AACnD,kCAAkD;AAArB,4FAAA,IAAI,OAAA;AACjC,oCAOiB;AADf,8FAAA,KAAK,OAAA"}
@@ -0,0 +1,5 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+ export { Bulk } from "./bulk.mjs";
3
+ export { Info } from "./info.mjs";
4
+ export { Links, } from "./links.mjs";
5
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/links/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAE9C,EAAwC,IAAI,EAAE;OAC9C,EAAsB,IAAI,EAAE;OAC5B,EAML,KAAK,GACN"}
@@ -0,0 +1,30 @@
1
+ import * as Core from 'dub/core';
2
+ import { APIResource } from 'dub/resource';
3
+ import * as InfoAPI from 'dub/resources/links/info';
4
+ import * as Shared from 'dub/resources/shared';
5
+ export declare class Info extends APIResource {
6
+ /**
7
+ * Retrieve the info for a link from their domain and key.
8
+ */
9
+ retrieve(query: InfoRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<Shared.Link>;
10
+ }
11
+ export interface InfoRetrieveParams {
12
+ /**
13
+ * The domain of the link to retrieve. E.g. for dub.sh/github, the domain is
14
+ * 'dub.sh'.
15
+ */
16
+ domain: string;
17
+ /**
18
+ * The key of the link to retrieve. E.g. for dub.sh/github, the key is 'github'.
19
+ */
20
+ key: string;
21
+ /**
22
+ * The slug for the project that the link belongs to. E.g. for app.dub.co/acme, the
23
+ * projectSlug is 'acme'.
24
+ */
25
+ projectSlug: string;
26
+ }
27
+ export declare namespace Info {
28
+ export import InfoRetrieveParams = InfoAPI.InfoRetrieveParams;
29
+ }
30
+ //# sourceMappingURL=info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../src/resources/links/info.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAC;AAE/C,qBAAa,IAAK,SAAQ,WAAW;IACnC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC;CAGjG;AAED,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,yBAAiB,IAAI,CAAC;IACpB,MAAM,QAAQ,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAC/D"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Info = void 0;
5
+ const resource_1 = require("dub/resource");
6
+ class Info extends resource_1.APIResource {
7
+ /**
8
+ * Retrieve the info for a link from their domain and key.
9
+ */
10
+ retrieve(query, options) {
11
+ return this._client.get('/links/info', { query, ...options });
12
+ }
13
+ }
14
+ exports.Info = Info;
15
+ (function (Info) {
16
+ })(Info = exports.Info || (exports.Info = {}));
17
+ //# sourceMappingURL=info.js.map