Skip to content

Commit

Permalink
Tested circleci v1.1 api
Browse files Browse the repository at this point in the history
add testing route
generate swagger doc
remove github sdk v61
  • Loading branch information
futugyou committed Oct 17, 2024
1 parent b4b6905 commit 52847e8
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 4 deletions.
23 changes: 23 additions & 0 deletions infr-project/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,29 @@ const docTemplate = `{
}
}
},
"/v1/test/circleci/projects": {
"get": {
"description": "circle CI project List",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Test"
],
"summary": "circle CI project List",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
}
}
}
},
"/v1/test/cqrstest": {
"get": {
"description": "cqrstest",
Expand Down
23 changes: 23 additions & 0 deletions infr-project/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,29 @@
}
}
},
"/v1/test/circleci/projects": {
"get": {
"description": "circle CI project List",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Test"
],
"summary": "circle CI project List",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
}
}
}
},
"/v1/test/cqrstest": {
"get": {
"description": "cqrstest",
Expand Down
15 changes: 15 additions & 0 deletions infr-project/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,21 @@ paths:
summary: circle CI project
tags:
- Test
/v1/test/circleci/projects:
get:
consumes:
- application/json
description: circle CI project List
produces:
- application/json
responses:
"200":
description: OK
schema:
type: string
summary: circle CI project List
tags:
- Test
/v1/test/cqrstest:
get:
consumes:
Expand Down
1 change: 0 additions & 1 deletion infr-project/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ require (
github.com/futugyousuzu/identity/client v0.0.0
github.com/gin-gonic/gin v1.10.0
github.com/go-playground/validator/v10 v10.22.1
github.com/google/go-github/v61 v61.0.0
github.com/google/go-github/v66 v66.0.0
github.com/google/uuid v1.6.0
github.com/hashicorp/go-slug v0.16.0
Expand Down
2 changes: 0 additions & 2 deletions infr-project/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-github/v61 v61.0.0 h1:VwQCBwhyE9JclCI+22/7mLB1PuU9eowCXKY5pNlu1go=
github.com/google/go-github/v61 v61.0.0/go.mod h1:0WR+KmsWX75G2EbpyGsGmradjo3IiciuI4BmdVCobQY=
github.com/google/go-github/v66 v66.0.0 h1:ADJsaXj9UotwdgK8/iFZtv7MLc8E8WBl62WLd/D/9+M=
github.com/google/go-github/v66 v66.0.0/go.mod h1:+4SO9Zkuyf8ytMj0csN1NR/5OTR+MfqPp8P8dVlcvY4=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
Expand Down
14 changes: 14 additions & 0 deletions infr-project/routes/v1/tool-routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func ConfigTestingRoutes(v1 *gin.RouterGroup, route *command.Router) {
v1.GET("/test/vercel", vercelProjectEndpoint)
v1.GET("/test/circleci", circleciPipeline)
v1.GET("/test/circleci/project", circleciProject)
v1.GET("/test/circleci/projects", circleciProjectList)
v1.GET("/test/vault", vaultSecret)
v1.GET("/test/tf", terraformWS)
v1.GET("/test/cqrs", cqrstest)
Expand Down Expand Up @@ -107,6 +108,19 @@ func circleciProject(c *gin.Context) {
c.JSON(200, result)
}

// @Summary circle CI project List
// @Description circle CI project List
// @Tags Test
// @Accept json
// @Produce json
// @Success 200 {string} string
// @Router /v1/test/circleci/projects [get]
func circleciProjectList(c *gin.Context) {
f := circleci.NewClientV1(os.Getenv("CIRCLECI_TOKEN"))
result, _ := f.Project.ListProject()
c.JSON(200, result)
}

// @Summary vault
// @Description vault
// @Tags Test
Expand Down
2 changes: 1 addition & 1 deletion infr-project/services/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"log"

"github.com/google/go-github/v61/github"
"github.com/google/go-github/v66/github"
)

type WorkflowService struct {
Expand Down

0 comments on commit 52847e8

Please sign in to comment.