dub 0.8.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 (64) hide show
  1. package/CHANGELOG.md +8 -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 +163 -11
  16. package/resources/links/bulk.d.ts.map +1 -1
  17. package/resources/links/bulk.js.map +1 -1
  18. package/resources/links/bulk.mjs.map +1 -1
  19. package/resources/links/index.d.ts +2 -2
  20. package/resources/links/index.d.ts.map +1 -1
  21. package/resources/links/index.js.map +1 -1
  22. package/resources/links/index.mjs.map +1 -1
  23. package/resources/links/info.d.ts +156 -5
  24. package/resources/links/info.d.ts.map +1 -1
  25. package/resources/links/info.js.map +1 -1
  26. package/resources/links/info.mjs.map +1 -1
  27. package/resources/links/links.d.ts +529 -66
  28. package/resources/links/links.d.ts.map +1 -1
  29. package/resources/links/links.js.map +1 -1
  30. package/resources/links/links.mjs.map +1 -1
  31. package/resources/projects/index.d.ts +2 -2
  32. package/resources/projects/index.d.ts.map +1 -1
  33. package/resources/projects/index.js.map +1 -1
  34. package/resources/projects/index.mjs.map +1 -1
  35. package/resources/projects/projects.d.ts +135 -31
  36. package/resources/projects/projects.d.ts.map +1 -1
  37. package/resources/projects/projects.js.map +1 -1
  38. package/resources/projects/projects.mjs.map +1 -1
  39. package/resources/projects/tags.d.ts +0 -18
  40. package/resources/projects/tags.d.ts.map +1 -1
  41. package/resources/projects/tags.js +0 -2
  42. package/resources/projects/tags.js.map +1 -1
  43. package/resources/projects/tags.mjs +0 -2
  44. package/resources/projects/tags.mjs.map +1 -1
  45. package/resources/qr.d.ts +7 -6
  46. package/resources/qr.d.ts.map +1 -1
  47. package/resources/qr.js +5 -4
  48. package/resources/qr.js.map +1 -1
  49. package/resources/qr.mjs +5 -4
  50. package/resources/qr.mjs.map +1 -1
  51. package/src/index.ts +9 -3
  52. package/src/resources/index.ts +4 -3
  53. package/src/resources/links/bulk.ts +198 -12
  54. package/src/resources/links/index.ts +4 -2
  55. package/src/resources/links/info.ts +190 -5
  56. package/src/resources/links/links.ts +637 -67
  57. package/src/resources/projects/index.ts +2 -2
  58. package/src/resources/projects/projects.ts +166 -31
  59. package/src/resources/projects/tags.ts +0 -22
  60. package/src/resources/qr.ts +16 -7
  61. package/src/version.ts +1 -1
  62. package/version.d.ts +1 -1
  63. package/version.js +1 -1
  64. package/version.mjs +1 -1
@@ -3,7 +3,6 @@
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
  /**
@@ -15,11 +14,198 @@ export class Bulk extends APIResource {
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;
@@ -32,6 +218,11 @@ export interface BulkCreateParams {
32
218
 
33
219
  export namespace BulkCreateParams {
34
220
  export interface Body {
221
+ /**
222
+ * The destination URL of the short link.
223
+ */
224
+ url: string;
225
+
35
226
  /**
36
227
  * The Android destination URL for the short link for Android device targeting.
37
228
  */
@@ -66,8 +257,8 @@ export namespace BulkCreateParams {
66
257
  expiresAt?: string | null;
67
258
 
68
259
  /**
69
- * Geo targeting information for the short link in JSON format {[COUNTRY]:
70
- * `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 }`.
71
262
  */
72
263
  geo?: Record<string, string> | null;
73
264
 
@@ -118,23 +309,18 @@ export namespace BulkCreateParams {
118
309
  /**
119
310
  * The unique ID of the tag assigned to the short link.
120
311
  */
121
- tagId?: string;
312
+ tagId?: string | null;
122
313
 
123
314
  /**
124
315
  * The unique IDs of the tags assigned to the short link.
125
316
  */
126
- tagIds?: Array<string>;
317
+ tagIds?: Array<string> | null;
127
318
 
128
319
  /**
129
320
  * The title of the short link generated via `api.dub.co/metatags`. Will be used
130
321
  * for Custom Social Media Cards if `proxy` is true.
131
322
  */
132
323
  title?: string | null;
133
-
134
- /**
135
- * The destination URL of the short link.
136
- */
137
- url?: string;
138
324
  }
139
325
  }
140
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
  }