Skip to content

Commit

Permalink
bug: use download resource for specs #374
Browse files Browse the repository at this point in the history
  • Loading branch information
srinandan committed Jan 10, 2024
1 parent 3040111 commit 82bf59f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 18 deletions.
5 changes: 2 additions & 3 deletions internal/client/registry/apis/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,10 @@ func GetArtifact(apiName string, name string) (respBody []byte, err error) {
}

// GetArtifactContents
func GetArtifactContents(apiName string, name string) (respBody []byte, err error) {
func GetArtifactContents(apiName string, name string) (err error) {
u, _ := url.Parse(apiclient.GetApigeeRegistryURL())
u.Path = path.Join(u.Path, "apis", apiName, "artifacts", name+":getContents")
respBody, err = apiclient.HttpClient(u.String())
return respBody, err
return apiclient.DownloadResource(u.String(), name+".txt", "", true)
}

// ListArtifacts
Expand Down
5 changes: 2 additions & 3 deletions internal/client/registry/apis/deployments/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,10 @@ func GetArtifact(apiName string, deploymentName string, name string) (respBody [
}

// GetArtifactContents
func GetArtifactContents(apiName string, deploymentName string, name string) (respBody []byte, err error) {
func GetArtifactContents(apiName string, deploymentName string, name string) (err error) {
u, _ := url.Parse(apiclient.GetApigeeRegistryURL())
u.Path = path.Join(u.Path, "apis", apiName, "deployments", deploymentName, "artifacts", name+":getContents")
respBody, err = apiclient.HttpClient(u.String())
return respBody, err
return apiclient.DownloadResource(u.String(), name+".txt", "", true)
}

// ListArtifacts
Expand Down
5 changes: 2 additions & 3 deletions internal/client/registry/apis/versions/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,10 @@ func GetArtifact(apiName string, apiVersion string, name string) (respBody []byt
}

// GetArtifactContents
func GetArtifactContents(apiName string, apiVersion string, name string) (respBody []byte, err error) {
func GetArtifactContents(apiName string, apiVersion string, name string) (err error) {
u, _ := url.Parse(apiclient.GetApigeeRegistryURL())
u.Path = path.Join(u.Path, "apis", apiName, "versions", apiVersion, "artifacts", name+":getContents")
respBody, err = apiclient.HttpClient(u.String())
return respBody, err
return apiclient.DownloadResource(u.String(), name+".txt", "", true)
}

// ListArtifacts
Expand Down
5 changes: 2 additions & 3 deletions internal/client/registry/apis/versions/specartifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,11 @@ func GetSpecArtifact(apiName string, apiVersion string, specName string,
// GetSpecArtifactContents
func GetSpecArtifactContents(apiName string, apiVersion string, specName string,
name string,
) (respBody []byte, err error) {
) (err error) {
u, _ := url.Parse(apiclient.GetApigeeRegistryURL())
u.Path = path.Join(u.Path, "apis", apiName, "versions", apiVersion,
"specs", specName, "artifacts", name+":getContents")
respBody, err = apiclient.HttpClient(u.String())
return respBody, err
return apiclient.DownloadResource(u.String(), name+".txt", "", true)
}

// ListSpecArtifacts
Expand Down
5 changes: 2 additions & 3 deletions internal/client/registry/apis/versions/specs.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,10 @@ func GetSpec(apiName string, apiVersion string, name string) (respBody []byte, e
}

// GetSpecContents
func GetSpecContents(apiName string, apiVersion string, name string) (respBody []byte, err error) {
func GetSpecContents(apiName string, apiVersion string, name string) (err error) {
u, _ := url.Parse(apiclient.GetApigeeRegistryURL())
u.Path = path.Join(u.Path, "apis", apiName, "versions", apiVersion, "specs", name+":getContents")
respBody, err = apiclient.HttpClient(u.String())
return respBody, err
return apiclient.DownloadResource(u.String(), name+".txt", "", true)
}

// ListSpecs
Expand Down
5 changes: 2 additions & 3 deletions internal/client/registry/artifacts/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ func Get(name string) (respBody []byte, err error) {
}

// GetContents
func GetContents(name string) (respBody []byte, err error) {
func GetContents(name string) (err error) {
u, _ := url.Parse(apiclient.GetApigeeRegistryURL())
u.Path = path.Join(u.Path, "artifacts", name+":getContents")
respBody, err = apiclient.HttpClient(u.String())
return respBody, err
return apiclient.DownloadResource(u.String(), name+".txt", "", true)
}

// List
Expand Down

0 comments on commit 82bf59f

Please sign in to comment.