mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-22 17:34:03 +03:00
Improve swagger doc (#2274)
* Add swagger comment for adminCreateOrg * Add swagger comment for admin route * add hook swagger doc * Add tags * Add auth * Fix name of responses * Edit name method * Update vendor * make generate-swagger
This commit is contained in:
parent
951c909a67
commit
fd8e8a421a
@ -51,6 +51,10 @@ type APIForbiddenError struct {
|
||||
// swagger:response notFound
|
||||
type APINotFound struct{}
|
||||
|
||||
//APIRedirect is a redirect response
|
||||
// swagger:response redirect
|
||||
type APIRedirect struct{}
|
||||
|
||||
// Error responses error message to client with given message.
|
||||
// If status is 500, also it prints error to log.
|
||||
func (ctx *APIContext) Error(status int, title string, obj interface{}) {
|
||||
|
1451
public/swagger.v1.json
vendored
1451
public/swagger.v1.json
vendored
File diff suppressed because it is too large
Load Diff
@ -14,8 +14,21 @@ import (
|
||||
)
|
||||
|
||||
// CreateOrg api for create organization
|
||||
// see https://github.com/gogits/go-gogs-client/wiki/Administration-Organizations#create-a-new-organization
|
||||
func CreateOrg(ctx *context.APIContext, form api.CreateOrgOption) {
|
||||
// swagger:route POST /admin/users/{username}/orgs admin adminCreateOrg
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 201: Organization
|
||||
// 403: forbidden
|
||||
// 422: validationError
|
||||
// 500: error
|
||||
|
||||
u := user.GetUserByParams(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
|
@ -13,8 +13,21 @@ import (
|
||||
)
|
||||
|
||||
// CreateRepo api for creating a repository
|
||||
// see https://github.com/gogits/go-gogs-client/wiki/Administration-Repositories#create-a-new-repository
|
||||
func CreateRepo(ctx *context.APIContext, form api.CreateRepoOption) {
|
||||
// swagger:route POST /admin/users/{username}/repos admin adminCreateRepo
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 201: Repository
|
||||
// 403: forbidden
|
||||
// 422: validationError
|
||||
// 500: error
|
||||
|
||||
owner := user.GetUserByParams(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
|
@ -35,8 +35,21 @@ func parseLoginSource(ctx *context.APIContext, u *models.User, sourceID int64, l
|
||||
}
|
||||
|
||||
// CreateUser api for creating a user
|
||||
// see https://github.com/gogits/go-gogs-client/wiki/Administration-Users#create-a-new-user
|
||||
func CreateUser(ctx *context.APIContext, form api.CreateUserOption) {
|
||||
// swagger:route POST /admin/users admin adminCreateUser
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 201: User
|
||||
// 403: forbidden
|
||||
// 422: validationError
|
||||
// 500: error
|
||||
|
||||
u := &models.User{
|
||||
Name: form.Username,
|
||||
FullName: form.FullName,
|
||||
@ -73,8 +86,21 @@ func CreateUser(ctx *context.APIContext, form api.CreateUserOption) {
|
||||
}
|
||||
|
||||
// EditUser api for modifying a user's information
|
||||
// see https://github.com/gogits/go-gogs-client/wiki/Administration-Users#edit-an-existing-user
|
||||
func EditUser(ctx *context.APIContext, form api.EditUserOption) {
|
||||
// swagger:route PATCH /admin/users/{username} admin adminEditUser
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 200: User
|
||||
// 403: forbidden
|
||||
// 422: validationError
|
||||
// 500: error
|
||||
|
||||
u := user.GetUserByParams(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
@ -130,8 +156,18 @@ func EditUser(ctx *context.APIContext, form api.EditUserOption) {
|
||||
}
|
||||
|
||||
// DeleteUser api for deleting a user
|
||||
// https://github.com/gogits/go-gogs-client/wiki/Administration-Users#delete-a-user
|
||||
func DeleteUser(ctx *context.APIContext) {
|
||||
// swagger:route DELETE /admin/users/{username} admin adminDeleteUser
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 204: empty
|
||||
// 403: forbidden
|
||||
// 422: validationError
|
||||
// 500: error
|
||||
|
||||
u := user.GetUserByParams(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
@ -152,8 +188,21 @@ func DeleteUser(ctx *context.APIContext) {
|
||||
}
|
||||
|
||||
// CreatePublicKey api for creating a public key to a user
|
||||
// see https://github.com/gogits/go-gogs-client/wiki/Administration-Users#create-a-public-key-for-user
|
||||
func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
|
||||
// swagger:route POST /admin/users/{username}/keys admin adminCreatePublicKey
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 201: PublicKey
|
||||
// 403: forbidden
|
||||
// 422: validationError
|
||||
// 500: error
|
||||
|
||||
u := user.GetUserByParams(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
|
@ -23,6 +23,28 @@
|
||||
// - application/json
|
||||
// - text/html
|
||||
//
|
||||
// Security:
|
||||
// - BasicAuth: []
|
||||
// - Token: []
|
||||
// - AccessToken: []
|
||||
// - AuthorizationHeaderToken: []
|
||||
//
|
||||
// SecurityDefinitions:
|
||||
// BasicAuth:
|
||||
// type: basic
|
||||
// Token:
|
||||
// type: apiKey
|
||||
// name: token
|
||||
// in: query
|
||||
// AccessToken:
|
||||
// type: apiKey
|
||||
// name: access_token
|
||||
// in: query
|
||||
// AuthorizationHeaderToken:
|
||||
// type: apiKey
|
||||
// name: Authorization
|
||||
// in: header
|
||||
//
|
||||
// swagger:meta
|
||||
package v1
|
||||
|
||||
|
@ -14,7 +14,7 @@ import (
|
||||
|
||||
// Markdown render markdown document to HTML
|
||||
func Markdown(ctx *context.APIContext, form api.MarkdownOption) {
|
||||
// swagger:route POST /markdown renderMarkdown
|
||||
// swagger:route POST /markdown miscellaneous renderMarkdown
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
@ -52,7 +52,7 @@ func Markdown(ctx *context.APIContext, form api.MarkdownOption) {
|
||||
|
||||
// MarkdownRaw render raw markdown HTML
|
||||
func MarkdownRaw(ctx *context.APIContext) {
|
||||
// swagger:route POST /markdown/raw renderMarkdownRaw
|
||||
// swagger:route POST /markdown/raw miscellaneous renderMarkdownRaw
|
||||
//
|
||||
// Consumes:
|
||||
// - text/plain
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
|
||||
// Version shows the version of the Gitea server
|
||||
func Version(ctx *context.APIContext) {
|
||||
// swagger:route GET /version getVersion
|
||||
// swagger:route GET /version miscellaneous getVersion
|
||||
//
|
||||
// Return Gitea running version.
|
||||
//
|
||||
|
@ -15,6 +15,15 @@ import (
|
||||
|
||||
// ListHooks list an organziation's webhooks
|
||||
func ListHooks(ctx *context.APIContext) {
|
||||
// swagger:route GET /orgs/{orgname}/hooks organization orgListHooks
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 200: HookList
|
||||
// 500: error
|
||||
|
||||
org := ctx.Org.Organization
|
||||
orgHooks, err := models.GetWebhooksByOrgID(org.ID)
|
||||
if err != nil {
|
||||
@ -30,6 +39,16 @@ func ListHooks(ctx *context.APIContext) {
|
||||
|
||||
// GetHook get an organization's hook by id
|
||||
func GetHook(ctx *context.APIContext) {
|
||||
// swagger:route GET /orgs/{orgname}/hooks/{id} organization orgGetHook
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 200: Hook
|
||||
// 404: notFound
|
||||
// 500: error
|
||||
|
||||
org := ctx.Org.Organization
|
||||
hookID := ctx.ParamsInt64(":id")
|
||||
hook, err := utils.GetOrgHook(ctx, org.ID, hookID)
|
||||
@ -41,6 +60,19 @@ func GetHook(ctx *context.APIContext) {
|
||||
|
||||
// CreateHook create a hook for an organization
|
||||
func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
|
||||
// swagger:route POST /orgs/{orgname}/hooks/ organization orgCreateHook
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 201: Hook
|
||||
// 422: validationError
|
||||
// 500: error
|
||||
|
||||
if !utils.CheckCreateHookOption(ctx, &form) {
|
||||
return
|
||||
}
|
||||
@ -49,12 +81,36 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
|
||||
|
||||
// EditHook modify a hook of a repository
|
||||
func EditHook(ctx *context.APIContext, form api.EditHookOption) {
|
||||
// swagger:route PATCH /orgs/{orgname}/hooks/{id} organization orgEditHook
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 200: Hook
|
||||
// 422: validationError
|
||||
// 404: notFound
|
||||
// 500: error
|
||||
|
||||
hookID := ctx.ParamsInt64(":id")
|
||||
utils.EditOrgHook(ctx, &form, hookID)
|
||||
}
|
||||
|
||||
// DeleteHook delete a hook of an organization
|
||||
func DeleteHook(ctx *context.APIContext) {
|
||||
// swagger:route DELETE /orgs/{orgname}/hooks/{id} organization orgDeleteHook
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 204: empty
|
||||
// 404: notFound
|
||||
// 500: error
|
||||
|
||||
org := ctx.Org.Organization
|
||||
hookID := ctx.ParamsInt64(":id")
|
||||
if err := models.DeleteWebhookByOrgID(org.ID, hookID); err != nil {
|
||||
|
@ -53,17 +53,45 @@ func listMembers(ctx *context.APIContext, publicOnly bool) {
|
||||
|
||||
// ListMembers list an organization's members
|
||||
func ListMembers(ctx *context.APIContext) {
|
||||
// swagger:route GET /orgs/{orgname}/members organization orgListMembers
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 200: UserList
|
||||
// 500: error
|
||||
|
||||
publicOnly := ctx.User == nil || !ctx.Org.Organization.IsOrgMember(ctx.User.ID)
|
||||
listMembers(ctx, publicOnly)
|
||||
}
|
||||
|
||||
// ListPublicMembers list an organization's public members
|
||||
func ListPublicMembers(ctx *context.APIContext) {
|
||||
// swagger:route GET /orgs/{orgname}/public_members organization orgListPublicMembers
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 200: UserList
|
||||
// 500: error
|
||||
|
||||
listMembers(ctx, true)
|
||||
}
|
||||
|
||||
// IsMember check if a user is a member of an organization
|
||||
func IsMember(ctx *context.APIContext) {
|
||||
// swagger:route GET /orgs/{orgname}/members/{username} organization orgIsMember
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 204: empty
|
||||
// 302: redirect
|
||||
// 404: notFound
|
||||
|
||||
userToCheck := user.GetUserByParams(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
@ -85,6 +113,15 @@ func IsMember(ctx *context.APIContext) {
|
||||
|
||||
// IsPublicMember check if a user is a public member of an organization
|
||||
func IsPublicMember(ctx *context.APIContext) {
|
||||
// swagger:route GET /orgs/{orgname}/public_members/{username} organization orgIsPublicMember
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 204: empty
|
||||
// 404: notFound
|
||||
|
||||
userToCheck := user.GetUserByParams(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
@ -98,6 +135,16 @@ func IsPublicMember(ctx *context.APIContext) {
|
||||
|
||||
// PublicizeMember make a member's membership public
|
||||
func PublicizeMember(ctx *context.APIContext) {
|
||||
// swagger:route PUT /orgs/{orgname}/public_members/{username} organization orgPublicizeMember
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 204: empty
|
||||
// 403: forbidden
|
||||
// 500: error
|
||||
|
||||
userToPublicize := user.GetUserByParams(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
@ -116,6 +163,16 @@ func PublicizeMember(ctx *context.APIContext) {
|
||||
|
||||
// ConcealMember make a member's membership not public
|
||||
func ConcealMember(ctx *context.APIContext) {
|
||||
// swagger:route DELETE /orgs/{orgname}/public_members/{username} organization orgConcealMember
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 204: empty
|
||||
// 403: forbidden
|
||||
// 500: error
|
||||
|
||||
userToConceal := user.GetUserByParams(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
@ -134,6 +191,15 @@ func ConcealMember(ctx *context.APIContext) {
|
||||
|
||||
// DeleteMember remove a member from an organization
|
||||
func DeleteMember(ctx *context.APIContext) {
|
||||
// swagger:route DELETE /orgs/{orgname}/members/{username} organization orgDeleteMember
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 204: empty
|
||||
// 500: error
|
||||
|
||||
member := user.GetUserByParams(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
|
@ -14,7 +14,7 @@ import (
|
||||
|
||||
// ListForks list a repository's forks
|
||||
func ListForks(ctx *context.APIContext) {
|
||||
// swagger:route GET /repos/{owner}/{repo}/forks listForks
|
||||
// swagger:route GET /repos/{owner}/{repo}/forks repository listForks
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -42,7 +42,7 @@ func ListForks(ctx *context.APIContext) {
|
||||
|
||||
// CreateFork create a fork of a repo
|
||||
func CreateFork(ctx *context.APIContext, form api.CreateForkOption) {
|
||||
// swagger:route POST /repos/{owner}/{repo}/forks createFork
|
||||
// swagger:route POST /repos/{owner}/{repo}/forks repository createFork
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
|
@ -15,13 +15,13 @@ import (
|
||||
|
||||
// ListHooks list all hooks of a repository
|
||||
func ListHooks(ctx *context.APIContext) {
|
||||
// swagger:route GET /repos/{username}/{reponame}/hooks
|
||||
// swagger:route GET /repos/{username}/{reponame}/hooks repository repoListHooks
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 200: apiHooks
|
||||
// 200: HookList
|
||||
// 500: error
|
||||
|
||||
hooks, err := models.GetWebhooksByRepoID(ctx.Repo.Repository.ID)
|
||||
@ -50,7 +50,7 @@ func GetHook(ctx *context.APIContext) {
|
||||
|
||||
// CreateHook create a hook for a repository
|
||||
func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
|
||||
// swagger:route POST /repos/{username}/{reponame}/hooks
|
||||
// swagger:route POST /repos/{username}/{reponame}/hooks repository repoCreateHook
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
@ -59,7 +59,7 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 200: apiHook
|
||||
// 200: Hook
|
||||
// 422: validationError
|
||||
// 500: error
|
||||
|
||||
@ -71,13 +71,13 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
|
||||
|
||||
// EditHook modify a hook of a repository
|
||||
func EditHook(ctx *context.APIContext, form api.EditHookOption) {
|
||||
// swagger:route PATCH /repos/{username}/{reponame}/hooks/{id}
|
||||
// swagger:route PATCH /repos/{username}/{reponame}/hooks/{id} repository repoEditHook
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 200: apiHook //TODO
|
||||
// 200: Hook
|
||||
// 422: validationError
|
||||
// 500: error
|
||||
|
||||
@ -87,7 +87,7 @@ func EditHook(ctx *context.APIContext, form api.EditHookOption) {
|
||||
|
||||
// DeleteHook delete a hook of a repository
|
||||
func DeleteHook(ctx *context.APIContext) {
|
||||
// swagger:route DELETE /repos/{username}/{reponame}/hooks/{id}
|
||||
// swagger:route DELETE /repos/{username}/{reponame}/hooks/{id} repository repoDeleteHook
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
|
@ -20,7 +20,7 @@ import (
|
||||
|
||||
// Search repositories via options
|
||||
func Search(ctx *context.APIContext) {
|
||||
// swagger:route GET /repos/search repoSearch
|
||||
// swagger:route GET /repos/search repository repoSearch
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -130,8 +130,21 @@ func CreateUserRepo(ctx *context.APIContext, owner *models.User, opt api.CreateR
|
||||
}
|
||||
|
||||
// Create one repository of mine
|
||||
// see https://github.com/gogits/go-gogs-client/wiki/Repositories#create
|
||||
func Create(ctx *context.APIContext, opt api.CreateRepoOption) {
|
||||
// swagger:route POST /user/repos repository user createCurrentUserRepo
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 201: Repository
|
||||
// 403: forbidden
|
||||
// 422: validationError
|
||||
// 500: error
|
||||
|
||||
// Shouldn't reach this condition, but just in case.
|
||||
if ctx.User.IsOrganization() {
|
||||
ctx.Error(422, "", "not allowed creating repository for organization")
|
||||
@ -142,7 +155,7 @@ func Create(ctx *context.APIContext, opt api.CreateRepoOption) {
|
||||
|
||||
// CreateOrgRepo create one repository of the organization
|
||||
func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) {
|
||||
// swagger:route POST /org/{org}/repos createOrgRepo
|
||||
// swagger:route POST /org/{org}/repos organization createOrgRepo
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
@ -175,7 +188,7 @@ func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) {
|
||||
|
||||
// Migrate migrate remote git repository to gitea
|
||||
func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
|
||||
// swagger:route POST /repos/migrate
|
||||
// swagger:route POST /repos/migrate repository repoMigrate
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
@ -260,7 +273,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
|
||||
|
||||
// Get one repository
|
||||
func Get(ctx *context.APIContext) {
|
||||
// swagger:route GET /repos/{username}/{reponame}
|
||||
// swagger:route GET /repos/{username}/{reponame} repository repoGet
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -274,7 +287,7 @@ func Get(ctx *context.APIContext) {
|
||||
|
||||
// GetByID returns a single Repository
|
||||
func GetByID(ctx *context.APIContext) {
|
||||
// swagger:route GET /repositories/{id}
|
||||
// swagger:route GET /repositories/{id} repository repoGetByID
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -306,7 +319,7 @@ func GetByID(ctx *context.APIContext) {
|
||||
|
||||
// Delete one repository
|
||||
func Delete(ctx *context.APIContext) {
|
||||
// swagger:route DELETE /repos/{username}/{reponame}
|
||||
// swagger:route DELETE /repos/{username}/{reponame} repository repoDelete
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -339,7 +352,7 @@ func Delete(ctx *context.APIContext) {
|
||||
|
||||
// MirrorSync adds a mirrored repository to the sync queue
|
||||
func MirrorSync(ctx *context.APIContext) {
|
||||
// swagger:route POST /repos/{username}/{reponame}/mirror-sync repoMirrorSync
|
||||
// swagger:route POST /repos/{username}/{reponame}/mirror-sync repository repoMirrorSync
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
|
||||
// ListAccessTokens list all the access tokens
|
||||
func ListAccessTokens(ctx *context.APIContext) {
|
||||
// swagger:route GET /users/{username}/tokens userGetTokens
|
||||
// swagger:route GET /users/{username}/tokens user userGetTokens
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -40,7 +40,7 @@ func ListAccessTokens(ctx *context.APIContext) {
|
||||
|
||||
// CreateAccessToken create access tokens
|
||||
func CreateAccessToken(ctx *context.APIContext, form api.CreateAccessTokenOption) {
|
||||
// swagger:route POST /users/{username} /tokens userCreateToken
|
||||
// swagger:route POST /users/{username} /tokens user userCreateToken
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
|
@ -30,7 +30,7 @@ func listUserFollowers(ctx *context.APIContext, u *models.User) {
|
||||
|
||||
// ListMyFollowers list all my followers
|
||||
func ListMyFollowers(ctx *context.APIContext) {
|
||||
// swagger:route GET /user/followers userCurrentListFollowers
|
||||
// swagger:route GET /user/followers user userCurrentListFollowers
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -44,7 +44,7 @@ func ListMyFollowers(ctx *context.APIContext) {
|
||||
|
||||
// ListFollowers list user's followers
|
||||
func ListFollowers(ctx *context.APIContext) {
|
||||
// swagger:route GET /users/:username/followers userListFollowers
|
||||
// swagger:route GET /users/:username/followers user userListFollowers
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -71,7 +71,7 @@ func listUserFollowing(ctx *context.APIContext, u *models.User) {
|
||||
|
||||
// ListMyFollowing list all my followings
|
||||
func ListMyFollowing(ctx *context.APIContext) {
|
||||
// swagger:route GET /user/following userCurrentListFollowing
|
||||
// swagger:route GET /user/following user userCurrentListFollowing
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -85,7 +85,7 @@ func ListMyFollowing(ctx *context.APIContext) {
|
||||
|
||||
// ListFollowing list user's followings
|
||||
func ListFollowing(ctx *context.APIContext) {
|
||||
// swagger:route GET /users/{username}/following userListFollowing
|
||||
// swagger:route GET /users/{username}/following user userListFollowing
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -111,7 +111,7 @@ func checkUserFollowing(ctx *context.APIContext, u *models.User, followID int64)
|
||||
|
||||
// CheckMyFollowing check if the repo is followed by me
|
||||
func CheckMyFollowing(ctx *context.APIContext) {
|
||||
// swagger:route GET /user/following/{username} userCurrentCheckFollowing
|
||||
// swagger:route GET /user/following/{username} user userCurrentCheckFollowing
|
||||
//
|
||||
// Responses:
|
||||
// 204: empty
|
||||
@ -126,7 +126,7 @@ func CheckMyFollowing(ctx *context.APIContext) {
|
||||
|
||||
// CheckFollowing check if the repo is followed by user
|
||||
func CheckFollowing(ctx *context.APIContext) {
|
||||
// swagger:route GET /users/{username}/following/:target userCheckFollowing
|
||||
// swagger:route GET /users/{username}/following/:target user userCheckFollowing
|
||||
//
|
||||
// Responses:
|
||||
// 204: empty
|
||||
@ -145,7 +145,7 @@ func CheckFollowing(ctx *context.APIContext) {
|
||||
|
||||
// Follow follow one repository
|
||||
func Follow(ctx *context.APIContext) {
|
||||
// swagger:route PUT /user/following/{username} userCurrentPutFollow
|
||||
// swagger:route PUT /user/following/{username} user userCurrentPutFollow
|
||||
//
|
||||
// Responses:
|
||||
// 204: empty
|
||||
@ -164,7 +164,7 @@ func Follow(ctx *context.APIContext) {
|
||||
|
||||
// Unfollow unfollow one repository
|
||||
func Unfollow(ctx *context.APIContext) {
|
||||
// swagger:route DELETE /user/following/{username} userCurrentDeleteFollow
|
||||
// swagger:route DELETE /user/following/{username} user userCurrentDeleteFollow
|
||||
//
|
||||
// Responses:
|
||||
// 204: empty
|
||||
|
@ -34,7 +34,7 @@ func listGPGKeys(ctx *context.APIContext, uid int64) {
|
||||
|
||||
//ListGPGKeys get the GPG key list of a user
|
||||
func ListGPGKeys(ctx *context.APIContext) {
|
||||
// swagger:route GET /users/{username}/gpg_keys userListGPGKeys
|
||||
// swagger:route GET /users/{username}/gpg_keys user userListGPGKeys
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -52,7 +52,7 @@ func ListGPGKeys(ctx *context.APIContext) {
|
||||
|
||||
//ListMyGPGKeys get the GPG key list of the logged user
|
||||
func ListMyGPGKeys(ctx *context.APIContext) {
|
||||
// swagger:route GET /user/gpg_keys userCurrentListGPGKeys
|
||||
// swagger:route GET /user/gpg_keys user userCurrentListGPGKeys
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -66,7 +66,7 @@ func ListMyGPGKeys(ctx *context.APIContext) {
|
||||
|
||||
//GetGPGKey get the GPG key based on a id
|
||||
func GetGPGKey(ctx *context.APIContext) {
|
||||
// swagger:route GET /user/gpg_keys/{id} userCurrentGetGPGKey
|
||||
// swagger:route GET /user/gpg_keys/{id} user userCurrentGetGPGKey
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -100,7 +100,7 @@ func CreateUserGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption, uid
|
||||
|
||||
//CreateGPGKey associate a GPG key to the current user
|
||||
func CreateGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption) {
|
||||
// swagger:route POST /user/gpg_keys userCurrentPostGPGKey
|
||||
// swagger:route POST /user/gpg_keys user userCurrentPostGPGKey
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
@ -118,7 +118,7 @@ func CreateGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption) {
|
||||
|
||||
//DeleteGPGKey remove a GPG key associated to the current user
|
||||
func DeleteGPGKey(ctx *context.APIContext) {
|
||||
// swagger:route DELETE /user/gpg_keys/{id} userCurrentDeleteGPGKey
|
||||
// swagger:route DELETE /user/gpg_keys/{id} user userCurrentDeleteGPGKey
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
|
@ -55,7 +55,7 @@ func listPublicKeys(ctx *context.APIContext, uid int64) {
|
||||
|
||||
// ListMyPublicKeys list all my public keys
|
||||
func ListMyPublicKeys(ctx *context.APIContext) {
|
||||
// swagger:route GET /user/keys userCurrentListKeys
|
||||
// swagger:route GET /user/keys user userCurrentListKeys
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -69,7 +69,7 @@ func ListMyPublicKeys(ctx *context.APIContext) {
|
||||
|
||||
// ListPublicKeys list all user's public keys
|
||||
func ListPublicKeys(ctx *context.APIContext) {
|
||||
// swagger:route GET /users/{username}/keys userListKeys
|
||||
// swagger:route GET /users/{username}/keys user userListKeys
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -87,7 +87,7 @@ func ListPublicKeys(ctx *context.APIContext) {
|
||||
|
||||
// GetPublicKey get one public key
|
||||
func GetPublicKey(ctx *context.APIContext) {
|
||||
// swagger:route GET /user/keys/{id} userCurrentGetKey
|
||||
// swagger:route GET /user/keys/{id} user userCurrentGetKey
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -130,7 +130,7 @@ func CreateUserPublicKey(ctx *context.APIContext, form api.CreateKeyOption, uid
|
||||
|
||||
// CreatePublicKey create one public key for me
|
||||
func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
|
||||
// swagger:route POST /user/keys userCurrentPostKey
|
||||
// swagger:route POST /user/keys user userCurrentPostKey
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
@ -148,7 +148,7 @@ func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
|
||||
|
||||
// DeletePublicKey delete one public key of mine
|
||||
func DeletePublicKey(ctx *context.APIContext) {
|
||||
// swagger:route DELETE /user/keys/{id} userCurrentDeleteKey
|
||||
// swagger:route DELETE /user/keys/{id} user userCurrentDeleteKey
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
|
@ -36,7 +36,7 @@ func listUserRepos(ctx *context.APIContext, u *models.User) {
|
||||
|
||||
// ListUserRepos - list the repos owned by the given user.
|
||||
func ListUserRepos(ctx *context.APIContext) {
|
||||
// swagger:route GET /users/{username}/repos userListRepos
|
||||
// swagger:route GET /users/{username}/repos user userListRepos
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -54,7 +54,7 @@ func ListUserRepos(ctx *context.APIContext) {
|
||||
|
||||
// ListMyRepos - list the repositories you own or have access to.
|
||||
func ListMyRepos(ctx *context.APIContext) {
|
||||
// swagger:route GET /user/repos userCurrentListRepos
|
||||
// swagger:route GET /user/repos user userCurrentListRepos
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -87,7 +87,7 @@ func ListMyRepos(ctx *context.APIContext) {
|
||||
|
||||
// ListOrgRepos - list the repositories of an organization.
|
||||
func ListOrgRepos(ctx *context.APIContext) {
|
||||
// swagger:route GET /orgs/{org}/repos orgListRepos
|
||||
// swagger:route GET /orgs/{orgname}/repos organization orgListRepos
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
|
@ -33,7 +33,7 @@ func getStarredRepos(userID int64, private bool) ([]*api.Repository, error) {
|
||||
// GetStarredRepos returns the repos that the user specified by the APIContext
|
||||
// has starred
|
||||
func GetStarredRepos(ctx *context.APIContext) {
|
||||
// swagger:route GET /users/{username}/starred userListStarred
|
||||
// swagger:route GET /users/{username}/starred user userListStarred
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -53,7 +53,7 @@ func GetStarredRepos(ctx *context.APIContext) {
|
||||
|
||||
// GetMyStarredRepos returns the repos that the authenticated user has starred
|
||||
func GetMyStarredRepos(ctx *context.APIContext) {
|
||||
// swagger:route GET /user/starred userCurrentListStarred
|
||||
// swagger:route GET /user/starred user userCurrentListStarred
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -71,7 +71,7 @@ func GetMyStarredRepos(ctx *context.APIContext) {
|
||||
|
||||
// IsStarring returns whether the authenticated is starring the repo
|
||||
func IsStarring(ctx *context.APIContext) {
|
||||
// swagger:route GET /user/starred/{username}/{reponame} userCurrentCheckStarring
|
||||
// swagger:route GET /user/starred/{username}/{reponame} user userCurrentCheckStarring
|
||||
//
|
||||
// Responses:
|
||||
// 204: empty
|
||||
@ -86,7 +86,7 @@ func IsStarring(ctx *context.APIContext) {
|
||||
|
||||
// Star the repo specified in the APIContext, as the authenticated user
|
||||
func Star(ctx *context.APIContext) {
|
||||
// swagger:route PUT /user/starred/{username}/{reponame} userCurrentPutStar
|
||||
// swagger:route PUT /user/starred/{username}/{reponame} user userCurrentPutStar
|
||||
//
|
||||
// Responses:
|
||||
// 204: empty
|
||||
@ -102,7 +102,7 @@ func Star(ctx *context.APIContext) {
|
||||
|
||||
// Unstar the repo specified in the APIContext, as the authenticated user
|
||||
func Unstar(ctx *context.APIContext) {
|
||||
// swagger:route DELETE /user/starred/{username}/{reponame} userCurrentDeleteStar
|
||||
// swagger:route DELETE /user/starred/{username}/{reponame} user userCurrentDeleteStar
|
||||
//
|
||||
// Responses:
|
||||
// 204: empty
|
||||
|
@ -17,7 +17,7 @@ import (
|
||||
|
||||
// Search search users
|
||||
func Search(ctx *context.APIContext) {
|
||||
// swagger:route GET /users/search userSearch
|
||||
// swagger:route GET /users/search user userSearch
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -65,7 +65,7 @@ func Search(ctx *context.APIContext) {
|
||||
|
||||
// GetInfo get user's information
|
||||
func GetInfo(ctx *context.APIContext) {
|
||||
// swagger:route GET /users/{username} userGet
|
||||
// swagger:route GET /users/{username} user userGet
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -94,7 +94,7 @@ func GetInfo(ctx *context.APIContext) {
|
||||
|
||||
// GetAuthenticatedUser get curent user's information
|
||||
func GetAuthenticatedUser(ctx *context.APIContext) {
|
||||
// swagger:route GET /user userGetCurrent
|
||||
// swagger:route GET /user user userGetCurrent
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
|
@ -33,7 +33,7 @@ func getWatchedRepos(userID int64, private bool) ([]*api.Repository, error) {
|
||||
|
||||
// GetWatchedRepos returns the repos that the user specified in ctx is watching
|
||||
func GetWatchedRepos(ctx *context.APIContext) {
|
||||
// swagger:route GET /users/{username}/subscriptions userListSubscriptions
|
||||
// swagger:route GET /users/{username}/subscriptions user userListSubscriptions
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -53,7 +53,7 @@ func GetWatchedRepos(ctx *context.APIContext) {
|
||||
|
||||
// GetMyWatchedRepos returns the repos that the authenticated user is watching
|
||||
func GetMyWatchedRepos(ctx *context.APIContext) {
|
||||
// swagger:route GET /user/subscriptions userCurrentListSubscriptions
|
||||
// swagger:route GET /user/subscriptions user userCurrentListSubscriptions
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
@ -72,7 +72,7 @@ func GetMyWatchedRepos(ctx *context.APIContext) {
|
||||
// IsWatching returns whether the authenticated user is watching the repo
|
||||
// specified in ctx
|
||||
func IsWatching(ctx *context.APIContext) {
|
||||
// swagger:route GET /repos/{username}/{reponame}/subscription userCurrentCheckSubscription
|
||||
// swagger:route GET /repos/{username}/{reponame}/subscription repository userCurrentCheckSubscription
|
||||
//
|
||||
// Responses:
|
||||
// 200: WatchInfo
|
||||
@ -94,7 +94,7 @@ func IsWatching(ctx *context.APIContext) {
|
||||
|
||||
// Watch the repo specified in ctx, as the authenticated user
|
||||
func Watch(ctx *context.APIContext) {
|
||||
// swagger:route PUT /repos/{username}/{reponame}/subscription userCurrentPutSubscription
|
||||
// swagger:route PUT /repos/{username}/{reponame}/subscription repository userCurrentPutSubscription
|
||||
//
|
||||
// Responses:
|
||||
// 200: WatchInfo
|
||||
@ -118,7 +118,7 @@ func Watch(ctx *context.APIContext) {
|
||||
|
||||
// Unwatch the repo specified in ctx, as the authenticated user
|
||||
func Unwatch(ctx *context.APIContext) {
|
||||
// swagger:route DELETE /repos/{username}/{reponame}/subscription userCurrentDeleteSubscription
|
||||
// swagger:route DELETE /repos/{username}/{reponame}/subscription repository userCurrentDeleteSubscription
|
||||
//
|
||||
// Responses:
|
||||
// 204: empty
|
||||
|
59
vendor/code.gitea.io/sdk/gitea/admin_user.go
generated
vendored
59
vendor/code.gitea.io/sdk/gitea/admin_user.go
generated
vendored
@ -11,14 +11,22 @@ import (
|
||||
)
|
||||
|
||||
// CreateUserOption create user options
|
||||
// swagger:parameters adminCreateUser
|
||||
type CreateUserOption struct {
|
||||
SourceID int64 `json:"source_id"`
|
||||
LoginName string `json:"login_name"`
|
||||
Username string `json:"username" binding:"Required;AlphaDashDot;MaxSize(35)"`
|
||||
FullName string `json:"full_name" binding:"MaxSize(100)"`
|
||||
Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
|
||||
Password string `json:"password" binding:"MaxSize(255)"`
|
||||
SendNotify bool `json:"send_notify"`
|
||||
// in: body
|
||||
SourceID int64 `json:"source_id"`
|
||||
// in: body
|
||||
LoginName string `json:"login_name"`
|
||||
// in: body
|
||||
Username string `json:"username" binding:"Required;AlphaDashDot;MaxSize(35)"`
|
||||
// in: body
|
||||
FullName string `json:"full_name" binding:"MaxSize(100)"`
|
||||
// in: body
|
||||
Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
|
||||
// in: body
|
||||
Password string `json:"password" binding:"MaxSize(255)"`
|
||||
// in: body
|
||||
SendNotify bool `json:"send_notify"`
|
||||
}
|
||||
|
||||
// AdminCreateUser create a user
|
||||
@ -32,19 +40,32 @@ func (c *Client) AdminCreateUser(opt CreateUserOption) (*User, error) {
|
||||
}
|
||||
|
||||
// EditUserOption edit user options
|
||||
// swagger:parameters adminEditUser
|
||||
type EditUserOption struct {
|
||||
SourceID int64 `json:"source_id"`
|
||||
LoginName string `json:"login_name"`
|
||||
FullName string `json:"full_name" binding:"MaxSize(100)"`
|
||||
Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
|
||||
Password string `json:"password" binding:"MaxSize(255)"`
|
||||
Website string `json:"website" binding:"MaxSize(50)"`
|
||||
Location string `json:"location" binding:"MaxSize(50)"`
|
||||
Active *bool `json:"active"`
|
||||
Admin *bool `json:"admin"`
|
||||
AllowGitHook *bool `json:"allow_git_hook"`
|
||||
AllowImportLocal *bool `json:"allow_import_local"`
|
||||
MaxRepoCreation *int `json:"max_repo_creation"`
|
||||
// in: body
|
||||
SourceID int64 `json:"source_id"`
|
||||
// in: body
|
||||
LoginName string `json:"login_name"`
|
||||
// in: body
|
||||
FullName string `json:"full_name" binding:"MaxSize(100)"`
|
||||
// in: body
|
||||
Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
|
||||
// in: body
|
||||
Password string `json:"password" binding:"MaxSize(255)"`
|
||||
// in: body
|
||||
Website string `json:"website" binding:"MaxSize(50)"`
|
||||
// in: body
|
||||
Location string `json:"location" binding:"MaxSize(50)"`
|
||||
// in: body
|
||||
Active *bool `json:"active"`
|
||||
// in: body
|
||||
Admin *bool `json:"admin"`
|
||||
// in: body
|
||||
AllowGitHook *bool `json:"allow_git_hook"`
|
||||
// in: body
|
||||
AllowImportLocal *bool `json:"allow_import_local"`
|
||||
// in: body
|
||||
MaxRepoCreation *int `json:"max_repo_creation"`
|
||||
}
|
||||
|
||||
// AdminEditUser modify user informations
|
||||
|
2
vendor/code.gitea.io/sdk/gitea/fork.go
generated
vendored
2
vendor/code.gitea.io/sdk/gitea/fork.go
generated
vendored
@ -20,7 +20,9 @@ func (c *Client) ListForks(user, repo string) ([]*Repository, error) {
|
||||
}
|
||||
|
||||
// CreateForkOption options for creating a fork
|
||||
// swagger:parameters createFork
|
||||
type CreateForkOption struct {
|
||||
// in: body
|
||||
Organization *string `json:"organization"`
|
||||
}
|
||||
|
||||
|
28
vendor/code.gitea.io/sdk/gitea/hook.go
generated
vendored
28
vendor/code.gitea.io/sdk/gitea/hook.go
generated
vendored
@ -20,6 +20,7 @@ var (
|
||||
)
|
||||
|
||||
// Hook a hook is a web hook when one repository changed
|
||||
// swagger:response Hook
|
||||
type Hook struct {
|
||||
ID int64 `json:"id"`
|
||||
Type string `json:"type"`
|
||||
@ -31,14 +32,18 @@ type Hook struct {
|
||||
Created time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
// HookList represents a list of API hook.
|
||||
// swagger:response HookList
|
||||
type HookList []*Hook
|
||||
|
||||
// ListOrgHooks list all the hooks of one organization
|
||||
func (c *Client) ListOrgHooks(org string) ([]*Hook, error) {
|
||||
func (c *Client) ListOrgHooks(org string) (HookList, error) {
|
||||
hooks := make([]*Hook, 0, 10)
|
||||
return hooks, c.getParsedResponse("GET", fmt.Sprintf("/orgs/%s/hooks", org), nil, nil, &hooks)
|
||||
}
|
||||
|
||||
// ListRepoHooks list all the hooks of one repository
|
||||
func (c *Client) ListRepoHooks(user, repo string) ([]*Hook, error) {
|
||||
func (c *Client) ListRepoHooks(user, repo string) (HookList, error) {
|
||||
hooks := make([]*Hook, 0, 10)
|
||||
return hooks, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/hooks", user, repo), nil, nil, &hooks)
|
||||
}
|
||||
@ -56,11 +61,16 @@ func (c *Client) GetRepoHook(user, repo string, id int64) (*Hook, error) {
|
||||
}
|
||||
|
||||
// CreateHookOption options when create a hook
|
||||
// swagger:parameters orgCreateHook repoCreateHook
|
||||
type CreateHookOption struct {
|
||||
Type string `json:"type" binding:"Required"`
|
||||
// in: body
|
||||
Type string `json:"type" binding:"Required"`
|
||||
// in: body
|
||||
Config map[string]string `json:"config" binding:"Required"`
|
||||
Events []string `json:"events"`
|
||||
Active bool `json:"active"`
|
||||
// in: body
|
||||
Events []string `json:"events"`
|
||||
// in: body
|
||||
Active bool `json:"active"`
|
||||
}
|
||||
|
||||
// CreateOrgHook create one hook for an organization, with options
|
||||
@ -84,10 +94,14 @@ func (c *Client) CreateRepoHook(user, repo string, opt CreateHookOption) (*Hook,
|
||||
}
|
||||
|
||||
// EditHookOption options when modify one hook
|
||||
// swagger:parameters orgEditHook repoEditHook
|
||||
type EditHookOption struct {
|
||||
// in: body
|
||||
Config map[string]string `json:"config"`
|
||||
Events []string `json:"events"`
|
||||
Active *bool `json:"active"`
|
||||
// in: body
|
||||
Events []string `json:"events"`
|
||||
// in: body
|
||||
Active *bool `json:"active"`
|
||||
}
|
||||
|
||||
// EditOrgHook modify one hook of an organization, with hook id and options
|
||||
|
69
vendor/code.gitea.io/sdk/gitea/issue_tracked_time.go
generated
vendored
Normal file
69
vendor/code.gitea.io/sdk/gitea/issue_tracked_time.go
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package gitea
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
// TrackedTime worked time for an issue / pr
|
||||
// swagger:response TrackedTime
|
||||
type TrackedTime struct {
|
||||
ID int64 `json:"id"`
|
||||
Created time.Time `json:"created"`
|
||||
// Time in seconds
|
||||
Time int64 `json:"time"`
|
||||
UserID int64 `json:"user_id"`
|
||||
IssueID int64 `json:"issue_id"`
|
||||
}
|
||||
|
||||
// TrackedTimes represent a list of tracked times
|
||||
// swagger:response TrackedTimes
|
||||
type TrackedTimes []*TrackedTime
|
||||
|
||||
// GetUserTrackedTimes list tracked times of a user
|
||||
func (c *Client) GetUserTrackedTimes(owner, repo, user string) (TrackedTimes, error) {
|
||||
times := make(TrackedTimes, 0, 10)
|
||||
return times, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/times/%s", owner, repo, user), nil, nil, ×)
|
||||
}
|
||||
|
||||
// GetRepoTrackedTimes list tracked times of a repository
|
||||
func (c *Client) GetRepoTrackedTimes(owner, repo string) (TrackedTimes, error) {
|
||||
times := make(TrackedTimes, 0, 10)
|
||||
return times, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/times", owner, repo), nil, nil, ×)
|
||||
}
|
||||
|
||||
// GetMyTrackedTimes list tracked times of the current user
|
||||
func (c *Client) GetMyTrackedTimes() (TrackedTimes, error) {
|
||||
times := make(TrackedTimes, 0, 10)
|
||||
return times, c.getParsedResponse("GET", "/user/times", nil, nil, ×)
|
||||
}
|
||||
|
||||
// AddTimeOption adds time manually to an issue
|
||||
// swagger:parameters addTime
|
||||
type AddTimeOption struct {
|
||||
// in: body
|
||||
Time int64 `json:"time" binding:"Required"`
|
||||
}
|
||||
|
||||
// AddTime adds time to issue with the given index
|
||||
func (c *Client) AddTime(owner, repo string, index int64, opt AddTimeOption) (*TrackedTime, error) {
|
||||
body, err := json.Marshal(&opt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
t := new(TrackedTime)
|
||||
return t, c.getParsedResponse("POST", fmt.Sprintf("/repos/%s/%s/issues/%d/times", owner, repo, index),
|
||||
jsonHeader, bytes.NewReader(body), t)
|
||||
}
|
||||
|
||||
// ListTrackedTimes get tracked times of one issue via issue id
|
||||
func (c *Client) ListTrackedTimes(owner, repo string, index int64) (TrackedTimes, error) {
|
||||
times := make(TrackedTimes, 0, 5)
|
||||
return times, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/issues/%d/times", owner, repo, index), nil, nil, ×)
|
||||
}
|
15
vendor/code.gitea.io/sdk/gitea/org.go
generated
vendored
15
vendor/code.gitea.io/sdk/gitea/org.go
generated
vendored
@ -11,6 +11,7 @@ import (
|
||||
)
|
||||
|
||||
// Organization a group of some repositories, users and teams
|
||||
// swagger:response Organization
|
||||
type Organization struct {
|
||||
ID int64 `json:"id"`
|
||||
UserName string `json:"username"`
|
||||
@ -40,12 +41,18 @@ func (c *Client) GetOrg(orgname string) (*Organization, error) {
|
||||
}
|
||||
|
||||
// CreateOrgOption create one organization options
|
||||
// swagger:parameters adminCreateOrg
|
||||
type CreateOrgOption struct {
|
||||
UserName string `json:"username" binding:"Required"`
|
||||
FullName string `json:"full_name"`
|
||||
// in: body
|
||||
UserName string `json:"username" binding:"Required"`
|
||||
// in: body
|
||||
FullName string `json:"full_name"`
|
||||
// in: body
|
||||
Description string `json:"description"`
|
||||
Website string `json:"website"`
|
||||
Location string `json:"location"`
|
||||
// in: body
|
||||
Website string `json:"website"`
|
||||
// in: body
|
||||
Location string `json:"location"`
|
||||
}
|
||||
|
||||
// EditOrgOption edit one organization options
|
||||
|
23
vendor/code.gitea.io/sdk/gitea/repo.go
generated
vendored
23
vendor/code.gitea.io/sdk/gitea/repo.go
generated
vendored
@ -69,7 +69,7 @@ func (c *Client) ListOrgRepos(org string) ([]*Repository, error) {
|
||||
}
|
||||
|
||||
// CreateRepoOption options when creating repository
|
||||
//swagger:parameters createOrgRepo
|
||||
//swagger:parameters createOrgRepo adminCreateRepo createCurrentUserRepo
|
||||
type CreateRepoOption struct {
|
||||
// Name of the repository to create
|
||||
//
|
||||
@ -135,15 +135,24 @@ func (c *Client) DeleteRepo(owner, repo string) error {
|
||||
}
|
||||
|
||||
// MigrateRepoOption options when migrate repository from an external place
|
||||
// swagger:parameters repoMigrate
|
||||
type MigrateRepoOption struct {
|
||||
CloneAddr string `json:"clone_addr" binding:"Required"`
|
||||
// in: body
|
||||
CloneAddr string `json:"clone_addr" binding:"Required"`
|
||||
// in: body
|
||||
AuthUsername string `json:"auth_username"`
|
||||
// in: body
|
||||
AuthPassword string `json:"auth_password"`
|
||||
UID int `json:"uid" binding:"Required"`
|
||||
RepoName string `json:"repo_name" binding:"Required"`
|
||||
Mirror bool `json:"mirror"`
|
||||
Private bool `json:"private"`
|
||||
Description string `json:"description"`
|
||||
// in: body
|
||||
UID int `json:"uid" binding:"Required"`
|
||||
// in: body
|
||||
RepoName string `json:"repo_name" binding:"Required"`
|
||||
// in: body
|
||||
Mirror bool `json:"mirror"`
|
||||
// in: body
|
||||
Private bool `json:"private"`
|
||||
// in: body
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// MigrateRepo migrates a repository from other Git hosting sources for the
|
||||
|
2
vendor/code.gitea.io/sdk/gitea/repo_key.go
generated
vendored
2
vendor/code.gitea.io/sdk/gitea/repo_key.go
generated
vendored
@ -34,7 +34,7 @@ func (c *Client) GetDeployKey(user, repo string, keyID int64) (*DeployKey, error
|
||||
}
|
||||
|
||||
// CreateKeyOption options when create deploy key
|
||||
// swagger:parameters userCurrentPostKey
|
||||
// swagger:parameters userCurrentPostKey adminCreatePublicKey
|
||||
type CreateKeyOption struct {
|
||||
// Title of the key to add
|
||||
//
|
||||
|
2
vendor/code.gitea.io/sdk/gitea/status.go
generated
vendored
2
vendor/code.gitea.io/sdk/gitea/status.go
generated
vendored
@ -21,7 +21,7 @@ const (
|
||||
// StatusSuccess is for when the Status is Success
|
||||
StatusSuccess StatusState = "success"
|
||||
// StatusError is for when the Status is Error
|
||||
StatusError StatusState = "error"
|
||||
StatusError StatusState = "error"
|
||||
// StatusFailure is for when the Status is Failure
|
||||
StatusFailure StatusState = "failure"
|
||||
// StatusWarning is for when the Status is Warning
|
||||
|
2
vendor/code.gitea.io/sdk/gitea/user_app.go
generated
vendored
2
vendor/code.gitea.io/sdk/gitea/user_app.go
generated
vendored
@ -26,7 +26,7 @@ type AccessToken struct {
|
||||
|
||||
// AccessTokenList represents a list of API access token.
|
||||
// swagger:response AccessTokenList
|
||||
type AccessTokenList []*AccessToken
|
||||
type AccessTokenList []*AccessToken
|
||||
|
||||
// ListAccessTokens lista all the access tokens of user
|
||||
func (c *Client) ListAccessTokens(user, pass string) ([]*AccessToken, error) {
|
||||
|
2
vendor/code.gitea.io/sdk/gitea/user_gpgkey.go
generated
vendored
2
vendor/code.gitea.io/sdk/gitea/user_gpgkey.go
generated
vendored
@ -32,7 +32,7 @@ type GPGKey struct {
|
||||
Expires time.Time `json:"expires_at,omitempty"`
|
||||
}
|
||||
|
||||
// GPGKeyEmail a email attache to a GPGKey
|
||||
// GPGKeyEmail an email attached to a GPGKey
|
||||
// swagger:model GPGKeyEmail
|
||||
type GPGKeyEmail struct {
|
||||
Email string `json:"email"`
|
||||
|
6
vendor/vendor.json
vendored
6
vendor/vendor.json
vendored
@ -9,10 +9,10 @@
|
||||
"revisionTime": "2017-08-03T00:53:29Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "nLhT+bLMj8uLICP+EZbrdoQe6mM=",
|
||||
"checksumSHA1": "Zgp5RqU+20L2p9TNl1rSsUIWEEE=",
|
||||
"path": "code.gitea.io/sdk/gitea",
|
||||
"revision": "8cff72208aa458f4efa8fdfbad29b03aee485b8c",
|
||||
"revisionTime": "2017-05-06T01:37:21Z"
|
||||
"revision": "bc243ad6c268d60658c71185452334b300c268cf",
|
||||
"revisionTime": "2017-08-21T08:23:17Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "bOODD4Gbw3GfcuQPU2dI40crxxk=",
|
||||
|
Loading…
Reference in New Issue
Block a user