@codeqr/ts 0.24.0 → 0.25.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 (129) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/LICENSE +1 -1
  3. package/README.md +28 -28
  4. package/client.d.mts +10 -10
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +10 -10
  7. package/client.d.ts.map +1 -1
  8. package/client.js +38 -38
  9. package/client.mjs +36 -36
  10. package/core/api-promise.d.mts +2 -2
  11. package/core/api-promise.d.ts +2 -2
  12. package/core/error.d.mts +2 -2
  13. package/core/error.d.ts +2 -2
  14. package/core/error.js +4 -4
  15. package/core/error.mjs +2 -2
  16. package/core/resource.d.mts +3 -3
  17. package/core/resource.d.ts +3 -3
  18. package/index.d.mts +3 -3
  19. package/index.d.ts +3 -3
  20. package/index.js +4 -4
  21. package/index.mjs +3 -3
  22. package/internal/parse.d.mts +2 -2
  23. package/internal/parse.d.ts +2 -2
  24. package/internal/shims.js +1 -1
  25. package/internal/shims.mjs +1 -1
  26. package/internal/uploads.d.mts +4 -4
  27. package/internal/uploads.d.ts +4 -4
  28. package/internal/utils/base64.js +2 -2
  29. package/internal/utils/base64.mjs +3 -3
  30. package/internal/utils/log.d.mts +3 -3
  31. package/internal/utils/log.d.ts +3 -3
  32. package/internal/utils/path.js +1 -1
  33. package/internal/utils/path.mjs +2 -2
  34. package/internal/utils/values.js +5 -5
  35. package/internal/utils/values.mjs +6 -6
  36. package/package.json +3 -3
  37. package/resources/analytics.d.mts +38 -5
  38. package/resources/analytics.d.mts.map +1 -1
  39. package/resources/analytics.d.ts +38 -5
  40. package/resources/analytics.d.ts.map +1 -1
  41. package/resources/domains.d.mts +26 -26
  42. package/resources/domains.d.mts.map +1 -1
  43. package/resources/domains.d.ts +26 -26
  44. package/resources/domains.d.ts.map +1 -1
  45. package/resources/domains.js +8 -8
  46. package/resources/domains.js.map +1 -1
  47. package/resources/domains.mjs +8 -8
  48. package/resources/domains.mjs.map +1 -1
  49. package/resources/events.d.mts +29 -72
  50. package/resources/events.d.mts.map +1 -1
  51. package/resources/events.d.ts +29 -72
  52. package/resources/events.d.ts.map +1 -1
  53. package/resources/index.d.mts +4 -4
  54. package/resources/index.d.mts.map +1 -1
  55. package/resources/index.d.ts +4 -4
  56. package/resources/index.d.ts.map +1 -1
  57. package/resources/links/bulk.d.mts +14 -5
  58. package/resources/links/bulk.d.mts.map +1 -1
  59. package/resources/links/bulk.d.ts +14 -5
  60. package/resources/links/bulk.d.ts.map +1 -1
  61. package/resources/links/index.d.mts +1 -1
  62. package/resources/links/index.d.mts.map +1 -1
  63. package/resources/links/index.d.ts +1 -1
  64. package/resources/links/index.d.ts.map +1 -1
  65. package/resources/links/links.d.mts +263 -237
  66. package/resources/links/links.d.mts.map +1 -1
  67. package/resources/links/links.d.ts +263 -237
  68. package/resources/links/links.d.ts.map +1 -1
  69. package/resources/links/links.js +21 -21
  70. package/resources/links/links.js.map +1 -1
  71. package/resources/links/links.mjs +21 -21
  72. package/resources/links/links.mjs.map +1 -1
  73. package/resources/qrcodes/bulk.d.mts +84 -17
  74. package/resources/qrcodes/bulk.d.mts.map +1 -1
  75. package/resources/qrcodes/bulk.d.ts +84 -17
  76. package/resources/qrcodes/bulk.d.ts.map +1 -1
  77. package/resources/qrcodes/index.d.mts +1 -1
  78. package/resources/qrcodes/index.d.mts.map +1 -1
  79. package/resources/qrcodes/index.d.ts +1 -1
  80. package/resources/qrcodes/index.d.ts.map +1 -1
  81. package/resources/qrcodes/qrcodes.d.mts +409 -223
  82. package/resources/qrcodes/qrcodes.d.mts.map +1 -1
  83. package/resources/qrcodes/qrcodes.d.ts +409 -223
  84. package/resources/qrcodes/qrcodes.d.ts.map +1 -1
  85. package/resources/qrcodes/qrcodes.js +11 -11
  86. package/resources/qrcodes/qrcodes.js.map +1 -1
  87. package/resources/qrcodes/qrcodes.mjs +11 -11
  88. package/resources/qrcodes/qrcodes.mjs.map +1 -1
  89. package/resources/tags.d.mts +12 -12
  90. package/resources/tags.d.mts.map +1 -1
  91. package/resources/tags.d.ts +12 -12
  92. package/resources/tags.d.ts.map +1 -1
  93. package/resources/tags.js +6 -6
  94. package/resources/tags.js.map +1 -1
  95. package/resources/tags.mjs +6 -6
  96. package/resources/tags.mjs.map +1 -1
  97. package/resources/track.d.mts +12 -0
  98. package/resources/track.d.mts.map +1 -1
  99. package/resources/track.d.ts +12 -0
  100. package/resources/track.d.ts.map +1 -1
  101. package/src/client.ts +21 -21
  102. package/src/core/api-promise.ts +4 -4
  103. package/src/core/error.ts +2 -2
  104. package/src/core/resource.ts +3 -3
  105. package/src/index.ts +3 -3
  106. package/src/internal/parse.ts +2 -2
  107. package/src/internal/shims.ts +1 -1
  108. package/src/internal/uploads.ts +5 -5
  109. package/src/internal/utils/base64.ts +3 -3
  110. package/src/internal/utils/log.ts +3 -3
  111. package/src/internal/utils/path.ts +2 -2
  112. package/src/internal/utils/values.ts +6 -6
  113. package/src/resources/analytics.ts +45 -5
  114. package/src/resources/domains.ts +37 -37
  115. package/src/resources/events.ts +48 -82
  116. package/src/resources/index.ts +4 -4
  117. package/src/resources/links/bulk.ts +23 -6
  118. package/src/resources/links/index.ts +1 -1
  119. package/src/resources/links/links.ts +328 -257
  120. package/src/resources/qrcodes/bulk.ts +103 -17
  121. package/src/resources/qrcodes/index.ts +1 -1
  122. package/src/resources/qrcodes/qrcodes.ts +629 -368
  123. package/src/resources/tags.ts +16 -16
  124. package/src/resources/track.ts +14 -0
  125. package/src/version.ts +1 -1
  126. package/version.d.mts +1 -1
  127. package/version.d.ts +1 -1
  128. package/version.js +1 -1
  129. package/version.mjs +1 -1
