@codeqr/ts 0.19.3 → 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.
Files changed (202) hide show
  1. package/CHANGELOG.md +278 -0
  2. package/api-promise.d.mts +1 -0
  3. package/api-promise.d.mts.map +1 -1
  4. package/api-promise.d.ts +1 -0
  5. package/api-promise.d.ts.map +1 -1
  6. package/api-promise.mjs +1 -0
  7. package/api-promise.mjs.map +1 -1
  8. package/client.d.mts +4 -4
  9. package/client.d.mts.map +1 -1
  10. package/client.d.ts +4 -4
  11. package/client.d.ts.map +1 -1
  12. package/client.js +20 -1
  13. package/client.js.map +1 -1
  14. package/client.mjs +20 -1
  15. package/client.mjs.map +1 -1
  16. package/core/api-promise.d.mts.map +1 -1
  17. package/core/api-promise.d.ts.map +1 -1
  18. package/core/api-promise.mjs.map +1 -1
  19. package/core/error.mjs.map +1 -1
  20. package/core/resource.d.mts.map +1 -1
  21. package/core/resource.d.ts.map +1 -1
  22. package/core/uploads.d.mts.map +1 -1
  23. package/core/uploads.d.ts.map +1 -1
  24. package/core/uploads.mjs.map +1 -1
  25. package/error.d.mts +1 -0
  26. package/error.d.mts.map +1 -1
  27. package/error.d.ts +1 -0
  28. package/error.d.ts.map +1 -1
  29. package/error.mjs +1 -0
  30. package/error.mjs.map +1 -1
  31. package/index.d.mts.map +1 -1
  32. package/index.d.ts.map +1 -1
  33. package/index.mjs.map +1 -1
  34. package/internal/detect-platform.mjs.map +1 -1
  35. package/internal/headers.mjs.map +1 -1
  36. package/internal/parse.d.mts.map +1 -1
  37. package/internal/parse.d.ts.map +1 -1
  38. package/internal/parse.mjs.map +1 -1
  39. package/internal/qs/formats.d.mts.map +1 -1
  40. package/internal/qs/formats.d.ts.map +1 -1
  41. package/internal/qs/index.d.mts +2 -2
  42. package/internal/qs/index.d.mts.map +1 -1
  43. package/internal/qs/index.d.ts +2 -2
  44. package/internal/qs/index.d.ts.map +1 -1
  45. package/internal/qs/index.mjs.map +1 -1
  46. package/internal/qs/stringify.d.mts.map +1 -1
  47. package/internal/qs/stringify.d.ts.map +1 -1
  48. package/internal/qs/stringify.mjs.map +1 -1
  49. package/internal/qs/utils.d.mts.map +1 -1
  50. package/internal/qs/utils.d.ts.map +1 -1
  51. package/internal/qs/utils.mjs.map +1 -1
  52. package/internal/request-options.d.mts.map +1 -1
  53. package/internal/request-options.d.ts.map +1 -1
  54. package/internal/shims.d.mts +6 -0
  55. package/internal/shims.d.mts.map +1 -1
  56. package/internal/shims.d.ts +6 -0
  57. package/internal/shims.d.ts.map +1 -1
  58. package/internal/to-file.d.mts.map +1 -1
  59. package/internal/to-file.d.ts.map +1 -1
  60. package/internal/to-file.mjs.map +1 -1
  61. package/internal/types.d.mts +10 -10
  62. package/internal/types.d.mts.map +1 -1
  63. package/internal/types.d.ts +10 -10
  64. package/internal/types.d.ts.map +1 -1
  65. package/internal/uploads.d.mts.map +1 -1
  66. package/internal/uploads.d.ts.map +1 -1
  67. package/internal/uploads.mjs.map +1 -1
  68. package/internal/utils/base64.mjs.map +1 -1
  69. package/internal/utils/env.js +2 -2
  70. package/internal/utils/env.js.map +1 -1
  71. package/internal/utils/env.mjs +2 -2
  72. package/internal/utils/env.mjs.map +1 -1
  73. package/internal/utils/log.d.mts.map +1 -1
  74. package/internal/utils/log.d.ts.map +1 -1
  75. package/internal/utils/log.js +2 -0
  76. package/internal/utils/log.js.map +1 -1
  77. package/internal/utils/log.mjs +2 -0
  78. package/internal/utils/log.mjs.map +1 -1
  79. package/internal/utils/path.mjs.map +1 -1
  80. package/internal/utils/query.mjs.map +1 -1
  81. package/internal/utils/values.mjs.map +1 -1
  82. package/internal/utils.d.mts.map +1 -1
  83. package/internal/utils.d.ts.map +1 -1
  84. package/internal/utils.mjs.map +1 -1
  85. package/package.json +1 -1
  86. package/resource.d.mts +1 -0
  87. package/resource.d.mts.map +1 -1
  88. package/resource.d.ts +1 -0
  89. package/resource.d.ts.map +1 -1
  90. package/resource.mjs +1 -0
  91. package/resource.mjs.map +1 -1
  92. package/resources/analytics.d.mts +22 -2
  93. package/resources/analytics.d.mts.map +1 -1
  94. package/resources/analytics.d.ts +22 -2
  95. package/resources/analytics.d.ts.map +1 -1
  96. package/resources/analytics.mjs.map +1 -1
  97. package/resources/domains.d.mts +26 -26
  98. package/resources/domains.d.mts.map +1 -1
  99. package/resources/domains.d.ts +26 -26
  100. package/resources/domains.d.ts.map +1 -1
  101. package/resources/domains.js +8 -8
  102. package/resources/domains.js.map +1 -1
  103. package/resources/domains.mjs +8 -8
  104. package/resources/domains.mjs.map +1 -1
  105. package/resources/events.d.mts +49 -3
  106. package/resources/events.d.mts.map +1 -1
  107. package/resources/events.d.ts +49 -3
  108. package/resources/events.d.ts.map +1 -1
  109. package/resources/events.mjs.map +1 -1
  110. package/resources/index.d.mts +4 -4
  111. package/resources/index.d.mts.map +1 -1
  112. package/resources/index.d.ts +4 -4
  113. package/resources/index.d.ts.map +1 -1
  114. package/resources/index.mjs.map +1 -1
  115. package/resources/links/bulk.d.mts +10 -0
  116. package/resources/links/bulk.d.mts.map +1 -1
  117. package/resources/links/bulk.d.ts +10 -0
  118. package/resources/links/bulk.d.ts.map +1 -1
  119. package/resources/links/bulk.mjs.map +1 -1
  120. package/resources/links/index.d.mts +1 -1
  121. package/resources/links/index.d.mts.map +1 -1
  122. package/resources/links/index.d.ts +1 -1
  123. package/resources/links/index.d.ts.map +1 -1
  124. package/resources/links/index.mjs.map +1 -1
  125. package/resources/links/links.d.mts +257 -201
  126. package/resources/links/links.d.mts.map +1 -1
  127. package/resources/links/links.d.ts +257 -201
  128. package/resources/links/links.d.ts.map +1 -1
  129. package/resources/links/links.js +21 -21
  130. package/resources/links/links.js.map +1 -1
  131. package/resources/links/links.mjs +21 -21
  132. package/resources/links/links.mjs.map +1 -1
  133. package/resources/links.d.mts.map +1 -1
  134. package/resources/links.d.ts.map +1 -1
  135. package/resources/links.mjs.map +1 -1
  136. package/resources/projects.d.mts.map +1 -1
  137. package/resources/projects.d.ts.map +1 -1
  138. package/resources/projects.mjs.map +1 -1
  139. package/resources/qrcodes/bulk.d.mts +83 -7
  140. package/resources/qrcodes/bulk.d.mts.map +1 -1
  141. package/resources/qrcodes/bulk.d.ts +83 -7
  142. package/resources/qrcodes/bulk.d.ts.map +1 -1
  143. package/resources/qrcodes/bulk.mjs.map +1 -1
  144. package/resources/qrcodes/index.d.mts +1 -1
  145. package/resources/qrcodes/index.d.mts.map +1 -1
  146. package/resources/qrcodes/index.d.ts +1 -1
  147. package/resources/qrcodes/index.d.ts.map +1 -1
  148. package/resources/qrcodes/index.mjs.map +1 -1
  149. package/resources/qrcodes/qrcodes.d.mts +385 -169
  150. package/resources/qrcodes/qrcodes.d.mts.map +1 -1
  151. package/resources/qrcodes/qrcodes.d.ts +385 -169
  152. package/resources/qrcodes/qrcodes.d.ts.map +1 -1
  153. package/resources/qrcodes/qrcodes.js +11 -11
  154. package/resources/qrcodes/qrcodes.js.map +1 -1
  155. package/resources/qrcodes/qrcodes.mjs +11 -11
  156. package/resources/qrcodes/qrcodes.mjs.map +1 -1
  157. package/resources/qrcodes.d.mts.map +1 -1
  158. package/resources/qrcodes.d.ts.map +1 -1
  159. package/resources/qrcodes.mjs.map +1 -1
  160. package/resources/tags.d.mts +12 -12
  161. package/resources/tags.d.mts.map +1 -1
  162. package/resources/tags.d.ts +12 -12
  163. package/resources/tags.d.ts.map +1 -1
  164. package/resources/tags.js +6 -6
  165. package/resources/tags.js.map +1 -1
  166. package/resources/tags.mjs +6 -6
  167. package/resources/tags.mjs.map +1 -1
  168. package/resources/track.d.mts +8 -7
  169. package/resources/track.d.mts.map +1 -1
  170. package/resources/track.d.ts +8 -7
  171. package/resources/track.d.ts.map +1 -1
  172. package/resources/track.mjs.map +1 -1
  173. package/resources.d.mts.map +1 -1
  174. package/resources.d.ts.map +1 -1
  175. package/resources.mjs.map +1 -1
  176. package/src/client.ts +25 -5
  177. package/src/internal/types.ts +6 -8
  178. package/src/internal/utils/env.ts +2 -2
  179. package/src/internal/utils/log.ts +2 -0
  180. package/src/resources/analytics.ts +32 -2
  181. package/src/resources/domains.ts +37 -37
  182. package/src/resources/events.ts +80 -3
  183. package/src/resources/index.ts +4 -4
  184. package/src/resources/links/bulk.ts +22 -0
  185. package/src/resources/links/index.ts +1 -1
  186. package/src/resources/links/links.ts +289 -212
  187. package/src/resources/qrcodes/bulk.ts +118 -7
  188. package/src/resources/qrcodes/index.ts +1 -1
  189. package/src/resources/qrcodes/qrcodes.ts +603 -309
  190. package/src/resources/tags.ts +16 -16
  191. package/src/resources/track.ts +8 -7
  192. package/src/version.ts +1 -1
  193. package/uploads.d.mts +1 -0
  194. package/uploads.d.mts.map +1 -1
  195. package/uploads.d.ts +1 -0
  196. package/uploads.d.ts.map +1 -1
  197. package/uploads.mjs +1 -0
  198. package/uploads.mjs.map +1 -1
  199. package/version.d.mts +1 -1
  200. package/version.d.ts +1 -1
  201. package/version.js +1 -1
  202. package/version.mjs +1 -1
