mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-21 08:31:27 -05:00
use star as swagger model
This commit is contained in:
parent
18f4c514ec
commit
dc1a82bf4c
4 changed files with 19 additions and 2 deletions
|
@ -25,7 +25,10 @@ var KnownSourceTypes = SourceTypes{
|
||||||
ForgejoSourceType,
|
ForgejoSourceType,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Star activity for adding a star to an repository
|
||||||
|
// swagger:model
|
||||||
type Star struct {
|
type Star struct {
|
||||||
|
// swagger: ignore
|
||||||
ap.Activity
|
ap.Activity
|
||||||
// Source identifies the system generated this Activity. Exact one value has to be specified.
|
// Source identifies the system generated this Activity. Exact one value has to be specified.
|
||||||
Source SourceType `jsonld:"source,omitempty"`
|
Source SourceType `jsonld:"source,omitempty"`
|
||||||
|
|
|
@ -34,7 +34,6 @@ func Repository(ctx *context.APIContext) {
|
||||||
// "200":
|
// "200":
|
||||||
// "$ref": "#/responses/ActivityPub"
|
// "$ref": "#/responses/ActivityPub"
|
||||||
|
|
||||||
// TODO: Mabe we should use F3 Repo instead?
|
|
||||||
link := fmt.Sprintf("%s/api/v1/activitypub/repoistory-id/%d", strings.TrimSuffix(setting.AppURL, "/"), ctx.Repo.Repository.ID)
|
link := fmt.Sprintf("%s/api/v1/activitypub/repoistory-id/%d", strings.TrimSuffix(setting.AppURL, "/"), ctx.Repo.Repository.ID)
|
||||||
repo := forgefed.RepositoryNew(ap.IRI(link))
|
repo := forgefed.RepositoryNew(ap.IRI(link))
|
||||||
|
|
||||||
|
@ -61,6 +60,10 @@ func RepositoryInbox(ctx *context.APIContext) {
|
||||||
// description: repository ID of the repo
|
// description: repository ID of the repo
|
||||||
// type: integer
|
// type: integer
|
||||||
// required: true
|
// required: true
|
||||||
|
// - name: body
|
||||||
|
// in: body
|
||||||
|
// schema:
|
||||||
|
// "$ref": "#/definitions/Star"
|
||||||
// responses:
|
// responses:
|
||||||
// "204":
|
// "204":
|
||||||
// "$ref": "#/responses/empty"
|
// "$ref": "#/responses/empty"
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
// Copyright 2023 The Gitea & forgejo Authors. All rights reserved.
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
package swagger
|
package swagger
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
ffed "code.gitea.io/gitea/modules/forgefed"
|
||||||
api "code.gitea.io/gitea/modules/structs"
|
api "code.gitea.io/gitea/modules/structs"
|
||||||
"code.gitea.io/gitea/services/forms"
|
"code.gitea.io/gitea/services/forms"
|
||||||
)
|
)
|
||||||
|
@ -14,6 +15,9 @@ import (
|
||||||
// parameterBodies
|
// parameterBodies
|
||||||
// swagger:response parameterBodies
|
// swagger:response parameterBodies
|
||||||
type swaggerParameterBodies struct {
|
type swaggerParameterBodies struct {
|
||||||
|
// in:body
|
||||||
|
Star ffed.Star
|
||||||
|
|
||||||
// in:body
|
// in:body
|
||||||
AddCollaboratorOption api.AddCollaboratorOption
|
AddCollaboratorOption api.AddCollaboratorOption
|
||||||
|
|
||||||
|
|
7
templates/swagger/v1_json.tmpl
generated
7
templates/swagger/v1_json.tmpl
generated
|
@ -66,6 +66,13 @@
|
||||||
"name": "repository-id",
|
"name": "repository-id",
|
||||||
"in": "path",
|
"in": "path",
|
||||||
"required": true
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/Star"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
|
|
Loading…
Reference in a new issue