dub 0.7.0 → 0.9.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 (72) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +27 -23
  3. package/index.d.mts +5 -3
  4. package/index.d.ts +5 -3
  5. package/index.d.ts.map +1 -1
  6. package/index.js +4 -0
  7. package/index.js.map +1 -1
  8. package/index.mjs +4 -0
  9. package/index.mjs.map +1 -1
  10. package/package.json +3 -1
  11. package/resources/index.d.ts +2 -2
  12. package/resources/index.d.ts.map +1 -1
  13. package/resources/index.js.map +1 -1
  14. package/resources/index.mjs.map +1 -1
  15. package/resources/links/bulk.d.ts +176 -10
  16. package/resources/links/bulk.d.ts.map +1 -1
  17. package/resources/links/bulk.js +2 -2
  18. package/resources/links/bulk.js.map +1 -1
  19. package/resources/links/bulk.mjs +2 -2
  20. package/resources/links/bulk.mjs.map +1 -1
  21. package/resources/links/index.d.ts +2 -2
  22. package/resources/links/index.d.ts.map +1 -1
  23. package/resources/links/index.js.map +1 -1
  24. package/resources/links/index.mjs.map +1 -1
  25. package/resources/links/info.d.ts +156 -5
  26. package/resources/links/info.d.ts.map +1 -1
  27. package/resources/links/info.js.map +1 -1
  28. package/resources/links/info.mjs.map +1 -1
  29. package/resources/links/links.d.ts +554 -52
  30. package/resources/links/links.d.ts.map +1 -1
  31. package/resources/links/links.js.map +1 -1
  32. package/resources/links/links.mjs.map +1 -1
  33. package/resources/projects/index.d.ts +2 -2
  34. package/resources/projects/index.d.ts.map +1 -1
  35. package/resources/projects/index.js.map +1 -1
  36. package/resources/projects/index.mjs.map +1 -1
  37. package/resources/projects/projects.d.ts +135 -34
  38. package/resources/projects/projects.d.ts.map +1 -1
  39. package/resources/projects/projects.js.map +1 -1
  40. package/resources/projects/projects.mjs.map +1 -1
  41. package/resources/projects/tags.d.ts +0 -49
  42. package/resources/projects/tags.d.ts.map +1 -1
  43. package/resources/projects/tags.js +0 -16
  44. package/resources/projects/tags.js.map +1 -1
  45. package/resources/projects/tags.mjs +0 -16
  46. package/resources/projects/tags.mjs.map +1 -1
  47. package/resources/qr.d.ts +7 -6
  48. package/resources/qr.d.ts.map +1 -1
  49. package/resources/qr.js +5 -4
  50. package/resources/qr.js.map +1 -1
  51. package/resources/qr.mjs +5 -4
  52. package/resources/qr.mjs.map +1 -1
  53. package/src/index.ts +9 -3
  54. package/src/resources/index.ts +4 -3
  55. package/src/resources/links/bulk.ts +216 -13
  56. package/src/resources/links/index.ts +4 -2
  57. package/src/resources/links/info.ts +190 -5
  58. package/src/resources/links/links.ts +670 -53
  59. package/src/resources/projects/index.ts +2 -2
  60. package/src/resources/projects/projects.ts +166 -34
  61. package/src/resources/projects/tags.ts +1 -66
  62. package/src/resources/qr.ts +16 -7
  63. package/src/uploads.ts +2 -3
  64. package/src/version.ts +1 -1
  65. package/uploads.d.ts.map +1 -1
  66. package/uploads.js +2 -1
  67. package/uploads.js.map +1 -1
  68. package/uploads.mjs +2 -1
  69. package/uploads.mjs.map +1 -1
  70. package/version.d.ts +1 -1
  71. package/version.js +1 -1
  72. package/version.mjs +1 -1
@@ -3,30 +3,226 @@
3
3
  import * as Core from "../../core";
4
4
  import { APIResource } from "../../resource";
5
5
  import * as BulkAPI from "./bulk";
6
- import * as LinksAPI from "./links";
7
6
 
