Skip to content

Commit

Permalink
Adjust GetAsset to return also preview URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
igolaizola committed Jul 3, 2024
1 parent 262e24c commit 3ed471e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/runway/runway.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,16 +408,16 @@ func (c *Client) DeleteAsset(ctx context.Context, id string) error {
return nil
}

func (c *Client) GetAsset(ctx context.Context, id string) (string, error) {
func (c *Client) GetAsset(ctx context.Context, id string) (string, []string, error) {
path := fmt.Sprintf("assets/%s", id)
var resp assetResponse
if _, err := c.do(ctx, "GET", path, nil, &resp); err != nil {
return "", fmt.Errorf("runway: couldn't get asset %s: %w", id, err)
return "", nil, fmt.Errorf("runway: couldn't get asset %s: %w", id, err)
}
if resp.Asset.URL == "" {
return "", fmt.Errorf("runway: empty asset url")
return "", nil, fmt.Errorf("runway: empty asset url")
}
return resp.Asset.URL, nil
return resp.Asset.URL, resp.Asset.PreviewURLs, nil
}

func (c *Client) Download(ctx context.Context, u, output string) error {
Expand Down

0 comments on commit 3ed471e

Please sign in to comment.