@codeqr/ts 0.9.0 → 0.24.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 +509 -0
- package/LICENSE +1 -1
- package/README.md +12 -1
- package/api-promise.d.mts +1 -0
- package/api-promise.d.mts.map +1 -1
- package/api-promise.d.ts +1 -0
- package/api-promise.d.ts.map +1 -1
- package/api-promise.mjs +1 -0
- package/api-promise.mjs.map +1 -1
- package/client.d.mts +8 -7
- package/client.d.mts.map +1 -1
- package/client.d.ts +8 -7
- package/client.d.ts.map +1 -1
- package/client.js +43 -10
- package/client.js.map +1 -1
- package/client.mjs +43 -10
- package/client.mjs.map +1 -1
- package/core/api-promise.d.mts.map +1 -1
- package/core/api-promise.d.ts.map +1 -1
- package/core/api-promise.mjs.map +1 -1
- package/core/error.mjs.map +1 -1
- package/core/resource.d.mts.map +1 -1
- package/core/resource.d.ts.map +1 -1
- package/core/uploads.d.mts.map +1 -1
- package/core/uploads.d.ts.map +1 -1
- package/core/uploads.mjs.map +1 -1
- package/error.d.mts +1 -0
- package/error.d.mts.map +1 -1
- package/error.d.ts +1 -0
- package/error.d.ts.map +1 -1
- package/error.mjs +1 -0
- package/error.mjs.map +1 -1
- package/index.d.mts.map +1 -1
- package/index.d.ts.map +1 -1
- package/index.mjs.map +1 -1
- package/internal/detect-platform.mjs.map +1 -1
- package/internal/headers.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +5 -0
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +5 -0
- package/internal/parse.mjs.map +1 -1
- package/internal/qs/formats.d.mts.map +1 -1
- package/internal/qs/formats.d.ts.map +1 -1
- package/internal/qs/index.d.mts +2 -2
- package/internal/qs/index.d.mts.map +1 -1
- package/internal/qs/index.d.ts +2 -2
- package/internal/qs/index.d.ts.map +1 -1
- package/internal/qs/index.mjs.map +1 -1
- package/internal/qs/stringify.d.mts.map +1 -1
- package/internal/qs/stringify.d.ts.map +1 -1
- package/internal/qs/stringify.mjs.map +1 -1
- package/internal/qs/utils.d.mts.map +1 -1
- package/internal/qs/utils.d.ts.map +1 -1
- package/internal/qs/utils.mjs.map +1 -1
- package/internal/request-options.d.mts.map +1 -1
- package/internal/request-options.d.ts.map +1 -1
- package/internal/shims.d.mts +6 -0
- package/internal/shims.d.mts.map +1 -1
- package/internal/shims.d.ts +6 -0
- package/internal/shims.d.ts.map +1 -1
- package/internal/to-file.d.mts.map +1 -1
- package/internal/to-file.d.ts.map +1 -1
- package/internal/to-file.mjs.map +1 -1
- package/internal/types.d.mts +10 -10
- package/internal/types.d.mts.map +1 -1
- package/internal/types.d.ts +10 -10
- package/internal/types.d.ts.map +1 -1
- package/internal/uploads.d.mts.map +1 -1
- package/internal/uploads.d.ts.map +1 -1
- package/internal/uploads.mjs.map +1 -1
- package/internal/utils/base64.mjs.map +1 -1
- package/internal/utils/env.js +2 -2
- package/internal/utils/env.js.map +1 -1
- package/internal/utils/env.mjs +2 -2
- package/internal/utils/env.mjs.map +1 -1
- package/internal/utils/log.d.mts.map +1 -1
- package/internal/utils/log.d.ts.map +1 -1
- package/internal/utils/log.js +2 -0
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs +2 -0
- package/internal/utils/log.mjs.map +1 -1
- package/internal/utils/path.mjs.map +1 -1
- package/internal/utils/query.d.mts +2 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +2 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +10 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +6 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils/values.mjs.map +1 -1
- package/internal/utils.d.mts +1 -0
- package/internal/utils.d.mts.map +1 -1
- package/internal/utils.d.ts +1 -0
- package/internal/utils.d.ts.map +1 -1
- package/internal/utils.js +1 -0
- package/internal/utils.js.map +1 -1
- package/internal/utils.mjs +1 -0
- package/internal/utils.mjs.map +1 -1
- package/package.json +12 -1
- package/resource.d.mts +1 -0
- package/resource.d.mts.map +1 -1
- package/resource.d.ts +1 -0
- package/resource.d.ts.map +1 -1
- package/resource.mjs +1 -0
- package/resource.mjs.map +1 -1
- package/resources/analytics.d.mts +23 -3
- package/resources/analytics.d.mts.map +1 -1
- package/resources/analytics.d.ts +23 -3
- package/resources/analytics.d.ts.map +1 -1
- package/resources/analytics.mjs.map +1 -1
- package/resources/domains.d.mts +27 -27
- package/resources/domains.d.mts.map +1 -1
- package/resources/domains.d.ts +27 -27
- package/resources/domains.d.ts.map +1 -1
- package/resources/domains.js +8 -8
- package/resources/domains.js.map +1 -1
- package/resources/domains.mjs +8 -8
- package/resources/domains.mjs.map +1 -1
- package/resources/events.d.mts +53 -137
- package/resources/events.d.mts.map +1 -1
- package/resources/events.d.ts +53 -137
- package/resources/events.d.ts.map +1 -1
- package/resources/events.mjs.map +1 -1
- package/resources/index.d.mts +4 -4
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +4 -4
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/links/bulk.d.mts +16 -26
- package/resources/links/bulk.d.mts.map +1 -1
- package/resources/links/bulk.d.ts +16 -26
- package/resources/links/bulk.d.ts.map +1 -1
- package/resources/links/bulk.js +0 -14
- package/resources/links/bulk.js.map +1 -1
- package/resources/links/bulk.mjs +0 -14
- package/resources/links/bulk.mjs.map +1 -1
- package/resources/links/index.d.mts +2 -2
- package/resources/links/index.d.mts.map +1 -1
- package/resources/links/index.d.ts +2 -2
- package/resources/links/index.d.ts.map +1 -1
- package/resources/links/index.js.map +1 -1
- package/resources/links/index.mjs +1 -1
- package/resources/links/index.mjs.map +1 -1
- package/resources/links/links.d.mts +232 -988
- package/resources/links/links.d.mts.map +1 -1
- package/resources/links/links.d.ts +232 -988
- package/resources/links/links.d.ts.map +1 -1
- package/resources/links/links.js +16 -42
- package/resources/links/links.js.map +1 -1
- package/resources/links/links.mjs +16 -42
- package/resources/links/links.mjs.map +1 -1
- package/resources/links.d.mts.map +1 -1
- package/resources/links.d.ts.map +1 -1
- package/resources/links.mjs.map +1 -1
- package/resources/projects.d.mts +0 -4
- package/resources/projects.d.mts.map +1 -1
- package/resources/projects.d.ts +0 -4
- package/resources/projects.d.ts.map +1 -1
- package/resources/projects.js +0 -7
- package/resources/projects.js.map +1 -1
- package/resources/projects.mjs +0 -7
- package/resources/projects.mjs.map +1 -1
- package/resources/qrcodes/bulk.d.mts +111 -38
- package/resources/qrcodes/bulk.d.mts.map +1 -1
- package/resources/qrcodes/bulk.d.ts +111 -38
- package/resources/qrcodes/bulk.d.ts.map +1 -1
- package/resources/qrcodes/bulk.js +0 -14
- package/resources/qrcodes/bulk.js.map +1 -1
- package/resources/qrcodes/bulk.mjs +0 -14
- package/resources/qrcodes/bulk.mjs.map +1 -1
- package/resources/qrcodes/index.d.mts +2 -2
- package/resources/qrcodes/index.d.mts.map +1 -1
- package/resources/qrcodes/index.d.ts +2 -2
- package/resources/qrcodes/index.d.ts.map +1 -1
- package/resources/qrcodes/index.js.map +1 -1
- package/resources/qrcodes/index.mjs +1 -1
- package/resources/qrcodes/index.mjs.map +1 -1
- package/resources/qrcodes/qrcodes.d.mts +442 -855
- package/resources/qrcodes/qrcodes.d.mts.map +1 -1
- package/resources/qrcodes/qrcodes.d.ts +442 -855
- package/resources/qrcodes/qrcodes.d.ts.map +1 -1
- package/resources/qrcodes/qrcodes.js +12 -42
- package/resources/qrcodes/qrcodes.js.map +1 -1
- package/resources/qrcodes/qrcodes.mjs +12 -42
- package/resources/qrcodes/qrcodes.mjs.map +1 -1
- package/resources/qrcodes.d.mts.map +1 -1
- package/resources/qrcodes.d.ts.map +1 -1
- package/resources/qrcodes.mjs.map +1 -1
- package/resources/tags.d.mts +19 -15
- package/resources/tags.d.mts.map +1 -1
- package/resources/tags.d.ts +19 -15
- package/resources/tags.d.ts.map +1 -1
- package/resources/tags.js +7 -7
- package/resources/tags.js.map +1 -1
- package/resources/tags.mjs +7 -7
- package/resources/tags.mjs.map +1 -1
- package/resources/track.d.mts +10 -9
- package/resources/track.d.mts.map +1 -1
- package/resources/track.d.ts +10 -9
- package/resources/track.d.ts.map +1 -1
- package/resources/track.mjs.map +1 -1
- package/resources.d.mts.map +1 -1
- package/resources.d.ts.map +1 -1
- package/resources.mjs.map +1 -1
- package/src/client.ts +53 -29
- package/src/internal/parse.ts +6 -0
- package/src/internal/types.ts +6 -8
- package/src/internal/utils/env.ts +2 -2
- package/src/internal/utils/log.ts +2 -0
- package/src/internal/utils/query.ts +7 -0
- package/src/internal/utils.ts +1 -0
- package/src/resources/analytics.ts +33 -3
- package/src/resources/domains.ts +38 -38
- package/src/resources/events.ts +90 -143
- package/src/resources/index.ts +4 -10
- package/src/resources/links/bulk.ts +30 -37
- package/src/resources/links/index.ts +2 -11
- package/src/resources/links/links.ts +227 -1538
- package/src/resources/projects.ts +0 -8
- package/src/resources/qrcodes/bulk.ts +151 -50
- package/src/resources/qrcodes/index.ts +2 -11
- package/src/resources/qrcodes/qrcodes.ts +405 -1083
- package/src/resources/tags.ts +23 -18
- package/src/resources/track.ts +10 -9
- package/src/version.ts +1 -1
- package/uploads.d.mts +1 -0
- package/uploads.d.mts.map +1 -1
- package/uploads.d.ts +1 -0
- package/uploads.d.ts.map +1 -1
- package/uploads.mjs +1 -0
- package/uploads.mjs.map +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
package/resources/track.d.mts
CHANGED
|
@@ -57,7 +57,7 @@ export interface TrackTrackSaleResponse {
|
|
|
57
57
|
export interface TrackTrackLeadParams {
|
|
58
58
|
/**
|
|
59
59
|
* The unique ID of the click that the lead conversion event is attributed to. You
|
|
60
|
-
* can read this value from `
|
|
60
|
+
* can read this value from `cq_id` cookie. If an empty string is provided, CodeQR
|
|
61
61
|
* will try to find an existing customer with the provided `customerExternalId` and
|
|
62
62
|
* use the `clickId` from the customer if found.
|
|
63
63
|
*/
|
|
@@ -99,16 +99,16 @@ export interface TrackTrackLeadParams {
|
|
|
99
99
|
} | null;
|
|
100
100
|
/**
|
|
101
101
|
* The mode to use for tracking the lead event. `async` will not block the request;
|
|
102
|
-
* `wait` will block the request until the lead event is fully recorded in
|
|
102
|
+
* `wait` will block the request until the lead event is fully recorded in CodeQR;
|
|
103
103
|
* `deferred` will defer the lead event creation to a subsequent request.
|
|
104
104
|
*/
|
|
105
105
|
mode?: 'async' | 'wait' | 'deferred';
|
|
106
106
|
}
|
|
107
107
|
export interface TrackTrackSaleParams {
|
|
108
108
|
/**
|
|
109
|
-
* The amount of the sale in
|
|
110
|
-
*
|
|
111
|
-
*
|
|
109
|
+
* The amount of the sale in the smallest unit of `currency` — cents for
|
|
110
|
+
* two-decimal currencies, the full integer for zero-decimal ones (e.g. `1437`
|
|
111
|
+
* JPY), thousandths for three-decimal ones (e.g. `1437` KWD fils).
|
|
112
112
|
*/
|
|
113
113
|
amount: number;
|
|
114
114
|
/**
|
|
@@ -118,13 +118,14 @@ export interface TrackTrackSaleParams {
|
|
|
118
118
|
customerExternalId: string;
|
|
119
119
|
/**
|
|
120
120
|
* [For direct sale tracking]: The unique ID of the click that the sale conversion
|
|
121
|
-
* event is attributed to. You can read this value from `
|
|
121
|
+
* event is attributed to. You can read this value from `cq_id` cookie.
|
|
122
122
|
*/
|
|
123
123
|
clickId?: string | null;
|
|
124
124
|
/**
|
|
125
|
-
* The currency of the sale
|
|
126
|
-
*
|
|
127
|
-
*
|
|
125
|
+
* The currency of the sale, as an ISO 4217 code. Reporting is always in USD:
|
|
126
|
+
* non-USD sales are converted at the exchange rate of the day the sale is
|
|
127
|
+
* recorded, and the original amount and currency are kept on the event. The rate
|
|
128
|
+
* is not re-applied later, so reported totals do not move with the exchange rate.
|
|
128
129
|
*/
|
|
129
130
|
currency?: string;
|
|
130
131
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"track.d.mts","sourceRoot":"","sources":["../src/resources/track.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"track.d.mts","sourceRoot":"","sources":["../src/resources/track.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAC/C,OAAO,EAAE,UAAU,EAAE,gCAA4B;AACjD,OAAO,EAAE,cAAc,EAAE,wCAAoC;AAE7D,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,sBAAsB,CAAC;IAInG;;;;;;;;;;OAUG;IACH,SAAS,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,sBAAsB,CAAC;CAGpG;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC;IAEpC,QAAQ,EAAE,sBAAsB,CAAC,QAAQ,CAAC;CAC3C;AAED,yBAAiB,sBAAsB,CAAC;IACtC,UAAiB,KAAK;QACpB,EAAE,EAAE,MAAM,CAAC;KACZ;IAED,UAAiB,QAAQ;QACvB,EAAE,EAAE,MAAM,CAAC;QAEX,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAEvB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAEtB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACtB;CACF;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IAEf,QAAQ,EAAE,MAAM,CAAC;IAEjB,UAAU,EAAE,MAAM,CAAC;IAEnB,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,MAAM,GAAG,IAAI,CAA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AAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B;;;OAGG;IACH,QAAQ,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAE7C;;OAEG;IACH,gBAAgB,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;CACnG;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EACL,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,oBAAoB,IAAI,oBAAoB,GAClD,CAAC;CACH"}
|
package/resources/track.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export interface TrackTrackSaleResponse {
|
|
|
57
57
|
export interface TrackTrackLeadParams {
|
|
58
58
|
/**
|
|
59
59
|
* The unique ID of the click that the lead conversion event is attributed to. You
|
|
60
|
-
* can read this value from `
|
|
60
|
+
* can read this value from `cq_id` cookie. If an empty string is provided, CodeQR
|
|
61
61
|
* will try to find an existing customer with the provided `customerExternalId` and
|
|
62
62
|
* use the `clickId` from the customer if found.
|
|
63
63
|
*/
|
|
@@ -99,16 +99,16 @@ export interface TrackTrackLeadParams {
|
|
|
99
99
|
} | null;
|
|
100
100
|
/**
|
|
101
101
|
* The mode to use for tracking the lead event. `async` will not block the request;
|
|
102
|
-
* `wait` will block the request until the lead event is fully recorded in
|
|
102
|
+
* `wait` will block the request until the lead event is fully recorded in CodeQR;
|
|
103
103
|
* `deferred` will defer the lead event creation to a subsequent request.
|
|
104
104
|
*/
|
|
105
105
|
mode?: 'async' | 'wait' | 'deferred';
|
|
106
106
|
}
|
|
107
107
|
export interface TrackTrackSaleParams {
|
|
108
108
|
/**
|
|
109
|
-
* The amount of the sale in
|
|
110
|
-
*
|
|
111
|
-
*
|
|
109
|
+
* The amount of the sale in the smallest unit of `currency` — cents for
|
|
110
|
+
* two-decimal currencies, the full integer for zero-decimal ones (e.g. `1437`
|
|
111
|
+
* JPY), thousandths for three-decimal ones (e.g. `1437` KWD fils).
|
|
112
112
|
*/
|
|
113
113
|
amount: number;
|
|
114
114
|
/**
|
|
@@ -118,13 +118,14 @@ export interface TrackTrackSaleParams {
|
|
|
118
118
|
customerExternalId: string;
|
|
119
119
|
/**
|
|
120
120
|
* [For direct sale tracking]: The unique ID of the click that the sale conversion
|
|
121
|
-
* event is attributed to. You can read this value from `
|
|
121
|
+
* event is attributed to. You can read this value from `cq_id` cookie.
|
|
122
122
|
*/
|
|
123
123
|
clickId?: string | null;
|
|
124
124
|
/**
|
|
125
|
-
* The currency of the sale
|
|
126
|
-
*
|
|
127
|
-
*
|
|
125
|
+
* The currency of the sale, as an ISO 4217 code. Reporting is always in USD:
|
|
126
|
+
* non-USD sales are converted at the exchange rate of the day the sale is
|
|
127
|
+
* recorded, and the original amount and currency are kept on the event. The rate
|
|
128
|
+
* is not re-applied later, so reported totals do not move with the exchange rate.
|
|
128
129
|
*/
|
|
129
130
|
currency?: string;
|
|
130
131
|
/**
|
package/resources/track.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"track.d.ts","sourceRoot":"","sources":["../src/resources/track.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"track.d.ts","sourceRoot":"","sources":["../src/resources/track.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,4BAAyB;AAC/C,OAAO,EAAE,UAAU,EAAE,+BAA4B;AACjD,OAAO,EAAE,cAAc,EAAE,uCAAoC;AAE7D,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAA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BAAsB,EACrD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,oBAAoB,IAAI,oBAAoB,GAClD,CAAC;CACH"}
|
package/resources/track.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"track.mjs","sourceRoot":"","sources":["../src/resources/track.ts"],"names":[],"mappings":"AAAA,sFAAsF;
|
|
1
|
+
{"version":3,"file":"track.mjs","sourceRoot":"","sources":["../src/resources/track.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAI/C,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,IAA0B,EAAE,OAAwB;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;IAED;;;;;;;;;;OAUG;IACH,SAAS,CAAC,IAA0B,EAAE,OAAwB;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;CACF"}
|
package/resources.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.mts","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"resources.d.mts","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":"AAAA,sCAAkC"}
|
package/resources.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":"AAAA,qCAAkC"}
|
package/resources.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.mjs","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"resources.mjs","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":"AAAA,sCAAkC"}
|
package/src/client.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type { APIResponseProps } from './internal/parse';
|
|
|
11
11
|
import { getPlatformHeaders } from './internal/detect-platform';
|
|
12
12
|
import * as Shims from './internal/shims';
|
|
13
13
|
import * as Opts from './internal/request-options';
|
|
14
|
-
import
|
|
14
|
+
import { stringifyQuery } from './internal/utils/query';
|
|
15
15
|
import { VERSION } from './version';
|
|
16
16
|
import * as Errors from './core/error';
|
|
17
17
|
import * as Uploads from './core/uploads';
|
|
@@ -53,28 +53,22 @@ import {
|
|
|
53
53
|
} from './resources/track';
|
|
54
54
|
import {
|
|
55
55
|
Link,
|
|
56
|
-
LinkCountParams,
|
|
57
|
-
LinkCountResponse,
|
|
58
56
|
LinkCreateParams,
|
|
59
57
|
LinkDeleteResponse,
|
|
60
58
|
LinkListParams,
|
|
61
59
|
LinkListResponse,
|
|
62
60
|
LinkRetrieveInfoParams,
|
|
63
61
|
LinkUpdateParams,
|
|
64
|
-
LinkUpsertParams,
|
|
65
62
|
Links,
|
|
66
63
|
} from './resources/links/links';
|
|
67
64
|
import {
|
|
68
65
|
QrCode,
|
|
69
|
-
QrcodeCountParams,
|
|
70
|
-
QrcodeCountResponse,
|
|
71
66
|
QrcodeCreateParams,
|
|
72
67
|
QrcodeDeleteResponse,
|
|
73
68
|
QrcodeListParams,
|
|
74
69
|
QrcodeListResponse,
|
|
75
70
|
QrcodeRetrieveParams,
|
|
76
71
|
QrcodeUpdateParams,
|
|
77
|
-
QrcodeUpsertParams,
|
|
78
72
|
Qrcodes,
|
|
79
73
|
} from './resources/qrcodes/qrcodes';
|
|
80
74
|
import { type Fetch } from './internal/builtin-types';
|
|
@@ -227,6 +221,18 @@ export class Codeqr {
|
|
|
227
221
|
this.fetch = options.fetch ?? Shims.getDefaultFetch();
|
|
228
222
|
this.#encoder = Opts.FallbackEncoder;
|
|
229
223
|
|
|
224
|
+
const customHeadersEnv = readEnv('CODEQR_CUSTOM_HEADERS');
|
|
225
|
+
if (customHeadersEnv) {
|
|
226
|
+
const parsed: Record<string, string> = {};
|
|
227
|
+
for (const line of customHeadersEnv.split('\n')) {
|
|
228
|
+
const colon = line.indexOf(':');
|
|
229
|
+
if (colon >= 0) {
|
|
230
|
+
parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
options.defaultHeaders = { ...parsed, ...options.defaultHeaders };
|
|
234
|
+
}
|
|
235
|
+
|
|
230
236
|
this._options = options;
|
|
231
237
|
|
|
232
238
|
this.apiKey = apiKey;
|
|
@@ -270,8 +276,8 @@ export class Codeqr {
|
|
|
270
276
|
return buildHeaders([{ Authorization: `Bearer ${this.apiKey}` }]);
|
|
271
277
|
}
|
|
272
278
|
|
|
273
|
-
protected stringifyQuery(query: Record<string, unknown>): string {
|
|
274
|
-
return
|
|
279
|
+
protected stringifyQuery(query: object | Record<string, unknown>): string {
|
|
280
|
+
return stringifyQuery(query);
|
|
275
281
|
}
|
|
276
282
|
|
|
277
283
|
private getUserAgent(): string {
|
|
@@ -303,12 +309,13 @@ export class Codeqr {
|
|
|
303
309
|
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
|
|
304
310
|
|
|
305
311
|
const defaultQuery = this.defaultQuery();
|
|
306
|
-
|
|
307
|
-
|
|
312
|
+
const pathQuery = Object.fromEntries(url.searchParams);
|
|
313
|
+
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
|
|
314
|
+
query = { ...pathQuery, ...defaultQuery, ...query };
|
|
308
315
|
}
|
|
309
316
|
|
|
310
317
|
if (typeof query === 'object' && query && !Array.isArray(query)) {
|
|
311
|
-
url.search = this.stringifyQuery(query
|
|
318
|
+
url.search = this.stringifyQuery(query);
|
|
312
319
|
}
|
|
313
320
|
|
|
314
321
|
return url.toString();
|
|
@@ -492,7 +499,7 @@ export class Codeqr {
|
|
|
492
499
|
loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
|
|
493
500
|
|
|
494
501
|
const errText = await response.text().catch((err: any) => castToError(err).message);
|
|
495
|
-
const errJSON = safeJSON(errText);
|
|
502
|
+
const errJSON = safeJSON(errText) as any;
|
|
496
503
|
const errMessage = errJSON ? undefined : errText;
|
|
497
504
|
|
|
498
505
|
loggerFor(this).debug(
|
|
@@ -533,9 +540,10 @@ export class Codeqr {
|
|
|
533
540
|
controller: AbortController,
|
|
534
541
|
): Promise<Response> {
|
|
535
542
|
const { signal, method, ...options } = init || {};
|
|
536
|
-
|
|
543
|
+
const abort = this._makeAbort(controller);
|
|
544
|
+
if (signal) signal.addEventListener('abort', abort, { once: true });
|
|
537
545
|
|
|
538
|
-
const timeout = setTimeout(
|
|
546
|
+
const timeout = setTimeout(abort, ms);
|
|
539
547
|
|
|
540
548
|
const isReadableBody =
|
|
541
549
|
((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) ||
|
|
@@ -612,9 +620,9 @@ export class Codeqr {
|
|
|
612
620
|
}
|
|
613
621
|
}
|
|
614
622
|
|
|
615
|
-
// If the API asks us to wait a certain amount of time
|
|
616
|
-
//
|
|
617
|
-
if (
|
|
623
|
+
// If the API asks us to wait a certain amount of time, just do what it
|
|
624
|
+
// says, but otherwise calculate a default
|
|
625
|
+
if (timeoutMillis === undefined) {
|
|
618
626
|
const maxRetries = options.maxRetries ?? this.maxRetries;
|
|
619
627
|
timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
|
|
620
628
|
}
|
|
@@ -702,11 +710,25 @@ export class Codeqr {
|
|
|
702
710
|
return headers.values;
|
|
703
711
|
}
|
|
704
712
|
|
|
705
|
-
private
|
|
713
|
+
private _makeAbort(controller: AbortController) {
|
|
714
|
+
// note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
|
|
715
|
+
// would capture all request options, and cause a memory leak.
|
|
716
|
+
return () => controller.abort();
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
private buildBody({ options }: { options: FinalRequestOptions }): {
|
|
706
720
|
bodyHeaders: HeadersLike;
|
|
707
721
|
body: BodyInit | undefined;
|
|
708
722
|
} {
|
|
723
|
+
const { body, headers: rawHeaders } = options;
|
|
709
724
|
if (!body) {
|
|
725
|
+
// A resource method always passes a `body` key when its operation defines a
|
|
726
|
+
// request body, even if the caller omitted an optional body param. Keep the
|
|
727
|
+
// content-type for those, and only elide it for operations with no body at
|
|
728
|
+
// all (e.g. GET/DELETE).
|
|
729
|
+
if (body == null && 'body' in options) {
|
|
730
|
+
return this.#encoder({ body, headers: buildHeaders([rawHeaders]) });
|
|
731
|
+
}
|
|
710
732
|
return { bodyHeaders: undefined, body: undefined };
|
|
711
733
|
}
|
|
712
734
|
const headers = buildHeaders([rawHeaders]);
|
|
@@ -734,6 +756,14 @@ export class Codeqr {
|
|
|
734
756
|
(Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))
|
|
735
757
|
) {
|
|
736
758
|
return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable<Uint8Array>) };
|
|
759
|
+
} else if (
|
|
760
|
+
typeof body === 'object' &&
|
|
761
|
+
headers.values.get('content-type') === 'application/x-www-form-urlencoded'
|
|
762
|
+
) {
|
|
763
|
+
return {
|
|
764
|
+
bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
|
|
765
|
+
body: this.stringifyQuery(body),
|
|
766
|
+
};
|
|
737
767
|
} else {
|
|
738
768
|
return this.#encoder({ body, headers });
|
|
739
769
|
}
|
|
@@ -785,13 +815,10 @@ export declare namespace Codeqr {
|
|
|
785
815
|
type Link as Link,
|
|
786
816
|
type LinkListResponse as LinkListResponse,
|
|
787
817
|
type LinkDeleteResponse as LinkDeleteResponse,
|
|
788
|
-
type LinkCountResponse as LinkCountResponse,
|
|
789
818
|
type LinkCreateParams as LinkCreateParams,
|
|
790
|
-
type LinkUpdateParams as LinkUpdateParams,
|
|
791
819
|
type LinkListParams as LinkListParams,
|
|
792
|
-
type LinkCountParams as LinkCountParams,
|
|
793
820
|
type LinkRetrieveInfoParams as LinkRetrieveInfoParams,
|
|
794
|
-
type
|
|
821
|
+
type LinkUpdateParams as LinkUpdateParams,
|
|
795
822
|
};
|
|
796
823
|
|
|
797
824
|
export {
|
|
@@ -799,13 +826,10 @@ export declare namespace Codeqr {
|
|
|
799
826
|
type QrCode as QrCode,
|
|
800
827
|
type QrcodeListResponse as QrcodeListResponse,
|
|
801
828
|
type QrcodeDeleteResponse as QrcodeDeleteResponse,
|
|
802
|
-
type QrcodeCountResponse as QrcodeCountResponse,
|
|
803
829
|
type QrcodeCreateParams as QrcodeCreateParams,
|
|
830
|
+
type QrcodeListParams as QrcodeListParams,
|
|
804
831
|
type QrcodeRetrieveParams as QrcodeRetrieveParams,
|
|
805
832
|
type QrcodeUpdateParams as QrcodeUpdateParams,
|
|
806
|
-
type QrcodeListParams as QrcodeListParams,
|
|
807
|
-
type QrcodeCountParams as QrcodeCountParams,
|
|
808
|
-
type QrcodeUpsertParams as QrcodeUpsertParams,
|
|
809
833
|
};
|
|
810
834
|
|
|
811
835
|
export {
|
|
@@ -828,8 +852,8 @@ export declare namespace Codeqr {
|
|
|
828
852
|
type TagListResponse as TagListResponse,
|
|
829
853
|
type TagDeleteResponse as TagDeleteResponse,
|
|
830
854
|
type TagCreateParams as TagCreateParams,
|
|
831
|
-
type TagUpdateParams as TagUpdateParams,
|
|
832
855
|
type TagListParams as TagListParams,
|
|
856
|
+
type TagUpdateParams as TagUpdateParams,
|
|
833
857
|
};
|
|
834
858
|
|
|
835
859
|
export {
|
|
@@ -838,8 +862,8 @@ export declare namespace Codeqr {
|
|
|
838
862
|
type DomainListResponse as DomainListResponse,
|
|
839
863
|
type DomainDeleteResponse as DomainDeleteResponse,
|
|
840
864
|
type DomainCreateParams as DomainCreateParams,
|
|
841
|
-
type DomainUpdateParams as DomainUpdateParams,
|
|
842
865
|
type DomainListParams as DomainListParams,
|
|
866
|
+
type DomainUpdateParams as DomainUpdateParams,
|
|
843
867
|
};
|
|
844
868
|
|
|
845
869
|
export {
|
package/src/internal/parse.ts
CHANGED
|
@@ -29,6 +29,12 @@ export async function defaultParseResponse<T>(client: Codeqr, props: APIResponse
|
|
|
29
29
|
const mediaType = contentType?.split(';')[0]?.trim();
|
|
30
30
|
const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
|
|
31
31
|
if (isJSON) {
|
|
32
|
+
const contentLength = response.headers.get('content-length');
|
|
33
|
+
if (contentLength === '0') {
|
|
34
|
+
// if there is no content we can't do anything
|
|
35
|
+
return undefined as T;
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
const json = await response.json();
|
|
33
39
|
return json as T;
|
|
34
40
|
}
|
package/src/internal/types.ts
CHANGED
|
@@ -40,7 +40,6 @@ type OverloadedParameters<T> =
|
|
|
40
40
|
: T extends (...args: infer A) => unknown ? A
|
|
41
41
|
: never;
|
|
42
42
|
|
|
43
|
-
/* eslint-disable */
|
|
44
43
|
/**
|
|
45
44
|
* These imports attempt to get types from a parent package's dependencies.
|
|
46
45
|
* Unresolved bare specifiers can trigger [automatic type acquisition][1] in some projects, which
|
|
@@ -63,19 +62,18 @@ type OverloadedParameters<T> =
|
|
|
63
62
|
*
|
|
64
63
|
* [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition
|
|
65
64
|
*/
|
|
66
|
-
/** @ts-ignore For users with \@types/node */
|
|
65
|
+
/** @ts-ignore For users with \@types/node */ /* prettier-ignore */
|
|
67
66
|
type UndiciTypesRequestInit = NotAny<import('../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit>;
|
|
68
|
-
/** @ts-ignore For users with undici */
|
|
67
|
+
/** @ts-ignore For users with undici */ /* prettier-ignore */
|
|
69
68
|
type UndiciRequestInit = NotAny<import('../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici/index.d.ts').RequestInit>;
|
|
70
|
-
/** @ts-ignore For users with \@types/bun */
|
|
69
|
+
/** @ts-ignore For users with \@types/bun */ /* prettier-ignore */
|
|
71
70
|
type BunRequestInit = globalThis.FetchRequestInit;
|
|
72
|
-
/** @ts-ignore For users with node-fetch@2 */
|
|
71
|
+
/** @ts-ignore For users with node-fetch@2 */ /* prettier-ignore */
|
|
73
72
|
type NodeFetch2RequestInit = NotAny<import('../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit>;
|
|
74
|
-
/** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */
|
|
73
|
+
/** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */ /* prettier-ignore */
|
|
75
74
|
type NodeFetch3RequestInit = NotAny<import('../node_modules/node-fetch').RequestInit> | NotAny<import('../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/node-fetch').RequestInit>;
|
|
76
|
-
/** @ts-ignore For users who use Deno */
|
|
75
|
+
/** @ts-ignore For users who use Deno */ /* prettier-ignore */
|
|
77
76
|
type FetchRequestInit = NonNullable<OverloadedParameters<typeof fetch>[1]>;
|
|
78
|
-
/* eslint-enable */
|
|
79
77
|
|
|
80
78
|
type RequestInits =
|
|
81
79
|
| NotAny<UndiciTypesRequestInit>
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export const readEnv = (env: string): string | undefined => {
|
|
11
11
|
if (typeof (globalThis as any).process !== 'undefined') {
|
|
12
|
-
return (globalThis as any).process.env?.[env]?.trim()
|
|
12
|
+
return (globalThis as any).process.env?.[env]?.trim() || undefined;
|
|
13
13
|
}
|
|
14
14
|
if (typeof (globalThis as any).Deno !== 'undefined') {
|
|
15
|
-
return (globalThis as any).Deno.env?.get?.(env)?.trim();
|
|
15
|
+
return (globalThis as any).Deno.env?.get?.(env)?.trim() || undefined;
|
|
16
16
|
}
|
|
17
17
|
return undefined;
|
|
18
18
|
};
|
|
@@ -107,6 +107,8 @@ export const formatRequestDetails = (details: {
|
|
|
107
107
|
name,
|
|
108
108
|
(
|
|
109
109
|
name.toLowerCase() === 'authorization' ||
|
|
110
|
+
name.toLowerCase() === 'api-key' ||
|
|
111
|
+
name.toLowerCase() === 'x-api-key' ||
|
|
110
112
|
name.toLowerCase() === 'cookie' ||
|
|
111
113
|
name.toLowerCase() === 'set-cookie'
|
|
112
114
|
) ?
|
package/src/internal/utils.ts
CHANGED
|
@@ -322,7 +322,7 @@ export namespace AnalyticsRetrieveResponse {
|
|
|
322
322
|
/**
|
|
323
323
|
* The total number of views
|
|
324
324
|
*/
|
|
325
|
-
|
|
325
|
+
views: number;
|
|
326
326
|
}
|
|
327
327
|
|
|
328
328
|
export interface AnalyticsTimesery {
|
|
@@ -679,7 +679,7 @@ export namespace AnalyticsRetrieveResponse {
|
|
|
679
679
|
clicks: number;
|
|
680
680
|
|
|
681
681
|
/**
|
|
682
|
-
* The 2-letter country code of the region
|
|
682
|
+
* The 2-letter ISO 3166-1 alpha-2 country code of the region.
|
|
683
683
|
*/
|
|
684
684
|
country:
|
|
685
685
|
| 'AF'
|
|
@@ -1532,7 +1532,12 @@ export interface AnalyticsRetrieveParams {
|
|
|
1532
1532
|
| 'cities'
|
|
1533
1533
|
| 'leads'
|
|
1534
1534
|
| 'sales'
|
|
1535
|
-
| 'composite'
|
|
1535
|
+
| 'composite'
|
|
1536
|
+
| 'utm_sources'
|
|
1537
|
+
| 'utm_mediums'
|
|
1538
|
+
| 'utm_campaigns'
|
|
1539
|
+
| 'utm_contents'
|
|
1540
|
+
| 'utm_terms';
|
|
1536
1541
|
|
|
1537
1542
|
/**
|
|
1538
1543
|
* The interval to retrieve analytics for. Takes precedence over start and end.
|
|
@@ -1605,6 +1610,31 @@ export interface AnalyticsRetrieveParams {
|
|
|
1605
1610
|
* The URL to retrieve analytics for.
|
|
1606
1611
|
*/
|
|
1607
1612
|
url?: string;
|
|
1613
|
+
|
|
1614
|
+
/**
|
|
1615
|
+
* UTM campaign to filter analytics by.
|
|
1616
|
+
*/
|
|
1617
|
+
utm_campaign?: string;
|
|
1618
|
+
|
|
1619
|
+
/**
|
|
1620
|
+
* UTM content to filter analytics by.
|
|
1621
|
+
*/
|
|
1622
|
+
utm_content?: string;
|
|
1623
|
+
|
|
1624
|
+
/**
|
|
1625
|
+
* UTM medium to filter analytics by.
|
|
1626
|
+
*/
|
|
1627
|
+
utm_medium?: string;
|
|
1628
|
+
|
|
1629
|
+
/**
|
|
1630
|
+
* UTM source to filter analytics by.
|
|
1631
|
+
*/
|
|
1632
|
+
utm_source?: string;
|
|
1633
|
+
|
|
1634
|
+
/**
|
|
1635
|
+
* UTM term to filter analytics by.
|
|
1636
|
+
*/
|
|
1637
|
+
utm_term?: string;
|
|
1608
1638
|
}
|
|
1609
1639
|
|
|
1610
1640
|
export declare namespace Analytics {
|
package/src/resources/domains.ts
CHANGED
|
@@ -21,34 +21,34 @@ export class Domains extends APIResource {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Retrieve a list of domains associated with the authenticated workspace.
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
27
27
|
* ```ts
|
|
28
|
-
* const
|
|
28
|
+
* const domains = await client.domains.list();
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
body: DomainUpdateParams | null | undefined = {},
|
|
31
|
+
list(
|
|
32
|
+
query: DomainListParams | null | undefined = {},
|
|
34
33
|
options?: RequestOptions,
|
|
35
|
-
): APIPromise<
|
|
36
|
-
return this._client.
|
|
34
|
+
): APIPromise<DomainListResponse> {
|
|
35
|
+
return this._client.get('/domains', { query, ...options });
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
/**
|
|
40
|
-
*
|
|
39
|
+
* Update a domain for the authenticated workspace.
|
|
41
40
|
*
|
|
42
41
|
* @example
|
|
43
42
|
* ```ts
|
|
44
|
-
* const
|
|
43
|
+
* const domain = await client.domains.update('acme.com');
|
|
45
44
|
* ```
|
|
46
45
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
update(
|
|
47
|
+
slug: string,
|
|
48
|
+
body: DomainUpdateParams | null | undefined = {},
|
|
49
49
|
options?: RequestOptions,
|
|
50
|
-
): APIPromise<
|
|
51
|
-
return this._client.
|
|
50
|
+
): APIPromise<Domain> {
|
|
51
|
+
return this._client.patch(path`/domains/${slug}`, { body, ...options });
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/**
|
|
@@ -166,6 +166,29 @@ export interface DomainCreateParams {
|
|
|
166
166
|
type?: 'redirect' | 'rewrite';
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
export interface DomainListParams {
|
|
170
|
+
/**
|
|
171
|
+
* Whether to include archived domains in the response. Defaults to `false` if not
|
|
172
|
+
* provided.
|
|
173
|
+
*/
|
|
174
|
+
archived?: boolean;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* The page number for pagination.
|
|
178
|
+
*/
|
|
179
|
+
page?: number;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* The number of items per page.
|
|
183
|
+
*/
|
|
184
|
+
pageSize?: number;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* The search term to filter the domains by.
|
|
188
|
+
*/
|
|
189
|
+
search?: string;
|
|
190
|
+
}
|
|
191
|
+
|
|
169
192
|
export interface DomainUpdateParams {
|
|
170
193
|
/**
|
|
171
194
|
* Whether to archive this domain. `false` will unarchive a previously archived
|
|
@@ -187,7 +210,7 @@ export interface DomainUpdateParams {
|
|
|
187
210
|
/**
|
|
188
211
|
* Name of the domain.
|
|
189
212
|
*/
|
|
190
|
-
|
|
213
|
+
slug?: string;
|
|
191
214
|
|
|
192
215
|
/**
|
|
193
216
|
* The target URL to redirect to when accessing the domain root.
|
|
@@ -200,36 +223,13 @@ export interface DomainUpdateParams {
|
|
|
200
223
|
type?: 'redirect' | 'rewrite';
|
|
201
224
|
}
|
|
202
225
|
|
|
203
|
-
export interface DomainListParams {
|
|
204
|
-
/**
|
|
205
|
-
* Whether to include archived domains in the response. Defaults to `false` if not
|
|
206
|
-
* provided.
|
|
207
|
-
*/
|
|
208
|
-
archived?: boolean;
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* The page number for pagination.
|
|
212
|
-
*/
|
|
213
|
-
page?: number;
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* The number of items per page.
|
|
217
|
-
*/
|
|
218
|
-
pageSize?: number;
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* The search term to filter the domains by.
|
|
222
|
-
*/
|
|
223
|
-
search?: string;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
226
|
export declare namespace Domains {
|
|
227
227
|
export {
|
|
228
228
|
type Domain as Domain,
|
|
229
229
|
type DomainListResponse as DomainListResponse,
|
|
230
230
|
type DomainDeleteResponse as DomainDeleteResponse,
|
|
231
231
|
type DomainCreateParams as DomainCreateParams,
|
|
232
|
-
type DomainUpdateParams as DomainUpdateParams,
|
|
233
232
|
type DomainListParams as DomainListParams,
|
|
233
|
+
type DomainUpdateParams as DomainUpdateParams,
|
|
234
234
|
};
|
|
235
235
|
}
|