aboutsummaryrefslogtreecommitdiffstats
path: root/modules/structs
diff options
context:
space:
mode:
authorBo-Yi Wu <appleboy.tw@gmail.com>2023-08-28 13:08:19 +0800
committerGitHub <noreply@github.com>2023-08-28 13:08:19 +0800
commit8cd46024fdcdaf04cd09be2c25db673e99b0a024 (patch)
treef8ea47b6a473ec43b35be215fce2755c7e7b363c /modules/structs
parent6945918d34ecc855c99bfc7d7773c3a2d60a3565 (diff)
downloadgitea-8cd46024fdcdaf04cd09be2c25db673e99b0a024.tar.gz
gitea-8cd46024fdcdaf04cd09be2c25db673e99b0a024.zip
refactor(API): refactor secret creation and update functionality (#26751)
According to the GitHub API Spec: https://docs.github.com/en/rest/actions/secrets?apiVersion=2022-11-28#create-or-update-an-organization-secret Merge the Create and Update secret into a single API. - Remove the `CreateSecretOption` struct and replace it with `CreateOrUpdateSecretOption` in `modules/structs/secret.go` - Update the `CreateOrUpdateOrgSecret` function in `routers/api/v1/org/action.go` to use `CreateOrUpdateSecretOption` instead of `UpdateSecretOption` - Remove the `CreateOrgSecret` function in `routers/api/v1/org/action.go` and replace it with `CreateOrUpdateOrgSecret` - Update the Swagger documentation in `routers/api/v1/swagger/options.go` and `templates/swagger/v1_json.tmpl` to reflect the changes in the struct names and function names Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Diffstat (limited to 'modules/structs')
-rw-r--r--modules/structs/secret.go16
1 files changed, 2 insertions, 14 deletions
diff --git a/modules/structs/secret.go b/modules/structs/secret.go
index 52221b51f0..a0673ca08c 100644
--- a/modules/structs/secret.go
+++ b/modules/structs/secret.go
@@ -14,21 +14,9 @@ type Secret struct {
Created time.Time `json:"created_at"`
}
-// CreateSecretOption options when creating secret
+// CreateOrUpdateSecretOption options when creating or updating secret
// swagger:model
-type CreateSecretOption struct {
- // Name of the secret to create
- //
- // required: true
- // unique: true
- Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(100)"`
- // Data of the secret to create
- Data string `json:"data" binding:"Required"`
-}
-
-// UpdateSecretOption options when updating secret
-// swagger:model
-type UpdateSecretOption struct {
+type CreateOrUpdateSecretOption struct {
// Data of the secret to update
//
// required: true