Browse Source

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
Antoine GIRARD 3 years ago
parent
commit
fd8e8a421a

+ 4 - 0
modules/context/api.go

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

File diff suppressed because it is too large
+ 1482 - 39
public/swagger.v1.json


+ 14 - 1
routers/api/v1/admin/org.go

@@ -14,8 +14,21 @@ import (
14 14
 )
15 15
 
16 16
 // CreateOrg api for create organization
17
-// see https://github.com/gogits/go-gogs-client/wiki/Administration-Organizations#create-a-new-organization
18 17
 func CreateOrg(ctx *context.APIContext, form api.CreateOrgOption) {
18
+	// swagger:route POST /admin/users/{username}/orgs admin adminCreateOrg
19
+	//
20
+	//     Consumes:
21
+	//     - application/json
22
+	//
23
+	//     Produces:
24
+	//     - application/json
25
+	//
26
+	//     Responses:
27
+	//       201: Organization
28
+	//       403: forbidden
29
+	//       422: validationError
30
+	//       500: error
31
+
19 32
 	u := user.GetUserByParams(ctx)
20 33
 	if ctx.Written() {
21 34
 		return

+ 14 - 1
routers/api/v1/admin/repo.go

@@ -13,8 +13,21 @@ import (
13 13
 )
14 14
 
15 15
 // CreateRepo api for creating a repository
16
-// see https://github.com/gogits/go-gogs-client/wiki/Administration-Repositories#create-a-new-repository
17 16
 func CreateRepo(ctx *context.APIContext, form api.CreateRepoOption) {
17
+	// swagger:route POST /admin/users/{username}/repos admin adminCreateRepo
18
+	//
19
+	//     Consumes:
20
+	//     - application/json
21
+	//
22
+	//     Produces:
23
+	//     - application/json
24
+	//
25
+	//     Responses:
26
+	//       201: Repository
27
+	//       403: forbidden
28
+	//       422: validationError
29
+	//       500: error
30
+
18 31
 	owner := user.GetUserByParams(ctx)
19 32
 	if ctx.Written() {
20 33
 		return

+ 53 - 4
routers/api/v1/admin/user.go

@@ -35,8 +35,21 @@ func parseLoginSource(ctx *context.APIContext, u *models.User, sourceID int64, l
35 35
 }
36 36
 
37 37
 // CreateUser api for creating a user
38
-// see https://github.com/gogits/go-gogs-client/wiki/Administration-Users#create-a-new-user
39 38
 func CreateUser(ctx *context.APIContext, form api.CreateUserOption) {
39
+	// swagger:route POST /admin/users admin adminCreateUser
40
+	//
41
+	//     Consumes:
42
+	//     - application/json
43
+	//
44
+	//     Produces:
45
+	//     - application/json
46
+	//
47
+	//     Responses:
48
+	//       201: User
49
+	//       403: forbidden
50
+	//       422: validationError
51
+	//       500: error
52
+
40 53
 	u := &models.User{
41 54
 		Name:      form.Username,
42 55
 		FullName:  form.FullName,
@@ -73,8 +86,21 @@ func CreateUser(ctx *context.APIContext, form api.CreateUserOption) {
73 86
 }
74 87
 
75 88
 // EditUser api for modifying a user's information
76
-// see https://github.com/gogits/go-gogs-client/wiki/Administration-Users#edit-an-existing-user
77 89
 func EditUser(ctx *context.APIContext, form api.EditUserOption) {
90
+	// swagger:route PATCH /admin/users/{username} admin adminEditUser
91
+	//
92
+	//     Consumes:
93
+	//     - application/json
94
+	//
95
+	//     Produces:
96
+	//     - application/json
97
+	//
98
+	//     Responses:
99
+	//       200: User
100
+	//       403: forbidden
101
+	//       422: validationError
102
+	//       500: error
103
+
78 104
 	u := user.GetUserByParams(ctx)
79 105
 	if ctx.Written() {
80 106
 		return
@@ -130,8 +156,18 @@ func EditUser(ctx *context.APIContext, form api.EditUserOption) {
130 156
 }
131 157
 
132 158
 // DeleteUser api for deleting a user
133
-// https://github.com/gogits/go-gogs-client/wiki/Administration-Users#delete-a-user
134 159
 func DeleteUser(ctx *context.APIContext) {
160
+	// swagger:route DELETE /admin/users/{username} admin adminDeleteUser
161
+	//
162
+	//     Produces:
163
+	//     - application/json
164
+	//
165
+	//     Responses:
166
+	//       204: empty
167
+	//       403: forbidden
168
+	//       422: validationError
169
+	//       500: error
170
+
135 171
 	u := user.GetUserByParams(ctx)
136 172
 	if ctx.Written() {
137 173
 		return
@@ -152,8 +188,21 @@ func DeleteUser(ctx *context.APIContext) {
152 188
 }
153 189
 
154 190
 // CreatePublicKey api for creating a public key to a user
155
-// see https://github.com/gogits/go-gogs-client/wiki/Administration-Users#create-a-public-key-for-user
156 191
 func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
192
+	// swagger:route POST /admin/users/{username}/keys admin adminCreatePublicKey
193
+	//
194
+	//     Consumes:
195
+	//     - application/json
196
+	//
197
+	//     Produces:
198
+	//     - application/json
199
+	//
200
+	//     Responses:
201
+	//       201: PublicKey
202
+	//       403: forbidden
203
+	//       422: validationError
204
+	//       500: error
205
+
157 206
 	u := user.GetUserByParams(ctx)
158 207
 	if ctx.Written() {
159 208
 		return

+ 22 - 0
routers/api/v1/api.go

@@ -23,6 +23,28 @@
23 23
 //     - application/json
24 24
 //     - text/html
25 25
 //
26
+//     Security:
27
+//     - BasicAuth: []
28
+//     - Token: []
29
+//     - AccessToken: []
30
+//     - AuthorizationHeaderToken: []
31
+//
32
+//     SecurityDefinitions:
33
+//     BasicAuth:
34
+//          type: basic
35
+//     Token:
36
+//          type: apiKey
37
+//          name: token
38
+//          in: query
39
+//     AccessToken:
40
+//          type: apiKey
41
+//          name: access_token
42
+//          in: query
43
+//     AuthorizationHeaderToken:
44
+//          type: apiKey
45
+//          name: Authorization
46
+//          in: header
47
+//
26 48
 // swagger:meta
27 49
 package v1
28 50
 

+ 2 - 2
routers/api/v1/misc/markdown.go

@@ -14,7 +14,7 @@ import (
14 14
 
15 15
 // Markdown render markdown document to HTML
16 16
 func Markdown(ctx *context.APIContext, form api.MarkdownOption) {
17
-	// swagger:route POST /markdown renderMarkdown
17
+	// swagger:route POST /markdown miscellaneous renderMarkdown
18 18
 	//
19 19
 	//     Consumes:
20 20
 	//     - application/json
@@ -52,7 +52,7 @@ func Markdown(ctx *context.APIContext, form api.MarkdownOption) {
52 52
 
53 53
 // MarkdownRaw render raw markdown HTML
54 54
 func MarkdownRaw(ctx *context.APIContext) {
55
-	// swagger:route POST /markdown/raw renderMarkdownRaw
55
+	// swagger:route POST /markdown/raw miscellaneous renderMarkdownRaw
56 56
 	//
57 57
 	//     Consumes:
58 58
 	//     - text/plain

+ 1 - 1
routers/api/v1/misc/version.go

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

+ 56 - 0
routers/api/v1/org/hook.go

@@ -15,6 +15,15 @@ import (
15 15
 
16 16
 // ListHooks list an organziation's webhooks
17 17
 func ListHooks(ctx *context.APIContext) {
18
+	// swagger:route GET /orgs/{orgname}/hooks organization orgListHooks
19
+	//
20
+	//     Produces:
21
+	//     - application/json
22
+	//
23
+	//     Responses:
24
+	//       200: HookList
25
+	//       500: error
26
+
18 27
 	org := ctx.Org.Organization
19 28
 	orgHooks, err := models.GetWebhooksByOrgID(org.ID)
20 29
 	if err != nil {
@@ -30,6 +39,16 @@ func ListHooks(ctx *context.APIContext) {
30 39
 
31 40
 // GetHook get an organization's hook by id
32 41
 func GetHook(ctx *context.APIContext) {
42
+	// swagger:route GET /orgs/{orgname}/hooks/{id} organization orgGetHook
43
+	//
44
+	//     Produces:
45
+	//     - application/json
46
+	//
47
+	//     Responses:
48
+	//       200: Hook
49
+	//       404: notFound
50
+	//       500: error
51
+
33 52
 	org := ctx.Org.Organization
34 53
 	hookID := ctx.ParamsInt64(":id")
35 54
 	hook, err := utils.GetOrgHook(ctx, org.ID, hookID)
@@ -41,6 +60,19 @@ func GetHook(ctx *context.APIContext) {
41 60
 
42 61
 // CreateHook create a hook for an organization
43 62
 func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
63
+	// swagger:route POST /orgs/{orgname}/hooks/ organization orgCreateHook
64
+	//
65
+	//     Consumes:
66
+	//     - application/json
67
+	//
68
+	//     Produces:
69
+	//     - application/json
70
+	//
71
+	//     Responses:
72
+	//       201: Hook
73
+	//       422: validationError
74
+	//       500: error
75
+
44 76
 	if !utils.CheckCreateHookOption(ctx, &form) {
45 77
 		return
46 78
 	}
@@ -49,12 +81,36 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
49 81
 
50 82
 // EditHook modify a hook of a repository
51 83
 func EditHook(ctx *context.APIContext, form api.EditHookOption) {
84
+	// swagger:route PATCH /orgs/{orgname}/hooks/{id} organization orgEditHook
85
+	//
86
+	//     Consumes:
87
+	//     - application/json
88
+	//
89
+	//     Produces:
90
+	//     - application/json
91
+	//
92
+	//     Responses:
93
+	//       200: Hook
94
+	//       422: validationError
95
+	//       404: notFound
96
+	//       500: error
97
+
52 98
 	hookID := ctx.ParamsInt64(":id")
53 99
 	utils.EditOrgHook(ctx, &form, hookID)
54 100
 }
55 101
 
56 102
 // DeleteHook delete a hook of an organization
57 103
 func DeleteHook(ctx *context.APIContext) {
104
+	// swagger:route DELETE /orgs/{orgname}/hooks/{id} organization orgDeleteHook
105
+	//
106
+	//     Produces:
107
+	//     - application/json
108
+	//
109
+	//     Responses:
110
+	//       204: empty
111
+	//       404: notFound
112
+	//       500: error
113
+
58 114
 	org := ctx.Org.Organization
59 115
 	hookID := ctx.ParamsInt64(":id")
60 116
 	if err := models.DeleteWebhookByOrgID(org.ID, hookID); err != nil {

+ 66 - 0
routers/api/v1/org/member.go

@@ -53,17 +53,45 @@ func listMembers(ctx *context.APIContext, publicOnly bool) {
53 53
 
54 54
 // ListMembers list an organization's members
55 55
 func ListMembers(ctx *context.APIContext) {
56
+	// swagger:route GET /orgs/{orgname}/members organization orgListMembers
57
+	//
58
+	//     Produces:
59
+	//     - application/json
60
+	//
61
+	//     Responses:
62
+	//       200: UserList
63
+	//       500: error
64
+
56 65
 	publicOnly := ctx.User == nil || !ctx.Org.Organization.IsOrgMember(ctx.User.ID)
57 66
 	listMembers(ctx, publicOnly)
58 67
 }
59 68
 
60 69
 // ListPublicMembers list an organization's public members
61 70
 func ListPublicMembers(ctx *context.APIContext) {
71
+	// swagger:route GET /orgs/{orgname}/public_members organization orgListPublicMembers
72
+	//
73
+	//     Produces:
74
+	//     - application/json
75
+	//
76
+	//     Responses:
77
+	//       200: UserList
78
+	//       500: error
79
+
62 80
 	listMembers(ctx, true)
63 81
 }
64 82
 
65 83
 // IsMember check if a user is a member of an organization
66 84
 func IsMember(ctx *context.APIContext) {
85
+	// swagger:route GET /orgs/{orgname}/members/{username} organization orgIsMember
86
+	//
87
+	//     Produces:
88
+	//     - application/json
89
+	//
90
+	//     Responses:
91
+	//       204: empty
92
+	//       302: redirect
93
+	//       404: notFound
94
+
67 95
 	userToCheck := user.GetUserByParams(ctx)
68 96
 	if ctx.Written() {
69 97
 		return
@@ -85,6 +113,15 @@ func IsMember(ctx *context.APIContext) {
85 113
 
86 114
 // IsPublicMember check if a user is a public member of an organization
87 115
 func IsPublicMember(ctx *context.APIContext) {
116
+	// swagger:route GET /orgs/{orgname}/public_members/{username} organization orgIsPublicMember
117
+	//
118
+	//     Produces:
119
+	//     - application/json
120
+	//
121
+	//     Responses:
122
+	//       204: empty
123
+	//       404: notFound
124
+
88 125
 	userToCheck := user.GetUserByParams(ctx)
89 126
 	if ctx.Written() {
90 127
 		return
@@ -98,6 +135,16 @@ func IsPublicMember(ctx *context.APIContext) {
98 135
 
99 136
 // PublicizeMember make a member's membership public
100 137
 func PublicizeMember(ctx *context.APIContext) {
138
+	// swagger:route PUT /orgs/{orgname}/public_members/{username} organization orgPublicizeMember
139
+	//
140
+	//     Produces:
141
+	//     - application/json
142
+	//
143
+	//     Responses:
144
+	//       204: empty
145
+	//       403: forbidden
146
+	//       500: error
147
+
101 148
 	userToPublicize := user.GetUserByParams(ctx)
102 149
 	if ctx.Written() {
103 150
 		return
@@ -116,6 +163,16 @@ func PublicizeMember(ctx *context.APIContext) {
116 163
 
117 164
 // ConcealMember make a member's membership not public
118 165
 func ConcealMember(ctx *context.APIContext) {
166
+	// swagger:route DELETE /orgs/{orgname}/public_members/{username} organization orgConcealMember
167
+	//
168
+	//     Produces:
169
+	//     - application/json
170
+	//
171
+	//     Responses:
172
+	//       204: empty
173
+	//       403: forbidden
174
+	//       500: error
175
+
119 176
 	userToConceal := user.GetUserByParams(ctx)
120 177
 	if ctx.Written() {
121 178
 		return
@@ -134,6 +191,15 @@ func ConcealMember(ctx *context.APIContext) {
134 191
 
135 192
 // DeleteMember remove a member from an organization
136 193
 func DeleteMember(ctx *context.APIContext) {
194
+	// swagger:route DELETE /orgs/{orgname}/members/{username} organization orgDeleteMember
195
+	//
196
+	//     Produces:
197
+	//     - application/json
198
+	//
199
+	//     Responses:
200
+	//       204: empty
201
+	//       500: error
202
+
137 203
 	member := user.GetUserByParams(ctx)
138 204
 	if ctx.Written() {
139 205
 		return

+ 2 - 2
routers/api/v1/repo/fork.go

@@ -14,7 +14,7 @@ import (
14 14
 
15 15
 // ListForks list a repository's forks
16 16
 func ListForks(ctx *context.APIContext) {
17
-	// swagger:route GET /repos/{owner}/{repo}/forks listForks
17
+	// swagger:route GET /repos/{owner}/{repo}/forks repository listForks
18 18
 	//
19 19
 	//     Produces:
20 20
 	//     - application/json
@@ -42,7 +42,7 @@ func ListForks(ctx *context.APIContext) {
42 42
 
43 43
 // CreateFork create a fork of a repo
44 44
 func CreateFork(ctx *context.APIContext, form api.CreateForkOption) {
45
-	// swagger:route POST /repos/{owner}/{repo}/forks createFork
45
+	// swagger:route POST /repos/{owner}/{repo}/forks repository createFork
46 46
 	//
47 47
 	//     Produces:
48 48
 	//     - application/json

+ 7 - 7
routers/api/v1/repo/hook.go

@@ -15,13 +15,13 @@ import (
15 15
 
16 16
 // ListHooks list all hooks of a repository
17 17
 func ListHooks(ctx *context.APIContext) {
18
-	// swagger:route GET /repos/{username}/{reponame}/hooks
18
+	// swagger:route GET /repos/{username}/{reponame}/hooks repository repoListHooks
19 19
 	//
20 20
 	//     Produces:
21 21
 	//     - application/json
22 22
 	//
23 23
 	//     Responses:
24
-	//       200: apiHooks
24
+	//       200: HookList
25 25
 	//       500: error
26 26
 
27 27
 	hooks, err := models.GetWebhooksByRepoID(ctx.Repo.Repository.ID)
@@ -50,7 +50,7 @@ func GetHook(ctx *context.APIContext) {
50 50
 
51 51
 // CreateHook create a hook for a repository
52 52
 func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
53
-	// swagger:route POST /repos/{username}/{reponame}/hooks
53
+	// swagger:route POST /repos/{username}/{reponame}/hooks repository repoCreateHook
54 54
 	//
55 55
 	//     Consumes:
56 56
 	//     - application/json
@@ -59,7 +59,7 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
59 59
 	//     - application/json
60 60
 	//
61 61
 	//     Responses:
62
-	//       200: apiHook
62
+	//       200: Hook
63 63
 	//       422: validationError
64 64
 	//       500: error
65 65
 
@@ -71,13 +71,13 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
71 71
 
72 72
 // EditHook modify a hook of a repository
73 73
 func EditHook(ctx *context.APIContext, form api.EditHookOption) {
74
-	// swagger:route PATCH /repos/{username}/{reponame}/hooks/{id}
74
+	// swagger:route PATCH /repos/{username}/{reponame}/hooks/{id} repository repoEditHook
75 75
 	//
76 76
 	//     Produces:
77 77
 	//     - application/json
78 78
 	//
79 79
 	//     Responses:
80
-	//       200: apiHook //TODO
80
+	//       200: Hook
81 81
 	//       422: validationError
82 82
 	//       500: error
83 83
 
@@ -87,7 +87,7 @@ func EditHook(ctx *context.APIContext, form api.EditHookOption) {
87 87
 
88 88
 // DeleteHook delete a hook of a repository
89 89
 func DeleteHook(ctx *context.APIContext) {
90
-	// swagger:route DELETE /repos/{username}/{reponame}/hooks/{id}
90
+	// swagger:route DELETE /repos/{username}/{reponame}/hooks/{id} repository repoDeleteHook
91 91
 	//
92 92
 	//     Produces:
93 93
 	//     - application/json

+ 21 - 8
routers/api/v1/repo/repo.go

@@ -20,7 +20,7 @@ import (
20 20
 
21 21
 // Search repositories via options
22 22
 func Search(ctx *context.APIContext) {
23
-	// swagger:route GET /repos/search repoSearch
23
+	// swagger:route GET /repos/search repository repoSearch
24 24
 	//
25 25
 	//     Produces:
26 26
 	//     - application/json
@@ -130,8 +130,21 @@ func CreateUserRepo(ctx *context.APIContext, owner *models.User, opt api.CreateR
130 130
 }
131 131
 
132 132
 // Create one repository of mine
133
-// see https://github.com/gogits/go-gogs-client/wiki/Repositories#create
134 133
 func Create(ctx *context.APIContext, opt api.CreateRepoOption) {
134
+	// swagger:route POST /user/repos repository user createCurrentUserRepo
135
+	//
136
+	//     Consumes:
137
+	//     - application/json
138
+	//
139
+	//     Produces:
140
+	//     - application/json
141
+	//
142
+	//     Responses:
143
+	//       201: Repository
144
+	//       403: forbidden
145
+	//       422: validationError
146
+	//       500: error
147
+
135 148
 	// Shouldn't reach this condition, but just in case.
136 149
 	if ctx.User.IsOrganization() {
137 150
 		ctx.Error(422, "", "not allowed creating repository for organization")
@@ -142,7 +155,7 @@ func Create(ctx *context.APIContext, opt api.CreateRepoOption) {
142 155
 
143 156
 // CreateOrgRepo create one repository of the organization
144 157
 func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) {
145
-	// swagger:route POST /org/{org}/repos createOrgRepo
158
+	// swagger:route POST /org/{org}/repos organization createOrgRepo
146 159
 	//
147 160
 	//     Consumes:
148 161
 	//     - application/json
@@ -175,7 +188,7 @@ func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) {
175 188
 
176 189
 // Migrate migrate remote git repository to gitea
177 190
 func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
178
-	// swagger:route POST /repos/migrate
191
+	// swagger:route POST /repos/migrate repository repoMigrate
179 192
 	//
180 193
 	//     Consumes:
181 194
 	//     - application/json
@@ -260,7 +273,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
260 273
 
261 274
 // Get one repository
262 275
 func Get(ctx *context.APIContext) {
263
-	// swagger:route GET /repos/{username}/{reponame}
276
+	// swagger:route GET /repos/{username}/{reponame} repository repoGet
264 277
 	//
265 278
 	//     Produces:
266 279
 	//     - application/json
@@ -274,7 +287,7 @@ func Get(ctx *context.APIContext) {
274 287
 
275 288
 // GetByID returns a single Repository
276 289
 func GetByID(ctx *context.APIContext) {
277
-	// swagger:route GET /repositories/{id}
290
+	// swagger:route GET /repositories/{id} repository repoGetByID
278 291
 	//
279 292
 	//     Produces:
280 293
 	//     - application/json
@@ -306,7 +319,7 @@ func GetByID(ctx *context.APIContext) {
306 319
 
307 320
 // Delete one repository
308 321
 func Delete(ctx *context.APIContext) {
309
-	// swagger:route DELETE /repos/{username}/{reponame}
322
+	// swagger:route DELETE /repos/{username}/{reponame} repository repoDelete
310 323
 	//
311 324
 	//     Produces:
312 325
 	//     - application/json
@@ -339,7 +352,7 @@ func Delete(ctx *context.APIContext) {
339 352
 
340 353
 // MirrorSync adds a mirrored repository to the sync queue
341 354
 func MirrorSync(ctx *context.APIContext) {
342
-	// swagger:route POST /repos/{username}/{reponame}/mirror-sync repoMirrorSync
355
+	// swagger:route POST /repos/{username}/{reponame}/mirror-sync repository repoMirrorSync
343 356
 	//
344 357
 	//     Produces:
345 358
 	//     - application/json

+ 2 - 2
routers/api/v1/user/app.go

@@ -13,7 +13,7 @@ import (
13 13
 
14 14
 // ListAccessTokens list all the access tokens
15 15
 func ListAccessTokens(ctx *context.APIContext) {
16
-	// swagger:route GET /users/{username}/tokens userGetTokens
16
+	// swagger:route GET /users/{username}/tokens user userGetTokens
17 17
 	//
18 18
 	//     Produces:
19 19
 	//     - application/json
@@ -40,7 +40,7 @@ func ListAccessTokens(ctx *context.APIContext) {
40 40
 
41 41
 // CreateAccessToken create access tokens
42 42
 func CreateAccessToken(ctx *context.APIContext, form api.CreateAccessTokenOption) {
43
-	// swagger:route POST /users/{username} /tokens userCreateToken
43
+	// swagger:route POST /users/{username} /tokens user userCreateToken
44 44
 	//
45 45
 	//     Consumes:
46 46
 	//     - application/json

+ 8 - 8
routers/api/v1/user/follower.go

@@ -30,7 +30,7 @@ func listUserFollowers(ctx *context.APIContext, u *models.User) {
30 30
 
31 31
 // ListMyFollowers list all my followers
32 32
 func ListMyFollowers(ctx *context.APIContext) {
33
-	// swagger:route GET /user/followers userCurrentListFollowers
33
+	// swagger:route GET /user/followers user userCurrentListFollowers
34 34
 	//
35 35
 	//     Produces:
36 36
 	//     - application/json
@@ -44,7 +44,7 @@ func ListMyFollowers(ctx *context.APIContext) {
44 44
 
45 45
 // ListFollowers list user's followers
46 46
 func ListFollowers(ctx *context.APIContext) {
47
-	// swagger:route GET /users/:username/followers userListFollowers
47
+	// swagger:route GET /users/:username/followers user userListFollowers
48 48
 	//
49 49
 	//     Produces:
50 50
 	//     - application/json
@@ -71,7 +71,7 @@ func listUserFollowing(ctx *context.APIContext, u *models.User) {
71 71
 
72 72
 // ListMyFollowing list all my followings
73 73
 func ListMyFollowing(ctx *context.APIContext) {
74
-	// swagger:route GET /user/following userCurrentListFollowing
74
+	// swagger:route GET /user/following user userCurrentListFollowing
75 75
 	//
76 76
 	//     Produces:
77 77
 	//     - application/json
@@ -85,7 +85,7 @@ func ListMyFollowing(ctx *context.APIContext) {
85 85
 
86 86
 // ListFollowing list user's followings
87 87
 func ListFollowing(ctx *context.APIContext) {
88
-	// swagger:route GET /users/{username}/following userListFollowing
88
+	// swagger:route GET /users/{username}/following user userListFollowing
89 89
 	//
90 90
 	//     Produces:
91 91
 	//     - application/json
@@ -111,7 +111,7 @@ func checkUserFollowing(ctx *context.APIContext, u *models.User, followID int64)
111 111
 
112 112
 // CheckMyFollowing check if the repo is followed by me
113 113
 func CheckMyFollowing(ctx *context.APIContext) {
114
-	// swagger:route GET /user/following/{username} userCurrentCheckFollowing
114
+	// swagger:route GET /user/following/{username} user userCurrentCheckFollowing
115 115
 	//
116 116
 	//     Responses:
117 117
 	//       204: empty
@@ -126,7 +126,7 @@ func CheckMyFollowing(ctx *context.APIContext) {
126 126
 
127 127
 // CheckFollowing check if the repo is followed by user
128 128
 func CheckFollowing(ctx *context.APIContext) {
129
-	// swagger:route GET /users/{username}/following/:target userCheckFollowing
129
+	// swagger:route GET /users/{username}/following/:target user userCheckFollowing
130 130
 	//
131 131
 	//     Responses:
132 132
 	//       204: empty
@@ -145,7 +145,7 @@ func CheckFollowing(ctx *context.APIContext) {
145 145
 
146 146
 // Follow follow one repository
147 147
 func Follow(ctx *context.APIContext) {
148
-	// swagger:route PUT /user/following/{username} userCurrentPutFollow
148
+	// swagger:route PUT /user/following/{username} user userCurrentPutFollow
149 149
 	//
150 150
 	//     Responses:
151 151
 	//       204: empty
@@ -164,7 +164,7 @@ func Follow(ctx *context.APIContext) {
164 164
 
165 165
 // Unfollow unfollow one repository
166 166
 func Unfollow(ctx *context.APIContext) {
167
-	// swagger:route DELETE /user/following/{username} userCurrentDeleteFollow
167
+	// swagger:route DELETE /user/following/{username} user userCurrentDeleteFollow
168 168
 	//
169 169
 	//     Responses:
170 170
 	//       204: empty

+ 5 - 5
routers/api/v1/user/gpg_key.go

@@ -34,7 +34,7 @@ func listGPGKeys(ctx *context.APIContext, uid int64) {
34 34
 
35 35
 //ListGPGKeys get the GPG key list of a user
36 36
 func ListGPGKeys(ctx *context.APIContext) {
37
-	// swagger:route GET /users/{username}/gpg_keys userListGPGKeys
37
+	// swagger:route GET /users/{username}/gpg_keys user userListGPGKeys
38 38
 	//
39 39
 	//     Produces:
40 40
 	//     - application/json
@@ -52,7 +52,7 @@ func ListGPGKeys(ctx *context.APIContext) {
52 52
 
53 53
 //ListMyGPGKeys get the GPG key list of the logged user
54 54
 func ListMyGPGKeys(ctx *context.APIContext) {
55
-	// swagger:route GET /user/gpg_keys userCurrentListGPGKeys
55
+	// swagger:route GET /user/gpg_keys user userCurrentListGPGKeys
56 56
 	//
57 57
 	//     Produces:
58 58
 	//     - application/json
@@ -66,7 +66,7 @@ func ListMyGPGKeys(ctx *context.APIContext) {
66 66
 
67 67
 //GetGPGKey get the GPG key based on a id
68 68
 func GetGPGKey(ctx *context.APIContext) {
69
-	// swagger:route GET /user/gpg_keys/{id} userCurrentGetGPGKey
69
+	// swagger:route GET /user/gpg_keys/{id} user userCurrentGetGPGKey
70 70
 	//
71 71
 	//     Produces:
72 72
 	//     - application/json
@@ -100,7 +100,7 @@ func CreateUserGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption, uid
100 100
 
101 101
 //CreateGPGKey associate a GPG key to the current user
102 102
 func CreateGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption) {
103
-	// swagger:route POST /user/gpg_keys userCurrentPostGPGKey
103
+	// swagger:route POST /user/gpg_keys user userCurrentPostGPGKey
104 104
 	//
105 105
 	//     Consumes:
106 106
 	//     - application/json
@@ -118,7 +118,7 @@ func CreateGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption) {
118 118
 
119 119
 //DeleteGPGKey remove a GPG key associated to the current user
120 120
 func DeleteGPGKey(ctx *context.APIContext) {
121
-	// swagger:route DELETE /user/gpg_keys/{id} userCurrentDeleteGPGKey
121
+	// swagger:route DELETE /user/gpg_keys/{id} user userCurrentDeleteGPGKey
122 122
 	//
123 123
 	//     Produces:
124 124
 	//     - application/json

+ 5 - 5
routers/api/v1/user/key.go

@@ -55,7 +55,7 @@ func listPublicKeys(ctx *context.APIContext, uid int64) {
55 55
 
56 56
 // ListMyPublicKeys list all my public keys
57 57
 func ListMyPublicKeys(ctx *context.APIContext) {
58
-	// swagger:route GET /user/keys userCurrentListKeys
58
+	// swagger:route GET /user/keys user userCurrentListKeys
59 59
 	//
60 60
 	//     Produces:
61 61
 	//     - application/json
@@ -69,7 +69,7 @@ func ListMyPublicKeys(ctx *context.APIContext) {
69 69
 
70 70
 // ListPublicKeys list all user's public keys
71 71
 func ListPublicKeys(ctx *context.APIContext) {
72
-	// swagger:route GET /users/{username}/keys userListKeys
72
+	// swagger:route GET /users/{username}/keys user userListKeys
73 73
 	//
74 74
 	//     Produces:
75 75
 	//     - application/json
@@ -87,7 +87,7 @@ func ListPublicKeys(ctx *context.APIContext) {
87 87
 
88 88
 // GetPublicKey get one public key
89 89
 func GetPublicKey(ctx *context.APIContext) {
90
-	// swagger:route GET /user/keys/{id} userCurrentGetKey
90
+	// swagger:route GET /user/keys/{id} user userCurrentGetKey
91 91
 	//
92 92
 	//     Produces:
93 93
 	//     - application/json
@@ -130,7 +130,7 @@ func CreateUserPublicKey(ctx *context.APIContext, form api.CreateKeyOption, uid
130 130
 
131 131
 // CreatePublicKey create one public key for me
132 132
 func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
133
-	// swagger:route POST /user/keys userCurrentPostKey
133
+	// swagger:route POST /user/keys user userCurrentPostKey
134 134
 	//
135 135
 	//     Consumes:
136 136
 	//     - application/json
@@ -148,7 +148,7 @@ func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
148 148
 
149 149
 // DeletePublicKey delete one public key of mine
150 150
 func DeletePublicKey(ctx *context.APIContext) {
151
-	// swagger:route DELETE /user/keys/{id} userCurrentDeleteKey
151
+	// swagger:route DELETE /user/keys/{id} user userCurrentDeleteKey
152 152
 	//
153 153
 	//     Produces:
154 154
 	//     - application/json

+ 3 - 3
routers/api/v1/user/repo.go

@@ -36,7 +36,7 @@ func listUserRepos(ctx *context.APIContext, u *models.User) {
36 36
 
37 37
 // ListUserRepos - list the repos owned by the given user.
38 38
 func ListUserRepos(ctx *context.APIContext) {
39
-	// swagger:route GET /users/{username}/repos userListRepos
39
+	// swagger:route GET /users/{username}/repos user userListRepos
40 40
 	//
41 41
 	//     Produces:
42 42
 	//     - application/json
@@ -54,7 +54,7 @@ func ListUserRepos(ctx *context.APIContext) {
54 54
 
55 55
 // ListMyRepos - list the repositories you own or have access to.
56 56
 func ListMyRepos(ctx *context.APIContext) {
57
-	// swagger:route GET /user/repos userCurrentListRepos
57
+	// swagger:route GET /user/repos user userCurrentListRepos
58 58
 	//
59 59
 	//     Produces:
60 60
 	//     - application/json
@@ -87,7 +87,7 @@ func ListMyRepos(ctx *context.APIContext) {
87 87
 
88 88
 // ListOrgRepos - list the repositories of an organization.
89 89
 func ListOrgRepos(ctx *context.APIContext) {
90
-	// swagger:route GET /orgs/{org}/repos orgListRepos
90
+	// swagger:route GET /orgs/{orgname}/repos organization orgListRepos
91 91
 	//
92 92
 	//     Produces:
93 93
 	//     - application/json

+ 5 - 5
routers/api/v1/user/star.go

@@ -33,7 +33,7 @@ func getStarredRepos(userID int64, private bool) ([]*api.Repository, error) {
33 33
 // GetStarredRepos returns the repos that the user specified by the APIContext
34 34
 // has starred
35 35
 func GetStarredRepos(ctx *context.APIContext) {
36
-	// swagger:route GET /users/{username}/starred userListStarred
36
+	// swagger:route GET /users/{username}/starred user userListStarred
37 37
 	//
38 38
 	//     Produces:
39 39
 	//     - application/json
@@ -53,7 +53,7 @@ func GetStarredRepos(ctx *context.APIContext) {
53 53
 
54 54
 // GetMyStarredRepos returns the repos that the authenticated user has starred
55 55
 func GetMyStarredRepos(ctx *context.APIContext) {
56
-	// swagger:route GET /user/starred userCurrentListStarred
56
+	// swagger:route GET /user/starred user userCurrentListStarred
57 57
 	//
58 58
 	//     Produces:
59 59
 	//     - application/json
@@ -71,7 +71,7 @@ func GetMyStarredRepos(ctx *context.APIContext) {
71 71
 
72 72
 // IsStarring returns whether the authenticated is starring the repo
73 73
 func IsStarring(ctx *context.APIContext) {
74
-	// swagger:route GET /user/starred/{username}/{reponame} userCurrentCheckStarring
74
+	// swagger:route GET /user/starred/{username}/{reponame} user userCurrentCheckStarring
75 75
 	//
76 76
 	//     Responses:
77 77
 	//       204: empty
@@ -86,7 +86,7 @@ func IsStarring(ctx *context.APIContext) {
86 86
 
87 87
 // Star the repo specified in the APIContext, as the authenticated user
88 88
 func Star(ctx *context.APIContext) {
89
-	// swagger:route PUT /user/starred/{username}/{reponame} userCurrentPutStar
89
+	// swagger:route PUT /user/starred/{username}/{reponame} user userCurrentPutStar
90 90
 	//
91 91
 	//     Responses:
92 92
 	//       204: empty
@@ -102,7 +102,7 @@ func Star(ctx *context.APIContext) {
102 102
 
103 103
 // Unstar the repo specified in the APIContext, as the authenticated user
104 104
 func Unstar(ctx *context.APIContext) {
105
-	// swagger:route DELETE /user/starred/{username}/{reponame} userCurrentDeleteStar
105
+	// swagger:route DELETE /user/starred/{username}/{reponame} user userCurrentDeleteStar
106 106
 	//
107 107
 	//     Responses:
108 108
 	//       204: empty

+ 3 - 3
routers/api/v1/user/user.go

@@ -17,7 +17,7 @@ import (
17 17
 
18 18
 // Search search users
19 19
 func Search(ctx *context.APIContext) {
20
-	// swagger:route GET /users/search userSearch
20
+	// swagger:route GET /users/search user userSearch
21 21
 	//
22 22
 	//     Produces:
23 23
 	//     - application/json
@@ -65,7 +65,7 @@ func Search(ctx *context.APIContext) {
65 65
 
66 66
 // GetInfo get user's information
67 67
 func GetInfo(ctx *context.APIContext) {
68
-	// swagger:route GET /users/{username} userGet
68
+	// swagger:route GET /users/{username} user userGet
69 69
 	//
70 70
 	//     Produces:
71 71
 	//     - application/json
@@ -94,7 +94,7 @@ func GetInfo(ctx *context.APIContext) {
94 94
 
95 95
 // GetAuthenticatedUser get curent user's information
96 96
 func GetAuthenticatedUser(ctx *context.APIContext) {
97
-	// swagger:route GET /user userGetCurrent
97
+	// swagger:route GET /user user userGetCurrent
98 98
 	//
99 99
 	//     Produces:
100 100
 	//     - application/json

+ 5 - 5
routers/api/v1/user/watch.go

@@ -33,7 +33,7 @@ func getWatchedRepos(userID int64, private bool) ([]*api.Repository, error) {
33 33
 
34 34
 // GetWatchedRepos returns the repos that the user specified in ctx is watching
35 35
 func GetWatchedRepos(ctx *context.APIContext) {
36
-	// swagger:route GET /users/{username}/subscriptions userListSubscriptions
36
+	// swagger:route GET /users/{username}/subscriptions user userListSubscriptions
37 37
 	//
38 38
 	//     Produces:
39 39
 	//     - application/json
@@ -53,7 +53,7 @@ func GetWatchedRepos(ctx *context.APIContext) {
53 53
 
54 54
 // GetMyWatchedRepos returns the repos that the authenticated user is watching
55 55
 func GetMyWatchedRepos(ctx *context.APIContext) {
56
-	// swagger:route GET /user/subscriptions userCurrentListSubscriptions
56
+	// swagger:route GET /user/subscriptions user userCurrentListSubscriptions
57 57
 	//
58 58
 	//     Produces:
59 59
 	//     - application/json
@@ -72,7 +72,7 @@ func GetMyWatchedRepos(ctx *context.APIContext) {
72 72
 // IsWatching returns whether the authenticated user is watching the repo
73 73
 // specified in ctx
74 74
 func IsWatching(ctx *context.APIContext) {
75
-	// swagger:route GET /repos/{username}/{reponame}/subscription userCurrentCheckSubscription
75
+	// swagger:route GET /repos/{username}/{reponame}/subscription repository userCurrentCheckSubscription
76 76
 	//
77 77
 	//     Responses:
78 78
 	//       200: WatchInfo
@@ -94,7 +94,7 @@ func IsWatching(ctx *context.APIContext) {
94 94
 
95 95
 // Watch the repo specified in ctx, as the authenticated user
96 96
 func Watch(ctx *context.APIContext) {
97
-	// swagger:route PUT /repos/{username}/{reponame}/subscription userCurrentPutSubscription
97
+	// swagger:route PUT /repos/{username}/{reponame}/subscription repository userCurrentPutSubscription
98 98
 	//
99 99
 	//     Responses:
100 100
 	//       200: WatchInfo
@@ -118,7 +118,7 @@ func Watch(ctx *context.APIContext) {
118 118
 
119 119
 // Unwatch the repo specified in ctx, as the authenticated user
120 120
 func Unwatch(ctx *context.APIContext) {
121
-	// swagger:route DELETE /repos/{username}/{reponame}/subscription userCurrentDeleteSubscription
121
+	// swagger:route DELETE /repos/{username}/{reponame}/subscription repository userCurrentDeleteSubscription
122 122
 	//
123 123
 	//     Responses:
124 124
 	//       204: empty

+ 40 - 19
vendor/code.gitea.io/sdk/gitea/admin_user.go

@@ -11,14 +11,22 @@ import (
11 11
 )
12 12
 
13 13
 // CreateUserOption create user options
14
+// swagger:parameters adminCreateUser
14 15
 type CreateUserOption struct {
15
-	SourceID   int64  `json:"source_id"`
16
-	LoginName  string `json:"login_name"`
17
-	Username   string `json:"username" binding:"Required;AlphaDashDot;MaxSize(35)"`
18
-	FullName   string `json:"full_name" binding:"MaxSize(100)"`
19
-	Email      string `json:"email" binding:"Required;Email;MaxSize(254)"`
20
-	Password   string `json:"password" binding:"MaxSize(255)"`
21
-	SendNotify bool   `json:"send_notify"`
16
+	// in: body
17
+	SourceID int64 `json:"source_id"`
18
+	// in: body
19
+	LoginName string `json:"login_name"`
20
+	// in: body
21
+	Username string `json:"username" binding:"Required;AlphaDashDot;MaxSize(35)"`
22
+	// in: body
23
+	FullName string `json:"full_name" binding:"MaxSize(100)"`
24
+	// in: body
25
+	Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
26
+	// in: body
27
+	Password string `json:"password" binding:"MaxSize(255)"`
28
+	// in: body
29
+	SendNotify bool `json:"send_notify"`
22 30
 }
23 31
 
24 32
 // AdminCreateUser create a user
@@ -32,19 +40,32 @@ func (c *Client) AdminCreateUser(opt CreateUserOption) (*User, error) {
32 40
 }
33 41
 
34 42
 // EditUserOption edit user options
43
+// swagger:parameters adminEditUser
35 44
 type EditUserOption struct {
36
-	SourceID         int64  `json:"source_id"`
37
-	LoginName        string `json:"login_name"`
38
-	FullName         string `json:"full_name" binding:"MaxSize(100)"`
39
-	Email            string `json:"email" binding:"Required;Email;MaxSize(254)"`
40
-	Password         string `json:"password" binding:"MaxSize(255)"`
41
-	Website          string `json:"website" binding:"MaxSize(50)"`
42
-	Location         string `json:"location" binding:"MaxSize(50)"`
43
-	Active           *bool  `json:"active"`
44
-	Admin            *bool  `json:"admin"`
45
-	AllowGitHook     *bool  `json:"allow_git_hook"`
46
-	AllowImportLocal *bool  `json:"allow_import_local"`
47
-	MaxRepoCreation  *int   `json:"max_repo_creation"`
45
+	// in: body
46
+	SourceID int64 `json:"source_id"`
47
+	// in: body
48
+	LoginName string `json:"login_name"`
49
+	// in: body
50
+	FullName string `json:"full_name" binding:"MaxSize(100)"`
51
+	// in: body
52
+	Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
53
+	// in: body
54
+	Password string `json:"password" binding:"MaxSize(255)"`
55
+	// in: body
56
+	Website string `json:"website" binding:"MaxSize(50)"`
57
+	// in: body
58
+	Location string `json:"location" binding:"MaxSize(50)"`
59
+	// in: body
60
+	Active *bool `json:"active"`
61
+	// in: body
62
+	Admin *bool `json:"admin"`
63
+	// in: body
64
+	AllowGitHook *bool `json:"allow_git_hook"`
65
+	// in: body
66
+	AllowImportLocal *bool `json:"allow_import_local"`
67
+	// in: body
68
+	MaxRepoCreation *int `json:"max_repo_creation"`
48 69
 }
49 70
 
50 71
 // AdminEditUser modify user informations

+ 2 - 0
vendor/code.gitea.io/sdk/gitea/fork.go

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

+ 21 - 7
vendor/code.gitea.io/sdk/gitea/hook.go

@@ -20,6 +20,7 @@ var (
20 20
 )
21 21
 
22 22
 // Hook a hook is a web hook when one repository changed
23
+// swagger:response Hook
23 24
 type Hook struct {
24 25
 	ID      int64             `json:"id"`
25 26
 	Type    string            `json:"type"`
@@ -31,14 +32,18 @@ type Hook struct {
31 32
 	Created time.Time         `json:"created_at"`
32 33
 }
33 34
 
35
+// HookList represents a list of API hook.
36
+// swagger:response HookList
37
+type HookList []*Hook
38
+
34 39
 // ListOrgHooks list all the hooks of one organization
35
-func (c *Client) ListOrgHooks(org string) ([]*Hook, error) {
40
+func (c *Client) ListOrgHooks(org string) (HookList, error) {
36 41
 	hooks := make([]*Hook, 0, 10)
37 42
 	return hooks, c.getParsedResponse("GET", fmt.Sprintf("/orgs/%s/hooks", org), nil, nil, &hooks)
38 43
 }
39 44
 
40 45
 // ListRepoHooks list all the hooks of one repository
41
-func (c *Client) ListRepoHooks(user, repo string) ([]*Hook, error) {
46
+func (c *Client) ListRepoHooks(user, repo string) (HookList, error) {
42 47
 	hooks := make([]*Hook, 0, 10)
43 48
 	return hooks, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/hooks", user, repo), nil, nil, &hooks)
44 49
 }
@@ -56,11 +61,16 @@ func (c *Client) GetRepoHook(user, repo string, id int64) (*Hook, error) {
56 61
 }
57 62
 
58 63
 // CreateHookOption options when create a hook
64
+// swagger:parameters orgCreateHook repoCreateHook
59 65
 type CreateHookOption struct {
60
-	Type   string            `json:"type" binding:"Required"`
66
+	// in: body
67
+	Type string `json:"type" binding:"Required"`
68
+	// in: body
61 69
 	Config map[string]string `json:"config" binding:"Required"`
62
-	Events []string          `json:"events"`
63
-	Active bool              `json:"active"`
70
+	// in: body
71
+	Events []string `json:"events"`
72
+	// in: body
73
+	Active bool `json:"active"`
64 74
 }
65 75
 
66 76
 // CreateOrgHook create one hook for an organization, with options
@@ -84,10 +94,14 @@ func (c *Client) CreateRepoHook(user, repo string, opt CreateHookOption) (*Hook,
84 94
 }
85 95
 
86 96
 // EditHookOption options when modify one hook
97
+// swagger:parameters orgEditHook repoEditHook
87 98
 type EditHookOption struct {
99
+	// in: body
88 100
 	Config map[string]string `json:"config"`
89
-	Events []string          `json:"events"`
90
-	Active *bool             `json:"active"`
101
+	// in: body
102
+	Events []string `json:"events"`
103
+	// in: body
104
+	Active *bool `json:"active"`
91 105
 }
92 106
 
93 107
 // EditOrgHook modify one hook of an organization, with hook id and options

+ 69 - 0
vendor/code.gitea.io/sdk/gitea/issue_tracked_time.go

@@ -0,0 +1,69 @@
1
+// Copyright 2017 The Gitea Authors. All rights reserved.
2
+// Use of this source code is governed by a MIT-style
3
+// license that can be found in the LICENSE file.
4
+
5
+package gitea
6
+
7
+import (
8
+	"bytes"
9
+	"encoding/json"
10
+	"fmt"
11
+	"time"
12
+)
13
+
14
+// TrackedTime worked time for an issue / pr
15
+// swagger:response TrackedTime
16
+type TrackedTime struct {
17
+	ID      int64     `json:"id"`
18
+	Created time.Time `json:"created"`
19
+	// Time in seconds
20
+	Time    int64 `json:"time"`
21
+	UserID  int64 `json:"user_id"`
22
+	IssueID int64 `json:"issue_id"`
23
+}
24
+
25
+// TrackedTimes represent a list of tracked times
26
+// swagger:response TrackedTimes
27
+type TrackedTimes []*TrackedTime
28
+
29
+// GetUserTrackedTimes list tracked times of a user
30
+func (c *Client) GetUserTrackedTimes(owner, repo, user string) (TrackedTimes, error) {
31
+	times := make(TrackedTimes, 0, 10)
32
+	return times, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/times/%s", owner, repo, user), nil, nil, &times)
33
+}
34
+
35
+// GetRepoTrackedTimes list tracked times of a repository
36
+func (c *Client) GetRepoTrackedTimes(owner, repo string) (TrackedTimes, error) {
37
+	times := make(TrackedTimes, 0, 10)
38
+	return times, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/times", owner, repo), nil, nil, &times)
39
+}
40
+
41
+// GetMyTrackedTimes list tracked times of the current user
42
+func (c *Client) GetMyTrackedTimes() (TrackedTimes, error) {
43
+	times := make(TrackedTimes, 0, 10)
44
+	return times, c.getParsedResponse("GET", "/user/times", nil, nil, &times)
45
+}
46
+
47
+// AddTimeOption adds time manually to an issue
48
+// swagger:parameters addTime
49
+type AddTimeOption struct {
50
+	// in: body
51
+	Time int64 `json:"time" binding:"Required"`
52
+}
53
+
54
+// AddTime adds time to issue with the given index
55
+func (c *Client) AddTime(owner, repo string, index int64, opt AddTimeOption) (*TrackedTime, error) {
56
+	body, err := json.Marshal(&opt)
57
+	if err != nil {
58
+		return nil, err
59
+	}
60
+	t := new(TrackedTime)
61
+	return t, c.getParsedResponse("POST", fmt.Sprintf("/repos/%s/%s/issues/%d/times", owner, repo, index),
62
+		jsonHeader, bytes.NewReader(body), t)
63
+}
64
+
65
+// ListTrackedTimes get tracked times of one issue via issue id
66
+func (c *Client) ListTrackedTimes(owner, repo string, index int64) (TrackedTimes, error) {
67
+	times := make(TrackedTimes, 0, 5)
68
+	return times, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/issues/%d/times", owner, repo, index), nil, nil, &times)
69
+}

+ 11 - 4
vendor/code.gitea.io/sdk/gitea/org.go

@@ -11,6 +11,7 @@ import (
11 11
 )
12 12
 
13 13
 // Organization a group of some repositories, users and teams
14
+// swagger:response Organization
14 15
 type Organization struct {
15 16
 	ID          int64  `json:"id"`
16 17
 	UserName    string `json:"username"`
@@ -40,12 +41,18 @@ func (c *Client) GetOrg(orgname string) (*Organization, error) {
40 41
 }
41 42
 
42 43
 // CreateOrgOption create one organization options
44
+// swagger:parameters adminCreateOrg
43 45
 type CreateOrgOption struct {
44
-	UserName    string `json:"username" binding:"Required"`
45
-	FullName    string `json:"full_name"`
46
+	// in: body
47
+	UserName string `json:"username" binding:"Required"`
48
+	// in: body
49
+	FullName string `json:"full_name"`
50
+	// in: body
46 51
 	Description string `json:"description"`
47
-	Website     string `json:"website"`
48
-	Location    string `json:"location"`
52
+	// in: body
53
+	Website string `json:"website"`
54
+	// in: body
55
+	Location string `json:"location"`
49 56
 }
50 57
 
51 58
 // EditOrgOption edit one organization options

+ 16 - 7
vendor/code.gitea.io/sdk/gitea/repo.go

@@ -69,7 +69,7 @@ func (c *Client) ListOrgRepos(org string) ([]*Repository, error) {
69 69
 }
70 70
 
71 71
 // CreateRepoOption options when creating repository
72
-//swagger:parameters createOrgRepo
72
+//swagger:parameters createOrgRepo adminCreateRepo createCurrentUserRepo
73 73
 type CreateRepoOption struct {
74 74
 	// Name of the repository to create
75 75
 	//
@@ -135,15 +135,24 @@ func (c *Client) DeleteRepo(owner, repo string) error {
135 135
 }
136 136
 
137 137
 // MigrateRepoOption options when migrate repository from an external place
138
+// swagger:parameters repoMigrate
138 139
 type MigrateRepoOption struct {
139
-	CloneAddr    string `json:"clone_addr" binding:"Required"`
140
+	// in: body
141
+	CloneAddr string `json:"clone_addr" binding:"Required"`
142
+	// in: body
140 143
 	AuthUsername string `json:"auth_username"`
144
+	// in: body
141 145
 	AuthPassword string `json:"auth_password"`
142
-	UID          int    `json:"uid" binding:"Required"`
143
-	RepoName     string `json:"repo_name" binding:"Required"`
144
-	Mirror       bool   `json:"mirror"`
145
-	Private      bool   `json:"private"`
146
-	Description  string `json:"description"`
146
+	// in: body
147
+	UID int `json:"uid" binding:"Required"`
148
+	// in: body
149
+	RepoName string `json:"repo_name" binding:"Required"`
150
+	// in: body
151
+	Mirror bool `json:"mirror"`
152
+	// in: body
153
+	Private bool `json:"private"`
154
+	// in: body
155
+	Description string `json:"description"`
147 156
 }
148 157
 
149 158
 // MigrateRepo migrates a repository from other Git hosting sources for the

+ 1 - 1
vendor/code.gitea.io/sdk/gitea/repo_key.go

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

+ 1 - 1
vendor/code.gitea.io/sdk/gitea/status.go

@@ -21,7 +21,7 @@ const (
21 21
 	// StatusSuccess is for when the Status is Success
22 22
 	StatusSuccess StatusState = "success"
23 23
 	// StatusError is for when the Status is Error
24
-	StatusError   StatusState = "error"
24
+	StatusError StatusState = "error"
25 25
 	// StatusFailure is for when the Status is Failure
26 26
 	StatusFailure StatusState = "failure"
27 27
 	// StatusWarning is for when the Status is Warning

+ 1 - 1
vendor/code.gitea.io/sdk/gitea/user_app.go

@@ -26,7 +26,7 @@ type AccessToken struct {
26 26
 
27 27
 // AccessTokenList represents a list of API access token.
28 28
 // swagger:response AccessTokenList
29
-type AccessTokenList []*AccessToken 
29
+type AccessTokenList []*AccessToken
30 30
 
31 31
 // ListAccessTokens lista all the access tokens of user
32 32
 func (c *Client) ListAccessTokens(user, pass string) ([]*AccessToken, error) {

+ 1 - 1
vendor/code.gitea.io/sdk/gitea/user_gpgkey.go

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

+ 3 - 3
vendor/vendor.json

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