magic-hour 0.97.1 → 0.98.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/README.md CHANGED
@@ -228,6 +228,10 @@ Valid values are: `none`, `error`, `warn`, `info`, `debug` (case insensitive). I
228
228
 
229
229
  - [list](src/resources/v1/account/README.md#list) - Get account details
230
230
 
231
+ ### [v1.account.checkout](src/resources/v1/account/checkout/README.md)
232
+
233
+ - [create](src/resources/v1/account/checkout/README.md#create) - Create checkout
234
+
231
235
  ### [v1.aiClothesChanger](src/resources/v1/ai-clothes-changer/README.md)
232
236
 
233
237
  - [create](src/resources/v1/ai-clothes-changer/README.md#create) - AI Clothes Changer
@@ -1,4 +1,4 @@
1
1
  export declare enum Environment {
2
2
  Environment = "https://api.magichour.ai",
3
- MockServer = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.102.0"
3
+ MockServer = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.103.0"
4
4
  }
@@ -4,5 +4,5 @@ exports.Environment = void 0;
4
4
  var Environment;
5
5
  (function (Environment) {
6
6
  Environment["Environment"] = "https://api.magichour.ai";
7
- Environment["MockServer"] = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.102.0";
7
+ Environment["MockServer"] = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.103.0";
8
8
  })(Environment || (exports.Environment = Environment = {}));
@@ -0,0 +1,2 @@
1
+ export { CreateRequest } from "./request-types";
2
+ export { CheckoutClient } from "./resource-client";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CheckoutClient = void 0;
4
+ var resource_client_1 = require("./resource-client");
5
+ Object.defineProperty(exports, "CheckoutClient", { enumerable: true, get: function () { return resource_client_1.CheckoutClient; } });
@@ -0,0 +1,32 @@
1
+ import * as z from "zod";
2
+ /**
3
+ * CreateRequest
4
+ */
5
+ export type CreateRequest = {
6
+ /**
7
+ * Credits a blocked request is missing, e.g. `credit_shortfall` from a 402 response. The checkout starts with enough packs to cover it. Defaults to one pack.
8
+ */
9
+ creditShortfall?: number | undefined;
10
+ /**
11
+ * Number of credit packs the checkout starts with. Takes priority over `credit_shortfall`.
12
+ */
13
+ packCount?: number | undefined;
14
+ /**
15
+ * What to buy. `credit_pack` is a one-time credit purchase.
16
+ */
17
+ type: "credit_pack";
18
+ };
19
+ /**
20
+ * @internal
21
+ * CreateRequest without any key transformation, this is what
22
+ * we expect to come in as network data
23
+ */
24
+ export type External$CreateRequest = {
25
+ credit_shortfall?: number | undefined;
26
+ pack_count?: number | undefined;
27
+ type: "credit_pack";
28
+ };
29
+ export declare const Schemas$CreateRequest: {
30
+ in: z.ZodType<CreateRequest, z.ZodTypeDef, unknown>;
31
+ out: z.ZodType<External$CreateRequest, z.ZodTypeDef, CreateRequest>;
32
+ };
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Schemas$CreateRequest = void 0;
37
+ const make_api_request_js_1 = require("make-api-request-js");
38
+ const z = __importStar(require("zod"));
39
+ /**
40
+ * Takes network data, validates it, and transforms keys to match typescript object CreateRequest
41
+ */
42
+ const SchemaIn$CreateRequest = z
43
+ .object({
44
+ credit_shortfall: z.number().optional(),
45
+ pack_count: z.number().int().optional(),
46
+ type: z.enum(["credit_pack"]),
47
+ })
48
+ .transform((obj) => {
49
+ return (0, make_api_request_js_1.zodTransform)(obj, {
50
+ credit_shortfall: "creditShortfall",
51
+ pack_count: "packCount",
52
+ type: "type",
53
+ });
54
+ });
55
+ /**
56
+ * @internal
57
+ * Takes typescript data, validates it, and maps keys to match the expected external object External$CreateRequest
58
+ */
59
+ const SchemaOut$CreateRequest = z
60
+ .object({
61
+ creditShortfall: z.number().optional(),
62
+ packCount: z.number().int().optional(),
63
+ type: z.enum(["credit_pack"]),
64
+ })
65
+ .transform((obj) => {
66
+ return (0, make_api_request_js_1.zodTransform)(obj, {
67
+ creditShortfall: "credit_shortfall",
68
+ packCount: "pack_count",
69
+ type: "type",
70
+ });
71
+ });
72
+ exports.Schemas$CreateRequest = {
73
+ in: SchemaIn$CreateRequest,
74
+ out: SchemaOut$CreateRequest,
75
+ };
@@ -0,0 +1,14 @@
1
+ import { ApiPromise, CoreClient, CoreResourceClient, RequestOptions, ResourceClientOptions } from "make-api-request-js";
2
+ import * as requests from "./request-types.js";
3
+ import * as types from "../../../../types/index.js";
4
+ export declare class CheckoutClient extends CoreResourceClient {
5
+ constructor(coreClient: CoreClient, opts: ResourceClientOptions);
6
+ /**
7
+ * Create checkout
8
+ *
9
+ * Create a Stripe Checkout link for the account that owns the API key. Nothing is charged until the checkout is completed in a browser.
10
+ *
11
+ * POST /v1/account/checkout
12
+ */
13
+ create(request: requests.CreateRequest, opts?: RequestOptions): ApiPromise<types.V1AccountCheckoutCreateResponse>;
14
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CheckoutClient = void 0;
4
+ const make_api_request_js_1 = require("make-api-request-js");
5
+ const v1_account_checkout_create_body_1 = require("../../../../types/v1-account-checkout-create-body.js");
6
+ const v1_account_checkout_create_response_1 = require("../../../../types/v1-account-checkout-create-response.js");
7
+ class CheckoutClient extends make_api_request_js_1.CoreResourceClient {
8
+ constructor(coreClient, opts) {
9
+ super(coreClient, opts);
10
+ }
11
+ /**
12
+ * Create checkout
13
+ *
14
+ * Create a Stripe Checkout link for the account that owns the API key. Nothing is charged until the checkout is completed in a browser.
15
+ *
16
+ * POST /v1/account/checkout
17
+ */
18
+ create(request, opts) {
19
+ return this._client.makeRequest({
20
+ method: "post",
21
+ path: "/v1/account/checkout",
22
+ auth: ["bearerAuth"],
23
+ contentType: "application/json",
24
+ body: v1_account_checkout_create_body_1.Schemas$V1AccountCheckoutCreateBody.out.parse(request),
25
+ responseSchema: v1_account_checkout_create_response_1.Schemas$V1AccountCheckoutCreateResponse.in,
26
+ opts,
27
+ });
28
+ }
29
+ }
30
+ exports.CheckoutClient = CheckoutClient;
@@ -1 +1,2 @@
1
+ export * as checkout from "./checkout";
1
2
  export { AccountClient } from "./resource-client";
@@ -1,5 +1,39 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AccountClient = void 0;
36
+ exports.AccountClient = exports.checkout = void 0;
37
+ exports.checkout = __importStar(require("./checkout"));
4
38
  var resource_client_1 = require("./resource-client");
5
39
  Object.defineProperty(exports, "AccountClient", { enumerable: true, get: function () { return resource_client_1.AccountClient; } });
@@ -1,6 +1,8 @@
1
1
  import { ApiPromise, CoreClient, CoreResourceClient, RequestOptions, ResourceClientOptions } from "make-api-request-js";
2
+ import { CheckoutClient } from "./checkout/index.js";
2
3
  import * as types from "../../../types/index.js";
3
4
  export declare class AccountClient extends CoreResourceClient {
5
+ private _checkoutLazy?;
4
6
  constructor(coreClient: CoreClient, opts: ResourceClientOptions);
5
7
  /**
6
8
  * Get account details
@@ -10,4 +12,5 @@ export declare class AccountClient extends CoreResourceClient {
10
12
  * GET /v1/account
11
13
  */
12
14
  list(opts?: RequestOptions): ApiPromise<types.V1AccountListResponse>;
15
+ get checkout(): CheckoutClient;
13
16
  }
@@ -6,6 +6,9 @@ const v1_account_list_response_1 = require("../../../types/v1-account-list-respo
6
6
  class AccountClient extends make_api_request_js_1.CoreResourceClient {
7
7
  constructor(coreClient, opts) {
8
8
  super(coreClient, opts);
9
+ if (this._opts.lazyLoad === false) {
10
+ this.checkout;
11
+ }
9
12
  }
10
13
  /**
11
14
  * Get account details
@@ -23,5 +26,9 @@ class AccountClient extends make_api_request_js_1.CoreResourceClient {
23
26
  opts,
24
27
  });
25
28
  }
29
+ get checkout() {
30
+ var _a;
31
+ return ((_a = this._checkoutLazy) !== null && _a !== void 0 ? _a : (this._checkoutLazy = new (require("./checkout").CheckoutClient)(this._client, this._opts)));
32
+ }
26
33
  }
27
34
  exports.AccountClient = AccountClient;
@@ -1,3 +1,6 @@
1
+ export { V1AccountCheckoutCreateBody } from "./v1-account-checkout-create-body";
2
+ export { V1AccountCheckoutCreateBodyTypeEnum } from "./v1-account-checkout-create-body-type-enum";
3
+ export { V1AccountCheckoutCreateResponse } from "./v1-account-checkout-create-response";
1
4
  export { V1AccountListResponse } from "./v1-account-list-response";
2
5
  export { V1AccountListResponseSubscription } from "./v1-account-list-response-subscription";
3
6
  export { V1AccountListResponseSubscriptionBillingIntervalEnum } from "./v1-account-list-response-subscription-billing-interval-enum";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * What to buy. `credit_pack` is a one-time credit purchase.
3
+ */
4
+ export type V1AccountCheckoutCreateBodyTypeEnum = "credit_pack";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,32 @@
1
+ import * as z from "zod";
2
+ /**
3
+ * V1AccountCheckoutCreateBody
4
+ */
5
+ export type V1AccountCheckoutCreateBody = {
6
+ /**
7
+ * Credits a blocked request is missing, e.g. `credit_shortfall` from a 402 response. The checkout starts with enough packs to cover it. Defaults to one pack.
8
+ */
9
+ creditShortfall?: number | undefined;
10
+ /**
11
+ * Number of credit packs the checkout starts with. Takes priority over `credit_shortfall`.
12
+ */
13
+ packCount?: number | undefined;
14
+ /**
15
+ * What to buy. `credit_pack` is a one-time credit purchase.
16
+ */
17
+ type: "credit_pack";
18
+ };
19
+ /**
20
+ * @internal
21
+ * V1AccountCheckoutCreateBody without any key transformation, this is what
22
+ * we expect to come in as network data
23
+ */
24
+ export type External$V1AccountCheckoutCreateBody = {
25
+ credit_shortfall?: number | undefined;
26
+ pack_count?: number | undefined;
27
+ type: "credit_pack";
28
+ };
29
+ export declare const Schemas$V1AccountCheckoutCreateBody: {
30
+ in: z.ZodType<V1AccountCheckoutCreateBody, z.ZodTypeDef, unknown>;
31
+ out: z.ZodType<External$V1AccountCheckoutCreateBody, z.ZodTypeDef, V1AccountCheckoutCreateBody>;
32
+ };
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Schemas$V1AccountCheckoutCreateBody = void 0;
37
+ const make_api_request_js_1 = require("make-api-request-js");
38
+ const z = __importStar(require("zod"));
39
+ /**
40
+ * Takes network data, validates it, and transforms keys to match typescript object V1AccountCheckoutCreateBody
41
+ */
42
+ const SchemaIn$V1AccountCheckoutCreateBody = z
43
+ .object({
44
+ credit_shortfall: z.number().optional(),
45
+ pack_count: z.number().int().optional(),
46
+ type: z.enum(["credit_pack"]),
47
+ })
48
+ .transform((obj) => {
49
+ return (0, make_api_request_js_1.zodTransform)(obj, {
50
+ credit_shortfall: "creditShortfall",
51
+ pack_count: "packCount",
52
+ type: "type",
53
+ });
54
+ });
55
+ /**
56
+ * @internal
57
+ * Takes typescript data, validates it, and maps keys to match the expected external object External$V1AccountCheckoutCreateBody
58
+ */
59
+ const SchemaOut$V1AccountCheckoutCreateBody = z
60
+ .object({
61
+ creditShortfall: z.number().optional(),
62
+ packCount: z.number().int().optional(),
63
+ type: z.enum(["credit_pack"]),
64
+ })
65
+ .transform((obj) => {
66
+ return (0, make_api_request_js_1.zodTransform)(obj, {
67
+ creditShortfall: "credit_shortfall",
68
+ packCount: "pack_count",
69
+ type: "type",
70
+ });
71
+ });
72
+ exports.Schemas$V1AccountCheckoutCreateBody = {
73
+ in: SchemaIn$V1AccountCheckoutCreateBody,
74
+ out: SchemaOut$V1AccountCheckoutCreateBody,
75
+ };
@@ -0,0 +1,22 @@
1
+ import * as z from "zod";
2
+ /**
3
+ * V1AccountCheckoutCreateResponse
4
+ */
5
+ export type V1AccountCheckoutCreateResponse = {
6
+ /**
7
+ * Open in a browser to complete the purchase.
8
+ */
9
+ checkoutUrl: string;
10
+ };
11
+ /**
12
+ * @internal
13
+ * V1AccountCheckoutCreateResponse without any key transformation, this is what
14
+ * we expect to come in as network data
15
+ */
16
+ export type External$V1AccountCheckoutCreateResponse = {
17
+ checkout_url: string;
18
+ };
19
+ export declare const Schemas$V1AccountCheckoutCreateResponse: {
20
+ in: z.ZodType<V1AccountCheckoutCreateResponse, z.ZodTypeDef, unknown>;
21
+ out: z.ZodType<External$V1AccountCheckoutCreateResponse, z.ZodTypeDef, V1AccountCheckoutCreateResponse>;
22
+ };
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Schemas$V1AccountCheckoutCreateResponse = void 0;
37
+ const make_api_request_js_1 = require("make-api-request-js");
38
+ const z = __importStar(require("zod"));
39
+ /**
40
+ * Takes network data, validates it, and transforms keys to match typescript object V1AccountCheckoutCreateResponse
41
+ */
42
+ const SchemaIn$V1AccountCheckoutCreateResponse = z
43
+ .object({
44
+ checkout_url: z.string(),
45
+ })
46
+ .transform((obj) => {
47
+ return (0, make_api_request_js_1.zodTransform)(obj, {
48
+ checkout_url: "checkoutUrl",
49
+ });
50
+ });
51
+ /**
52
+ * @internal
53
+ * Takes typescript data, validates it, and maps keys to match the expected external object External$V1AccountCheckoutCreateResponse
54
+ */
55
+ const SchemaOut$V1AccountCheckoutCreateResponse = z
56
+ .object({
57
+ checkoutUrl: z.string(),
58
+ })
59
+ .transform((obj) => {
60
+ return (0, make_api_request_js_1.zodTransform)(obj, {
61
+ checkoutUrl: "checkout_url",
62
+ });
63
+ });
64
+ exports.Schemas$V1AccountCheckoutCreateResponse = {
65
+ in: SchemaIn$V1AccountCheckoutCreateResponse,
66
+ out: SchemaOut$V1AccountCheckoutCreateResponse,
67
+ };
@@ -15,7 +15,7 @@ export type V1ImageToVideoCreateBodyAssets = {
15
15
  * * **`seedance-1.5`**: Supports 480p, 720p, 1080p.
16
16
  * * **`seedance-2.0`**: Supports 480p, 720p, 1080p, 4k.
17
17
  * * **`seedance-2.0-fast`**: Supports 480p, 720p.
18
- * * **`seedance-2.0-mini`**: Supports 480p, 720p.
18
+ * * **`seedance-2.0-mini`**: Not supported
19
19
  * * **`seedance-2.5`**: Supports 480p, 720p, 1080p, 4k.
20
20
  * * **`veo3.1`**: Supports 720p, 1080p. Requires a duration of 8 seconds or less.
21
21
  * * **`veo3.1-lite`**: Supports 720p, 1080p. Requires a duration of 8 seconds or less.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "magic-hour",
3
- "version": "0.97.1",
3
+ "version": "0.98.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {