Skip to content
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

Support deploy for partial rollout #90

Closed
wants to merge 2 commits into from

Conversation

jsalvata
Copy link

Google recently documented a new deployPercentage parameter to the publish API call.

This allows using partial rollout on extensions published via the API.

jsalvata added 2 commits May 29, 2024 19:11
Google recently documented this parameter to the `publish` call; this adds support for it.
Copy link
Owner

@fregante fregante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR!

`${rootURI}/chromewebstore/v1.1/items/${id}/publish?publishTarget=${target}`;
const publishURI = (id, target, deployPercentage) => (
`${rootURI}/chromewebstore/v1.1/items/${id}/publish?publishTarget=${target}`
+ (deployPercentage == undefined ? '' : `&deployPercentage=${deployPercentage}`)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you alter this function to build the URL via new URL() so you can add parameters via url.searchParams.set()?

@@ -6,8 +6,10 @@ const rootURI = 'https://www.googleapis.com';
export const refreshTokenURI = 'https://www.googleapis.com/oauth2/v4/token';
const uploadExistingURI = id =>
`${rootURI}/upload/chromewebstore/v1.1/items/${id}`;
const publishURI = (id, target) =>
`${rootURI}/chromewebstore/v1.1/items/${id}/publish?publishTarget=${target}`;
const publishURI = (id, target, deployPercentage) => (
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functions shouldn't accept more than 1 optional parameter, can you turn this into an object? {id, target, deployPercentage}

@@ -61,10 +63,10 @@ class APIClient {
return response;
}

async publish(target = 'default', token = this.fetchToken()) {
async publish(target = 'default', token = this.fetchToken(), deployPercentage = undefined) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same goes here, this can be changed to a single object: {target, token, deployPercentage}

I'll release a breaking version after this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants