magic-hour 0.35.0 → 0.37.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 (256) hide show
  1. package/README.md +208 -10
  2. package/dist/client.js +2 -2
  3. package/dist/core/api-error.d.ts +1 -1
  4. package/dist/core/api-promise.d.ts +2 -2
  5. package/dist/core/api-promise.js +2 -1
  6. package/dist/core/auth.d.ts +1 -1
  7. package/dist/core/auth.js +1 -1
  8. package/dist/core/binary-response.d.ts +1 -1
  9. package/dist/core/core-client.d.ts +5 -5
  10. package/dist/core/core-client.js +2 -5
  11. package/dist/core/form-data.d.ts +1 -1
  12. package/dist/core/zod.d.ts +1 -1
  13. package/dist/core/zod.js +1 -1
  14. package/dist/environment.d.ts +1 -1
  15. package/dist/environment.js +1 -1
  16. package/dist/helpers/download.d.ts +5 -0
  17. package/dist/helpers/download.js +88 -0
  18. package/dist/helpers/generate-type.d.ts +51 -0
  19. package/dist/helpers/generate-type.js +2 -0
  20. package/dist/helpers/sleep.d.ts +4 -0
  21. package/dist/helpers/sleep.js +9 -0
  22. package/dist/logger.d.ts +48 -0
  23. package/dist/logger.js +97 -0
  24. package/dist/resources/v1/ai-clothes-changer/request-types.d.ts +1 -1
  25. package/dist/resources/v1/ai-clothes-changer/request-types.js +1 -1
  26. package/dist/resources/v1/ai-clothes-changer/resource-client.d.ts +50 -0
  27. package/dist/resources/v1/ai-clothes-changer/resource-client.js +75 -0
  28. package/dist/resources/v1/ai-face-editor/request-types.d.ts +1 -1
  29. package/dist/resources/v1/ai-face-editor/request-types.js +1 -1
  30. package/dist/resources/v1/ai-face-editor/resource-client.d.ts +55 -0
  31. package/dist/resources/v1/ai-face-editor/resource-client.js +85 -0
  32. package/dist/resources/v1/ai-gif-generator/request-types.d.ts +1 -1
  33. package/dist/resources/v1/ai-gif-generator/request-types.js +1 -1
  34. package/dist/resources/v1/ai-gif-generator/resource-client.d.ts +29 -0
  35. package/dist/resources/v1/ai-gif-generator/resource-client.js +60 -0
  36. package/dist/resources/v1/ai-headshot-generator/request-types.d.ts +1 -1
  37. package/dist/resources/v1/ai-headshot-generator/request-types.js +1 -1
  38. package/dist/resources/v1/ai-headshot-generator/resource-client.d.ts +38 -0
  39. package/dist/resources/v1/ai-headshot-generator/resource-client.js +68 -0
  40. package/dist/resources/v1/ai-image-editor/request-types.d.ts +1 -1
  41. package/dist/resources/v1/ai-image-editor/request-types.js +1 -1
  42. package/dist/resources/v1/ai-image-editor/resource-client.d.ts +39 -0
  43. package/dist/resources/v1/ai-image-editor/resource-client.js +69 -0
  44. package/dist/resources/v1/ai-image-generator/request-types.d.ts +1 -1
  45. package/dist/resources/v1/ai-image-generator/request-types.js +1 -1
  46. package/dist/resources/v1/ai-image-generator/resource-client.d.ts +31 -0
  47. package/dist/resources/v1/ai-image-generator/resource-client.js +62 -0
  48. package/dist/resources/v1/ai-image-upscaler/request-types.d.ts +1 -1
  49. package/dist/resources/v1/ai-image-upscaler/request-types.js +1 -1
  50. package/dist/resources/v1/ai-image-upscaler/resource-client.d.ts +40 -0
  51. package/dist/resources/v1/ai-image-upscaler/resource-client.js +70 -0
  52. package/dist/resources/v1/ai-meme-generator/request-types.d.ts +1 -1
  53. package/dist/resources/v1/ai-meme-generator/request-types.js +1 -1
  54. package/dist/resources/v1/ai-meme-generator/resource-client.d.ts +33 -0
  55. package/dist/resources/v1/ai-meme-generator/resource-client.js +64 -0
  56. package/dist/resources/v1/ai-photo-editor/request-types.d.ts +1 -1
  57. package/dist/resources/v1/ai-photo-editor/request-types.js +1 -1
  58. package/dist/resources/v1/ai-photo-editor/resource-client.d.ts +49 -0
  59. package/dist/resources/v1/ai-photo-editor/resource-client.js +79 -0
  60. package/dist/resources/v1/ai-qr-code-generator/request-types.d.ts +1 -1
  61. package/dist/resources/v1/ai-qr-code-generator/request-types.js +1 -1
  62. package/dist/resources/v1/ai-qr-code-generator/resource-client.d.ts +30 -0
  63. package/dist/resources/v1/ai-qr-code-generator/resource-client.js +61 -0
  64. package/dist/resources/v1/ai-talking-photo/request-types.d.ts +1 -1
  65. package/dist/resources/v1/ai-talking-photo/request-types.js +1 -1
  66. package/dist/resources/v1/ai-talking-photo/resource-client.d.ts +51 -0
  67. package/dist/resources/v1/ai-talking-photo/resource-client.js +76 -0
  68. package/dist/resources/v1/animation/request-types.d.ts +1 -1
  69. package/dist/resources/v1/animation/request-types.js +1 -1
  70. package/dist/resources/v1/animation/resource-client.d.ts +61 -0
  71. package/dist/resources/v1/animation/resource-client.js +98 -0
  72. package/dist/resources/v1/auto-subtitle-generator/request-types.d.ts +1 -1
  73. package/dist/resources/v1/auto-subtitle-generator/request-types.js +1 -1
  74. package/dist/resources/v1/auto-subtitle-generator/resource-client.d.ts +41 -0
  75. package/dist/resources/v1/auto-subtitle-generator/resource-client.js +71 -0
  76. package/dist/resources/v1/face-detection/request-types.d.ts +1 -1
  77. package/dist/resources/v1/face-detection/request-types.js +1 -1
  78. package/dist/resources/v1/face-detection/resource-client.d.ts +30 -0
  79. package/dist/resources/v1/face-detection/resource-client.js +75 -0
  80. package/dist/resources/v1/face-swap/request-types.d.ts +7 -1
  81. package/dist/resources/v1/face-swap/request-types.js +6 -1
  82. package/dist/resources/v1/face-swap/resource-client.d.ts +77 -0
  83. package/dist/resources/v1/face-swap/resource-client.js +125 -0
  84. package/dist/resources/v1/face-swap-photo/request-types.d.ts +1 -1
  85. package/dist/resources/v1/face-swap-photo/request-types.js +1 -1
  86. package/dist/resources/v1/face-swap-photo/resource-client.d.ts +73 -0
  87. package/dist/resources/v1/face-swap-photo/resource-client.js +117 -0
  88. package/dist/resources/v1/files/resource-client.d.ts +40 -0
  89. package/dist/resources/v1/files/resource-client.js +236 -0
  90. package/dist/resources/v1/files/resource-client.test.d.ts +1 -0
  91. package/dist/resources/v1/files/resource-client.test.js +422 -0
  92. package/dist/resources/v1/files/upload-urls/request-types.d.ts +1 -1
  93. package/dist/resources/v1/files/upload-urls/request-types.js +1 -1
  94. package/dist/resources/v1/image-background-remover/request-types.d.ts +1 -1
  95. package/dist/resources/v1/image-background-remover/request-types.js +1 -1
  96. package/dist/resources/v1/image-background-remover/resource-client.d.ts +49 -0
  97. package/dist/resources/v1/image-background-remover/resource-client.js +82 -0
  98. package/dist/resources/v1/image-projects/request-types.js +1 -1
  99. package/dist/resources/v1/image-projects/resource-client.d.ts +22 -0
  100. package/dist/resources/v1/image-projects/resource-client.js +68 -0
  101. package/dist/resources/v1/image-projects/resource-client.test.d.ts +1 -0
  102. package/dist/resources/v1/image-projects/resource-client.test.js +538 -0
  103. package/dist/resources/v1/image-to-video/request-types.d.ts +1 -1
  104. package/dist/resources/v1/image-to-video/request-types.js +1 -1
  105. package/dist/resources/v1/image-to-video/resource-client.d.ts +40 -0
  106. package/dist/resources/v1/image-to-video/resource-client.js +70 -0
  107. package/dist/resources/v1/lip-sync/request-types.d.ts +1 -1
  108. package/dist/resources/v1/lip-sync/request-types.js +1 -1
  109. package/dist/resources/v1/lip-sync/resource-client.d.ts +53 -0
  110. package/dist/resources/v1/lip-sync/resource-client.js +84 -0
  111. package/dist/resources/v1/photo-colorizer/request-types.d.ts +1 -1
  112. package/dist/resources/v1/photo-colorizer/request-types.js +1 -1
  113. package/dist/resources/v1/photo-colorizer/resource-client.d.ts +38 -0
  114. package/dist/resources/v1/photo-colorizer/resource-client.js +68 -0
  115. package/dist/resources/v1/resource-client.js +3 -3
  116. package/dist/resources/v1/text-to-video/request-types.d.ts +1 -1
  117. package/dist/resources/v1/text-to-video/request-types.js +1 -1
  118. package/dist/resources/v1/text-to-video/resource-client.d.ts +32 -0
  119. package/dist/resources/v1/text-to-video/resource-client.js +63 -0
  120. package/dist/resources/v1/video-projects/request-types.js +1 -1
  121. package/dist/resources/v1/video-projects/resource-client.d.ts +22 -0
  122. package/dist/resources/v1/video-projects/resource-client.js +68 -0
  123. package/dist/resources/v1/video-projects/resource-client.test.d.ts +1 -0
  124. package/dist/resources/v1/video-projects/resource-client.test.js +713 -0
  125. package/dist/resources/v1/video-to-video/request-types.d.ts +1 -1
  126. package/dist/resources/v1/video-to-video/request-types.js +1 -1
  127. package/dist/resources/v1/video-to-video/resource-client.d.ts +48 -0
  128. package/dist/resources/v1/video-to-video/resource-client.js +84 -0
  129. package/dist/types/index.d.ts +2 -0
  130. package/dist/types/v1-ai-clothes-changer-create-body-assets.js +1 -1
  131. package/dist/types/v1-ai-clothes-changer-create-body.d.ts +1 -1
  132. package/dist/types/v1-ai-clothes-changer-create-body.js +2 -2
  133. package/dist/types/v1-ai-clothes-changer-create-response.js +1 -1
  134. package/dist/types/v1-ai-face-editor-create-body-assets.js +1 -1
  135. package/dist/types/v1-ai-face-editor-create-body-style.js +1 -1
  136. package/dist/types/v1-ai-face-editor-create-body.d.ts +1 -1
  137. package/dist/types/v1-ai-face-editor-create-body.js +2 -2
  138. package/dist/types/v1-ai-face-editor-create-response.js +1 -1
  139. package/dist/types/v1-ai-gif-generator-create-body-style.js +1 -1
  140. package/dist/types/v1-ai-gif-generator-create-body.d.ts +1 -1
  141. package/dist/types/v1-ai-gif-generator-create-body.js +2 -2
  142. package/dist/types/v1-ai-gif-generator-create-response.js +1 -1
  143. package/dist/types/v1-ai-headshot-generator-create-body-assets.js +1 -1
  144. package/dist/types/v1-ai-headshot-generator-create-body-style.js +1 -1
  145. package/dist/types/v1-ai-headshot-generator-create-body.d.ts +1 -1
  146. package/dist/types/v1-ai-headshot-generator-create-body.js +2 -2
  147. package/dist/types/v1-ai-headshot-generator-create-response.js +1 -1
  148. package/dist/types/v1-ai-image-editor-create-body-assets.js +1 -1
  149. package/dist/types/v1-ai-image-editor-create-body-style.js +1 -1
  150. package/dist/types/v1-ai-image-editor-create-body.d.ts +1 -1
  151. package/dist/types/v1-ai-image-editor-create-body.js +2 -2
  152. package/dist/types/v1-ai-image-editor-create-response.js +1 -1
  153. package/dist/types/v1-ai-image-generator-create-body-style.js +1 -1
  154. package/dist/types/v1-ai-image-generator-create-body.d.ts +1 -1
  155. package/dist/types/v1-ai-image-generator-create-body.js +2 -2
  156. package/dist/types/v1-ai-image-generator-create-response.js +1 -1
  157. package/dist/types/v1-ai-image-upscaler-create-body-assets.js +1 -1
  158. package/dist/types/v1-ai-image-upscaler-create-body-style.js +1 -1
  159. package/dist/types/v1-ai-image-upscaler-create-body.d.ts +1 -1
  160. package/dist/types/v1-ai-image-upscaler-create-body.js +2 -2
  161. package/dist/types/v1-ai-image-upscaler-create-response.js +1 -1
  162. package/dist/types/v1-ai-meme-generator-create-body-style.js +1 -1
  163. package/dist/types/v1-ai-meme-generator-create-body.d.ts +1 -1
  164. package/dist/types/v1-ai-meme-generator-create-body.js +2 -2
  165. package/dist/types/v1-ai-meme-generator-create-response.js +1 -1
  166. package/dist/types/v1-ai-photo-editor-create-body-assets.js +1 -1
  167. package/dist/types/v1-ai-photo-editor-create-body-style.js +1 -1
  168. package/dist/types/v1-ai-photo-editor-create-body.d.ts +1 -1
  169. package/dist/types/v1-ai-photo-editor-create-body.js +2 -2
  170. package/dist/types/v1-ai-photo-editor-create-response.js +1 -1
  171. package/dist/types/v1-ai-qr-code-generator-create-body-style.js +1 -1
  172. package/dist/types/v1-ai-qr-code-generator-create-body.d.ts +1 -1
  173. package/dist/types/v1-ai-qr-code-generator-create-body.js +2 -2
  174. package/dist/types/v1-ai-qr-code-generator-create-response.js +1 -1
  175. package/dist/types/v1-ai-talking-photo-create-body-assets.js +1 -1
  176. package/dist/types/v1-ai-talking-photo-create-body-style.js +1 -1
  177. package/dist/types/v1-ai-talking-photo-create-body.d.ts +1 -1
  178. package/dist/types/v1-ai-talking-photo-create-body.js +2 -2
  179. package/dist/types/v1-ai-talking-photo-create-response.js +1 -1
  180. package/dist/types/v1-animation-create-body-assets.js +1 -1
  181. package/dist/types/v1-animation-create-body-style.js +1 -1
  182. package/dist/types/v1-animation-create-body.d.ts +1 -1
  183. package/dist/types/v1-animation-create-body.js +2 -2
  184. package/dist/types/v1-animation-create-response.js +1 -1
  185. package/dist/types/v1-auto-subtitle-generator-create-body-assets.js +1 -1
  186. package/dist/types/v1-auto-subtitle-generator-create-body-style-custom-config.js +1 -1
  187. package/dist/types/v1-auto-subtitle-generator-create-body-style.d.ts +1 -1
  188. package/dist/types/v1-auto-subtitle-generator-create-body-style.js +2 -2
  189. package/dist/types/v1-auto-subtitle-generator-create-body.d.ts +1 -1
  190. package/dist/types/v1-auto-subtitle-generator-create-body.js +2 -2
  191. package/dist/types/v1-auto-subtitle-generator-create-response.js +1 -1
  192. package/dist/types/v1-face-detection-create-body-assets.js +1 -1
  193. package/dist/types/v1-face-detection-create-body.d.ts +1 -1
  194. package/dist/types/v1-face-detection-create-body.js +2 -2
  195. package/dist/types/v1-face-detection-create-response.js +1 -1
  196. package/dist/types/v1-face-detection-get-response-faces-item.js +1 -1
  197. package/dist/types/v1-face-detection-get-response.d.ts +1 -1
  198. package/dist/types/v1-face-detection-get-response.js +2 -2
  199. package/dist/types/v1-face-swap-create-body-assets-face-mappings-item.js +1 -1
  200. package/dist/types/v1-face-swap-create-body-assets.d.ts +1 -1
  201. package/dist/types/v1-face-swap-create-body-assets.js +2 -2
  202. package/dist/types/v1-face-swap-create-body-style-version-enum.d.ts +6 -0
  203. package/dist/types/v1-face-swap-create-body-style-version-enum.js +2 -0
  204. package/dist/types/v1-face-swap-create-body-style.d.ts +24 -0
  205. package/dist/types/v1-face-swap-create-body-style.js +67 -0
  206. package/dist/types/v1-face-swap-create-body.d.ts +7 -1
  207. package/dist/types/v1-face-swap-create-body.js +7 -2
  208. package/dist/types/v1-face-swap-create-response.js +1 -1
  209. package/dist/types/v1-face-swap-photo-create-body-assets-face-mappings-item.js +1 -1
  210. package/dist/types/v1-face-swap-photo-create-body-assets.d.ts +1 -1
  211. package/dist/types/v1-face-swap-photo-create-body-assets.js +2 -2
  212. package/dist/types/v1-face-swap-photo-create-body.d.ts +1 -1
  213. package/dist/types/v1-face-swap-photo-create-body.js +2 -2
  214. package/dist/types/v1-face-swap-photo-create-response.js +1 -1
  215. package/dist/types/v1-files-upload-urls-create-body-items-item.js +1 -1
  216. package/dist/types/v1-files-upload-urls-create-body.d.ts +1 -1
  217. package/dist/types/v1-files-upload-urls-create-body.js +2 -2
  218. package/dist/types/v1-files-upload-urls-create-response-items-item.js +1 -1
  219. package/dist/types/v1-files-upload-urls-create-response.d.ts +1 -1
  220. package/dist/types/v1-files-upload-urls-create-response.js +2 -2
  221. package/dist/types/v1-image-background-remover-create-body-assets.js +1 -1
  222. package/dist/types/v1-image-background-remover-create-body.d.ts +1 -1
  223. package/dist/types/v1-image-background-remover-create-body.js +2 -2
  224. package/dist/types/v1-image-background-remover-create-response.js +1 -1
  225. package/dist/types/v1-image-projects-get-response-downloads-item.js +1 -1
  226. package/dist/types/v1-image-projects-get-response-error.js +1 -1
  227. package/dist/types/v1-image-projects-get-response.d.ts +1 -1
  228. package/dist/types/v1-image-projects-get-response.js +2 -2
  229. package/dist/types/v1-image-to-video-create-body-assets.js +1 -1
  230. package/dist/types/v1-image-to-video-create-body-style.js +1 -1
  231. package/dist/types/v1-image-to-video-create-body.d.ts +1 -1
  232. package/dist/types/v1-image-to-video-create-body.js +2 -2
  233. package/dist/types/v1-image-to-video-create-response.js +1 -1
  234. package/dist/types/v1-lip-sync-create-body-assets.js +1 -1
  235. package/dist/types/v1-lip-sync-create-body.d.ts +1 -1
  236. package/dist/types/v1-lip-sync-create-body.js +2 -2
  237. package/dist/types/v1-lip-sync-create-response.js +1 -1
  238. package/dist/types/v1-photo-colorizer-create-body-assets.js +1 -1
  239. package/dist/types/v1-photo-colorizer-create-body.d.ts +1 -1
  240. package/dist/types/v1-photo-colorizer-create-body.js +2 -2
  241. package/dist/types/v1-photo-colorizer-create-response.js +1 -1
  242. package/dist/types/v1-text-to-video-create-body-style.js +1 -1
  243. package/dist/types/v1-text-to-video-create-body.d.ts +1 -1
  244. package/dist/types/v1-text-to-video-create-body.js +2 -2
  245. package/dist/types/v1-text-to-video-create-response.js +1 -1
  246. package/dist/types/v1-video-projects-get-response-download.js +1 -1
  247. package/dist/types/v1-video-projects-get-response-downloads-item.js +1 -1
  248. package/dist/types/v1-video-projects-get-response-error.js +1 -1
  249. package/dist/types/v1-video-projects-get-response.d.ts +1 -1
  250. package/dist/types/v1-video-projects-get-response.js +2 -2
  251. package/dist/types/v1-video-to-video-create-body-assets.js +1 -1
  252. package/dist/types/v1-video-to-video-create-body-style.js +1 -1
  253. package/dist/types/v1-video-to-video-create-body.d.ts +1 -1
  254. package/dist/types/v1-video-to-video-create-body.js +2 -2
  255. package/dist/types/v1-video-to-video-create-response.js +1 -1
  256. package/package.json +14 -9
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Logging levels for the SDK
3
+ */
4
+ export declare const LogLevel: {
5
+ readonly none: 0;
6
+ readonly error: 1;
7
+ readonly warn: 2;
8
+ readonly info: 3;
9
+ readonly debug: 4;
10
+ };
11
+ export type PossibleLogLevel = keyof typeof LogLevel;
12
+ /**
13
+ * Logger interface for the Magic Hour SDK
14
+ */
15
+ export interface Logger {
16
+ /**
17
+ * Log an error message
18
+ */
19
+ error(message: string, ...args: any[]): void;
20
+ /**
21
+ * Log a warning message
22
+ */
23
+ warn(message: string, ...args: any[]): void;
24
+ /**
25
+ * Log an info message
26
+ */
27
+ info(message: string, ...args: any[]): void;
28
+ /**
29
+ * Log a debug message
30
+ */
31
+ debug(message: string, ...args: any[]): void;
32
+ }
33
+ /**
34
+ * Configuration options for the logger
35
+ */
36
+ export interface LoggerConfig {
37
+ level: PossibleLogLevel;
38
+ }
39
+ /**
40
+ * Default logger configuration
41
+ */
42
+ export declare const DEFAULT_LOGGER_CONFIG: LoggerConfig;
43
+ /**
44
+ * Create a logger instance based on configuration
45
+ *
46
+ */
47
+ export declare function setupLogger(config: LoggerConfig): Logger;
48
+ export declare function getLogger(): Logger;
package/dist/logger.js ADDED
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_LOGGER_CONFIG = exports.LogLevel = void 0;
4
+ exports.setupLogger = setupLogger;
5
+ exports.getLogger = getLogger;
6
+ /**
7
+ * Logging levels for the SDK
8
+ */
9
+ exports.LogLevel = {
10
+ none: 0,
11
+ error: 1,
12
+ warn: 2,
13
+ info: 3,
14
+ debug: 4,
15
+ };
16
+ const logLevelOrder = ["none", "error", "warn", "info", "debug"];
17
+ /**
18
+ * Default logger implementation using console
19
+ */
20
+ class ConsoleLogger {
21
+ constructor(config) {
22
+ this.config = config;
23
+ }
24
+ shouldLog(level) {
25
+ return (logLevelOrder.indexOf(level) <= logLevelOrder.indexOf(this.config.level));
26
+ }
27
+ formatMessage(level, message) {
28
+ const timestamp = `[${new Date().toISOString()}]`;
29
+ const levelStr = `[${level.toUpperCase()}]`;
30
+ return [timestamp, levelStr, message].join(" ");
31
+ }
32
+ error(message, ...args) {
33
+ if (this.shouldLog("error")) {
34
+ console.error(this.formatMessage("error", message), ...args);
35
+ }
36
+ }
37
+ warn(message, ...args) {
38
+ if (this.shouldLog("warn")) {
39
+ console.warn(this.formatMessage("warn", message), ...args);
40
+ }
41
+ }
42
+ info(message, ...args) {
43
+ if (this.shouldLog("info")) {
44
+ console.info(this.formatMessage("info", message), ...args);
45
+ }
46
+ }
47
+ debug(message, ...args) {
48
+ if (this.shouldLog("debug")) {
49
+ console.debug(this.formatMessage("debug", message), ...args);
50
+ }
51
+ }
52
+ }
53
+ /**
54
+ * No-operation logger for when logging is disabled
55
+ */
56
+ class NoOpLogger {
57
+ error() { }
58
+ warn() { }
59
+ info() { }
60
+ debug() { }
61
+ }
62
+ /**
63
+ * Get log level from environment variable or default
64
+ */
65
+ function getLogLevelFromEnv() {
66
+ var _a;
67
+ const envLevel = (_a = process.env["MAGIC_HOUR_LOG_LEVEL"]) === null || _a === void 0 ? void 0 : _a.toLowerCase();
68
+ if (envLevel && envLevel in exports.LogLevel) {
69
+ return envLevel;
70
+ }
71
+ return "info";
72
+ }
73
+ /**
74
+ * Default logger configuration
75
+ */
76
+ exports.DEFAULT_LOGGER_CONFIG = {
77
+ level: "info",
78
+ };
79
+ /**
80
+ * Create a logger instance based on configuration
81
+ *
82
+ */
83
+ function setupLogger(config) {
84
+ globalForLogger.logger =
85
+ config.level === "none" ? new NoOpLogger() : new ConsoleLogger(config);
86
+ return globalForLogger.logger;
87
+ }
88
+ const globalForLogger = globalThis;
89
+ function getLogger() {
90
+ if (!globalForLogger.logger) {
91
+ const config = {
92
+ level: getLogLevelFromEnv(),
93
+ };
94
+ globalForLogger.logger = setupLogger(config);
95
+ }
96
+ return globalForLogger.logger;
97
+ }
@@ -1,5 +1,5 @@
1
- import { External$V1AiClothesChangerCreateBodyAssets, V1AiClothesChangerCreateBodyAssets } from "../../../types/v1-ai-clothes-changer-create-body-assets";
2
1
  import * as z from "zod";
