Files
gitea/modules/structs/repo_collaborator.go
T
Myers Carpenter 9e031eb3df Serve OpenAPI 3.0 spec at /openapi.v1.json (#37038)
Add a build-time conversion step that transforms the existing Swagger
2.0 spec into an OpenAPI 3.0 spec. The OAS3 spec is served alongside the
existing Swagger 2.0 spec, enabling API clients that require OAS3 to
generate code directly from Gitea's API.

This is not to be an answer to how gitea handles OAS3 long term,
but a way to use what we have to move a step forward.

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Claude (Opus 4.7) <noreply@anthropic.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-04-29 20:47:52 +08:00

46 lines
1.5 KiB
Go

// Copyright 2016 The Gogs Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package structs
// RepoWritePermission is a permission level callers may grant to a team or
// collaborator on input. Output fields use AccessLevelName instead.
// swagger:enum RepoWritePermission
type RepoWritePermission string
const (
RepoWritePermissionRead RepoWritePermission = "read"
RepoWritePermissionWrite RepoWritePermission = "write"
RepoWritePermissionAdmin RepoWritePermission = "admin"
)
// AccessLevelName is the string rendering of a perm.AccessMode produced on
// API responses. Callers must not send these values; use RepoWritePermission
// on input.
// swagger:enum AccessLevelName
type AccessLevelName string
const (
AccessLevelNameNone AccessLevelName = "none"
AccessLevelNameRead AccessLevelName = "read"
AccessLevelNameWrite AccessLevelName = "write"
AccessLevelNameAdmin AccessLevelName = "admin"
AccessLevelNameOwner AccessLevelName = "owner"
)
// AddCollaboratorOption options when adding a user as a collaborator of a repository
type AddCollaboratorOption struct {
// Permission level to grant the collaborator
Permission *RepoWritePermission `json:"permission"`
}
// RepoCollaboratorPermission to get repository permission for a collaborator
type RepoCollaboratorPermission struct {
// Permission level of the collaborator
Permission AccessLevelName `json:"permission"`
// RoleName is the name of the permission role
RoleName string `json:"role_name"`
// User information of the collaborator
User *User `json:"user"`
}