magic-hour 0.36.0 → 0.38.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 +202 -10
- package/dist/client.d.ts +1 -1
- package/dist/client.js +3 -3
- package/dist/environment.d.ts +1 -1
- package/dist/environment.js +1 -1
- package/dist/helpers/download.d.ts +5 -0
- package/dist/helpers/download.js +88 -0
- package/dist/helpers/generate-type.d.ts +51 -0
- package/dist/helpers/generate-type.js +2 -0
- package/dist/helpers/sleep.d.ts +4 -0
- package/dist/helpers/sleep.js +9 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/dist/logger.d.ts +48 -0
- package/dist/logger.js +97 -0
- package/dist/resources/v1/ai-clothes-changer/request-types.js +3 -3
- package/dist/resources/v1/ai-clothes-changer/resource-client.d.ts +51 -1
- package/dist/resources/v1/ai-clothes-changer/resource-client.js +77 -2
- package/dist/resources/v1/ai-face-editor/request-types.js +3 -3
- package/dist/resources/v1/ai-face-editor/resource-client.d.ts +56 -1
- package/dist/resources/v1/ai-face-editor/resource-client.js +87 -2
- package/dist/resources/v1/ai-gif-generator/request-types.js +3 -3
- package/dist/resources/v1/ai-gif-generator/resource-client.d.ts +30 -1
- package/dist/resources/v1/ai-gif-generator/resource-client.js +62 -2
- package/dist/resources/v1/ai-headshot-generator/request-types.js +3 -3
- package/dist/resources/v1/ai-headshot-generator/resource-client.d.ts +39 -1
- package/dist/resources/v1/ai-headshot-generator/resource-client.js +70 -2
- package/dist/resources/v1/ai-image-editor/request-types.js +3 -3
- package/dist/resources/v1/ai-image-editor/resource-client.d.ts +40 -1
- package/dist/resources/v1/ai-image-editor/resource-client.js +71 -2
- package/dist/resources/v1/ai-image-generator/request-types.js +3 -3
- package/dist/resources/v1/ai-image-generator/resource-client.d.ts +32 -1
- package/dist/resources/v1/ai-image-generator/resource-client.js +64 -2
- package/dist/resources/v1/ai-image-upscaler/request-types.js +3 -3
- package/dist/resources/v1/ai-image-upscaler/resource-client.d.ts +41 -1
- package/dist/resources/v1/ai-image-upscaler/resource-client.js +72 -2
- package/dist/resources/v1/ai-meme-generator/request-types.js +3 -3
- package/dist/resources/v1/ai-meme-generator/resource-client.d.ts +34 -1
- package/dist/resources/v1/ai-meme-generator/resource-client.js +66 -2
- package/dist/resources/v1/ai-photo-editor/request-types.js +3 -3
- package/dist/resources/v1/ai-photo-editor/resource-client.d.ts +50 -1
- package/dist/resources/v1/ai-photo-editor/resource-client.js +81 -2
- package/dist/resources/v1/ai-qr-code-generator/request-types.js +3 -3
- package/dist/resources/v1/ai-qr-code-generator/resource-client.d.ts +31 -1
- package/dist/resources/v1/ai-qr-code-generator/resource-client.js +63 -2
- package/dist/resources/v1/ai-talking-photo/request-types.js +3 -3
- package/dist/resources/v1/ai-talking-photo/resource-client.d.ts +52 -1
- package/dist/resources/v1/ai-talking-photo/resource-client.js +78 -2
- package/dist/resources/v1/animation/request-types.js +3 -3
- package/dist/resources/v1/animation/resource-client.d.ts +62 -1
- package/dist/resources/v1/animation/resource-client.js +100 -2
- package/dist/resources/v1/auto-subtitle-generator/request-types.js +3 -3
- package/dist/resources/v1/auto-subtitle-generator/resource-client.d.ts +42 -1
- package/dist/resources/v1/auto-subtitle-generator/resource-client.js +73 -2
- package/dist/resources/v1/face-detection/request-types.js +5 -5
- package/dist/resources/v1/face-detection/resource-client.d.ts +31 -1
- package/dist/resources/v1/face-detection/resource-client.js +77 -2
- package/dist/resources/v1/face-swap/request-types.js +3 -3
- package/dist/resources/v1/face-swap/resource-client.d.ts +78 -1
- package/dist/resources/v1/face-swap/resource-client.js +127 -2
- package/dist/resources/v1/face-swap-photo/request-types.js +3 -3
- package/dist/resources/v1/face-swap-photo/resource-client.d.ts +74 -1
- package/dist/resources/v1/face-swap-photo/resource-client.js +119 -2
- package/dist/resources/v1/files/resource-client.d.ts +41 -1
- package/dist/resources/v1/files/resource-client.js +238 -2
- package/dist/resources/v1/files/resource-client.test.d.ts +1 -0
- package/dist/resources/v1/files/resource-client.test.js +422 -0
- package/dist/resources/v1/files/upload-urls/request-types.js +3 -3
- package/dist/resources/v1/files/upload-urls/resource-client.d.ts +1 -1
- package/dist/resources/v1/files/upload-urls/resource-client.js +2 -2
- package/dist/resources/v1/image-background-remover/request-types.js +3 -3
- package/dist/resources/v1/image-background-remover/resource-client.d.ts +50 -1
- package/dist/resources/v1/image-background-remover/resource-client.js +84 -2
- package/dist/resources/v1/image-projects/request-types.js +5 -5
- package/dist/resources/v1/image-projects/resource-client.d.ts +23 -1
- package/dist/resources/v1/image-projects/resource-client.js +70 -2
- package/dist/resources/v1/image-projects/resource-client.test.d.ts +1 -0
- package/dist/resources/v1/image-projects/resource-client.test.js +538 -0
- package/dist/resources/v1/image-to-video/request-types.js +3 -3
- package/dist/resources/v1/image-to-video/resource-client.d.ts +41 -1
- package/dist/resources/v1/image-to-video/resource-client.js +72 -2
- package/dist/resources/v1/lip-sync/request-types.js +3 -3
- package/dist/resources/v1/lip-sync/resource-client.d.ts +54 -1
- package/dist/resources/v1/lip-sync/resource-client.js +86 -2
- package/dist/resources/v1/photo-colorizer/request-types.js +3 -3
- package/dist/resources/v1/photo-colorizer/resource-client.d.ts +39 -1
- package/dist/resources/v1/photo-colorizer/resource-client.js +70 -2
- package/dist/resources/v1/resource-client.d.ts +1 -1
- package/dist/resources/v1/resource-client.js +2 -2
- package/dist/resources/v1/text-to-video/request-types.js +3 -3
- package/dist/resources/v1/text-to-video/resource-client.d.ts +33 -1
- package/dist/resources/v1/text-to-video/resource-client.js +65 -2
- package/dist/resources/v1/video-projects/request-types.js +5 -5
- package/dist/resources/v1/video-projects/resource-client.d.ts +23 -1
- package/dist/resources/v1/video-projects/resource-client.js +70 -2
- package/dist/resources/v1/video-projects/resource-client.test.d.ts +1 -0
- package/dist/resources/v1/video-projects/resource-client.test.js +713 -0
- package/dist/resources/v1/video-to-video/request-types.js +3 -3
- package/dist/resources/v1/video-to-video/resource-client.d.ts +49 -1
- package/dist/resources/v1/video-to-video/resource-client.js +86 -2
- package/dist/types/v1-ai-clothes-changer-create-body-assets.js +3 -3
- package/dist/types/v1-ai-clothes-changer-create-body.js +3 -3
- package/dist/types/v1-ai-clothes-changer-create-response.js +3 -3
- package/dist/types/v1-ai-clothes-changer-create-response400.js +3 -3
- package/dist/types/v1-ai-clothes-changer-create-response401.js +3 -3
- package/dist/types/v1-ai-clothes-changer-create-response404.js +3 -3
- package/dist/types/v1-ai-clothes-changer-create-response422.js +3 -3
- package/dist/types/v1-ai-face-editor-create-body-assets.js +3 -3
- package/dist/types/v1-ai-face-editor-create-body-style.js +3 -3
- package/dist/types/v1-ai-face-editor-create-body.js +3 -3
- package/dist/types/v1-ai-face-editor-create-response.js +3 -3
- package/dist/types/v1-ai-face-editor-create-response400.js +3 -3
- package/dist/types/v1-ai-face-editor-create-response401.js +3 -3
- package/dist/types/v1-ai-face-editor-create-response404.js +3 -3
- package/dist/types/v1-ai-face-editor-create-response422.js +3 -3
- package/dist/types/v1-ai-gif-generator-create-body-style.js +3 -3
- package/dist/types/v1-ai-gif-generator-create-body.js +3 -3
- package/dist/types/v1-ai-gif-generator-create-response.js +3 -3
- package/dist/types/v1-ai-gif-generator-create-response400.js +3 -3
- package/dist/types/v1-ai-gif-generator-create-response401.js +3 -3
- package/dist/types/v1-ai-gif-generator-create-response404.js +3 -3
- package/dist/types/v1-ai-gif-generator-create-response422.js +3 -3
- package/dist/types/v1-ai-headshot-generator-create-body-assets.js +3 -3
- package/dist/types/v1-ai-headshot-generator-create-body-style.js +3 -3
- package/dist/types/v1-ai-headshot-generator-create-body.js +3 -3
- package/dist/types/v1-ai-headshot-generator-create-response.js +3 -3
- package/dist/types/v1-ai-headshot-generator-create-response400.js +3 -3
- package/dist/types/v1-ai-headshot-generator-create-response401.js +3 -3
- package/dist/types/v1-ai-headshot-generator-create-response404.js +3 -3
- package/dist/types/v1-ai-headshot-generator-create-response422.js +3 -3
- package/dist/types/v1-ai-image-editor-create-body-assets.js +3 -3
- package/dist/types/v1-ai-image-editor-create-body-style.js +3 -3
- package/dist/types/v1-ai-image-editor-create-body.js +3 -3
- package/dist/types/v1-ai-image-editor-create-response.js +3 -3
- package/dist/types/v1-ai-image-editor-create-response400.js +3 -3
- package/dist/types/v1-ai-image-editor-create-response401.js +3 -3
- package/dist/types/v1-ai-image-editor-create-response404.js +3 -3
- package/dist/types/v1-ai-image-editor-create-response422.js +3 -3
- package/dist/types/v1-ai-image-generator-create-body-style.js +3 -3
- package/dist/types/v1-ai-image-generator-create-body.js +3 -3
- package/dist/types/v1-ai-image-generator-create-response.js +3 -3
- package/dist/types/v1-ai-image-generator-create-response400.js +3 -3
- package/dist/types/v1-ai-image-generator-create-response401.js +3 -3
- package/dist/types/v1-ai-image-generator-create-response404.js +3 -3
- package/dist/types/v1-ai-image-generator-create-response422.js +3 -3
- package/dist/types/v1-ai-image-upscaler-create-body-assets.js +3 -3
- package/dist/types/v1-ai-image-upscaler-create-body-style.js +3 -3
- package/dist/types/v1-ai-image-upscaler-create-body.js +3 -3
- package/dist/types/v1-ai-image-upscaler-create-response.js +3 -3
- package/dist/types/v1-ai-image-upscaler-create-response400.js +3 -3
- package/dist/types/v1-ai-image-upscaler-create-response401.js +3 -3
- package/dist/types/v1-ai-image-upscaler-create-response404.js +3 -3
- package/dist/types/v1-ai-image-upscaler-create-response422.js +3 -3
- package/dist/types/v1-ai-meme-generator-create-body-style.js +3 -3
- package/dist/types/v1-ai-meme-generator-create-body.js +3 -3
- package/dist/types/v1-ai-meme-generator-create-response.js +3 -3
- package/dist/types/v1-ai-meme-generator-create-response400.js +3 -3
- package/dist/types/v1-ai-meme-generator-create-response401.js +3 -3
- package/dist/types/v1-ai-meme-generator-create-response404.js +3 -3
- package/dist/types/v1-ai-meme-generator-create-response422.js +3 -3
- package/dist/types/v1-ai-photo-editor-create-body-assets.js +3 -3
- package/dist/types/v1-ai-photo-editor-create-body-style.js +3 -3
- package/dist/types/v1-ai-photo-editor-create-body.js +3 -3
- package/dist/types/v1-ai-photo-editor-create-response.js +3 -3
- package/dist/types/v1-ai-photo-editor-create-response400.js +3 -3
- package/dist/types/v1-ai-photo-editor-create-response401.js +3 -3
- package/dist/types/v1-ai-photo-editor-create-response404.js +3 -3
- package/dist/types/v1-ai-photo-editor-create-response422.js +3 -3
- package/dist/types/v1-ai-qr-code-generator-create-body-style.js +3 -3
- package/dist/types/v1-ai-qr-code-generator-create-body.js +3 -3
- package/dist/types/v1-ai-qr-code-generator-create-response.js +3 -3
- package/dist/types/v1-ai-qr-code-generator-create-response400.js +3 -3
- package/dist/types/v1-ai-qr-code-generator-create-response401.js +3 -3
- package/dist/types/v1-ai-qr-code-generator-create-response404.js +3 -3
- package/dist/types/v1-ai-qr-code-generator-create-response422.js +3 -3
- package/dist/types/v1-ai-talking-photo-create-body-assets.js +3 -3
- package/dist/types/v1-ai-talking-photo-create-body-style-generation-mode-enum.d.ts +3 -2
- package/dist/types/v1-ai-talking-photo-create-body-style.d.ts +4 -3
- package/dist/types/v1-ai-talking-photo-create-body-style.js +5 -5
- package/dist/types/v1-ai-talking-photo-create-body.js +3 -3
- package/dist/types/v1-ai-talking-photo-create-response.js +3 -3
- package/dist/types/v1-ai-talking-photo-create-response400.js +3 -3
- package/dist/types/v1-ai-talking-photo-create-response401.js +3 -3
- package/dist/types/v1-ai-talking-photo-create-response404.js +3 -3
- package/dist/types/v1-ai-talking-photo-create-response422.js +3 -3
- package/dist/types/v1-animation-create-body-assets.js +3 -3
- package/dist/types/v1-animation-create-body-style.js +3 -3
- package/dist/types/v1-animation-create-body.js +3 -3
- package/dist/types/v1-animation-create-response.js +3 -3
- package/dist/types/v1-animation-create-response400.js +3 -3
- package/dist/types/v1-animation-create-response401.js +3 -3
- package/dist/types/v1-animation-create-response404.js +3 -3
- package/dist/types/v1-animation-create-response422.js +3 -3
- package/dist/types/v1-auto-subtitle-generator-create-body-assets.js +3 -3
- package/dist/types/v1-auto-subtitle-generator-create-body-style-custom-config.js +3 -3
- package/dist/types/v1-auto-subtitle-generator-create-body-style.js +3 -3
- package/dist/types/v1-auto-subtitle-generator-create-body.js +3 -3
- package/dist/types/v1-auto-subtitle-generator-create-response.js +3 -3
- package/dist/types/v1-auto-subtitle-generator-create-response400.js +3 -3
- package/dist/types/v1-auto-subtitle-generator-create-response401.js +3 -3
- package/dist/types/v1-auto-subtitle-generator-create-response404.js +3 -3
- package/dist/types/v1-auto-subtitle-generator-create-response422.js +3 -3
- package/dist/types/v1-face-detection-create-body-assets.js +3 -3
- package/dist/types/v1-face-detection-create-body.js +3 -3
- package/dist/types/v1-face-detection-create-response.js +3 -3
- package/dist/types/v1-face-detection-create-response400.js +3 -3
- package/dist/types/v1-face-detection-create-response401.js +3 -3
- package/dist/types/v1-face-detection-create-response404.js +3 -3
- package/dist/types/v1-face-detection-create-response422.js +3 -3
- package/dist/types/v1-face-detection-get-response-faces-item.js +3 -3
- package/dist/types/v1-face-detection-get-response.js +3 -3
- package/dist/types/v1-face-detection-get-response400.js +3 -3
- package/dist/types/v1-face-detection-get-response401.js +3 -3
- package/dist/types/v1-face-detection-get-response404.js +3 -3
- package/dist/types/v1-face-detection-get-response422.js +3 -3
- package/dist/types/v1-face-swap-create-body-assets-face-mappings-item.js +3 -3
- package/dist/types/v1-face-swap-create-body-assets.js +3 -3
- package/dist/types/v1-face-swap-create-body-style.js +3 -3
- package/dist/types/v1-face-swap-create-body.js +3 -3
- package/dist/types/v1-face-swap-create-response.js +3 -3
- package/dist/types/v1-face-swap-create-response400.js +3 -3
- package/dist/types/v1-face-swap-create-response401.js +3 -3
- package/dist/types/v1-face-swap-create-response404.js +3 -3
- package/dist/types/v1-face-swap-create-response422.js +3 -3
- package/dist/types/v1-face-swap-photo-create-body-assets-face-mappings-item.js +3 -3
- package/dist/types/v1-face-swap-photo-create-body-assets.js +3 -3
- package/dist/types/v1-face-swap-photo-create-body.js +3 -3
- package/dist/types/v1-face-swap-photo-create-response.js +3 -3
- package/dist/types/v1-face-swap-photo-create-response400.js +3 -3
- package/dist/types/v1-face-swap-photo-create-response401.js +3 -3
- package/dist/types/v1-face-swap-photo-create-response404.js +3 -3
- package/dist/types/v1-face-swap-photo-create-response422.js +3 -3
- package/dist/types/v1-files-upload-urls-create-body-items-item.js +3 -3
- package/dist/types/v1-files-upload-urls-create-body.js +3 -3
- package/dist/types/v1-files-upload-urls-create-response-items-item.js +3 -3
- package/dist/types/v1-files-upload-urls-create-response.js +3 -3
- package/dist/types/v1-files-upload-urls-create-response400.js +3 -3
- package/dist/types/v1-files-upload-urls-create-response401.js +3 -3
- package/dist/types/v1-files-upload-urls-create-response404.js +3 -3
- package/dist/types/v1-files-upload-urls-create-response422.js +3 -3
- package/dist/types/v1-image-background-remover-create-body-assets.js +3 -3
- package/dist/types/v1-image-background-remover-create-body.js +3 -3
- package/dist/types/v1-image-background-remover-create-response.js +3 -3
- package/dist/types/v1-image-background-remover-create-response400.js +3 -3
- package/dist/types/v1-image-background-remover-create-response401.js +3 -3
- package/dist/types/v1-image-background-remover-create-response404.js +3 -3
- package/dist/types/v1-image-background-remover-create-response422.js +3 -3
- package/dist/types/v1-image-projects-delete-response400.js +3 -3
- package/dist/types/v1-image-projects-delete-response401.js +3 -3
- package/dist/types/v1-image-projects-delete-response404.js +3 -3
- package/dist/types/v1-image-projects-get-response-downloads-item.js +3 -3
- package/dist/types/v1-image-projects-get-response-error.js +3 -3
- package/dist/types/v1-image-projects-get-response.js +3 -3
- package/dist/types/v1-image-projects-get-response400.js +3 -3
- package/dist/types/v1-image-projects-get-response401.js +3 -3
- package/dist/types/v1-image-projects-get-response404.js +3 -3
- package/dist/types/v1-image-to-video-create-body-assets.js +3 -3
- package/dist/types/v1-image-to-video-create-body-style.js +3 -3
- package/dist/types/v1-image-to-video-create-body.js +3 -3
- package/dist/types/v1-image-to-video-create-response.js +3 -3
- package/dist/types/v1-image-to-video-create-response400.js +3 -3
- package/dist/types/v1-image-to-video-create-response401.js +3 -3
- package/dist/types/v1-image-to-video-create-response404.js +3 -3
- package/dist/types/v1-image-to-video-create-response422.js +3 -3
- package/dist/types/v1-lip-sync-create-body-assets.js +3 -3
- package/dist/types/v1-lip-sync-create-body.js +3 -3
- package/dist/types/v1-lip-sync-create-response.js +3 -3
- package/dist/types/v1-lip-sync-create-response400.js +3 -3
- package/dist/types/v1-lip-sync-create-response401.js +3 -3
- package/dist/types/v1-lip-sync-create-response404.js +3 -3
- package/dist/types/v1-lip-sync-create-response422.js +3 -3
- package/dist/types/v1-photo-colorizer-create-body-assets.js +3 -3
- package/dist/types/v1-photo-colorizer-create-body.js +3 -3
- package/dist/types/v1-photo-colorizer-create-response.js +3 -3
- package/dist/types/v1-photo-colorizer-create-response400.js +3 -3
- package/dist/types/v1-photo-colorizer-create-response401.js +3 -3
- package/dist/types/v1-photo-colorizer-create-response404.js +3 -3
- package/dist/types/v1-photo-colorizer-create-response422.js +3 -3
- package/dist/types/v1-text-to-video-create-body-style.js +3 -3
- package/dist/types/v1-text-to-video-create-body.js +3 -3
- package/dist/types/v1-text-to-video-create-response.js +3 -3
- package/dist/types/v1-text-to-video-create-response400.js +3 -3
- package/dist/types/v1-text-to-video-create-response401.js +3 -3
- package/dist/types/v1-text-to-video-create-response404.js +3 -3
- package/dist/types/v1-text-to-video-create-response422.js +3 -3
- package/dist/types/v1-video-projects-delete-response400.js +3 -3
- package/dist/types/v1-video-projects-delete-response401.js +3 -3
- package/dist/types/v1-video-projects-delete-response404.js +3 -3
- package/dist/types/v1-video-projects-delete-response422.js +3 -3
- package/dist/types/v1-video-projects-get-response-download.js +3 -3
- package/dist/types/v1-video-projects-get-response-downloads-item.js +3 -3
- package/dist/types/v1-video-projects-get-response-error.js +3 -3
- package/dist/types/v1-video-projects-get-response.js +3 -3
- package/dist/types/v1-video-projects-get-response400.js +3 -3
- package/dist/types/v1-video-projects-get-response401.js +3 -3
- package/dist/types/v1-video-projects-get-response404.js +3 -3
- package/dist/types/v1-video-to-video-create-body-assets.js +3 -3
- package/dist/types/v1-video-to-video-create-body-style.js +3 -3
- package/dist/types/v1-video-to-video-create-body.js +3 -3
- package/dist/types/v1-video-to-video-create-response.js +3 -3
- package/dist/types/v1-video-to-video-create-response400.js +3 -3
- package/dist/types/v1-video-to-video-create-response401.js +3 -3
- package/dist/types/v1-video-to-video-create-response404.js +3 -3
- package/dist/types/v1-video-to-video-create-response422.js +3 -3
- package/package.json +16 -21
- package/dist/core/api-error.d.ts +0 -6
- package/dist/core/api-error.js +0 -11
- package/dist/core/api-promise.d.ts +0 -28
- package/dist/core/api-promise.js +0 -252
- package/dist/core/auth.d.ts +0 -76
- package/dist/core/auth.js +0 -232
- package/dist/core/binary-response.d.ts +0 -6
- package/dist/core/binary-response.js +0 -10
- package/dist/core/content-type.d.ts +0 -4
- package/dist/core/content-type.js +0 -12
- package/dist/core/core-client.d.ts +0 -58
- package/dist/core/core-client.js +0 -168
- package/dist/core/form-data.d.ts +0 -26
- package/dist/core/form-data.js +0 -83
- package/dist/core/index.d.ts +0 -9
- package/dist/core/index.js +0 -28
- package/dist/core/query.d.ts +0 -8
- package/dist/core/query.js +0 -77
- package/dist/core/runtime.d.ts +0 -4
- package/dist/core/runtime.js +0 -20
- package/dist/core/zod.d.ts +0 -13
- package/dist/core/zod.js +0 -60
|
@@ -1,13 +1,83 @@
|
|
|
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.ImageToVideoClient = void 0;
|
|
4
|
-
const
|
|
24
|
+
const make_api_request_js_1 = require("make-api-request-js");
|
|
25
|
+
const logger_1 = require("../../../logger");
|
|
26
|
+
const files_1 = require("../../../resources/v1/files");
|
|
27
|
+
const video_projects_1 = require("../../../resources/v1/video-projects");
|
|
5
28
|
const v1_image_to_video_create_body_1 = require("../../../types/v1-image-to-video-create-body");
|
|
6
29
|
const v1_image_to_video_create_response_1 = require("../../../types/v1-image-to-video-create-response");
|
|
7
|
-
class ImageToVideoClient extends
|
|
30
|
+
class ImageToVideoClient extends make_api_request_js_1.CoreResourceClient {
|
|
8
31
|
constructor(coreClient, opts) {
|
|
9
32
|
super(coreClient, opts);
|
|
10
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Image-to-Video
|
|
36
|
+
*
|
|
37
|
+
* Create a Image To Video video
|
|
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.imageToVideo.generate(
|
|
47
|
+
* {
|
|
48
|
+
* assets: { imageFilePath: "/path/to/1234.png" },
|
|
49
|
+
* endSeconds: 5.0,
|
|
50
|
+
* name: "Image To Video video",
|
|
51
|
+
* resolution: "720p",
|
|
52
|
+
* },
|
|
53
|
+
* {
|
|
54
|
+
* waitForCompletion: true,
|
|
55
|
+
* downloadOutputs: true,
|
|
56
|
+
* downloadDirectory: "outputs",
|
|
57
|
+
* },
|
|
58
|
+
* );
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
generate(request_1) {
|
|
62
|
+
return __awaiter(this, arguments, void 0, function* (request, opts = {}) {
|
|
63
|
+
const { waitForCompletion = true, downloadOutputs = true, downloadDirectory = undefined } = opts, createOpts = __rest(opts, ["waitForCompletion", "downloadOutputs", "downloadDirectory"]);
|
|
64
|
+
const fileClient = new files_1.FilesClient(this._client, this._opts);
|
|
65
|
+
const _a = request.assets, { imageFilePath } = _a, restAssets = __rest(_a, ["imageFilePath"]);
|
|
66
|
+
(0, logger_1.getLogger)().debug(`Uploading file ${imageFilePath} to Magic Hour's storage`);
|
|
67
|
+
const [uploadedImageFilePath] = yield Promise.all([
|
|
68
|
+
fileClient.uploadFile(imageFilePath),
|
|
69
|
+
]);
|
|
70
|
+
(0, logger_1.getLogger)().info(`Uploaded file ${imageFilePath} to Magic Hour's storage as ${uploadedImageFilePath}`);
|
|
71
|
+
const createResponse = yield this.create(Object.assign(Object.assign({}, request), { assets: Object.assign(Object.assign({}, restAssets), { imageFilePath: uploadedImageFilePath }) }), createOpts);
|
|
72
|
+
(0, logger_1.getLogger)().info(`Created ImageToVideoClient project ${createResponse.id}`);
|
|
73
|
+
const projectsClient = new video_projects_1.VideoProjectsClient(this._client, this._opts);
|
|
74
|
+
(0, logger_1.getLogger)().debug(`Checking result for ImageToVideoClient project ${createResponse.id}`);
|
|
75
|
+
const result = yield projectsClient.checkResult({ id: createResponse.id }, Object.assign({ waitForCompletion,
|
|
76
|
+
downloadOutputs,
|
|
77
|
+
downloadDirectory }, createOpts));
|
|
78
|
+
return result;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
11
81
|
/**
|
|
12
82
|
* Image-to-Video
|
|
13
83
|
*
|
|
@@ -34,8 +34,8 @@ 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 make_api_request_js_1 = require("make-api-request-js");
|
|
37
38
|
const z = __importStar(require("zod"));
|
|
38
|
-
const core_1 = require("../../../core");
|
|
39
39
|
const v1_lip_sync_create_body_assets_1 = require("../../../types/v1-lip-sync-create-body-assets");
|
|
40
40
|
/**
|
|
41
41
|
* Takes network data, validates it, and transforms keys to match typescript object CreateRequest
|
|
@@ -51,7 +51,7 @@ const SchemaIn$CreateRequest = z
|
|
|
51
51
|
width: z.number().int().nullable().optional(),
|
|
52
52
|
})
|
|
53
53
|
.transform((obj) => {
|
|
54
|
-
return (0,
|
|
54
|
+
return (0, make_api_request_js_1.zodTransform)(obj, {
|
|
55
55
|
assets: "assets",
|
|
56
56
|
end_seconds: "endSeconds",
|
|
57
57
|
height: "height",
|
|
@@ -76,7 +76,7 @@ const SchemaOut$CreateRequest = z
|
|
|
76
76
|
width: z.number().int().nullable().optional(),
|
|
77
77
|
})
|
|
78
78
|
.transform((obj) => {
|
|
79
|
-
return (0,
|
|
79
|
+
return (0, make_api_request_js_1.zodTransform)(obj, {
|
|
80
80
|
assets: "assets",
|
|
81
81
|
endSeconds: "end_seconds",
|
|
82
82
|
height: "height",
|
|
@@ -1,8 +1,60 @@
|
|
|
1
|
+
import { ApiPromise, CoreClient, CoreResourceClient, RequestOptions, ResourceClientOptions } from "make-api-request-js";
|
|
1
2
|
import { types } from "../../../index.js";
|
|
2
|
-
import {
|
|
3
|
+
import { GenerateOptions, GenerateRequestType } from "../../../helpers/generate-type";
|
|
3
4
|
import * as requests from "../../../resources/v1/lip-sync/request-types";
|
|
5
|
+
type GenerateRequest = GenerateRequestType<requests.CreateRequest, {
|
|
6
|
+
/**
|
|
7
|
+
* The path of the audio file. 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
|
+
audioFilePath: string;
|
|
14
|
+
/**
|
|
15
|
+
* Required if `video_source` is `file`. 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
|
+
videoFilePath?: string | undefined;
|
|
22
|
+
}>;
|
|
4
23
|
export declare class LipSyncClient extends CoreResourceClient {
|
|
5
24
|
constructor(coreClient: CoreClient, opts: ResourceClientOptions);
|
|
25
|
+
/**
|
|
26
|
+
* Lip Sync
|
|
27
|
+
*
|
|
28
|
+
* Create a Lip Sync video
|
|
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.lipSync.generate(
|
|
38
|
+
* {
|
|
39
|
+
* assets: {
|
|
40
|
+
* audioFilePath: "/path/to/1234.mp3",
|
|
41
|
+
* videoFilePath: "/path/to/1234.mp4",
|
|
42
|
+
* videoSource: "file",
|
|
43
|
+
* },
|
|
44
|
+
* endSeconds: 15.0,
|
|
45
|
+
* maxFpsLimit: 12.0,
|
|
46
|
+
* name: "Lip Sync video",
|
|
47
|
+
* startSeconds: 0.0,
|
|
48
|
+
* },
|
|
49
|
+
* {
|
|
50
|
+
* waitForCompletion: true,
|
|
51
|
+
* downloadOutputs: true,
|
|
52
|
+
* downloadDirectory: "outputs",
|
|
53
|
+
* },
|
|
54
|
+
* );
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
generate(request: GenerateRequest, opts?: GenerateOptions): Promise<import("../video-projects/resource-client").V1VideoProjectsGetResponseWithDownloads>;
|
|
6
58
|
/**
|
|
7
59
|
* Lip Sync
|
|
8
60
|
*
|
|
@@ -15,3 +67,4 @@ export declare class LipSyncClient extends CoreResourceClient {
|
|
|
15
67
|
*/
|
|
16
68
|
create(request: requests.CreateRequest, opts?: RequestOptions): ApiPromise<types.V1LipSyncCreateResponse>;
|
|
17
69
|
}
|
|
70
|
+
export {};
|
|
@@ -1,13 +1,97 @@
|
|
|
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.LipSyncClient = void 0;
|
|
4
|
-
const
|
|
24
|
+
const make_api_request_js_1 = require("make-api-request-js");
|
|
25
|
+
const logger_1 = require("../../../logger");
|
|
26
|
+
const files_1 = require("../../../resources/v1/files");
|
|
27
|
+
const video_projects_1 = require("../../../resources/v1/video-projects");
|
|
5
28
|
const v1_lip_sync_create_body_1 = require("../../../types/v1-lip-sync-create-body");
|
|
6
29
|
const v1_lip_sync_create_response_1 = require("../../../types/v1-lip-sync-create-response");
|
|
7
|
-
class LipSyncClient extends
|
|
30
|
+
class LipSyncClient extends make_api_request_js_1.CoreResourceClient {
|
|
8
31
|
constructor(coreClient, opts) {
|
|
9
32
|
super(coreClient, opts);
|
|
10
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Lip Sync
|
|
36
|
+
*
|
|
37
|
+
* Create a Lip Sync video
|
|
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.lipSync.generate(
|
|
47
|
+
* {
|
|
48
|
+
* assets: {
|
|
49
|
+
* audioFilePath: "/path/to/1234.mp3",
|
|
50
|
+
* videoFilePath: "/path/to/1234.mp4",
|
|
51
|
+
* videoSource: "file",
|
|
52
|
+
* },
|
|
53
|
+
* endSeconds: 15.0,
|
|
54
|
+
* maxFpsLimit: 12.0,
|
|
55
|
+
* name: "Lip Sync video",
|
|
56
|
+
* startSeconds: 0.0,
|
|
57
|
+
* },
|
|
58
|
+
* {
|
|
59
|
+
* waitForCompletion: true,
|
|
60
|
+
* downloadOutputs: true,
|
|
61
|
+
* downloadDirectory: "outputs",
|
|
62
|
+
* },
|
|
63
|
+
* );
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
generate(request_1) {
|
|
67
|
+
return __awaiter(this, arguments, void 0, function* (request, opts = {}) {
|
|
68
|
+
const { waitForCompletion = true, downloadOutputs = true, downloadDirectory = undefined } = opts, createOpts = __rest(opts, ["waitForCompletion", "downloadOutputs", "downloadDirectory"]);
|
|
69
|
+
const fileClient = new files_1.FilesClient(this._client, this._opts);
|
|
70
|
+
const _a = request.assets, { audioFilePath, videoFilePath } = _a, restAssets = __rest(_a, ["audioFilePath", "videoFilePath"]);
|
|
71
|
+
(0, logger_1.getLogger)().debug(`Uploading file ${audioFilePath} to Magic Hour's storage`);
|
|
72
|
+
if (videoFilePath) {
|
|
73
|
+
(0, logger_1.getLogger)().debug(`Uploading file ${videoFilePath} to Magic Hour's storage`);
|
|
74
|
+
}
|
|
75
|
+
const [uploadedAudioFilePath, uploadedVideoFilePath] = yield Promise.all([
|
|
76
|
+
fileClient.uploadFile(audioFilePath),
|
|
77
|
+
videoFilePath
|
|
78
|
+
? fileClient.uploadFile(videoFilePath)
|
|
79
|
+
: Promise.resolve(videoFilePath),
|
|
80
|
+
]);
|
|
81
|
+
(0, logger_1.getLogger)().info(`Uploaded file ${audioFilePath} to Magic Hour's storage as ${uploadedAudioFilePath}`);
|
|
82
|
+
if (videoFilePath) {
|
|
83
|
+
(0, logger_1.getLogger)().info(`Uploaded file ${videoFilePath} to Magic Hour's storage as ${uploadedVideoFilePath}`);
|
|
84
|
+
}
|
|
85
|
+
const createResponse = yield this.create(Object.assign(Object.assign({}, request), { assets: Object.assign(Object.assign({}, restAssets), { audioFilePath: uploadedAudioFilePath, videoFilePath: videoFilePath ? uploadedVideoFilePath : videoFilePath }) }), createOpts);
|
|
86
|
+
(0, logger_1.getLogger)().info(`Created LipSyncClient project ${createResponse.id}`);
|
|
87
|
+
const projectsClient = new video_projects_1.VideoProjectsClient(this._client, this._opts);
|
|
88
|
+
(0, logger_1.getLogger)().debug(`Checking result for LipSyncClient project ${createResponse.id}`);
|
|
89
|
+
const result = yield projectsClient.checkResult({ id: createResponse.id }, Object.assign({ waitForCompletion,
|
|
90
|
+
downloadOutputs,
|
|
91
|
+
downloadDirectory }, createOpts));
|
|
92
|
+
return result;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
11
95
|
/**
|
|
12
96
|
* Lip Sync
|
|
13
97
|
*
|
|
@@ -34,8 +34,8 @@ 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 make_api_request_js_1 = require("make-api-request-js");
|
|
37
38
|
const z = __importStar(require("zod"));
|
|
38
|
-
const core_1 = require("../../../core");
|
|
39
39
|
const v1_photo_colorizer_create_body_assets_1 = require("../../../types/v1-photo-colorizer-create-body-assets");
|
|
40
40
|
/**
|
|
41
41
|
* Takes network data, validates it, and transforms keys to match typescript object CreateRequest
|
|
@@ -46,7 +46,7 @@ const SchemaIn$CreateRequest = z
|
|
|
46
46
|
name: z.string().optional(),
|
|
47
47
|
})
|
|
48
48
|
.transform((obj) => {
|
|
49
|
-
return (0,
|
|
49
|
+
return (0, make_api_request_js_1.zodTransform)(obj, {
|
|
50
50
|
assets: "assets",
|
|
51
51
|
name: "name",
|
|
52
52
|
});
|
|
@@ -61,7 +61,7 @@ const SchemaOut$CreateRequest = z
|
|
|
61
61
|
name: z.string().optional(),
|
|
62
62
|
})
|
|
63
63
|
.transform((obj) => {
|
|
64
|
-
return (0,
|
|
64
|
+
return (0, make_api_request_js_1.zodTransform)(obj, {
|
|
65
65
|
assets: "assets",
|
|
66
66
|
name: "name",
|
|
67
67
|
});
|
|
@@ -1,8 +1,45 @@
|
|
|
1
|
+
import { ApiPromise, CoreClient, CoreResourceClient, RequestOptions, ResourceClientOptions } from "make-api-request-js";
|
|
1
2
|
import { types } from "../../../index.js";
|
|
2
|
-
import {
|
|
3
|
+
import { GenerateOptions, GenerateRequestType } from "../../../helpers/generate-type";
|
|
3
4
|
import * as requests from "../../../resources/v1/photo-colorizer/request-types";
|
|
5
|
+
type GenerateRequest = GenerateRequestType<requests.CreateRequest, {
|
|
6
|
+
/**
|
|
7
|
+
* The image used to generate the colorized image. 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 PhotoColorizerClient extends CoreResourceClient {
|
|
5
16
|
constructor(coreClient: CoreClient, opts: ResourceClientOptions);
|
|
17
|
+
/**
|
|
18
|
+
* Photo Colorizer
|
|
19
|
+
*
|
|
20
|
+
* Colorize image
|
|
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.photoColorizer.generate(
|
|
30
|
+
* {
|
|
31
|
+
* assets: { imageFilePath: "/path/to/1234.png" },
|
|
32
|
+
* name: "Photo Colorizer image",
|
|
33
|
+
* },
|
|
34
|
+
* {
|
|
35
|
+
* waitForCompletion: true,
|
|
36
|
+
* downloadOutputs: true,
|
|
37
|
+
* downloadDirectory: "outputs",
|
|
38
|
+
* },
|
|
39
|
+
* );
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
generate(request: GenerateRequest, opts?: GenerateOptions): Promise<import("../image-projects/resource-client").V1ImageProjectsGetResponseWithDownloads>;
|
|
6
43
|
/**
|
|
7
44
|
* Photo Colorizer
|
|
8
45
|
*
|
|
@@ -12,3 +49,4 @@ export declare class PhotoColorizerClient extends CoreResourceClient {
|
|
|
12
49
|
*/
|
|
13
50
|
create(request: requests.CreateRequest, opts?: RequestOptions): ApiPromise<types.V1PhotoColorizerCreateResponse>;
|
|
14
51
|
}
|
|
52
|
+
export {};
|
|
@@ -1,13 +1,81 @@
|
|
|
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.PhotoColorizerClient = void 0;
|
|
4
|
-
const
|
|
24
|
+
const make_api_request_js_1 = require("make-api-request-js");
|
|
25
|
+
const logger_1 = require("../../../logger");
|
|
26
|
+
const files_1 = require("../../../resources/v1/files");
|
|
27
|
+
const image_projects_1 = require("../../../resources/v1/image-projects");
|
|
5
28
|
const v1_photo_colorizer_create_body_1 = require("../../../types/v1-photo-colorizer-create-body");
|
|
6
29
|
const v1_photo_colorizer_create_response_1 = require("../../../types/v1-photo-colorizer-create-response");
|
|
7
|
-
class PhotoColorizerClient extends
|
|
30
|
+
class PhotoColorizerClient extends make_api_request_js_1.CoreResourceClient {
|
|
8
31
|
constructor(coreClient, opts) {
|
|
9
32
|
super(coreClient, opts);
|
|
10
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Photo Colorizer
|
|
36
|
+
*
|
|
37
|
+
* Colorize image
|
|
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.photoColorizer.generate(
|
|
47
|
+
* {
|
|
48
|
+
* assets: { imageFilePath: "/path/to/1234.png" },
|
|
49
|
+
* name: "Photo Colorizer image",
|
|
50
|
+
* },
|
|
51
|
+
* {
|
|
52
|
+
* waitForCompletion: true,
|
|
53
|
+
* downloadOutputs: true,
|
|
54
|
+
* downloadDirectory: "outputs",
|
|
55
|
+
* },
|
|
56
|
+
* );
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
generate(request_1) {
|
|
60
|
+
return __awaiter(this, arguments, void 0, function* (request, opts = {}) {
|
|
61
|
+
const { waitForCompletion = true, downloadOutputs = true, downloadDirectory = undefined } = opts, createOpts = __rest(opts, ["waitForCompletion", "downloadOutputs", "downloadDirectory"]);
|
|
62
|
+
const fileClient = new files_1.FilesClient(this._client, this._opts);
|
|
63
|
+
const _a = request.assets, { imageFilePath } = _a, restAssets = __rest(_a, ["imageFilePath"]);
|
|
64
|
+
(0, logger_1.getLogger)().debug(`Uploading file ${imageFilePath} to Magic Hour's storage`);
|
|
65
|
+
const [uploadedImageFilePath] = yield Promise.all([
|
|
66
|
+
fileClient.uploadFile(imageFilePath),
|
|
67
|
+
]);
|
|
68
|
+
(0, logger_1.getLogger)().info(`Uploaded file ${imageFilePath} to Magic Hour's storage as ${uploadedImageFilePath}`);
|
|
69
|
+
const createResponse = yield this.create(Object.assign(Object.assign({}, request), { assets: Object.assign(Object.assign({}, restAssets), { imageFilePath: uploadedImageFilePath }) }), createOpts);
|
|
70
|
+
(0, logger_1.getLogger)().info(`Created PhotoColorizerClient project ${createResponse.id}`);
|
|
71
|
+
const projectsClient = new image_projects_1.ImageProjectsClient(this._client, this._opts);
|
|
72
|
+
(0, logger_1.getLogger)().debug(`Checking result for PhotoColorizerClient project ${createResponse.id}`);
|
|
73
|
+
const result = yield projectsClient.checkResult({ id: createResponse.id }, Object.assign({ waitForCompletion,
|
|
74
|
+
downloadOutputs,
|
|
75
|
+
downloadDirectory }, createOpts));
|
|
76
|
+
return result;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
11
79
|
/**
|
|
12
80
|
* Photo Colorizer
|
|
13
81
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CoreClient, CoreResourceClient, ResourceClientOptions } from "
|
|
1
|
+
import { CoreClient, CoreResourceClient, ResourceClientOptions } from "make-api-request-js";
|
|
2
2
|
import { AiClothesChangerClient } from "../../resources/v1/ai-clothes-changer";
|
|
3
3
|
import { AiFaceEditorClient } from "../../resources/v1/ai-face-editor";
|
|
4
4
|
import { AiGifGeneratorClient } from "../../resources/v1/ai-gif-generator";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.V1Client = void 0;
|
|
4
|
-
const
|
|
5
|
-
class V1Client extends
|
|
4
|
+
const make_api_request_js_1 = require("make-api-request-js");
|
|
5
|
+
class V1Client extends make_api_request_js_1.CoreResourceClient {
|
|
6
6
|
constructor(coreClient, opts) {
|
|
7
7
|
super(coreClient, opts);
|
|
8
8
|
if (this._opts.lazyLoad === false) {
|
|
@@ -34,8 +34,8 @@ 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 make_api_request_js_1 = require("make-api-request-js");
|
|
37
38
|
const z = __importStar(require("zod"));
|
|
38
|
-
const core_1 = require("../../../core");
|
|
39
39
|
const v1_text_to_video_create_body_style_1 = require("../../../types/v1-text-to-video-create-body-style");
|
|
40
40
|
/**
|
|
41
41
|
* Takes network data, validates it, and transforms keys to match typescript object CreateRequest
|
|
@@ -49,7 +49,7 @@ const SchemaIn$CreateRequest = z
|
|
|
49
49
|
style: v1_text_to_video_create_body_style_1.Schemas$V1TextToVideoCreateBodyStyle.in,
|
|
50
50
|
})
|
|
51
51
|
.transform((obj) => {
|
|
52
|
-
return (0,
|
|
52
|
+
return (0, make_api_request_js_1.zodTransform)(obj, {
|
|
53
53
|
end_seconds: "endSeconds",
|
|
54
54
|
name: "name",
|
|
55
55
|
orientation: "orientation",
|
|
@@ -70,7 +70,7 @@ const SchemaOut$CreateRequest = z
|
|
|
70
70
|
style: v1_text_to_video_create_body_style_1.Schemas$V1TextToVideoCreateBodyStyle.out,
|
|
71
71
|
})
|
|
72
72
|
.transform((obj) => {
|
|
73
|
-
return (0,
|
|
73
|
+
return (0, make_api_request_js_1.zodTransform)(obj, {
|
|
74
74
|
endSeconds: "end_seconds",
|
|
75
75
|
name: "name",
|
|
76
76
|
orientation: "orientation",
|
|
@@ -1,8 +1,39 @@
|
|
|
1
|
+
import { ApiPromise, CoreClient, CoreResourceClient, RequestOptions, ResourceClientOptions } from "make-api-request-js";
|
|
1
2
|
import { types } from "../../../index.js";
|
|
2
|
-
import {
|
|
3
|
+
import { GenerateOptions, GenerateRequestType } from "../../../helpers/generate-type";
|
|
3
4
|
import * as requests from "../../../resources/v1/text-to-video/request-types";
|
|
5
|
+
type GenerateRequest = GenerateRequestType<requests.CreateRequest, {}>;
|
|
4
6
|
export declare class TextToVideoClient extends CoreResourceClient {
|
|
5
7
|
constructor(coreClient: CoreClient, opts: ResourceClientOptions);
|
|
8
|
+
/**
|
|
9
|
+
* Text-to-Video
|
|
10
|
+
*
|
|
11
|
+
* Create a Text To Video video
|
|
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.textToVideo.generate(
|
|
21
|
+
* {
|
|
22
|
+
* endSeconds: 5.0,
|
|
23
|
+
* name: "Text To Video video",
|
|
24
|
+
* orientation: "landscape",
|
|
25
|
+
* resolution: "720p",
|
|
26
|
+
* style: { prompt: "a dog running" },
|
|
27
|
+
* },
|
|
28
|
+
* {
|
|
29
|
+
* waitForCompletion: true,
|
|
30
|
+
* downloadOutputs: true,
|
|
31
|
+
* downloadDirectory: "outputs",
|
|
32
|
+
* },
|
|
33
|
+
* );
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
generate(request: GenerateRequest, opts?: GenerateOptions): Promise<import("../video-projects/resource-client").V1VideoProjectsGetResponseWithDownloads>;
|
|
6
37
|
/**
|
|
7
38
|
* Text-to-Video
|
|
8
39
|
*
|
|
@@ -15,3 +46,4 @@ export declare class TextToVideoClient extends CoreResourceClient {
|
|
|
15
46
|
*/
|
|
16
47
|
create(request: requests.CreateRequest, opts?: RequestOptions): ApiPromise<types.V1TextToVideoCreateResponse>;
|
|
17
48
|
}
|
|
49
|
+
export {};
|
|
@@ -1,13 +1,76 @@
|
|
|
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.TextToVideoClient = void 0;
|
|
4
|
-
const
|
|
24
|
+
const make_api_request_js_1 = require("make-api-request-js");
|
|
25
|
+
const logger_1 = require("../../../logger");
|
|
26
|
+
const video_projects_1 = require("../../../resources/v1/video-projects");
|
|
5
27
|
const v1_text_to_video_create_body_1 = require("../../../types/v1-text-to-video-create-body");
|
|
6
28
|
const v1_text_to_video_create_response_1 = require("../../../types/v1-text-to-video-create-response");
|
|
7
|
-
class TextToVideoClient extends
|
|
29
|
+
class TextToVideoClient extends make_api_request_js_1.CoreResourceClient {
|
|
8
30
|
constructor(coreClient, opts) {
|
|
9
31
|
super(coreClient, opts);
|
|
10
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Text-to-Video
|
|
35
|
+
*
|
|
36
|
+
* Create a Text To Video video
|
|
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.textToVideo.generate(
|
|
46
|
+
* {
|
|
47
|
+
* endSeconds: 5.0,
|
|
48
|
+
* name: "Text To Video video",
|
|
49
|
+
* orientation: "landscape",
|
|
50
|
+
* resolution: "720p",
|
|
51
|
+
* style: { prompt: "a dog running" },
|
|
52
|
+
* },
|
|
53
|
+
* {
|
|
54
|
+
* waitForCompletion: true,
|
|
55
|
+
* downloadOutputs: true,
|
|
56
|
+
* downloadDirectory: "outputs",
|
|
57
|
+
* },
|
|
58
|
+
* );
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
generate(request_1) {
|
|
62
|
+
return __awaiter(this, arguments, void 0, function* (request, opts = {}) {
|
|
63
|
+
const { waitForCompletion = true, downloadOutputs = true, downloadDirectory = undefined } = opts, createOpts = __rest(opts, ["waitForCompletion", "downloadOutputs", "downloadDirectory"]);
|
|
64
|
+
const createResponse = yield this.create(request, createOpts);
|
|
65
|
+
(0, logger_1.getLogger)().info(`Created TextToVideoClient project ${createResponse.id}`);
|
|
66
|
+
const projectsClient = new video_projects_1.VideoProjectsClient(this._client, this._opts);
|
|
67
|
+
(0, logger_1.getLogger)().debug(`Checking result for TextToVideoClient project ${createResponse.id}`);
|
|
68
|
+
const result = yield projectsClient.checkResult({ id: createResponse.id }, Object.assign({ waitForCompletion,
|
|
69
|
+
downloadOutputs,
|
|
70
|
+
downloadDirectory }, createOpts));
|
|
71
|
+
return result;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
11
74
|
/**
|
|
12
75
|
* Text-to-Video
|
|
13
76
|
*
|
|
@@ -34,8 +34,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Schemas$GetRequest = exports.Schemas$DeleteRequest = void 0;
|
|
37
|
+
const make_api_request_js_1 = require("make-api-request-js");
|
|
37
38
|
const z = __importStar(require("zod"));
|
|
38
|
-
const core_1 = require("../../../core");
|
|
39
39
|
/**
|
|
40
40
|
* Takes network data, validates it, and transforms keys to match typescript object DeleteRequest
|
|
41
41
|
*/
|
|
@@ -44,7 +44,7 @@ const SchemaIn$DeleteRequest = z
|
|
|
44
44
|
id: z.string(),
|
|
45
45
|
})
|
|
46
46
|
.transform((obj) => {
|
|
47
|
-
return (0,
|
|
47
|
+
return (0, make_api_request_js_1.zodTransform)(obj, {
|
|
48
48
|
id: "id",
|
|
49
49
|
});
|
|
50
50
|
});
|
|
@@ -57,7 +57,7 @@ const SchemaOut$DeleteRequest = z
|
|
|
57
57
|
id: z.string(),
|
|
58
58
|
})
|
|
59
59
|
.transform((obj) => {
|
|
60
|
-
return (0,
|
|
60
|
+
return (0, make_api_request_js_1.zodTransform)(obj, {
|
|
61
61
|
id: "id",
|
|
62
62
|
});
|
|
63
63
|
});
|
|
@@ -73,7 +73,7 @@ const SchemaIn$GetRequest = z
|
|
|
73
73
|
id: z.string(),
|
|
74
74
|
})
|
|
75
75
|
.transform((obj) => {
|
|
76
|
-
return (0,
|
|
76
|
+
return (0, make_api_request_js_1.zodTransform)(obj, {
|
|
77
77
|
id: "id",
|
|
78
78
|
});
|
|
79
79
|
});
|
|
@@ -86,7 +86,7 @@ const SchemaOut$GetRequest = z
|
|
|
86
86
|
id: z.string(),
|
|
87
87
|
})
|
|
88
88
|
.transform((obj) => {
|
|
89
|
-
return (0,
|
|
89
|
+
return (0, make_api_request_js_1.zodTransform)(obj, {
|
|
90
90
|
id: "id",
|
|
91
91
|
});
|
|
92
92
|
});
|