2
+ import { External$V1AiClothesChangerCreateBodyAssets, V1AiClothesChangerCreateBodyAssets } from "../../../types/v1-ai-clothes-changer-create-body-assets";
3
3
  /**
4
4
  * CreateRequest
5
5
  */
@@ -34,9 +34,9 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.Schemas$CreateRequest = void 0;
37
+ const z = __importStar(require("zod"));
37
38
  const core_1 = require("../../../core");
38
39
  const v1_ai_clothes_changer_create_body_assets_1 = require("../../../types/v1-ai-clothes-changer-create-body-assets");
39
- const z = __importStar(require("zod"));
40
40
  /**
41
41
  * Takes network data, validates it, and transforms keys to match typescript object CreateRequest
42
42
  */
@@ -1,8 +1,57 @@
1
1
  import { types } from "../../../index.js";
2
2
  import { ApiPromise, CoreClient, CoreResourceClient, RequestOptions, ResourceClientOptions } from "../../../core";
3
+ import { GenerateOptions, GenerateRequestType } from "../../../helpers/generate-type";
3
4
  import * as requests from "../../../resources/v1/ai-clothes-changer/request-types";
5
+ type GenerateRequest = GenerateRequestType<requests.CreateRequest, {
6
+ /**
7
+ * The image of the outfit. This value is either
8
+ * - a direct URL to the image file
9
+ * - a path to a local file
10
+ *
11
+ * Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
12
+ */
13
+ garmentFilePath: string;
14
+ /**
15
+ * The image with the person. This value is either
16
+ * - a direct URL to the image file
17
+ * - a path to a local file
18
+ *
19
+ * Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
20
+ */
21
+ personFilePath: string;
22
+ }>;
4
23
  export declare class AiClothesChangerClient extends CoreResourceClient {
5
24
  constructor(coreClient: CoreClient, opts: ResourceClientOptions);
25
+ /**
26
+ * AI Clothes Changer
27
+ *
28
+ * Change outfits in photos in seconds with just a photo reference
29
+ *
30
+ * This method provides a convenient way to create a request and automatically wait for completion and download outputs.
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * import Client from "../../../index.js";
35
+ *
36
+ * const client = new Client({ token: process.env["API_TOKEN"]!! });
37
+ * const res = await client.v1.aiClothesChanger.generate(
38
+ * {
39
+ * assets: {
40
+ * garmentFilePath: "/path/to/outfit.png",
41
+ * garmentType: "upper_body",
42
+ * personFilePath: "/path/to/model.png",
43
+ * },
44
+ * name: "Clothes Changer image",
45
+ * },
46
+ * {
47
+ * waitForCompletion: true,
48
+ * downloadOutputs: true,
49
+ * downloadDirectory: "outputs",
50
+ * },
51
+ * );
52
+ * ```
53
+ */
54
+ generate(request: GenerateRequest, opts?: GenerateOptions): Promise<import("../image-projects/resource-client").V1ImageProjectsGetResponseWithDownloads>;
6
55
  /**
7
56
  * AI Clothes Changer
8
57
  *
@@ -12,3 +61,4 @@ export declare class AiClothesChangerClient extends CoreResourceClient {
12
61
  */
13
62
  create(request: requests.CreateRequest, opts?: RequestOptions): ApiPromise<types.V1AiClothesChangerCreateResponse>;
14
63
  }
