add content subcommand

This commit is contained in:
filifa
2024-07-23 19:04:57 -05:00
parent cc59c2bfc8
commit 3c4f51e94d
2 changed files with 70 additions and 0 deletions

View File

@@ -38,6 +38,10 @@ func RequestDiffPatch(gamePk, startTimecode, pushUpdateId string) (DiffPatchResp
return DefaultClient.RequestDiffPatch(gamePk, startTimecode, pushUpdateId)
}
func RequestContent(gamePk string) ([]byte, error) {
return DefaultClient.RequestContent(gamePk)
}
type DiffPatchResponse []byte
type Client struct {
@@ -98,6 +102,11 @@ func (c *Client) RequestDiffPatch(gamePk, startTimecode, pushUpdateId string) (D
return c.get(&endpoint)
}
func (c *Client) RequestContent(gamePk string) ([]byte, error) {
endpoint := url.URL{Path: "api/v1/game/" + gamePk + "/content"}
return c.get(&endpoint)
}
func (c *Client) get(endpoint *url.URL) ([]byte, error) {
url := c.baseURL.ResolveReference(endpoint)