Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed path params to camelCase #76

Merged
merged 6 commits into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ This project tries to follow [SemVer 2.0.0](https://semver.org/).
data is slightly different; it has additional properties, and does not have a
`status` property. (#43)

- Changed format of all endpoint's path parameters from all lowercase to
camelCase: (#76)

- branchid -> branchId
- projectid -> projectId
- providerid -> providerId
- tokenid -> tokenId
- buildid -> buildId

This affects the Swagger documentation, but has no behavioral implications.

## v4.2.0 (2021-09-10)

- Added support for the TZ environment variable (setting timezones ex.
Expand Down
26 changes: 13 additions & 13 deletions artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ func (m artifactModule) Register(g *gin.RouterGroup) {
// getBuildArtifactsHandler godoc
// @summary Get list of build artifacts
// @tags artifact
// @param buildid path int true "Build ID"
// @param buildId path int true "Build ID"
// @success 200 {array} Artifact
// @failure 400 {object} problem.Response "Bad request"
// @failure 401 {object} problem.Response "Unauthorized or missing jwt token"
// @failure 502 {object} problem.Response "Database is unreachable"
// @router /build/{buildid}/artifacts [get]
// @router /build/{buildId}/artifacts [get]
func (m artifactModule) getBuildArtifactsHandler(c *gin.Context) {
buildID, ok := ginutil.ParseParamUint(c, "buildid")
buildID, ok := ginutil.ParseParamUint(c, "buildId")
if !ok {
return
}
Expand All @@ -88,16 +88,16 @@ func (m artifactModule) getBuildArtifactsHandler(c *gin.Context) {
// getBuildArtifactHandler godoc
// @summary Get build artifact
// @tags artifact
// @param buildid path int true "Build ID"
// @param buildId path int true "Build ID"
// @param artifactId path int true "Artifact ID"
// @success 200 {file} string "OK"
// @failure 400 {object} problem.Response "Bad request"
// @failure 401 {object} problem.Response "Unauthorized or missing jwt token"
// @failure 404 {object} problem.Response "Artifact not found"
// @failure 502 {object} problem.Response "Database is unreachable"
// @router /build/{buildid}/artifact/{artifactId} [get]
// @router /build/{buildId}/artifact/{artifactId} [get]
func (m artifactModule) getBuildArtifactHandler(c *gin.Context) {
buildID, ok := ginutil.ParseParamUint(c, "buildid")
buildID, ok := ginutil.ParseParamUint(c, "buildId")
if !ok {
return
}
Expand Down Expand Up @@ -139,16 +139,16 @@ func (m artifactModule) getBuildArtifactHandler(c *gin.Context) {
// @summary Post build artifact
// @tags artifact
// @accept multipart/form-data
// @param buildid path int true "Build ID"
// @param buildId path int true "Build ID"
// @param files formData file true "Build artifact file"
// @success 201 "Added new artifacts"
// @failure 400 {object} problem.Response "Bad request"
// @failure 401 {object} problem.Response "Unauthorized or missing jwt token"
// @failure 404 {object} problem.Response "Artifact not found"
// @failure 502 {object} problem.Response "Database is unreachable"
// @router /build/{buildid}/artifact [post]
// @router /build/{buildId}/artifact [post]
func (m artifactModule) postBuildArtifactHandler(c *gin.Context) {
buildID, ok := ginutil.ParseParamUint(c, "buildid")
buildID, ok := ginutil.ParseParamUint(c, "buildId")
if !ok {
return
}
Expand All @@ -171,16 +171,16 @@ func (m artifactModule) postBuildArtifactHandler(c *gin.Context) {

// getBuildTestsResultsHandler godoc
// @deprecated
// @summary Get build tests results from .trx files. Deprecated, /build/{buildid}/test-results-summary should be used instead.
// @summary Get build tests results from .trx files. Deprecated, /build/{buildId}/test-results-summary should be used instead.
// @tags artifact
// @param buildid path int true "Build ID"
// @param buildId path int true "Build ID"
// @success 200 {object} TestsResults
// @failure 400 {object} problem.Response "Bad request"
// @failure 401 {object} problem.Response "Unauthorized or missing jwt token"
// @failure 502 {object} problem.Response "Database is unreachable"
// @router /build/{buildid}/tests-results [get]
// @router /build/{buildId}/tests-results [get]
func (m artifactModule) getBuildTestsResultsHandler(c *gin.Context) {
buildID, ok := ginutil.ParseParamUint(c, "buildid")
buildID, ok := ginutil.ParseParamUint(c, "buildId")
if !ok {
return
}
Expand Down
6 changes: 3 additions & 3 deletions branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (m branchModule) Register(g *gin.RouterGroup) {

branch := g.Group("/branch")
{
branch.GET("/:branchid", m.GetBranchHandler)
branch.GET("/:branchId", m.GetBranchHandler)
branch.POST("", m.PostBranchHandler)
}
}
Expand All @@ -41,9 +41,9 @@ func (m branchModule) GetBranchesHandler(c *gin.Context) {
// GetBranchHandler godoc
// @summary NOT IMPLEMENTED YET
// @tags branch
// @param branchid path int true "branch ID"
// @param branchId path int true "branch ID"
// @success 501 "Not Implemented"
// @router /branch/{branchid} [get]
// @router /branch/{branchId} [get]
func (m branchModule) GetBranchHandler(c *gin.Context) {
c.Status(http.StatusNotImplemented)
}
Expand Down
32 changes: 16 additions & 16 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (m buildModule) Register(g *gin.RouterGroup) {
builds.POST("/search", m.postBuildSearchHandler)
}

build := g.Group("/build/:buildid")
build := g.Group("/build/:buildId")
{
build.GET("", m.getBuildHandler)
build.PUT("", m.putBuildStatus)
Expand Down Expand Up @@ -97,15 +97,15 @@ func build(buildID uint) broadcast.Broadcaster {
// getBuildHandler godoc
// @summary Finds build by build ID
// @tags build
// @param buildid path int true "build id"
// @param buildId path int true "build id"
// @success 200 {object} Build
// @failure 400 {object} problem.Response "Bad request"
// @failure 401 {object} problem.Response "Unauthorized or missing jwt token"
// @failure 404 {object} problem.Response "Build not found"
// @failure 502 {object} problem.Response "Database is unreachable"
// @router /build/{buildid} [get]
// @router /build/{buildId} [get]
func (m buildModule) getBuildHandler(c *gin.Context) {
buildID, ok := ginutil.ParseParamUint(c, "buildid")
buildID, ok := ginutil.ParseParamUint(c, "buildId")
if !ok {
return
}
Expand Down Expand Up @@ -163,14 +163,14 @@ func (m buildModule) postBuildSearchHandler(c *gin.Context) {
// getLogHandler godoc
// @summary Finds logs for build with selected build ID
// @tags build
// @param buildid path int true "build id"
// @param buildId path int true "build id"
// @success 200 {object} []Log "logs from selected build"
// @failure 400 {object} problem.Response "Bad request"
// @failure 401 {object} problem.Response "Unauthorized or missing jwt token"
// @failure 502 {object} problem.Response "Database is unreachable"
// @router /build/{buildid}/log [get]
// @router /build/{buildId}/log [get]
func (m buildModule) getLogHandler(c *gin.Context) {
buildID, ok := ginutil.ParseParamUint(c, "buildid")
buildID, ok := ginutil.ParseParamUint(c, "buildId")
if !ok {
return
}
Expand All @@ -190,13 +190,13 @@ func (m buildModule) getLogHandler(c *gin.Context) {
// streamBuildLogHandler godoc
// @summary Opens stream listener
// @tags build
// @param buildid path int true "build id"
// @param buildId path int true "build id"
// @success 200 "Open stream"
// @failure 400 {object} problem.Response "Bad request"
// @failure 401 {object} problem.Response "Unauthorized or missing jwt token"
// @router /build/{buildid}/stream [get]
// @router /build/{buildId}/stream [get]
func (m buildModule) streamBuildLogHandler(c *gin.Context) {
buildID, ok := ginutil.ParseParamUint(c, "buildid")
buildID, ok := ginutil.ParseParamUint(c, "buildId")
if !ok {
return
}
Expand All @@ -220,15 +220,15 @@ func (m buildModule) streamBuildLogHandler(c *gin.Context) {
// postBuildLogHandler godoc
// @summary Post a log to selected build
// @tags build
// @param buildid path int true "build id"
// @param buildId path int true "build id"
// @param data body BuildLog true "data"
// @success 201 "Created"
// @failure 400 {object} problem.Response "Bad request"
// @failure 401 {object} problem.Response "Unauthorized or missing jwt token"
// @failure 502 {object} problem.Response "Database is unreachable"
// @router /build/{buildid}/log [post]
// @router /build/{buildId}/log [post]
func (m buildModule) postBuildLogHandler(c *gin.Context) {
buildID, ok := ginutil.ParseParamUint(c, "buildid")
buildID, ok := ginutil.ParseParamUint(c, "buildId")
if !ok {
return
}
Expand Down Expand Up @@ -264,16 +264,16 @@ func (m buildModule) postBuildLogHandler(c *gin.Context) {
// putBuildStatus godoc
// @summary Partially update specific build
// @tags build
// @param buildid path uint true "build id"
// @param buildId path uint true "build id"
// @param status query string true "Build status term" Enums(Scheduling, Running, Completed, Failed)
// @success 200 {object} Build
// @failure 400 {object} problem.Response "Bad request"
// @failure 401 {object} problem.Response "Unauthorized or missing jwt token"
// @failure 404 {object} problem.Response "Build not found"
// @failure 502 {object} problem.Response "Database is unreachable"
// @router /build/{buildid} [put]
// @router /build/{buildId} [put]
func (m buildModule) putBuildStatus(c *gin.Context) {
buildID, ok := ginutil.ParseParamUint(c, "buildid")
buildID, ok := ginutil.ParseParamUint(c, "buildId")
if !ok {
return
}
Expand Down
32 changes: 16 additions & 16 deletions project.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ func (m projectModule) Register(g *gin.RouterGroup) {
{
projects.GET("", m.getProjectsHandler)
projects.POST("/search", m.searchProjectsHandler)
projects.GET("/:projectid/builds", m.getBuildsSliceHandler)
projects.GET("/:projectId/builds", m.getBuildsSliceHandler)
}

project := g.Group("/project")
{
project.GET("/:projectid", m.getProjectHandler)
project.GET("/:projectId", m.getProjectHandler)
project.POST("", m.postProjectHandler)
project.DELETE("/:projectid", m.deleteProjectHandler)
project.DELETE("/:projectId", m.deleteProjectHandler)
project.PUT("", m.putProjectHandler)
project.POST("/:projectid/:stage/run", m.runStageHandler)
project.POST("/:projectId/:stage/run", m.runStageHandler)
}
}

Expand Down Expand Up @@ -127,17 +127,17 @@ func (m projectModule) searchProjectsHandler(c *gin.Context) {
// getBuildsSliceHandler godoc
// @summary Get slice of builds.
// @tags project
// @param projectid path int true "project ID"
// @param projectId path int true "project ID"
// @param limit query string true "number of fetched branches"
// @param offset query string true "PK of last branch taken"
// @param orderby query []string false "Sorting orders. Takes the property name followed by either 'asc' or 'desc'. Can be specified multiple times for more granular sorting. Defaults to '?orderby=buildId desc'"
// @success 200 {object} PaginatedBuilds
// @failure 400 {object} problem.Response "Bad request"
// @failure 401 {object} problem.Response "Unauthorized or missing jwt token"
// @failure 502 {object} problem.Response "Database is unreachable"
// @router /projects/{projectid}/builds [get]
// @router /projects/{projectId}/builds [get]
func (m projectModule) getBuildsSliceHandler(c *gin.Context) {
projectID, ok := ginutil.ParseParamUint(c, "projectid")
projectID, ok := ginutil.ParseParamUint(c, "projectId")
if !ok {
return
}
Expand Down Expand Up @@ -182,15 +182,15 @@ func (m projectModule) getBuildsSliceHandler(c *gin.Context) {
// getProjectHandler godoc
// @summary Returns project with selected project ID
// @tags project
// @param projectid path int true "project ID"
// @param projectId path int true "project ID"
// @success 200 {object} Project
// @failure 400 {object} problem.Response "Bad request"
// @failure 401 {object} problem.Response "Unauthorized or missing jwt token"
// @failure 404 {object} problem.Response "Project not found"
// @failure 502 {object} problem.Response "Database is unreachable"
// @router /project/{projectid} [get]
// @router /project/{projectId} [get]
func (m projectModule) getProjectHandler(c *gin.Context) {
projectID, ok := ginutil.ParseParamUint(c, "projectid")
projectID, ok := ginutil.ParseParamUint(c, "projectId")
if !ok {
return
}
Expand Down Expand Up @@ -280,15 +280,15 @@ func (m projectModule) postProjectHandler(c *gin.Context) {
// deleteProjectHandler godoc
// @summary Delete project with selected project ID
// @tags project
// @param projectid path int true "project ID"
// @param projectId path int true "project ID"
// @success 204 "Deleted"
// @failure 502 {object} problem.Response "Database is unreachable"
// @failure 400 {object} problem.Response "Bad request"
// @failure 404 {object} problem.Response "Project to delete is not found"
// @failure 401 {object} problem.Response "Unauthorized or missing jwt token"
// @router /project/{projectid} [delete]
// @router /project/{projectId} [delete]
func (m projectModule) deleteProjectHandler(c *gin.Context) {
projectID, ok := ginutil.ParseParamUint(c, "projectid")
projectID, ok := ginutil.ParseParamUint(c, "projectId")
if !ok {
return
}
Expand Down Expand Up @@ -378,7 +378,7 @@ func (m projectModule) putProjectHandler(c *gin.Context) {
// @summary Responsible for run stage environment for selected project
// @tags project
// @accept json
// @param projectid path int true "project ID"
// @param projectId path int true "project ID"
// @param stage path string true "name of stage to run, or specify ALL to run everything"
// @param branch query string false "branch name, uses default branch if omitted"
// @param environment query string false "environment name"
Expand All @@ -388,9 +388,9 @@ func (m projectModule) putProjectHandler(c *gin.Context) {
// @failure 401 {object} problem.Response "Unauthorized or missing jwt token"
// @failure 404 {object} problem.Response "Project was not found"
// @failure 502 {object} problem.Response "Database or code execution engine is unreachable"
// @router /project/{projectid}/{stage}/run [post]
// @router /project/{projectId}/{stage}/run [post]
func (m projectModule) runStageHandler(c *gin.Context) {
projectID, ok := ginutil.ParseParamUint(c, "projectid")
projectID, ok := ginutil.ParseParamUint(c, "projectId")
if !ok {
return
}
Expand Down
8 changes: 4 additions & 4 deletions provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (m providerModule) Register(g *gin.RouterGroup) {

provider := g.Group("/provider")
{
provider.GET("/:providerid", m.getProviderHandler)
provider.GET("/:providerId", m.getProviderHandler)
provider.POST("", m.postProviderHandler)
provider.PUT("", m.putProviderHandler)
}
Expand All @@ -80,15 +80,15 @@ func (m providerModule) getProvidersHandler(c *gin.Context) {
// getProviderHandler godoc
// @summary Returns provider with selected provider ID
// @tags provider
// @param providerid path int true "Provider ID"
// @param providerId path int true "Provider ID"
// @success 200 {object} Provider
// @failure 400 {object} problem.Response "Bad request"
// @failure 404 {object} problem.Response "Provider not found"
// @failure 401 {object} problem.Response "Unauthorized or missing jwt token"
// @failure 502 {object} problem.Response "Database is unreachable"
// @router /provider/{providerid} [get]
// @router /provider/{providerId} [get]
func (m providerModule) getProviderHandler(c *gin.Context) {
providerID, ok := ginutil.ParseParamUint(c, "providerid")
providerID, ok := ginutil.ParseParamUint(c, "providerId")
if !ok {
return
}
Expand Down
Loading