.
This commit is contained in:
commit
598ecbbd5a
20
bots-common/Makefile
Normal file
20
bots-common/Makefile
Normal file
@ -0,0 +1,20 @@
|
||||
all: build
|
||||
|
||||
api.json:
|
||||
curl -o api.json https://src.opensuse.org/swagger.v1.json
|
||||
|
||||
obs.api.json:
|
||||
curl -o obs.api.yaml https://api.opensuse.org/apidocs/OBS-v2.10.50.yaml
|
||||
|
||||
gitea-generated/client/gitea_api_client.go: api.json
|
||||
[ -d gitea-generated ] || mkdir gitea-generated
|
||||
podman run --rm -v $$(pwd):/api ghcr.io/go-swagger/go-swagger generate client -f /api/api.json -t /api/gitea-generated
|
||||
|
||||
generate.go:
|
||||
go generate
|
||||
|
||||
api: gitea-generated/client/gitea_api_client.go
|
||||
|
||||
build: api
|
||||
go build
|
||||
|
25728
bots-common/api.json
Normal file
25728
bots-common/api.json
Normal file
File diff suppressed because it is too large
Load Diff
5
bots-common/cfg.yaml
Normal file
5
bots-common/cfg.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
package: client
|
||||
output: client.gen.go
|
||||
generate:
|
||||
models: true
|
||||
client: true
|
8
bots-common/consts.go
Normal file
8
bots-common/consts.go
Normal file
@ -0,0 +1,8 @@
|
||||
package common;
|
||||
|
||||
const (
|
||||
GiteaTokenEnv = "GITEA_TOKEN"
|
||||
DefaultGitPrj = "_ObsPrj"
|
||||
GiteaRequestHeader = "X-Gitea-Event-Type"
|
||||
)
|
||||
|
432
bots-common/conststring_test.go
Normal file
432
bots-common/conststring_test.go
Normal file
@ -0,0 +1,432 @@
|
||||
package common
|
||||
|
||||
const examplePushJSON = `{
|
||||
"ref": "refs/heads/main",
|
||||
"before": "9fe6b18fee74f49786c39e062ef02bcfb560a0be6eb7851b81954123e2d55629",
|
||||
"after": "7d0be2432c179873081b715b8d38a563b8469608e110205821ba6a894e63c616",
|
||||
"compare_url": "https://src.opensuse.org/autogits/_ObsPrj/compare/9fe6b18fee74f49786c39e062ef02bcfb560a0be6eb7851b81954123e2d55629...7d0be2432c179873081b715b8d38a563b8469608e110205821ba6a894e63c616",
|
||||
"commits": [
|
||||
{
|
||||
"id": "7d0be2432c179873081b715b8d38a563b8469608e110205821ba6a894e63c616",
|
||||
"message": "Automatic project inclusion\n",
|
||||
"url": "https://src.opensuse.org/autogits/_ObsPrj/commit/7d0be2432c179873081b715b8d38a563b8469608e110205821ba6a894e63c616",
|
||||
"author": {
|
||||
"name": "GiteaBot - AutoDevel",
|
||||
"email": "not-exist@src.opensuse.org",
|
||||
"username": ""
|
||||
},
|
||||
"committer": {
|
||||
"name": "root",
|
||||
"email": "not-exist@src.opensuse.org",
|
||||
"username": ""
|
||||
},
|
||||
"verification": null,
|
||||
"timestamp": "2024-06-25T14:38:31Z",
|
||||
"added": [
|
||||
".gitmodules",
|
||||
"nodejs22"
|
||||
],
|
||||
"removed": [],
|
||||
"modified": []
|
||||
}
|
||||
],
|
||||
"total_commits": 1,
|
||||
"head_commit": {
|
||||
"id": "7d0be2432c179873081b715b8d38a563b8469608e110205821ba6a894e63c616",
|
||||
"message": "Automatic project inclusion\n",
|
||||
"url": "https://src.opensuse.org/autogits/_ObsPrj/commit/7d0be2432c179873081b715b8d38a563b8469608e110205821ba6a894e63c616",
|
||||
"author": {
|
||||
"name": "GiteaBot - AutoDevel",
|
||||
"email": "not-exist@src.opensuse.org",
|
||||
"username": ""
|
||||
},
|
||||
"committer": {
|
||||
"name": "root",
|
||||
"email": "not-exist@src.opensuse.org",
|
||||
"username": ""
|
||||
},
|
||||
"verification": null,
|
||||
"timestamp": "2024-06-25T14:38:31Z",
|
||||
"added": [
|
||||
".gitmodules",
|
||||
"nodejs22"
|
||||
],
|
||||
"removed": [],
|
||||
"modified": []
|
||||
},
|
||||
"repository": {
|
||||
"id": 90487,
|
||||
"owner": {
|
||||
"id": 983,
|
||||
"login": "autogits",
|
||||
"login_name": "",
|
||||
"source_id": 0,
|
||||
"full_name": "",
|
||||
"email": "",
|
||||
"avatar_url": "https://src.opensuse.org/avatars/80a61ef3a14c3c22f0b8b1885d1a75d4",
|
||||
"html_url": "https://src.opensuse.org/autogits",
|
||||
"language": "",
|
||||
"is_admin": false,
|
||||
"last_login": "0001-01-01T00:00:00Z",
|
||||
"created": "2024-06-20T09:46:37+02:00",
|
||||
"restricted": false,
|
||||
"active": false,
|
||||
"prohibit_login": false,
|
||||
"location": "",
|
||||
"website": "",
|
||||
"description": "",
|
||||
"visibility": "public",
|
||||
"followers_count": 0,
|
||||
"following_count": 0,
|
||||
"starred_repos_count": 0,
|
||||
"username": "autogits"
|
||||
},
|
||||
"name": "_ObsPrj",
|
||||
"full_name": "autogits/_ObsPrj",
|
||||
"description": "",
|
||||
"empty": false,
|
||||
"private": false,
|
||||
"fork": false,
|
||||
"template": false,
|
||||
"parent": null,
|
||||
"mirror": false,
|
||||
"size": 27,
|
||||
"language": "",
|
||||
"languages_url": "https://src.opensuse.org/api/v1/repos/autogits/_ObsPrj/languages",
|
||||
"html_url": "https://src.opensuse.org/autogits/_ObsPrj",
|
||||
"url": "https://src.opensuse.org/api/v1/repos/autogits/_ObsPrj",
|
||||
"link": "",
|
||||
"ssh_url": "gitea@src.opensuse.org:autogits/_ObsPrj.git",
|
||||
"clone_url": "https://src.opensuse.org/autogits/_ObsPrj.git",
|
||||
"original_url": "",
|
||||
"website": "",
|
||||
"stars_count": 0,
|
||||
"forks_count": 0,
|
||||
"watchers_count": 1,
|
||||
"open_issues_count": 0,
|
||||
"open_pr_counter": 0,
|
||||
"release_counter": 0,
|
||||
"default_branch": "main",
|
||||
"archived": false,
|
||||
"created_at": "2024-06-25T13:52:03+02:00",
|
||||
"updated_at": "2024-06-25T16:20:44+02:00",
|
||||
"archived_at": "1970-01-01T01:00:00+01:00",
|
||||
"permissions": {
|
||||
"admin": true,
|
||||
"push": true,
|
||||
"pull": true
|
||||
},
|
||||
"has_issues": true,
|
||||
"internal_tracker": {
|
||||
"enable_time_tracker": false,
|
||||
"allow_only_contributors_to_track_time": true,
|
||||
"enable_issue_dependencies": true
|
||||
},
|
||||
"has_wiki": true,
|
||||
"has_pull_requests": true,
|
||||
"has_projects": true,
|
||||
"projects_mode": "all",
|
||||
"has_releases": true,
|
||||
"has_packages": true,
|
||||
"has_actions": true,
|
||||
"ignore_whitespace_conflicts": false,
|
||||
"allow_merge_commits": true,
|
||||
"allow_rebase": true,
|
||||
"allow_rebase_explicit": true,
|
||||
"allow_squash_merge": true,
|
||||
"allow_fast_forward_only_merge": true,
|
||||
"allow_rebase_update": true,
|
||||
"default_delete_branch_after_merge": false,
|
||||
"default_merge_style": "merge",
|
||||
"default_allow_maintainer_edit": false,
|
||||
"avatar_url": "https://src.opensuse.org/",
|
||||
"internal": false,
|
||||
"mirror_interval": "",
|
||||
"object_format_name": "sha256",
|
||||
"mirror_updated": "0001-01-01T00:00:00Z",
|
||||
"repo_transfer": null
|
||||
},
|
||||
"pusher": {
|
||||
"id": 129,
|
||||
"login": "adamm",
|
||||
"login_name": "",
|
||||
"source_id": 0,
|
||||
"full_name": "Adam Majer",
|
||||
"email": "adamm@noreply@src.opensuse.org",
|
||||
"avatar_url": "https://src.opensuse.org/avatar/babb6ae054a709c238a4e9b0f2b53d53",
|
||||
"html_url": "https://src.opensuse.org/adamm",
|
||||
"language": "",
|
||||
"is_admin": false,
|
||||
"last_login": "0001-01-01T00:00:00Z",
|
||||
"created": "2023-07-21T16:43:48+02:00",
|
||||
"restricted": false,
|
||||
"active": false,
|
||||
"prohibit_login": false,
|
||||
"location": "",
|
||||
"website": "",
|
||||
"description": "",
|
||||
"visibility": "public",
|
||||
"followers_count": 0,
|
||||
"following_count": 0,
|
||||
"starred_repos_count": 0,
|
||||
"username": "adamm"
|
||||
},
|
||||
"sender": {
|
||||
"id": 129,
|
||||
"login": "adamm",
|
||||
"login_name": "",
|
||||
"source_id": 0,
|
||||
"full_name": "Adam Majer",
|
||||
"email": "adamm@noreply@src.opensuse.org",
|
||||
"avatar_url": "https://src.opensuse.org/avatar/babb6ae054a709c238a4e9b0f2b53d53",
|
||||
"html_url": "https://src.opensuse.org/adamm",
|
||||
"language": "",
|
||||
"is_admin": false,
|
||||
"last_login": "0001-01-01T00:00:00Z",
|
||||
"created": "2023-07-21T16:43:48+02:00",
|
||||
"restricted": false,
|
||||
"active": false,
|
||||
"prohibit_login": false,
|
||||
"location": "",
|
||||
"website": "",
|
||||
"description": "",
|
||||
"visibility": "public",
|
||||
"followers_count": 0,
|
||||
"following_count": 0,
|
||||
"starred_repos_count": 0,
|
||||
"username": "adamm"
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const repoCreateJSON = `{
|
||||
"action": "created",
|
||||
"repository": {
|
||||
"id": 87483,
|
||||
"owner": {
|
||||
"id": 983,
|
||||
"login": "autogits",
|
||||
"login_name": "",
|
||||
"source_id": 0,
|
||||
"full_name": "",
|
||||
"email": "",
|
||||
"avatar_url": "https://src.opensuse.org/avatars/80a61ef3a14c3c22f0b8b1885d1a75d4",
|
||||
"html_url": "https://src.opensuse.org/autogits",
|
||||
"language": "",
|
||||
"is_admin": false,
|
||||
"last_login": "0001-01-01T00:00:00Z",
|
||||
"created": "2024-06-20T09:46:37+02:00",
|
||||
"restricted": false,
|
||||
"active": false,
|
||||
"prohibit_login": false,
|
||||
"location": "",
|
||||
"website": "",
|
||||
"description": "",
|
||||
"visibility": "public",
|
||||
"followers_count": 0,
|
||||
"following_count": 0,
|
||||
"starred_repos_count": 0,
|
||||
"username": "autogits"
|
||||
},
|
||||
"name": "nodejs22",
|
||||
"full_name": "autogits/nodejs22",
|
||||
"description": "",
|
||||
"empty": false,
|
||||
"private": false,
|
||||
"fork": true,
|
||||
"template": false,
|
||||
"parent": {
|
||||
"id": 54598,
|
||||
"owner": {
|
||||
"id": 64,
|
||||
"login": "pool",
|
||||
"login_name": "",
|
||||
"source_id": 0,
|
||||
"full_name": "",
|
||||
"email": "",
|
||||
"avatar_url": "https://src.opensuse.org/avatars/b10a8c0bede9eb4ea771b04db3149f28",
|
||||
"html_url": "https://src.opensuse.org/pool",
|
||||
"language": "",
|
||||
"is_admin": false,
|
||||
"last_login": "0001-01-01T00:00:00Z",
|
||||
"created": "2023-03-01T14:41:17+01:00",
|
||||
"restricted": false,
|
||||
"active": false,
|
||||
"prohibit_login": false,
|
||||
"location": "",
|
||||
"website": "",
|
||||
"description": "",
|
||||
"visibility": "public",
|
||||
"followers_count": 0,
|
||||
"following_count": 0,
|
||||
"starred_repos_count": 0,
|
||||
"username": "pool"
|
||||
},
|
||||
"name": "nodejs22",
|
||||
"full_name": "pool/nodejs22",
|
||||
"description": "",
|
||||
"empty": false,
|
||||
"private": false,
|
||||
"fork": false,
|
||||
"template": false,
|
||||
"parent": null,
|
||||
"mirror": false,
|
||||
"size": 190,
|
||||
"language": "",
|
||||
"languages_url": "https://src.opensuse.org/api/v1/repos/pool/nodejs22/languages",
|
||||
"html_url": "https://src.opensuse.org/pool/nodejs22",
|
||||
"url": "https://src.opensuse.org/api/v1/repos/pool/nodejs22",
|
||||
"link": "",
|
||||
"ssh_url": "gitea@src.opensuse.org:pool/nodejs22.git",
|
||||
"clone_url": "https://src.opensuse.org/pool/nodejs22.git",
|
||||
"original_url": "",
|
||||
"website": "",
|
||||
"stars_count": 0,
|
||||
"forks_count": 3,
|
||||
"watchers_count": 4,
|
||||
"open_issues_count": 0,
|
||||
"open_pr_counter": 1,
|
||||
"release_counter": 0,
|
||||
"default_branch": "factory",
|
||||
"archived": false,
|
||||
"created_at": "2024-05-28T12:47:21+02:00",
|
||||
"updated_at": "2024-06-12T14:54:03+02:00",
|
||||
"archived_at": "1970-01-01T01:00:00+01:00",
|
||||
"permissions": {
|
||||
"admin": true,
|
||||
"push": true,
|
||||
"pull": true
|
||||
},
|
||||
"has_issues": true,
|
||||
"internal_tracker": {
|
||||
"enable_time_tracker": false,
|
||||
"allow_only_contributors_to_track_time": true,
|
||||
"enable_issue_dependencies": true
|
||||
},
|
||||
"has_wiki": true,
|
||||
"has_pull_requests": true,
|
||||
"has_projects": true,
|
||||
"projects_mode": "",
|
||||
"has_releases": true,
|
||||
"has_packages": true,
|
||||
"has_actions": false,
|
||||
"ignore_whitespace_conflicts": false,
|
||||
"allow_merge_commits": true,
|
||||
"allow_rebase": true,
|
||||
"allow_rebase_explicit": true,
|
||||
"allow_squash_merge": true,
|
||||
"allow_fast_forward_only_merge": false,
|
||||
"allow_rebase_update": true,
|
||||
"default_delete_branch_after_merge": false,
|
||||
"default_merge_style": "merge",
|
||||
"default_allow_maintainer_edit": false,
|
||||
"avatar_url": "https://src.opensuse.org/",
|
||||
"internal": false,
|
||||
"mirror_interval": "",
|
||||
"object_format_name": "sha256",
|
||||
"mirror_updated": "0001-01-01T00:00:00Z",
|
||||
"repo_transfer": null
|
||||
},
|
||||
"mirror": false,
|
||||
"size": 0,
|
||||
"language": "",
|
||||
"languages_url": "https://src.opensuse.org/api/v1/repos/autogits/nodejs22/languages",
|
||||
"html_url": "https://src.opensuse.org/autogits/nodejs22",
|
||||
"url": "https://src.opensuse.org/api/v1/repos/autogits/nodejs22",
|
||||
"link": "",
|
||||
"ssh_url": "gitea@src.opensuse.org:autogits/nodejs22.git",
|
||||
"clone_url": "https://src.opensuse.org/autogits/nodejs22.git",
|
||||
"original_url": "",
|
||||
"website": "",
|
||||
"stars_count": 0,
|
||||
"forks_count": 0,
|
||||
"watchers_count": 0,
|
||||
"open_issues_count": 0,
|
||||
"open_pr_counter": 0,
|
||||
"release_counter": 0,
|
||||
"default_branch": "factory",
|
||||
"archived": false,
|
||||
"created_at": "2024-06-20T10:09:12+02:00",
|
||||
"updated_at": "2024-06-20T10:09:12+02:00",
|
||||
"archived_at": "1970-01-01T01:00:00+01:00",
|
||||
"permissions": {
|
||||
"admin": true,
|
||||
"push": true,
|
||||
"pull": true
|
||||
},
|
||||
"has_issues": false,
|
||||
"has_wiki": false,
|
||||
"has_pull_requests": true,
|
||||
"has_projects": false,
|
||||
"projects_mode": "all",
|
||||
"has_releases": false,
|
||||
"has_packages": false,
|
||||
"has_actions": false,
|
||||
"ignore_whitespace_conflicts": false,
|
||||
"allow_merge_commits": true,
|
||||
"allow_rebase": true,
|
||||
"allow_rebase_explicit": true,
|
||||
"allow_squash_merge": true,
|
||||
"allow_fast_forward_only_merge": true,
|
||||
"allow_rebase_update": true,
|
||||
"default_delete_branch_after_merge": false,
|
||||
"default_merge_style": "merge",
|
||||
"default_allow_maintainer_edit": false,
|
||||
"avatar_url": "https://src.opensuse.org/",
|
||||
"internal": false,
|
||||
"mirror_interval": "",
|
||||
"object_format_name": "sha256",
|
||||
"mirror_updated": "0001-01-01T00:00:00Z",
|
||||
"repo_transfer": null
|
||||
},
|
||||
"organization": {
|
||||
"id": 983,
|
||||
"login": "autogits",
|
||||
"login_name": "",
|
||||
"source_id": 0,
|
||||
"full_name": "",
|
||||
"email": "autogits@noreply@src.opensuse.org",
|
||||
"avatar_url": "https://src.opensuse.org/avatars/80a61ef3a14c3c22f0b8b1885d1a75d4",
|
||||
"html_url": "https://src.opensuse.org/autogits",
|
||||
"language": "",
|
||||
"is_admin": false,
|
||||
"last_login": "0001-01-01T00:00:00Z",
|
||||
"created": "2024-06-20T09:46:37+02:00",
|
||||
"restricted": false,
|
||||
"active": false,
|
||||
"prohibit_login": false,
|
||||
"location": "",
|
||||
"website": "",
|
||||
"description": "",
|
||||
"visibility": "public",
|
||||
"followers_count": 0,
|
||||
"following_count": 0,
|
||||
"starred_repos_count": 0,
|
||||
"username": "autogits"
|
||||
},
|
||||
"sender": {
|
||||
"id": 129,
|
||||
"login": "adamm",
|
||||
"login_name": "",
|
||||
"source_id": 0,
|
||||
"full_name": "Adam Majer",
|
||||
"email": "adamm@noreply@src.opensuse.org",
|
||||
"avatar_url": "https://src.opensuse.org/avatar/babb6ae054a709c238a4e9b0f2b53d53",
|
||||
"html_url": "https://src.opensuse.org/adamm",
|
||||
"language": "",
|
||||
"is_admin": false,
|
||||
"last_login": "0001-01-01T00:00:00Z",
|
||||
"created": "2023-07-21T16:43:48+02:00",
|
||||
"restricted": false,
|
||||
"active": false,
|
||||
"prohibit_login": false,
|
||||
"location": "",
|
||||
"website": "",
|
||||
"description": "",
|
||||
"visibility": "public",
|
||||
"followers_count": 0,
|
||||
"following_count": 0,
|
||||
"starred_repos_count": 0,
|
||||
"username": "adamm"
|
||||
}
|
||||
}`
|
8
bots-common/devtest.sh
Executable file
8
bots-common/devtest.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
while true; do
|
||||
clear
|
||||
go test
|
||||
inotifywait -q -e modify -e create -e delete -r .
|
||||
done
|
||||
|
5
bots-common/generate.go
Normal file
5
bots-common/generate.go
Normal file
@ -0,0 +1,5 @@
|
||||
package common
|
||||
|
||||
//go:generate go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen -config cfg.yaml obs.api.yaml
|
||||
|
||||
|
204
bots-common/git_utils.go
Normal file
204
bots-common/git_utils.go
Normal file
@ -0,0 +1,204 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
//func (h *RequestHandler) ProcessBranchList() []string {
|
||||
// if h.HasError() {
|
||||
// return make([]string, 0)
|
||||
// }
|
||||
//
|
||||
// trackedBranches, err := os.ReadFile(path.Join(h.GitPath, DefaultGitPrj, TrackedBranchesFile))
|
||||
// if err != nil {
|
||||
// if errors.Is(err, os.ErrNotExist) {
|
||||
// trackedBranches = []byte("factory")
|
||||
// } else {
|
||||
// h.LogError("file error reading '%s' file in repo", TrackedBranchesFile)
|
||||
// h.Error = err
|
||||
// return make([]string, 0)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return strings.Split(string(trackedBranches), "\n")
|
||||
//}
|
||||
|
||||
type GitReference struct {
|
||||
Branch string
|
||||
Id string
|
||||
}
|
||||
|
||||
type GitReferences struct {
|
||||
refs []GitReference
|
||||
}
|
||||
|
||||
func (refs *GitReferences) addReference(id, branch string) {
|
||||
for _, ref := range refs.refs {
|
||||
if ref.Id == id && ref.Branch == branch {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
refs.refs = append(refs.refs, GitReference{Branch: branch, Id: id})
|
||||
}
|
||||
|
||||
func processRefs(gitDir string) ([]GitReference, error) {
|
||||
packedRefsPath := path.Join(gitDir, "packed-refs")
|
||||
stat, err := os.Stat(packedRefsPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if stat.Size() > 10000 || stat.IsDir() {
|
||||
return nil, fmt.Errorf("Funny business with 'packed-refs' in '%s'", gitDir)
|
||||
}
|
||||
|
||||
data, err := os.ReadFile(packedRefsPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var references GitReferences
|
||||
for _, line := range strings.Split(string(data), "\n") {
|
||||
if len(line) < 1 || line[0] == '#' {
|
||||
continue
|
||||
}
|
||||
|
||||
splitLine := strings.Split(line, " ")
|
||||
if len(splitLine) != 2 {
|
||||
return nil, fmt.Errorf("Unexpected packaged-refs entry '%#v' in '%s'", splitLine, packedRefsPath)
|
||||
}
|
||||
id, ref := splitLine[0], splitLine[1]
|
||||
const remoteRefPrefix = "refs/remotes/origin/"
|
||||
if ref[0:len(remoteRefPrefix)] != remoteRefPrefix {
|
||||
continue
|
||||
}
|
||||
|
||||
references.addReference(id, ref[len(remoteRefPrefix):])
|
||||
}
|
||||
|
||||
return references.refs, nil
|
||||
}
|
||||
|
||||
func findGitDir(p string) (string, error) {
|
||||
gitFile := path.Join(p, ".git")
|
||||
stat, err := os.Stat(gitFile)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if stat.IsDir() {
|
||||
return path.Join(p, ".git"), nil
|
||||
}
|
||||
|
||||
data, err := os.ReadFile(gitFile)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
for _, line := range strings.Split(string(data), "\n") {
|
||||
refs := strings.Split(line, ":")
|
||||
if len(refs) != 2 {
|
||||
return "", fmt.Errorf("Unknown format of .git file: '%s'\n", line)
|
||||
}
|
||||
|
||||
if refs[0] != "gitdir" {
|
||||
return "", fmt.Errorf("Unknown header of .git file: '%s'\n", refs[0])
|
||||
}
|
||||
|
||||
return path.Join(p, strings.TrimSpace(refs[1])), nil
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("Can't find git subdirectory in '%s'", p)
|
||||
}
|
||||
|
||||
func (e *RequestHandler) GitBranchHead(gitDir, branchName string) (string, error) {
|
||||
if e.HasError() {
|
||||
return "", e.Error
|
||||
}
|
||||
|
||||
path, err := findGitDir(path.Join(e.GitPath, gitDir))
|
||||
if err != nil {
|
||||
e.LogError("Error identifying gitdir in `%s`: %#v", gitDir, err)
|
||||
e.Error = err
|
||||
}
|
||||
|
||||
refs, err := processRefs(path)
|
||||
if err != nil {
|
||||
e.LogError("Error finding branches (%s): %#v", branchName, err)
|
||||
e.Error = err
|
||||
return "", e.Error
|
||||
}
|
||||
|
||||
for _, ref := range refs {
|
||||
if ref.Branch == branchName {
|
||||
return ref.Id, nil
|
||||
}
|
||||
}
|
||||
|
||||
e.Error = fmt.Errorf("Can't find default remote branch: %s", branchName)
|
||||
e.LogError("%s", e.Error.Error())
|
||||
return "", e.Error
|
||||
}
|
||||
|
||||
type ExecStream interface {
|
||||
Close()
|
||||
HasError() bool
|
||||
GitExec(cwd string, param ...string) ExecStream
|
||||
}
|
||||
|
||||
func (e *RequestHandler) Close() {
|
||||
if e.GitPath == "" {
|
||||
return
|
||||
}
|
||||
|
||||
e.Error = os.RemoveAll(e.GitPath)
|
||||
e.GitPath = ""
|
||||
return
|
||||
}
|
||||
|
||||
func (e *RequestHandler) HasError() bool {
|
||||
return e.Error != nil
|
||||
}
|
||||
|
||||
type writeFunc func(data []byte) (int, error)
|
||||
|
||||
func (f writeFunc) Write(data []byte) (int, error) {
|
||||
return f(data)
|
||||
}
|
||||
|
||||
func (e *RequestHandler) GitExec(cwd string, params ...string) ExecStream {
|
||||
if e.Error != nil {
|
||||
return e
|
||||
}
|
||||
|
||||
cmd := exec.Command("/usr/bin/git", params...)
|
||||
cmd.Env = []string{
|
||||
"GIT_CEILING_DIRECTORIES=" + e.GitPath,
|
||||
"GIT_CONFIG_GLOBAL=/dev/null",
|
||||
"GIT_AUTHOR_NAME=" + e.GitCommiter,
|
||||
"EMAIL=not@exist@src.opensuse.org",
|
||||
"GIT_LFS_SKIP_SMUDGE=1",
|
||||
"GIT_SSH_COMMAND=/usr/bin/ssh -o StrictHostKeyChecking=yes",
|
||||
}
|
||||
cmd.Dir = filepath.Join(e.GitPath, cwd)
|
||||
cmd.Stdout = writeFunc(func(data []byte) (int, error) {
|
||||
e.Logger.Log("%s", data)
|
||||
return len(data), nil
|
||||
})
|
||||
cmd.Stderr = writeFunc(func(data []byte) (int, error) {
|
||||
e.Logger.LogError("%s", data)
|
||||
return len(data), nil
|
||||
})
|
||||
cmd.Stdin = nil
|
||||
|
||||
e.Log("git execute: %#v", cmd.Args)
|
||||
e.Error = cmd.Run()
|
||||
|
||||
return e
|
||||
}
|
@ -0,0 +1,171 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package activitypub
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
httptransport "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new activitypub API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
// New creates a new activitypub API client with basic auth credentials.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - user: user for basic authentication header.
|
||||
// - password: password for basic authentication header.
|
||||
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
// New creates a new activitypub API client with a bearer token for authentication.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - bearerToken: bearer token for Bearer authentication header.
|
||||
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for activitypub API
|
||||
*/
|
||||
type Client struct {
|
||||
transport runtime.ClientTransport
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption may be used to customize the behavior of Client methods.
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// This client is generated with a few options you might find useful for your swagger spec.
|
||||
//
|
||||
// Feel free to add you own set of options.
|
||||
|
||||
// WithContentType allows the client to force the Content-Type header
|
||||
// to negotiate a specific Consumer from the server.
|
||||
//
|
||||
// You may use this option to set arbitrary extensions to your MIME media type.
|
||||
func WithContentType(mime string) ClientOption {
|
||||
return func(r *runtime.ClientOperation) {
|
||||
r.ConsumesMediaTypes = []string{mime}
|
||||
}
|
||||
}
|
||||
|
||||
// WithContentTypeApplicationJSON sets the Content-Type header to "application/json".
|
||||
func WithContentTypeApplicationJSON(r *runtime.ClientOperation) {
|
||||
r.ConsumesMediaTypes = []string{"application/json"}
|
||||
}
|
||||
|
||||
// WithContentTypeTextPlain sets the Content-Type header to "text/plain".
|
||||
func WithContentTypeTextPlain(r *runtime.ClientOperation) {
|
||||
r.ConsumesMediaTypes = []string{"text/plain"}
|
||||
}
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
ActivitypubPerson(params *ActivitypubPersonParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ActivitypubPersonOK, error)
|
||||
|
||||
ActivitypubPersonInbox(params *ActivitypubPersonInboxParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ActivitypubPersonInboxNoContent, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
ActivitypubPerson returns the person actor for a user
|
||||
*/
|
||||
func (a *Client) ActivitypubPerson(params *ActivitypubPersonParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ActivitypubPersonOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewActivitypubPersonParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "activitypubPerson",
|
||||
Method: "GET",
|
||||
PathPattern: "/activitypub/user-id/{user-id}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json", "text/plain"},
|
||||
Schemes: []string{"http", "https"},
|
||||
Params: params,
|
||||
Reader: &ActivitypubPersonReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ActivitypubPersonOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for activitypubPerson: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
ActivitypubPersonInbox sends to the inbox
|
||||
*/
|
||||
func (a *Client) ActivitypubPersonInbox(params *ActivitypubPersonInboxParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ActivitypubPersonInboxNoContent, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewActivitypubPersonInboxParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "activitypubPersonInbox",
|
||||
Method: "POST",
|
||||
PathPattern: "/activitypub/user-id/{user-id}/inbox",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json", "text/plain"},
|
||||
Schemes: []string{"http", "https"},
|
||||
Params: params,
|
||||
Reader: &ActivitypubPersonInboxReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ActivitypubPersonInboxNoContent)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for activitypubPersonInbox: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client
|
||||
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||
a.transport = transport
|
||||
}
|
@ -0,0 +1,152 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package activitypub
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// NewActivitypubPersonInboxParams creates a new ActivitypubPersonInboxParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewActivitypubPersonInboxParams() *ActivitypubPersonInboxParams {
|
||||
return &ActivitypubPersonInboxParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewActivitypubPersonInboxParamsWithTimeout creates a new ActivitypubPersonInboxParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewActivitypubPersonInboxParamsWithTimeout(timeout time.Duration) *ActivitypubPersonInboxParams {
|
||||
return &ActivitypubPersonInboxParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewActivitypubPersonInboxParamsWithContext creates a new ActivitypubPersonInboxParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewActivitypubPersonInboxParamsWithContext(ctx context.Context) *ActivitypubPersonInboxParams {
|
||||
return &ActivitypubPersonInboxParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewActivitypubPersonInboxParamsWithHTTPClient creates a new ActivitypubPersonInboxParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewActivitypubPersonInboxParamsWithHTTPClient(client *http.Client) *ActivitypubPersonInboxParams {
|
||||
return &ActivitypubPersonInboxParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ActivitypubPersonInboxParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the activitypub person inbox operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ActivitypubPersonInboxParams struct {
|
||||
|
||||
/* UserID.
|
||||
|
||||
user ID of the user
|
||||
*/
|
||||
UserID int64
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the activitypub person inbox params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ActivitypubPersonInboxParams) WithDefaults() *ActivitypubPersonInboxParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the activitypub person inbox params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ActivitypubPersonInboxParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the activitypub person inbox params
|
||||
func (o *ActivitypubPersonInboxParams) WithTimeout(timeout time.Duration) *ActivitypubPersonInboxParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the activitypub person inbox params
|
||||
func (o *ActivitypubPersonInboxParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the activitypub person inbox params
|
||||
func (o *ActivitypubPersonInboxParams) WithContext(ctx context.Context) *ActivitypubPersonInboxParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the activitypub person inbox params
|
||||
func (o *ActivitypubPersonInboxParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the activitypub person inbox params
|
||||
func (o *ActivitypubPersonInboxParams) WithHTTPClient(client *http.Client) *ActivitypubPersonInboxParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the activitypub person inbox params
|
||||
func (o *ActivitypubPersonInboxParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithUserID adds the userID to the activitypub person inbox params
|
||||
func (o *ActivitypubPersonInboxParams) WithUserID(userID int64) *ActivitypubPersonInboxParams {
|
||||
o.SetUserID(userID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetUserID adds the userId to the activitypub person inbox params
|
||||
func (o *ActivitypubPersonInboxParams) SetUserID(userID int64) {
|
||||
o.UserID = userID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ActivitypubPersonInboxParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param user-id
|
||||
if err := r.SetPathParam("user-id", swag.FormatInt64(o.UserID)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package activitypub
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// ActivitypubPersonInboxReader is a Reader for the ActivitypubPersonInbox structure.
|
||||
type ActivitypubPersonInboxReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ActivitypubPersonInboxReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 204:
|
||||
result := NewActivitypubPersonInboxNoContent()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[POST /activitypub/user-id/{user-id}/inbox] activitypubPersonInbox", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewActivitypubPersonInboxNoContent creates a ActivitypubPersonInboxNoContent with default headers values
|
||||
func NewActivitypubPersonInboxNoContent() *ActivitypubPersonInboxNoContent {
|
||||
return &ActivitypubPersonInboxNoContent{}
|
||||
}
|
||||
|
||||
/*
|
||||
ActivitypubPersonInboxNoContent describes a response with status code 204, with default header values.
|
||||
|
||||
APIEmpty is an empty response
|
||||
*/
|
||||
type ActivitypubPersonInboxNoContent struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this activitypub person inbox no content response has a 2xx status code
|
||||
func (o *ActivitypubPersonInboxNoContent) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this activitypub person inbox no content response has a 3xx status code
|
||||
func (o *ActivitypubPersonInboxNoContent) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this activitypub person inbox no content response has a 4xx status code
|
||||
func (o *ActivitypubPersonInboxNoContent) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this activitypub person inbox no content response has a 5xx status code
|
||||
func (o *ActivitypubPersonInboxNoContent) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this activitypub person inbox no content response a status code equal to that given
|
||||
func (o *ActivitypubPersonInboxNoContent) IsCode(code int) bool {
|
||||
return code == 204
|
||||
}
|
||||
|
||||
// Code gets the status code for the activitypub person inbox no content response
|
||||
func (o *ActivitypubPersonInboxNoContent) Code() int {
|
||||
return 204
|
||||
}
|
||||
|
||||
func (o *ActivitypubPersonInboxNoContent) Error() string {
|
||||
return fmt.Sprintf("[POST /activitypub/user-id/{user-id}/inbox][%d] activitypubPersonInboxNoContent", 204)
|
||||
}
|
||||
|
||||
func (o *ActivitypubPersonInboxNoContent) String() string {
|
||||
return fmt.Sprintf("[POST /activitypub/user-id/{user-id}/inbox][%d] activitypubPersonInboxNoContent", 204)
|
||||
}
|
||||
|
||||
func (o *ActivitypubPersonInboxNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,152 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package activitypub
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// NewActivitypubPersonParams creates a new ActivitypubPersonParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewActivitypubPersonParams() *ActivitypubPersonParams {
|
||||
return &ActivitypubPersonParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewActivitypubPersonParamsWithTimeout creates a new ActivitypubPersonParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewActivitypubPersonParamsWithTimeout(timeout time.Duration) *ActivitypubPersonParams {
|
||||
return &ActivitypubPersonParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewActivitypubPersonParamsWithContext creates a new ActivitypubPersonParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewActivitypubPersonParamsWithContext(ctx context.Context) *ActivitypubPersonParams {
|
||||
return &ActivitypubPersonParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewActivitypubPersonParamsWithHTTPClient creates a new ActivitypubPersonParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewActivitypubPersonParamsWithHTTPClient(client *http.Client) *ActivitypubPersonParams {
|
||||
return &ActivitypubPersonParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ActivitypubPersonParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the activitypub person operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ActivitypubPersonParams struct {
|
||||
|
||||
/* UserID.
|
||||
|
||||
user ID of the user
|
||||
*/
|
||||
UserID int64
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the activitypub person params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ActivitypubPersonParams) WithDefaults() *ActivitypubPersonParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the activitypub person params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ActivitypubPersonParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the activitypub person params
|
||||
func (o *ActivitypubPersonParams) WithTimeout(timeout time.Duration) *ActivitypubPersonParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the activitypub person params
|
||||
func (o *ActivitypubPersonParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the activitypub person params
|
||||
func (o *ActivitypubPersonParams) WithContext(ctx context.Context) *ActivitypubPersonParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the activitypub person params
|
||||
func (o *ActivitypubPersonParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the activitypub person params
|
||||
func (o *ActivitypubPersonParams) WithHTTPClient(client *http.Client) *ActivitypubPersonParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the activitypub person params
|
||||
func (o *ActivitypubPersonParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithUserID adds the userID to the activitypub person params
|
||||
func (o *ActivitypubPersonParams) WithUserID(userID int64) *ActivitypubPersonParams {
|
||||
o.SetUserID(userID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetUserID adds the userId to the activitypub person params
|
||||
func (o *ActivitypubPersonParams) SetUserID(userID int64) {
|
||||
o.UserID = userID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ActivitypubPersonParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param user-id
|
||||
if err := r.SetPathParam("user-id", swag.FormatInt64(o.UserID)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package activitypub
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"src.opensuse.org/autogits/common/gitea-generated/models"
|
||||
)
|
||||
|
||||
// ActivitypubPersonReader is a Reader for the ActivitypubPerson structure.
|
||||
type ActivitypubPersonReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ActivitypubPersonReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewActivitypubPersonOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[GET /activitypub/user-id/{user-id}] activitypubPerson", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewActivitypubPersonOK creates a ActivitypubPersonOK with default headers values
|
||||
func NewActivitypubPersonOK() *ActivitypubPersonOK {
|
||||
return &ActivitypubPersonOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ActivitypubPersonOK describes a response with status code 200, with default header values.
|
||||
|
||||
ActivityPub
|
||||
*/
|
||||
type ActivitypubPersonOK struct {
|
||||
Payload *models.ActivityPub
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this activitypub person o k response has a 2xx status code
|
||||
func (o *ActivitypubPersonOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this activitypub person o k response has a 3xx status code
|
||||
func (o *ActivitypubPersonOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this activitypub person o k response has a 4xx status code
|
||||
func (o *ActivitypubPersonOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this activitypub person o k response has a 5xx status code
|
||||
func (o *ActivitypubPersonOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this activitypub person o k response a status code equal to that given
|
||||
func (o *ActivitypubPersonOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the activitypub person o k response
|
||||
func (o *ActivitypubPersonOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ActivitypubPersonOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /activitypub/user-id/{user-id}][%d] activitypubPersonOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ActivitypubPersonOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /activitypub/user-id/{user-id}][%d] activitypubPersonOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ActivitypubPersonOK) GetPayload() *models.ActivityPub {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ActivitypubPersonOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.ActivityPub)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,172 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"src.opensuse.org/autogits/common/gitea-generated/models"
|
||||
)
|
||||
|
||||
// NewAdminAddUserBadgesParams creates a new AdminAddUserBadgesParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewAdminAddUserBadgesParams() *AdminAddUserBadgesParams {
|
||||
return &AdminAddUserBadgesParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminAddUserBadgesParamsWithTimeout creates a new AdminAddUserBadgesParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewAdminAddUserBadgesParamsWithTimeout(timeout time.Duration) *AdminAddUserBadgesParams {
|
||||
return &AdminAddUserBadgesParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminAddUserBadgesParamsWithContext creates a new AdminAddUserBadgesParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewAdminAddUserBadgesParamsWithContext(ctx context.Context) *AdminAddUserBadgesParams {
|
||||
return &AdminAddUserBadgesParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminAddUserBadgesParamsWithHTTPClient creates a new AdminAddUserBadgesParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewAdminAddUserBadgesParamsWithHTTPClient(client *http.Client) *AdminAddUserBadgesParams {
|
||||
return &AdminAddUserBadgesParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminAddUserBadgesParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the admin add user badges operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type AdminAddUserBadgesParams struct {
|
||||
|
||||
// Body.
|
||||
Body *models.UserBadgeOption
|
||||
|
||||
/* Username.
|
||||
|
||||
username of user
|
||||
*/
|
||||
Username string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the admin add user badges params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminAddUserBadgesParams) WithDefaults() *AdminAddUserBadgesParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the admin add user badges params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminAddUserBadgesParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the admin add user badges params
|
||||
func (o *AdminAddUserBadgesParams) WithTimeout(timeout time.Duration) *AdminAddUserBadgesParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the admin add user badges params
|
||||
func (o *AdminAddUserBadgesParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the admin add user badges params
|
||||
func (o *AdminAddUserBadgesParams) WithContext(ctx context.Context) *AdminAddUserBadgesParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the admin add user badges params
|
||||
func (o *AdminAddUserBadgesParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the admin add user badges params
|
||||
func (o *AdminAddUserBadgesParams) WithHTTPClient(client *http.Client) *AdminAddUserBadgesParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the admin add user badges params
|
||||
func (o *AdminAddUserBadgesParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the admin add user badges params
|
||||
func (o *AdminAddUserBadgesParams) WithBody(body *models.UserBadgeOption) *AdminAddUserBadgesParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the admin add user badges params
|
||||
func (o *AdminAddUserBadgesParams) SetBody(body *models.UserBadgeOption) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WithUsername adds the username to the admin add user badges params
|
||||
func (o *AdminAddUserBadgesParams) WithUsername(username string) *AdminAddUserBadgesParams {
|
||||
o.SetUsername(username)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetUsername adds the username to the admin add user badges params
|
||||
func (o *AdminAddUserBadgesParams) SetUsername(username string) {
|
||||
o.Username = username
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *AdminAddUserBadgesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// path param username
|
||||
if err := r.SetPathParam("username", o.Username); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,166 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// AdminAddUserBadgesReader is a Reader for the AdminAddUserBadges structure.
|
||||
type AdminAddUserBadgesReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *AdminAddUserBadgesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 204:
|
||||
result := NewAdminAddUserBadgesNoContent()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 403:
|
||||
result := NewAdminAddUserBadgesForbidden()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[POST /admin/users/{username}/badges] adminAddUserBadges", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminAddUserBadgesNoContent creates a AdminAddUserBadgesNoContent with default headers values
|
||||
func NewAdminAddUserBadgesNoContent() *AdminAddUserBadgesNoContent {
|
||||
return &AdminAddUserBadgesNoContent{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminAddUserBadgesNoContent describes a response with status code 204, with default header values.
|
||||
|
||||
APIEmpty is an empty response
|
||||
*/
|
||||
type AdminAddUserBadgesNoContent struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin add user badges no content response has a 2xx status code
|
||||
func (o *AdminAddUserBadgesNoContent) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin add user badges no content response has a 3xx status code
|
||||
func (o *AdminAddUserBadgesNoContent) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin add user badges no content response has a 4xx status code
|
||||
func (o *AdminAddUserBadgesNoContent) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin add user badges no content response has a 5xx status code
|
||||
func (o *AdminAddUserBadgesNoContent) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin add user badges no content response a status code equal to that given
|
||||
func (o *AdminAddUserBadgesNoContent) IsCode(code int) bool {
|
||||
return code == 204
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin add user badges no content response
|
||||
func (o *AdminAddUserBadgesNoContent) Code() int {
|
||||
return 204
|
||||
}
|
||||
|
||||
func (o *AdminAddUserBadgesNoContent) Error() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/badges][%d] adminAddUserBadgesNoContent", 204)
|
||||
}
|
||||
|
||||
func (o *AdminAddUserBadgesNoContent) String() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/badges][%d] adminAddUserBadgesNoContent", 204)
|
||||
}
|
||||
|
||||
func (o *AdminAddUserBadgesNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminAddUserBadgesForbidden creates a AdminAddUserBadgesForbidden with default headers values
|
||||
func NewAdminAddUserBadgesForbidden() *AdminAddUserBadgesForbidden {
|
||||
return &AdminAddUserBadgesForbidden{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminAddUserBadgesForbidden describes a response with status code 403, with default header values.
|
||||
|
||||
APIForbiddenError is a forbidden error response
|
||||
*/
|
||||
type AdminAddUserBadgesForbidden struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin add user badges forbidden response has a 2xx status code
|
||||
func (o *AdminAddUserBadgesForbidden) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin add user badges forbidden response has a 3xx status code
|
||||
func (o *AdminAddUserBadgesForbidden) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin add user badges forbidden response has a 4xx status code
|
||||
func (o *AdminAddUserBadgesForbidden) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin add user badges forbidden response has a 5xx status code
|
||||
func (o *AdminAddUserBadgesForbidden) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin add user badges forbidden response a status code equal to that given
|
||||
func (o *AdminAddUserBadgesForbidden) IsCode(code int) bool {
|
||||
return code == 403
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin add user badges forbidden response
|
||||
func (o *AdminAddUserBadgesForbidden) Code() int {
|
||||
return 403
|
||||
}
|
||||
|
||||
func (o *AdminAddUserBadgesForbidden) Error() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/badges][%d] adminAddUserBadgesForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminAddUserBadgesForbidden) String() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/badges][%d] adminAddUserBadgesForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminAddUserBadgesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,173 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewAdminAdoptRepositoryParams creates a new AdminAdoptRepositoryParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewAdminAdoptRepositoryParams() *AdminAdoptRepositoryParams {
|
||||
return &AdminAdoptRepositoryParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminAdoptRepositoryParamsWithTimeout creates a new AdminAdoptRepositoryParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewAdminAdoptRepositoryParamsWithTimeout(timeout time.Duration) *AdminAdoptRepositoryParams {
|
||||
return &AdminAdoptRepositoryParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminAdoptRepositoryParamsWithContext creates a new AdminAdoptRepositoryParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewAdminAdoptRepositoryParamsWithContext(ctx context.Context) *AdminAdoptRepositoryParams {
|
||||
return &AdminAdoptRepositoryParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminAdoptRepositoryParamsWithHTTPClient creates a new AdminAdoptRepositoryParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewAdminAdoptRepositoryParamsWithHTTPClient(client *http.Client) *AdminAdoptRepositoryParams {
|
||||
return &AdminAdoptRepositoryParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminAdoptRepositoryParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the admin adopt repository operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type AdminAdoptRepositoryParams struct {
|
||||
|
||||
/* Owner.
|
||||
|
||||
owner of the repo
|
||||
*/
|
||||
Owner string
|
||||
|
||||
/* Repo.
|
||||
|
||||
name of the repo
|
||||
*/
|
||||
Repo string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the admin adopt repository params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminAdoptRepositoryParams) WithDefaults() *AdminAdoptRepositoryParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the admin adopt repository params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminAdoptRepositoryParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the admin adopt repository params
|
||||
func (o *AdminAdoptRepositoryParams) WithTimeout(timeout time.Duration) *AdminAdoptRepositoryParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the admin adopt repository params
|
||||
func (o *AdminAdoptRepositoryParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the admin adopt repository params
|
||||
func (o *AdminAdoptRepositoryParams) WithContext(ctx context.Context) *AdminAdoptRepositoryParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the admin adopt repository params
|
||||
func (o *AdminAdoptRepositoryParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the admin adopt repository params
|
||||
func (o *AdminAdoptRepositoryParams) WithHTTPClient(client *http.Client) *AdminAdoptRepositoryParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the admin adopt repository params
|
||||
func (o *AdminAdoptRepositoryParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOwner adds the owner to the admin adopt repository params
|
||||
func (o *AdminAdoptRepositoryParams) WithOwner(owner string) *AdminAdoptRepositoryParams {
|
||||
o.SetOwner(owner)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOwner adds the owner to the admin adopt repository params
|
||||
func (o *AdminAdoptRepositoryParams) SetOwner(owner string) {
|
||||
o.Owner = owner
|
||||
}
|
||||
|
||||
// WithRepo adds the repo to the admin adopt repository params
|
||||
func (o *AdminAdoptRepositoryParams) WithRepo(repo string) *AdminAdoptRepositoryParams {
|
||||
o.SetRepo(repo)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetRepo adds the repo to the admin adopt repository params
|
||||
func (o *AdminAdoptRepositoryParams) SetRepo(repo string) {
|
||||
o.Repo = repo
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *AdminAdoptRepositoryParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param owner
|
||||
if err := r.SetPathParam("owner", o.Owner); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// path param repo
|
||||
if err := r.SetPathParam("repo", o.Repo); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,228 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// AdminAdoptRepositoryReader is a Reader for the AdminAdoptRepository structure.
|
||||
type AdminAdoptRepositoryReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *AdminAdoptRepositoryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 204:
|
||||
result := NewAdminAdoptRepositoryNoContent()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 403:
|
||||
result := NewAdminAdoptRepositoryForbidden()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 404:
|
||||
result := NewAdminAdoptRepositoryNotFound()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[POST /admin/unadopted/{owner}/{repo}] adminAdoptRepository", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminAdoptRepositoryNoContent creates a AdminAdoptRepositoryNoContent with default headers values
|
||||
func NewAdminAdoptRepositoryNoContent() *AdminAdoptRepositoryNoContent {
|
||||
return &AdminAdoptRepositoryNoContent{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminAdoptRepositoryNoContent describes a response with status code 204, with default header values.
|
||||
|
||||
APIEmpty is an empty response
|
||||
*/
|
||||
type AdminAdoptRepositoryNoContent struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin adopt repository no content response has a 2xx status code
|
||||
func (o *AdminAdoptRepositoryNoContent) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin adopt repository no content response has a 3xx status code
|
||||
func (o *AdminAdoptRepositoryNoContent) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin adopt repository no content response has a 4xx status code
|
||||
func (o *AdminAdoptRepositoryNoContent) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin adopt repository no content response has a 5xx status code
|
||||
func (o *AdminAdoptRepositoryNoContent) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin adopt repository no content response a status code equal to that given
|
||||
func (o *AdminAdoptRepositoryNoContent) IsCode(code int) bool {
|
||||
return code == 204
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin adopt repository no content response
|
||||
func (o *AdminAdoptRepositoryNoContent) Code() int {
|
||||
return 204
|
||||
}
|
||||
|
||||
func (o *AdminAdoptRepositoryNoContent) Error() string {
|
||||
return fmt.Sprintf("[POST /admin/unadopted/{owner}/{repo}][%d] adminAdoptRepositoryNoContent", 204)
|
||||
}
|
||||
|
||||
func (o *AdminAdoptRepositoryNoContent) String() string {
|
||||
return fmt.Sprintf("[POST /admin/unadopted/{owner}/{repo}][%d] adminAdoptRepositoryNoContent", 204)
|
||||
}
|
||||
|
||||
func (o *AdminAdoptRepositoryNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminAdoptRepositoryForbidden creates a AdminAdoptRepositoryForbidden with default headers values
|
||||
func NewAdminAdoptRepositoryForbidden() *AdminAdoptRepositoryForbidden {
|
||||
return &AdminAdoptRepositoryForbidden{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminAdoptRepositoryForbidden describes a response with status code 403, with default header values.
|
||||
|
||||
APIForbiddenError is a forbidden error response
|
||||
*/
|
||||
type AdminAdoptRepositoryForbidden struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin adopt repository forbidden response has a 2xx status code
|
||||
func (o *AdminAdoptRepositoryForbidden) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin adopt repository forbidden response has a 3xx status code
|
||||
func (o *AdminAdoptRepositoryForbidden) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin adopt repository forbidden response has a 4xx status code
|
||||
func (o *AdminAdoptRepositoryForbidden) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin adopt repository forbidden response has a 5xx status code
|
||||
func (o *AdminAdoptRepositoryForbidden) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin adopt repository forbidden response a status code equal to that given
|
||||
func (o *AdminAdoptRepositoryForbidden) IsCode(code int) bool {
|
||||
return code == 403
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin adopt repository forbidden response
|
||||
func (o *AdminAdoptRepositoryForbidden) Code() int {
|
||||
return 403
|
||||
}
|
||||
|
||||
func (o *AdminAdoptRepositoryForbidden) Error() string {
|
||||
return fmt.Sprintf("[POST /admin/unadopted/{owner}/{repo}][%d] adminAdoptRepositoryForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminAdoptRepositoryForbidden) String() string {
|
||||
return fmt.Sprintf("[POST /admin/unadopted/{owner}/{repo}][%d] adminAdoptRepositoryForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminAdoptRepositoryForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminAdoptRepositoryNotFound creates a AdminAdoptRepositoryNotFound with default headers values
|
||||
func NewAdminAdoptRepositoryNotFound() *AdminAdoptRepositoryNotFound {
|
||||
return &AdminAdoptRepositoryNotFound{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminAdoptRepositoryNotFound describes a response with status code 404, with default header values.
|
||||
|
||||
APINotFound is a not found empty response
|
||||
*/
|
||||
type AdminAdoptRepositoryNotFound struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin adopt repository not found response has a 2xx status code
|
||||
func (o *AdminAdoptRepositoryNotFound) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin adopt repository not found response has a 3xx status code
|
||||
func (o *AdminAdoptRepositoryNotFound) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin adopt repository not found response has a 4xx status code
|
||||
func (o *AdminAdoptRepositoryNotFound) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin adopt repository not found response has a 5xx status code
|
||||
func (o *AdminAdoptRepositoryNotFound) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin adopt repository not found response a status code equal to that given
|
||||
func (o *AdminAdoptRepositoryNotFound) IsCode(code int) bool {
|
||||
return code == 404
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin adopt repository not found response
|
||||
func (o *AdminAdoptRepositoryNotFound) Code() int {
|
||||
return 404
|
||||
}
|
||||
|
||||
func (o *AdminAdoptRepositoryNotFound) Error() string {
|
||||
return fmt.Sprintf("[POST /admin/unadopted/{owner}/{repo}][%d] adminAdoptRepositoryNotFound", 404)
|
||||
}
|
||||
|
||||
func (o *AdminAdoptRepositoryNotFound) String() string {
|
||||
return fmt.Sprintf("[POST /admin/unadopted/{owner}/{repo}][%d] adminAdoptRepositoryNotFound", 404)
|
||||
}
|
||||
|
||||
func (o *AdminAdoptRepositoryNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
1155
bots-common/gitea-generated/client/admin/admin_client.go
Normal file
1155
bots-common/gitea-generated/client/admin/admin_client.go
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,150 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"src.opensuse.org/autogits/common/gitea-generated/models"
|
||||
)
|
||||
|
||||
// NewAdminCreateHookParams creates a new AdminCreateHookParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewAdminCreateHookParams() *AdminCreateHookParams {
|
||||
return &AdminCreateHookParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCreateHookParamsWithTimeout creates a new AdminCreateHookParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewAdminCreateHookParamsWithTimeout(timeout time.Duration) *AdminCreateHookParams {
|
||||
return &AdminCreateHookParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCreateHookParamsWithContext creates a new AdminCreateHookParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewAdminCreateHookParamsWithContext(ctx context.Context) *AdminCreateHookParams {
|
||||
return &AdminCreateHookParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCreateHookParamsWithHTTPClient creates a new AdminCreateHookParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewAdminCreateHookParamsWithHTTPClient(client *http.Client) *AdminCreateHookParams {
|
||||
return &AdminCreateHookParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreateHookParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the admin create hook operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type AdminCreateHookParams struct {
|
||||
|
||||
// Body.
|
||||
Body *models.CreateHookOption
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the admin create hook params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminCreateHookParams) WithDefaults() *AdminCreateHookParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the admin create hook params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminCreateHookParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the admin create hook params
|
||||
func (o *AdminCreateHookParams) WithTimeout(timeout time.Duration) *AdminCreateHookParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the admin create hook params
|
||||
func (o *AdminCreateHookParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the admin create hook params
|
||||
func (o *AdminCreateHookParams) WithContext(ctx context.Context) *AdminCreateHookParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the admin create hook params
|
||||
func (o *AdminCreateHookParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the admin create hook params
|
||||
func (o *AdminCreateHookParams) WithHTTPClient(client *http.Client) *AdminCreateHookParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the admin create hook params
|
||||
func (o *AdminCreateHookParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the admin create hook params
|
||||
func (o *AdminCreateHookParams) WithBody(body *models.CreateHookOption) *AdminCreateHookParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the admin create hook params
|
||||
func (o *AdminCreateHookParams) SetBody(body *models.CreateHookOption) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *AdminCreateHookParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"src.opensuse.org/autogits/common/gitea-generated/models"
|
||||
)
|
||||
|
||||
// AdminCreateHookReader is a Reader for the AdminCreateHook structure.
|
||||
type AdminCreateHookReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *AdminCreateHookReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 201:
|
||||
result := NewAdminCreateHookCreated()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[POST /admin/hooks] adminCreateHook", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCreateHookCreated creates a AdminCreateHookCreated with default headers values
|
||||
func NewAdminCreateHookCreated() *AdminCreateHookCreated {
|
||||
return &AdminCreateHookCreated{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreateHookCreated describes a response with status code 201, with default header values.
|
||||
|
||||
Hook
|
||||
*/
|
||||
type AdminCreateHookCreated struct {
|
||||
Payload *models.Hook
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin create hook created response has a 2xx status code
|
||||
func (o *AdminCreateHookCreated) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin create hook created response has a 3xx status code
|
||||
func (o *AdminCreateHookCreated) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin create hook created response has a 4xx status code
|
||||
func (o *AdminCreateHookCreated) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin create hook created response has a 5xx status code
|
||||
func (o *AdminCreateHookCreated) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin create hook created response a status code equal to that given
|
||||
func (o *AdminCreateHookCreated) IsCode(code int) bool {
|
||||
return code == 201
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin create hook created response
|
||||
func (o *AdminCreateHookCreated) Code() int {
|
||||
return 201
|
||||
}
|
||||
|
||||
func (o *AdminCreateHookCreated) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /admin/hooks][%d] adminCreateHookCreated %s", 201, payload)
|
||||
}
|
||||
|
||||
func (o *AdminCreateHookCreated) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /admin/hooks][%d] adminCreateHookCreated %s", 201, payload)
|
||||
}
|
||||
|
||||
func (o *AdminCreateHookCreated) GetPayload() *models.Hook {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *AdminCreateHookCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.Hook)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,172 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"src.opensuse.org/autogits/common/gitea-generated/models"
|
||||
)
|
||||
|
||||
// NewAdminCreateOrgParams creates a new AdminCreateOrgParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewAdminCreateOrgParams() *AdminCreateOrgParams {
|
||||
return &AdminCreateOrgParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCreateOrgParamsWithTimeout creates a new AdminCreateOrgParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewAdminCreateOrgParamsWithTimeout(timeout time.Duration) *AdminCreateOrgParams {
|
||||
return &AdminCreateOrgParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCreateOrgParamsWithContext creates a new AdminCreateOrgParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewAdminCreateOrgParamsWithContext(ctx context.Context) *AdminCreateOrgParams {
|
||||
return &AdminCreateOrgParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCreateOrgParamsWithHTTPClient creates a new AdminCreateOrgParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewAdminCreateOrgParamsWithHTTPClient(client *http.Client) *AdminCreateOrgParams {
|
||||
return &AdminCreateOrgParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreateOrgParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the admin create org operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type AdminCreateOrgParams struct {
|
||||
|
||||
// Organization.
|
||||
Organization *models.CreateOrgOption
|
||||
|
||||
/* Username.
|
||||
|
||||
username of the user that will own the created organization
|
||||
*/
|
||||
Username string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the admin create org params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminCreateOrgParams) WithDefaults() *AdminCreateOrgParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the admin create org params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminCreateOrgParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the admin create org params
|
||||
func (o *AdminCreateOrgParams) WithTimeout(timeout time.Duration) *AdminCreateOrgParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the admin create org params
|
||||
func (o *AdminCreateOrgParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the admin create org params
|
||||
func (o *AdminCreateOrgParams) WithContext(ctx context.Context) *AdminCreateOrgParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the admin create org params
|
||||
func (o *AdminCreateOrgParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the admin create org params
|
||||
func (o *AdminCreateOrgParams) WithHTTPClient(client *http.Client) *AdminCreateOrgParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the admin create org params
|
||||
func (o *AdminCreateOrgParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOrganization adds the organization to the admin create org params
|
||||
func (o *AdminCreateOrgParams) WithOrganization(organization *models.CreateOrgOption) *AdminCreateOrgParams {
|
||||
o.SetOrganization(organization)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOrganization adds the organization to the admin create org params
|
||||
func (o *AdminCreateOrgParams) SetOrganization(organization *models.CreateOrgOption) {
|
||||
o.Organization = organization
|
||||
}
|
||||
|
||||
// WithUsername adds the username to the admin create org params
|
||||
func (o *AdminCreateOrgParams) WithUsername(username string) *AdminCreateOrgParams {
|
||||
o.SetUsername(username)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetUsername adds the username to the admin create org params
|
||||
func (o *AdminCreateOrgParams) SetUsername(username string) {
|
||||
o.Username = username
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *AdminCreateOrgParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Organization != nil {
|
||||
if err := r.SetBodyParam(o.Organization); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// path param username
|
||||
if err := r.SetPathParam("username", o.Username); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,262 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"src.opensuse.org/autogits/common/gitea-generated/models"
|
||||
)
|
||||
|
||||
// AdminCreateOrgReader is a Reader for the AdminCreateOrg structure.
|
||||
type AdminCreateOrgReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *AdminCreateOrgReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 201:
|
||||
result := NewAdminCreateOrgCreated()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 403:
|
||||
result := NewAdminCreateOrgForbidden()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 422:
|
||||
result := NewAdminCreateOrgUnprocessableEntity()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[POST /admin/users/{username}/orgs] adminCreateOrg", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCreateOrgCreated creates a AdminCreateOrgCreated with default headers values
|
||||
func NewAdminCreateOrgCreated() *AdminCreateOrgCreated {
|
||||
return &AdminCreateOrgCreated{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreateOrgCreated describes a response with status code 201, with default header values.
|
||||
|
||||
Organization
|
||||
*/
|
||||
type AdminCreateOrgCreated struct {
|
||||
Payload *models.Organization
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin create org created response has a 2xx status code
|
||||
func (o *AdminCreateOrgCreated) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin create org created response has a 3xx status code
|
||||
func (o *AdminCreateOrgCreated) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin create org created response has a 4xx status code
|
||||
func (o *AdminCreateOrgCreated) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin create org created response has a 5xx status code
|
||||
func (o *AdminCreateOrgCreated) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin create org created response a status code equal to that given
|
||||
func (o *AdminCreateOrgCreated) IsCode(code int) bool {
|
||||
return code == 201
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin create org created response
|
||||
func (o *AdminCreateOrgCreated) Code() int {
|
||||
return 201
|
||||
}
|
||||
|
||||
func (o *AdminCreateOrgCreated) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/orgs][%d] adminCreateOrgCreated %s", 201, payload)
|
||||
}
|
||||
|
||||
func (o *AdminCreateOrgCreated) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/orgs][%d] adminCreateOrgCreated %s", 201, payload)
|
||||
}
|
||||
|
||||
func (o *AdminCreateOrgCreated) GetPayload() *models.Organization {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *AdminCreateOrgCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.Organization)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminCreateOrgForbidden creates a AdminCreateOrgForbidden with default headers values
|
||||
func NewAdminCreateOrgForbidden() *AdminCreateOrgForbidden {
|
||||
return &AdminCreateOrgForbidden{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreateOrgForbidden describes a response with status code 403, with default header values.
|
||||
|
||||
APIForbiddenError is a forbidden error response
|
||||
*/
|
||||
type AdminCreateOrgForbidden struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin create org forbidden response has a 2xx status code
|
||||
func (o *AdminCreateOrgForbidden) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin create org forbidden response has a 3xx status code
|
||||
func (o *AdminCreateOrgForbidden) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin create org forbidden response has a 4xx status code
|
||||
func (o *AdminCreateOrgForbidden) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin create org forbidden response has a 5xx status code
|
||||
func (o *AdminCreateOrgForbidden) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin create org forbidden response a status code equal to that given
|
||||
func (o *AdminCreateOrgForbidden) IsCode(code int) bool {
|
||||
return code == 403
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin create org forbidden response
|
||||
func (o *AdminCreateOrgForbidden) Code() int {
|
||||
return 403
|
||||
}
|
||||
|
||||
func (o *AdminCreateOrgForbidden) Error() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/orgs][%d] adminCreateOrgForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminCreateOrgForbidden) String() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/orgs][%d] adminCreateOrgForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminCreateOrgForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminCreateOrgUnprocessableEntity creates a AdminCreateOrgUnprocessableEntity with default headers values
|
||||
func NewAdminCreateOrgUnprocessableEntity() *AdminCreateOrgUnprocessableEntity {
|
||||
return &AdminCreateOrgUnprocessableEntity{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreateOrgUnprocessableEntity describes a response with status code 422, with default header values.
|
||||
|
||||
APIValidationError is error format response related to input validation
|
||||
*/
|
||||
type AdminCreateOrgUnprocessableEntity struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin create org unprocessable entity response has a 2xx status code
|
||||
func (o *AdminCreateOrgUnprocessableEntity) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin create org unprocessable entity response has a 3xx status code
|
||||
func (o *AdminCreateOrgUnprocessableEntity) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin create org unprocessable entity response has a 4xx status code
|
||||
func (o *AdminCreateOrgUnprocessableEntity) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin create org unprocessable entity response has a 5xx status code
|
||||
func (o *AdminCreateOrgUnprocessableEntity) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin create org unprocessable entity response a status code equal to that given
|
||||
func (o *AdminCreateOrgUnprocessableEntity) IsCode(code int) bool {
|
||||
return code == 422
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin create org unprocessable entity response
|
||||
func (o *AdminCreateOrgUnprocessableEntity) Code() int {
|
||||
return 422
|
||||
}
|
||||
|
||||
func (o *AdminCreateOrgUnprocessableEntity) Error() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/orgs][%d] adminCreateOrgUnprocessableEntity", 422)
|
||||
}
|
||||
|
||||
func (o *AdminCreateOrgUnprocessableEntity) String() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/orgs][%d] adminCreateOrgUnprocessableEntity", 422)
|
||||
}
|
||||
|
||||
func (o *AdminCreateOrgUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,172 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"src.opensuse.org/autogits/common/gitea-generated/models"
|
||||
)
|
||||
|
||||
// NewAdminCreatePublicKeyParams creates a new AdminCreatePublicKeyParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewAdminCreatePublicKeyParams() *AdminCreatePublicKeyParams {
|
||||
return &AdminCreatePublicKeyParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCreatePublicKeyParamsWithTimeout creates a new AdminCreatePublicKeyParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewAdminCreatePublicKeyParamsWithTimeout(timeout time.Duration) *AdminCreatePublicKeyParams {
|
||||
return &AdminCreatePublicKeyParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCreatePublicKeyParamsWithContext creates a new AdminCreatePublicKeyParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewAdminCreatePublicKeyParamsWithContext(ctx context.Context) *AdminCreatePublicKeyParams {
|
||||
return &AdminCreatePublicKeyParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCreatePublicKeyParamsWithHTTPClient creates a new AdminCreatePublicKeyParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewAdminCreatePublicKeyParamsWithHTTPClient(client *http.Client) *AdminCreatePublicKeyParams {
|
||||
return &AdminCreatePublicKeyParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreatePublicKeyParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the admin create public key operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type AdminCreatePublicKeyParams struct {
|
||||
|
||||
// Key.
|
||||
Key *models.CreateKeyOption
|
||||
|
||||
/* Username.
|
||||
|
||||
username of the user
|
||||
*/
|
||||
Username string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the admin create public key params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminCreatePublicKeyParams) WithDefaults() *AdminCreatePublicKeyParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the admin create public key params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminCreatePublicKeyParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the admin create public key params
|
||||
func (o *AdminCreatePublicKeyParams) WithTimeout(timeout time.Duration) *AdminCreatePublicKeyParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the admin create public key params
|
||||
func (o *AdminCreatePublicKeyParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the admin create public key params
|
||||
func (o *AdminCreatePublicKeyParams) WithContext(ctx context.Context) *AdminCreatePublicKeyParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the admin create public key params
|
||||
func (o *AdminCreatePublicKeyParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the admin create public key params
|
||||
func (o *AdminCreatePublicKeyParams) WithHTTPClient(client *http.Client) *AdminCreatePublicKeyParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the admin create public key params
|
||||
func (o *AdminCreatePublicKeyParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithKey adds the key to the admin create public key params
|
||||
func (o *AdminCreatePublicKeyParams) WithKey(key *models.CreateKeyOption) *AdminCreatePublicKeyParams {
|
||||
o.SetKey(key)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetKey adds the key to the admin create public key params
|
||||
func (o *AdminCreatePublicKeyParams) SetKey(key *models.CreateKeyOption) {
|
||||
o.Key = key
|
||||
}
|
||||
|
||||
// WithUsername adds the username to the admin create public key params
|
||||
func (o *AdminCreatePublicKeyParams) WithUsername(username string) *AdminCreatePublicKeyParams {
|
||||
o.SetUsername(username)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetUsername adds the username to the admin create public key params
|
||||
func (o *AdminCreatePublicKeyParams) SetUsername(username string) {
|
||||
o.Username = username
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *AdminCreatePublicKeyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Key != nil {
|
||||
if err := r.SetBodyParam(o.Key); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// path param username
|
||||
if err := r.SetPathParam("username", o.Username); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,262 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"src.opensuse.org/autogits/common/gitea-generated/models"
|
||||
)
|
||||
|
||||
// AdminCreatePublicKeyReader is a Reader for the AdminCreatePublicKey structure.
|
||||
type AdminCreatePublicKeyReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *AdminCreatePublicKeyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 201:
|
||||
result := NewAdminCreatePublicKeyCreated()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 403:
|
||||
result := NewAdminCreatePublicKeyForbidden()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 422:
|
||||
result := NewAdminCreatePublicKeyUnprocessableEntity()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[POST /admin/users/{username}/keys] adminCreatePublicKey", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCreatePublicKeyCreated creates a AdminCreatePublicKeyCreated with default headers values
|
||||
func NewAdminCreatePublicKeyCreated() *AdminCreatePublicKeyCreated {
|
||||
return &AdminCreatePublicKeyCreated{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreatePublicKeyCreated describes a response with status code 201, with default header values.
|
||||
|
||||
PublicKey
|
||||
*/
|
||||
type AdminCreatePublicKeyCreated struct {
|
||||
Payload *models.PublicKey
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin create public key created response has a 2xx status code
|
||||
func (o *AdminCreatePublicKeyCreated) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin create public key created response has a 3xx status code
|
||||
func (o *AdminCreatePublicKeyCreated) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin create public key created response has a 4xx status code
|
||||
func (o *AdminCreatePublicKeyCreated) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin create public key created response has a 5xx status code
|
||||
func (o *AdminCreatePublicKeyCreated) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin create public key created response a status code equal to that given
|
||||
func (o *AdminCreatePublicKeyCreated) IsCode(code int) bool {
|
||||
return code == 201
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin create public key created response
|
||||
func (o *AdminCreatePublicKeyCreated) Code() int {
|
||||
return 201
|
||||
}
|
||||
|
||||
func (o *AdminCreatePublicKeyCreated) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/keys][%d] adminCreatePublicKeyCreated %s", 201, payload)
|
||||
}
|
||||
|
||||
func (o *AdminCreatePublicKeyCreated) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/keys][%d] adminCreatePublicKeyCreated %s", 201, payload)
|
||||
}
|
||||
|
||||
func (o *AdminCreatePublicKeyCreated) GetPayload() *models.PublicKey {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *AdminCreatePublicKeyCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.PublicKey)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminCreatePublicKeyForbidden creates a AdminCreatePublicKeyForbidden with default headers values
|
||||
func NewAdminCreatePublicKeyForbidden() *AdminCreatePublicKeyForbidden {
|
||||
return &AdminCreatePublicKeyForbidden{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreatePublicKeyForbidden describes a response with status code 403, with default header values.
|
||||
|
||||
APIForbiddenError is a forbidden error response
|
||||
*/
|
||||
type AdminCreatePublicKeyForbidden struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin create public key forbidden response has a 2xx status code
|
||||
func (o *AdminCreatePublicKeyForbidden) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin create public key forbidden response has a 3xx status code
|
||||
func (o *AdminCreatePublicKeyForbidden) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin create public key forbidden response has a 4xx status code
|
||||
func (o *AdminCreatePublicKeyForbidden) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin create public key forbidden response has a 5xx status code
|
||||
func (o *AdminCreatePublicKeyForbidden) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin create public key forbidden response a status code equal to that given
|
||||
func (o *AdminCreatePublicKeyForbidden) IsCode(code int) bool {
|
||||
return code == 403
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin create public key forbidden response
|
||||
func (o *AdminCreatePublicKeyForbidden) Code() int {
|
||||
return 403
|
||||
}
|
||||
|
||||
func (o *AdminCreatePublicKeyForbidden) Error() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/keys][%d] adminCreatePublicKeyForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminCreatePublicKeyForbidden) String() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/keys][%d] adminCreatePublicKeyForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminCreatePublicKeyForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminCreatePublicKeyUnprocessableEntity creates a AdminCreatePublicKeyUnprocessableEntity with default headers values
|
||||
func NewAdminCreatePublicKeyUnprocessableEntity() *AdminCreatePublicKeyUnprocessableEntity {
|
||||
return &AdminCreatePublicKeyUnprocessableEntity{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreatePublicKeyUnprocessableEntity describes a response with status code 422, with default header values.
|
||||
|
||||
APIValidationError is error format response related to input validation
|
||||
*/
|
||||
type AdminCreatePublicKeyUnprocessableEntity struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin create public key unprocessable entity response has a 2xx status code
|
||||
func (o *AdminCreatePublicKeyUnprocessableEntity) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin create public key unprocessable entity response has a 3xx status code
|
||||
func (o *AdminCreatePublicKeyUnprocessableEntity) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin create public key unprocessable entity response has a 4xx status code
|
||||
func (o *AdminCreatePublicKeyUnprocessableEntity) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin create public key unprocessable entity response has a 5xx status code
|
||||
func (o *AdminCreatePublicKeyUnprocessableEntity) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin create public key unprocessable entity response a status code equal to that given
|
||||
func (o *AdminCreatePublicKeyUnprocessableEntity) IsCode(code int) bool {
|
||||
return code == 422
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin create public key unprocessable entity response
|
||||
func (o *AdminCreatePublicKeyUnprocessableEntity) Code() int {
|
||||
return 422
|
||||
}
|
||||
|
||||
func (o *AdminCreatePublicKeyUnprocessableEntity) Error() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/keys][%d] adminCreatePublicKeyUnprocessableEntity", 422)
|
||||
}
|
||||
|
||||
func (o *AdminCreatePublicKeyUnprocessableEntity) String() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/keys][%d] adminCreatePublicKeyUnprocessableEntity", 422)
|
||||
}
|
||||
|
||||
func (o *AdminCreatePublicKeyUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,172 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"src.opensuse.org/autogits/common/gitea-generated/models"
|
||||
)
|
||||
|
||||
// NewAdminCreateRepoParams creates a new AdminCreateRepoParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewAdminCreateRepoParams() *AdminCreateRepoParams {
|
||||
return &AdminCreateRepoParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCreateRepoParamsWithTimeout creates a new AdminCreateRepoParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewAdminCreateRepoParamsWithTimeout(timeout time.Duration) *AdminCreateRepoParams {
|
||||
return &AdminCreateRepoParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCreateRepoParamsWithContext creates a new AdminCreateRepoParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewAdminCreateRepoParamsWithContext(ctx context.Context) *AdminCreateRepoParams {
|
||||
return &AdminCreateRepoParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCreateRepoParamsWithHTTPClient creates a new AdminCreateRepoParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewAdminCreateRepoParamsWithHTTPClient(client *http.Client) *AdminCreateRepoParams {
|
||||
return &AdminCreateRepoParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreateRepoParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the admin create repo operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type AdminCreateRepoParams struct {
|
||||
|
||||
// Repository.
|
||||
Repository *models.CreateRepoOption
|
||||
|
||||
/* Username.
|
||||
|
||||
username of the user. This user will own the created repository
|
||||
*/
|
||||
Username string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the admin create repo params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminCreateRepoParams) WithDefaults() *AdminCreateRepoParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the admin create repo params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminCreateRepoParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the admin create repo params
|
||||
func (o *AdminCreateRepoParams) WithTimeout(timeout time.Duration) *AdminCreateRepoParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the admin create repo params
|
||||
func (o *AdminCreateRepoParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the admin create repo params
|
||||
func (o *AdminCreateRepoParams) WithContext(ctx context.Context) *AdminCreateRepoParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the admin create repo params
|
||||
func (o *AdminCreateRepoParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the admin create repo params
|
||||
func (o *AdminCreateRepoParams) WithHTTPClient(client *http.Client) *AdminCreateRepoParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the admin create repo params
|
||||
func (o *AdminCreateRepoParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithRepository adds the repository to the admin create repo params
|
||||
func (o *AdminCreateRepoParams) WithRepository(repository *models.CreateRepoOption) *AdminCreateRepoParams {
|
||||
o.SetRepository(repository)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetRepository adds the repository to the admin create repo params
|
||||
func (o *AdminCreateRepoParams) SetRepository(repository *models.CreateRepoOption) {
|
||||
o.Repository = repository
|
||||
}
|
||||
|
||||
// WithUsername adds the username to the admin create repo params
|
||||
func (o *AdminCreateRepoParams) WithUsername(username string) *AdminCreateRepoParams {
|
||||
o.SetUsername(username)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetUsername adds the username to the admin create repo params
|
||||
func (o *AdminCreateRepoParams) SetUsername(username string) {
|
||||
o.Username = username
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *AdminCreateRepoParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Repository != nil {
|
||||
if err := r.SetBodyParam(o.Repository); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// path param username
|
||||
if err := r.SetPathParam("username", o.Username); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,480 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"src.opensuse.org/autogits/common/gitea-generated/models"
|
||||
)
|
||||
|
||||
// AdminCreateRepoReader is a Reader for the AdminCreateRepo structure.
|
||||
type AdminCreateRepoReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *AdminCreateRepoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 201:
|
||||
result := NewAdminCreateRepoCreated()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 400:
|
||||
result := NewAdminCreateRepoBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 403:
|
||||
result := NewAdminCreateRepoForbidden()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 404:
|
||||
result := NewAdminCreateRepoNotFound()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 409:
|
||||
result := NewAdminCreateRepoConflict()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 422:
|
||||
result := NewAdminCreateRepoUnprocessableEntity()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[POST /admin/users/{username}/repos] adminCreateRepo", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCreateRepoCreated creates a AdminCreateRepoCreated with default headers values
|
||||
func NewAdminCreateRepoCreated() *AdminCreateRepoCreated {
|
||||
return &AdminCreateRepoCreated{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreateRepoCreated describes a response with status code 201, with default header values.
|
||||
|
||||
Repository
|
||||
*/
|
||||
type AdminCreateRepoCreated struct {
|
||||
Payload *models.Repository
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin create repo created response has a 2xx status code
|
||||
func (o *AdminCreateRepoCreated) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin create repo created response has a 3xx status code
|
||||
func (o *AdminCreateRepoCreated) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin create repo created response has a 4xx status code
|
||||
func (o *AdminCreateRepoCreated) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin create repo created response has a 5xx status code
|
||||
func (o *AdminCreateRepoCreated) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin create repo created response a status code equal to that given
|
||||
func (o *AdminCreateRepoCreated) IsCode(code int) bool {
|
||||
return code == 201
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin create repo created response
|
||||
func (o *AdminCreateRepoCreated) Code() int {
|
||||
return 201
|
||||
}
|
||||
|
||||
func (o *AdminCreateRepoCreated) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoCreated %s", 201, payload)
|
||||
}
|
||||
|
||||
func (o *AdminCreateRepoCreated) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoCreated %s", 201, payload)
|
||||
}
|
||||
|
||||
func (o *AdminCreateRepoCreated) GetPayload() *models.Repository {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *AdminCreateRepoCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.Repository)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminCreateRepoBadRequest creates a AdminCreateRepoBadRequest with default headers values
|
||||
func NewAdminCreateRepoBadRequest() *AdminCreateRepoBadRequest {
|
||||
return &AdminCreateRepoBadRequest{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreateRepoBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
APIError is error format response
|
||||
*/
|
||||
type AdminCreateRepoBadRequest struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin create repo bad request response has a 2xx status code
|
||||
func (o *AdminCreateRepoBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin create repo bad request response has a 3xx status code
|
||||
func (o *AdminCreateRepoBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin create repo bad request response has a 4xx status code
|
||||
func (o *AdminCreateRepoBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin create repo bad request response has a 5xx status code
|
||||
func (o *AdminCreateRepoBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin create repo bad request response a status code equal to that given
|
||||
func (o *AdminCreateRepoBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin create repo bad request response
|
||||
func (o *AdminCreateRepoBadRequest) Code() int {
|
||||
return 400
|
||||
}
|
||||
|
||||
func (o *AdminCreateRepoBadRequest) Error() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoBadRequest", 400)
|
||||
}
|
||||
|
||||
func (o *AdminCreateRepoBadRequest) String() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoBadRequest", 400)
|
||||
}
|
||||
|
||||
func (o *AdminCreateRepoBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminCreateRepoForbidden creates a AdminCreateRepoForbidden with default headers values
|
||||
func NewAdminCreateRepoForbidden() *AdminCreateRepoForbidden {
|
||||
return &AdminCreateRepoForbidden{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreateRepoForbidden describes a response with status code 403, with default header values.
|
||||
|
||||
APIForbiddenError is a forbidden error response
|
||||
*/
|
||||
type AdminCreateRepoForbidden struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin create repo forbidden response has a 2xx status code
|
||||
func (o *AdminCreateRepoForbidden) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin create repo forbidden response has a 3xx status code
|
||||
func (o *AdminCreateRepoForbidden) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin create repo forbidden response has a 4xx status code
|
||||
func (o *AdminCreateRepoForbidden) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin create repo forbidden response has a 5xx status code
|
||||
func (o *AdminCreateRepoForbidden) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin create repo forbidden response a status code equal to that given
|
||||
func (o *AdminCreateRepoForbidden) IsCode(code int) bool {
|
||||
return code == 403
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin create repo forbidden response
|
||||
func (o *AdminCreateRepoForbidden) Code() int {
|
||||
return 403
|
||||
}
|
||||
|
||||
func (o *AdminCreateRepoForbidden) Error() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminCreateRepoForbidden) String() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminCreateRepoForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminCreateRepoNotFound creates a AdminCreateRepoNotFound with default headers values
|
||||
func NewAdminCreateRepoNotFound() *AdminCreateRepoNotFound {
|
||||
return &AdminCreateRepoNotFound{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreateRepoNotFound describes a response with status code 404, with default header values.
|
||||
|
||||
APINotFound is a not found empty response
|
||||
*/
|
||||
type AdminCreateRepoNotFound struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin create repo not found response has a 2xx status code
|
||||
func (o *AdminCreateRepoNotFound) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin create repo not found response has a 3xx status code
|
||||
func (o *AdminCreateRepoNotFound) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin create repo not found response has a 4xx status code
|
||||
func (o *AdminCreateRepoNotFound) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin create repo not found response has a 5xx status code
|
||||
func (o *AdminCreateRepoNotFound) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin create repo not found response a status code equal to that given
|
||||
func (o *AdminCreateRepoNotFound) IsCode(code int) bool {
|
||||
return code == 404
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin create repo not found response
|
||||
func (o *AdminCreateRepoNotFound) Code() int {
|
||||
return 404
|
||||
}
|
||||
|
||||
func (o *AdminCreateRepoNotFound) Error() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoNotFound", 404)
|
||||
}
|
||||
|
||||
func (o *AdminCreateRepoNotFound) String() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoNotFound", 404)
|
||||
}
|
||||
|
||||
func (o *AdminCreateRepoNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminCreateRepoConflict creates a AdminCreateRepoConflict with default headers values
|
||||
func NewAdminCreateRepoConflict() *AdminCreateRepoConflict {
|
||||
return &AdminCreateRepoConflict{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreateRepoConflict describes a response with status code 409, with default header values.
|
||||
|
||||
APIError is error format response
|
||||
*/
|
||||
type AdminCreateRepoConflict struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin create repo conflict response has a 2xx status code
|
||||
func (o *AdminCreateRepoConflict) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin create repo conflict response has a 3xx status code
|
||||
func (o *AdminCreateRepoConflict) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin create repo conflict response has a 4xx status code
|
||||
func (o *AdminCreateRepoConflict) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin create repo conflict response has a 5xx status code
|
||||
func (o *AdminCreateRepoConflict) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin create repo conflict response a status code equal to that given
|
||||
func (o *AdminCreateRepoConflict) IsCode(code int) bool {
|
||||
return code == 409
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin create repo conflict response
|
||||
func (o *AdminCreateRepoConflict) Code() int {
|
||||
return 409
|
||||
}
|
||||
|
||||
func (o *AdminCreateRepoConflict) Error() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoConflict", 409)
|
||||
}
|
||||
|
||||
func (o *AdminCreateRepoConflict) String() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoConflict", 409)
|
||||
}
|
||||
|
||||
func (o *AdminCreateRepoConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminCreateRepoUnprocessableEntity creates a AdminCreateRepoUnprocessableEntity with default headers values
|
||||
func NewAdminCreateRepoUnprocessableEntity() *AdminCreateRepoUnprocessableEntity {
|
||||
return &AdminCreateRepoUnprocessableEntity{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreateRepoUnprocessableEntity describes a response with status code 422, with default header values.
|
||||
|
||||
APIValidationError is error format response related to input validation
|
||||
*/
|
||||
type AdminCreateRepoUnprocessableEntity struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin create repo unprocessable entity response has a 2xx status code
|
||||
func (o *AdminCreateRepoUnprocessableEntity) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin create repo unprocessable entity response has a 3xx status code
|
||||
func (o *AdminCreateRepoUnprocessableEntity) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin create repo unprocessable entity response has a 4xx status code
|
||||
func (o *AdminCreateRepoUnprocessableEntity) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin create repo unprocessable entity response has a 5xx status code
|
||||
func (o *AdminCreateRepoUnprocessableEntity) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin create repo unprocessable entity response a status code equal to that given
|
||||
func (o *AdminCreateRepoUnprocessableEntity) IsCode(code int) bool {
|
||||
return code == 422
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin create repo unprocessable entity response
|
||||
func (o *AdminCreateRepoUnprocessableEntity) Code() int {
|
||||
return 422
|
||||
}
|
||||
|
||||
func (o *AdminCreateRepoUnprocessableEntity) Error() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoUnprocessableEntity", 422)
|
||||
}
|
||||
|
||||
func (o *AdminCreateRepoUnprocessableEntity) String() string {
|
||||
return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoUnprocessableEntity", 422)
|
||||
}
|
||||
|
||||
func (o *AdminCreateRepoUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"src.opensuse.org/autogits/common/gitea-generated/models"
|
||||
)
|
||||
|
||||
// NewAdminCreateUserParams creates a new AdminCreateUserParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewAdminCreateUserParams() *AdminCreateUserParams {
|
||||
return &AdminCreateUserParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCreateUserParamsWithTimeout creates a new AdminCreateUserParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewAdminCreateUserParamsWithTimeout(timeout time.Duration) *AdminCreateUserParams {
|
||||
return &AdminCreateUserParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCreateUserParamsWithContext creates a new AdminCreateUserParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewAdminCreateUserParamsWithContext(ctx context.Context) *AdminCreateUserParams {
|
||||
return &AdminCreateUserParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCreateUserParamsWithHTTPClient creates a new AdminCreateUserParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewAdminCreateUserParamsWithHTTPClient(client *http.Client) *AdminCreateUserParams {
|
||||
return &AdminCreateUserParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreateUserParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the admin create user operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type AdminCreateUserParams struct {
|
||||
|
||||
// Body.
|
||||
Body *models.CreateUserOption
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the admin create user params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminCreateUserParams) WithDefaults() *AdminCreateUserParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the admin create user params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminCreateUserParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the admin create user params
|
||||
func (o *AdminCreateUserParams) WithTimeout(timeout time.Duration) *AdminCreateUserParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the admin create user params
|
||||
func (o *AdminCreateUserParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the admin create user params
|
||||
func (o *AdminCreateUserParams) WithContext(ctx context.Context) *AdminCreateUserParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the admin create user params
|
||||
func (o *AdminCreateUserParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the admin create user params
|
||||
func (o *AdminCreateUserParams) WithHTTPClient(client *http.Client) *AdminCreateUserParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the admin create user params
|
||||
func (o *AdminCreateUserParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the admin create user params
|
||||
func (o *AdminCreateUserParams) WithBody(body *models.CreateUserOption) *AdminCreateUserParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the admin create user params
|
||||
func (o *AdminCreateUserParams) SetBody(body *models.CreateUserOption) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *AdminCreateUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,340 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"src.opensuse.org/autogits/common/gitea-generated/models"
|
||||
)
|
||||
|
||||
// AdminCreateUserReader is a Reader for the AdminCreateUser structure.
|
||||
type AdminCreateUserReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *AdminCreateUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 201:
|
||||
result := NewAdminCreateUserCreated()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 400:
|
||||
result := NewAdminCreateUserBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 403:
|
||||
result := NewAdminCreateUserForbidden()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 422:
|
||||
result := NewAdminCreateUserUnprocessableEntity()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[POST /admin/users] adminCreateUser", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCreateUserCreated creates a AdminCreateUserCreated with default headers values
|
||||
func NewAdminCreateUserCreated() *AdminCreateUserCreated {
|
||||
return &AdminCreateUserCreated{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreateUserCreated describes a response with status code 201, with default header values.
|
||||
|
||||
User
|
||||
*/
|
||||
type AdminCreateUserCreated struct {
|
||||
Payload *models.User
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin create user created response has a 2xx status code
|
||||
func (o *AdminCreateUserCreated) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin create user created response has a 3xx status code
|
||||
func (o *AdminCreateUserCreated) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin create user created response has a 4xx status code
|
||||
func (o *AdminCreateUserCreated) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin create user created response has a 5xx status code
|
||||
func (o *AdminCreateUserCreated) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin create user created response a status code equal to that given
|
||||
func (o *AdminCreateUserCreated) IsCode(code int) bool {
|
||||
return code == 201
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin create user created response
|
||||
func (o *AdminCreateUserCreated) Code() int {
|
||||
return 201
|
||||
}
|
||||
|
||||
func (o *AdminCreateUserCreated) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /admin/users][%d] adminCreateUserCreated %s", 201, payload)
|
||||
}
|
||||
|
||||
func (o *AdminCreateUserCreated) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /admin/users][%d] adminCreateUserCreated %s", 201, payload)
|
||||
}
|
||||
|
||||
func (o *AdminCreateUserCreated) GetPayload() *models.User {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *AdminCreateUserCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.User)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminCreateUserBadRequest creates a AdminCreateUserBadRequest with default headers values
|
||||
func NewAdminCreateUserBadRequest() *AdminCreateUserBadRequest {
|
||||
return &AdminCreateUserBadRequest{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreateUserBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
APIError is error format response
|
||||
*/
|
||||
type AdminCreateUserBadRequest struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin create user bad request response has a 2xx status code
|
||||
func (o *AdminCreateUserBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin create user bad request response has a 3xx status code
|
||||
func (o *AdminCreateUserBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin create user bad request response has a 4xx status code
|
||||
func (o *AdminCreateUserBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin create user bad request response has a 5xx status code
|
||||
func (o *AdminCreateUserBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin create user bad request response a status code equal to that given
|
||||
func (o *AdminCreateUserBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin create user bad request response
|
||||
func (o *AdminCreateUserBadRequest) Code() int {
|
||||
return 400
|
||||
}
|
||||
|
||||
func (o *AdminCreateUserBadRequest) Error() string {
|
||||
return fmt.Sprintf("[POST /admin/users][%d] adminCreateUserBadRequest", 400)
|
||||
}
|
||||
|
||||
func (o *AdminCreateUserBadRequest) String() string {
|
||||
return fmt.Sprintf("[POST /admin/users][%d] adminCreateUserBadRequest", 400)
|
||||
}
|
||||
|
||||
func (o *AdminCreateUserBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminCreateUserForbidden creates a AdminCreateUserForbidden with default headers values
|
||||
func NewAdminCreateUserForbidden() *AdminCreateUserForbidden {
|
||||
return &AdminCreateUserForbidden{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreateUserForbidden describes a response with status code 403, with default header values.
|
||||
|
||||
APIForbiddenError is a forbidden error response
|
||||
*/
|
||||
type AdminCreateUserForbidden struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin create user forbidden response has a 2xx status code
|
||||
func (o *AdminCreateUserForbidden) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin create user forbidden response has a 3xx status code
|
||||
func (o *AdminCreateUserForbidden) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin create user forbidden response has a 4xx status code
|
||||
func (o *AdminCreateUserForbidden) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin create user forbidden response has a 5xx status code
|
||||
func (o *AdminCreateUserForbidden) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin create user forbidden response a status code equal to that given
|
||||
func (o *AdminCreateUserForbidden) IsCode(code int) bool {
|
||||
return code == 403
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin create user forbidden response
|
||||
func (o *AdminCreateUserForbidden) Code() int {
|
||||
return 403
|
||||
}
|
||||
|
||||
func (o *AdminCreateUserForbidden) Error() string {
|
||||
return fmt.Sprintf("[POST /admin/users][%d] adminCreateUserForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminCreateUserForbidden) String() string {
|
||||
return fmt.Sprintf("[POST /admin/users][%d] adminCreateUserForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminCreateUserForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminCreateUserUnprocessableEntity creates a AdminCreateUserUnprocessableEntity with default headers values
|
||||
func NewAdminCreateUserUnprocessableEntity() *AdminCreateUserUnprocessableEntity {
|
||||
return &AdminCreateUserUnprocessableEntity{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCreateUserUnprocessableEntity describes a response with status code 422, with default header values.
|
||||
|
||||
APIValidationError is error format response related to input validation
|
||||
*/
|
||||
type AdminCreateUserUnprocessableEntity struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin create user unprocessable entity response has a 2xx status code
|
||||
func (o *AdminCreateUserUnprocessableEntity) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin create user unprocessable entity response has a 3xx status code
|
||||
func (o *AdminCreateUserUnprocessableEntity) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin create user unprocessable entity response has a 4xx status code
|
||||
func (o *AdminCreateUserUnprocessableEntity) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin create user unprocessable entity response has a 5xx status code
|
||||
func (o *AdminCreateUserUnprocessableEntity) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin create user unprocessable entity response a status code equal to that given
|
||||
func (o *AdminCreateUserUnprocessableEntity) IsCode(code int) bool {
|
||||
return code == 422
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin create user unprocessable entity response
|
||||
func (o *AdminCreateUserUnprocessableEntity) Code() int {
|
||||
return 422
|
||||
}
|
||||
|
||||
func (o *AdminCreateUserUnprocessableEntity) Error() string {
|
||||
return fmt.Sprintf("[POST /admin/users][%d] adminCreateUserUnprocessableEntity", 422)
|
||||
}
|
||||
|
||||
func (o *AdminCreateUserUnprocessableEntity) String() string {
|
||||
return fmt.Sprintf("[POST /admin/users][%d] adminCreateUserUnprocessableEntity", 422)
|
||||
}
|
||||
|
||||
func (o *AdminCreateUserUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,198 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// NewAdminCronListParams creates a new AdminCronListParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewAdminCronListParams() *AdminCronListParams {
|
||||
return &AdminCronListParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCronListParamsWithTimeout creates a new AdminCronListParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewAdminCronListParamsWithTimeout(timeout time.Duration) *AdminCronListParams {
|
||||
return &AdminCronListParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCronListParamsWithContext creates a new AdminCronListParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewAdminCronListParamsWithContext(ctx context.Context) *AdminCronListParams {
|
||||
return &AdminCronListParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCronListParamsWithHTTPClient creates a new AdminCronListParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewAdminCronListParamsWithHTTPClient(client *http.Client) *AdminCronListParams {
|
||||
return &AdminCronListParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCronListParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the admin cron list operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type AdminCronListParams struct {
|
||||
|
||||
/* Limit.
|
||||
|
||||
page size of results
|
||||
*/
|
||||
Limit *int64
|
||||
|
||||
/* Page.
|
||||
|
||||
page number of results to return (1-based)
|
||||
*/
|
||||
Page *int64
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the admin cron list params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminCronListParams) WithDefaults() *AdminCronListParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the admin cron list params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminCronListParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the admin cron list params
|
||||
func (o *AdminCronListParams) WithTimeout(timeout time.Duration) *AdminCronListParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the admin cron list params
|
||||
func (o *AdminCronListParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the admin cron list params
|
||||
func (o *AdminCronListParams) WithContext(ctx context.Context) *AdminCronListParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the admin cron list params
|
||||
func (o *AdminCronListParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the admin cron list params
|
||||
func (o *AdminCronListParams) WithHTTPClient(client *http.Client) *AdminCronListParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the admin cron list params
|
||||
func (o *AdminCronListParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithLimit adds the limit to the admin cron list params
|
||||
func (o *AdminCronListParams) WithLimit(limit *int64) *AdminCronListParams {
|
||||
o.SetLimit(limit)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetLimit adds the limit to the admin cron list params
|
||||
func (o *AdminCronListParams) SetLimit(limit *int64) {
|
||||
o.Limit = limit
|
||||
}
|
||||
|
||||
// WithPage adds the page to the admin cron list params
|
||||
func (o *AdminCronListParams) WithPage(page *int64) *AdminCronListParams {
|
||||
o.SetPage(page)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPage adds the page to the admin cron list params
|
||||
func (o *AdminCronListParams) SetPage(page *int64) {
|
||||
o.Page = page
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *AdminCronListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.Limit != nil {
|
||||
|
||||
// query param limit
|
||||
var qrLimit int64
|
||||
|
||||
if o.Limit != nil {
|
||||
qrLimit = *o.Limit
|
||||
}
|
||||
qLimit := swag.FormatInt64(qrLimit)
|
||||
if qLimit != "" {
|
||||
|
||||
if err := r.SetQueryParam("limit", qLimit); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if o.Page != nil {
|
||||
|
||||
// query param page
|
||||
var qrPage int64
|
||||
|
||||
if o.Page != nil {
|
||||
qrPage = *o.Page
|
||||
}
|
||||
qPage := swag.FormatInt64(qrPage)
|
||||
if qPage != "" {
|
||||
|
||||
if err := r.SetQueryParam("page", qPage); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,182 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"src.opensuse.org/autogits/common/gitea-generated/models"
|
||||
)
|
||||
|
||||
// AdminCronListReader is a Reader for the AdminCronList structure.
|
||||
type AdminCronListReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *AdminCronListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewAdminCronListOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 403:
|
||||
result := NewAdminCronListForbidden()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[GET /admin/cron] adminCronList", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCronListOK creates a AdminCronListOK with default headers values
|
||||
func NewAdminCronListOK() *AdminCronListOK {
|
||||
return &AdminCronListOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCronListOK describes a response with status code 200, with default header values.
|
||||
|
||||
CronList
|
||||
*/
|
||||
type AdminCronListOK struct {
|
||||
Payload []*models.Cron
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin cron list o k response has a 2xx status code
|
||||
func (o *AdminCronListOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin cron list o k response has a 3xx status code
|
||||
func (o *AdminCronListOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin cron list o k response has a 4xx status code
|
||||
func (o *AdminCronListOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin cron list o k response has a 5xx status code
|
||||
func (o *AdminCronListOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin cron list o k response a status code equal to that given
|
||||
func (o *AdminCronListOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin cron list o k response
|
||||
func (o *AdminCronListOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *AdminCronListOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /admin/cron][%d] adminCronListOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *AdminCronListOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /admin/cron][%d] adminCronListOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *AdminCronListOK) GetPayload() []*models.Cron {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *AdminCronListOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminCronListForbidden creates a AdminCronListForbidden with default headers values
|
||||
func NewAdminCronListForbidden() *AdminCronListForbidden {
|
||||
return &AdminCronListForbidden{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCronListForbidden describes a response with status code 403, with default header values.
|
||||
|
||||
APIForbiddenError is a forbidden error response
|
||||
*/
|
||||
type AdminCronListForbidden struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin cron list forbidden response has a 2xx status code
|
||||
func (o *AdminCronListForbidden) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin cron list forbidden response has a 3xx status code
|
||||
func (o *AdminCronListForbidden) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin cron list forbidden response has a 4xx status code
|
||||
func (o *AdminCronListForbidden) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin cron list forbidden response has a 5xx status code
|
||||
func (o *AdminCronListForbidden) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin cron list forbidden response a status code equal to that given
|
||||
func (o *AdminCronListForbidden) IsCode(code int) bool {
|
||||
return code == 403
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin cron list forbidden response
|
||||
func (o *AdminCronListForbidden) Code() int {
|
||||
return 403
|
||||
}
|
||||
|
||||
func (o *AdminCronListForbidden) Error() string {
|
||||
return fmt.Sprintf("[GET /admin/cron][%d] adminCronListForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminCronListForbidden) String() string {
|
||||
return fmt.Sprintf("[GET /admin/cron][%d] adminCronListForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminCronListForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,151 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewAdminCronRunParams creates a new AdminCronRunParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewAdminCronRunParams() *AdminCronRunParams {
|
||||
return &AdminCronRunParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCronRunParamsWithTimeout creates a new AdminCronRunParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewAdminCronRunParamsWithTimeout(timeout time.Duration) *AdminCronRunParams {
|
||||
return &AdminCronRunParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCronRunParamsWithContext creates a new AdminCronRunParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewAdminCronRunParamsWithContext(ctx context.Context) *AdminCronRunParams {
|
||||
return &AdminCronRunParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCronRunParamsWithHTTPClient creates a new AdminCronRunParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewAdminCronRunParamsWithHTTPClient(client *http.Client) *AdminCronRunParams {
|
||||
return &AdminCronRunParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCronRunParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the admin cron run operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type AdminCronRunParams struct {
|
||||
|
||||
/* Task.
|
||||
|
||||
task to run
|
||||
*/
|
||||
Task string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the admin cron run params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminCronRunParams) WithDefaults() *AdminCronRunParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the admin cron run params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminCronRunParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the admin cron run params
|
||||
func (o *AdminCronRunParams) WithTimeout(timeout time.Duration) *AdminCronRunParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the admin cron run params
|
||||
func (o *AdminCronRunParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the admin cron run params
|
||||
func (o *AdminCronRunParams) WithContext(ctx context.Context) *AdminCronRunParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the admin cron run params
|
||||
func (o *AdminCronRunParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the admin cron run params
|
||||
func (o *AdminCronRunParams) WithHTTPClient(client *http.Client) *AdminCronRunParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the admin cron run params
|
||||
func (o *AdminCronRunParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithTask adds the task to the admin cron run params
|
||||
func (o *AdminCronRunParams) WithTask(task string) *AdminCronRunParams {
|
||||
o.SetTask(task)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTask adds the task to the admin cron run params
|
||||
func (o *AdminCronRunParams) SetTask(task string) {
|
||||
o.Task = task
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *AdminCronRunParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param task
|
||||
if err := r.SetPathParam("task", o.Task); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// AdminCronRunReader is a Reader for the AdminCronRun structure.
|
||||
type AdminCronRunReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *AdminCronRunReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 204:
|
||||
result := NewAdminCronRunNoContent()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 404:
|
||||
result := NewAdminCronRunNotFound()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[POST /admin/cron/{task}] adminCronRun", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminCronRunNoContent creates a AdminCronRunNoContent with default headers values
|
||||
func NewAdminCronRunNoContent() *AdminCronRunNoContent {
|
||||
return &AdminCronRunNoContent{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCronRunNoContent describes a response with status code 204, with default header values.
|
||||
|
||||
APIEmpty is an empty response
|
||||
*/
|
||||
type AdminCronRunNoContent struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin cron run no content response has a 2xx status code
|
||||
func (o *AdminCronRunNoContent) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin cron run no content response has a 3xx status code
|
||||
func (o *AdminCronRunNoContent) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin cron run no content response has a 4xx status code
|
||||
func (o *AdminCronRunNoContent) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin cron run no content response has a 5xx status code
|
||||
func (o *AdminCronRunNoContent) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin cron run no content response a status code equal to that given
|
||||
func (o *AdminCronRunNoContent) IsCode(code int) bool {
|
||||
return code == 204
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin cron run no content response
|
||||
func (o *AdminCronRunNoContent) Code() int {
|
||||
return 204
|
||||
}
|
||||
|
||||
func (o *AdminCronRunNoContent) Error() string {
|
||||
return fmt.Sprintf("[POST /admin/cron/{task}][%d] adminCronRunNoContent", 204)
|
||||
}
|
||||
|
||||
func (o *AdminCronRunNoContent) String() string {
|
||||
return fmt.Sprintf("[POST /admin/cron/{task}][%d] adminCronRunNoContent", 204)
|
||||
}
|
||||
|
||||
func (o *AdminCronRunNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminCronRunNotFound creates a AdminCronRunNotFound with default headers values
|
||||
func NewAdminCronRunNotFound() *AdminCronRunNotFound {
|
||||
return &AdminCronRunNotFound{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminCronRunNotFound describes a response with status code 404, with default header values.
|
||||
|
||||
APINotFound is a not found empty response
|
||||
*/
|
||||
type AdminCronRunNotFound struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin cron run not found response has a 2xx status code
|
||||
func (o *AdminCronRunNotFound) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin cron run not found response has a 3xx status code
|
||||
func (o *AdminCronRunNotFound) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin cron run not found response has a 4xx status code
|
||||
func (o *AdminCronRunNotFound) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin cron run not found response has a 5xx status code
|
||||
func (o *AdminCronRunNotFound) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin cron run not found response a status code equal to that given
|
||||
func (o *AdminCronRunNotFound) IsCode(code int) bool {
|
||||
return code == 404
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin cron run not found response
|
||||
func (o *AdminCronRunNotFound) Code() int {
|
||||
return 404
|
||||
}
|
||||
|
||||
func (o *AdminCronRunNotFound) Error() string {
|
||||
return fmt.Sprintf("[POST /admin/cron/{task}][%d] adminCronRunNotFound", 404)
|
||||
}
|
||||
|
||||
func (o *AdminCronRunNotFound) String() string {
|
||||
return fmt.Sprintf("[POST /admin/cron/{task}][%d] adminCronRunNotFound", 404)
|
||||
}
|
||||
|
||||
func (o *AdminCronRunNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,154 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// NewAdminDeleteHookParams creates a new AdminDeleteHookParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewAdminDeleteHookParams() *AdminDeleteHookParams {
|
||||
return &AdminDeleteHookParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminDeleteHookParamsWithTimeout creates a new AdminDeleteHookParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewAdminDeleteHookParamsWithTimeout(timeout time.Duration) *AdminDeleteHookParams {
|
||||
return &AdminDeleteHookParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminDeleteHookParamsWithContext creates a new AdminDeleteHookParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewAdminDeleteHookParamsWithContext(ctx context.Context) *AdminDeleteHookParams {
|
||||
return &AdminDeleteHookParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminDeleteHookParamsWithHTTPClient creates a new AdminDeleteHookParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewAdminDeleteHookParamsWithHTTPClient(client *http.Client) *AdminDeleteHookParams {
|
||||
return &AdminDeleteHookParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminDeleteHookParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the admin delete hook operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type AdminDeleteHookParams struct {
|
||||
|
||||
/* ID.
|
||||
|
||||
id of the hook to delete
|
||||
|
||||
Format: int64
|
||||
*/
|
||||
ID int64
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the admin delete hook params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminDeleteHookParams) WithDefaults() *AdminDeleteHookParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the admin delete hook params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminDeleteHookParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the admin delete hook params
|
||||
func (o *AdminDeleteHookParams) WithTimeout(timeout time.Duration) *AdminDeleteHookParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the admin delete hook params
|
||||
func (o *AdminDeleteHookParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the admin delete hook params
|
||||
func (o *AdminDeleteHookParams) WithContext(ctx context.Context) *AdminDeleteHookParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the admin delete hook params
|
||||
func (o *AdminDeleteHookParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the admin delete hook params
|
||||
func (o *AdminDeleteHookParams) WithHTTPClient(client *http.Client) *AdminDeleteHookParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the admin delete hook params
|
||||
func (o *AdminDeleteHookParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithID adds the id to the admin delete hook params
|
||||
func (o *AdminDeleteHookParams) WithID(id int64) *AdminDeleteHookParams {
|
||||
o.SetID(id)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetID adds the id to the admin delete hook params
|
||||
func (o *AdminDeleteHookParams) SetID(id int64) {
|
||||
o.ID = id
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *AdminDeleteHookParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param id
|
||||
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// AdminDeleteHookReader is a Reader for the AdminDeleteHook structure.
|
||||
type AdminDeleteHookReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *AdminDeleteHookReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 204:
|
||||
result := NewAdminDeleteHookNoContent()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[DELETE /admin/hooks/{id}] adminDeleteHook", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminDeleteHookNoContent creates a AdminDeleteHookNoContent with default headers values
|
||||
func NewAdminDeleteHookNoContent() *AdminDeleteHookNoContent {
|
||||
return &AdminDeleteHookNoContent{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminDeleteHookNoContent describes a response with status code 204, with default header values.
|
||||
|
||||
APIEmpty is an empty response
|
||||
*/
|
||||
type AdminDeleteHookNoContent struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin delete hook no content response has a 2xx status code
|
||||
func (o *AdminDeleteHookNoContent) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin delete hook no content response has a 3xx status code
|
||||
func (o *AdminDeleteHookNoContent) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin delete hook no content response has a 4xx status code
|
||||
func (o *AdminDeleteHookNoContent) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin delete hook no content response has a 5xx status code
|
||||
func (o *AdminDeleteHookNoContent) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin delete hook no content response a status code equal to that given
|
||||
func (o *AdminDeleteHookNoContent) IsCode(code int) bool {
|
||||
return code == 204
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin delete hook no content response
|
||||
func (o *AdminDeleteHookNoContent) Code() int {
|
||||
return 204
|
||||
}
|
||||
|
||||
func (o *AdminDeleteHookNoContent) Error() string {
|
||||
return fmt.Sprintf("[DELETE /admin/hooks/{id}][%d] adminDeleteHookNoContent", 204)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteHookNoContent) String() string {
|
||||
return fmt.Sprintf("[DELETE /admin/hooks/{id}][%d] adminDeleteHookNoContent", 204)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteHookNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,173 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewAdminDeleteUnadoptedRepositoryParams creates a new AdminDeleteUnadoptedRepositoryParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewAdminDeleteUnadoptedRepositoryParams() *AdminDeleteUnadoptedRepositoryParams {
|
||||
return &AdminDeleteUnadoptedRepositoryParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminDeleteUnadoptedRepositoryParamsWithTimeout creates a new AdminDeleteUnadoptedRepositoryParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewAdminDeleteUnadoptedRepositoryParamsWithTimeout(timeout time.Duration) *AdminDeleteUnadoptedRepositoryParams {
|
||||
return &AdminDeleteUnadoptedRepositoryParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminDeleteUnadoptedRepositoryParamsWithContext creates a new AdminDeleteUnadoptedRepositoryParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewAdminDeleteUnadoptedRepositoryParamsWithContext(ctx context.Context) *AdminDeleteUnadoptedRepositoryParams {
|
||||
return &AdminDeleteUnadoptedRepositoryParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminDeleteUnadoptedRepositoryParamsWithHTTPClient creates a new AdminDeleteUnadoptedRepositoryParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewAdminDeleteUnadoptedRepositoryParamsWithHTTPClient(client *http.Client) *AdminDeleteUnadoptedRepositoryParams {
|
||||
return &AdminDeleteUnadoptedRepositoryParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminDeleteUnadoptedRepositoryParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the admin delete unadopted repository operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type AdminDeleteUnadoptedRepositoryParams struct {
|
||||
|
||||
/* Owner.
|
||||
|
||||
owner of the repo
|
||||
*/
|
||||
Owner string
|
||||
|
||||
/* Repo.
|
||||
|
||||
name of the repo
|
||||
*/
|
||||
Repo string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the admin delete unadopted repository params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminDeleteUnadoptedRepositoryParams) WithDefaults() *AdminDeleteUnadoptedRepositoryParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the admin delete unadopted repository params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminDeleteUnadoptedRepositoryParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the admin delete unadopted repository params
|
||||
func (o *AdminDeleteUnadoptedRepositoryParams) WithTimeout(timeout time.Duration) *AdminDeleteUnadoptedRepositoryParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the admin delete unadopted repository params
|
||||
func (o *AdminDeleteUnadoptedRepositoryParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the admin delete unadopted repository params
|
||||
func (o *AdminDeleteUnadoptedRepositoryParams) WithContext(ctx context.Context) *AdminDeleteUnadoptedRepositoryParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the admin delete unadopted repository params
|
||||
func (o *AdminDeleteUnadoptedRepositoryParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the admin delete unadopted repository params
|
||||
func (o *AdminDeleteUnadoptedRepositoryParams) WithHTTPClient(client *http.Client) *AdminDeleteUnadoptedRepositoryParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the admin delete unadopted repository params
|
||||
func (o *AdminDeleteUnadoptedRepositoryParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOwner adds the owner to the admin delete unadopted repository params
|
||||
func (o *AdminDeleteUnadoptedRepositoryParams) WithOwner(owner string) *AdminDeleteUnadoptedRepositoryParams {
|
||||
o.SetOwner(owner)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOwner adds the owner to the admin delete unadopted repository params
|
||||
func (o *AdminDeleteUnadoptedRepositoryParams) SetOwner(owner string) {
|
||||
o.Owner = owner
|
||||
}
|
||||
|
||||
// WithRepo adds the repo to the admin delete unadopted repository params
|
||||
func (o *AdminDeleteUnadoptedRepositoryParams) WithRepo(repo string) *AdminDeleteUnadoptedRepositoryParams {
|
||||
o.SetRepo(repo)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetRepo adds the repo to the admin delete unadopted repository params
|
||||
func (o *AdminDeleteUnadoptedRepositoryParams) SetRepo(repo string) {
|
||||
o.Repo = repo
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *AdminDeleteUnadoptedRepositoryParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param owner
|
||||
if err := r.SetPathParam("owner", o.Owner); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// path param repo
|
||||
if err := r.SetPathParam("repo", o.Repo); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,166 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// AdminDeleteUnadoptedRepositoryReader is a Reader for the AdminDeleteUnadoptedRepository structure.
|
||||
type AdminDeleteUnadoptedRepositoryReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *AdminDeleteUnadoptedRepositoryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 204:
|
||||
result := NewAdminDeleteUnadoptedRepositoryNoContent()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 403:
|
||||
result := NewAdminDeleteUnadoptedRepositoryForbidden()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[DELETE /admin/unadopted/{owner}/{repo}] adminDeleteUnadoptedRepository", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminDeleteUnadoptedRepositoryNoContent creates a AdminDeleteUnadoptedRepositoryNoContent with default headers values
|
||||
func NewAdminDeleteUnadoptedRepositoryNoContent() *AdminDeleteUnadoptedRepositoryNoContent {
|
||||
return &AdminDeleteUnadoptedRepositoryNoContent{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminDeleteUnadoptedRepositoryNoContent describes a response with status code 204, with default header values.
|
||||
|
||||
APIEmpty is an empty response
|
||||
*/
|
||||
type AdminDeleteUnadoptedRepositoryNoContent struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin delete unadopted repository no content response has a 2xx status code
|
||||
func (o *AdminDeleteUnadoptedRepositoryNoContent) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin delete unadopted repository no content response has a 3xx status code
|
||||
func (o *AdminDeleteUnadoptedRepositoryNoContent) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin delete unadopted repository no content response has a 4xx status code
|
||||
func (o *AdminDeleteUnadoptedRepositoryNoContent) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin delete unadopted repository no content response has a 5xx status code
|
||||
func (o *AdminDeleteUnadoptedRepositoryNoContent) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin delete unadopted repository no content response a status code equal to that given
|
||||
func (o *AdminDeleteUnadoptedRepositoryNoContent) IsCode(code int) bool {
|
||||
return code == 204
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin delete unadopted repository no content response
|
||||
func (o *AdminDeleteUnadoptedRepositoryNoContent) Code() int {
|
||||
return 204
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUnadoptedRepositoryNoContent) Error() string {
|
||||
return fmt.Sprintf("[DELETE /admin/unadopted/{owner}/{repo}][%d] adminDeleteUnadoptedRepositoryNoContent", 204)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUnadoptedRepositoryNoContent) String() string {
|
||||
return fmt.Sprintf("[DELETE /admin/unadopted/{owner}/{repo}][%d] adminDeleteUnadoptedRepositoryNoContent", 204)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUnadoptedRepositoryNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminDeleteUnadoptedRepositoryForbidden creates a AdminDeleteUnadoptedRepositoryForbidden with default headers values
|
||||
func NewAdminDeleteUnadoptedRepositoryForbidden() *AdminDeleteUnadoptedRepositoryForbidden {
|
||||
return &AdminDeleteUnadoptedRepositoryForbidden{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminDeleteUnadoptedRepositoryForbidden describes a response with status code 403, with default header values.
|
||||
|
||||
APIForbiddenError is a forbidden error response
|
||||
*/
|
||||
type AdminDeleteUnadoptedRepositoryForbidden struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin delete unadopted repository forbidden response has a 2xx status code
|
||||
func (o *AdminDeleteUnadoptedRepositoryForbidden) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin delete unadopted repository forbidden response has a 3xx status code
|
||||
func (o *AdminDeleteUnadoptedRepositoryForbidden) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin delete unadopted repository forbidden response has a 4xx status code
|
||||
func (o *AdminDeleteUnadoptedRepositoryForbidden) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin delete unadopted repository forbidden response has a 5xx status code
|
||||
func (o *AdminDeleteUnadoptedRepositoryForbidden) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin delete unadopted repository forbidden response a status code equal to that given
|
||||
func (o *AdminDeleteUnadoptedRepositoryForbidden) IsCode(code int) bool {
|
||||
return code == 403
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin delete unadopted repository forbidden response
|
||||
func (o *AdminDeleteUnadoptedRepositoryForbidden) Code() int {
|
||||
return 403
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUnadoptedRepositoryForbidden) Error() string {
|
||||
return fmt.Sprintf("[DELETE /admin/unadopted/{owner}/{repo}][%d] adminDeleteUnadoptedRepositoryForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUnadoptedRepositoryForbidden) String() string {
|
||||
return fmt.Sprintf("[DELETE /admin/unadopted/{owner}/{repo}][%d] adminDeleteUnadoptedRepositoryForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUnadoptedRepositoryForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,172 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"src.opensuse.org/autogits/common/gitea-generated/models"
|
||||
)
|
||||
|
||||
// NewAdminDeleteUserBadgesParams creates a new AdminDeleteUserBadgesParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewAdminDeleteUserBadgesParams() *AdminDeleteUserBadgesParams {
|
||||
return &AdminDeleteUserBadgesParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminDeleteUserBadgesParamsWithTimeout creates a new AdminDeleteUserBadgesParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewAdminDeleteUserBadgesParamsWithTimeout(timeout time.Duration) *AdminDeleteUserBadgesParams {
|
||||
return &AdminDeleteUserBadgesParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminDeleteUserBadgesParamsWithContext creates a new AdminDeleteUserBadgesParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewAdminDeleteUserBadgesParamsWithContext(ctx context.Context) *AdminDeleteUserBadgesParams {
|
||||
return &AdminDeleteUserBadgesParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminDeleteUserBadgesParamsWithHTTPClient creates a new AdminDeleteUserBadgesParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewAdminDeleteUserBadgesParamsWithHTTPClient(client *http.Client) *AdminDeleteUserBadgesParams {
|
||||
return &AdminDeleteUserBadgesParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminDeleteUserBadgesParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the admin delete user badges operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type AdminDeleteUserBadgesParams struct {
|
||||
|
||||
// Body.
|
||||
Body *models.UserBadgeOption
|
||||
|
||||
/* Username.
|
||||
|
||||
username of user
|
||||
*/
|
||||
Username string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the admin delete user badges params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminDeleteUserBadgesParams) WithDefaults() *AdminDeleteUserBadgesParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the admin delete user badges params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminDeleteUserBadgesParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the admin delete user badges params
|
||||
func (o *AdminDeleteUserBadgesParams) WithTimeout(timeout time.Duration) *AdminDeleteUserBadgesParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the admin delete user badges params
|
||||
func (o *AdminDeleteUserBadgesParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the admin delete user badges params
|
||||
func (o *AdminDeleteUserBadgesParams) WithContext(ctx context.Context) *AdminDeleteUserBadgesParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the admin delete user badges params
|
||||
func (o *AdminDeleteUserBadgesParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the admin delete user badges params
|
||||
func (o *AdminDeleteUserBadgesParams) WithHTTPClient(client *http.Client) *AdminDeleteUserBadgesParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the admin delete user badges params
|
||||
func (o *AdminDeleteUserBadgesParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the admin delete user badges params
|
||||
func (o *AdminDeleteUserBadgesParams) WithBody(body *models.UserBadgeOption) *AdminDeleteUserBadgesParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the admin delete user badges params
|
||||
func (o *AdminDeleteUserBadgesParams) SetBody(body *models.UserBadgeOption) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WithUsername adds the username to the admin delete user badges params
|
||||
func (o *AdminDeleteUserBadgesParams) WithUsername(username string) *AdminDeleteUserBadgesParams {
|
||||
o.SetUsername(username)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetUsername adds the username to the admin delete user badges params
|
||||
func (o *AdminDeleteUserBadgesParams) SetUsername(username string) {
|
||||
o.Username = username
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *AdminDeleteUserBadgesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// path param username
|
||||
if err := r.SetPathParam("username", o.Username); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,244 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// AdminDeleteUserBadgesReader is a Reader for the AdminDeleteUserBadges structure.
|
||||
type AdminDeleteUserBadgesReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *AdminDeleteUserBadgesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 204:
|
||||
result := NewAdminDeleteUserBadgesNoContent()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 403:
|
||||
result := NewAdminDeleteUserBadgesForbidden()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 422:
|
||||
result := NewAdminDeleteUserBadgesUnprocessableEntity()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[DELETE /admin/users/{username}/badges] adminDeleteUserBadges", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminDeleteUserBadgesNoContent creates a AdminDeleteUserBadgesNoContent with default headers values
|
||||
func NewAdminDeleteUserBadgesNoContent() *AdminDeleteUserBadgesNoContent {
|
||||
return &AdminDeleteUserBadgesNoContent{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminDeleteUserBadgesNoContent describes a response with status code 204, with default header values.
|
||||
|
||||
APIEmpty is an empty response
|
||||
*/
|
||||
type AdminDeleteUserBadgesNoContent struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin delete user badges no content response has a 2xx status code
|
||||
func (o *AdminDeleteUserBadgesNoContent) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin delete user badges no content response has a 3xx status code
|
||||
func (o *AdminDeleteUserBadgesNoContent) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin delete user badges no content response has a 4xx status code
|
||||
func (o *AdminDeleteUserBadgesNoContent) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin delete user badges no content response has a 5xx status code
|
||||
func (o *AdminDeleteUserBadgesNoContent) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin delete user badges no content response a status code equal to that given
|
||||
func (o *AdminDeleteUserBadgesNoContent) IsCode(code int) bool {
|
||||
return code == 204
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin delete user badges no content response
|
||||
func (o *AdminDeleteUserBadgesNoContent) Code() int {
|
||||
return 204
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserBadgesNoContent) Error() string {
|
||||
return fmt.Sprintf("[DELETE /admin/users/{username}/badges][%d] adminDeleteUserBadgesNoContent", 204)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserBadgesNoContent) String() string {
|
||||
return fmt.Sprintf("[DELETE /admin/users/{username}/badges][%d] adminDeleteUserBadgesNoContent", 204)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserBadgesNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminDeleteUserBadgesForbidden creates a AdminDeleteUserBadgesForbidden with default headers values
|
||||
func NewAdminDeleteUserBadgesForbidden() *AdminDeleteUserBadgesForbidden {
|
||||
return &AdminDeleteUserBadgesForbidden{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminDeleteUserBadgesForbidden describes a response with status code 403, with default header values.
|
||||
|
||||
APIForbiddenError is a forbidden error response
|
||||
*/
|
||||
type AdminDeleteUserBadgesForbidden struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin delete user badges forbidden response has a 2xx status code
|
||||
func (o *AdminDeleteUserBadgesForbidden) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin delete user badges forbidden response has a 3xx status code
|
||||
func (o *AdminDeleteUserBadgesForbidden) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin delete user badges forbidden response has a 4xx status code
|
||||
func (o *AdminDeleteUserBadgesForbidden) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin delete user badges forbidden response has a 5xx status code
|
||||
func (o *AdminDeleteUserBadgesForbidden) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin delete user badges forbidden response a status code equal to that given
|
||||
func (o *AdminDeleteUserBadgesForbidden) IsCode(code int) bool {
|
||||
return code == 403
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin delete user badges forbidden response
|
||||
func (o *AdminDeleteUserBadgesForbidden) Code() int {
|
||||
return 403
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserBadgesForbidden) Error() string {
|
||||
return fmt.Sprintf("[DELETE /admin/users/{username}/badges][%d] adminDeleteUserBadgesForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserBadgesForbidden) String() string {
|
||||
return fmt.Sprintf("[DELETE /admin/users/{username}/badges][%d] adminDeleteUserBadgesForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserBadgesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminDeleteUserBadgesUnprocessableEntity creates a AdminDeleteUserBadgesUnprocessableEntity with default headers values
|
||||
func NewAdminDeleteUserBadgesUnprocessableEntity() *AdminDeleteUserBadgesUnprocessableEntity {
|
||||
return &AdminDeleteUserBadgesUnprocessableEntity{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminDeleteUserBadgesUnprocessableEntity describes a response with status code 422, with default header values.
|
||||
|
||||
APIValidationError is error format response related to input validation
|
||||
*/
|
||||
type AdminDeleteUserBadgesUnprocessableEntity struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin delete user badges unprocessable entity response has a 2xx status code
|
||||
func (o *AdminDeleteUserBadgesUnprocessableEntity) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin delete user badges unprocessable entity response has a 3xx status code
|
||||
func (o *AdminDeleteUserBadgesUnprocessableEntity) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin delete user badges unprocessable entity response has a 4xx status code
|
||||
func (o *AdminDeleteUserBadgesUnprocessableEntity) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin delete user badges unprocessable entity response has a 5xx status code
|
||||
func (o *AdminDeleteUserBadgesUnprocessableEntity) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin delete user badges unprocessable entity response a status code equal to that given
|
||||
func (o *AdminDeleteUserBadgesUnprocessableEntity) IsCode(code int) bool {
|
||||
return code == 422
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin delete user badges unprocessable entity response
|
||||
func (o *AdminDeleteUserBadgesUnprocessableEntity) Code() int {
|
||||
return 422
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserBadgesUnprocessableEntity) Error() string {
|
||||
return fmt.Sprintf("[DELETE /admin/users/{username}/badges][%d] adminDeleteUserBadgesUnprocessableEntity", 422)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserBadgesUnprocessableEntity) String() string {
|
||||
return fmt.Sprintf("[DELETE /admin/users/{username}/badges][%d] adminDeleteUserBadgesUnprocessableEntity", 422)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserBadgesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,186 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// NewAdminDeleteUserParams creates a new AdminDeleteUserParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewAdminDeleteUserParams() *AdminDeleteUserParams {
|
||||
return &AdminDeleteUserParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminDeleteUserParamsWithTimeout creates a new AdminDeleteUserParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewAdminDeleteUserParamsWithTimeout(timeout time.Duration) *AdminDeleteUserParams {
|
||||
return &AdminDeleteUserParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminDeleteUserParamsWithContext creates a new AdminDeleteUserParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewAdminDeleteUserParamsWithContext(ctx context.Context) *AdminDeleteUserParams {
|
||||
return &AdminDeleteUserParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminDeleteUserParamsWithHTTPClient creates a new AdminDeleteUserParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewAdminDeleteUserParamsWithHTTPClient(client *http.Client) *AdminDeleteUserParams {
|
||||
return &AdminDeleteUserParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminDeleteUserParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the admin delete user operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type AdminDeleteUserParams struct {
|
||||
|
||||
/* Purge.
|
||||
|
||||
purge the user from the system completely
|
||||
*/
|
||||
Purge *bool
|
||||
|
||||
/* Username.
|
||||
|
||||
username of user to delete
|
||||
*/
|
||||
Username string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the admin delete user params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminDeleteUserParams) WithDefaults() *AdminDeleteUserParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the admin delete user params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminDeleteUserParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the admin delete user params
|
||||
func (o *AdminDeleteUserParams) WithTimeout(timeout time.Duration) *AdminDeleteUserParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the admin delete user params
|
||||
func (o *AdminDeleteUserParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the admin delete user params
|
||||
func (o *AdminDeleteUserParams) WithContext(ctx context.Context) *AdminDeleteUserParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the admin delete user params
|
||||
func (o *AdminDeleteUserParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the admin delete user params
|
||||
func (o *AdminDeleteUserParams) WithHTTPClient(client *http.Client) *AdminDeleteUserParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the admin delete user params
|
||||
func (o *AdminDeleteUserParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithPurge adds the purge to the admin delete user params
|
||||
func (o *AdminDeleteUserParams) WithPurge(purge *bool) *AdminDeleteUserParams {
|
||||
o.SetPurge(purge)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPurge adds the purge to the admin delete user params
|
||||
func (o *AdminDeleteUserParams) SetPurge(purge *bool) {
|
||||
o.Purge = purge
|
||||
}
|
||||
|
||||
// WithUsername adds the username to the admin delete user params
|
||||
func (o *AdminDeleteUserParams) WithUsername(username string) *AdminDeleteUserParams {
|
||||
o.SetUsername(username)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetUsername adds the username to the admin delete user params
|
||||
func (o *AdminDeleteUserParams) SetUsername(username string) {
|
||||
o.Username = username
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *AdminDeleteUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.Purge != nil {
|
||||
|
||||
// query param purge
|
||||
var qrPurge bool
|
||||
|
||||
if o.Purge != nil {
|
||||
qrPurge = *o.Purge
|
||||
}
|
||||
qPurge := swag.FormatBool(qrPurge)
|
||||
if qPurge != "" {
|
||||
|
||||
if err := r.SetQueryParam("purge", qPurge); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// path param username
|
||||
if err := r.SetPathParam("username", o.Username); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,176 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// NewAdminDeleteUserPublicKeyParams creates a new AdminDeleteUserPublicKeyParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewAdminDeleteUserPublicKeyParams() *AdminDeleteUserPublicKeyParams {
|
||||
return &AdminDeleteUserPublicKeyParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminDeleteUserPublicKeyParamsWithTimeout creates a new AdminDeleteUserPublicKeyParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewAdminDeleteUserPublicKeyParamsWithTimeout(timeout time.Duration) *AdminDeleteUserPublicKeyParams {
|
||||
return &AdminDeleteUserPublicKeyParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminDeleteUserPublicKeyParamsWithContext creates a new AdminDeleteUserPublicKeyParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewAdminDeleteUserPublicKeyParamsWithContext(ctx context.Context) *AdminDeleteUserPublicKeyParams {
|
||||
return &AdminDeleteUserPublicKeyParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminDeleteUserPublicKeyParamsWithHTTPClient creates a new AdminDeleteUserPublicKeyParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewAdminDeleteUserPublicKeyParamsWithHTTPClient(client *http.Client) *AdminDeleteUserPublicKeyParams {
|
||||
return &AdminDeleteUserPublicKeyParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminDeleteUserPublicKeyParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the admin delete user public key operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type AdminDeleteUserPublicKeyParams struct {
|
||||
|
||||
/* ID.
|
||||
|
||||
id of the key to delete
|
||||
|
||||
Format: int64
|
||||
*/
|
||||
ID int64
|
||||
|
||||
/* Username.
|
||||
|
||||
username of user
|
||||
*/
|
||||
Username string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the admin delete user public key params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminDeleteUserPublicKeyParams) WithDefaults() *AdminDeleteUserPublicKeyParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the admin delete user public key params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminDeleteUserPublicKeyParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the admin delete user public key params
|
||||
func (o *AdminDeleteUserPublicKeyParams) WithTimeout(timeout time.Duration) *AdminDeleteUserPublicKeyParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the admin delete user public key params
|
||||
func (o *AdminDeleteUserPublicKeyParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the admin delete user public key params
|
||||
func (o *AdminDeleteUserPublicKeyParams) WithContext(ctx context.Context) *AdminDeleteUserPublicKeyParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the admin delete user public key params
|
||||
func (o *AdminDeleteUserPublicKeyParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the admin delete user public key params
|
||||
func (o *AdminDeleteUserPublicKeyParams) WithHTTPClient(client *http.Client) *AdminDeleteUserPublicKeyParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the admin delete user public key params
|
||||
func (o *AdminDeleteUserPublicKeyParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithID adds the id to the admin delete user public key params
|
||||
func (o *AdminDeleteUserPublicKeyParams) WithID(id int64) *AdminDeleteUserPublicKeyParams {
|
||||
o.SetID(id)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetID adds the id to the admin delete user public key params
|
||||
func (o *AdminDeleteUserPublicKeyParams) SetID(id int64) {
|
||||
o.ID = id
|
||||
}
|
||||
|
||||
// WithUsername adds the username to the admin delete user public key params
|
||||
func (o *AdminDeleteUserPublicKeyParams) WithUsername(username string) *AdminDeleteUserPublicKeyParams {
|
||||
o.SetUsername(username)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetUsername adds the username to the admin delete user public key params
|
||||
func (o *AdminDeleteUserPublicKeyParams) SetUsername(username string) {
|
||||
o.Username = username
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *AdminDeleteUserPublicKeyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// path param id
|
||||
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// path param username
|
||||
if err := r.SetPathParam("username", o.Username); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,228 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// AdminDeleteUserPublicKeyReader is a Reader for the AdminDeleteUserPublicKey structure.
|
||||
type AdminDeleteUserPublicKeyReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *AdminDeleteUserPublicKeyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 204:
|
||||
result := NewAdminDeleteUserPublicKeyNoContent()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 403:
|
||||
result := NewAdminDeleteUserPublicKeyForbidden()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 404:
|
||||
result := NewAdminDeleteUserPublicKeyNotFound()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[DELETE /admin/users/{username}/keys/{id}] adminDeleteUserPublicKey", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminDeleteUserPublicKeyNoContent creates a AdminDeleteUserPublicKeyNoContent with default headers values
|
||||
func NewAdminDeleteUserPublicKeyNoContent() *AdminDeleteUserPublicKeyNoContent {
|
||||
return &AdminDeleteUserPublicKeyNoContent{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminDeleteUserPublicKeyNoContent describes a response with status code 204, with default header values.
|
||||
|
||||
APIEmpty is an empty response
|
||||
*/
|
||||
type AdminDeleteUserPublicKeyNoContent struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin delete user public key no content response has a 2xx status code
|
||||
func (o *AdminDeleteUserPublicKeyNoContent) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin delete user public key no content response has a 3xx status code
|
||||
func (o *AdminDeleteUserPublicKeyNoContent) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin delete user public key no content response has a 4xx status code
|
||||
func (o *AdminDeleteUserPublicKeyNoContent) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin delete user public key no content response has a 5xx status code
|
||||
func (o *AdminDeleteUserPublicKeyNoContent) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin delete user public key no content response a status code equal to that given
|
||||
func (o *AdminDeleteUserPublicKeyNoContent) IsCode(code int) bool {
|
||||
return code == 204
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin delete user public key no content response
|
||||
func (o *AdminDeleteUserPublicKeyNoContent) Code() int {
|
||||
return 204
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserPublicKeyNoContent) Error() string {
|
||||
return fmt.Sprintf("[DELETE /admin/users/{username}/keys/{id}][%d] adminDeleteUserPublicKeyNoContent", 204)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserPublicKeyNoContent) String() string {
|
||||
return fmt.Sprintf("[DELETE /admin/users/{username}/keys/{id}][%d] adminDeleteUserPublicKeyNoContent", 204)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserPublicKeyNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminDeleteUserPublicKeyForbidden creates a AdminDeleteUserPublicKeyForbidden with default headers values
|
||||
func NewAdminDeleteUserPublicKeyForbidden() *AdminDeleteUserPublicKeyForbidden {
|
||||
return &AdminDeleteUserPublicKeyForbidden{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminDeleteUserPublicKeyForbidden describes a response with status code 403, with default header values.
|
||||
|
||||
APIForbiddenError is a forbidden error response
|
||||
*/
|
||||
type AdminDeleteUserPublicKeyForbidden struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin delete user public key forbidden response has a 2xx status code
|
||||
func (o *AdminDeleteUserPublicKeyForbidden) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin delete user public key forbidden response has a 3xx status code
|
||||
func (o *AdminDeleteUserPublicKeyForbidden) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin delete user public key forbidden response has a 4xx status code
|
||||
func (o *AdminDeleteUserPublicKeyForbidden) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin delete user public key forbidden response has a 5xx status code
|
||||
func (o *AdminDeleteUserPublicKeyForbidden) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin delete user public key forbidden response a status code equal to that given
|
||||
func (o *AdminDeleteUserPublicKeyForbidden) IsCode(code int) bool {
|
||||
return code == 403
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin delete user public key forbidden response
|
||||
func (o *AdminDeleteUserPublicKeyForbidden) Code() int {
|
||||
return 403
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserPublicKeyForbidden) Error() string {
|
||||
return fmt.Sprintf("[DELETE /admin/users/{username}/keys/{id}][%d] adminDeleteUserPublicKeyForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserPublicKeyForbidden) String() string {
|
||||
return fmt.Sprintf("[DELETE /admin/users/{username}/keys/{id}][%d] adminDeleteUserPublicKeyForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserPublicKeyForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminDeleteUserPublicKeyNotFound creates a AdminDeleteUserPublicKeyNotFound with default headers values
|
||||
func NewAdminDeleteUserPublicKeyNotFound() *AdminDeleteUserPublicKeyNotFound {
|
||||
return &AdminDeleteUserPublicKeyNotFound{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminDeleteUserPublicKeyNotFound describes a response with status code 404, with default header values.
|
||||
|
||||
APINotFound is a not found empty response
|
||||
*/
|
||||
type AdminDeleteUserPublicKeyNotFound struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin delete user public key not found response has a 2xx status code
|
||||
func (o *AdminDeleteUserPublicKeyNotFound) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin delete user public key not found response has a 3xx status code
|
||||
func (o *AdminDeleteUserPublicKeyNotFound) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin delete user public key not found response has a 4xx status code
|
||||
func (o *AdminDeleteUserPublicKeyNotFound) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin delete user public key not found response has a 5xx status code
|
||||
func (o *AdminDeleteUserPublicKeyNotFound) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin delete user public key not found response a status code equal to that given
|
||||
func (o *AdminDeleteUserPublicKeyNotFound) IsCode(code int) bool {
|
||||
return code == 404
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin delete user public key not found response
|
||||
func (o *AdminDeleteUserPublicKeyNotFound) Code() int {
|
||||
return 404
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserPublicKeyNotFound) Error() string {
|
||||
return fmt.Sprintf("[DELETE /admin/users/{username}/keys/{id}][%d] adminDeleteUserPublicKeyNotFound", 404)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserPublicKeyNotFound) String() string {
|
||||
return fmt.Sprintf("[DELETE /admin/users/{username}/keys/{id}][%d] adminDeleteUserPublicKeyNotFound", 404)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserPublicKeyNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,306 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// AdminDeleteUserReader is a Reader for the AdminDeleteUser structure.
|
||||
type AdminDeleteUserReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *AdminDeleteUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 204:
|
||||
result := NewAdminDeleteUserNoContent()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 403:
|
||||
result := NewAdminDeleteUserForbidden()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 404:
|
||||
result := NewAdminDeleteUserNotFound()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 422:
|
||||
result := NewAdminDeleteUserUnprocessableEntity()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[DELETE /admin/users/{username}] adminDeleteUser", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminDeleteUserNoContent creates a AdminDeleteUserNoContent with default headers values
|
||||
func NewAdminDeleteUserNoContent() *AdminDeleteUserNoContent {
|
||||
return &AdminDeleteUserNoContent{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminDeleteUserNoContent describes a response with status code 204, with default header values.
|
||||
|
||||
APIEmpty is an empty response
|
||||
*/
|
||||
type AdminDeleteUserNoContent struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin delete user no content response has a 2xx status code
|
||||
func (o *AdminDeleteUserNoContent) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin delete user no content response has a 3xx status code
|
||||
func (o *AdminDeleteUserNoContent) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin delete user no content response has a 4xx status code
|
||||
func (o *AdminDeleteUserNoContent) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin delete user no content response has a 5xx status code
|
||||
func (o *AdminDeleteUserNoContent) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin delete user no content response a status code equal to that given
|
||||
func (o *AdminDeleteUserNoContent) IsCode(code int) bool {
|
||||
return code == 204
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin delete user no content response
|
||||
func (o *AdminDeleteUserNoContent) Code() int {
|
||||
return 204
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserNoContent) Error() string {
|
||||
return fmt.Sprintf("[DELETE /admin/users/{username}][%d] adminDeleteUserNoContent", 204)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserNoContent) String() string {
|
||||
return fmt.Sprintf("[DELETE /admin/users/{username}][%d] adminDeleteUserNoContent", 204)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminDeleteUserForbidden creates a AdminDeleteUserForbidden with default headers values
|
||||
func NewAdminDeleteUserForbidden() *AdminDeleteUserForbidden {
|
||||
return &AdminDeleteUserForbidden{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminDeleteUserForbidden describes a response with status code 403, with default header values.
|
||||
|
||||
APIForbiddenError is a forbidden error response
|
||||
*/
|
||||
type AdminDeleteUserForbidden struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin delete user forbidden response has a 2xx status code
|
||||
func (o *AdminDeleteUserForbidden) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin delete user forbidden response has a 3xx status code
|
||||
func (o *AdminDeleteUserForbidden) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin delete user forbidden response has a 4xx status code
|
||||
func (o *AdminDeleteUserForbidden) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin delete user forbidden response has a 5xx status code
|
||||
func (o *AdminDeleteUserForbidden) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin delete user forbidden response a status code equal to that given
|
||||
func (o *AdminDeleteUserForbidden) IsCode(code int) bool {
|
||||
return code == 403
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin delete user forbidden response
|
||||
func (o *AdminDeleteUserForbidden) Code() int {
|
||||
return 403
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserForbidden) Error() string {
|
||||
return fmt.Sprintf("[DELETE /admin/users/{username}][%d] adminDeleteUserForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserForbidden) String() string {
|
||||
return fmt.Sprintf("[DELETE /admin/users/{username}][%d] adminDeleteUserForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminDeleteUserNotFound creates a AdminDeleteUserNotFound with default headers values
|
||||
func NewAdminDeleteUserNotFound() *AdminDeleteUserNotFound {
|
||||
return &AdminDeleteUserNotFound{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminDeleteUserNotFound describes a response with status code 404, with default header values.
|
||||
|
||||
APINotFound is a not found empty response
|
||||
*/
|
||||
type AdminDeleteUserNotFound struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin delete user not found response has a 2xx status code
|
||||
func (o *AdminDeleteUserNotFound) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin delete user not found response has a 3xx status code
|
||||
func (o *AdminDeleteUserNotFound) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin delete user not found response has a 4xx status code
|
||||
func (o *AdminDeleteUserNotFound) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin delete user not found response has a 5xx status code
|
||||
func (o *AdminDeleteUserNotFound) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin delete user not found response a status code equal to that given
|
||||
func (o *AdminDeleteUserNotFound) IsCode(code int) bool {
|
||||
return code == 404
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin delete user not found response
|
||||
func (o *AdminDeleteUserNotFound) Code() int {
|
||||
return 404
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserNotFound) Error() string {
|
||||
return fmt.Sprintf("[DELETE /admin/users/{username}][%d] adminDeleteUserNotFound", 404)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserNotFound) String() string {
|
||||
return fmt.Sprintf("[DELETE /admin/users/{username}][%d] adminDeleteUserNotFound", 404)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminDeleteUserUnprocessableEntity creates a AdminDeleteUserUnprocessableEntity with default headers values
|
||||
func NewAdminDeleteUserUnprocessableEntity() *AdminDeleteUserUnprocessableEntity {
|
||||
return &AdminDeleteUserUnprocessableEntity{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminDeleteUserUnprocessableEntity describes a response with status code 422, with default header values.
|
||||
|
||||
APIValidationError is error format response related to input validation
|
||||
*/
|
||||
type AdminDeleteUserUnprocessableEntity struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin delete user unprocessable entity response has a 2xx status code
|
||||
func (o *AdminDeleteUserUnprocessableEntity) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin delete user unprocessable entity response has a 3xx status code
|
||||
func (o *AdminDeleteUserUnprocessableEntity) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin delete user unprocessable entity response has a 4xx status code
|
||||
func (o *AdminDeleteUserUnprocessableEntity) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin delete user unprocessable entity response has a 5xx status code
|
||||
func (o *AdminDeleteUserUnprocessableEntity) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin delete user unprocessable entity response a status code equal to that given
|
||||
func (o *AdminDeleteUserUnprocessableEntity) IsCode(code int) bool {
|
||||
return code == 422
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin delete user unprocessable entity response
|
||||
func (o *AdminDeleteUserUnprocessableEntity) Code() int {
|
||||
return 422
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserUnprocessableEntity) Error() string {
|
||||
return fmt.Sprintf("[DELETE /admin/users/{username}][%d] adminDeleteUserUnprocessableEntity", 422)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserUnprocessableEntity) String() string {
|
||||
return fmt.Sprintf("[DELETE /admin/users/{username}][%d] adminDeleteUserUnprocessableEntity", 422)
|
||||
}
|
||||
|
||||
func (o *AdminDeleteUserUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,175 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"src.opensuse.org/autogits/common/gitea-generated/models"
|
||||
)
|
||||
|
||||
// NewAdminEditHookParams creates a new AdminEditHookParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewAdminEditHookParams() *AdminEditHookParams {
|
||||
return &AdminEditHookParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminEditHookParamsWithTimeout creates a new AdminEditHookParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewAdminEditHookParamsWithTimeout(timeout time.Duration) *AdminEditHookParams {
|
||||
return &AdminEditHookParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminEditHookParamsWithContext creates a new AdminEditHookParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewAdminEditHookParamsWithContext(ctx context.Context) *AdminEditHookParams {
|
||||
return &AdminEditHookParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminEditHookParamsWithHTTPClient creates a new AdminEditHookParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewAdminEditHookParamsWithHTTPClient(client *http.Client) *AdminEditHookParams {
|
||||
return &AdminEditHookParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminEditHookParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the admin edit hook operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type AdminEditHookParams struct {
|
||||
|
||||
// Body.
|
||||
Body *models.EditHookOption
|
||||
|
||||
/* ID.
|
||||
|
||||
id of the hook to update
|
||||
|
||||
Format: int64
|
||||
*/
|
||||
ID int64
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the admin edit hook params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminEditHookParams) WithDefaults() *AdminEditHookParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the admin edit hook params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminEditHookParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the admin edit hook params
|
||||
func (o *AdminEditHookParams) WithTimeout(timeout time.Duration) *AdminEditHookParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the admin edit hook params
|
||||
func (o *AdminEditHookParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the admin edit hook params
|
||||
func (o *AdminEditHookParams) WithContext(ctx context.Context) *AdminEditHookParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the admin edit hook params
|
||||
func (o *AdminEditHookParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the admin edit hook params
|
||||
func (o *AdminEditHookParams) WithHTTPClient(client *http.Client) *AdminEditHookParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the admin edit hook params
|
||||
func (o *AdminEditHookParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the admin edit hook params
|
||||
func (o *AdminEditHookParams) WithBody(body *models.EditHookOption) *AdminEditHookParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the admin edit hook params
|
||||
func (o *AdminEditHookParams) SetBody(body *models.EditHookOption) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WithID adds the id to the admin edit hook params
|
||||
func (o *AdminEditHookParams) WithID(id int64) *AdminEditHookParams {
|
||||
o.SetID(id)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetID adds the id to the admin edit hook params
|
||||
func (o *AdminEditHookParams) SetID(id int64) {
|
||||
o.ID = id
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *AdminEditHookParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// path param id
|
||||
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"src.opensuse.org/autogits/common/gitea-generated/models"
|
||||
)
|
||||
|
||||
// AdminEditHookReader is a Reader for the AdminEditHook structure.
|
||||
type AdminEditHookReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *AdminEditHookReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewAdminEditHookOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[PATCH /admin/hooks/{id}] adminEditHook", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminEditHookOK creates a AdminEditHookOK with default headers values
|
||||
func NewAdminEditHookOK() *AdminEditHookOK {
|
||||
return &AdminEditHookOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminEditHookOK describes a response with status code 200, with default header values.
|
||||
|
||||
Hook
|
||||
*/
|
||||
type AdminEditHookOK struct {
|
||||
Payload *models.Hook
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin edit hook o k response has a 2xx status code
|
||||
func (o *AdminEditHookOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin edit hook o k response has a 3xx status code
|
||||
func (o *AdminEditHookOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin edit hook o k response has a 4xx status code
|
||||
func (o *AdminEditHookOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin edit hook o k response has a 5xx status code
|
||||
func (o *AdminEditHookOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin edit hook o k response a status code equal to that given
|
||||
func (o *AdminEditHookOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin edit hook o k response
|
||||
func (o *AdminEditHookOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *AdminEditHookOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PATCH /admin/hooks/{id}][%d] adminEditHookOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *AdminEditHookOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PATCH /admin/hooks/{id}][%d] adminEditHookOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *AdminEditHookOK) GetPayload() *models.Hook {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *AdminEditHookOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.Hook)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,172 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"src.opensuse.org/autogits/common/gitea-generated/models"
|
||||
)
|
||||
|
||||
// NewAdminEditUserParams creates a new AdminEditUserParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewAdminEditUserParams() *AdminEditUserParams {
|
||||
return &AdminEditUserParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminEditUserParamsWithTimeout creates a new AdminEditUserParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewAdminEditUserParamsWithTimeout(timeout time.Duration) *AdminEditUserParams {
|
||||
return &AdminEditUserParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminEditUserParamsWithContext creates a new AdminEditUserParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewAdminEditUserParamsWithContext(ctx context.Context) *AdminEditUserParams {
|
||||
return &AdminEditUserParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminEditUserParamsWithHTTPClient creates a new AdminEditUserParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewAdminEditUserParamsWithHTTPClient(client *http.Client) *AdminEditUserParams {
|
||||
return &AdminEditUserParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminEditUserParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the admin edit user operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type AdminEditUserParams struct {
|
||||
|
||||
// Body.
|
||||
Body *models.EditUserOption
|
||||
|
||||
/* Username.
|
||||
|
||||
username of user to edit
|
||||
*/
|
||||
Username string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the admin edit user params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminEditUserParams) WithDefaults() *AdminEditUserParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the admin edit user params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminEditUserParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the admin edit user params
|
||||
func (o *AdminEditUserParams) WithTimeout(timeout time.Duration) *AdminEditUserParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the admin edit user params
|
||||
func (o *AdminEditUserParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the admin edit user params
|
||||
func (o *AdminEditUserParams) WithContext(ctx context.Context) *AdminEditUserParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the admin edit user params
|
||||
func (o *AdminEditUserParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the admin edit user params
|
||||
func (o *AdminEditUserParams) WithHTTPClient(client *http.Client) *AdminEditUserParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the admin edit user params
|
||||
func (o *AdminEditUserParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the admin edit user params
|
||||
func (o *AdminEditUserParams) WithBody(body *models.EditUserOption) *AdminEditUserParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the admin edit user params
|
||||
func (o *AdminEditUserParams) SetBody(body *models.EditUserOption) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WithUsername adds the username to the admin edit user params
|
||||
func (o *AdminEditUserParams) WithUsername(username string) *AdminEditUserParams {
|
||||
o.SetUsername(username)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetUsername adds the username to the admin edit user params
|
||||
func (o *AdminEditUserParams) SetUsername(username string) {
|
||||
o.Username = username
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *AdminEditUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// path param username
|
||||
if err := r.SetPathParam("username", o.Username); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,340 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"src.opensuse.org/autogits/common/gitea-generated/models"
|
||||
)
|
||||
|
||||
// AdminEditUserReader is a Reader for the AdminEditUser structure.
|
||||
type AdminEditUserReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *AdminEditUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewAdminEditUserOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 400:
|
||||
result := NewAdminEditUserBadRequest()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 403:
|
||||
result := NewAdminEditUserForbidden()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 422:
|
||||
result := NewAdminEditUserUnprocessableEntity()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[PATCH /admin/users/{username}] adminEditUser", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminEditUserOK creates a AdminEditUserOK with default headers values
|
||||
func NewAdminEditUserOK() *AdminEditUserOK {
|
||||
return &AdminEditUserOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminEditUserOK describes a response with status code 200, with default header values.
|
||||
|
||||
User
|
||||
*/
|
||||
type AdminEditUserOK struct {
|
||||
Payload *models.User
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin edit user o k response has a 2xx status code
|
||||
func (o *AdminEditUserOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin edit user o k response has a 3xx status code
|
||||
func (o *AdminEditUserOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin edit user o k response has a 4xx status code
|
||||
func (o *AdminEditUserOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin edit user o k response has a 5xx status code
|
||||
func (o *AdminEditUserOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin edit user o k response a status code equal to that given
|
||||
func (o *AdminEditUserOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin edit user o k response
|
||||
func (o *AdminEditUserOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *AdminEditUserOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PATCH /admin/users/{username}][%d] adminEditUserOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *AdminEditUserOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[PATCH /admin/users/{username}][%d] adminEditUserOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *AdminEditUserOK) GetPayload() *models.User {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *AdminEditUserOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.User)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminEditUserBadRequest creates a AdminEditUserBadRequest with default headers values
|
||||
func NewAdminEditUserBadRequest() *AdminEditUserBadRequest {
|
||||
return &AdminEditUserBadRequest{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminEditUserBadRequest describes a response with status code 400, with default header values.
|
||||
|
||||
APIError is error format response
|
||||
*/
|
||||
type AdminEditUserBadRequest struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin edit user bad request response has a 2xx status code
|
||||
func (o *AdminEditUserBadRequest) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin edit user bad request response has a 3xx status code
|
||||
func (o *AdminEditUserBadRequest) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin edit user bad request response has a 4xx status code
|
||||
func (o *AdminEditUserBadRequest) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin edit user bad request response has a 5xx status code
|
||||
func (o *AdminEditUserBadRequest) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin edit user bad request response a status code equal to that given
|
||||
func (o *AdminEditUserBadRequest) IsCode(code int) bool {
|
||||
return code == 400
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin edit user bad request response
|
||||
func (o *AdminEditUserBadRequest) Code() int {
|
||||
return 400
|
||||
}
|
||||
|
||||
func (o *AdminEditUserBadRequest) Error() string {
|
||||
return fmt.Sprintf("[PATCH /admin/users/{username}][%d] adminEditUserBadRequest", 400)
|
||||
}
|
||||
|
||||
func (o *AdminEditUserBadRequest) String() string {
|
||||
return fmt.Sprintf("[PATCH /admin/users/{username}][%d] adminEditUserBadRequest", 400)
|
||||
}
|
||||
|
||||
func (o *AdminEditUserBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminEditUserForbidden creates a AdminEditUserForbidden with default headers values
|
||||
func NewAdminEditUserForbidden() *AdminEditUserForbidden {
|
||||
return &AdminEditUserForbidden{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminEditUserForbidden describes a response with status code 403, with default header values.
|
||||
|
||||
APIForbiddenError is a forbidden error response
|
||||
*/
|
||||
type AdminEditUserForbidden struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin edit user forbidden response has a 2xx status code
|
||||
func (o *AdminEditUserForbidden) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin edit user forbidden response has a 3xx status code
|
||||
func (o *AdminEditUserForbidden) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin edit user forbidden response has a 4xx status code
|
||||
func (o *AdminEditUserForbidden) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin edit user forbidden response has a 5xx status code
|
||||
func (o *AdminEditUserForbidden) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin edit user forbidden response a status code equal to that given
|
||||
func (o *AdminEditUserForbidden) IsCode(code int) bool {
|
||||
return code == 403
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin edit user forbidden response
|
||||
func (o *AdminEditUserForbidden) Code() int {
|
||||
return 403
|
||||
}
|
||||
|
||||
func (o *AdminEditUserForbidden) Error() string {
|
||||
return fmt.Sprintf("[PATCH /admin/users/{username}][%d] adminEditUserForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminEditUserForbidden) String() string {
|
||||
return fmt.Sprintf("[PATCH /admin/users/{username}][%d] adminEditUserForbidden", 403)
|
||||
}
|
||||
|
||||
func (o *AdminEditUserForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewAdminEditUserUnprocessableEntity creates a AdminEditUserUnprocessableEntity with default headers values
|
||||
func NewAdminEditUserUnprocessableEntity() *AdminEditUserUnprocessableEntity {
|
||||
return &AdminEditUserUnprocessableEntity{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminEditUserUnprocessableEntity describes a response with status code 422, with default header values.
|
||||
|
||||
APIValidationError is error format response related to input validation
|
||||
*/
|
||||
type AdminEditUserUnprocessableEntity struct {
|
||||
Message string
|
||||
URL string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin edit user unprocessable entity response has a 2xx status code
|
||||
func (o *AdminEditUserUnprocessableEntity) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin edit user unprocessable entity response has a 3xx status code
|
||||
func (o *AdminEditUserUnprocessableEntity) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin edit user unprocessable entity response has a 4xx status code
|
||||
func (o *AdminEditUserUnprocessableEntity) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin edit user unprocessable entity response has a 5xx status code
|
||||
func (o *AdminEditUserUnprocessableEntity) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this admin edit user unprocessable entity response a status code equal to that given
|
||||
func (o *AdminEditUserUnprocessableEntity) IsCode(code int) bool {
|
||||
return code == 422
|
||||
}
|
||||
|
||||
// Code gets the status code for the admin edit user unprocessable entity response
|
||||
func (o *AdminEditUserUnprocessableEntity) Code() int {
|
||||
return 422
|
||||
}
|
||||
|
||||
func (o *AdminEditUserUnprocessableEntity) Error() string {
|
||||
return fmt.Sprintf("[PATCH /admin/users/{username}][%d] adminEditUserUnprocessableEntity", 422)
|
||||
}
|
||||
|
||||
func (o *AdminEditUserUnprocessableEntity) String() string {
|
||||
return fmt.Sprintf("[PATCH /admin/users/{username}][%d] adminEditUserUnprocessableEntity", 422)
|
||||
}
|
||||
|
||||
func (o *AdminEditUserUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// hydrates response header message
|
||||
hdrMessage := response.GetHeader("message")
|
||||
|
||||
if hdrMessage != "" {
|
||||
o.Message = hdrMessage
|
||||
}
|
||||
|
||||
// hydrates response header url
|
||||
hdrURL := response.GetHeader("url")
|
||||
|
||||
if hdrURL != "" {
|
||||
o.URL = hdrURL
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,198 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// NewAdminGetAllEmailsParams creates a new AdminGetAllEmailsParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewAdminGetAllEmailsParams() *AdminGetAllEmailsParams {
|
||||
return &AdminGetAllEmailsParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminGetAllEmailsParamsWithTimeout creates a new AdminGetAllEmailsParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewAdminGetAllEmailsParamsWithTimeout(timeout time.Duration) *AdminGetAllEmailsParams {
|
||||
return &AdminGetAllEmailsParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminGetAllEmailsParamsWithContext creates a new AdminGetAllEmailsParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewAdminGetAllEmailsParamsWithContext(ctx context.Context) *AdminGetAllEmailsParams {
|
||||
return &AdminGetAllEmailsParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminGetAllEmailsParamsWithHTTPClient creates a new AdminGetAllEmailsParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewAdminGetAllEmailsParamsWithHTTPClient(client *http.Client) *AdminGetAllEmailsParams {
|
||||
return &AdminGetAllEmailsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminGetAllEmailsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the admin get all emails operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type AdminGetAllEmailsParams struct {
|
||||
|
||||
/* Limit.
|
||||
|
||||
page size of results
|
||||
*/
|
||||
Limit *int64
|
||||
|
||||
/* Page.
|
||||
|
||||
page number of results to return (1-based)
|
||||
*/
|
||||
Page *int64
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the admin get all emails params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminGetAllEmailsParams) WithDefaults() *AdminGetAllEmailsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the admin get all emails params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *AdminGetAllEmailsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the admin get all emails params
|
||||
func (o *AdminGetAllEmailsParams) WithTimeout(timeout time.Duration) *AdminGetAllEmailsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the admin get all emails params
|
||||
func (o *AdminGetAllEmailsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the admin get all emails params
|
||||
func (o *AdminGetAllEmailsParams) WithContext(ctx context.Context) *AdminGetAllEmailsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the admin get all emails params
|
||||
func (o *AdminGetAllEmailsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the admin get all emails params
|
||||
func (o *AdminGetAllEmailsParams) WithHTTPClient(client *http.Client) *AdminGetAllEmailsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the admin get all emails params
|
||||
func (o *AdminGetAllEmailsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithLimit adds the limit to the admin get all emails params
|
||||
func (o *AdminGetAllEmailsParams) WithLimit(limit *int64) *AdminGetAllEmailsParams {
|
||||
o.SetLimit(limit)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetLimit adds the limit to the admin get all emails params
|
||||
func (o *AdminGetAllEmailsParams) SetLimit(limit *int64) {
|
||||
o.Limit = limit
|
||||
}
|
||||
|
||||
// WithPage adds the page to the admin get all emails params
|
||||
func (o *AdminGetAllEmailsParams) WithPage(page *int64) *AdminGetAllEmailsParams {
|
||||
o.SetPage(page)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPage adds the page to the admin get all emails params
|
||||
func (o *AdminGetAllEmailsParams) SetPage(page *int64) {
|
||||
o.Page = page
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *AdminGetAllEmailsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if o.Limit != nil {
|
||||
|
||||
// query param limit
|
||||
var qrLimit int64
|
||||
|
||||
if o.Limit != nil {
|
||||
qrLimit = *o.Limit
|
||||
}
|
||||
qLimit := swag.FormatInt64(qrLimit)
|
||||
if qLimit != "" {
|
||||
|
||||
if err := r.SetQueryParam("limit", qLimit); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if o.Page != nil {
|
||||
|
||||
// query param page
|
||||
var qrPage int64
|
||||
|
||||
if o.Page != nil {
|
||||
qrPage = *o.Page
|
||||
}
|
||||
qPage := swag.FormatInt64(qrPage)
|
||||
if qPage != "" {
|
||||
|
||||
if err := r.SetQueryParam("page", qPage); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,182 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"src.opensuse.org/autogits/common/gitea-generated/models"
|
||||
)
|
||||
|
||||
// AdminGetAllEmailsReader is a Reader for the AdminGetAllEmails structure.
|
||||
type AdminGetAllEmailsReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *AdminGetAllEmailsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewAdminGetAllEmailsOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 403:
|
||||
result := NewAdminGetAllEmailsForbidden()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("[GET /admin/emails] adminGetAllEmails", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewAdminGetAllEmailsOK creates a AdminGetAllEmailsOK with default headers values
|
||||
func NewAdminGetAllEmailsOK() *AdminGetAllEmailsOK {
|
||||
return &AdminGetAllEmailsOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
AdminGetAllEmailsOK describes a response with status code 200, with default header values.
|
||||
|
||||
EmailList
|
||||
*/
|
||||
type AdminGetAllEmailsOK struct {
|
||||
Payload []*models.Email
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this admin get all emails o k response has a 2xx status code
|
||||
func (o *AdminGetAllEmailsOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this admin get all emails o k response has a 3xx status code
|
||||
func (o *AdminGetAllEmailsOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this admin get all emails o k response has a 4xx status code
|
||||
func (o *AdminGetAllEmailsOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this admin get all emails o k response has a 5xx status code
|
||||