API: Expose its limitation settings (#12714)
* API: Expose its limitation settings * TESTs Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
45c0ec3152
commit
2a52aeec49
7 changed files with 133 additions and 14 deletions
|
@ -521,6 +521,7 @@ func RegisterRoutes(m *macaron.Macaron) {
|
|||
m.Post("/markdown/raw", misc.MarkdownRaw)
|
||||
m.Group("/settings", func() {
|
||||
m.Get("/ui", settings.GetGeneralUISettings)
|
||||
m.Get("/api", settings.GetGeneralAPISettings)
|
||||
m.Get("/repository", settings.GetGeneralRepoSettings)
|
||||
})
|
||||
|
||||
|
|
|
@ -27,6 +27,24 @@ func GetGeneralUISettings(ctx *context.APIContext) {
|
|||
})
|
||||
}
|
||||
|
||||
// GetGeneralAPISettings returns instance's global settings for api
|
||||
func GetGeneralAPISettings(ctx *context.APIContext) {
|
||||
// swagger:operation GET /settings/api settings getGeneralAPISettings
|
||||
// ---
|
||||
// summary: Get instance's global settings for api
|
||||
// produces:
|
||||
// - application/json
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/GeneralAPISettings"
|
||||
ctx.JSON(http.StatusOK, api.GeneralAPISettings{
|
||||
MaxResponseItems: setting.API.MaxResponseItems,
|
||||
DefaultPagingNum: setting.API.DefaultPagingNum,
|
||||
DefaultGitTreesPerPage: setting.API.DefaultGitTreesPerPage,
|
||||
DefaultMaxBlobSize: setting.API.DefaultMaxBlobSize,
|
||||
})
|
||||
}
|
||||
|
||||
// GetGeneralRepoSettings returns instance's global settings for repositories
|
||||
func GetGeneralRepoSettings(ctx *context.APIContext) {
|
||||
// swagger:operation GET /settings/repository settings getGeneralRepositorySettings
|
||||
|
|
|
@ -19,3 +19,10 @@ type swaggerResponseGeneralUISettings struct {
|
|||
// in:body
|
||||
Body api.GeneralUISettings `json:"body"`
|
||||
}
|
||||
|
||||
// GeneralAPISettings
|
||||
// swagger:response GeneralAPISettings
|
||||
type swaggerResponseGeneralAPISettings struct {
|
||||
// in:body
|
||||
Body api.GeneralAPISettings `json:"body"`
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue