feat: add uploader.generate to generate and upload AI images#737
Open
mckomo-cl wants to merge 1 commit into
Open
feat: add uploader.generate to generate and upload AI images#737mckomo-cl wants to merge 1 commit into
mckomo-cl wants to merge 1 commit into
Conversation
Adds cloudinary.v2.uploader.generate(generateParams, options, callback), which generates an image from a text prompt and uploads the result in a single call. It calls the image generation API, then delegates to uploader.upload using the secure_url from the response, so the resolved value is the upload result and all standard upload options are honored. - New internal client call_generate_api (JSON + Basic Auth/OAuth) - New base_processing_api_url helper for the v2 processing endpoint - TypeScript types (GenerateImageOptions + generate overloads) - Tests mirroring existing conventions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brief Summary of Changes
Adds a new
cloudinary.v2.uploader.generate()method that generates an image from a text prompt using Cloudinary's image generation API and uploads the generated image to your product environment — in a single call.uploader.generate(generateParams, options, callback)— the same envelope asuploader.upload, but the first argument carries the generation parameters (promptis required;model_family,quality_tier,model_id,width,height,seedare optional).secure_urlreturned by the generation API) by delegating touploader.upload. The resolved value / callback result is therefore the upload response, so all standard upload options (folder,tags,context,metadata, …) are honored.call_generate_api(JSON body + Basic Auth / OAuth) mirroringcall_analysis_api, plus abase_processing_api_urlhelper for the v2 processing endpoint.GenerateImageOptionsinterface andgenerateoverloads).Usage
Callback style is also supported, identical to
upload:What Does This PR Address?
Are Tests Included?
Reviewer, Please Note:
upload. The newcall_generate_apiclient handles this and reuses the existing API key/secret (or OAuth) configuration — no extra auth setup is required.generatereturns the upload result (not the generation response) by design, so it behaves as a drop-in foruploadwith a prompt instead of a file path.sinonstub ofhttps.request, assertions mirroringanalyze_spec/debug_mode_spec); no new test utilities were added.