64
+ export {};
@@ -1,13 +1,88 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
2
22
  Object.defineProperty(exports, "__esModule", { value: true });
3
23
  exports.AiClothesChangerClient = void 0;
4
24
  const core_1 = require("../../../core");
25
+ const files_1 = require("../../../resources/v1/files");
5
26
  const v1_ai_clothes_changer_create_body_1 = require("../../../types/v1-ai-clothes-changer-create-body");
6
27
  const v1_ai_clothes_changer_create_response_1 = require("../../../types/v1-ai-clothes-changer-create-response");
28
+ const logger_1 = require("../../../logger");
29
+ const image_projects_1 = require("../../../resources/v1/image-projects");
7
30
  class AiClothesChangerClient extends core_1.CoreResourceClient {
8
31
  constructor(coreClient, opts) {
9
32
  super(coreClient, opts);
10
33
  }
34
+ /**
35
+ * AI Clothes Changer
36
+ *
37
+ * Change outfits in photos in seconds with just a photo reference
38
+ *
39
+ * This method provides a convenient way to create a request and automatically wait for completion and download outputs.
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * import Client from "../../../index.js";
44
+ *
45
+ * const client = new Client({ token: process.env["API_TOKEN"]!! });
46
+ * const res = await client.v1.aiClothesChanger.generate(
47
+ * {
48
+ * assets: {
49
+ * garmentFilePath: "/path/to/outfit.png",
50
+ * garmentType: "upper_body",
51
+ * personFilePath: "/path/to/model.png",
52
+ * },
53
+ * name: "Clothes Changer image",
54
+ * },
55
+ * {
56
+ * waitForCompletion: true,
57
+ * downloadOutputs: true,
58
+ * downloadDirectory: "outputs",
59
+ * },
60
+ * );
61
+ * ```
62
+ */
63
+ generate(request_1) {
64
+ return __awaiter(this, arguments, void 0, function* (request, opts = {}) {
65
+ const { waitForCompletion = true, downloadOutputs = true, downloadDirectory = undefined } = opts, createOpts = __rest(opts, ["waitForCompletion", "downloadOutputs", "downloadDirectory"]);
66
+ const fileClient = new files_1.FilesClient(this._client, this._opts);
67
+ const _a = request.assets, { garmentFilePath, personFilePath } = _a, restAssets = __rest(_a, ["garmentFilePath", "personFilePath"]);
68
+ (0, logger_1.getLogger)().debug(`Uploading file ${garmentFilePath} to Magic Hour's storage`);
69
+ (0, logger_1.getLogger)().debug(`Uploading file ${personFilePath} to Magic Hour's storage`);
70
+ const [uploadedGarmentFilePath, uploadedPersonFilePath] = yield Promise.all([
71
+ fileClient.uploadFile(garmentFilePath),
72
+ fileClient.uploadFile(personFilePath),
73
+ ]);
74
+ (0, logger_1.getLogger)().info(`Uploaded file ${garmentFilePath} to Magic Hour's storage as ${uploadedGarmentFilePath}`);
75
+ (0, logger_1.getLogger)().info(`Uploaded file ${personFilePath} to Magic Hour's storage as ${uploadedPersonFilePath}`);
76
+ const createResponse = yield this.create(Object.assign(Object.assign({}, request), { assets: Object.assign(Object.assign({}, restAssets), { garmentFilePath: uploadedGarmentFilePath, personFilePath: uploadedPersonFilePath }) }), createOpts);
77
+ (0, logger_1.getLogger)().info(`Created AiClothesChangerClient project ${createResponse.id}`);
78
+ const projectsClient = new image_projects_1.ImageProjectsClient(this._client, this._opts);
79
+ (0, logger_1.getLogger)().debug(`Checking result for AiClothesChangerClient project ${createResponse.id}`);
80
+ const result = yield projectsClient.checkResult({ id: createResponse.id }, Object.assign({ waitForCompletion,
81
+ downloadOutputs,
82
+ downloadDirectory }, createOpts));
83
+ return result;
84
+ });
85
+ }
11
86
  /**
12
87
  * AI Clothes Changer
13
88
  *
@@ -1,6 +1,6 @@
1
+ import * as z from "zod";
1
2
  import { External$V1AiFaceEditorCreateBodyAssets, V1AiFaceEditorCreateBodyAssets } from "../../../types/v1-ai-face-editor-create-body-assets";
2
3
  import { External$V1AiFaceEditorCreateBodyStyle, V1AiFaceEditorCreateBodyStyle } from "../../../types/v1-ai-face-editor-create-body-style";
3
- import * as z from "zod";
4
4
  /**
5
5
  * CreateRequest
6
6
  */
@@ -34,10 +34,10 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.Schemas$CreateRequest = void 0;
37
+ const z = __importStar(require("zod"));
37
38
  const core_1 = require("../../../core");
38
39
  const v1_ai_face_editor_create_body_assets_1 = require("../../../types/v1-ai-face-editor-create-body-assets");
39
40
  const v1_ai_face_editor_create_body_style_1 = require("../../../types/v1-ai-face-editor-create-body-style");
40
- const z = __importStar(require("zod"));
41
41
  /**
42
42
  * Takes network data, validates it, and transforms keys to match typescript object CreateRequest
43
43
  */
@@ -1,8 +1,62 @@
1
1
  import { types } from "../../../index.js";
2
2
  import { ApiPromise, CoreClient, CoreResourceClient, RequestOptions, ResourceClientOptions } from "../../../core";
3
+ import { GenerateOptions, GenerateRequestType } from "../../../helpers/generate-type";
3
4
  import * as requests from "../../../resources/v1/ai-face-editor/request-types";
5
+ type GenerateRequest = GenerateRequestType<requests.CreateRequest, {
6
+ /**
7
+ * This is the image whose face will be edited. This value is either
8
+ * - a direct URL to the image file
9
+ * - a path to a local file
10
+ *
11
+ * Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
12
+ */
13
+ imageFilePath: string;
14
+ }>;
4
15
  export declare class AiFaceEditorClient extends CoreResourceClient {
5
16
  constructor(coreClient: CoreClient, opts: ResourceClientOptions);
17
+ /**
18
+ * AI Face Editor
19
+ *
20
+ * Edit facial features of an image using AI
21
+ *
22
+ * This method provides a convenient way to create a request and automatically wait for completion and download outputs.
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * import Client from "../../../index.js";
27
+ *
28
+ * const client = new Client({ token: process.env["API_TOKEN"]!! });
29
+ * const res = await client.v1.aiFaceEditor.generate(
30
+ * {
31
+ * assets: { imageFilePath: "/path/to/1234.png" },
32
+ * name: "Face Editor image",
33
+ * style: {
34
+ * enhanceFace: false,
35
+ * eyeGazeHorizontal: 0.0,
36
+ * eyeGazeVertical: 0.0,
37
+ * eyeOpenRatio: 0.0,
38
+ * eyebrowDirection: 0.0,
39
+ * headPitch: 0.0,
40
+ * headRoll: 0.0,
41
+ * headYaw: 0.0,
42
+ * lipOpenRatio: 0.0,
43
+ * mouthGrim: 0.0,
44
+ * mouthPositionHorizontal: 0.0,
45
+ * mouthPositionVertical: 0.0,
46
+ * mouthPout: 0.0,
47
+ * mouthPurse: 0.0,
48
+ * mouthSmile: 0.0,
49
+ * },
50
+ * },
51
+ * {
52
+ * waitForCompletion: true,
53
+ * downloadOutputs: true,
54
+ * downloadDirectory: "outputs",
55
+ * },
56
+ * );
57
+ * ```
58
+ */
59
+ generate(request: GenerateRequest, opts?: GenerateOptions): Promise<import("../image-projects/resource-client").V1ImageProjectsGetResponseWithDownloads>;
6
60
  /**
7
61
  * AI Face Editor
8
62
  *
@@ -12,3 +66,4 @@ export declare class AiFaceEditorClient extends CoreResourceClient {
12
66
  */
13
67
  create(request: requests.CreateRequest, opts?: RequestOptions): ApiPromise<types.V1AiFaceEditorCreateResponse>;
14
68
  }
69
+ export {};
@@ -1,13 +1,98 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
2
22
  Object.defineProperty(exports, "__esModule", { value: true });
3
23
  exports.AiFaceEditorClient = void 0;
4
24
  const core_1 = require("../../../core");
25
+ const files_1 = require("../../../resources/v1/files");
5
26
  const v1_ai_face_editor_create_body_1 = require("../../../types/v1-ai-face-editor-create-body");
6
27
  const v1_ai_face_editor_create_response_1 = require("../../../types/v1-ai-face-editor-create-response");
28
+ const logger_1 = require("../../../logger");
29
+ const image_projects_1 = require("../../../resources/v1/image-projects");
7
30
  class AiFaceEditorClient extends core_1.CoreResourceClient {
8
31
  constructor(coreClient, opts) {
9
32
  super(coreClient, opts);
10
33
  }
34
+ /**
35
+ * AI Face Editor
36
+ *
37
+ * Edit facial features of an image using AI
38
+ *
39
+ * This method provides a convenient way to create a request and automatically wait for completion and download outputs.
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * import Client from "../../../index.js";
44
+ *
45
+ * const client = new Client({ token: process.env["API_TOKEN"]!! });
46
+ * const res = await client.v1.aiFaceEditor.generate(
47
+ * {
48
+ * assets: { imageFilePath: "/path/to/1234.png" },
49
+ * name: "Face Editor image",
50
+ * style: {
51
+ * enhanceFace: false,
52
+ * eyeGazeHorizontal: 0.0,
53
+ * eyeGazeVertical: 0.0,
54
+ * eyeOpenRatio: 0.0,
55
+ * eyebrowDirection: 0.0,
56
+ * headPitch: 0.0,
57
+ * headRoll: 0.0,
58
+ * headYaw: 0.0,
59
+ * lipOpenRatio: 0.0,
60
+ * mouthGrim: 0.0,
61
+ * mouthPositionHorizontal: 0.0,
62
+ * mouthPositionVertical: 0.0,
63
+ * mouthPout: 0.0,
64
+ * mouthPurse: 0.0,
65
+ * mouthSmile: 0.0,
66
+ * },
67
+ * },
68
+ * {
69
+ * waitForCompletion: true,
70
+ * downloadOutputs: true,
71
+ * downloadDirectory: "outputs",
72
+ * },
73
+ * );
74
+ * ```
75
+ */
76
+ generate(request_1) {
77
+ return __awaiter(this, arguments, void 0, function* (request, opts = {}) {
78
+ const { waitForCompletion = true, downloadOutputs = true, downloadDirectory = undefined } = opts, createOpts = __rest(opts, ["waitForCompletion", "downloadOutputs", "downloadDirectory"]);
79
+ const fileClient = new files_1.FilesClient(this._client, this._opts);
80
+ const _a = request.assets, { imageFilePath } = _a, restAssets = __rest(_a, ["imageFilePath"]);
81
+ (0, logger_1.getLogger)().debug(`Uploading file ${imageFilePath} to Magic Hour's storage`);
82
+ const [uploadedImageFilePath] = yield Promise.all([
83
+ fileClient.uploadFile(imageFilePath),
84
+ ]);
85
+ (0, logger_1.getLogger)().info(`Uploaded file ${imageFilePath} to Magic Hour's storage as ${uploadedImageFilePath}`);
86
+ const createResponse = yield this.create(Object.assign(Object.assign({}, request), { assets: Object.assign(Object.assign({}, restAssets), { imageFilePath: uploadedImageFilePath }) }), createOpts);
87
+ (0, logger_1.getLogger)().info(`Created AiFaceEditorClient project ${createResponse.id}`);
88
+ const projectsClient = new image_projects_1.ImageProjectsClient(this._client, this._opts);
89
+ (0, logger_1.getLogger)().debug(`Checking result for AiFaceEditorClient project ${createResponse.id}`);
90
+ const result = yield projectsClient.checkResult({ id: createResponse.id }, Object.assign({ waitForCompletion,
91
+ downloadOutputs,
92
+ downloadDirectory }, createOpts));
93
+ return result;
94
+ });
95
+ }
11
96
  /**
12
97
  * AI Face Editor
13
98
  *
@@ -1,5 +1,5 @@
1
- import { External$V1AiGifGeneratorCreateBodyStyle, V1AiGifGeneratorCreateBodyStyle } from "../../../types/v1-ai-gif-generator-create-body-style";
2
1
  import * as z from "zod";
2
+ import { External$V1AiGifGeneratorCreateBodyStyle, V1AiGifGeneratorCreateBodyStyle } from "../../../types/v1-ai-gif-generator-create-body-style";
3
3
  /**
4
4
  * CreateRequest
5
5
  */
@@ -34,9 +34,9 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.Schemas$CreateRequest = void 0;
37
+ const z = __importStar(require("zod"));
37
38
  const core_1 = require("../../../core");
38
39
  const v1_ai_gif_generator_create_body_style_1 = require("../../../types/v1-ai-gif-generator-create-body-style");
39
- const z = __importStar(require("zod"));
40
40
  /**
41
41
  * Takes network data, validates it, and transforms keys to match typescript object CreateRequest
42
42
  */
@@ -1,8 +1,36 @@
1
1
  import { types } from "../../../index.js";
2
2
  import { ApiPromise, CoreClient, CoreResourceClient, RequestOptions, ResourceClientOptions } from "../../../core";
3
+ import { GenerateOptions, GenerateRequestType } from "../../../helpers/generate-type";
3
4
  import * as requests from "../../../resources/v1/ai-gif-generator/request-types";
5
+ type GenerateRequest = GenerateRequestType<requests.CreateRequest, {}>;
4
6
  export declare class AiGifGeneratorClient extends CoreResourceClient {
5
7
  constructor(coreClient: CoreClient, opts: ResourceClientOptions);
8
+ /**
9
+ * AI GIFs
10
+ *
11
+ * Create an AI GIF
12
+ *
13
+ * This method provides a convenient way to create a request and automatically wait for completion and download outputs.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * import Client from "../../../index.js";
18
+ *
19
+ * const client = new Client({ token: process.env["API_TOKEN"]!! });
20
+ * const res = await client.v1.aiGifGenerator.generate(
21
+ * {
22
+ * name: "Ai Gif gif",
23
+ * style: { prompt: "Cute dancing cat, pixel art" },
24
+ * },
25
+ * {
26
+ * waitForCompletion: true,
27
+ * downloadOutputs: true,
28
+ * downloadDirectory: "outputs",
29
+ * },
30
+ * );
31
+ * ```
32
+ */
33
+ generate(request: GenerateRequest, opts?: GenerateOptions): Promise<import("../image-projects/resource-client").V1ImageProjectsGetResponseWithDownloads>;
6
34
  /**
7
35
  * AI GIFs
8
36
  *
@@ -12,3 +40,4 @@ export declare class AiGifGeneratorClient extends CoreResourceClient {
12
40
  */
13
41
  create(request: requests.CreateRequest, opts?: RequestOptions): ApiPromise<types.V1AiGifGeneratorCreateResponse>;
14
42
  }
43
+ export {};
@@ -1,13 +1,73 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
2
22
  Object.defineProperty(exports, "__esModule", { value: true });
3
23
  exports.AiGifGeneratorClient = void 0;
4
24
  const core_1 = require("../../../core");
5
25
  const v1_ai_gif_generator_create_body_1 = require("../../../types/v1-ai-gif-generator-create-body");
6
26
  const v1_ai_gif_generator_create_response_1 = require("../../../types/v1-ai-gif-generator-create-response");
27
+ const logger_1 = require("../../../logger");
28
+ const image_projects_1 = require("../../../resources/v1/image-projects");
7
29
  class AiGifGeneratorClient extends core_1.CoreResourceClient {
8
30
  constructor(coreClient, opts) {
9
31
  super(coreClient, opts);
10
32
  }
33
+ /**
34
+ * AI GIFs
35
+ *
36
+ * Create an AI GIF
37
+ *
38
+ * This method provides a convenient way to create a request and automatically wait for completion and download outputs.
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * import Client from "../../../index.js";
43
+ *
44
+ * const client = new Client({ token: process.env["API_TOKEN"]!! });
45
+ * const res = await client.v1.aiGifGenerator.generate(
46
+ * {
47
+ * name: "Ai Gif gif",
48
+ * style: { prompt: "Cute dancing cat, pixel art" },
49
+ * },
50
+ * {
51
+ * waitForCompletion: true,
52
+ * downloadOutputs: true,
53
+ * downloadDirectory: "outputs",
54
+ * },
55
+ * );
56
+ * ```
57
+ */
58
+ generate(request_1) {
59
+ return __awaiter(this, arguments, void 0, function* (request, opts = {}) {
60
+ const { waitForCompletion = true, downloadOutputs = true, downloadDirectory = undefined } = opts, createOpts = __rest(opts, ["waitForCompletion", "downloadOutputs", "downloadDirectory"]);
61
+ const createResponse = yield this.create(request, createOpts);
62
+ (0, logger_1.getLogger)().info(`Created AiGifGeneratorClient project ${createResponse.id}`);
63
+ const projectsClient = new image_projects_1.ImageProjectsClient(this._client, this._opts);
64
+ (0, logger_1.getLogger)().debug(`Checking result for AiGifGeneratorClient project ${createResponse.id}`);
65
+ const result = yield projectsClient.checkResult({ id: createResponse.id }, Object.assign({ waitForCompletion,
66
+ downloadOutputs,
67
+ downloadDirectory }, createOpts));
68
+ return result;
69
+ });
70
+ }
11
71
  /**
12
72
  * AI GIFs
13
73
  *
@@ -1,6 +1,6 @@
1
+ import * as z from "zod";
1
2
  import { External$V1AiHeadshotGeneratorCreateBodyAssets, V1AiHeadshotGeneratorCreateBodyAssets } from "../../../types/v1-ai-headshot-generator-create-body-assets";
2
3
  import { External$V1AiHeadshotGeneratorCreateBodyStyle, V1AiHeadshotGeneratorCreateBodyStyle } from "../../../types/v1-ai-headshot-generator-create-body-style";
3
- import * as z from "zod";
4
4
  /**
5
5
  * CreateRequest
6
6
  */
@@ -34,10 +34,10 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.Schemas$CreateRequest = void 0;
37
+ const z = __importStar(require("zod"));
37
38
  const core_1 = require("../../../core");
38
39
  const v1_ai_headshot_generator_create_body_assets_1 = require("../../../types/v1-ai-headshot-generator-create-body-assets");
39
40
  const v1_ai_headshot_generator_create_body_style_1 = require("../../../types/v1-ai-headshot-generator-create-body-style");
40
- const z = __importStar(require("zod"));
41
41
  /**
42
42
  * Takes network data, validates it, and transforms keys to match typescript object CreateRequest
43
43
  */