dub 0.4.0 → 0.6.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.
- package/CHANGELOG.md +16 -0
- package/README.md +14 -8
- package/index.d.mts +13 -1
- package/index.d.ts +13 -1
- package/index.d.ts.map +1 -1
- package/index.js +13 -1
- package/index.js.map +1 -1
- package/index.mjs +13 -1
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/index.d.ts +2 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/links/bulk.d.ts +10 -9
- package/resources/links/bulk.d.ts.map +1 -1
- package/resources/links/bulk.js +1 -1
- package/resources/links/bulk.js.map +1 -1
- package/resources/links/bulk.mjs +1 -1
- package/resources/links/bulk.mjs.map +1 -1
- package/resources/links/info.d.ts +7 -7
- package/resources/links/info.d.ts.map +1 -1
- package/resources/links/info.js +3 -2
- package/resources/links/info.js.map +1 -1
- package/resources/links/info.mjs +3 -2
- package/resources/links/info.mjs.map +1 -1
- package/resources/links/links.d.ts +55 -40
- package/resources/links/links.d.ts.map +1 -1
- package/resources/links/links.js +6 -5
- package/resources/links/links.js.map +1 -1
- package/resources/links/links.mjs +6 -5
- package/resources/links/links.mjs.map +1 -1
- package/resources/projects/index.d.ts +2 -2
- package/resources/projects/index.d.ts.map +1 -1
- package/resources/projects/index.js.map +1 -1
- package/resources/projects/index.mjs.map +1 -1
- package/resources/projects/projects.d.ts +10 -1
- package/resources/projects/projects.d.ts.map +1 -1
- package/resources/projects/projects.js +2 -1
- package/resources/projects/projects.js.map +1 -1
- package/resources/projects/projects.mjs +2 -1
- package/resources/projects/projects.mjs.map +1 -1
- package/resources/projects/tags.d.ts +16 -3
- package/resources/projects/tags.d.ts.map +1 -1
- package/resources/projects/tags.js +4 -2
- package/resources/projects/tags.js.map +1 -1
- package/resources/projects/tags.mjs +4 -2
- package/resources/projects/tags.mjs.map +1 -1
- package/resources/qr.d.ts +40 -0
- package/resources/qr.d.ts.map +1 -1
- package/resources/qr.js +8 -0
- package/resources/qr.js.map +1 -1
- package/resources/qr.mjs +8 -0
- package/resources/qr.mjs.map +1 -1
- package/src/index.ts +35 -1
- package/src/resources/index.ts +8 -2
- package/src/resources/links/bulk.ts +11 -10
- package/src/resources/links/info.ts +9 -8
- package/src/resources/links/links.ts +63 -45
- package/src/resources/projects/index.ts +2 -2
- package/src/resources/projects/projects.ts +12 -1
- package/src/resources/projects/tags.ts +20 -3
- package/src/resources/qr.ts +51 -1
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/resources/qr.mjs
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
import { APIResource } from 'dub/resource';
|
|
3
3
|
export class Qr extends APIResource {
|
|
4
|
+
/**
|
|
5
|
+
* Retrieve a QR code for a link.
|
|
6
|
+
*/
|
|
7
|
+
retrieve(query, options) {
|
|
8
|
+
return this._client.get('/qr', { query, ...options, __binaryResponse: true });
|
|
9
|
+
}
|
|
4
10
|
}
|
|
11
|
+
(function (Qr) {
|
|
12
|
+
})(Qr || (Qr = {}));
|
|
5
13
|
//# sourceMappingURL=qr.mjs.map
|
package/resources/qr.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qr.mjs","sourceRoot":"","sources":["../src/resources/qr.ts"],"names":[],"mappings":"AAAA,qDAAqD;
|
|
1
|
+
{"version":3,"file":"qr.mjs","sourceRoot":"","sources":["../src/resources/qr.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAE,WAAW,EAAE,MAAM,cAAc;AAI1C,MAAM,OAAO,EAAG,SAAQ,WAAW;IACjC;;OAEG;IACH,QAAQ,CAAC,KAAuB,EAAE,OAA6B;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;IAChF,CAAC;CACF;AAsCD,WAAiB,EAAE;AAEnB,CAAC,EAFgB,EAAE,KAAF,EAAE,QAElB"}
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,13 @@ import * as Uploads from './uploads';
|
|
|
7
7
|
import * as API from "./resources/index";
|
|
8
8
|
|
|
9
9
|
export interface ClientOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Defaults to process.env['DUB_API_KEY'].
|
|
12
|
+
*/
|
|
13
|
+
token?: string | undefined;
|
|
14
|
+
|
|
15
|
+
projectSlug?: string | null | undefined;
|
|
16
|
+
|
|
10
17
|
/**
|
|
11
18
|
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
12
19
|
*
|
|
@@ -66,11 +73,16 @@ export interface ClientOptions {
|
|
|
66
73
|
|
|
67
74
|
/** API Client for interfacing with the Dub API. */
|
|
68
75
|
export class Dub extends Core.APIClient {
|
|
76
|
+
token: string;
|
|
77
|
+
projectSlug: string | null;
|
|
78
|
+
|
|
69
79
|
private _options: ClientOptions;
|
|
70
80
|
|
|
71
81
|
/**
|
|
72
82
|
* API Client for interfacing with the Dub API.
|
|
73
83
|
*
|
|
84
|
+
* @param {string | undefined} [opts.token=process.env['DUB_API_KEY'] ?? undefined]
|
|
85
|
+
* @param {string | null | undefined} [opts.projectSlug]
|
|
74
86
|
* @param {string} [opts.baseURL=process.env['DUB_BASE_URL'] ?? https://api.dub.co] - Override the default base URL for the API.
|
|
75
87
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
76
88
|
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
@@ -79,8 +91,21 @@ export class Dub extends Core.APIClient {
|
|
|
79
91
|
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
80
92
|
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
81
93
|
*/
|
|
82
|
-
constructor({
|
|
94
|
+
constructor({
|
|
95
|
+
baseURL = Core.readEnv('DUB_BASE_URL'),
|
|
96
|
+
token = Core.readEnv('DUB_API_KEY'),
|
|
97
|
+
projectSlug = null,
|
|
98
|
+
...opts
|
|
99
|
+
}: ClientOptions = {}) {
|
|
100
|
+
if (token === undefined) {
|
|
101
|
+
throw new Errors.DubError(
|
|
102
|
+
"The DUB_API_KEY environment variable is missing or empty; either provide it, or instantiate the Dub client with an token option, like new Dub({ token: 'My Token' }).",
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
83
106
|
const options: ClientOptions = {
|
|
107
|
+
token,
|
|
108
|
+
projectSlug,
|
|
84
109
|
...opts,
|
|
85
110
|
baseURL: baseURL || `https://api.dub.co`,
|
|
86
111
|
};
|
|
@@ -93,6 +118,9 @@ export class Dub extends Core.APIClient {
|
|
|
93
118
|
fetch: options.fetch,
|
|
94
119
|
});
|
|
95
120
|
this._options = options;
|
|
121
|
+
|
|
122
|
+
this.token = token;
|
|
123
|
+
this.projectSlug = projectSlug;
|
|
96
124
|
}
|
|
97
125
|
|
|
98
126
|
links: API.Links = new API.Links(this);
|
|
@@ -110,6 +138,10 @@ export class Dub extends Core.APIClient {
|
|
|
110
138
|
};
|
|
111
139
|
}
|
|
112
140
|
|
|
141
|
+
protected override authHeaders(opts: Core.FinalRequestOptions): Core.Headers {
|
|
142
|
+
return { Authorization: `Bearer ${this.token}` };
|
|
143
|
+
}
|
|
144
|
+
|
|
113
145
|
static Dub = this;
|
|
114
146
|
|
|
115
147
|
static DubError = Errors.DubError;
|
|
@@ -162,11 +194,13 @@ export namespace Dub {
|
|
|
162
194
|
export import LinkDeleteLinkParams = API.LinkDeleteLinkParams;
|
|
163
195
|
|
|
164
196
|
export import Qr = API.Qr;
|
|
197
|
+
export import QrRetrieveParams = API.QrRetrieveParams;
|
|
165
198
|
|
|
166
199
|
export import Projects = API.Projects;
|
|
167
200
|
export import Project = API.Project;
|
|
168
201
|
export import ProjectDetails = API.ProjectDetails;
|
|
169
202
|
export import ProjectListResponse = API.ProjectListResponse;
|
|
203
|
+
export import ProjectRetrieveParams = API.ProjectRetrieveParams;
|
|
170
204
|
}
|
|
171
205
|
|
|
172
206
|
export default Dub;
|
package/src/resources/index.ts
CHANGED
|
@@ -9,5 +9,11 @@ export {
|
|
|
9
9
|
LinkDeleteLinkParams,
|
|
10
10
|
Links,
|
|
11
11
|
} from './links/links';
|
|
12
|
-
export {
|
|
13
|
-
|
|
12
|
+
export {
|
|
13
|
+
Project,
|
|
14
|
+
ProjectDetails,
|
|
15
|
+
ProjectListResponse,
|
|
16
|
+
ProjectRetrieveParams,
|
|
17
|
+
Projects,
|
|
18
|
+
} from './projects/projects';
|
|
19
|
+
export { QrRetrieveParams, Qr } from './qr';
|
|
@@ -10,7 +10,7 @@ export class Bulk extends APIResource {
|
|
|
10
10
|
* Bulk create up to 100 links for the authenticated project.
|
|
11
11
|
*/
|
|
12
12
|
create(params: BulkCreateParams, options?: Core.RequestOptions): Core.APIPromise<BulkCreateResponse> {
|
|
13
|
-
const { projectSlug, ...body } = params;
|
|
13
|
+
const { projectSlug = this._client.projectSlug, ...body } = params;
|
|
14
14
|
return this._client.post('/links/bulk', { query: { projectSlug }, body, ...options });
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -20,9 +20,9 @@ export type BulkCreateResponse = Array<LinksAPI.Link>;
|
|
|
20
20
|
export interface BulkCreateParams {
|
|
21
21
|
/**
|
|
22
22
|
* Query param: The slug for the project to create links for. E.g. for
|
|
23
|
-
* app.dub.co/acme
|
|
23
|
+
* `app.dub.co/acme`, the projectSlug is `acme`.
|
|
24
24
|
*/
|
|
25
|
-
projectSlug
|
|
25
|
+
projectSlug?: string;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export namespace BulkCreateParams {
|
|
@@ -43,13 +43,14 @@ export namespace BulkCreateParams {
|
|
|
43
43
|
comments?: string | null;
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
* The description of the short link generated via api.dub.co/metatags
|
|
46
|
+
* The description of the short link generated via `api.dub.co/metatags`. Will be
|
|
47
47
|
* used for Custom Social Media Cards if `proxy` is true.
|
|
48
48
|
*/
|
|
49
49
|
description?: string | null;
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
* The domain of the short link.
|
|
52
|
+
* The domain of the short link. If not provided, the primary domain for the
|
|
53
|
+
* project will be used (or `dub.sh` if the project has no domains).
|
|
53
54
|
*/
|
|
54
55
|
domain?: string;
|
|
55
56
|
|
|
@@ -61,13 +62,13 @@ export namespace BulkCreateParams {
|
|
|
61
62
|
|
|
62
63
|
/**
|
|
63
64
|
* Geo targeting information for the short link in JSON format {[COUNTRY]:
|
|
64
|
-
*
|
|
65
|
+
* `https://example.com` }. Learn more: `https://dub.sh/geo`
|
|
65
66
|
*/
|
|
66
67
|
geo?: Record<string, string> | null;
|
|
67
68
|
|
|
68
69
|
/**
|
|
69
|
-
* The image of the short link generated via api.dub.co/metatags
|
|
70
|
-
* Custom Social Media Cards if `proxy` is true.
|
|
70
|
+
* The image of the short link generated via `api.dub.co/metatags`. Will be used
|
|
71
|
+
* for Custom Social Media Cards if `proxy` is true.
|
|
71
72
|
*/
|
|
72
73
|
image?: string | null;
|
|
73
74
|
|
|
@@ -108,8 +109,8 @@ export namespace BulkCreateParams {
|
|
|
108
109
|
tagId?: string | null;
|
|
109
110
|
|
|
110
111
|
/**
|
|
111
|
-
* The title of the short link generated via api.dub.co/metatags
|
|
112
|
-
* Custom Social Media Cards if `proxy` is true.
|
|
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.
|
|
113
114
|
*/
|
|
114
115
|
title?: string | null;
|
|
115
116
|
|
|
@@ -9,28 +9,29 @@ export class Info extends APIResource {
|
|
|
9
9
|
/**
|
|
10
10
|
* Retrieve the info for a link from their domain and key.
|
|
11
11
|
*/
|
|
12
|
-
retrieve(
|
|
13
|
-
|
|
12
|
+
retrieve(params: InfoRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<LinksAPI.Link> {
|
|
13
|
+
const { projectSlug = this._client.projectSlug, ...query } = params;
|
|
14
|
+
return this._client.get('/links/info', { query: { projectSlug, ...query }, ...options });
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export interface InfoRetrieveParams {
|
|
18
19
|
/**
|
|
19
|
-
* The domain of the link to retrieve. E.g. for dub.sh/github
|
|
20
|
-
*
|
|
20
|
+
* The domain of the link to retrieve. E.g. for `dub.sh/github`, the domain is
|
|
21
|
+
* `dub.sh`.
|
|
21
22
|
*/
|
|
22
23
|
domain: string;
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
|
-
* The key of the link to retrieve. E.g. for dub.sh/github
|
|
26
|
+
* The key of the link to retrieve. E.g. for `dub.sh/github`, the key is `github`.
|
|
26
27
|
*/
|
|
27
28
|
key: string;
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
|
-
* The slug for the project that the link belongs to. E.g. for app.dub.co/acme
|
|
31
|
-
* projectSlug is
|
|
31
|
+
* The slug for the project that the link belongs to. E.g. for `app.dub.co/acme`,
|
|
32
|
+
* the projectSlug is `acme`.
|
|
32
33
|
*/
|
|
33
|
-
projectSlug
|
|
34
|
+
projectSlug?: string;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
export namespace Info {
|
|
@@ -14,7 +14,7 @@ export class Links extends APIResource {
|
|
|
14
14
|
* Create a new link for the authenticated project.
|
|
15
15
|
*/
|
|
16
16
|
create(params: LinkCreateParams, options?: Core.RequestOptions): Core.APIPromise<Link> {
|
|
17
|
-
const { projectSlug, ...body } = params;
|
|
17
|
+
const { projectSlug = this._client.projectSlug, ...body } = params;
|
|
18
18
|
return this._client.post('/links', { query: { projectSlug }, body, ...options });
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ export class Links extends APIResource {
|
|
|
22
22
|
* Edit a link for the authenticated project.
|
|
23
23
|
*/
|
|
24
24
|
update(linkId: string, params: LinkUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Link> {
|
|
25
|
-
const { projectSlug, ...body } = params;
|
|
25
|
+
const { projectSlug = this._client.projectSlug, ...body } = params;
|
|
26
26
|
return this._client.put(`/links/${linkId}`, { query: { projectSlug }, body, ...options });
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -30,8 +30,9 @@ export class Links extends APIResource {
|
|
|
30
30
|
* Retrieve a list of links for the authenticated project. The list will be
|
|
31
31
|
* paginated and the provided query parameters allow filtering the returned links.
|
|
32
32
|
*/
|
|
33
|
-
list(
|
|
34
|
-
|
|
33
|
+
list(params: LinkListParams, options?: Core.RequestOptions): Core.APIPromise<LinkListResponse> {
|
|
34
|
+
const { projectSlug = this._client.projectSlug, ...query } = params;
|
|
35
|
+
return this._client.get('/links', { query: { projectSlug, ...query }, ...options });
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
/**
|
|
@@ -42,7 +43,7 @@ export class Links extends APIResource {
|
|
|
42
43
|
params: LinkDeleteLinkParams,
|
|
43
44
|
options?: Core.RequestOptions,
|
|
44
45
|
): Core.APIPromise<Link> {
|
|
45
|
-
const { projectSlug } = params;
|
|
46
|
+
const { projectSlug = this._client.projectSlug } = params;
|
|
46
47
|
return this._client.delete(`/links/${linkId}`, { query: { projectSlug }, ...options });
|
|
47
48
|
}
|
|
48
49
|
}
|
|
@@ -79,13 +80,14 @@ export interface Link {
|
|
|
79
80
|
createdAt?: string;
|
|
80
81
|
|
|
81
82
|
/**
|
|
82
|
-
* The description of the short link generated via api.dub.co/metatags
|
|
83
|
+
* The description of the short link generated via `api.dub.co/metatags`. Will be
|
|
83
84
|
* used for Custom Social Media Cards if `proxy` is true.
|
|
84
85
|
*/
|
|
85
86
|
description?: string | null;
|
|
86
87
|
|
|
87
88
|
/**
|
|
88
|
-
* 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).
|
|
89
91
|
*/
|
|
90
92
|
domain?: string;
|
|
91
93
|
|
|
@@ -97,13 +99,13 @@ export interface Link {
|
|
|
97
99
|
|
|
98
100
|
/**
|
|
99
101
|
* Geo targeting information for the short link in JSON format {[COUNTRY]:
|
|
100
|
-
*
|
|
102
|
+
* `https://example.com` }. Learn more: `https://dub.sh/geo`
|
|
101
103
|
*/
|
|
102
104
|
geo?: Record<string, string> | null;
|
|
103
105
|
|
|
104
106
|
/**
|
|
105
|
-
* The image of the short link generated via api.dub.co/metatags
|
|
106
|
-
* 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.
|
|
107
109
|
*/
|
|
108
110
|
image?: string | null;
|
|
109
111
|
|
|
@@ -143,19 +145,31 @@ export interface Link {
|
|
|
143
145
|
*/
|
|
144
146
|
publicStats?: boolean;
|
|
145
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
|
+
|
|
146
154
|
/**
|
|
147
155
|
* Whether the short link uses link cloaking.
|
|
148
156
|
*/
|
|
149
157
|
rewrite?: boolean;
|
|
150
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
|
+
|
|
151
165
|
/**
|
|
152
166
|
* The unique id of the tag assigned to the short link.
|
|
153
167
|
*/
|
|
154
168
|
tagId?: string | null;
|
|
155
169
|
|
|
156
170
|
/**
|
|
157
|
-
* The title of the short link generated via api.dub.co/metatags
|
|
158
|
-
* 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.
|
|
159
173
|
*/
|
|
160
174
|
title?: string | null;
|
|
161
175
|
|
|
@@ -205,14 +219,9 @@ export type LinkListResponse = Array<Link>;
|
|
|
205
219
|
export interface LinkCreateParams {
|
|
206
220
|
/**
|
|
207
221
|
* Query param: The slug for the project to create links for. E.g. for
|
|
208
|
-
* app.dub.co/acme
|
|
222
|
+
* `app.dub.co/acme`, the projectSlug is `acme`.
|
|
209
223
|
*/
|
|
210
|
-
projectSlug
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Body param: The domain of the short link.
|
|
214
|
-
*/
|
|
215
|
-
domain: string;
|
|
224
|
+
projectSlug?: string;
|
|
216
225
|
|
|
217
226
|
/**
|
|
218
227
|
* Body param: The destination URL of the short link.
|
|
@@ -236,11 +245,18 @@ export interface LinkCreateParams {
|
|
|
236
245
|
comments?: string | null;
|
|
237
246
|
|
|
238
247
|
/**
|
|
239
|
-
* Body param: The description of the short link generated via
|
|
240
|
-
* Will be used for Custom Social Media Cards if `proxy` is
|
|
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.
|
|
241
251
|
*/
|
|
242
252
|
description?: string | null;
|
|
243
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
|
+
|
|
244
260
|
/**
|
|
245
261
|
* Body param: The date and time when the short link will expire in ISO-8601
|
|
246
262
|
* format. Must be in the future.
|
|
@@ -249,13 +265,13 @@ export interface LinkCreateParams {
|
|
|
249
265
|
|
|
250
266
|
/**
|
|
251
267
|
* Body param: Geo targeting information for the short link in JSON format
|
|
252
|
-
* {[COUNTRY]:
|
|
268
|
+
* {[COUNTRY]: `https://example.com` }. Learn more: `https://dub.sh/geo`
|
|
253
269
|
*/
|
|
254
270
|
geo?: Record<string, string> | null;
|
|
255
271
|
|
|
256
272
|
/**
|
|
257
|
-
* Body param: The image of the short link generated via api.dub.co/metatags
|
|
258
|
-
* 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.
|
|
259
275
|
*/
|
|
260
276
|
image?: string | null;
|
|
261
277
|
|
|
@@ -297,8 +313,8 @@ export interface LinkCreateParams {
|
|
|
297
313
|
tagId?: string | null;
|
|
298
314
|
|
|
299
315
|
/**
|
|
300
|
-
* Body param: The title of the short link generated via api.dub.co/metatags
|
|
301
|
-
* 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.
|
|
302
318
|
*/
|
|
303
319
|
title?: string | null;
|
|
304
320
|
}
|
|
@@ -306,9 +322,9 @@ export interface LinkCreateParams {
|
|
|
306
322
|
export interface LinkUpdateParams {
|
|
307
323
|
/**
|
|
308
324
|
* Query param: The slug for the project that the link belongs to. E.g. for
|
|
309
|
-
* app.dub.co/acme
|
|
325
|
+
* `app.dub.co/acme`, the projectSlug is `acme`.
|
|
310
326
|
*/
|
|
311
|
-
projectSlug
|
|
327
|
+
projectSlug?: string;
|
|
312
328
|
|
|
313
329
|
/**
|
|
314
330
|
* Body param: The Android destination URL for the short link for Android device
|
|
@@ -327,13 +343,15 @@ export interface LinkUpdateParams {
|
|
|
327
343
|
comments?: string | null;
|
|
328
344
|
|
|
329
345
|
/**
|
|
330
|
-
* Body param: The description of the short link generated via
|
|
331
|
-
* Will be used for Custom Social Media Cards if `proxy` is
|
|
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.
|
|
332
349
|
*/
|
|
333
350
|
description?: string | null;
|
|
334
351
|
|
|
335
352
|
/**
|
|
336
|
-
* 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).
|
|
337
355
|
*/
|
|
338
356
|
domain?: string;
|
|
339
357
|
|
|
@@ -345,13 +363,13 @@ export interface LinkUpdateParams {
|
|
|
345
363
|
|
|
346
364
|
/**
|
|
347
365
|
* Body param: Geo targeting information for the short link in JSON format
|
|
348
|
-
* {[COUNTRY]:
|
|
366
|
+
* {[COUNTRY]: `https://example.com` }. Learn more: `https://dub.sh/geo`
|
|
349
367
|
*/
|
|
350
368
|
geo?: Record<string, string> | null;
|
|
351
369
|
|
|
352
370
|
/**
|
|
353
|
-
* Body param: The image of the short link generated via api.dub.co/metatags
|
|
354
|
-
* 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.
|
|
355
373
|
*/
|
|
356
374
|
image?: string | null;
|
|
357
375
|
|
|
@@ -393,8 +411,8 @@ export interface LinkUpdateParams {
|
|
|
393
411
|
tagId?: string | null;
|
|
394
412
|
|
|
395
413
|
/**
|
|
396
|
-
* Body param: The title of the short link generated via api.dub.co/metatags
|
|
397
|
-
* 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.
|
|
398
416
|
*/
|
|
399
417
|
title?: string | null;
|
|
400
418
|
|
|
@@ -406,13 +424,13 @@ export interface LinkUpdateParams {
|
|
|
406
424
|
|
|
407
425
|
export interface LinkListParams {
|
|
408
426
|
/**
|
|
409
|
-
* The slug for the project to retrieve links for. E.g. for app.dub.co/acme
|
|
410
|
-
* projectSlug is
|
|
427
|
+
* The slug for the project to retrieve links for. E.g. for `app.dub.co/acme`, the
|
|
428
|
+
* projectSlug is `acme`.
|
|
411
429
|
*/
|
|
412
|
-
projectSlug
|
|
430
|
+
projectSlug?: string;
|
|
413
431
|
|
|
414
432
|
/**
|
|
415
|
-
* The domain to filter the links by. E.g.
|
|
433
|
+
* The domain to filter the links by. E.g. `ac.me`. If not provided, all links for
|
|
416
434
|
* the project will be returned.
|
|
417
435
|
*/
|
|
418
436
|
domain?: string;
|
|
@@ -429,13 +447,13 @@ export interface LinkListParams {
|
|
|
429
447
|
search?: string;
|
|
430
448
|
|
|
431
449
|
/**
|
|
432
|
-
* 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
|
|
433
451
|
* provided.
|
|
434
452
|
*/
|
|
435
453
|
showArchived?: true | false;
|
|
436
454
|
|
|
437
455
|
/**
|
|
438
|
-
* The field to sort the links by. The default is
|
|
456
|
+
* The field to sort the links by. The default is `createdAt`, and sort order is
|
|
439
457
|
* always descending.
|
|
440
458
|
*/
|
|
441
459
|
sort?: 'createdAt' | 'clicks' | 'lastClicked';
|
|
@@ -453,10 +471,10 @@ export interface LinkListParams {
|
|
|
453
471
|
|
|
454
472
|
export interface LinkDeleteLinkParams {
|
|
455
473
|
/**
|
|
456
|
-
* The slug for the project that the link belongs to. E.g. for app.dub.co/acme
|
|
457
|
-
* projectSlug is
|
|
474
|
+
* The slug for the project that the link belongs to. E.g. for `app.dub.co/acme`,
|
|
475
|
+
* the projectSlug is `acme`.
|
|
458
476
|
*/
|
|
459
|
-
projectSlug
|
|
477
|
+
projectSlug?: string;
|
|
460
478
|
}
|
|
461
479
|
|
|
462
480
|
export namespace Links {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
|
|
3
|
-
export { Project, ProjectDetails, ProjectListResponse, Projects } from './projects';
|
|
4
|
-
export { Tag, TagListResponse, TagCreateParams, Tags } from './tags';
|
|
3
|
+
export { Project, ProjectDetails, ProjectListResponse, ProjectRetrieveParams, Projects } from './projects';
|
|
4
|
+
export { Tag, TagListResponse, TagCreateParams, TagListParams, Tags } from './tags';
|
|
@@ -11,7 +11,8 @@ export class Projects extends APIResource {
|
|
|
11
11
|
/**
|
|
12
12
|
* Retrieve a project for the authenticated user.
|
|
13
13
|
*/
|
|
14
|
-
retrieve(
|
|
14
|
+
retrieve(params: ProjectRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<ProjectDetails> {
|
|
15
|
+
const { projectSlug = this._client.projectSlug } = params;
|
|
15
16
|
return this._client.get(`/projects/${projectSlug}`, options);
|
|
16
17
|
}
|
|
17
18
|
|
|
@@ -111,12 +112,22 @@ export namespace ProjectDetails {
|
|
|
111
112
|
|
|
112
113
|
export type ProjectListResponse = Array<Project>;
|
|
113
114
|
|
|
115
|
+
export interface ProjectRetrieveParams {
|
|
116
|
+
/**
|
|
117
|
+
* The slug for the project to retrieve. E.g. for `app.dub.co/acme`, the
|
|
118
|
+
* projectSlug is `acme`.
|
|
119
|
+
*/
|
|
120
|
+
projectSlug?: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
114
123
|
export namespace Projects {
|
|
115
124
|
export import Project = ProjectsAPI.Project;
|
|
116
125
|
export import ProjectDetails = ProjectsAPI.ProjectDetails;
|
|
117
126
|
export import ProjectListResponse = ProjectsAPI.ProjectListResponse;
|
|
127
|
+
export import ProjectRetrieveParams = ProjectsAPI.ProjectRetrieveParams;
|
|
118
128
|
export import Tags = TagsAPI.Tags;
|
|
119
129
|
export import Tag = TagsAPI.Tag;
|
|
120
130
|
export import TagListResponse = TagsAPI.TagListResponse;
|
|
121
131
|
export import TagCreateParams = TagsAPI.TagCreateParams;
|
|
132
|
+
export import TagListParams = TagsAPI.TagListParams;
|
|
122
133
|
}
|
|
@@ -8,14 +8,16 @@ export class Tags extends APIResource {
|
|
|
8
8
|
/**
|
|
9
9
|
* Create a new tag for the authenticated project.
|
|
10
10
|
*/
|
|
11
|
-
create(
|
|
11
|
+
create(params: TagCreateParams, options?: Core.RequestOptions): Core.APIPromise<Tag> {
|
|
12
|
+
const { projectSlug = this._client.projectSlug, ...body } = params;
|
|
12
13
|
return this._client.post(`/projects/${projectSlug}/tags`, { body, ...options });
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Retrieve a list of tags for the authenticated project.
|
|
17
18
|
*/
|
|
18
|
-
list(
|
|
19
|
+
list(params: TagListParams, options?: Core.RequestOptions): Core.APIPromise<TagListResponse> {
|
|
20
|
+
const { projectSlug = this._client.projectSlug } = params;
|
|
19
21
|
return this._client.get(`/projects/${projectSlug}/tags`, options);
|
|
20
22
|
}
|
|
21
23
|
}
|
|
@@ -41,13 +43,28 @@ export type TagListResponse = Array<Tag>;
|
|
|
41
43
|
|
|
42
44
|
export interface TagCreateParams {
|
|
43
45
|
/**
|
|
44
|
-
* The
|
|
46
|
+
* Path param: The slug for the project to create tags for. E.g. for
|
|
47
|
+
* `app.dub.co/acme`, the projectSlug is `acme`.
|
|
48
|
+
*/
|
|
49
|
+
projectSlug?: string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Body param: The name of the tag to create.
|
|
45
53
|
*/
|
|
46
54
|
tag?: string;
|
|
47
55
|
}
|
|
48
56
|
|
|
57
|
+
export interface TagListParams {
|
|
58
|
+
/**
|
|
59
|
+
* The slug for the project to retrieve tags for. E.g. for `app.dub.co/acme`, the
|
|
60
|
+
* projectSlug is `acme`.
|
|
61
|
+
*/
|
|
62
|
+
projectSlug?: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
49
65
|
export namespace Tags {
|
|
50
66
|
export import Tag = TagsAPI.Tag;
|
|
51
67
|
export import TagListResponse = TagsAPI.TagListResponse;
|
|
52
68
|
export import TagCreateParams = TagsAPI.TagCreateParams;
|
|
69
|
+
export import TagListParams = TagsAPI.TagListParams;
|
|
53
70
|
}
|
package/src/resources/qr.ts
CHANGED
|
@@ -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.
|
|
1
|
+
export const VERSION = '0.6.0'; // x-release-please-version
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.6.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.6.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|