8
7
  export class Bulk extends APIResource {
9
8
  /**
10
9
  * Bulk create up to 100 links for the authenticated project.
11
10
  */
12
11
  create(params: BulkCreateParams, options?: Core.RequestOptions): Core.APIPromise<BulkCreateResponse> {
13
- const { projectSlug = this._client.projectSlug, ...body } = params;
14
- return this._client.post('/links/bulk', { query: { projectSlug }, body, ...options });
12
+ const { projectSlug = this._client.projectSlug, body } = params;
13
+ return this._client.post('/links/bulk', { query: { projectSlug }, body: body, ...options });
15
14
  }
16
15
  }
17
16
 
18
- export type BulkCreateResponse = Array<LinksAPI.Link>;
17
+ export type BulkCreateResponse = Array<BulkCreateResponse.BulkCreateResponseItem>;
18
+
19
+ export namespace BulkCreateResponse {
20
+ export interface BulkCreateResponseItem {
21
+ /**
22
+ * The unique ID of the short link.
23
+ */
24
+ id: string;
25
+
26
+ /**
27
+ * The Android destination URL for the short link for Android device targeting.
28
+ */
29
+ android: string | null;
30
+
31
+ /**
32
+ * Whether the short link is archived.
33
+ */
34
+ archived: boolean;
35
+
36
+ /**
37
+ * The number of clicks on the short link.
38
+ */
39
+ clicks: number;
40
+
41
+ /**
42
+ * The comments for the short link.
43
+ */
44
+ comments: string | null;
45
+
46
+ /**
47
+ * The date and time when the short link was created.
48
+ */
49
+ createdAt: string;
50
+
51
+ /**
52
+ * The description of the short link generated via `api.dub.co/metatags`. Will be
53
+ * used for Custom Social Media Cards if `proxy` is true.
54
+ */
55
+ description: string | null;
56
+
57
+ /**
58
+ * The domain of the short link. If not provided, the primary domain for the
59
+ * project will be used (or `dub.sh` if the project has no domains).
60
+ */
61
+ domain: string;
62
+
63
+ /**
64
+ * The date and time when the short link will expire in ISO-8601 format. Must be in
65
+ * the future.
66
+ */
67
+ expiresAt: string | null;
68
+
69
+ /**
70
+ * Geo targeting information for the short link in JSON format
71
+ * `{[COUNTRY]: https://example.com }`. Learn more: https://d.to/geo
72
+ */
73
+ geo: Record<string, string> | null;
74
+
75
+ /**
76
+ * The image of the short link generated via `api.dub.co/metatags`. Will be used
77
+ * for Custom Social Media Cards if `proxy` is true.
78
+ */
79
+ image: string | null;
80
+
81
+ /**
82
+ * The iOS destination URL for the short link for iOS device targeting.
83
+ */
84
+ ios: string | null;
85
+
86
+ /**
87
+ * The short link slug. If not provided, a random 7-character slug will be
88
+ * generated.
89
+ */
90
+ key: string;
91
+
92
+ /**
93
+ * The date and time when the short link was last clicked.
94
+ */
95
+ lastClicked: string | null;
96
+
97
+ /**
98
+ * The password required to access the destination URL of the short link.
99
+ */
100
+ password: string | null;
101
+
102
+ /**
103
+ * The project ID of the short link.
104
+ */
105
+ projectId: string;
106
+
107
+ /**
108
+ * Whether the short link uses Custom Social Media Cards feature.
109
+ */
110
+ proxy: boolean;
111
+
112
+ /**
113
+ * Whether the short link's stats are publicly accessible.
114
+ */
115
+ publicStats: boolean;
116
+
117
+ /**
118
+ * The full URL of the QR code for the short link (e.g.
119
+ * `https://api.dub.co/qr?url=https://dub.sh/try`).
120
+ */
121
+ qrCode: string;
122
+
123
+ /**
124
+ * Whether the short link uses link cloaking.
125
+ */
126
+ rewrite: boolean;
127
+
128
+ /**
129
+ * The full URL of the short link, including the https protocol (e.g.
130
+ * `https://dub.sh/try`).
131
+ */
132
+ shortLink: string;
133
+
134
+ /**
135
+ * The tags assigned to the short link.
136
+ */
137
+ tags: Array<BulkCreateResponseItem.Tag> | null;
138
+
139
+ /**
140
+ * The title of the short link generated via `api.dub.co/metatags`. Will be used
141
+ * for Custom Social Media Cards if `proxy` is true.
142
+ */
143
+ title: string | null;
144
+
145
+ /**
146
+ * The date and time when the short link was last updated.
147
+ */
148
+ updatedAt: string;
149
+
150
+ /**
151
+ * The destination URL of the short link.
152
+ */
153
+ url: string;
154
+
155
+ /**
156
+ * The user ID of the creator of the short link.
157
+ */
158
+ userId: string;
159
+
160
+ /**
161
+ * The UTM campaign of the short link.
162
+ */
163
+ utm_campaign: string | null;
164
+
165
+ /**
166
+ * The UTM content of the short link.
167
+ */
168
+ utm_content: string | null;
169
+
170
+ /**
171
+ * The UTM medium of the short link.
172
+ */
173
+ utm_medium: string | null;
174
+
175
+ /**
176
+ * The UTM source of the short link.
177
+ */
178
+ utm_source: string | null;
179
+
180
+ /**
181
+ * The UTM term of the short link.
182
+ */
183
+ utm_term: string | null;
184
+ }
185
+
186
+ export namespace BulkCreateResponseItem {
187
+ export interface Tag {
188
+ /**
189
+ * The unique ID of the tag.
190
+ */
191
+ id: string;
192
+
193
+ /**
194
+ * The color of the tag.
195
+ */
196
+ color: 'red' | 'yellow' | 'green' | 'blue' | 'purple' | 'pink' | 'brown';
197
+
198
+ /**
199
+ * The name of the tag.
200
+ */
201
+ name: string;
202
+ }
203
+ }
204
+ }
19
205
 
20
206
  export interface BulkCreateParams {
21
207
  /**
22
- * Query param: The slug for the project to create links for. E.g. for
208
+ * Query param: The slug for the project that the link belongs to. E.g. for
23
209
  * `app.dub.co/acme`, the projectSlug is `acme`.
24
210
  */
25
211
  projectSlug?: string;
212
+
213
+ /**
214
+ * Body param:
215
+ */
216
+ body: Array<BulkCreateParams.Body>;
26
217
  }
27
218
 
28
219
  export namespace BulkCreateParams {
29
220
  export interface Body {
221
+ /**
222
+ * The destination URL of the short link.
223
+ */
224
+ url: string;
225
+
30
226
  /**
31
227
  * The Android destination URL for the short link for Android device targeting.
32
228
  */
@@ -61,8 +257,8 @@ export namespace BulkCreateParams {
61
257
  expiresAt?: string | null;
62
258
 
63
259
  /**
64
- * Geo targeting information for the short link in JSON format {[COUNTRY]:
65
- * `https://example.com` }. Learn more: `https://dub.sh/geo`
260
+ * Geo targeting information for the short link in JSON format
261
+ * `{[COUNTRY]: https://example.com }`.
66
262
  */
67
263
  geo?: Record<string, string> | null;
68
264
 
@@ -88,6 +284,13 @@ export namespace BulkCreateParams {
88
284
  */
89
285
  password?: string | null;
90
286
 
287
+ /**
288
+ * The prefix of the short link slug for randomly-generated keys (e.g. if prefix is
289
+ * `/c/`, generated keys will be in the `/c/:key` format). Will be ignored if `key`
290
+ * is provided.
291
+ */
292
+ prefix?: string;
293
+
91
294
  /**
92
295
  * Whether the short link uses Custom Social Media Cards feature.
93
296
  */
@@ -104,20 +307,20 @@ export namespace BulkCreateParams {
104
307
  rewrite?: boolean;
105
308
 
106
309
  /**
107
- * The unique id of the tag assigned to the short link.
310
+ * The unique ID of the tag assigned to the short link.
108
311
  */
109
312
  tagId?: string | null;
110
313
 
111
314
  /**
112
- * The title of the short link generated via `api.dub.co/metatags`. Will be used
113
- * for Custom Social Media Cards if `proxy` is true.
315
+ * The unique IDs of the tags assigned to the short link.
114
316
  */
115
- title?: string | null;
317
+ tagIds?: Array<string> | null;
116
318
 
117
319
  /**
118
- * The destination URL of the short link.
320
+ * The title of the short link generated via `api.dub.co/metatags`. Will be used
321
+ * for Custom Social Media Cards if `proxy` is true.
119
322
  */
120
- url?: string;
323
+ title?: string | null;
121
324
  }
122
325
  }
123
326
 
@@ -1,10 +1,12 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
3
  export { BulkCreateResponse, BulkCreateParams, Bulk } from './bulk';
4
- export { InfoRetrieveParams, Info } from './info';
4
+ export { InfoRetrieveResponse, InfoRetrieveParams, Info } from './info';
5
5
  export {
6
- Link,
6
+ LinkCreateResponse,
7
+ LinkUpdateResponse,
7
8
  LinkListResponse,
9
+ LinkDeleteLinkResponse,
8
10
  LinkCreateParams,
9
11
  LinkUpdateParams,
10
12
  LinkListParams,
@@ -3,27 +3,211 @@
3
3
  import * as Core from "../../core";
4
4
  import { APIResource } from "../../resource";
5
5
  import * as InfoAPI from "./info";
6
- import * as LinksAPI from "./links";
7
6
 
8
7
  export class Info extends APIResource {
9
8
  /**
10
9
  * Retrieve the info for a link from their domain and key.
11
10
  */
12
- retrieve(params: InfoRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<LinksAPI.Link> {
11
+ retrieve(params: InfoRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<InfoRetrieveResponse> {
13
12
  const { projectSlug = this._client.projectSlug, ...query } = params;
14
13
  return this._client.get('/links/info', { query: { projectSlug, ...query }, ...options });
15
14
  }
16
15
  }
17
16
 
17
+ export interface InfoRetrieveResponse {
18
+ /**
19
+ * The unique ID of the short link.
20
+ */
21
+ id: string;
22
+
23
+ /**
24
+ * The Android destination URL for the short link for Android device targeting.
25
+ */
26
+ android: string | null;
27
+
28
+ /**
29
+ * Whether the short link is archived.
30
+ */
31
+ archived: boolean;
32
+
33
+ /**
34
+ * The number of clicks on the short link.
35
+ */
36
+ clicks: number;
37
+
38
+ /**
39
+ * The comments for the short link.
40
+ */
41
+ comments: string | null;
42
+
43
+ /**
44
+ * The date and time when the short link was created.
45
+ */
46
+ createdAt: string;
47
+
48
+ /**
49
+ * The description of the short link generated via `api.dub.co/metatags`. Will be
50
+ * used for Custom Social Media Cards if `proxy` is true.
51
+ */
52
+ description: string | null;
53
+
54
+ /**
55
+ * The domain of the short link. If not provided, the primary domain for the
56
+ * project will be used (or `dub.sh` if the project has no domains).
57
+ */
58
+ domain: string;
59
+
60
+ /**
61
+ * The date and time when the short link will expire in ISO-8601 format. Must be in
62
+ * the future.
63
+ */
64
+ expiresAt: string | null;
65
+
66
+ /**
67
+ * Geo targeting information for the short link in JSON format
68
+ * `{[COUNTRY]: https://example.com }`. Learn more: https://d.to/geo
69
+ */
70
+ geo: Record<string, string> | null;
71
+
72
+ /**
73
+ * The image of the short link generated via `api.dub.co/metatags`. Will be used
74
+ * for Custom Social Media Cards if `proxy` is true.
75
+ */
76
+ image: string | null;
77
+
78
+ /**
79
+ * The iOS destination URL for the short link for iOS device targeting.
80
+ */
81
+ ios: string | null;
82
+
83
+ /**
84
+ * The short link slug. If not provided, a random 7-character slug will be
85
+ * generated.
86
+ */
87
+ key: string;
88
+
89
+ /**
90
+ * The date and time when the short link was last clicked.
91
+ */
92
+ lastClicked: string | null;
93
+
94
+ /**
95
+ * The password required to access the destination URL of the short link.
96
+ */
97
+ password: string | null;
98
+
99
+ /**
100
+ * The project ID of the short link.
101
+ */
102
+ projectId: string;
103
+
104
+ /**
105
+ * Whether the short link uses Custom Social Media Cards feature.
106
+ */
107
+ proxy: boolean;
108
+
109
+ /**
110
+ * Whether the short link's stats are publicly accessible.
111
+ */
112
+ publicStats: boolean;
113
+
114
+ /**
115
+ * The full URL of the QR code for the short link (e.g.
116
+ * `https://api.dub.co/qr?url=https://dub.sh/try`).
117
+ */
118
+ qrCode: string;
119
+
120
+ /**
121
+ * Whether the short link uses link cloaking.
122
+ */
123
+ rewrite: boolean;
124
+
125
+ /**
126
+ * The full URL of the short link, including the https protocol (e.g.
127
+ * `https://dub.sh/try`).
128
+ */
129
+ shortLink: string;
130
+
131
+ /**
132
+ * The tags assigned to the short link.
133
+ */
134
+ tags: Array<InfoRetrieveResponse.Tag> | null;
135
+
136
+ /**
137
+ * The title of the short link generated via `api.dub.co/metatags`. Will be used
138
+ * for Custom Social Media Cards if `proxy` is true.
139
+ */
140
+ title: string | null;
141
+
142
+ /**
143
+ * The date and time when the short link was last updated.
144
+ */
145
+ updatedAt: string;
146
+
147
+ /**
148
+ * The destination URL of the short link.
149
+ */
150
+ url: string;
151
+
152
+ /**
153
+ * The user ID of the creator of the short link.
154
+ */
155
+ userId: string;
156
+
157
+ /**
158
+ * The UTM campaign of the short link.
159
+ */
160
+ utm_campaign: string | null;
161
+
162
+ /**
163
+ * The UTM content of the short link.
164
+ */
165
+ utm_content: string | null;
166
+
167
+ /**
168
+ * The UTM medium of the short link.
169
+ */
170
+ utm_medium: string | null;
171
+
172
+ /**
173
+ * The UTM source of the short link.
174
+ */
175
+ utm_source: string | null;
176
+
177
+ /**
178
+ * The UTM term of the short link.
179
+ */
180
+ utm_term: string | null;
181
+ }
182
+
183
+ export namespace InfoRetrieveResponse {
184
+ export interface Tag {
185
+ /**
186
+ * The unique ID of the tag.
187
+ */
188
+ id: string;
189
+
190
+ /**
191
+ * The color of the tag.
192
+ */
193
+ color: 'red' | 'yellow' | 'green' | 'blue' | 'purple' | 'pink' | 'brown';
194
+
195
+ /**
196
+ * The name of the tag.
197
+ */
198
+ name: string;
199
+ }
200
+ }
201
+
18
202
  export interface InfoRetrieveParams {
19
203
  /**
20
- * The domain of the link to retrieve. E.g. for `dub.sh/github`, the domain is
21
- * `dub.sh`.
204
+ * The domain of the link to retrieve. E.g. for `d.to/github`, the domain is
205
+ * `d.to`.
22
206
  */
23
207
  domain: string;
24
208
 
25
209
  /**
26
- * The key of the link to retrieve. E.g. for `dub.sh/github`, the key is `github`.
210
+ * The key of the link to retrieve. E.g. for `d.to/github`, the key is `github`.
27
211
  */
28
212
  key: string;
29
213
 
@@ -35,5 +219,6 @@ export interface InfoRetrieveParams {
35
219
  }
36
220
 
37
221
  export namespace Info {
222
+ export import InfoRetrieveResponse = InfoAPI.InfoRetrieveResponse;
38
223
  export import InfoRetrieveParams = InfoAPI.InfoRetrieveParams;
39
224
  }