package/src/client.ts CHANGED
@@ -221,6 +221,18 @@ export class Codeqr {
221
221
  this.fetch = options.fetch ?? Shims.getDefaultFetch();
222
222
  this.#encoder = Opts.FallbackEncoder;
223
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
+
224
236
  this._options = options;
225
237
 
226
238
  this.apiKey = apiKey;
@@ -704,11 +716,19 @@ export class Codeqr {
704
716
  return () => controller.abort();
705
717
  }
706
718
 
707
- private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): {
719
+ private buildBody({ options }: { options: FinalRequestOptions }): {
708
720
  bodyHeaders: HeadersLike;
709
721
  body: BodyInit | undefined;
710
722
  } {
723
+ const { body, headers: rawHeaders } = options;
711
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
+ }
712
732
  return { bodyHeaders: undefined, body: undefined };
713
733
  }
714
734
  const headers = buildHeaders([rawHeaders]);
@@ -796,9 +816,9 @@ export declare namespace Codeqr {
796
816
  type LinkListResponse as LinkListResponse,
797
817
  type LinkDeleteResponse as LinkDeleteResponse,
798
818
  type LinkCreateParams as LinkCreateParams,
799
- type LinkUpdateParams as LinkUpdateParams,
800
819
  type LinkListParams as LinkListParams,
801
820
  type LinkRetrieveInfoParams as LinkRetrieveInfoParams,
821
+ type LinkUpdateParams as LinkUpdateParams,
802
822
  };
803
823
 
804
824
  export {
@@ -807,9 +827,9 @@ export declare namespace Codeqr {
807
827
  type QrcodeListResponse as QrcodeListResponse,
808
828
  type QrcodeDeleteResponse as QrcodeDeleteResponse,
809
829
  type QrcodeCreateParams as QrcodeCreateParams,
830
+ type QrcodeListParams as QrcodeListParams,
810
831
  type QrcodeRetrieveParams as QrcodeRetrieveParams,
811
832
  type QrcodeUpdateParams as QrcodeUpdateParams,
812
- type QrcodeListParams as QrcodeListParams,
813
833
  };
814
834
 
815
835
  export {
@@ -832,8 +852,8 @@ export declare namespace Codeqr {
832
852
  type TagListResponse as TagListResponse,
833
853
  type TagDeleteResponse as TagDeleteResponse,
834
854
  type TagCreateParams as TagCreateParams,
835
- type TagUpdateParams as TagUpdateParams,
836
855
  type TagListParams as TagListParams,
856
+ type TagUpdateParams as TagUpdateParams,
837
857
  };
838
858
 
839
859
  export {
@@ -842,8 +862,8 @@ export declare namespace Codeqr {
842
862
  type DomainListResponse as DomainListResponse,
843
863
  type DomainDeleteResponse as DomainDeleteResponse,
844
864
  type DomainCreateParams as DomainCreateParams,
845
- type DomainUpdateParams as DomainUpdateParams,
846
865
  type DomainListParams as DomainListParams,
866
+ type DomainUpdateParams as DomainUpdateParams,
847
867
  };
848
868
 
849
869
  export {
@@ -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() ?? undefined;
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
  ) ?
@@ -679,7 +679,7 @@ export namespace AnalyticsRetrieveResponse {
679
679
  clicks: number;
680
680
 
681
681
  /**
682
- * The 2-letter country code of the region: https://d.to/geo
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 {
@@ -21,34 +21,34 @@ export class Domains extends APIResource {
21
21
  }
22
22
 
23
23
  /**
24
- * Update a domain for the authenticated workspace.
24
+ * Retrieve a list of domains associated with the authenticated workspace.
25
25
  *
26
26
  * @example
27
27
  * ```ts
28
- * const domain = await client.domains.update('acme.com');
28
+ * const domains = await client.domains.list();
29
29
  * ```
30
30
  */
31
- update(
32
- slug: string,
33
- body: DomainUpdateParams | null | undefined = {},
31
+ list(
32
+ query: DomainListParams | null | undefined = {},
34
33
  options?: RequestOptions,
35
- ): APIPromise<Domain> {
36
- return this._client.patch(path`/domains/${slug}`, { body, ...options });
34
+ ): APIPromise<DomainListResponse> {
35
+ return this._client.get('/domains', { query, ...options });
37
36
  }
38
37
 
39
38
  /**
40
- * Retrieve a list of domains associated with the authenticated workspace.
39
+ * Update a domain for the authenticated workspace.
41
40
  *
42
41
  * @example
43
42
  * ```ts
44
- * const domains = await client.domains.list();
43
+ * const domain = await client.domains.update('acme.com');
45
44
  * ```
46
45
  */
47
- list(
48
- query: DomainListParams | null | undefined = {},
46
+ update(
47
+ slug: string,
48
+ body: DomainUpdateParams | null | undefined = {},
49
49
  options?: RequestOptions,
50
- ): APIPromise<DomainListResponse> {
51
- return this._client.get('/domains', { query, ...options });
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
@@ -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
  }
@@ -218,6 +218,11 @@ export namespace EventListResponse {
218
218
 
219
219
  updatedAt: string;
220
220
 
221
+ /**
222
+ * Whether this link should be used as a reusable template.
223
+ */
224
+ useAsTemplate: boolean;
225
+
221
226
  utm_campaign: string | null;
222
227
 
223
228
  utm_content: string | null;
@@ -262,6 +267,8 @@ export namespace EventListResponse {
262
267
 
263
268
  rewrite?: boolean;
264
269
 
270
+ rules?: Array<Link.Rule> | null;
271
+
265
272
  /**
266
273
  * The complete URL of the short link, including the https protocol (for example,
267
274
  * `https://codeqr.link/try`).
@@ -274,6 +281,25 @@ export namespace EventListResponse {
274
281
 
275
282
  userId?: string | null;
276
283
  }
284
+
285
+ export namespace Link {
286
+ export interface Rule {
287
+ attribute:
288
+ | 'device'
289
+ | 'country'
290
+ | 'utm_source'
291
+ | 'utm_medium'
292
+ | 'utm_campaign'
293
+ | 'referrer'
294
+ | 'language';
295
+
296
+ operator: 'equals' | 'not_equals';
297
+
298
+ url: string;
299
+
300
+ value: string;
301
+ }
302
+ }
277
303
  }
278
304
 
279
305
  export interface LeadEvent {
@@ -688,6 +714,11 @@ export namespace EventListResponse {
688
714
 
689
715
  updatedAt: string;
690
716
 
717
+ /**
718
+ * Whether this link should be used as a reusable template.
719
+ */
720
+ useAsTemplate: boolean;
721
+
691
722
  utm_campaign: string | null;
692
723
 
693
724
  utm_content: string | null;
@@ -732,6 +763,8 @@ export namespace EventListResponse {
732
763
 
733
764
  rewrite?: boolean;
734
765
 
766
+ rules?: Array<Link.Rule> | null;
767
+
735
768
  /**
736
769
  * The complete URL of the short link, including the https protocol (for example,
737
770
  * `https://codeqr.link/try`).
@@ -745,11 +778,30 @@ export namespace EventListResponse {
745
778
  userId?: string | null;
746
779
  }
747
780
 
781
+ export namespace Link {
782
+ export interface Rule {
783
+ attribute:
784
+ | 'device'
785
+ | 'country'
786
+ | 'utm_source'
787
+ | 'utm_medium'
788
+ | 'utm_campaign'
789
+ | 'referrer'
790
+ | 'language';
791
+
792
+ operator: 'equals' | 'not_equals';
793
+
794
+ url: string;
795
+
796
+ value: string;
797
+ }
798
+ }
799
+
748
800
  export interface Sale {
749
801
  /**
750
- * The amount of the sale in cents (for all two-decimal currencies). If the sale is
751
- * in a zero-decimal currency, pass the full integer value (e.g. `1437` JPY). Learn
752
- * more: https://d.to/currency
802
+ * The amount of the sale in the smallest unit of `currency` — cents for
803
+ * two-decimal currencies, the full integer for zero-decimal ones (e.g. `1437`
804
+ * JPY), thousandths for three-decimal ones (e.g. `1437` KWD fils).
753
805
  */
754
806
  amount: number;
755
807
 
@@ -900,6 +952,31 @@ export interface EventListParams {
900
952
  * The URL to retrieve analytics for.
901
953
  */
902
954
  url?: string;
955
+
956
+ /**
957
+ * UTM campaign to filter analytics by.
958
+ */
959
+ utm_campaign?: string;
960
+
961
+ /**
962
+ * UTM content to filter analytics by.
963
+ */
964
+ utm_content?: string;
965
+
966
+ /**
967
+ * UTM medium to filter analytics by.
968
+ */
969
+ utm_medium?: string;
970
+
971
+ /**
972
+ * UTM source to filter analytics by.
973
+ */
974
+ utm_source?: string;
975
+
976
+ /**
977
+ * UTM term to filter analytics by.
978
+ */
979
+ utm_term?: string;
903
980
  }
904
981
 
905
982
  export declare namespace Events {
@@ -13,8 +13,8 @@ export {
13
13
  type DomainListResponse,
14
14
  type DomainDeleteResponse,
15
15
  type DomainCreateParams,
16
- type DomainUpdateParams,
17
16
  type DomainListParams,
17
+ type DomainUpdateParams,
18
18
  } from './domains';
19
19
  export { Events, type EventListResponse, type EventListParams } from './events';
20
20
  export {
@@ -23,9 +23,9 @@ export {
23
23
  type LinkListResponse,
24
24
  type LinkDeleteResponse,
25
25
  type LinkCreateParams,
26
- type LinkUpdateParams,
27
26
  type LinkListParams,
28
27
  type LinkRetrieveInfoParams,
28
+ type LinkUpdateParams,
29
29
  } from './links/links';
30
30
  export { Projects, type Project, type ProjectListResponse } from './projects';
31
31
  export {
@@ -34,9 +34,9 @@ export {
34
34
  type QrcodeListResponse,
35
35
  type QrcodeDeleteResponse,
36
36
  type QrcodeCreateParams,
37
+ type QrcodeListParams,
37
38
  type QrcodeRetrieveParams,
38
39
  type QrcodeUpdateParams,
39
- type QrcodeListParams,
40
40
  } from './qrcodes/qrcodes';
41
41
  export {
42
42
  Tags,
@@ -44,8 +44,8 @@ export {
44
44
  type TagListResponse,
45
45
  type TagDeleteResponse,
46
46
  type TagCreateParams,
47
- type TagUpdateParams,
48
47
  type TagListParams,
48
+ type TagUpdateParams,
49
49
  } from './tags';
50
50
  export {
51
51
  Track,
@@ -198,6 +198,11 @@ export namespace BulkCreateParams {
198
198
  */
199
199
  rewrite?: boolean;
200
200
 
201
+ /**
202
+ * Smart rules for conditional destination routing by request attribute.
203
+ */
204
+ rules?: Array<Body.Rule> | null;
205
+
201
206
  /**
202
207
  * @deprecated The unique ID of the tag assigned to the short link. This field is
203
208
  * deprecated – use `tagIds` instead.
@@ -748,6 +753,23 @@ export namespace BulkCreateParams {
748
753
 
749
754
  ZW?: string;
750
755
  }
756
+
757
+ export interface Rule {
758
+ attribute:
759
+ | 'device'
760
+ | 'country'
761
+ | 'utm_source'
762
+ | 'utm_medium'
763
+ | 'utm_campaign'
764
+ | 'referrer'
765
+ | 'language';
766
+
767
+ operator: 'equals' | 'not_equals';
768
+
769
+ url: string;
770
+
771
+ value: string;
772
+ }
751
773
  }
752
774
  }
753
775
 
@@ -7,7 +7,7 @@ export {
7
7
  type LinkListResponse,
8
8
  type LinkDeleteResponse,
9
9
  type LinkCreateParams,
10
- type LinkUpdateParams,
11
10
  type LinkListParams,
12
11
  type LinkRetrieveInfoParams,
12
+ type LinkUpdateParams,
13
13
  } from './links';