-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
Conversation
Google recently documented this parameter to the `publish` call; this adds support for it.
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.
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}`) |
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.
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) => ( |
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.
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) { |
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.
Same goes here, this can be changed to a single object: {target, token, deployPercentage}
I'll release a breaking version after this
Google recently documented a new
deployPercentage
parameter to thepublish
API call.This allows using partial rollout on extensions published via the API.