dub 0.5.0 → 0.7.0

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 (46) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/core.d.ts.map +1 -1
  3. package/core.js +2 -1
  4. package/core.js.map +1 -1
  5. package/core.mjs +2 -1
  6. package/core.mjs.map +1 -1
  7. package/index.d.mts +1 -0
  8. package/index.d.ts +1 -0
  9. package/index.d.ts.map +1 -1
  10. package/index.js.map +1 -1
  11. package/index.mjs.map +1 -1
  12. package/package.json +1 -1
  13. package/resources/index.d.ts +1 -1
  14. package/resources/index.d.ts.map +1 -1
  15. package/resources/index.js.map +1 -1
  16. package/resources/index.mjs.map +1 -1
  17. package/resources/links/bulk.d.ts +9 -8
  18. package/resources/links/bulk.d.ts.map +1 -1
  19. package/resources/links/bulk.js.map +1 -1
  20. package/resources/links/bulk.mjs.map +1 -1
  21. package/resources/links/info.d.ts +5 -5
  22. package/resources/links/links.d.ts +50 -35
  23. package/resources/links/links.d.ts.map +1 -1
  24. package/resources/links/links.js.map +1 -1
  25. package/resources/links/links.mjs.map +1 -1
  26. package/resources/projects/projects.d.ts +2 -2
  27. package/resources/projects/tags.d.ts +3 -3
  28. package/resources/qr.d.ts +40 -0
  29. package/resources/qr.d.ts.map +1 -1
  30. package/resources/qr.js +8 -0
  31. package/resources/qr.js.map +1 -1
  32. package/resources/qr.mjs +8 -0
  33. package/resources/qr.mjs.map +1 -1
  34. package/src/core.ts +3 -1
  35. package/src/index.ts +1 -0
  36. package/src/resources/index.ts +1 -1
  37. package/src/resources/links/bulk.ts +9 -8
  38. package/src/resources/links/info.ts +5 -5
  39. package/src/resources/links/links.ts +53 -36
  40. package/src/resources/projects/projects.ts +2 -2
  41. package/src/resources/projects/tags.ts +3 -3
  42. package/src/resources/qr.ts +51 -1
  43. package/src/version.ts +1 -1
  44. package/version.d.ts +1 -1
  45. package/version.js +1 -1
  46. package/version.mjs +1 -1
@@ -80,13 +80,14 @@ export interface Link {
80
80
  createdAt?: string;
81
81
 
82
82
  /**
83
- * The description of the short link generated via api.dub.co/metatags. Will be
83
+ * The description of the short link generated via `api.dub.co/metatags`. Will be
84
84
  * used for Custom Social Media Cards if `proxy` is true.
85
85
  */
86
86
  description?: string | null;
87
87
 
88
88
  /**
89
- * The domain of the short link.
89
+ * The domain of the short link. If not provided, the primary domain for the
90
+ * project will be used (or `dub.sh` if the project has no domains).
90
91
  */
91
92
  domain?: string;
92
93
 
@@ -98,13 +99,13 @@ export interface Link {
98
99
 
99
100
  /**
100
101
  * Geo targeting information for the short link in JSON format {[COUNTRY]:
101
- * "https://example.com" }. Learn more: https://dub.sh/geo
102
+ * `https://example.com` }. Learn more: `https://dub.sh/geo`
102
103
  */
103
104
  geo?: Record<string, string> | null;
104
105
 
105
106
  /**
106
- * The image of the short link generated via api.dub.co/metatags. Will be used for
107
- * Custom Social Media Cards if `proxy` is true.
107
+ * The image of the short link generated via `api.dub.co/metatags`. Will be used
108
+ * for Custom Social Media Cards if `proxy` is true.
108
109
  */
109
110
  image?: string | null;
110
111
 
@@ -144,19 +145,31 @@ export interface Link {
144
145
  */
145
146
  publicStats?: boolean;
146
147
 
148
+ /**
149
+ * The full URL of the QR code for the short link (e.g.
150
+ * `https://api.dub.co/qr?url=https://dub.sh/try`).
151
+ */
152
+ qrCode?: string;
153
+
147
154
  /**
148
155
  * Whether the short link uses link cloaking.
149
156
  */
150
157
  rewrite?: boolean;
151
158
 
159
+ /**
160
+ * The full URL of the short link, including the https protocol (e.g.
161
+ * `https://dub.sh/try`).
162
+ */
163
+ shortLink?: string;
164
+
152
165
  /**
153
166
  * The unique id of the tag assigned to the short link.
154
167
  */
155
168
  tagId?: string | null;
156
169
 
157
170
  /**
158
- * The title of the short link generated via api.dub.co/metatags. Will be used for
159
- * Custom Social Media Cards if `proxy` is true.
171
+ * The title of the short link generated via `api.dub.co/metatags`. Will be used
172
+ * for Custom Social Media Cards if `proxy` is true.
160
173
  */
161
174
  title?: string | null;
162
175
 
@@ -206,15 +219,10 @@ export type LinkListResponse = Array<Link>;
206
219
  export interface LinkCreateParams {
207
220
  /**
208
221
  * Query param: The slug for the project to create links for. E.g. for
209
- * app.dub.co/acme, the projectSlug is 'acme'.
222
+ * `app.dub.co/acme`, the projectSlug is `acme`.
210
223
  */
211
224
  projectSlug?: string;
212
225
 
213
- /**
214
- * Body param: The domain of the short link.
215
- */
216
- domain: string;
217
-
218
226
  /**
219
227
  * Body param: The destination URL of the short link.
220
228
  */
@@ -237,11 +245,18 @@ export interface LinkCreateParams {
237
245
  comments?: string | null;
238
246
 
239
247
  /**
240
- * Body param: The description of the short link generated via api.dub.co/metatags.
241
- * Will be used for Custom Social Media Cards if `proxy` is true.
248
+ * Body param: The description of the short link generated via
249
+ * `api.dub.co/metatags`. Will be used for Custom Social Media Cards if `proxy` is
250
+ * true.
242
251
  */
243
252
  description?: string | null;
244
253
 
254
+ /**
255
+ * Body param: The domain of the short link. If not provided, the primary domain
256
+ * for the project will be used (or `dub.sh` if the project has no domains).
257
+ */
258
+ domain?: string;
259
+
245
260
  /**
246
261
  * Body param: The date and time when the short link will expire in ISO-8601
247
262
  * format. Must be in the future.
@@ -250,13 +265,13 @@ export interface LinkCreateParams {
250
265
 
251
266
  /**
252
267
  * Body param: Geo targeting information for the short link in JSON format
253
- * {[COUNTRY]: "https://example.com" }. Learn more: https://dub.sh/geo
268
+ * {[COUNTRY]: `https://example.com` }. Learn more: `https://dub.sh/geo`
254
269
  */
255
270
  geo?: Record<string, string> | null;
256
271
 
257
272
  /**
258
- * Body param: The image of the short link generated via api.dub.co/metatags. Will
259
- * be used for Custom Social Media Cards if `proxy` is true.
273
+ * Body param: The image of the short link generated via `api.dub.co/metatags`.
274
+ * Will be used for Custom Social Media Cards if `proxy` is true.
260
275
  */
261
276
  image?: string | null;
262
277
 
@@ -298,8 +313,8 @@ export interface LinkCreateParams {
298
313
  tagId?: string | null;
299
314
 
300
315
  /**
301
- * Body param: The title of the short link generated via api.dub.co/metatags. Will
302
- * be used for Custom Social Media Cards if `proxy` is true.
316
+ * Body param: The title of the short link generated via `api.dub.co/metatags`.
317
+ * Will be used for Custom Social Media Cards if `proxy` is true.
303
318
  */
304
319
  title?: string | null;
305
320
  }
@@ -307,7 +322,7 @@ export interface LinkCreateParams {
307
322
  export interface LinkUpdateParams {
308
323
  /**
309
324
  * Query param: The slug for the project that the link belongs to. E.g. for
310
- * app.dub.co/acme, the projectSlug is 'acme'.
325
+ * `app.dub.co/acme`, the projectSlug is `acme`.
311
326
  */
312
327
  projectSlug?: string;
313
328
 
@@ -328,13 +343,15 @@ export interface LinkUpdateParams {
328
343
  comments?: string | null;
329
344
 
330
345
  /**
331
- * Body param: The description of the short link generated via api.dub.co/metatags.
332
- * Will be used for Custom Social Media Cards if `proxy` is true.
346
+ * Body param: The description of the short link generated via
347
+ * `api.dub.co/metatags`. Will be used for Custom Social Media Cards if `proxy` is
348
+ * true.
333
349
  */
334
350
  description?: string | null;
335
351
 
336
352
  /**
337
- * Body param: The domain of the short link.
353
+ * Body param: The domain of the short link. If not provided, the primary domain
354
+ * for the project will be used (or `dub.sh` if the project has no domains).
338
355
  */
339
356
  domain?: string;
340
357
 
@@ -346,13 +363,13 @@ export interface LinkUpdateParams {
346
363
 
347
364
  /**
348
365
  * Body param: Geo targeting information for the short link in JSON format
349
- * {[COUNTRY]: "https://example.com" }. Learn more: https://dub.sh/geo
366
+ * {[COUNTRY]: `https://example.com` }. Learn more: `https://dub.sh/geo`
350
367
  */
351
368
  geo?: Record<string, string> | null;
352
369
 
353
370
  /**
354
- * Body param: The image of the short link generated via api.dub.co/metatags. Will
355
- * be used for Custom Social Media Cards if `proxy` is true.
371
+ * Body param: The image of the short link generated via `api.dub.co/metatags`.
372
+ * Will be used for Custom Social Media Cards if `proxy` is true.
356
373
  */
357
374
  image?: string | null;
358
375
 
@@ -394,8 +411,8 @@ export interface LinkUpdateParams {
394
411
  tagId?: string | null;
395
412
 
396
413
  /**
397
- * Body param: The title of the short link generated via api.dub.co/metatags. Will
398
- * be used for Custom Social Media Cards if `proxy` is true.
414
+ * Body param: The title of the short link generated via `api.dub.co/metatags`.
415
+ * Will be used for Custom Social Media Cards if `proxy` is true.
399
416
  */
400
417
  title?: string | null;
401
418
 
@@ -407,13 +424,13 @@ export interface LinkUpdateParams {
407
424
 
408
425
  export interface LinkListParams {
409
426
  /**
410
- * The slug for the project to retrieve links for. E.g. for app.dub.co/acme, the
411
- * projectSlug is 'acme'.
427
+ * The slug for the project to retrieve links for. E.g. for `app.dub.co/acme`, the
428
+ * projectSlug is `acme`.
412
429
  */
413
430
  projectSlug?: string;
414
431
 
415
432
  /**
416
- * The domain to filter the links by. E.g. 'ac.me'. If not provided, all links for
433
+ * The domain to filter the links by. E.g. `ac.me`. If not provided, all links for
417
434
  * the project will be returned.
418
435
  */
419
436
  domain?: string;
@@ -430,13 +447,13 @@ export interface LinkListParams {
430
447
  search?: string;
431
448
 
432
449
  /**
433
- * Whether to include archived links in the response. Defaults to false if not
450
+ * Whether to include archived links in the response. Defaults to `false` if not
434
451
  * provided.
435
452
  */
436
453
  showArchived?: true | false;
437
454
 
438
455
  /**
439
- * The field to sort the links by. The default is 'createdAt', and sort order is
456
+ * The field to sort the links by. The default is `createdAt`, and sort order is
440
457
  * always descending.
441
458
  */
442
459
  sort?: 'createdAt' | 'clicks' | 'lastClicked';
@@ -454,8 +471,8 @@ export interface LinkListParams {
454
471
 
455
472
  export interface LinkDeleteLinkParams {
456
473
  /**
457
- * The slug for the project that the link belongs to. E.g. for app.dub.co/acme, the
458
- * projectSlug is 'acme'.
474
+ * The slug for the project that the link belongs to. E.g. for `app.dub.co/acme`,
475
+ * the projectSlug is `acme`.
459
476
  */
460
477
  projectSlug?: string;
461
478
  }
@@ -114,8 +114,8 @@ export type ProjectListResponse = Array<Project>;
114
114
 
115
115
  export interface ProjectRetrieveParams {
116
116
  /**
117
- * The slug for the project to retrieve. E.g. for app.dub.co/acme, the projectSlug
118
- * is 'acme'.
117
+ * The slug for the project to retrieve. E.g. for `app.dub.co/acme`, the
118
+ * projectSlug is `acme`.
119
119
  */
120
120
  projectSlug?: string;
121
121
  }
@@ -44,7 +44,7 @@ export type TagListResponse = Array<Tag>;
44
44
  export interface TagCreateParams {
45
45
  /**
46
46
  * Path param: The slug for the project to create tags for. E.g. for
47
- * app.dub.co/acme, the projectSlug is 'acme'.
47
+ * `app.dub.co/acme`, the projectSlug is `acme`.
48
48
  */
49
49
  projectSlug?: string;
50
50
 
@@ -56,8 +56,8 @@ export interface TagCreateParams {
56
56
 
57
57
  export interface TagListParams {
58
58
  /**
59
- * The slug for the project to retrieve tags for. E.g. for app.dub.co/acme, the
60
- * projectSlug is 'acme'.
59
+ * The slug for the project to retrieve tags for. E.g. for `app.dub.co/acme`, the
60
+ * projectSlug is `acme`.
61
61
  */
62
62
  projectSlug?: string;
63
63
  }
@@ -1,5 +1,55 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
+ import * as Core from "../core";
3
4
  import { APIResource } from "../resource";
5
+ import { type Response } from "../_shims/index";
6
+ import * as QrAPI from "./qr";
4
7
 
5
- export class Qr extends APIResource {}
8
+ export class Qr extends APIResource {
9
+ /**
10
+ * Retrieve a QR code for a link.
11
+ */
12
+ retrieve(query: QrRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<Response> {
13
+ return this._client.get('/qr', { query, ...options, __binaryResponse: true });
14
+ }
15
+ }
16
+
17
+ export interface QrRetrieveParams {
18
+ /**
19
+ * The URL to generate a QR code for. Defaults to `https://dub.co` if not provided.
20
+ */
21
+ url: string;
22
+
23
+ /**
24
+ * The background color of the QR code in hex format. Defaults to `#ffffff` if not
25
+ * provided.
26
+ */
27
+ bgColor?: string;
28
+
29
+ /**
30
+ * The foreground color of the QR code in hex format. Defaults to `#000000` if not
31
+ * provided.
32
+ */
33
+ fgColor?: string;
34
+
35
+ /**
36
+ * Whether to include a margin around the QR code. Defaults to `false` if not
37
+ * provided.
38
+ */
39
+ includeMargin?: true | false;
40
+
41
+ /**
42
+ * The level of error correction to use for the QR code. Defaults to `L` if not
43
+ * provided.
44
+ */
45
+ level?: 'L' | 'M' | 'Q' | 'H';
46
+
47
+ /**
48
+ * The size of the QR code in pixels. Defaults to `600` if not provided.
49
+ */
50
+ size?: number;
51
+ }
52
+
53
+ export namespace Qr {
54
+ export import QrRetrieveParams = QrAPI.QrRetrieveParams;
55
+ }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.5.0'; // x-release-please-version
1
+ export const VERSION = '0.7.0'; // x-release-please-version
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.5.0";
1
+ export declare const VERSION = "0.7.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.5.0'; // x-release-please-version
4
+ exports.VERSION = '0.7.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.5.0'; // x-release-please-version
1
+ export const VERSION = '0.7.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map