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:
Antoine GIRARD 2017-08-21 13:13:47 +02:00 committed by Lauris BH
parent 951c909a67
commit fd8e8a421a
32 changed files with 1911 additions and 110 deletions

View file

@ -51,6 +51,10 @@ type APIForbiddenError struct {
// swagger:response notFound // swagger:response notFound
type APINotFound struct{} type APINotFound struct{}
//APIRedirect is a redirect response
// swagger:response redirect
type APIRedirect struct{}
// Error responses error message to client with given message. // Error responses error message to client with given message.
// If status is 500, also it prints error to log. // If status is 500, also it prints error to log.
func (ctx *APIContext) Error(status int, title string, obj interface{}) { func (ctx *APIContext) Error(status int, title string, obj interface{}) {

1447
public/swagger.v1.json vendored

File diff suppressed because it is too large Load diff

View file

@ -14,8 +14,21 @@ import (
) )
// CreateOrg api for create organization // 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) { 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) u := user.GetUserByParams(ctx)
if ctx.Written() { if ctx.Written() {
return return

View file

@ -13,8 +13,21 @@ import (
) )
// CreateRepo api for creating a repository // 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) { 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) owner := user.GetUserByParams(ctx)
if ctx.Written() { if ctx.Written() {
return return

View file

@ -35,8 +35,21 @@ func parseLoginSource(ctx *context.APIContext, u *models.User, sourceID int64, l
} }
// CreateUser api for creating a user // 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) { 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{ u := &models.User{
Name: form.Username, Name: form.Username,
FullName: form.FullName, FullName: form.FullName,
@ -73,8 +86,21 @@ func CreateUser(ctx *context.APIContext, form api.CreateUserOption) {
} }
// EditUser api for modifying a user's information // 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) { 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) u := user.GetUserByParams(ctx)
if ctx.Written() { if ctx.Written() {
return return
@ -130,8 +156,18 @@ func EditUser(ctx *context.APIContext, form api.EditUserOption) {
} }
// DeleteUser api for deleting a user // DeleteUser api for deleting a user
// https://github.com/gogits/go-gogs-client/wiki/Administration-Users#delete-a-user
func DeleteUser(ctx *context.APIContext) { 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) u := user.GetUserByParams(ctx)
if ctx.Written() { if ctx.Written() {
return return
@ -152,8 +188,21 @@ func DeleteUser(ctx *context.APIContext) {
} }
// CreatePublicKey api for creating a public key to a user // 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) { 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) u := user.GetUserByParams(ctx)
if ctx.Written() { if ctx.Written() {
return return

View file

@ -23,6 +23,28 @@
// - application/json // - application/json
// - text/html // - 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 // swagger:meta
package v1 package v1

View file

@ -14,7 +14,7 @@ import (
// Markdown render markdown document to HTML // Markdown render markdown document to HTML
func Markdown(ctx *context.APIContext, form api.MarkdownOption) { func Markdown(ctx *context.APIContext, form api.MarkdownOption) {
// swagger:route POST /markdown renderMarkdown // swagger:route POST /markdown miscellaneous renderMarkdown
// //
// Consumes: // Consumes:
// - application/json // - application/json
@ -52,7 +52,7 @@ func Markdown(ctx *context.APIContext, form api.MarkdownOption) {
// MarkdownRaw render raw markdown HTML // MarkdownRaw render raw markdown HTML
func MarkdownRaw(ctx *context.APIContext) { func MarkdownRaw(ctx *context.APIContext) {
// swagger:route POST /markdown/raw renderMarkdownRaw // swagger:route POST /markdown/raw miscellaneous renderMarkdownRaw
// //
// Consumes: // Consumes:
// - text/plain // - text/plain

View file

@ -12,7 +12,7 @@ import (
// Version shows the version of the Gitea server // Version shows the version of the Gitea server
func Version(ctx *context.APIContext) { func Version(ctx *context.APIContext) {
// swagger:route GET /version getVersion // swagger:route GET /version miscellaneous getVersion
// //
// Return Gitea running version. // Return Gitea running version.
// //

View file

@ -15,6 +15,15 @@ import (
// ListHooks list an organziation's webhooks // ListHooks list an organziation's webhooks
func ListHooks(ctx *context.APIContext) { 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 org := ctx.Org.Organization
orgHooks, err := models.GetWebhooksByOrgID(org.ID) orgHooks, err := models.GetWebhooksByOrgID(org.ID)
if err != nil { if err != nil {
@ -30,6 +39,16 @@ func ListHooks(ctx *context.APIContext) {
// GetHook get an organization's hook by id // GetHook get an organization's hook by id
func GetHook(ctx *context.APIContext) { 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 org := ctx.Org.Organization
hookID := ctx.ParamsInt64(":id") hookID := ctx.ParamsInt64(":id")
hook, err := utils.GetOrgHook(ctx, org.ID, hookID) hook, err := utils.GetOrgHook(ctx, org.ID, hookID)
@ -41,6 +60,19 @@ func GetHook(ctx *context.APIContext) {
// CreateHook create a hook for an organization // CreateHook create a hook for an organization
func CreateHook(ctx *context.APIContext, form api.CreateHookOption) { 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) { if !utils.CheckCreateHookOption(ctx, &form) {
return return
} }
@ -49,12 +81,36 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
// EditHook modify a hook of a repository // EditHook modify a hook of a repository
func EditHook(ctx *context.APIContext, form api.EditHookOption) { 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") hookID := ctx.ParamsInt64(":id")
utils.EditOrgHook(ctx, &form, hookID) utils.EditOrgHook(ctx, &form, hookID)
} }
// DeleteHook delete a hook of an organization // DeleteHook delete a hook of an organization
func DeleteHook(ctx *context.APIContext) { 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 org := ctx.Org.Organization
hookID := ctx.ParamsInt64(":id") hookID := ctx.ParamsInt64(":id")
if err := models.DeleteWebhookByOrgID(org.ID, hookID); err != nil { if err := models.DeleteWebhookByOrgID(org.ID, hookID); err != nil {

View file

@ -53,17 +53,45 @@ func listMembers(ctx *context.APIContext, publicOnly bool) {
// ListMembers list an organization's members // ListMembers list an organization's members
func ListMembers(ctx *context.APIContext) { 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) publicOnly := ctx.User == nil || !ctx.Org.Organization.IsOrgMember(ctx.User.ID)
listMembers(ctx, publicOnly) listMembers(ctx, publicOnly)
} }
// ListPublicMembers list an organization's public members // ListPublicMembers list an organization's public members
func ListPublicMembers(ctx *context.APIContext) { 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) listMembers(ctx, true)
} }
// IsMember check if a user is a member of an organization // IsMember check if a user is a member of an organization
func IsMember(ctx *context.APIContext) { 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) userToCheck := user.GetUserByParams(ctx)
if ctx.Written() { if ctx.Written() {
return return
@ -85,6 +113,15 @@ func IsMember(ctx *context.APIContext) {
// IsPublicMember check if a user is a public member of an organization // IsPublicMember check if a user is a public member of an organization
func IsPublicMember(ctx *context.APIContext) { 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) userToCheck := user.GetUserByParams(ctx)
if ctx.Written() { if ctx.Written() {
return return
@ -98,6 +135,16 @@ func IsPublicMember(ctx *context.APIContext) {
// PublicizeMember make a member's membership public // PublicizeMember make a member's membership public
func PublicizeMember(ctx *context.APIContext) { 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) userToPublicize := user.GetUserByParams(ctx)
if ctx.Written() { if ctx.Written() {
return return
@ -116,6 +163,16 @@ func PublicizeMember(ctx *context.APIContext) {
// ConcealMember make a member's membership not public // ConcealMember make a member's membership not public
func ConcealMember(ctx *context.APIContext) { 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) userToConceal := user.GetUserByParams(ctx)
if ctx.Written() { if ctx.Written() {
return return
@ -134,6 +191,15 @@ func ConcealMember(ctx *context.APIContext) {
// DeleteMember remove a member from an organization // DeleteMember remove a member from an organization
func DeleteMember(ctx *context.APIContext) { 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) member := user.GetUserByParams(ctx)
if ctx.Written() { if ctx.Written() {
return return

View file

@ -14,7 +14,7 @@ import (
// ListForks list a repository's forks // ListForks list a repository's forks
func ListForks(ctx *context.APIContext) { func ListForks(ctx *context.APIContext) {
// swagger:route GET /repos/{owner}/{repo}/forks listForks // swagger:route GET /repos/{owner}/{repo}/forks repository listForks
// //
// Produces: // Produces:
// - application/json // - application/json
@ -42,7 +42,7 @@ func ListForks(ctx *context.APIContext) {
// CreateFork create a fork of a repo // CreateFork create a fork of a repo
func CreateFork(ctx *context.APIContext, form api.CreateForkOption) { 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: // Produces:
// - application/json // - application/json

View file

@ -15,13 +15,13 @@ import (
// ListHooks list all hooks of a repository // ListHooks list all hooks of a repository
func ListHooks(ctx *context.APIContext) { func ListHooks(ctx *context.APIContext) {
// swagger:route GET /repos/{username}/{reponame}/hooks // swagger:route GET /repos/{username}/{reponame}/hooks repository repoListHooks
// //
// Produces: // Produces:
// - application/json // - application/json
// //
// Responses: // Responses:
// 200: apiHooks // 200: HookList
// 500: error // 500: error
hooks, err := models.GetWebhooksByRepoID(ctx.Repo.Repository.ID) hooks, err := models.GetWebhooksByRepoID(ctx.Repo.Repository.ID)
@ -50,7 +50,7 @@ func GetHook(ctx *context.APIContext) {
// CreateHook create a hook for a repository // CreateHook create a hook for a repository
func CreateHook(ctx *context.APIContext, form api.CreateHookOption) { 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: // Consumes:
// - application/json // - application/json
@ -59,7 +59,7 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
// - application/json // - application/json
// //
// Responses: // Responses:
// 200: apiHook // 200: Hook
// 422: validationError // 422: validationError
// 500: error // 500: error
@ -71,13 +71,13 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
// EditHook modify a hook of a repository // EditHook modify a hook of a repository
func EditHook(ctx *context.APIContext, form api.EditHookOption) { 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: // Produces:
// - application/json // - application/json
// //
// Responses: // Responses:
// 200: apiHook //TODO // 200: Hook
// 422: validationError // 422: validationError
// 500: error // 500: error
@ -87,7 +87,7 @@ func EditHook(ctx *context.APIContext, form api.EditHookOption) {
// DeleteHook delete a hook of a repository // DeleteHook delete a hook of a repository
func DeleteHook(ctx *context.APIContext) { func DeleteHook(ctx *context.APIContext) {
// swagger:route DELETE /repos/{username}/{reponame}/hooks/{id} // swagger:route DELETE /repos/{username}/{reponame}/hooks/{id} repository repoDeleteHook
// //
// Produces: // Produces:
// - application/json // - application/json

View file

@ -20,7 +20,7 @@ import (
// Search repositories via options // Search repositories via options
func Search(ctx *context.APIContext) { func Search(ctx *context.APIContext) {
// swagger:route GET /repos/search repoSearch // swagger:route GET /repos/search repository repoSearch
// //
// Produces: // Produces:
// - application/json // - application/json
@ -130,8 +130,21 @@ func CreateUserRepo(ctx *context.APIContext, owner *models.User, opt api.CreateR
} }
// Create one repository of mine // Create one repository of mine
// see https://github.com/gogits/go-gogs-client/wiki/Repositories#create
func Create(ctx *context.APIContext, opt api.CreateRepoOption) { 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. // Shouldn't reach this condition, but just in case.
if ctx.User.IsOrganization() { if ctx.User.IsOrganization() {
ctx.Error(422, "", "not allowed creating repository for organization") 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 // CreateOrgRepo create one repository of the organization
func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) { func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) {
// swagger:route POST /org/{org}/repos createOrgRepo // swagger:route POST /org/{org}/repos organization createOrgRepo
// //
// Consumes: // Consumes:
// - application/json // - application/json
@ -175,7 +188,7 @@ func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) {
// Migrate migrate remote git repository to gitea // Migrate migrate remote git repository to gitea
func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) { func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
// swagger:route POST /repos/migrate // swagger:route POST /repos/migrate repository repoMigrate
// //
// Consumes: // Consumes:
// - application/json // - application/json
@ -260,7 +273,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
// Get one repository // Get one repository
func Get(ctx *context.APIContext) { func Get(ctx *context.APIContext) {
// swagger:route GET /repos/{username}/{reponame} // swagger:route GET /repos/{username}/{reponame} repository repoGet
// //
// Produces: // Produces:
// - application/json // - application/json
@ -274,7 +287,7 @@ func Get(ctx *context.APIContext) {
// GetByID returns a single Repository // GetByID returns a single Repository
func GetByID(ctx *context.APIContext) { func GetByID(ctx *context.APIContext) {
// swagger:route GET /repositories/{id} // swagger:route GET /repositories/{id} repository repoGetByID
// //
// Produces: // Produces:
// - application/json // - application/json
@ -306,7 +319,7 @@ func GetByID(ctx *context.APIContext) {
// Delete one repository // Delete one repository
func Delete(ctx *context.APIContext) { func Delete(ctx *context.APIContext) {
// swagger:route DELETE /repos/{username}/{reponame} // swagger:route DELETE /repos/{username}/{reponame} repository repoDelete
// //
// Produces: // Produces:
// - application/json // - application/json
@ -339,7 +352,7 @@ func Delete(ctx *context.APIContext) {
// MirrorSync adds a mirrored repository to the sync queue // MirrorSync adds a mirrored repository to the sync queue
func MirrorSync(ctx *context.APIContext) { 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: // Produces:
// - application/json // - application/json

View file

@ -13,7 +13,7 @@ import (
// ListAccessTokens list all the access tokens // ListAccessTokens list all the access tokens
func ListAccessTokens(ctx *context.APIContext) { func ListAccessTokens(ctx *context.APIContext) {
// swagger:route GET /users/{username}/tokens userGetTokens // swagger:route GET /users/{username}/tokens user userGetTokens
// //
// Produces: // Produces:
// - application/json // - application/json
@ -40,7 +40,7 @@ func ListAccessTokens(ctx *context.APIContext) {
// CreateAccessToken create access tokens // CreateAccessToken create access tokens
func CreateAccessToken(ctx *context.APIContext, form api.CreateAccessTokenOption) { func CreateAccessToken(ctx *context.APIContext, form api.CreateAccessTokenOption) {
// swagger:route POST /users/{username} /tokens userCreateToken // swagger:route POST /users/{username} /tokens user userCreateToken
// //
// Consumes: // Consumes:
// - application/json // - application/json

View file

@ -30,7 +30,7 @@ func listUserFollowers(ctx *context.APIContext, u *models.User) {
// ListMyFollowers list all my followers // ListMyFollowers list all my followers
func ListMyFollowers(ctx *context.APIContext) { func ListMyFollowers(ctx *context.APIContext) {
// swagger:route GET /user/followers userCurrentListFollowers // swagger:route GET /user/followers user userCurrentListFollowers
// //
// Produces: // Produces:
// - application/json // - application/json
@ -44,7 +44,7 @@ func ListMyFollowers(ctx *context.APIContext) {
// ListFollowers list user's followers // ListFollowers list user's followers
func ListFollowers(ctx *context.APIContext) { func ListFollowers(ctx *context.APIContext) {
// swagger:route GET /users/:username/followers userListFollowers // swagger:route GET /users/:username/followers user userListFollowers
// //
// Produces: // Produces:
// - application/json // - application/json
@ -71,7 +71,7 @@ func listUserFollowing(ctx *context.APIContext, u *models.User) {
// ListMyFollowing list all my followings // ListMyFollowing list all my followings
func ListMyFollowing(ctx *context.APIContext) { func ListMyFollowing(ctx *context.APIContext) {
// swagger:route GET /user/following userCurrentListFollowing // swagger:route GET /user/following user userCurrentListFollowing
// //
// Produces: // Produces:
// - application/json // - application/json
@ -85,7 +85,7 @@ func ListMyFollowing(ctx *context.APIContext) {
// ListFollowing list user's followings // ListFollowing list user's followings
func ListFollowing(ctx *context.APIContext) { func ListFollowing(ctx *context.APIContext) {
// swagger:route GET /users/{username}/following userListFollowing // swagger:route GET /users/{username}/following user userListFollowing
// //
// Produces: // Produces:
// - application/json // - 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 // CheckMyFollowing check if the repo is followed by me
func CheckMyFollowing(ctx *context.APIContext) { func CheckMyFollowing(ctx *context.APIContext) {
// swagger:route GET /user/following/{username} userCurrentCheckFollowing // swagger:route GET /user/following/{username} user userCurrentCheckFollowing
// //
// Responses: // Responses:
// 204: empty // 204: empty
@ -126,7 +126,7 @@ func CheckMyFollowing(ctx *context.APIContext) {
// CheckFollowing check if the repo is followed by user // CheckFollowing check if the repo is followed by user
func CheckFollowing(ctx *context.APIContext) { func CheckFollowing(ctx *context.APIContext) {
// swagger:route GET /users/{username}/following/:target userCheckFollowing // swagger:route GET /users/{username}/following/:target user userCheckFollowing
// //
// Responses: // Responses:
// 204: empty // 204: empty
@ -145,7 +145,7 @@ func CheckFollowing(ctx *context.APIContext) {
// Follow follow one repository // Follow follow one repository
func Follow(ctx *context.APIContext) { func Follow(ctx *context.APIContext) {
// swagger:route PUT /user/following/{username} userCurrentPutFollow // swagger:route PUT /user/following/{username} user userCurrentPutFollow
// //
// Responses: // Responses:
// 204: empty // 204: empty
@ -164,7 +164,7 @@ func Follow(ctx *context.APIContext) {
// Unfollow unfollow one repository // Unfollow unfollow one repository
func Unfollow(ctx *context.APIContext) { func Unfollow(ctx *context.APIContext) {
// swagger:route DELETE /user/following/{username} userCurrentDeleteFollow // swagger:route DELETE /user/following/{username} user userCurrentDeleteFollow
// //
// Responses: // Responses:
// 204: empty // 204: empty

View file

@ -34,7 +34,7 @@ func listGPGKeys(ctx *context.APIContext, uid int64) {
//ListGPGKeys get the GPG key list of a user //ListGPGKeys get the GPG key list of a user
func ListGPGKeys(ctx *context.APIContext) { func ListGPGKeys(ctx *context.APIContext) {
// swagger:route GET /users/{username}/gpg_keys userListGPGKeys // swagger:route GET /users/{username}/gpg_keys user userListGPGKeys
// //
// Produces: // Produces:
// - application/json // - application/json
@ -52,7 +52,7 @@ func ListGPGKeys(ctx *context.APIContext) {
//ListMyGPGKeys get the GPG key list of the logged user //ListMyGPGKeys get the GPG key list of the logged user
func ListMyGPGKeys(ctx *context.APIContext) { func ListMyGPGKeys(ctx *context.APIContext) {
// swagger:route GET /user/gpg_keys userCurrentListGPGKeys // swagger:route GET /user/gpg_keys user userCurrentListGPGKeys
// //
// Produces: // Produces:
// - application/json // - application/json
@ -66,7 +66,7 @@ func ListMyGPGKeys(ctx *context.APIContext) {
//GetGPGKey get the GPG key based on a id //GetGPGKey get the GPG key based on a id
func GetGPGKey(ctx *context.APIContext) { func GetGPGKey(ctx *context.APIContext) {
// swagger:route GET /user/gpg_keys/{id} userCurrentGetGPGKey // swagger:route GET /user/gpg_keys/{id} user userCurrentGetGPGKey
// //
// Produces: // Produces:
// - application/json // - application/json
@ -100,7 +100,7 @@ func CreateUserGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption, uid
//CreateGPGKey associate a GPG key to the current user //CreateGPGKey associate a GPG key to the current user
func CreateGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption) { func CreateGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption) {
// swagger:route POST /user/gpg_keys userCurrentPostGPGKey // swagger:route POST /user/gpg_keys user userCurrentPostGPGKey
// //
// Consumes: // Consumes:
// - application/json // - application/json
@ -118,7 +118,7 @@ func CreateGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption) {
//DeleteGPGKey remove a GPG key associated to the current user //DeleteGPGKey remove a GPG key associated to the current user
func DeleteGPGKey(ctx *context.APIContext) { func DeleteGPGKey(ctx *context.APIContext) {
// swagger:route DELETE /user/gpg_keys/{id} userCurrentDeleteGPGKey // swagger:route DELETE /user/gpg_keys/{id} user userCurrentDeleteGPGKey
// //
// Produces: // Produces:
// - application/json // - application/json

View file

@ -55,7 +55,7 @@ func listPublicKeys(ctx *context.APIContext, uid int64) {
// ListMyPublicKeys list all my public keys // ListMyPublicKeys list all my public keys
func ListMyPublicKeys(ctx *context.APIContext) { func ListMyPublicKeys(ctx *context.APIContext) {
// swagger:route GET /user/keys userCurrentListKeys // swagger:route GET /user/keys user userCurrentListKeys
// //
// Produces: // Produces:
// - application/json // - application/json
@ -69,7 +69,7 @@ func ListMyPublicKeys(ctx *context.APIContext) {
// ListPublicKeys list all user's public keys // ListPublicKeys list all user's public keys
func ListPublicKeys(ctx *context.APIContext) { func ListPublicKeys(ctx *context.APIContext) {
// swagger:route GET /users/{username}/keys userListKeys // swagger:route GET /users/{username}/keys user userListKeys
// //
// Produces: // Produces:
// - application/json // - application/json
@ -87,7 +87,7 @@ func ListPublicKeys(ctx *context.APIContext) {
// GetPublicKey get one public key // GetPublicKey get one public key
func GetPublicKey(ctx *context.APIContext) { func GetPublicKey(ctx *context.APIContext) {
// swagger:route GET /user/keys/{id} userCurrentGetKey // swagger:route GET /user/keys/{id} user userCurrentGetKey
// //
// Produces: // Produces:
// - application/json // - application/json
@ -130,7 +130,7 @@ func CreateUserPublicKey(ctx *context.APIContext, form api.CreateKeyOption, uid
// CreatePublicKey create one public key for me // CreatePublicKey create one public key for me
func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) { func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
// swagger:route POST /user/keys userCurrentPostKey // swagger:route POST /user/keys user userCurrentPostKey
// //
// Consumes: // Consumes:
// - application/json // - application/json
@ -148,7 +148,7 @@ func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
// DeletePublicKey delete one public key of mine // DeletePublicKey delete one public key of mine
func DeletePublicKey(ctx *context.APIContext) { func DeletePublicKey(ctx *context.APIContext) {
// swagger:route DELETE /user/keys/{id} userCurrentDeleteKey // swagger:route DELETE /user/keys/{id} user userCurrentDeleteKey
// //
// Produces: // Produces:
// - application/json // - application/json

View file

@ -36,7 +36,7 @@ func listUserRepos(ctx *context.APIContext, u *models.User) {
// ListUserRepos - list the repos owned by the given user. // ListUserRepos - list the repos owned by the given user.
func ListUserRepos(ctx *context.APIContext) { func ListUserRepos(ctx *context.APIContext) {
// swagger:route GET /users/{username}/repos userListRepos // swagger:route GET /users/{username}/repos user userListRepos
// //
// Produces: // Produces:
// - application/json // - application/json
@ -54,7 +54,7 @@ func ListUserRepos(ctx *context.APIContext) {
// ListMyRepos - list the repositories you own or have access to. // ListMyRepos - list the repositories you own or have access to.
func ListMyRepos(ctx *context.APIContext) { func ListMyRepos(ctx *context.APIContext) {
// swagger:route GET /user/repos userCurrentListRepos // swagger:route GET /user/repos user userCurrentListRepos
// //
// Produces: // Produces:
// - application/json // - application/json
@ -87,7 +87,7 @@ func ListMyRepos(ctx *context.APIContext) {
// ListOrgRepos - list the repositories of an organization. // ListOrgRepos - list the repositories of an organization.
func ListOrgRepos(ctx *context.APIContext) { func ListOrgRepos(ctx *context.APIContext) {
// swagger:route GET /orgs/{org}/repos orgListRepos // swagger:route GET /orgs/{orgname}/repos organization orgListRepos
// //
// Produces: // Produces:
// - application/json // - application/json

View file

@ -33,7 +33,7 @@ func getStarredRepos(userID int64, private bool) ([]*api.Repository, error) {
// GetStarredRepos returns the repos that the user specified by the APIContext // GetStarredRepos returns the repos that the user specified by the APIContext
// has starred // has starred
func GetStarredRepos(ctx *context.APIContext) { func GetStarredRepos(ctx *context.APIContext) {
// swagger:route GET /users/{username}/starred userListStarred // swagger:route GET /users/{username}/starred user userListStarred
// //
// Produces: // Produces:
// - application/json // - application/json
@ -53,7 +53,7 @@ func GetStarredRepos(ctx *context.APIContext) {
// GetMyStarredRepos returns the repos that the authenticated user has starred // GetMyStarredRepos returns the repos that the authenticated user has starred
func GetMyStarredRepos(ctx *context.APIContext) { func GetMyStarredRepos(ctx *context.APIContext) {
// swagger:route GET /user/starred userCurrentListStarred // swagger:route GET /user/starred user userCurrentListStarred
// //
// Produces: // Produces:
// - application/json // - application/json
@ -71,7 +71,7 @@ func GetMyStarredRepos(ctx *context.APIContext) {
// IsStarring returns whether the authenticated is starring the repo // IsStarring returns whether the authenticated is starring the repo
func IsStarring(ctx *context.APIContext) { func IsStarring(ctx *context.APIContext) {
// swagger:route GET /user/starred/{username}/{reponame} userCurrentCheckStarring // swagger:route GET /user/starred/{username}/{reponame} user userCurrentCheckStarring
// //
// Responses: // Responses:
// 204: empty // 204: empty
@ -86,7 +86,7 @@ func IsStarring(ctx *context.APIContext) {
// Star the repo specified in the APIContext, as the authenticated user // Star the repo specified in the APIContext, as the authenticated user
func Star(ctx *context.APIContext) { func Star(ctx *context.APIContext) {
// swagger:route PUT /user/starred/{username}/{reponame} userCurrentPutStar // swagger:route PUT /user/starred/{username}/{reponame} user userCurrentPutStar
// //
// Responses: // Responses:
// 204: empty // 204: empty
@ -102,7 +102,7 @@ func Star(ctx *context.APIContext) {
// Unstar the repo specified in the APIContext, as the authenticated user // Unstar the repo specified in the APIContext, as the authenticated user
func Unstar(ctx *context.APIContext) { func Unstar(ctx *context.APIContext) {
// swagger:route DELETE /user/starred/{username}/{reponame} userCurrentDeleteStar // swagger:route DELETE /user/starred/{username}/{reponame} user userCurrentDeleteStar
// //
// Responses: // Responses:
// 204: empty // 204: empty

View file

@ -17,7 +17,7 @@ import (
// Search search users // Search search users
func Search(ctx *context.APIContext) { func Search(ctx *context.APIContext) {
// swagger:route GET /users/search userSearch // swagger:route GET /users/search user userSearch
// //
// Produces: // Produces:
// - application/json // - application/json
@ -65,7 +65,7 @@ func Search(ctx *context.APIContext) {
// GetInfo get user's information // GetInfo get user's information
func GetInfo(ctx *context.APIContext) { func GetInfo(ctx *context.APIContext) {
// swagger:route GET /users/{username} userGet // swagger:route GET /users/{username} user userGet
// //
// Produces: // Produces:
// - application/json // - application/json
@ -94,7 +94,7 @@ func GetInfo(ctx *context.APIContext) {
// GetAuthenticatedUser get curent user's information // GetAuthenticatedUser get curent user's information
func GetAuthenticatedUser(ctx *context.APIContext) { func GetAuthenticatedUser(ctx *context.APIContext) {
// swagger:route GET /user userGetCurrent // swagger:route GET /user user userGetCurrent
// //
// Produces: // Produces:
// - application/json // - application/json

View file

@ -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 // GetWatchedRepos returns the repos that the user specified in ctx is watching
func GetWatchedRepos(ctx *context.APIContext) { func GetWatchedRepos(ctx *context.APIContext) {
// swagger:route GET /users/{username}/subscriptions userListSubscriptions // swagger:route GET /users/{username}/subscriptions user userListSubscriptions
// //
// Produces: // Produces:
// - application/json // - application/json
@ -53,7 +53,7 @@ func GetWatchedRepos(ctx *context.APIContext) {
// GetMyWatchedRepos returns the repos that the authenticated user is watching // GetMyWatchedRepos returns the repos that the authenticated user is watching
func GetMyWatchedRepos(ctx *context.APIContext) { func GetMyWatchedRepos(ctx *context.APIContext) {
// swagger:route GET /user/subscriptions userCurrentListSubscriptions // swagger:route GET /user/subscriptions user userCurrentListSubscriptions
// //
// Produces: // Produces:
// - application/json // - application/json
@ -72,7 +72,7 @@ func GetMyWatchedRepos(ctx *context.APIContext) {
// IsWatching returns whether the authenticated user is watching the repo // IsWatching returns whether the authenticated user is watching the repo
// specified in ctx // specified in ctx
func IsWatching(ctx *context.APIContext) { func IsWatching(ctx *context.APIContext) {
// swagger:route GET /repos/{username}/{reponame}/subscription userCurrentCheckSubscription // swagger:route GET /repos/{username}/{reponame}/subscription repository userCurrentCheckSubscription
// //
// Responses: // Responses:
// 200: WatchInfo // 200: WatchInfo
@ -94,7 +94,7 @@ func IsWatching(ctx *context.APIContext) {
// Watch the repo specified in ctx, as the authenticated user // Watch the repo specified in ctx, as the authenticated user
func Watch(ctx *context.APIContext) { func Watch(ctx *context.APIContext) {
// swagger:route PUT /repos/{username}/{reponame}/subscription userCurrentPutSubscription // swagger:route PUT /repos/{username}/{reponame}/subscription repository userCurrentPutSubscription
// //
// Responses: // Responses:
// 200: WatchInfo // 200: WatchInfo
@ -118,7 +118,7 @@ func Watch(ctx *context.APIContext) {
// Unwatch the repo specified in ctx, as the authenticated user // Unwatch the repo specified in ctx, as the authenticated user
func Unwatch(ctx *context.APIContext) { func Unwatch(ctx *context.APIContext) {
// swagger:route DELETE /repos/{username}/{reponame}/subscription userCurrentDeleteSubscription // swagger:route DELETE /repos/{username}/{reponame}/subscription repository userCurrentDeleteSubscription
// //
// Responses: // Responses:
// 204: empty // 204: empty

View file

@ -11,13 +11,21 @@ import (
) )
// CreateUserOption create user options // CreateUserOption create user options
// swagger:parameters adminCreateUser
type CreateUserOption struct { type CreateUserOption struct {
// in: body
SourceID int64 `json:"source_id"` SourceID int64 `json:"source_id"`
// in: body
LoginName string `json:"login_name"` LoginName string `json:"login_name"`
// in: body
Username string `json:"username" binding:"Required;AlphaDashDot;MaxSize(35)"` Username string `json:"username" binding:"Required;AlphaDashDot;MaxSize(35)"`
// in: body
FullName string `json:"full_name" binding:"MaxSize(100)"` FullName string `json:"full_name" binding:"MaxSize(100)"`
// in: body
Email string `json:"email" binding:"Required;Email;MaxSize(254)"` Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
// in: body
Password string `json:"password" binding:"MaxSize(255)"` Password string `json:"password" binding:"MaxSize(255)"`
// in: body
SendNotify bool `json:"send_notify"` SendNotify bool `json:"send_notify"`
} }
@ -32,18 +40,31 @@ func (c *Client) AdminCreateUser(opt CreateUserOption) (*User, error) {
} }
// EditUserOption edit user options // EditUserOption edit user options
// swagger:parameters adminEditUser
type EditUserOption struct { type EditUserOption struct {
// in: body
SourceID int64 `json:"source_id"` SourceID int64 `json:"source_id"`
// in: body
LoginName string `json:"login_name"` LoginName string `json:"login_name"`
// in: body
FullName string `json:"full_name" binding:"MaxSize(100)"` FullName string `json:"full_name" binding:"MaxSize(100)"`
// in: body
Email string `json:"email" binding:"Required;Email;MaxSize(254)"` Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
// in: body
Password string `json:"password" binding:"MaxSize(255)"` Password string `json:"password" binding:"MaxSize(255)"`
// in: body
Website string `json:"website" binding:"MaxSize(50)"` Website string `json:"website" binding:"MaxSize(50)"`
// in: body
Location string `json:"location" binding:"MaxSize(50)"` Location string `json:"location" binding:"MaxSize(50)"`
// in: body
Active *bool `json:"active"` Active *bool `json:"active"`
// in: body
Admin *bool `json:"admin"` Admin *bool `json:"admin"`
// in: body
AllowGitHook *bool `json:"allow_git_hook"` AllowGitHook *bool `json:"allow_git_hook"`
// in: body
AllowImportLocal *bool `json:"allow_import_local"` AllowImportLocal *bool `json:"allow_import_local"`
// in: body
MaxRepoCreation *int `json:"max_repo_creation"` MaxRepoCreation *int `json:"max_repo_creation"`
} }

View file

@ -20,7 +20,9 @@ func (c *Client) ListForks(user, repo string) ([]*Repository, error) {
} }
// CreateForkOption options for creating a fork // CreateForkOption options for creating a fork
// swagger:parameters createFork
type CreateForkOption struct { type CreateForkOption struct {
// in: body
Organization *string `json:"organization"` Organization *string `json:"organization"`
} }

View file

@ -20,6 +20,7 @@ var (
) )
// Hook a hook is a web hook when one repository changed // Hook a hook is a web hook when one repository changed
// swagger:response Hook
type Hook struct { type Hook struct {
ID int64 `json:"id"` ID int64 `json:"id"`
Type string `json:"type"` Type string `json:"type"`
@ -31,14 +32,18 @@ type Hook struct {
Created time.Time `json:"created_at"` 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 // 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) hooks := make([]*Hook, 0, 10)
return hooks, c.getParsedResponse("GET", fmt.Sprintf("/orgs/%s/hooks", org), nil, nil, &hooks) return hooks, c.getParsedResponse("GET", fmt.Sprintf("/orgs/%s/hooks", org), nil, nil, &hooks)
} }
// ListRepoHooks list all the hooks of one repository // 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) hooks := make([]*Hook, 0, 10)
return hooks, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/hooks", user, repo), nil, nil, &hooks) return hooks, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/hooks", user, repo), nil, nil, &hooks)
} }
@ -56,10 +61,15 @@ func (c *Client) GetRepoHook(user, repo string, id int64) (*Hook, error) {
} }
// CreateHookOption options when create a hook // CreateHookOption options when create a hook
// swagger:parameters orgCreateHook repoCreateHook
type CreateHookOption struct { type CreateHookOption struct {
// in: body
Type string `json:"type" binding:"Required"` Type string `json:"type" binding:"Required"`
// in: body
Config map[string]string `json:"config" binding:"Required"` Config map[string]string `json:"config" binding:"Required"`
// in: body
Events []string `json:"events"` Events []string `json:"events"`
// in: body
Active bool `json:"active"` Active bool `json:"active"`
} }
@ -84,9 +94,13 @@ func (c *Client) CreateRepoHook(user, repo string, opt CreateHookOption) (*Hook,
} }
// EditHookOption options when modify one hook // EditHookOption options when modify one hook
// swagger:parameters orgEditHook repoEditHook
type EditHookOption struct { type EditHookOption struct {
// in: body
Config map[string]string `json:"config"` Config map[string]string `json:"config"`
// in: body
Events []string `json:"events"` Events []string `json:"events"`
// in: body
Active *bool `json:"active"` Active *bool `json:"active"`
} }

69
vendor/code.gitea.io/sdk/gitea/issue_tracked_time.go generated vendored Normal file
View 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, &times)
}
// 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, &times)
}
// 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, &times)
}
// 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, &times)
}

View file

@ -11,6 +11,7 @@ import (
) )
// Organization a group of some repositories, users and teams // Organization a group of some repositories, users and teams
// swagger:response Organization
type Organization struct { type Organization struct {
ID int64 `json:"id"` ID int64 `json:"id"`
UserName string `json:"username"` UserName string `json:"username"`
@ -40,11 +41,17 @@ func (c *Client) GetOrg(orgname string) (*Organization, error) {
} }
// CreateOrgOption create one organization options // CreateOrgOption create one organization options
// swagger:parameters adminCreateOrg
type CreateOrgOption struct { type CreateOrgOption struct {
// in: body
UserName string `json:"username" binding:"Required"` UserName string `json:"username" binding:"Required"`
// in: body
FullName string `json:"full_name"` FullName string `json:"full_name"`
// in: body
Description string `json:"description"` Description string `json:"description"`
// in: body
Website string `json:"website"` Website string `json:"website"`
// in: body
Location string `json:"location"` Location string `json:"location"`
} }

View file

@ -69,7 +69,7 @@ func (c *Client) ListOrgRepos(org string) ([]*Repository, error) {
} }
// CreateRepoOption options when creating repository // CreateRepoOption options when creating repository
//swagger:parameters createOrgRepo //swagger:parameters createOrgRepo adminCreateRepo createCurrentUserRepo
type CreateRepoOption struct { type CreateRepoOption struct {
// Name of the repository to create // Name of the repository to create
// //
@ -135,14 +135,23 @@ func (c *Client) DeleteRepo(owner, repo string) error {
} }
// MigrateRepoOption options when migrate repository from an external place // MigrateRepoOption options when migrate repository from an external place
// swagger:parameters repoMigrate
type MigrateRepoOption struct { type MigrateRepoOption struct {
// in: body
CloneAddr string `json:"clone_addr" binding:"Required"` CloneAddr string `json:"clone_addr" binding:"Required"`
// in: body
AuthUsername string `json:"auth_username"` AuthUsername string `json:"auth_username"`
// in: body
AuthPassword string `json:"auth_password"` AuthPassword string `json:"auth_password"`
// in: body
UID int `json:"uid" binding:"Required"` UID int `json:"uid" binding:"Required"`
// in: body
RepoName string `json:"repo_name" binding:"Required"` RepoName string `json:"repo_name" binding:"Required"`
// in: body
Mirror bool `json:"mirror"` Mirror bool `json:"mirror"`
// in: body
Private bool `json:"private"` Private bool `json:"private"`
// in: body
Description string `json:"description"` Description string `json:"description"`
} }

View file

@ -34,7 +34,7 @@ func (c *Client) GetDeployKey(user, repo string, keyID int64) (*DeployKey, error
} }
// CreateKeyOption options when create deploy key // CreateKeyOption options when create deploy key
// swagger:parameters userCurrentPostKey // swagger:parameters userCurrentPostKey adminCreatePublicKey
type CreateKeyOption struct { type CreateKeyOption struct {
// Title of the key to add // Title of the key to add
// //

View file

@ -32,7 +32,7 @@ type GPGKey struct {
Expires time.Time `json:"expires_at,omitempty"` Expires time.Time `json:"expires_at,omitempty"`
} }
// GPGKeyEmail a email attache to a GPGKey // GPGKeyEmail an email attached to a GPGKey
// swagger:model GPGKeyEmail // swagger:model GPGKeyEmail
type GPGKeyEmail struct { type GPGKeyEmail struct {
Email string `json:"email"` Email string `json:"email"`

6
vendor/vendor.json vendored
View file

@ -9,10 +9,10 @@
"revisionTime": "2017-08-03T00:53:29Z" "revisionTime": "2017-08-03T00:53:29Z"
}, },
{ {
"checksumSHA1": "nLhT+bLMj8uLICP+EZbrdoQe6mM=", "checksumSHA1": "Zgp5RqU+20L2p9TNl1rSsUIWEEE=",
"path": "code.gitea.io/sdk/gitea", "path": "code.gitea.io/sdk/gitea",
"revision": "8cff72208aa458f4efa8fdfbad29b03aee485b8c", "revision": "bc243ad6c268d60658c71185452334b300c268cf",
"revisionTime": "2017-05-06T01:37:21Z" "revisionTime": "2017-08-21T08:23:17Z"
}, },
{ {
"checksumSHA1": "bOODD4Gbw3GfcuQPU2dI40crxxk=", "checksumSHA1": "bOODD4Gbw3GfcuQPU2dI40crxxk=",