package/client.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- var _Codeqr_instances, _a, _Codeqr_encoder, _Codeqr_baseURLOverridden;
2
+ var _CodeQR_instances, _a, _CodeQR_encoder, _CodeQR_baseURLOverridden;
3
3
  import { __classPrivateFieldGet, __classPrivateFieldSet } from "./internal/tslib.mjs";
4
4
  import { uuid4 } from "./internal/utils/uuid.mjs";
5
5
  import { validatePositiveInteger, isAbsoluteURL, safeJSON } from "./internal/utils/values.mjs";
@@ -27,11 +27,11 @@ import { readEnv } from "./internal/utils/env.mjs";
27
27
  import { formatRequestDetails, loggerFor, parseLogLevel, } from "./internal/utils/log.mjs";
28
28
  import { isEmptyObj } from "./internal/utils/values.mjs";
29
29
  /**
30
- * API Client for interfacing with the Codeqr API.
30
+ * API Client for interfacing with the CodeQR API.
31
31
  */
32
- export class Codeqr {
32
+ export class CodeQR {
33
33
  /**
34
- * API Client for interfacing with the Codeqr API.
34
+ * API Client for interfacing with the CodeQR API.
35
35
  *
36
36
  * @param {string | undefined} [opts.apiKey=process.env['CODEQR_API_KEY'] ?? undefined]
37
37
  * @param {string} [opts.baseURL=process.env['CODEQR_BASE_URL'] ?? https://api.codeqr.io] - Override the default base URL for the API.
@@ -43,8 +43,8 @@ export class Codeqr {
43
43
  * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
44
44
  */
45
45
  constructor({ baseURL = readEnv('CODEQR_BASE_URL'), apiKey = readEnv('CODEQR_API_KEY'), ...opts } = {}) {
46
- _Codeqr_instances.add(this);
47
- _Codeqr_encoder.set(this, void 0);
46
+ _CodeQR_instances.add(this);
47
+ _CodeQR_encoder.set(this, void 0);
48
48
  this.links = new API.Links(this);
49
49
  this.qrcodes = new API.Qrcodes(this);
50
50
  this.analytics = new API.Analytics(this);
@@ -54,7 +54,7 @@ export class Codeqr {
54
54
  this.track = new API.Track(this);
55
55
  this.projects = new API.Projects(this);
56
56
  if (apiKey === undefined) {
57
- throw new Errors.CodeqrError("The CODEQR_API_KEY environment variable is missing or empty; either provide it, or instantiate the Codeqr client with an apiKey option, like new Codeqr({ apiKey: 'My API Key' }).");
57
+ throw new Errors.CodeQRError("The CODEQR_API_KEY environment variable is missing or empty; either provide it, or instantiate the CodeQR client with an apiKey option, like new CodeQR({ apiKey: 'My API Key' }).");
58
58
  }
59
59
  const options = {
60
60
  apiKey,
@@ -74,7 +74,7 @@ export class Codeqr {
74
74
  this.fetchOptions = options.fetchOptions;
75
75
  this.maxRetries = options.maxRetries ?? 2;
76
76
  this.fetch = options.fetch ?? Shims.getDefaultFetch();
77
- __classPrivateFieldSet(this, _Codeqr_encoder, Opts.FallbackEncoder, "f");
77
+ __classPrivateFieldSet(this, _CodeQR_encoder, Opts.FallbackEncoder, "f");
78
78
  const customHeadersEnv = readEnv('CODEQR_CUSTOM_HEADERS');
79
79
  if (customHeadersEnv) {
80
80
  const parsed = {};
@@ -129,7 +129,7 @@ export class Codeqr {
129
129
  return Errors.APIError.generate(status, error, message, headers);
130
130
  }
131
131
  buildURL(path, query, defaultBaseURL) {
132
- const baseURL = (!__classPrivateFieldGet(this, _Codeqr_instances, "m", _Codeqr_baseURLOverridden).call(this) && defaultBaseURL) || this.baseURL;
132
+ const baseURL = (!__classPrivateFieldGet(this, _CodeQR_instances, "m", _CodeQR_baseURLOverridden).call(this) && defaultBaseURL) || this.baseURL;
133
133
  const url = isAbsoluteURL(path) ?
134
134
  new URL(path)
135
135
  : new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
@@ -428,7 +428,7 @@ export class Codeqr {
428
428
  // content-type for those, and only elide it for operations with no body at
429
429
  // all (e.g. GET/DELETE).
430
430
  if (body == null && 'body' in options) {
431
- return __classPrivateFieldGet(this, _Codeqr_encoder, "f").call(this, { body, headers: buildHeaders([rawHeaders]) });
431
+ return __classPrivateFieldGet(this, _CodeQR_encoder, "f").call(this, { body, headers: buildHeaders([rawHeaders]) });
432
432
  }
433
433
  return { bodyHeaders: undefined, body: undefined };
434
434
  }
@@ -464,35 +464,35 @@ export class Codeqr {
464
464
  };
465
465
  }
466
466
  else {
467
- return __classPrivateFieldGet(this, _Codeqr_encoder, "f").call(this, { body, headers });
467
+ return __classPrivateFieldGet(this, _CodeQR_encoder, "f").call(this, { body, headers });
468
468
  }
469
469
  }
470
470
  }
471
- _a = Codeqr, _Codeqr_encoder = new WeakMap(), _Codeqr_instances = new WeakSet(), _Codeqr_baseURLOverridden = function _Codeqr_baseURLOverridden() {
471
+ _a = CodeQR, _CodeQR_encoder = new WeakMap(), _CodeQR_instances = new WeakSet(), _CodeQR_baseURLOverridden = function _CodeQR_baseURLOverridden() {
472
472
  return this.baseURL !== 'https://api.codeqr.io';
473
473
  };
474
- Codeqr.Codeqr = _a;
475
- Codeqr.DEFAULT_TIMEOUT = 60000; // 1 minute
476
- Codeqr.CodeqrError = Errors.CodeqrError;
477
- Codeqr.APIError = Errors.APIError;
478
- Codeqr.APIConnectionError = Errors.APIConnectionError;
479
- Codeqr.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
480
- Codeqr.APIUserAbortError = Errors.APIUserAbortError;
481
- Codeqr.NotFoundError = Errors.NotFoundError;
482
- Codeqr.ConflictError = Errors.ConflictError;
483
- Codeqr.RateLimitError = Errors.RateLimitError;
484
- Codeqr.BadRequestError = Errors.BadRequestError;
485
- Codeqr.AuthenticationError = Errors.AuthenticationError;
486
- Codeqr.InternalServerError = Errors.InternalServerError;
487
- Codeqr.PermissionDeniedError = Errors.PermissionDeniedError;
488
- Codeqr.UnprocessableEntityError = Errors.UnprocessableEntityError;
489
- Codeqr.toFile = Uploads.toFile;
490
- Codeqr.Links = Links;
491
- Codeqr.Qrcodes = Qrcodes;
492
- Codeqr.Analytics = Analytics;
493
- Codeqr.Events = Events;
494
- Codeqr.Tags = Tags;
495
- Codeqr.Domains = Domains;
496
- Codeqr.Track = Track;
497
- Codeqr.Projects = Projects;
474
+ CodeQR.CodeQR = _a;
475
+ CodeQR.DEFAULT_TIMEOUT = 60000; // 1 minute
476
+ CodeQR.CodeQRError = Errors.CodeQRError;
477
+ CodeQR.APIError = Errors.APIError;
478
+ CodeQR.APIConnectionError = Errors.APIConnectionError;
479
+ CodeQR.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
480
+ CodeQR.APIUserAbortError = Errors.APIUserAbortError;
481
+ CodeQR.NotFoundError = Errors.NotFoundError;
482
+ CodeQR.ConflictError = Errors.ConflictError;
483
+ CodeQR.RateLimitError = Errors.RateLimitError;
484
+ CodeQR.BadRequestError = Errors.BadRequestError;
485
+ CodeQR.AuthenticationError = Errors.AuthenticationError;
486
+ CodeQR.InternalServerError = Errors.InternalServerError;
487
+ CodeQR.PermissionDeniedError = Errors.PermissionDeniedError;
488
+ CodeQR.UnprocessableEntityError = Errors.UnprocessableEntityError;
489
+ CodeQR.toFile = Uploads.toFile;
490
+ CodeQR.Links = Links;
491
+ CodeQR.Qrcodes = Qrcodes;
492
+ CodeQR.Analytics = Analytics;
493
+ CodeQR.Events = Events;
494
+ CodeQR.Tags = Tags;
495
+ CodeQR.Domains = Domains;
496
+ CodeQR.Track = Track;
497
+ CodeQR.Projects = Projects;
498
498
  //# sourceMappingURL=client.mjs.map
@@ -1,4 +1,4 @@
1
- import { type Codeqr } from "../client.mjs";
1
+ import { type CodeQR } from "../client.mjs";
2
2
  import { type PromiseOrValue } from "../internal/types.mjs";
3
3
  import { APIResponseProps } from "../internal/parse.mjs";
4
4
  /**
@@ -10,7 +10,7 @@ export declare class APIPromise<T> extends Promise<T> {
10
10
  private responsePromise;
11
11
  private parseResponse;
12
12
  private parsedPromise;
13
- constructor(client: Codeqr, responsePromise: Promise<APIResponseProps>, parseResponse?: (client: Codeqr, props: APIResponseProps) => PromiseOrValue<T>);
13
+ constructor(client: CodeQR, responsePromise: Promise<APIResponseProps>, parseResponse?: (client: CodeQR, props: APIResponseProps) => PromiseOrValue<T>);
14
14
  _thenUnwrap<U>(transform: (data: T, props: APIResponseProps) => U): APIPromise<U>;
15
15
  /**
16
16
  * Gets the raw `Response` instance instead of parsing the response
@@ -1,4 +1,4 @@
1
- import { type Codeqr } from "../client.js";
1
+ import { type CodeQR } from "../client.js";
2
2
  import { type PromiseOrValue } from "../internal/types.js";
3
3
  import { APIResponseProps } from "../internal/parse.js";
4
4
  /**
@@ -10,7 +10,7 @@ export declare class APIPromise<T> extends Promise<T> {
10
10
  private responsePromise;
11
11
  private parseResponse;
12
12
  private parsedPromise;
13
- constructor(client: Codeqr, responsePromise: Promise<APIResponseProps>, parseResponse?: (client: Codeqr, props: APIResponseProps) => PromiseOrValue<T>);
13
+ constructor(client: CodeQR, responsePromise: Promise<APIResponseProps>, parseResponse?: (client: CodeQR, props: APIResponseProps) => PromiseOrValue<T>);
14
14
  _thenUnwrap<U>(transform: (data: T, props: APIResponseProps) => U): APIPromise<U>;
15
15
  /**
16
16
  * Gets the raw `Response` instance instead of parsing the response
package/core/error.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- export declare class CodeqrError extends Error {
1
+ export declare class CodeQRError extends Error {
2
2
  }
3
- export declare class APIError<TStatus extends number | undefined = number | undefined, THeaders extends Headers | undefined = Headers | undefined, TError extends Object | undefined = Object | undefined> extends CodeqrError {
3
+ export declare class APIError<TStatus extends number | undefined = number | undefined, THeaders extends Headers | undefined = Headers | undefined, TError extends Object | undefined = Object | undefined> extends CodeQRError {
4
4
  /** HTTP status for the response that caused the error */
5
5
  readonly status: TStatus;
6
6
  /** HTTP headers for the response that caused the error */
package/core/error.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export declare class CodeqrError extends Error {
1
+ export declare class CodeQRError extends Error {
2
2
  }
3
- export declare class APIError<TStatus extends number | undefined = number | undefined, THeaders extends Headers | undefined = Headers | undefined, TError extends Object | undefined = Object | undefined> extends CodeqrError {
3
+ export declare class APIError<TStatus extends number | undefined = number | undefined, THeaders extends Headers | undefined = Headers | undefined, TError extends Object | undefined = Object | undefined> extends CodeQRError {
4
4
  /** HTTP status for the response that caused the error */
5
5
  readonly status: TStatus;
6
6
  /** HTTP headers for the response that caused the error */
package/core/error.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.InternalServerError = exports.RateLimitError = exports.UnprocessableEntityError = exports.ConflictError = exports.NotFoundError = exports.PermissionDeniedError = exports.AuthenticationError = exports.BadRequestError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIUserAbortError = exports.APIError = exports.CodeqrError = void 0;
4
+ exports.InternalServerError = exports.RateLimitError = exports.UnprocessableEntityError = exports.ConflictError = exports.NotFoundError = exports.PermissionDeniedError = exports.AuthenticationError = exports.BadRequestError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIUserAbortError = exports.APIError = exports.CodeQRError = void 0;
5
5
  const errors_1 = require("../internal/errors.js");
6
- class CodeqrError extends Error {
6
+ class CodeQRError extends Error {
7
7
  }
8
- exports.CodeqrError = CodeqrError;
9
- class APIError extends CodeqrError {
8
+ exports.CodeQRError = CodeQRError;
9
+ class APIError extends CodeQRError {
10
10
  constructor(status, error, message, headers) {
11
11
  super(`${APIError.makeMessage(status, error, message)}`);
12
12
  this.status = status;
package/core/error.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
  import { castToError } from "../internal/errors.mjs";
3
- export class CodeqrError extends Error {
3
+ export class CodeQRError extends Error {
4
4
  }
5
- export class APIError extends CodeqrError {
5
+ export class APIError extends CodeQRError {
6
6
  constructor(status, error, message, headers) {
7
7
  super(`${APIError.makeMessage(status, error, message)}`);
8
8
  this.status = status;
@@ -1,6 +1,6 @@
1
- import type { Codeqr } from "../client.mjs";
1
+ import type { CodeQR } from "../client.mjs";
2
2
  export declare abstract class APIResource {
3
- protected _client: Codeqr;
4
- constructor(client: Codeqr);
3
+ protected _client: CodeQR;
4
+ constructor(client: CodeQR);
5
5
  }
6
6
  //# sourceMappingURL=resource.d.mts.map
@@ -1,6 +1,6 @@
1
- import type { Codeqr } from "../client.js";
1
+ import type { CodeQR } from "../client.js";
2
2
  export declare abstract class APIResource {
3
- protected _client: Codeqr;
4
- constructor(client: Codeqr);
3
+ protected _client: CodeQR;
4
+ constructor(client: CodeQR);
5
5
  }
6
6
  //# sourceMappingURL=resource.d.ts.map
package/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- export { Codeqr as default } from "./client.mjs";
1
+ export { CodeQR as default } from "./client.mjs";
2
2
  export { type Uploadable, toFile } from "./core/uploads.mjs";
3
3
  export { APIPromise } from "./core/api-promise.mjs";
4
- export { Codeqr, type ClientOptions } from "./client.mjs";
5
- export { CodeqrError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.mjs";
4
+ export { CodeQR, type ClientOptions } from "./client.mjs";
5
+ export { CodeQRError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.mjs";
6
6
  //# sourceMappingURL=index.d.mts.map
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { Codeqr as default } from "./client.js";
1
+ export { CodeQR as default } from "./client.js";
2
2
  export { type Uploadable, toFile } from "./core/uploads.js";
3
3
  export { APIPromise } from "./core/api-promise.js";
4
- export { Codeqr, type ClientOptions } from "./client.js";
5
- export { CodeqrError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.js";
4
+ export { CodeQR, type ClientOptions } from "./client.js";
5
+ export { CodeQRError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.js";
6
6
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -4,17 +4,17 @@ exports = module.exports = function (...args) {
4
4
  return new exports.default(...args)
5
5
  }
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.CodeqrError = exports.Codeqr = exports.APIPromise = exports.toFile = exports.default = void 0;
7
+ exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.CodeQRError = exports.CodeQR = exports.APIPromise = exports.toFile = exports.default = void 0;
8
8
  var client_1 = require("./client.js");
9
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return client_1.Codeqr; } });
9
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return client_1.CodeQR; } });
10
10
  var uploads_1 = require("./core/uploads.js");
11
11
  Object.defineProperty(exports, "toFile", { enumerable: true, get: function () { return uploads_1.toFile; } });
12
12
  var api_promise_1 = require("./core/api-promise.js");
13
13
  Object.defineProperty(exports, "APIPromise", { enumerable: true, get: function () { return api_promise_1.APIPromise; } });
14
14
  var client_2 = require("./client.js");
15
- Object.defineProperty(exports, "Codeqr", { enumerable: true, get: function () { return client_2.Codeqr; } });
15
+ Object.defineProperty(exports, "CodeQR", { enumerable: true, get: function () { return client_2.CodeQR; } });
16
16
  var error_1 = require("./core/error.js");
17
- Object.defineProperty(exports, "CodeqrError", { enumerable: true, get: function () { return error_1.CodeqrError; } });
17
+ Object.defineProperty(exports, "CodeQRError", { enumerable: true, get: function () { return error_1.CodeQRError; } });
18
18
  Object.defineProperty(exports, "APIError", { enumerable: true, get: function () { return error_1.APIError; } });
19
19
  Object.defineProperty(exports, "APIConnectionError", { enumerable: true, get: function () { return error_1.APIConnectionError; } });
20
20
  Object.defineProperty(exports, "APIConnectionTimeoutError", { enumerable: true, get: function () { return error_1.APIConnectionTimeoutError; } });
package/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- export { Codeqr as default } from "./client.mjs";
2
+ export { CodeQR as default } from "./client.mjs";
3
3
  export { toFile } from "./core/uploads.mjs";
4
4
  export { APIPromise } from "./core/api-promise.mjs";
5
- export { Codeqr } from "./client.mjs";
6
- export { CodeqrError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.mjs";
5
+ export { CodeQR } from "./client.mjs";
6
+ export { CodeQRError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.mjs";
7
7
  //# sourceMappingURL=index.mjs.map
@@ -1,5 +1,5 @@
1
1
  import type { FinalRequestOptions } from "./request-options.mjs";
2
- import { type Codeqr } from "../client.mjs";
2
+ import { type CodeQR } from "../client.mjs";
3
3
  export type APIResponseProps = {
4
4
  response: Response;
5
5
  options: FinalRequestOptions;
@@ -8,5 +8,5 @@ export type APIResponseProps = {
8
8
  retryOfRequestLogID: string | undefined;
9
9
  startTime: number;
10
10
  };
11
- export declare function defaultParseResponse<T>(client: Codeqr, props: APIResponseProps): Promise<T>;
11
+ export declare function defaultParseResponse<T>(client: CodeQR, props: APIResponseProps): Promise<T>;
12
12
  //# sourceMappingURL=parse.d.mts.map
@@ -1,5 +1,5 @@
1
1
  import type { FinalRequestOptions } from "./request-options.js";
2
- import { type Codeqr } from "../client.js";
2
+ import { type CodeQR } from "../client.js";
3
3
  export type APIResponseProps = {
4
4
  response: Response;
5
5
  options: FinalRequestOptions;
@@ -8,5 +8,5 @@ export type APIResponseProps = {
8
8
  retryOfRequestLogID: string | undefined;
9
9
  startTime: number;
10
10
  };
11
- export declare function defaultParseResponse<T>(client: Codeqr, props: APIResponseProps): Promise<T>;
11
+ export declare function defaultParseResponse<T>(client: CodeQR, props: APIResponseProps): Promise<T>;
12
12
  //# sourceMappingURL=parse.d.ts.map
package/internal/shims.js CHANGED
@@ -10,7 +10,7 @@ function getDefaultFetch() {
10
10
  if (typeof fetch !== 'undefined') {
11
11
  return fetch;
12
12
  }
13
- throw new Error('`fetch` is not defined as a global; Either pass `fetch` to the client, `new Codeqr({ fetch })` or polyfill the global, `globalThis.fetch = fetch`');
13
+ throw new Error('`fetch` is not defined as a global; Either pass `fetch` to the client, `new CodeQR({ fetch })` or polyfill the global, `globalThis.fetch = fetch`');
14
14
  }
15
15
  function makeReadableStream(...args) {
16
16
  const ReadableStream = globalThis.ReadableStream;
@@ -3,7 +3,7 @@ export function getDefaultFetch() {
3
3
  if (typeof fetch !== 'undefined') {
4
4
  return fetch;
5
5
  }
6
- throw new Error('`fetch` is not defined as a global; Either pass `fetch` to the client, `new Codeqr({ fetch })` or polyfill the global, `globalThis.fetch = fetch`');
6
+ throw new Error('`fetch` is not defined as a global; Either pass `fetch` to the client, `new CodeQR({ fetch })` or polyfill the global, `globalThis.fetch = fetch`');
7
7
  }
8
8
  export function makeReadableStream(...args) {
9
9
  const ReadableStream = globalThis.ReadableStream;
@@ -1,6 +1,6 @@
1
1
  import { type RequestOptions } from "./request-options.mjs";
2
2
  import type { FilePropertyBag, Fetch } from "./builtin-types.mjs";
3
- import type { Codeqr } from "../client.mjs";
3
+ import type { CodeQR } from "../client.mjs";
4
4
  export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | DataView;
5
5
  type FsReadStream = AsyncIterable<Uint8Array> & {
6
6
  path: string | {
@@ -32,11 +32,11 @@ export declare const isAsyncIterable: (value: any) => value is AsyncIterable<any
32
32
  * Returns a multipart/form-data request if any part of the given request body contains a File / Blob value.
33
33
  * Otherwise returns the request as is.
34
34
  */
35
- export declare const maybeMultipartFormRequestOptions: (opts: RequestOptions, fetch: Codeqr | Fetch) => Promise<RequestOptions>;
35
+ export declare const maybeMultipartFormRequestOptions: (opts: RequestOptions, fetch: CodeQR | Fetch) => Promise<RequestOptions>;
36
36
  type MultipartFormRequestOptions = Omit<RequestOptions, 'body'> & {
37
37
  body: unknown;
38
38
  };
39
- export declare const multipartFormRequestOptions: (opts: MultipartFormRequestOptions, fetch: Codeqr | Fetch) => Promise<RequestOptions>;
40
- export declare const createForm: <T = Record<string, unknown>>(body: T | undefined, fetch: Codeqr | Fetch) => Promise<FormData>;
39
+ export declare const multipartFormRequestOptions: (opts: MultipartFormRequestOptions, fetch: CodeQR | Fetch) => Promise<RequestOptions>;
40
+ export declare const createForm: <T = Record<string, unknown>>(body: T | undefined, fetch: CodeQR | Fetch) => Promise<FormData>;
41
41
  export {};
42
42
  //# sourceMappingURL=uploads.d.mts.map
@@ -1,6 +1,6 @@
1
1
  import { type RequestOptions } from "./request-options.js";
2
2
  import type { FilePropertyBag, Fetch } from "./builtin-types.js";
3
- import type { Codeqr } from "../client.js";
3
+ import type { CodeQR } from "../client.js";
4
4
  export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | DataView;
5
5
  type FsReadStream = AsyncIterable<Uint8Array> & {
6
6
  path: string | {
@@ -32,11 +32,11 @@ export declare const isAsyncIterable: (value: any) => value is AsyncIterable<any
32
32
  * Returns a multipart/form-data request if any part of the given request body contains a File / Blob value.
33
33
  * Otherwise returns the request as is.
34
34
  */
35
- export declare const maybeMultipartFormRequestOptions: (opts: RequestOptions, fetch: Codeqr | Fetch) => Promise<RequestOptions>;
35
+ export declare const maybeMultipartFormRequestOptions: (opts: RequestOptions, fetch: CodeQR | Fetch) => Promise<RequestOptions>;
36
36
  type MultipartFormRequestOptions = Omit<RequestOptions, 'body'> & {
37
37
  body: unknown;
38
38
  };
39
- export declare const multipartFormRequestOptions: (opts: MultipartFormRequestOptions, fetch: Codeqr | Fetch) => Promise<RequestOptions>;
40
- export declare const createForm: <T = Record<string, unknown>>(body: T | undefined, fetch: Codeqr | Fetch) => Promise<FormData>;
39
+ export declare const multipartFormRequestOptions: (opts: MultipartFormRequestOptions, fetch: CodeQR | Fetch) => Promise<RequestOptions>;
40
+ export declare const createForm: <T = Record<string, unknown>>(body: T | undefined, fetch: CodeQR | Fetch) => Promise<FormData>;
41
41
  export {};
42
42
  //# sourceMappingURL=uploads.d.ts.map
@@ -16,7 +16,7 @@ const toBase64 = (data) => {
16
16
  if (typeof btoa !== 'undefined') {
17
17
  return btoa(String.fromCharCode.apply(null, data));
18
18
  }
19
- throw new error_1.CodeqrError('Cannot generate base64 string; Expected `Buffer` or `btoa` to be defined');
19
+ throw new error_1.CodeQRError('Cannot generate base64 string; Expected `Buffer` or `btoa` to be defined');
20
20
  };
21
21
  exports.toBase64 = toBase64;
22
22
  const fromBase64 = (str) => {
@@ -32,7 +32,7 @@ const fromBase64 = (str) => {
32
32
  }
33
33
  return buf;
34
34
  }
35
- throw new error_1.CodeqrError('Cannot decode base64 string; Expected `Buffer` or `atob` to be defined');
35
+ throw new error_1.CodeQRError('Cannot decode base64 string; Expected `Buffer` or `atob` to be defined');
36
36
  };
37
37
  exports.fromBase64 = fromBase64;
38
38
  //# sourceMappingURL=base64.js.map
@@ -1,5 +1,5 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import { CodeqrError } from "../../core/error.mjs";
2
+ import { CodeQRError } from "../../core/error.mjs";
3
3
  import { encodeUTF8 } from "./bytes.mjs";
4
4
  export const toBase64 = (data) => {
5
5
  if (!data)
@@ -13,7 +13,7 @@ export const toBase64 = (data) => {
13
13
  if (typeof btoa !== 'undefined') {
14
14
  return btoa(String.fromCharCode.apply(null, data));
15
15
  }
16
- throw new CodeqrError('Cannot generate base64 string; Expected `Buffer` or `btoa` to be defined');
16
+ throw new CodeQRError('Cannot generate base64 string; Expected `Buffer` or `btoa` to be defined');
17
17
  };
18
18
  export const fromBase64 = (str) => {
19
19
  if (typeof globalThis.Buffer !== 'undefined') {
@@ -28,6 +28,6 @@ export const fromBase64 = (str) => {
28
28
  }
29
29
  return buf;
30
30
  }
31
- throw new CodeqrError('Cannot decode base64 string; Expected `Buffer` or `atob` to be defined');
31
+ throw new CodeQRError('Cannot decode base64 string; Expected `Buffer` or `atob` to be defined');
32
32
  };
33
33
  //# sourceMappingURL=base64.mjs.map
@@ -1,4 +1,4 @@
1
- import { type Codeqr } from "../../client.mjs";
1
+ import { type CodeQR } from "../../client.mjs";
2
2
  import { RequestOptions } from "../request-options.mjs";
3
3
  type LogFn = (message: string, ...rest: unknown[]) => void;
4
4
  export type Logger = {
@@ -8,8 +8,8 @@ export type Logger = {
8
8
  debug: LogFn;
9
9
  };
10
10
  export type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug';
11
- export declare const parseLogLevel: (maybeLevel: string | undefined, sourceName: string, client: Codeqr) => LogLevel | undefined;
12
- export declare function loggerFor(client: Codeqr): Logger;
11
+ export declare const parseLogLevel: (maybeLevel: string | undefined, sourceName: string, client: CodeQR) => LogLevel | undefined;
12
+ export declare function loggerFor(client: CodeQR): Logger;
13
13
  export declare const formatRequestDetails: (details: {
14
14
  options?: RequestOptions | undefined;
15
15
  headers?: Headers | Record<string, string> | undefined;
@@ -1,4 +1,4 @@
1
- import { type Codeqr } from "../../client.js";
1
+ import { type CodeQR } from "../../client.js";
2
2
  import { RequestOptions } from "../request-options.js";
3
3
  type LogFn = (message: string, ...rest: unknown[]) => void;
4
4
  export type Logger = {
@@ -8,8 +8,8 @@ export type Logger = {
8
8
  debug: LogFn;
9
9
  };
10
10
  export type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug';
11
- export declare const parseLogLevel: (maybeLevel: string | undefined, sourceName: string, client: Codeqr) => LogLevel | undefined;
12
- export declare function loggerFor(client: Codeqr): Logger;
11
+ export declare const parseLogLevel: (maybeLevel: string | undefined, sourceName: string, client: CodeQR) => LogLevel | undefined;
12
+ export declare function loggerFor(client: CodeQR): Logger;
13
13
  export declare const formatRequestDetails: (details: {
14
14
  options?: RequestOptions | undefined;
15
15
  headers?: Headers | Record<string, string> | undefined;
@@ -65,7 +65,7 @@ const createPathTagFunction = (pathEncoder = encodeURIPath) => function path(sta
65
65
  lastEnd = segment.start + segment.length;
66
66
  return acc + spaces + arrows;
67
67
  }, '');
68
- throw new error_1.CodeqrError(`Path parameters result in path with invalid segments:\n${invalidSegments
68
+ throw new error_1.CodeQRError(`Path parameters result in path with invalid segments:\n${invalidSegments
69
69
  .map((e) => e.error)
70
70
  .join('\n')}\n${path}\n${underline}`);
71
71
  }
@@ -1,4 +1,4 @@
1
- import { CodeqrError } from "../../core/error.mjs";
1
+ import { CodeQRError } from "../../core/error.mjs";
2
2
  /**
3
3
  * Percent-encode everything that isn't safe to have in a path without encoding safe chars.
4
4
  *
@@ -61,7 +61,7 @@ export const createPathTagFunction = (pathEncoder = encodeURIPath) => function p
61
61
  lastEnd = segment.start + segment.length;
62
62
  return acc + spaces + arrows;
63
63
  }, '');
64
- throw new CodeqrError(`Path parameters result in path with invalid segments:\n${invalidSegments
64
+ throw new CodeQRError(`Path parameters result in path with invalid segments:\n${invalidSegments
65
65
  .map((e) => e.error)
66
66
  .join('\n')}\n${path}\n${underline}`);
67
67
  }
@@ -40,17 +40,17 @@ function isObj(obj) {
40
40
  }
41
41
  const ensurePresent = (value) => {
42
42
  if (value == null) {
43
- throw new error_1.CodeqrError(`Expected a value to be given but received ${value} instead.`);
43
+ throw new error_1.CodeQRError(`Expected a value to be given but received ${value} instead.`);
44
44
  }
45
45
  return value;
46
46
  };
47
47
  exports.ensurePresent = ensurePresent;
48
48
  const validatePositiveInteger = (name, n) => {
49
49
  if (typeof n !== 'number' || !Number.isInteger(n)) {
50
- throw new error_1.CodeqrError(`${name} must be an integer`);
50
+ throw new error_1.CodeQRError(`${name} must be an integer`);
51
51
  }
52
52
  if (n < 0) {
53
- throw new error_1.CodeqrError(`${name} must be a positive integer`);
53
+ throw new error_1.CodeQRError(`${name} must be a positive integer`);
54
54
  }
55
55
  return n;
56
56
  };
@@ -60,7 +60,7 @@ const coerceInteger = (value) => {
60
60
  return Math.round(value);
61
61
  if (typeof value === 'string')
62
62
  return parseInt(value, 10);
63
- throw new error_1.CodeqrError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
63
+ throw new error_1.CodeQRError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
64
64
  };
65
65
  exports.coerceInteger = coerceInteger;
66
66
  const coerceFloat = (value) => {
@@ -68,7 +68,7 @@ const coerceFloat = (value) => {
68
68
  return value;
69
69
  if (typeof value === 'string')
70
70
  return parseFloat(value);
71
- throw new error_1.CodeqrError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
71
+ throw new error_1.CodeQRError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
72
72
  };
73
73
  exports.coerceFloat = coerceFloat;
74
74
  const coerceBoolean = (value) => {
@@ -1,5 +1,5 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import { CodeqrError } from "../../core/error.mjs";
2
+ import { CodeQRError } from "../../core/error.mjs";
3
3
  // https://url.spec.whatwg.org/#url-scheme-string
4
4
  const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i;
5
5
  export const isAbsoluteURL = (url) => {
@@ -31,16 +31,16 @@ export function isObj(obj) {
31
31
  }
32
32
  export const ensurePresent = (value) => {
33
33
  if (value == null) {
34
- throw new CodeqrError(`Expected a value to be given but received ${value} instead.`);
34
+ throw new CodeQRError(`Expected a value to be given but received ${value} instead.`);
35
35
  }
36
36
  return value;
37
37
  };
38
38
  export const validatePositiveInteger = (name, n) => {
39
39
  if (typeof n !== 'number' || !Number.isInteger(n)) {
40
- throw new CodeqrError(`${name} must be an integer`);
40
+ throw new CodeQRError(`${name} must be an integer`);
41
41
  }
42
42
  if (n < 0) {
43
- throw new CodeqrError(`${name} must be a positive integer`);
43
+ throw new CodeQRError(`${name} must be a positive integer`);
44
44
  }
45
45
  return n;
46
46
  };
@@ -49,14 +49,14 @@ export const coerceInteger = (value) => {
49
49
  return Math.round(value);
50
50
  if (typeof value === 'string')
51
51
  return parseInt(value, 10);
52
- throw new CodeqrError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
52
+ throw new CodeQRError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
53
53
  };
54
54
  export const coerceFloat = (value) => {
55
55
  if (typeof value === 'number')
56
56
  return value;
57
57
  if (typeof value === 'string')
58
58
  return parseFloat(value);
59
- throw new CodeqrError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
59
+ throw new CodeQRError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
60
60
  };
61
61
  export const coerceBoolean = (value) => {
62
62
  if (typeof value === 'boolean')
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@codeqr/ts",
3
- "version": "0.24.0",
4
- "description": "The official TypeScript library for the Codeqr API",
5
- "author": "Codeqr <contact@codeqr.io>",
3
+ "version": "0.25.0",
4
+ "description": "The official TypeScript library for the CodeQR API",
5
+ "author": "CodeQR <contact@codeqr.io>",
6
6
  "types": "./index.d.ts",
7
7
  "main": "./index.js",
8
8
  "type": "commonjs",