Skip to content

Commit

Permalink
chore: remove assets related code
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaszbarwicki committed Jun 26, 2024
1 parent 532df79 commit 68b9cd2
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions src/api-collector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ import (

const API_DOCS_REPO = "api-hub"

type assetInfo struct {
id int64
name string
}

type OpenAPIInfo struct {
Version string `yaml:"version"`
Title string `yaml:"title"`
Expand Down Expand Up @@ -155,27 +150,6 @@ func getAPISpecsUrls(ctx context.Context, client *github.Client, owner string, r
return m.OpenApiSpecs, nil
}

func getAPISpecAssets(ctx context.Context, client *github.Client, owner string, repo string) []assetInfo {
var apiSpecs []assetInfo
release, _, err := client.Repositories.GetLatestRelease(ctx, owner, repo)
if err != nil {
log.Println("\t- No release found")
return apiSpecs
}
log.Printf("\t+ Latest release found: %s\n", *release.Name)
assets, _, err := client.Repositories.ListReleaseAssets(ctx, owner, repo, *release.ID, nil)
if err != nil {
log.Println("\t- No assets found in the release")
return apiSpecs
}
for _, asset := range assets {
if strings.Contains(*asset.Name, "_openapi.yaml") || strings.Contains(*asset.Name, "_openapi.yml") {
apiSpecs = append(apiSpecs, assetInfo{*asset.ID, *asset.Name})
}
}
return apiSpecs
}

func downloadAPISpecs(repo string, specsUrls []string) []string {
var downloadedSpecs []string
for _, url := range specsUrls {
Expand Down

0 comments on commit 68b9cd2

Please sign in to comment.