-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add set_partial_override
method to the API
#668
base: master
Are you sure you want to change the base?
Conversation
There's a general error in the pipeline run:
|
lib/api.js
Outdated
@@ -692,3 +692,8 @@ exports.update_metadata_rule = function update_metadata_rule(field_external_id, | |||
exports.delete_metadata_rule = function delete_metadata_rule(field_external_id, callback, options = {}) { | |||
return call_api('delete', ['metadata_rules', field_external_id], {}, callback, options); | |||
}; | |||
|
|||
exports.update_partial_overrides = function update_partial_overrides(asset_id, callback, params = {}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would change name to upsert
as it does exactly that create
or update
. It's a unique operation for our API so there is no convention yet for similar operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upsert
term comes from the database world and not from API.
See this discussion in stack overflow:
https://stackoverflow.com/questions/18470588/in-rest-is-post-or-put-best-suited-for-upsert-operation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct, upsert
is not an HTTP API-connotated word but for the sake of good DevEx using that name is better than update
where there is no create
method.
That being said, it's just my suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my understanding of the whole partial overrides thingy, this method will update a resource with partial overrides (and this might be operation that creates an override, or overrides an existing override).
What do you think about the set_partial_overrides
name? It's more human-like language than upsert
😉 , and it still might express the nature of this operation better than update
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed another thing. The final method name should indicate a singular partial override, as you send a payload of only one partial override.
set_partial_override
also sounds good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as you send a payload of only one partial override
Oh, I thought there can be multiple overrides provided.
If that's not the case, why overrides
in API payload is an array?
{
transformation_prefix: string;
asset_override_uri: string;
overrides: Array<{
action: 'gen_fill';
params: {
seed: string;
prompt: string;
ignore_foreground: boolean;
}
}>;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future, you will be able to provide overrides to many actions, not just gen_fill
.
E.g. consider w_100/e_isolate,b_gen_fill,...
. The correct payload for it would be:
{
"transformation_prefix":"w_100/e_isolate,b_gen_fill,...",
"asset_override_uri":"http://...",
"overrides":[
{
"action":"gen_fill",
"params":{
"seed":"...",
"prompt":"..."
}
},
{
"action":"isolate",
"params":{
"seed":"..."
}
}
]
}
You override one transformation prefix with one override snapshot, but the snapshot is result of override of two actions (gen_fill
and e_isolate
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CC @mikeys ^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
As long as @mckomo-cl and @const-cloudinary are ok with the naming, I don't have an opinion there.
@mckomo-cl - As per our discussions on the Confluence spec, I wasn't entirely convinced that "partial override" is the ideal name for the feature, but I won't have time to deep dive into it. I thought it was still in the spec stage. Didn't realize it was already being implemented in an SDK. Have you & @konforti sync'd with @carlevison on the naming of all the methods? |
update_partial_overrides
method to the APIset_partial_override
method to the API
Brief Summary of Changes
update_partial_overrides
method to the API. This will allow to overridegen_fill
derived asset result.What Does This PR Address?
Are Tests Included?
Reviewer, Please Note: