magic-hour 0.6.1 → 0.7.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 +5 -1
- package/dist/core/api-promise.d.ts +14 -6
- package/dist/core/api-promise.js +184 -10
- package/dist/core/core-client.d.ts +5 -3
- package/dist/core/core-client.js +7 -3
- package/dist/core/form-data.d.ts +1 -2
- package/dist/core/form-data.js +6 -7
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.js +4 -1
- package/dist/core/zod.d.ts +15 -0
- package/dist/core/zod.js +60 -0
- package/dist/environment.js +1 -1
- package/dist/index.js +17 -7
- package/dist/resources/index.js +17 -7
- package/dist/resources/v1/ai-headshot-generator/request-types.d.ts +24 -3
- package/dist/resources/v1/ai-headshot-generator/request-types.js +70 -0
- package/dist/resources/v1/ai-headshot-generator/resource-client.js +4 -1
- package/dist/resources/v1/ai-image-generator/request-types.d.ts +29 -3
- package/dist/resources/v1/ai-image-generator/request-types.js +78 -0
- package/dist/resources/v1/ai-image-generator/resource-client.js +4 -1
- package/dist/resources/v1/ai-image-upscaler/request-types.d.ts +29 -3
- package/dist/resources/v1/ai-image-upscaler/request-types.js +79 -0
- package/dist/resources/v1/ai-image-upscaler/resource-client.js +4 -1
- package/dist/resources/v1/ai-photo-editor/request-types.d.ts +37 -3
- package/dist/resources/v1/ai-photo-editor/request-types.js +83 -0
- package/dist/resources/v1/ai-photo-editor/resource-client.js +4 -1
- package/dist/resources/v1/ai-qr-code-generator/request-types.d.ts +26 -3
- package/dist/resources/v1/ai-qr-code-generator/request-types.js +74 -0
- package/dist/resources/v1/ai-qr-code-generator/resource-client.js +4 -1
- package/dist/resources/v1/animation/request-types.d.ts +50 -3
- package/dist/resources/v1/animation/request-types.js +91 -0
- package/dist/resources/v1/animation/resource-client.js +4 -1
- package/dist/resources/v1/face-swap/request-types.d.ts +44 -3
- package/dist/resources/v1/face-swap/request-types.js +86 -0
- package/dist/resources/v1/face-swap/resource-client.js +4 -1
- package/dist/resources/v1/face-swap-photo/request-types.d.ts +24 -3
- package/dist/resources/v1/face-swap-photo/request-types.js +70 -0
- package/dist/resources/v1/face-swap-photo/resource-client.js +4 -1
- package/dist/resources/v1/files/index.js +17 -7
- package/dist/resources/v1/files/upload-urls/request-types.d.ts +16 -3
- package/dist/resources/v1/files/upload-urls/request-types.js +66 -0
- package/dist/resources/v1/files/upload-urls/resource-client.js +4 -1
- package/dist/resources/v1/image-background-remover/index.d.ts +5 -0
- package/dist/resources/v1/image-background-remover/index.js +8 -0
- package/dist/resources/v1/image-background-remover/request-types.d.ts +31 -0
- package/dist/resources/v1/image-background-remover/request-types.js +75 -0
- package/dist/resources/v1/image-background-remover/resource-client.d.ts +15 -0
- package/dist/resources/v1/image-background-remover/resource-client.js +32 -0
- package/dist/resources/v1/image-projects/request-types.d.ts +27 -2
- package/dist/resources/v1/image-projects/request-types.js +94 -0
- package/dist/resources/v1/image-projects/resource-client.js +2 -0
- package/dist/resources/v1/image-to-video/request-types.d.ts +42 -3
- package/dist/resources/v1/image-to-video/request-types.js +87 -0
- package/dist/resources/v1/image-to-video/resource-client.js +4 -1
- package/dist/resources/v1/index.d.ts +1 -0
- package/dist/resources/v1/index.js +19 -8
- package/dist/resources/v1/lip-sync/request-types.d.ts +49 -3
- package/dist/resources/v1/lip-sync/request-types.js +90 -0
- package/dist/resources/v1/lip-sync/resource-client.js +4 -1
- package/dist/resources/v1/resource-client.d.ts +2 -0
- package/dist/resources/v1/resource-client.js +2 -0
- package/dist/resources/v1/text-to-video/request-types.d.ts +32 -3
- package/dist/resources/v1/text-to-video/request-types.js +78 -0
- package/dist/resources/v1/text-to-video/resource-client.js +4 -1
- package/dist/resources/v1/video-projects/request-types.d.ts +27 -2
- package/dist/resources/v1/video-projects/request-types.js +94 -0
- package/dist/resources/v1/video-projects/resource-client.js +2 -0
- package/dist/resources/v1/video-to-video/request-types.d.ts +55 -3
- package/dist/resources/v1/video-to-video/request-types.js +95 -0
- package/dist/resources/v1/video-to-video/resource-client.js +4 -1
- package/dist/types/delete-v1-image-projects-id-response400.d.ts +14 -1
- package/dist/types/delete-v1-image-projects-id-response400.js +65 -0
- package/dist/types/delete-v1-image-projects-id-response401-message-enum.d.ts +9 -1
- package/dist/types/delete-v1-image-projects-id-response401.d.ts +16 -3
- package/dist/types/delete-v1-image-projects-id-response401.js +65 -0
- package/dist/types/delete-v1-image-projects-id-response404-message-enum.d.ts +9 -1
- package/dist/types/delete-v1-image-projects-id-response404.d.ts +16 -3
- package/dist/types/delete-v1-image-projects-id-response404.js +65 -0
- package/dist/types/delete-v1-video-projects-id-response400.d.ts +14 -1
- package/dist/types/delete-v1-video-projects-id-response400.js +65 -0
- package/dist/types/delete-v1-video-projects-id-response401-message-enum.d.ts +9 -1
- package/dist/types/delete-v1-video-projects-id-response401.d.ts +16 -3
- package/dist/types/delete-v1-video-projects-id-response401.js +65 -0
- package/dist/types/delete-v1-video-projects-id-response404-message-enum.d.ts +9 -1
- package/dist/types/delete-v1-video-projects-id-response404.d.ts +16 -3
- package/dist/types/delete-v1-video-projects-id-response404.js +65 -0
- package/dist/types/delete-v1-video-projects-id-response422.d.ts +14 -1
- package/dist/types/delete-v1-video-projects-id-response422.js +65 -0
- package/dist/types/get-v1-image-projects-id-response-downloads-item.d.ts +15 -1
- package/dist/types/get-v1-image-projects-id-response-downloads-item.js +69 -0
- package/dist/types/get-v1-image-projects-id-response-error.d.ts +15 -1
- package/dist/types/get-v1-image-projects-id-response-error.js +69 -0
- package/dist/types/get-v1-image-projects-id-response-status-enum.d.ts +9 -1
- package/dist/types/get-v1-image-projects-id-response-type-enum.d.ts +9 -1
- package/dist/types/get-v1-image-projects-id-response.d.ts +34 -9
- package/dist/types/get-v1-image-projects-id-response.js +133 -0
- package/dist/types/get-v1-image-projects-id-response400.d.ts +14 -1
- package/dist/types/get-v1-image-projects-id-response400.js +65 -0
- package/dist/types/get-v1-image-projects-id-response401-message-enum.d.ts +9 -1
- package/dist/types/get-v1-image-projects-id-response401.d.ts +16 -3
- package/dist/types/get-v1-image-projects-id-response401.js +65 -0
- package/dist/types/get-v1-image-projects-id-response404-message-enum.d.ts +9 -1
- package/dist/types/get-v1-image-projects-id-response404.d.ts +16 -3
- package/dist/types/get-v1-image-projects-id-response404.js +65 -0
- package/dist/types/get-v1-video-projects-id-response-download.d.ts +16 -2
- package/dist/types/get-v1-video-projects-id-response-download.js +69 -0
- package/dist/types/get-v1-video-projects-id-response-downloads-item.d.ts +24 -0
- package/dist/types/get-v1-video-projects-id-response-downloads-item.js +74 -0
- package/dist/types/get-v1-video-projects-id-response-error.d.ts +15 -1
- package/dist/types/get-v1-video-projects-id-response-error.js +69 -0
- package/dist/types/get-v1-video-projects-id-response-status-enum.d.ts +9 -1
- package/dist/types/get-v1-video-projects-id-response-type-enum.d.ts +9 -1
- package/dist/types/get-v1-video-projects-id-response.d.ts +44 -12
- package/dist/types/get-v1-video-projects-id-response.js +152 -0
- package/dist/types/get-v1-video-projects-id-response400.d.ts +14 -1
- package/dist/types/get-v1-video-projects-id-response400.js +65 -0
- package/dist/types/get-v1-video-projects-id-response401-message-enum.d.ts +9 -1
- package/dist/types/get-v1-video-projects-id-response401.d.ts +16 -3
- package/dist/types/get-v1-video-projects-id-response401.js +65 -0
- package/dist/types/get-v1-video-projects-id-response404-message-enum.d.ts +9 -1
- package/dist/types/get-v1-video-projects-id-response404.d.ts +16 -3
- package/dist/types/get-v1-video-projects-id-response404.js +65 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/post-v1-ai-headshot-generator-body-assets.d.ts +14 -1
- package/dist/types/post-v1-ai-headshot-generator-body-assets.js +65 -0
- package/dist/types/post-v1-ai-headshot-generator-body.d.ts +18 -4
- package/dist/types/post-v1-ai-headshot-generator-body.js +70 -0
- package/dist/types/post-v1-ai-headshot-generator-response.d.ts +19 -2
- package/dist/types/post-v1-ai-headshot-generator-response.js +69 -0
- package/dist/types/post-v1-ai-headshot-generator-response400.d.ts +14 -1
- package/dist/types/post-v1-ai-headshot-generator-response400.js +65 -0
- package/dist/types/post-v1-ai-headshot-generator-response401-message-enum.d.ts +9 -1
- package/dist/types/post-v1-ai-headshot-generator-response401.d.ts +16 -3
- package/dist/types/post-v1-ai-headshot-generator-response401.js +65 -0
- package/dist/types/post-v1-ai-headshot-generator-response404-message-enum.d.ts +9 -1
- package/dist/types/post-v1-ai-headshot-generator-response404.d.ts +16 -3
- package/dist/types/post-v1-ai-headshot-generator-response404.js +65 -0
- package/dist/types/post-v1-ai-headshot-generator-response422.d.ts +14 -1
- package/dist/types/post-v1-ai-headshot-generator-response422.js +65 -0
- package/dist/types/post-v1-ai-image-generator-body-orientation-enum.d.ts +9 -1
- package/dist/types/post-v1-ai-image-generator-body-style.d.ts +14 -1
- package/dist/types/post-v1-ai-image-generator-body-style.js +65 -0
- package/dist/types/post-v1-ai-image-generator-body.d.ts +23 -6
- package/dist/types/post-v1-ai-image-generator-body.js +78 -0
- package/dist/types/post-v1-ai-image-generator-response.d.ts +19 -2
- package/dist/types/post-v1-ai-image-generator-response.js +69 -0
- package/dist/types/post-v1-ai-image-generator-response400.d.ts +14 -1
- package/dist/types/post-v1-ai-image-generator-response400.js +65 -0
- package/dist/types/post-v1-ai-image-generator-response401-message-enum.d.ts +9 -1
- package/dist/types/post-v1-ai-image-generator-response401.d.ts +16 -3
- package/dist/types/post-v1-ai-image-generator-response401.js +65 -0
- package/dist/types/post-v1-ai-image-generator-response404-message-enum.d.ts +9 -1
- package/dist/types/post-v1-ai-image-generator-response404.d.ts +16 -3
- package/dist/types/post-v1-ai-image-generator-response404.js +65 -0
- package/dist/types/post-v1-ai-image-generator-response422.d.ts +14 -1
- package/dist/types/post-v1-ai-image-generator-response422.js +65 -0
- package/dist/types/post-v1-ai-image-upscaler-body-assets.d.ts +14 -1
- package/dist/types/post-v1-ai-image-upscaler-body-assets.js +65 -0
- package/dist/types/post-v1-ai-image-upscaler-body-style-enhancement-enum.d.ts +9 -1
- package/dist/types/post-v1-ai-image-upscaler-body-style.d.ts +18 -4
- package/dist/types/post-v1-ai-image-upscaler-body-style.js +69 -0
- package/dist/types/post-v1-ai-image-upscaler-body.d.ts +22 -5
- package/dist/types/post-v1-ai-image-upscaler-body.js +79 -0
- package/dist/types/post-v1-ai-image-upscaler-response.d.ts +19 -2
- package/dist/types/post-v1-ai-image-upscaler-response.js +69 -0
- package/dist/types/post-v1-ai-image-upscaler-response400.d.ts +14 -1
- package/dist/types/post-v1-ai-image-upscaler-response400.js +65 -0
- package/dist/types/post-v1-ai-image-upscaler-response401-message-enum.d.ts +9 -1
- package/dist/types/post-v1-ai-image-upscaler-response401.d.ts +16 -3
- package/dist/types/post-v1-ai-image-upscaler-response401.js +65 -0
- package/dist/types/post-v1-ai-image-upscaler-response404-message-enum.d.ts +9 -1
- package/dist/types/post-v1-ai-image-upscaler-response404.d.ts +16 -3
- package/dist/types/post-v1-ai-image-upscaler-response404.js +65 -0
- package/dist/types/post-v1-ai-image-upscaler-response422.d.ts +14 -1
- package/dist/types/post-v1-ai-image-upscaler-response422.js +65 -0
- package/dist/types/post-v1-ai-photo-editor-body-assets.d.ts +14 -1
- package/dist/types/post-v1-ai-photo-editor-body-assets.js +65 -0
- package/dist/types/post-v1-ai-photo-editor-body-style.d.ts +24 -6
- package/dist/types/post-v1-ai-photo-editor-body-style.js +85 -0
- package/dist/types/post-v1-ai-photo-editor-body.d.ts +24 -6
- package/dist/types/post-v1-ai-photo-editor-body.js +83 -0
- package/dist/types/post-v1-ai-photo-editor-response.d.ts +19 -2
- package/dist/types/post-v1-ai-photo-editor-response.js +69 -0
- package/dist/types/post-v1-ai-photo-editor-response400.d.ts +14 -1
- package/dist/types/post-v1-ai-photo-editor-response400.js +65 -0
- package/dist/types/post-v1-ai-photo-editor-response401-message-enum.d.ts +9 -1
- package/dist/types/post-v1-ai-photo-editor-response401.d.ts +16 -3
- package/dist/types/post-v1-ai-photo-editor-response401.js +65 -0
- package/dist/types/post-v1-ai-photo-editor-response404-message-enum.d.ts +9 -1
- package/dist/types/post-v1-ai-photo-editor-response404.d.ts +16 -3
- package/dist/types/post-v1-ai-photo-editor-response404.js +65 -0
- package/dist/types/post-v1-ai-photo-editor-response422.d.ts +14 -1
- package/dist/types/post-v1-ai-photo-editor-response422.js +65 -0
- package/dist/types/post-v1-ai-qr-code-generator-body-style.d.ts +14 -1
- package/dist/types/post-v1-ai-qr-code-generator-body-style.js +65 -0
- package/dist/types/post-v1-ai-qr-code-generator-body.d.ts +19 -4
- package/dist/types/post-v1-ai-qr-code-generator-body.js +74 -0
- package/dist/types/post-v1-ai-qr-code-generator-response.d.ts +19 -2
- package/dist/types/post-v1-ai-qr-code-generator-response.js +69 -0
- package/dist/types/post-v1-ai-qr-code-generator-response400.d.ts +14 -1
- package/dist/types/post-v1-ai-qr-code-generator-response400.js +65 -0
- package/dist/types/post-v1-ai-qr-code-generator-response401-message-enum.d.ts +9 -1
- package/dist/types/post-v1-ai-qr-code-generator-response401.d.ts +16 -3
- package/dist/types/post-v1-ai-qr-code-generator-response401.js +65 -0
- package/dist/types/post-v1-ai-qr-code-generator-response404-message-enum.d.ts +9 -1
- package/dist/types/post-v1-ai-qr-code-generator-response404.d.ts +16 -3
- package/dist/types/post-v1-ai-qr-code-generator-response404.js +65 -0
- package/dist/types/post-v1-ai-qr-code-generator-response422.d.ts +14 -1
- package/dist/types/post-v1-ai-qr-code-generator-response422.js +65 -0
- package/dist/types/post-v1-animation-body-assets-audio-source-enum.d.ts +9 -1
- package/dist/types/post-v1-animation-body-assets.d.ts +22 -6
- package/dist/types/post-v1-animation-body-assets.js +77 -0
- package/dist/types/post-v1-animation-body-style-art-style-enum.d.ts +9 -1
- package/dist/types/post-v1-animation-body-style-camera-effect-enum.d.ts +9 -1
- package/dist/types/post-v1-animation-body-style-prompt-type-enum.d.ts +12 -1
- package/dist/types/post-v1-animation-body-style.d.ts +27 -7
- package/dist/types/post-v1-animation-body-style.js +287 -0
- package/dist/types/post-v1-animation-body.d.ts +26 -6
- package/dist/types/post-v1-animation-body.js +91 -0
- package/dist/types/post-v1-animation-response.d.ts +16 -2
- package/dist/types/post-v1-animation-response.js +69 -0
- package/dist/types/post-v1-animation-response400.d.ts +14 -1
- package/dist/types/post-v1-animation-response400.js +65 -0
- package/dist/types/post-v1-animation-response401-message-enum.d.ts +9 -1
- package/dist/types/post-v1-animation-response401.d.ts +16 -3
- package/dist/types/post-v1-animation-response401.js +65 -0
- package/dist/types/post-v1-animation-response404-message-enum.d.ts +9 -1
- package/dist/types/post-v1-animation-response404.d.ts +16 -3
- package/dist/types/post-v1-animation-response404.js +65 -0
- package/dist/types/post-v1-animation-response422.d.ts +14 -1
- package/dist/types/post-v1-animation-response422.js +65 -0
- package/dist/types/post-v1-face-swap-body-assets-video-source-enum.d.ts +9 -1
- package/dist/types/post-v1-face-swap-body-assets.d.ts +22 -6
- package/dist/types/post-v1-face-swap-body-assets.js +77 -0
- package/dist/types/post-v1-face-swap-body.d.ts +24 -6
- package/dist/types/post-v1-face-swap-body.js +86 -0
- package/dist/types/post-v1-face-swap-photo-body-assets.d.ts +16 -2
- package/dist/types/post-v1-face-swap-photo-body-assets.js +69 -0
- package/dist/types/post-v1-face-swap-photo-body.d.ts +18 -4
- package/dist/types/post-v1-face-swap-photo-body.js +70 -0
- package/dist/types/post-v1-face-swap-photo-response.d.ts +19 -2
- package/dist/types/post-v1-face-swap-photo-response.js +69 -0
- package/dist/types/post-v1-face-swap-photo-response400.d.ts +14 -1
- package/dist/types/post-v1-face-swap-photo-response400.js +65 -0
- package/dist/types/post-v1-face-swap-photo-response401-message-enum.d.ts +9 -1
- package/dist/types/post-v1-face-swap-photo-response401.d.ts +16 -3
- package/dist/types/post-v1-face-swap-photo-response401.js +65 -0
- package/dist/types/post-v1-face-swap-photo-response404-message-enum.d.ts +9 -1
- package/dist/types/post-v1-face-swap-photo-response404.d.ts +16 -3
- package/dist/types/post-v1-face-swap-photo-response404.js +65 -0
- package/dist/types/post-v1-face-swap-photo-response422.d.ts +14 -1
- package/dist/types/post-v1-face-swap-photo-response422.js +65 -0
- package/dist/types/post-v1-face-swap-response.d.ts +16 -2
- package/dist/types/post-v1-face-swap-response.js +69 -0
- package/dist/types/post-v1-face-swap-response400.d.ts +14 -1
- package/dist/types/post-v1-face-swap-response400.js +65 -0
- package/dist/types/post-v1-face-swap-response401-message-enum.d.ts +9 -1
- package/dist/types/post-v1-face-swap-response401.d.ts +16 -3
- package/dist/types/post-v1-face-swap-response401.js +65 -0
- package/dist/types/post-v1-face-swap-response404-message-enum.d.ts +9 -1
- package/dist/types/post-v1-face-swap-response404.d.ts +16 -3
- package/dist/types/post-v1-face-swap-response404.js +65 -0
- package/dist/types/post-v1-face-swap-response422.d.ts +14 -1
- package/dist/types/post-v1-face-swap-response422.js +65 -0
- package/dist/types/post-v1-files-upload-urls-body-items-item-type-enum.d.ts +9 -1
- package/dist/types/post-v1-files-upload-urls-body-items-item.d.ts +17 -3
- package/dist/types/post-v1-files-upload-urls-body-items-item.js +69 -0
- package/dist/types/post-v1-files-upload-urls-body.d.ts +16 -3
- package/dist/types/post-v1-files-upload-urls-body.js +66 -0
- package/dist/types/post-v1-files-upload-urls-response-items-item.d.ts +18 -3
- package/dist/types/post-v1-files-upload-urls-response-items-item.js +73 -0
- package/dist/types/post-v1-files-upload-urls-response.d.ts +16 -3
- package/dist/types/post-v1-files-upload-urls-response.js +66 -0
- package/dist/types/post-v1-files-upload-urls-response400.d.ts +14 -1
- package/dist/types/post-v1-files-upload-urls-response400.js +65 -0
- package/dist/types/post-v1-files-upload-urls-response401-message-enum.d.ts +9 -1
- package/dist/types/post-v1-files-upload-urls-response401.d.ts +16 -3
- package/dist/types/post-v1-files-upload-urls-response401.js +65 -0
- package/dist/types/post-v1-files-upload-urls-response404-message-enum.d.ts +9 -1
- package/dist/types/post-v1-files-upload-urls-response404.d.ts +16 -3
- package/dist/types/post-v1-files-upload-urls-response404.js +65 -0
- package/dist/types/post-v1-files-upload-urls-response422.d.ts +14 -1
- package/dist/types/post-v1-files-upload-urls-response422.js +65 -0
- package/dist/types/post-v1-image-background-remover-body-assets.d.ts +25 -0
- package/dist/types/post-v1-image-background-remover-body-assets.js +70 -0
- package/dist/types/post-v1-image-background-remover-body.d.ts +31 -0
- package/dist/types/post-v1-image-background-remover-body.js +75 -0
- package/dist/types/post-v1-image-background-remover-response.d.ts +30 -0
- package/dist/types/post-v1-image-background-remover-response.js +74 -0
- package/dist/types/post-v1-image-background-remover-response400.d.ts +22 -0
- package/dist/types/post-v1-image-background-remover-response400.js +70 -0
- package/dist/types/post-v1-image-background-remover-response401-message-enum.d.ts +12 -0
- package/dist/types/post-v1-image-background-remover-response401-message-enum.js +2 -0
- package/dist/types/post-v1-image-background-remover-response401.d.ts +23 -0
- package/dist/types/post-v1-image-background-remover-response401.js +70 -0
- package/dist/types/post-v1-image-background-remover-response404-message-enum.d.ts +12 -0
- package/dist/types/post-v1-image-background-remover-response404-message-enum.js +2 -0
- package/dist/types/post-v1-image-background-remover-response404.d.ts +23 -0
- package/dist/types/post-v1-image-background-remover-response404.js +70 -0
- package/dist/types/post-v1-image-background-remover-response422.d.ts +22 -0
- package/dist/types/post-v1-image-background-remover-response422.js +70 -0
- package/dist/types/post-v1-image-to-video-body-assets.d.ts +14 -1
- package/dist/types/post-v1-image-to-video-body-assets.js +65 -0
- package/dist/types/post-v1-image-to-video-body-style.d.ts +15 -2
- package/dist/types/post-v1-image-to-video-body-style.js +65 -0
- package/dist/types/post-v1-image-to-video-body.d.ts +25 -6
- package/dist/types/post-v1-image-to-video-body.js +87 -0
- package/dist/types/post-v1-image-to-video-response.d.ts +16 -2
- package/dist/types/post-v1-image-to-video-response.js +69 -0
- package/dist/types/post-v1-image-to-video-response400.d.ts +14 -1
- package/dist/types/post-v1-image-to-video-response400.js +65 -0
- package/dist/types/post-v1-image-to-video-response401-message-enum.d.ts +9 -1
- package/dist/types/post-v1-image-to-video-response401.d.ts +16 -3
- package/dist/types/post-v1-image-to-video-response401.js +65 -0
- package/dist/types/post-v1-image-to-video-response404-message-enum.d.ts +9 -1
- package/dist/types/post-v1-image-to-video-response404.d.ts +16 -3
- package/dist/types/post-v1-image-to-video-response404.js +65 -0
- package/dist/types/post-v1-image-to-video-response422.d.ts +14 -1
- package/dist/types/post-v1-image-to-video-response422.js +65 -0
- package/dist/types/post-v1-lip-sync-body-assets-video-source-enum.d.ts +9 -1
- package/dist/types/post-v1-lip-sync-body-assets.d.ts +22 -6
- package/dist/types/post-v1-lip-sync-body-assets.js +77 -0
- package/dist/types/post-v1-lip-sync-body.d.ts +26 -7
- package/dist/types/post-v1-lip-sync-body.js +90 -0
- package/dist/types/post-v1-lip-sync-response.d.ts +16 -2
- package/dist/types/post-v1-lip-sync-response.js +69 -0
- package/dist/types/post-v1-lip-sync-response400.d.ts +14 -1
- package/dist/types/post-v1-lip-sync-response400.js +65 -0
- package/dist/types/post-v1-lip-sync-response401-message-enum.d.ts +9 -1
- package/dist/types/post-v1-lip-sync-response401.d.ts +16 -3
- package/dist/types/post-v1-lip-sync-response401.js +65 -0
- package/dist/types/post-v1-lip-sync-response404-message-enum.d.ts +9 -1
- package/dist/types/post-v1-lip-sync-response404.d.ts +16 -3
- package/dist/types/post-v1-lip-sync-response404.js +65 -0
- package/dist/types/post-v1-lip-sync-response422.d.ts +14 -1
- package/dist/types/post-v1-lip-sync-response422.js +65 -0
- package/dist/types/post-v1-text-to-video-body-orientation-enum.d.ts +9 -1
- package/dist/types/post-v1-text-to-video-body-style.d.ts +14 -1
- package/dist/types/post-v1-text-to-video-body-style.js +65 -0
- package/dist/types/post-v1-text-to-video-body.d.ts +23 -6
- package/dist/types/post-v1-text-to-video-body.js +78 -0
- package/dist/types/post-v1-text-to-video-response.d.ts +16 -2
- package/dist/types/post-v1-text-to-video-response.js +69 -0
- package/dist/types/post-v1-text-to-video-response400.d.ts +14 -1
- package/dist/types/post-v1-text-to-video-response400.js +65 -0
- package/dist/types/post-v1-text-to-video-response401-message-enum.d.ts +9 -1
- package/dist/types/post-v1-text-to-video-response401.d.ts +16 -3
- package/dist/types/post-v1-text-to-video-response401.js +65 -0
- package/dist/types/post-v1-text-to-video-response404-message-enum.d.ts +9 -1
- package/dist/types/post-v1-text-to-video-response404.d.ts +16 -3
- package/dist/types/post-v1-text-to-video-response404.js +65 -0
- package/dist/types/post-v1-text-to-video-response422.d.ts +14 -1
- package/dist/types/post-v1-text-to-video-response422.js +65 -0
- package/dist/types/post-v1-video-to-video-body-assets-video-source-enum.d.ts +9 -1
- package/dist/types/post-v1-video-to-video-body-assets.d.ts +20 -5
- package/dist/types/post-v1-video-to-video-body-assets.js +73 -0
- package/dist/types/post-v1-video-to-video-body-fps-resolution-enum.d.ts +11 -1
- package/dist/types/post-v1-video-to-video-body-style-art-style-enum.d.ts +9 -1
- package/dist/types/post-v1-video-to-video-body-style-model-enum.d.ts +12 -1
- package/dist/types/post-v1-video-to-video-body-style-prompt-type-enum.d.ts +11 -1
- package/dist/types/post-v1-video-to-video-body-style-version-enum.d.ts +11 -1
- package/dist/types/post-v1-video-to-video-body-style.d.ts +27 -7
- package/dist/types/post-v1-video-to-video-body-style.js +211 -0
- package/dist/types/post-v1-video-to-video-body.d.ts +30 -8
- package/dist/types/post-v1-video-to-video-body.js +95 -0
- package/dist/types/post-v1-video-to-video-response.d.ts +16 -2
- package/dist/types/post-v1-video-to-video-response.js +69 -0
- package/dist/types/post-v1-video-to-video-response400.d.ts +14 -1
- package/dist/types/post-v1-video-to-video-response400.js +65 -0
- package/dist/types/post-v1-video-to-video-response401-message-enum.d.ts +9 -1
- package/dist/types/post-v1-video-to-video-response401.d.ts +16 -3
- package/dist/types/post-v1-video-to-video-response401.js +65 -0
- package/dist/types/post-v1-video-to-video-response404-message-enum.d.ts +9 -1
- package/dist/types/post-v1-video-to-video-response404.d.ts +16 -3
- package/dist/types/post-v1-video-to-video-response404.js +65 -0
- package/dist/types/post-v1-video-to-video-response422.d.ts +14 -1
- package/dist/types/post-v1-video-to-video-response422.js +65 -0
- package/package.json +12 -11
package/README.md
CHANGED
|
@@ -72,10 +72,14 @@ const client = new Client({ token: process.env["API_TOKEN"]!! });
|
|
|
72
72
|
|
|
73
73
|
* [create](src/resources/v1/files/upload-urls/README.md#create) - Generate asset upload urls
|
|
74
74
|
|
|
75
|
+
### [v1.image_background_remover](src/resources/v1/image-background-remover/README.md)
|
|
76
|
+
|
|
77
|
+
* [create](src/resources/v1/image-background-remover/README.md#create) - Image Background Remover
|
|
78
|
+
|
|
75
79
|
### [v1.image_projects](src/resources/v1/image-projects/README.md)
|
|
76
80
|
|
|
77
81
|
* [delete](src/resources/v1/image-projects/README.md#delete) - Delete image
|
|
78
|
-
* [get](src/resources/v1/image-projects/README.md#get) - Get image
|
|
82
|
+
* [get](src/resources/v1/image-projects/README.md#get) - Get image details
|
|
79
83
|
|
|
80
84
|
### [v1.image_to_video](src/resources/v1/image-to-video/README.md)
|
|
81
85
|
|
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generated by Sideko (sideko.dev)
|
|
3
3
|
**/
|
|
4
|
+
import * as z from "zod";
|
|
4
5
|
import { Response as NodeResponse } from "node-fetch";
|
|
5
6
|
import { ResponseType } from "./core-client";
|
|
6
7
|
export interface ApiPromiseProps {
|
|
7
|
-
|
|
8
|
-
responseType
|
|
8
|
+
responsePromise: Promise<Response | NodeResponse>;
|
|
9
|
+
responseType?: ResponseType | undefined;
|
|
10
|
+
responseSchema?: z.Schema | undefined;
|
|
9
11
|
}
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
export type EventSourceResponse<T> = AsyncIterableIterator<T>;
|
|
13
|
+
export declare class ApiPromise<T> extends Promise<T> implements AsyncIterator<T>, AsyncIterable<T> {
|
|
14
|
+
private responseProps;
|
|
15
|
+
constructor(responseProps: ApiPromiseProps);
|
|
13
16
|
/**
|
|
14
|
-
* Gets the raw response as
|
|
17
|
+
* Gets the raw response as returned by `fetch` rather than automatically
|
|
15
18
|
* parsing the response.
|
|
16
19
|
*/
|
|
17
20
|
asResponse(): Promise<Response | NodeResponse>;
|
|
18
21
|
private parseResponse;
|
|
22
|
+
private handleNodeStream;
|
|
23
|
+
private handleWebStream;
|
|
24
|
+
asEventStream(): AsyncIterableIterator<T>;
|
|
25
|
+
next(): Promise<IteratorResult<T>>;
|
|
26
|
+
[Symbol.asyncIterator](): AsyncIterator<T>;
|
|
19
27
|
then<Result1 = T, Result2 = never>(onfulfilled?: ((value: T) => Result1 | PromiseLike<Result1>) | undefined | null, onrejected?: ((reason: any) => Result2 | PromiseLike<Result2>) | undefined | null): Promise<Result1 | Result2>;
|
|
20
28
|
catch<Result = never>(onrejected?: ((reason: any) => Result | PromiseLike<Result>) | undefined | null): Promise<T | Result>;
|
|
21
29
|
finally(onfinally?: (() => void) | undefined | null): Promise<T>;
|
package/dist/core/api-promise.js
CHANGED
|
@@ -11,31 +11,54 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
12
|
});
|
|
13
13
|
};
|
|
14
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
15
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
16
|
+
var m = o[Symbol.asyncIterator], i;
|
|
17
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
18
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
19
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
20
|
+
};
|
|
21
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
22
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
23
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
24
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
25
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
26
|
+
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
27
|
+
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
28
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
29
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
30
|
+
function fulfill(value) { resume("next", value); }
|
|
31
|
+
function reject(value) { resume("throw", value); }
|
|
32
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
33
|
+
};
|
|
34
|
+
var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
|
|
35
|
+
var i, p;
|
|
36
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
37
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
|
38
|
+
};
|
|
14
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
40
|
exports.ApiPromise = void 0;
|
|
16
41
|
const binary_response_1 = require("./binary-response");
|
|
17
42
|
class ApiPromise extends Promise {
|
|
18
|
-
constructor(
|
|
43
|
+
constructor(responseProps) {
|
|
19
44
|
super((resolve) => {
|
|
20
|
-
// left purposely as a no-op to avoid automatically parsing the response
|
|
21
|
-
// body. Instead, .then, .catch, and .finally overridden to explicitly
|
|
22
|
-
// parse the response
|
|
23
45
|
resolve(null);
|
|
24
46
|
});
|
|
25
|
-
this.
|
|
47
|
+
this.responseProps = responseProps;
|
|
26
48
|
}
|
|
27
49
|
/**
|
|
28
|
-
* Gets the raw response as
|
|
50
|
+
* Gets the raw response as returned by `fetch` rather than automatically
|
|
29
51
|
* parsing the response.
|
|
30
52
|
*/
|
|
31
53
|
asResponse() {
|
|
32
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
return
|
|
55
|
+
return yield this.responseProps.responsePromise;
|
|
34
56
|
});
|
|
35
57
|
}
|
|
36
58
|
parseResponse() {
|
|
37
59
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
const {
|
|
60
|
+
const { responsePromise, responseType, responseSchema } = this.responseProps;
|
|
61
|
+
const response = yield responsePromise;
|
|
39
62
|
const contentType = response.headers.get("content-type");
|
|
40
63
|
if (response.status === 204) {
|
|
41
64
|
return null;
|
|
@@ -44,17 +67,122 @@ class ApiPromise extends Promise {
|
|
|
44
67
|
return new binary_response_1.BinaryResponse(yield response.blob(), contentType);
|
|
45
68
|
}
|
|
46
69
|
// use a pattern to match json content type to handle
|
|
47
|
-
// base case of application/json as well as vendor
|
|
70
|
+
// base case of application/json as well as vendor specific
|
|
48
71
|
// headers e.g. application/vnd.github+json
|
|
49
72
|
const jsonPattern = /application\/.*json/g;
|
|
50
73
|
if (contentType === null || contentType === void 0 ? void 0 : contentType.match(jsonPattern)) {
|
|
51
|
-
|
|
74
|
+
const rawJson = yield response.json();
|
|
75
|
+
return responseSchema ? responseSchema.parse(rawJson) : rawJson;
|
|
52
76
|
}
|
|
53
77
|
// fall back on text
|
|
54
78
|
return (yield response.text());
|
|
55
79
|
});
|
|
56
80
|
}
|
|
81
|
+
handleNodeStream(stream) {
|
|
82
|
+
return __asyncGenerator(this, arguments, function* handleNodeStream_1() {
|
|
83
|
+
var _a, e_1, _b, _c;
|
|
84
|
+
const { responseSchema } = this.responseProps;
|
|
85
|
+
const parser = new EventSourceParser();
|
|
86
|
+
try {
|
|
87
|
+
for (var _d = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield __await(stream_1.next()), _a = stream_1_1.done, !_a; _d = true) {
|
|
88
|
+
_c = stream_1_1.value;
|
|
89
|
+
_d = false;
|
|
90
|
+
const chunk = _c;
|
|
91
|
+
const text = chunk.toString();
|
|
92
|
+
const messages = parser.parse(text);
|
|
93
|
+
for (const message of messages) {
|
|
94
|
+
if (message.data) {
|
|
95
|
+
const rawJson = { data: JSON.parse(message.data) };
|
|
96
|
+
yield yield __await(responseSchema ? responseSchema.parse(rawJson) : rawJson);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
102
|
+
finally {
|
|
103
|
+
try {
|
|
104
|
+
if (!_d && !_a && (_b = stream_1.return)) yield __await(_b.call(stream_1));
|
|
105
|
+
}
|
|
106
|
+
finally { if (e_1) throw e_1.error; }
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
handleWebStream(stream) {
|
|
111
|
+
return __asyncGenerator(this, arguments, function* handleWebStream_1() {
|
|
112
|
+
const { responseSchema } = this.responseProps;
|
|
113
|
+
const reader = stream.getReader();
|
|
114
|
+
const decoder = new TextDecoder();
|
|
115
|
+
const parser = new EventSourceParser();
|
|
116
|
+
try {
|
|
117
|
+
while (true) {
|
|
118
|
+
const { done, value } = yield __await(reader.read());
|
|
119
|
+
if (done) {
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
const chunk = decoder.decode(value, { stream: true });
|
|
123
|
+
const messages = parser.parse(chunk);
|
|
124
|
+
for (const message of messages) {
|
|
125
|
+
if (message.data) {
|
|
126
|
+
const rawJson = { data: JSON.parse(message.data) };
|
|
127
|
+
yield yield __await(responseSchema ? responseSchema.parse(rawJson) : rawJson);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
finally {
|
|
133
|
+
reader.releaseLock();
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
asEventStream() {
|
|
138
|
+
return __asyncGenerator(this, arguments, function* asEventStream_1() {
|
|
139
|
+
const { responsePromise, responseType } = this.responseProps;
|
|
140
|
+
if (responseType !== "event-stream") {
|
|
141
|
+
throw new Error("Response is not an event stream");
|
|
142
|
+
}
|
|
143
|
+
const response = yield __await(responsePromise);
|
|
144
|
+
if (!response.body) {
|
|
145
|
+
throw new Error("Response body is undefined");
|
|
146
|
+
}
|
|
147
|
+
// Check if we're in Node.js environment
|
|
148
|
+
if ("pipe" in response.body && typeof response.body.pipe === "function") {
|
|
149
|
+
yield __await(yield* __asyncDelegator(__asyncValues(this.handleNodeStream(response.body))));
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
yield __await(yield* __asyncDelegator(__asyncValues(this.handleWebStream(response.body))));
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
next() {
|
|
157
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
const { responseType } = this.responseProps;
|
|
159
|
+
if (responseType === "event-stream") {
|
|
160
|
+
const iterator = this.asEventStream();
|
|
161
|
+
const result = yield iterator.next();
|
|
162
|
+
return result;
|
|
163
|
+
}
|
|
164
|
+
const value = yield this.parseResponse();
|
|
165
|
+
return { value, done: true };
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
[Symbol.asyncIterator]() {
|
|
169
|
+
const iterator = {
|
|
170
|
+
next: () => __awaiter(this, void 0, void 0, function* () {
|
|
171
|
+
const { responseType } = this.responseProps;
|
|
172
|
+
if (responseType === "event-stream") {
|
|
173
|
+
const stream = this.asEventStream();
|
|
174
|
+
return stream.next();
|
|
175
|
+
}
|
|
176
|
+
const value = yield this.parseResponse();
|
|
177
|
+
return { value, done: true };
|
|
178
|
+
}),
|
|
179
|
+
};
|
|
180
|
+
return iterator;
|
|
181
|
+
}
|
|
57
182
|
then(onfulfilled, onrejected) {
|
|
183
|
+
if (this.responseProps.responseType === "event-stream") {
|
|
184
|
+
return Promise.resolve(this.asEventStream());
|
|
185
|
+
}
|
|
58
186
|
return this.parseResponse().then(onfulfilled, onrejected);
|
|
59
187
|
}
|
|
60
188
|
catch(onrejected) {
|
|
@@ -65,3 +193,49 @@ class ApiPromise extends Promise {
|
|
|
65
193
|
}
|
|
66
194
|
}
|
|
67
195
|
exports.ApiPromise = ApiPromise;
|
|
196
|
+
class EventSourceParser {
|
|
197
|
+
constructor() {
|
|
198
|
+
this.buffer = "";
|
|
199
|
+
}
|
|
200
|
+
parse(chunk) {
|
|
201
|
+
this.buffer += chunk;
|
|
202
|
+
const messages = [];
|
|
203
|
+
const lines = this.buffer.split("\n");
|
|
204
|
+
// Keep the last line in buffer if it's not complete
|
|
205
|
+
this.buffer = lines.pop() || "";
|
|
206
|
+
let currentMessage = {};
|
|
207
|
+
for (const line of lines) {
|
|
208
|
+
if (line.trim() === "") {
|
|
209
|
+
if (currentMessage.data) {
|
|
210
|
+
const message = {
|
|
211
|
+
event: currentMessage.event,
|
|
212
|
+
data: currentMessage.data,
|
|
213
|
+
id: currentMessage.id,
|
|
214
|
+
};
|
|
215
|
+
messages.push(message);
|
|
216
|
+
}
|
|
217
|
+
currentMessage = {};
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
const [fieldName, ...fieldValue] = line.split(":");
|
|
221
|
+
const value = fieldValue.join(":").trim();
|
|
222
|
+
switch (fieldName) {
|
|
223
|
+
case "event":
|
|
224
|
+
currentMessage.event = value;
|
|
225
|
+
break;
|
|
226
|
+
case "data":
|
|
227
|
+
currentMessage.data = currentMessage.data
|
|
228
|
+
? currentMessage.data + "\n" + value
|
|
229
|
+
: value;
|
|
230
|
+
break;
|
|
231
|
+
case "id":
|
|
232
|
+
currentMessage.id = value;
|
|
233
|
+
break;
|
|
234
|
+
case "retry":
|
|
235
|
+
// Handle retry if needed
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return messages;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generated by Sideko (sideko.dev)
|
|
3
3
|
**/
|
|
4
|
+
import * as z from "zod";
|
|
4
5
|
import { AuthProvider } from "./auth";
|
|
5
6
|
import { ApiPromise } from "./api-promise";
|
|
6
7
|
export interface CoreClientProps {
|
|
7
8
|
baseUrl: string;
|
|
8
9
|
timeout?: number | undefined;
|
|
9
10
|
}
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
11
|
+
export type HttpMethod = "get" | "post" | "put" | "patch" | "delete";
|
|
12
|
+
export type ResponseType = "json" | "blob" | "unknown" | "event-stream";
|
|
13
|
+
export type RequestConfig = {
|
|
13
14
|
method: HttpMethod;
|
|
14
15
|
path: string;
|
|
15
16
|
responseType: ResponseType;
|
|
17
|
+
responseSchema?: z.Schema;
|
|
16
18
|
auth?: string[];
|
|
17
19
|
query?: string[];
|
|
18
20
|
body?: any;
|
package/dist/core/core-client.js
CHANGED
|
@@ -111,8 +111,8 @@ class CoreClient {
|
|
|
111
111
|
return reqInit;
|
|
112
112
|
}
|
|
113
113
|
request(cfg) {
|
|
114
|
-
var _a, _b;
|
|
115
114
|
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
var _a, _b;
|
|
116
116
|
const fetcherFn = runtime_1.RUNTIME.type === "node" || typeof fetch !== "function"
|
|
117
117
|
? require("node-fetch").default
|
|
118
118
|
: fetch;
|
|
@@ -133,11 +133,15 @@ class CoreClient {
|
|
|
133
133
|
if (!response.ok) {
|
|
134
134
|
throw new api_error_1.ApiError(cfg, response);
|
|
135
135
|
}
|
|
136
|
-
return
|
|
136
|
+
return response;
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
makeRequest(cfg) {
|
|
140
|
-
return new api_promise_1.ApiPromise(
|
|
140
|
+
return new api_promise_1.ApiPromise({
|
|
141
|
+
responsePromise: this.request(cfg),
|
|
142
|
+
responseType: cfg.responseType,
|
|
143
|
+
responseSchema: cfg.responseSchema,
|
|
144
|
+
});
|
|
141
145
|
}
|
|
142
146
|
}
|
|
143
147
|
exports.CoreClient = CoreClient;
|
package/dist/core/form-data.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generated by Sideko (sideko.dev)
|
|
3
3
|
**/
|
|
4
|
-
/// <reference types="node" />
|
|
5
4
|
import { type ReadStream as NodeReadStream } from "node:fs";
|
|
6
|
-
export
|
|
5
|
+
export type UploadFile = FileLike | NodeReadStream;
|
|
7
6
|
export declare function isUploadFile(val: any): val is UploadFile;
|
|
8
7
|
export declare function isNodeReadStream(val: any): val is NodeReadStream;
|
|
9
8
|
/**
|
package/dist/core/form-data.js
CHANGED
|
@@ -3,14 +3,17 @@
|
|
|
3
3
|
* Generated by Sideko (sideko.dev)
|
|
4
4
|
**/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.isUploadFile = isUploadFile;
|
|
7
|
+
exports.isNodeReadStream = isNodeReadStream;
|
|
8
|
+
exports.isFileLike = isFileLike;
|
|
9
|
+
exports.isBlobLike = isBlobLike;
|
|
10
|
+
exports.createForm = createForm;
|
|
7
11
|
const runtime_1 = require("./runtime");
|
|
8
12
|
function isUploadFile(val) {
|
|
9
13
|
return isFileLike(val) || isNodeReadStream(val);
|
|
10
14
|
}
|
|
11
|
-
exports.isUploadFile = isUploadFile;
|
|
12
15
|
function isNodeReadStream(val) {
|
|
13
|
-
// node read stream
|
|
16
|
+
// node read stream duck-typing check
|
|
14
17
|
return (runtime_1.RUNTIME.type === "node" &&
|
|
15
18
|
typeof val === "object" &&
|
|
16
19
|
typeof val.bytesRead === "number" &&
|
|
@@ -27,7 +30,6 @@ function isNodeReadStream(val) {
|
|
|
27
30
|
typeof val.unshift === "function" &&
|
|
28
31
|
typeof val.wrap === "function");
|
|
29
32
|
}
|
|
30
|
-
exports.isNodeReadStream = isNodeReadStream;
|
|
31
33
|
function isFileLike(val) {
|
|
32
34
|
// https://developer.mozilla.org/docs/Web/API/File
|
|
33
35
|
// https://github.com/node-fetch/fetch-blob/blob/main/file.js
|
|
@@ -35,7 +37,6 @@ function isFileLike(val) {
|
|
|
35
37
|
typeof (val === null || val === void 0 ? void 0 : val.name) === "string" &&
|
|
36
38
|
isBlobLike(val));
|
|
37
39
|
}
|
|
38
|
-
exports.isFileLike = isFileLike;
|
|
39
40
|
function isBlobLike(val) {
|
|
40
41
|
// https://developer.mozilla.org/docs/Web/API/Blob
|
|
41
42
|
// https://github.com/node-fetch/fetch-blob/blob/main/index.js
|
|
@@ -45,7 +46,6 @@ function isBlobLike(val) {
|
|
|
45
46
|
typeof (val === null || val === void 0 ? void 0 : val.text) === "function" &&
|
|
46
47
|
typeof (val === null || val === void 0 ? void 0 : val.arrayBuffer) === "function");
|
|
47
48
|
}
|
|
48
|
-
exports.isBlobLike = isBlobLike;
|
|
49
49
|
function appendFormData(form, key, val) {
|
|
50
50
|
if (val === null || typeof val === "undefined") {
|
|
51
51
|
return;
|
|
@@ -84,4 +84,3 @@ function createForm(data) {
|
|
|
84
84
|
}
|
|
85
85
|
return form;
|
|
86
86
|
}
|
|
87
|
-
exports.createForm = createForm;
|
package/dist/core/index.d.ts
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
export { CoreClient, CoreClientProps, CoreResourceClient, RequestOptions, } from "./core-client";
|
|
5
5
|
export { AuthProvider, AuthBasic, AuthBearer, AuthKeyQuery, AuthKeyHeader, AuthCookieHeader, } from "./auth";
|
|
6
6
|
export { RUNTIME } from "./runtime";
|
|
7
|
-
export { ApiPromise } from "./api-promise";
|
|
7
|
+
export { ApiPromise, EventSourceResponse } from "./api-promise";
|
|
8
8
|
export { BinaryResponse } from "./binary-response";
|
|
9
9
|
export { ApiError } from "./api-error";
|
|
10
10
|
export { createForm, UploadFile, isUploadFile } from "./form-data";
|
|
11
|
+
export { zodTransform, zodUploadFile } from "./zod";
|
package/dist/core/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Generated by Sideko (sideko.dev)
|
|
4
4
|
**/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isUploadFile = exports.createForm = exports.ApiError = exports.BinaryResponse = exports.ApiPromise = exports.RUNTIME = exports.AuthCookieHeader = exports.AuthKeyHeader = exports.AuthKeyQuery = exports.AuthBearer = exports.AuthBasic = exports.CoreResourceClient = exports.CoreClient = void 0;
|
|
6
|
+
exports.zodUploadFile = exports.zodTransform = exports.isUploadFile = exports.createForm = exports.ApiError = exports.BinaryResponse = exports.ApiPromise = exports.RUNTIME = exports.AuthCookieHeader = exports.AuthKeyHeader = exports.AuthKeyQuery = exports.AuthBearer = exports.AuthBasic = exports.CoreResourceClient = exports.CoreClient = void 0;
|
|
7
7
|
var core_client_1 = require("./core-client");
|
|
8
8
|
Object.defineProperty(exports, "CoreClient", { enumerable: true, get: function () { return core_client_1.CoreClient; } });
|
|
9
9
|
Object.defineProperty(exports, "CoreResourceClient", { enumerable: true, get: function () { return core_client_1.CoreResourceClient; } });
|
|
@@ -24,3 +24,6 @@ Object.defineProperty(exports, "ApiError", { enumerable: true, get: function ()
|
|
|
24
24
|
var form_data_1 = require("./form-data");
|
|
25
25
|
Object.defineProperty(exports, "createForm", { enumerable: true, get: function () { return form_data_1.createForm; } });
|
|
26
26
|
Object.defineProperty(exports, "isUploadFile", { enumerable: true, get: function () { return form_data_1.isUploadFile; } });
|
|
27
|
+
var zod_1 = require("./zod");
|
|
28
|
+
Object.defineProperty(exports, "zodTransform", { enumerable: true, get: function () { return zod_1.zodTransform; } });
|
|
29
|
+
Object.defineProperty(exports, "zodUploadFile", { enumerable: true, get: function () { return zod_1.zodUploadFile; } });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by Sideko (sideko.dev)
|
|
3
|
+
**/
|
|
4
|
+
import * as z from "zod";
|
|
5
|
+
import { UploadFile } from "./form-data";
|
|
6
|
+
/**
|
|
7
|
+
* Generic function to transform an objects keys from one string to another.
|
|
8
|
+
* If the incoming object does not have a transform key, the original key is retained.
|
|
9
|
+
* If the incoming object has a key that maps to a `null` transform key, then
|
|
10
|
+
* the value is skipped.
|
|
11
|
+
*/
|
|
12
|
+
export declare function zodTransform<Input extends Record<string, unknown>, const Transformer extends {
|
|
13
|
+
[k in keyof Input]?: string | null;
|
|
14
|
+
}>(input: Input, transformer: Transformer): any;
|
|
15
|
+
export declare const zodUploadFile: z.ZodType<UploadFile, z.ZodTypeDef, UploadFile>;
|
package/dist/core/zod.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Generated by Sideko (sideko.dev)
|
|
4
|
+
**/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.zodUploadFile = void 0;
|
|
40
|
+
exports.zodTransform = zodTransform;
|
|
41
|
+
const z = __importStar(require("zod"));
|
|
42
|
+
const form_data_1 = require("./form-data");
|
|
43
|
+
/**
|
|
44
|
+
* Generic function to transform an objects keys from one string to another.
|
|
45
|
+
* If the incoming object does not have a transform key, the original key is retained.
|
|
46
|
+
* If the incoming object has a key that maps to a `null` transform key, then
|
|
47
|
+
* the value is skipped.
|
|
48
|
+
*/
|
|
49
|
+
function zodTransform(input, transformer) {
|
|
50
|
+
let transformed = {};
|
|
51
|
+
for (const [key, val] of Object.entries(input)) {
|
|
52
|
+
const toKey = transformer[key];
|
|
53
|
+
if (toKey === null) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
transformed[toKey !== null && toKey !== void 0 ? toKey : key] = val;
|
|
57
|
+
}
|
|
58
|
+
return transformed;
|
|
59
|
+
}
|
|
60
|
+
exports.zodUploadFile = z.custom((val) => (0, form_data_1.isUploadFile)(val));
|
package/dist/environment.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.types = exports.resources = exports.Environment = exports.isUploadFile = exports.BinaryResponse = exports.ApiError = exports.default = void 0;
|
|
27
37
|
var client_1 = require("./client");
|
package/dist/resources/index.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.v1 = void 0;
|
|
27
37
|
exports.v1 = __importStar(require("./v1"));
|
|
@@ -1,10 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generated by Sideko (sideko.dev)
|
|
3
3
|
**/
|
|
4
|
-
import {
|
|
4
|
+
import { External$PostV1AiHeadshotGeneratorBodyAssets, PostV1AiHeadshotGeneratorBodyAssets } from "../../../types/post-v1-ai-headshot-generator-body-assets";
|
|
5
|
+
import * as z from "zod";
|
|
5
6
|
/**
|
|
6
7
|
* CreateRequest
|
|
7
8
|
*/
|
|
8
|
-
export
|
|
9
|
-
|
|
9
|
+
export type CreateRequest = {
|
|
10
|
+
/**
|
|
11
|
+
* Provide the assets for headshot photo
|
|
12
|
+
*/
|
|
13
|
+
assets: PostV1AiHeadshotGeneratorBodyAssets;
|
|
14
|
+
/**
|
|
15
|
+
* The name of image
|
|
16
|
+
*/
|
|
17
|
+
name?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
* CreateRequest without any key transformation, this is what
|
|
22
|
+
* we expect to come in as network data
|
|
23
|
+
*/
|
|
24
|
+
export type External$CreateRequest = {
|
|
25
|
+
assets: External$PostV1AiHeadshotGeneratorBodyAssets;
|
|
26
|
+
name?: string | undefined;
|
|
27
|
+
};
|
|
28
|
+
export declare const Schemas$CreateRequest: {
|
|
29
|
+
in: z.ZodType<CreateRequest, z.ZodTypeDef, unknown>;
|
|
30
|
+
out: z.ZodType<External$CreateRequest, z.ZodTypeDef, CreateRequest>;
|
|
10
31
|
};
|