.
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
|
||||||
|
func (o *AdminGetAllEmailsOK) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this admin get all emails o k response a status code equal to that given
|
||||||
|
func (o *AdminGetAllEmailsOK) IsCode(code int) bool {
|
||||||
|
return code == 200
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the admin get all emails o k response
|
||||||
|
func (o *AdminGetAllEmailsOK) Code() int {
|
||||||
|
return 200
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetAllEmailsOK) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[GET /admin/emails][%d] adminGetAllEmailsOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetAllEmailsOK) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[GET /admin/emails][%d] adminGetAllEmailsOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetAllEmailsOK) GetPayload() []*models.Email {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetAllEmailsOK) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminGetAllEmailsForbidden creates a AdminGetAllEmailsForbidden with default headers values
|
||||||
|
func NewAdminGetAllEmailsForbidden() *AdminGetAllEmailsForbidden {
|
||||||
|
return &AdminGetAllEmailsForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminGetAllEmailsForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
APIForbiddenError is a forbidden error response
|
||||||
|
*/
|
||||||
|
type AdminGetAllEmailsForbidden struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this admin get all emails forbidden response has a 2xx status code
|
||||||
|
func (o *AdminGetAllEmailsForbidden) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this admin get all emails forbidden response has a 3xx status code
|
||||||
|
func (o *AdminGetAllEmailsForbidden) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this admin get all emails forbidden response has a 4xx status code
|
||||||
|
func (o *AdminGetAllEmailsForbidden) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this admin get all emails forbidden response has a 5xx status code
|
||||||
|
func (o *AdminGetAllEmailsForbidden) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this admin get all emails forbidden response a status code equal to that given
|
||||||
|
func (o *AdminGetAllEmailsForbidden) IsCode(code int) bool {
|
||||||
|
return code == 403
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the admin get all emails forbidden response
|
||||||
|
func (o *AdminGetAllEmailsForbidden) Code() int {
|
||||||
|
return 403
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetAllEmailsForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /admin/emails][%d] adminGetAllEmailsForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetAllEmailsForbidden) String() string {
|
||||||
|
return fmt.Sprintf("[GET /admin/emails][%d] adminGetAllEmailsForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetAllEmailsForbidden) 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewAdminGetAllOrgsParams creates a new AdminGetAllOrgsParams 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 NewAdminGetAllOrgsParams() *AdminGetAllOrgsParams {
|
||||||
|
return &AdminGetAllOrgsParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminGetAllOrgsParamsWithTimeout creates a new AdminGetAllOrgsParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewAdminGetAllOrgsParamsWithTimeout(timeout time.Duration) *AdminGetAllOrgsParams {
|
||||||
|
return &AdminGetAllOrgsParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminGetAllOrgsParamsWithContext creates a new AdminGetAllOrgsParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewAdminGetAllOrgsParamsWithContext(ctx context.Context) *AdminGetAllOrgsParams {
|
||||||
|
return &AdminGetAllOrgsParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminGetAllOrgsParamsWithHTTPClient creates a new AdminGetAllOrgsParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewAdminGetAllOrgsParamsWithHTTPClient(client *http.Client) *AdminGetAllOrgsParams {
|
||||||
|
return &AdminGetAllOrgsParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminGetAllOrgsParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the admin get all orgs operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type AdminGetAllOrgsParams 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 orgs params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AdminGetAllOrgsParams) WithDefaults() *AdminGetAllOrgsParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the admin get all orgs params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AdminGetAllOrgsParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the admin get all orgs params
|
||||||
|
func (o *AdminGetAllOrgsParams) WithTimeout(timeout time.Duration) *AdminGetAllOrgsParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the admin get all orgs params
|
||||||
|
func (o *AdminGetAllOrgsParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the admin get all orgs params
|
||||||
|
func (o *AdminGetAllOrgsParams) WithContext(ctx context.Context) *AdminGetAllOrgsParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the admin get all orgs params
|
||||||
|
func (o *AdminGetAllOrgsParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the admin get all orgs params
|
||||||
|
func (o *AdminGetAllOrgsParams) WithHTTPClient(client *http.Client) *AdminGetAllOrgsParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the admin get all orgs params
|
||||||
|
func (o *AdminGetAllOrgsParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLimit adds the limit to the admin get all orgs params
|
||||||
|
func (o *AdminGetAllOrgsParams) WithLimit(limit *int64) *AdminGetAllOrgsParams {
|
||||||
|
o.SetLimit(limit)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLimit adds the limit to the admin get all orgs params
|
||||||
|
func (o *AdminGetAllOrgsParams) SetLimit(limit *int64) {
|
||||||
|
o.Limit = limit
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithPage adds the page to the admin get all orgs params
|
||||||
|
func (o *AdminGetAllOrgsParams) WithPage(page *int64) *AdminGetAllOrgsParams {
|
||||||
|
o.SetPage(page)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetPage adds the page to the admin get all orgs params
|
||||||
|
func (o *AdminGetAllOrgsParams) SetPage(page *int64) {
|
||||||
|
o.Page = page
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *AdminGetAllOrgsParams) 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AdminGetAllOrgsReader is a Reader for the AdminGetAllOrgs structure.
|
||||||
|
type AdminGetAllOrgsReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *AdminGetAllOrgsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewAdminGetAllOrgsOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 403:
|
||||||
|
result := NewAdminGetAllOrgsForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[GET /admin/orgs] adminGetAllOrgs", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminGetAllOrgsOK creates a AdminGetAllOrgsOK with default headers values
|
||||||
|
func NewAdminGetAllOrgsOK() *AdminGetAllOrgsOK {
|
||||||
|
return &AdminGetAllOrgsOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminGetAllOrgsOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
OrganizationList
|
||||||
|
*/
|
||||||
|
type AdminGetAllOrgsOK struct {
|
||||||
|
Payload []*models.Organization
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this admin get all orgs o k response has a 2xx status code
|
||||||
|
func (o *AdminGetAllOrgsOK) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this admin get all orgs o k response has a 3xx status code
|
||||||
|
func (o *AdminGetAllOrgsOK) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this admin get all orgs o k response has a 4xx status code
|
||||||
|
func (o *AdminGetAllOrgsOK) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this admin get all orgs o k response has a 5xx status code
|
||||||
|
func (o *AdminGetAllOrgsOK) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this admin get all orgs o k response a status code equal to that given
|
||||||
|
func (o *AdminGetAllOrgsOK) IsCode(code int) bool {
|
||||||
|
return code == 200
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the admin get all orgs o k response
|
||||||
|
func (o *AdminGetAllOrgsOK) Code() int {
|
||||||
|
return 200
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetAllOrgsOK) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[GET /admin/orgs][%d] adminGetAllOrgsOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetAllOrgsOK) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[GET /admin/orgs][%d] adminGetAllOrgsOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetAllOrgsOK) GetPayload() []*models.Organization {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetAllOrgsOK) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminGetAllOrgsForbidden creates a AdminGetAllOrgsForbidden with default headers values
|
||||||
|
func NewAdminGetAllOrgsForbidden() *AdminGetAllOrgsForbidden {
|
||||||
|
return &AdminGetAllOrgsForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminGetAllOrgsForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
APIForbiddenError is a forbidden error response
|
||||||
|
*/
|
||||||
|
type AdminGetAllOrgsForbidden struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this admin get all orgs forbidden response has a 2xx status code
|
||||||
|
func (o *AdminGetAllOrgsForbidden) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this admin get all orgs forbidden response has a 3xx status code
|
||||||
|
func (o *AdminGetAllOrgsForbidden) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this admin get all orgs forbidden response has a 4xx status code
|
||||||
|
func (o *AdminGetAllOrgsForbidden) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this admin get all orgs forbidden response has a 5xx status code
|
||||||
|
func (o *AdminGetAllOrgsForbidden) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this admin get all orgs forbidden response a status code equal to that given
|
||||||
|
func (o *AdminGetAllOrgsForbidden) IsCode(code int) bool {
|
||||||
|
return code == 403
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the admin get all orgs forbidden response
|
||||||
|
func (o *AdminGetAllOrgsForbidden) Code() int {
|
||||||
|
return 403
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetAllOrgsForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /admin/orgs][%d] adminGetAllOrgsForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetAllOrgsForbidden) String() string {
|
||||||
|
return fmt.Sprintf("[GET /admin/orgs][%d] adminGetAllOrgsForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetAllOrgsForbidden) 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,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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewAdminGetHookParams creates a new AdminGetHookParams 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 NewAdminGetHookParams() *AdminGetHookParams {
|
||||||
|
return &AdminGetHookParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminGetHookParamsWithTimeout creates a new AdminGetHookParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewAdminGetHookParamsWithTimeout(timeout time.Duration) *AdminGetHookParams {
|
||||||
|
return &AdminGetHookParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminGetHookParamsWithContext creates a new AdminGetHookParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewAdminGetHookParamsWithContext(ctx context.Context) *AdminGetHookParams {
|
||||||
|
return &AdminGetHookParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminGetHookParamsWithHTTPClient creates a new AdminGetHookParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewAdminGetHookParamsWithHTTPClient(client *http.Client) *AdminGetHookParams {
|
||||||
|
return &AdminGetHookParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminGetHookParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the admin get hook operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type AdminGetHookParams struct {
|
||||||
|
|
||||||
|
/* ID.
|
||||||
|
|
||||||
|
id of the hook to get
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
ID int64
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the admin get hook params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AdminGetHookParams) WithDefaults() *AdminGetHookParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the admin get hook params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AdminGetHookParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the admin get hook params
|
||||||
|
func (o *AdminGetHookParams) WithTimeout(timeout time.Duration) *AdminGetHookParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the admin get hook params
|
||||||
|
func (o *AdminGetHookParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the admin get hook params
|
||||||
|
func (o *AdminGetHookParams) WithContext(ctx context.Context) *AdminGetHookParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the admin get hook params
|
||||||
|
func (o *AdminGetHookParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the admin get hook params
|
||||||
|
func (o *AdminGetHookParams) WithHTTPClient(client *http.Client) *AdminGetHookParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the admin get hook params
|
||||||
|
func (o *AdminGetHookParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithID adds the id to the admin get hook params
|
||||||
|
func (o *AdminGetHookParams) WithID(id int64) *AdminGetHookParams {
|
||||||
|
o.SetID(id)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetID adds the id to the admin get hook params
|
||||||
|
func (o *AdminGetHookParams) SetID(id int64) {
|
||||||
|
o.ID = id
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *AdminGetHookParams) 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,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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AdminGetHookReader is a Reader for the AdminGetHook structure.
|
||||||
|
type AdminGetHookReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *AdminGetHookReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewAdminGetHookOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[GET /admin/hooks/{id}] adminGetHook", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminGetHookOK creates a AdminGetHookOK with default headers values
|
||||||
|
func NewAdminGetHookOK() *AdminGetHookOK {
|
||||||
|
return &AdminGetHookOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminGetHookOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Hook
|
||||||
|
*/
|
||||||
|
type AdminGetHookOK struct {
|
||||||
|
Payload *models.Hook
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this admin get hook o k response has a 2xx status code
|
||||||
|
func (o *AdminGetHookOK) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this admin get hook o k response has a 3xx status code
|
||||||
|
func (o *AdminGetHookOK) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this admin get hook o k response has a 4xx status code
|
||||||
|
func (o *AdminGetHookOK) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this admin get hook o k response has a 5xx status code
|
||||||
|
func (o *AdminGetHookOK) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this admin get hook o k response a status code equal to that given
|
||||||
|
func (o *AdminGetHookOK) IsCode(code int) bool {
|
||||||
|
return code == 200
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the admin get hook o k response
|
||||||
|
func (o *AdminGetHookOK) Code() int {
|
||||||
|
return 200
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetHookOK) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[GET /admin/hooks/{id}][%d] adminGetHookOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetHookOK) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[GET /admin/hooks/{id}][%d] adminGetHookOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetHookOK) GetPayload() *models.Hook {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetHookOK) 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,128 @@
|
|||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewAdminGetRunnerRegistrationTokenParams creates a new AdminGetRunnerRegistrationTokenParams 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 NewAdminGetRunnerRegistrationTokenParams() *AdminGetRunnerRegistrationTokenParams {
|
||||||
|
return &AdminGetRunnerRegistrationTokenParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminGetRunnerRegistrationTokenParamsWithTimeout creates a new AdminGetRunnerRegistrationTokenParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewAdminGetRunnerRegistrationTokenParamsWithTimeout(timeout time.Duration) *AdminGetRunnerRegistrationTokenParams {
|
||||||
|
return &AdminGetRunnerRegistrationTokenParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminGetRunnerRegistrationTokenParamsWithContext creates a new AdminGetRunnerRegistrationTokenParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewAdminGetRunnerRegistrationTokenParamsWithContext(ctx context.Context) *AdminGetRunnerRegistrationTokenParams {
|
||||||
|
return &AdminGetRunnerRegistrationTokenParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminGetRunnerRegistrationTokenParamsWithHTTPClient creates a new AdminGetRunnerRegistrationTokenParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewAdminGetRunnerRegistrationTokenParamsWithHTTPClient(client *http.Client) *AdminGetRunnerRegistrationTokenParams {
|
||||||
|
return &AdminGetRunnerRegistrationTokenParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminGetRunnerRegistrationTokenParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the admin get runner registration token operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type AdminGetRunnerRegistrationTokenParams struct {
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the admin get runner registration token params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AdminGetRunnerRegistrationTokenParams) WithDefaults() *AdminGetRunnerRegistrationTokenParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the admin get runner registration token params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AdminGetRunnerRegistrationTokenParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the admin get runner registration token params
|
||||||
|
func (o *AdminGetRunnerRegistrationTokenParams) WithTimeout(timeout time.Duration) *AdminGetRunnerRegistrationTokenParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the admin get runner registration token params
|
||||||
|
func (o *AdminGetRunnerRegistrationTokenParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the admin get runner registration token params
|
||||||
|
func (o *AdminGetRunnerRegistrationTokenParams) WithContext(ctx context.Context) *AdminGetRunnerRegistrationTokenParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the admin get runner registration token params
|
||||||
|
func (o *AdminGetRunnerRegistrationTokenParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the admin get runner registration token params
|
||||||
|
func (o *AdminGetRunnerRegistrationTokenParams) WithHTTPClient(client *http.Client) *AdminGetRunnerRegistrationTokenParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the admin get runner registration token params
|
||||||
|
func (o *AdminGetRunnerRegistrationTokenParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *AdminGetRunnerRegistrationTokenParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
@ -0,0 +1,96 @@
|
|||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AdminGetRunnerRegistrationTokenReader is a Reader for the AdminGetRunnerRegistrationToken structure.
|
||||||
|
type AdminGetRunnerRegistrationTokenReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *AdminGetRunnerRegistrationTokenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewAdminGetRunnerRegistrationTokenOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[GET /admin/runners/registration-token] adminGetRunnerRegistrationToken", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminGetRunnerRegistrationTokenOK creates a AdminGetRunnerRegistrationTokenOK with default headers values
|
||||||
|
func NewAdminGetRunnerRegistrationTokenOK() *AdminGetRunnerRegistrationTokenOK {
|
||||||
|
return &AdminGetRunnerRegistrationTokenOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminGetRunnerRegistrationTokenOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
RegistrationToken is response related to registration token
|
||||||
|
*/
|
||||||
|
type AdminGetRunnerRegistrationTokenOK struct {
|
||||||
|
Token string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this admin get runner registration token o k response has a 2xx status code
|
||||||
|
func (o *AdminGetRunnerRegistrationTokenOK) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this admin get runner registration token o k response has a 3xx status code
|
||||||
|
func (o *AdminGetRunnerRegistrationTokenOK) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this admin get runner registration token o k response has a 4xx status code
|
||||||
|
func (o *AdminGetRunnerRegistrationTokenOK) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this admin get runner registration token o k response has a 5xx status code
|
||||||
|
func (o *AdminGetRunnerRegistrationTokenOK) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this admin get runner registration token o k response a status code equal to that given
|
||||||
|
func (o *AdminGetRunnerRegistrationTokenOK) IsCode(code int) bool {
|
||||||
|
return code == 200
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the admin get runner registration token o k response
|
||||||
|
func (o *AdminGetRunnerRegistrationTokenOK) Code() int {
|
||||||
|
return 200
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetRunnerRegistrationTokenOK) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /admin/runners/registration-token][%d] adminGetRunnerRegistrationTokenOK", 200)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetRunnerRegistrationTokenOK) String() string {
|
||||||
|
return fmt.Sprintf("[GET /admin/runners/registration-token][%d] adminGetRunnerRegistrationTokenOK", 200)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminGetRunnerRegistrationTokenOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
// hydrates response header token
|
||||||
|
hdrToken := response.GetHeader("token")
|
||||||
|
|
||||||
|
if hdrToken != "" {
|
||||||
|
o.Token = hdrToken
|
||||||
|
}
|
||||||
|
|
||||||
|
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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewAdminListHooksParams creates a new AdminListHooksParams 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 NewAdminListHooksParams() *AdminListHooksParams {
|
||||||
|
return &AdminListHooksParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminListHooksParamsWithTimeout creates a new AdminListHooksParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewAdminListHooksParamsWithTimeout(timeout time.Duration) *AdminListHooksParams {
|
||||||
|
return &AdminListHooksParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminListHooksParamsWithContext creates a new AdminListHooksParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewAdminListHooksParamsWithContext(ctx context.Context) *AdminListHooksParams {
|
||||||
|
return &AdminListHooksParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminListHooksParamsWithHTTPClient creates a new AdminListHooksParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewAdminListHooksParamsWithHTTPClient(client *http.Client) *AdminListHooksParams {
|
||||||
|
return &AdminListHooksParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminListHooksParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the admin list hooks operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type AdminListHooksParams 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 list hooks params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AdminListHooksParams) WithDefaults() *AdminListHooksParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the admin list hooks params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AdminListHooksParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the admin list hooks params
|
||||||
|
func (o *AdminListHooksParams) WithTimeout(timeout time.Duration) *AdminListHooksParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the admin list hooks params
|
||||||
|
func (o *AdminListHooksParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the admin list hooks params
|
||||||
|
func (o *AdminListHooksParams) WithContext(ctx context.Context) *AdminListHooksParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the admin list hooks params
|
||||||
|
func (o *AdminListHooksParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the admin list hooks params
|
||||||
|
func (o *AdminListHooksParams) WithHTTPClient(client *http.Client) *AdminListHooksParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the admin list hooks params
|
||||||
|
func (o *AdminListHooksParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLimit adds the limit to the admin list hooks params
|
||||||
|
func (o *AdminListHooksParams) WithLimit(limit *int64) *AdminListHooksParams {
|
||||||
|
o.SetLimit(limit)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLimit adds the limit to the admin list hooks params
|
||||||
|
func (o *AdminListHooksParams) SetLimit(limit *int64) {
|
||||||
|
o.Limit = limit
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithPage adds the page to the admin list hooks params
|
||||||
|
func (o *AdminListHooksParams) WithPage(page *int64) *AdminListHooksParams {
|
||||||
|
o.SetPage(page)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetPage adds the page to the admin list hooks params
|
||||||
|
func (o *AdminListHooksParams) SetPage(page *int64) {
|
||||||
|
o.Page = page
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *AdminListHooksParams) 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,104 @@
|
|||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AdminListHooksReader is a Reader for the AdminListHooks structure.
|
||||||
|
type AdminListHooksReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *AdminListHooksReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewAdminListHooksOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[GET /admin/hooks] adminListHooks", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminListHooksOK creates a AdminListHooksOK with default headers values
|
||||||
|
func NewAdminListHooksOK() *AdminListHooksOK {
|
||||||
|
return &AdminListHooksOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminListHooksOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
HookList
|
||||||
|
*/
|
||||||
|
type AdminListHooksOK struct {
|
||||||
|
Payload []*models.Hook
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this admin list hooks o k response has a 2xx status code
|
||||||
|
func (o *AdminListHooksOK) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this admin list hooks o k response has a 3xx status code
|
||||||
|
func (o *AdminListHooksOK) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this admin list hooks o k response has a 4xx status code
|
||||||
|
func (o *AdminListHooksOK) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this admin list hooks o k response has a 5xx status code
|
||||||
|
func (o *AdminListHooksOK) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this admin list hooks o k response a status code equal to that given
|
||||||
|
func (o *AdminListHooksOK) IsCode(code int) bool {
|
||||||
|
return code == 200
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the admin list hooks o k response
|
||||||
|
func (o *AdminListHooksOK) Code() int {
|
||||||
|
return 200
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminListHooksOK) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[GET /admin/hooks][%d] adminListHooksOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminListHooksOK) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[GET /admin/hooks][%d] adminListHooksOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminListHooksOK) GetPayload() []*models.Hook {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminListHooksOK) 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
|
||||||
|
}
|
@ -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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewAdminListUserBadgesParams creates a new AdminListUserBadgesParams 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 NewAdminListUserBadgesParams() *AdminListUserBadgesParams {
|
||||||
|
return &AdminListUserBadgesParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminListUserBadgesParamsWithTimeout creates a new AdminListUserBadgesParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewAdminListUserBadgesParamsWithTimeout(timeout time.Duration) *AdminListUserBadgesParams {
|
||||||
|
return &AdminListUserBadgesParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminListUserBadgesParamsWithContext creates a new AdminListUserBadgesParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewAdminListUserBadgesParamsWithContext(ctx context.Context) *AdminListUserBadgesParams {
|
||||||
|
return &AdminListUserBadgesParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminListUserBadgesParamsWithHTTPClient creates a new AdminListUserBadgesParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewAdminListUserBadgesParamsWithHTTPClient(client *http.Client) *AdminListUserBadgesParams {
|
||||||
|
return &AdminListUserBadgesParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminListUserBadgesParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the admin list user badges operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type AdminListUserBadgesParams struct {
|
||||||
|
|
||||||
|
/* Username.
|
||||||
|
|
||||||
|
username of user
|
||||||
|
*/
|
||||||
|
Username string
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the admin list user badges params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AdminListUserBadgesParams) WithDefaults() *AdminListUserBadgesParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the admin list user badges params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AdminListUserBadgesParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the admin list user badges params
|
||||||
|
func (o *AdminListUserBadgesParams) WithTimeout(timeout time.Duration) *AdminListUserBadgesParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the admin list user badges params
|
||||||
|
func (o *AdminListUserBadgesParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the admin list user badges params
|
||||||
|
func (o *AdminListUserBadgesParams) WithContext(ctx context.Context) *AdminListUserBadgesParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the admin list user badges params
|
||||||
|
func (o *AdminListUserBadgesParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the admin list user badges params
|
||||||
|
func (o *AdminListUserBadgesParams) WithHTTPClient(client *http.Client) *AdminListUserBadgesParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the admin list user badges params
|
||||||
|
func (o *AdminListUserBadgesParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithUsername adds the username to the admin list user badges params
|
||||||
|
func (o *AdminListUserBadgesParams) WithUsername(username string) *AdminListUserBadgesParams {
|
||||||
|
o.SetUsername(username)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetUsername adds the username to the admin list user badges params
|
||||||
|
func (o *AdminListUserBadgesParams) SetUsername(username string) {
|
||||||
|
o.Username = username
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *AdminListUserBadgesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
// 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 (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"src.opensuse.org/autogits/common/gitea-generated/models"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AdminListUserBadgesReader is a Reader for the AdminListUserBadges structure.
|
||||||
|
type AdminListUserBadgesReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *AdminListUserBadgesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewAdminListUserBadgesOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 404:
|
||||||
|
result := NewAdminListUserBadgesNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[GET /admin/users/{username}/badges] adminListUserBadges", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminListUserBadgesOK creates a AdminListUserBadgesOK with default headers values
|
||||||
|
func NewAdminListUserBadgesOK() *AdminListUserBadgesOK {
|
||||||
|
return &AdminListUserBadgesOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminListUserBadgesOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
BadgeList
|
||||||
|
*/
|
||||||
|
type AdminListUserBadgesOK struct {
|
||||||
|
Payload []*models.Badge
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this admin list user badges o k response has a 2xx status code
|
||||||
|
func (o *AdminListUserBadgesOK) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this admin list user badges o k response has a 3xx status code
|
||||||
|
func (o *AdminListUserBadgesOK) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this admin list user badges o k response has a 4xx status code
|
||||||
|
func (o *AdminListUserBadgesOK) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this admin list user badges o k response has a 5xx status code
|
||||||
|
func (o *AdminListUserBadgesOK) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this admin list user badges o k response a status code equal to that given
|
||||||
|
func (o *AdminListUserBadgesOK) IsCode(code int) bool {
|
||||||
|
return code == 200
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the admin list user badges o k response
|
||||||
|
func (o *AdminListUserBadgesOK) Code() int {
|
||||||
|
return 200
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminListUserBadgesOK) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[GET /admin/users/{username}/badges][%d] adminListUserBadgesOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminListUserBadgesOK) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[GET /admin/users/{username}/badges][%d] adminListUserBadgesOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminListUserBadgesOK) GetPayload() []*models.Badge {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminListUserBadgesOK) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminListUserBadgesNotFound creates a AdminListUserBadgesNotFound with default headers values
|
||||||
|
func NewAdminListUserBadgesNotFound() *AdminListUserBadgesNotFound {
|
||||||
|
return &AdminListUserBadgesNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminListUserBadgesNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
APINotFound is a not found empty response
|
||||||
|
*/
|
||||||
|
type AdminListUserBadgesNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this admin list user badges not found response has a 2xx status code
|
||||||
|
func (o *AdminListUserBadgesNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this admin list user badges not found response has a 3xx status code
|
||||||
|
func (o *AdminListUserBadgesNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this admin list user badges not found response has a 4xx status code
|
||||||
|
func (o *AdminListUserBadgesNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this admin list user badges not found response has a 5xx status code
|
||||||
|
func (o *AdminListUserBadgesNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this admin list user badges not found response a status code equal to that given
|
||||||
|
func (o *AdminListUserBadgesNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the admin list user badges not found response
|
||||||
|
func (o *AdminListUserBadgesNotFound) Code() int {
|
||||||
|
return 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminListUserBadgesNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /admin/users/{username}/badges][%d] adminListUserBadgesNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminListUserBadgesNotFound) String() string {
|
||||||
|
return fmt.Sprintf("[GET /admin/users/{username}/badges][%d] adminListUserBadgesNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminListUserBadgesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewAdminRenameUserParams creates a new AdminRenameUserParams 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 NewAdminRenameUserParams() *AdminRenameUserParams {
|
||||||
|
return &AdminRenameUserParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminRenameUserParamsWithTimeout creates a new AdminRenameUserParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewAdminRenameUserParamsWithTimeout(timeout time.Duration) *AdminRenameUserParams {
|
||||||
|
return &AdminRenameUserParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminRenameUserParamsWithContext creates a new AdminRenameUserParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewAdminRenameUserParamsWithContext(ctx context.Context) *AdminRenameUserParams {
|
||||||
|
return &AdminRenameUserParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminRenameUserParamsWithHTTPClient creates a new AdminRenameUserParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewAdminRenameUserParamsWithHTTPClient(client *http.Client) *AdminRenameUserParams {
|
||||||
|
return &AdminRenameUserParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminRenameUserParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the admin rename user operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type AdminRenameUserParams struct {
|
||||||
|
|
||||||
|
// Body.
|
||||||
|
Body *models.RenameUserOption
|
||||||
|
|
||||||
|
/* Username.
|
||||||
|
|
||||||
|
existing username of user
|
||||||
|
*/
|
||||||
|
Username string
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the admin rename user params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AdminRenameUserParams) WithDefaults() *AdminRenameUserParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the admin rename user params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AdminRenameUserParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the admin rename user params
|
||||||
|
func (o *AdminRenameUserParams) WithTimeout(timeout time.Duration) *AdminRenameUserParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the admin rename user params
|
||||||
|
func (o *AdminRenameUserParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the admin rename user params
|
||||||
|
func (o *AdminRenameUserParams) WithContext(ctx context.Context) *AdminRenameUserParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the admin rename user params
|
||||||
|
func (o *AdminRenameUserParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the admin rename user params
|
||||||
|
func (o *AdminRenameUserParams) WithHTTPClient(client *http.Client) *AdminRenameUserParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the admin rename user params
|
||||||
|
func (o *AdminRenameUserParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBody adds the body to the admin rename user params
|
||||||
|
func (o *AdminRenameUserParams) WithBody(body *models.RenameUserOption) *AdminRenameUserParams {
|
||||||
|
o.SetBody(body)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetBody adds the body to the admin rename user params
|
||||||
|
func (o *AdminRenameUserParams) SetBody(body *models.RenameUserOption) {
|
||||||
|
o.Body = body
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithUsername adds the username to the admin rename user params
|
||||||
|
func (o *AdminRenameUserParams) WithUsername(username string) *AdminRenameUserParams {
|
||||||
|
o.SetUsername(username)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetUsername adds the username to the admin rename user params
|
||||||
|
func (o *AdminRenameUserParams) SetUsername(username string) {
|
||||||
|
o.Username = username
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *AdminRenameUserParams) 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AdminRenameUserReader is a Reader for the AdminRenameUser structure.
|
||||||
|
type AdminRenameUserReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *AdminRenameUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 204:
|
||||||
|
result := NewAdminRenameUserNoContent()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 403:
|
||||||
|
result := NewAdminRenameUserForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewAdminRenameUserUnprocessableEntity()
|
||||||
|
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}/rename] adminRenameUser", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminRenameUserNoContent creates a AdminRenameUserNoContent with default headers values
|
||||||
|
func NewAdminRenameUserNoContent() *AdminRenameUserNoContent {
|
||||||
|
return &AdminRenameUserNoContent{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminRenameUserNoContent describes a response with status code 204, with default header values.
|
||||||
|
|
||||||
|
APIEmpty is an empty response
|
||||||
|
*/
|
||||||
|
type AdminRenameUserNoContent struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this admin rename user no content response has a 2xx status code
|
||||||
|
func (o *AdminRenameUserNoContent) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this admin rename user no content response has a 3xx status code
|
||||||
|
func (o *AdminRenameUserNoContent) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this admin rename user no content response has a 4xx status code
|
||||||
|
func (o *AdminRenameUserNoContent) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this admin rename user no content response has a 5xx status code
|
||||||
|
func (o *AdminRenameUserNoContent) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this admin rename user no content response a status code equal to that given
|
||||||
|
func (o *AdminRenameUserNoContent) IsCode(code int) bool {
|
||||||
|
return code == 204
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the admin rename user no content response
|
||||||
|
func (o *AdminRenameUserNoContent) Code() int {
|
||||||
|
return 204
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminRenameUserNoContent) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /admin/users/{username}/rename][%d] adminRenameUserNoContent", 204)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminRenameUserNoContent) String() string {
|
||||||
|
return fmt.Sprintf("[POST /admin/users/{username}/rename][%d] adminRenameUserNoContent", 204)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminRenameUserNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminRenameUserForbidden creates a AdminRenameUserForbidden with default headers values
|
||||||
|
func NewAdminRenameUserForbidden() *AdminRenameUserForbidden {
|
||||||
|
return &AdminRenameUserForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminRenameUserForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
APIForbiddenError is a forbidden error response
|
||||||
|
*/
|
||||||
|
type AdminRenameUserForbidden struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this admin rename user forbidden response has a 2xx status code
|
||||||
|
func (o *AdminRenameUserForbidden) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this admin rename user forbidden response has a 3xx status code
|
||||||
|
func (o *AdminRenameUserForbidden) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this admin rename user forbidden response has a 4xx status code
|
||||||
|
func (o *AdminRenameUserForbidden) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this admin rename user forbidden response has a 5xx status code
|
||||||
|
func (o *AdminRenameUserForbidden) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this admin rename user forbidden response a status code equal to that given
|
||||||
|
func (o *AdminRenameUserForbidden) IsCode(code int) bool {
|
||||||
|
return code == 403
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the admin rename user forbidden response
|
||||||
|
func (o *AdminRenameUserForbidden) Code() int {
|
||||||
|
return 403
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminRenameUserForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /admin/users/{username}/rename][%d] adminRenameUserForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminRenameUserForbidden) String() string {
|
||||||
|
return fmt.Sprintf("[POST /admin/users/{username}/rename][%d] adminRenameUserForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminRenameUserForbidden) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminRenameUserUnprocessableEntity creates a AdminRenameUserUnprocessableEntity with default headers values
|
||||||
|
func NewAdminRenameUserUnprocessableEntity() *AdminRenameUserUnprocessableEntity {
|
||||||
|
return &AdminRenameUserUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminRenameUserUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
APIValidationError is error format response related to input validation
|
||||||
|
*/
|
||||||
|
type AdminRenameUserUnprocessableEntity struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this admin rename user unprocessable entity response has a 2xx status code
|
||||||
|
func (o *AdminRenameUserUnprocessableEntity) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this admin rename user unprocessable entity response has a 3xx status code
|
||||||
|
func (o *AdminRenameUserUnprocessableEntity) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this admin rename user unprocessable entity response has a 4xx status code
|
||||||
|
func (o *AdminRenameUserUnprocessableEntity) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this admin rename user unprocessable entity response has a 5xx status code
|
||||||
|
func (o *AdminRenameUserUnprocessableEntity) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this admin rename user unprocessable entity response a status code equal to that given
|
||||||
|
func (o *AdminRenameUserUnprocessableEntity) IsCode(code int) bool {
|
||||||
|
return code == 422
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the admin rename user unprocessable entity response
|
||||||
|
func (o *AdminRenameUserUnprocessableEntity) Code() int {
|
||||||
|
return 422
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminRenameUserUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /admin/users/{username}/rename][%d] adminRenameUserUnprocessableEntity", 422)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminRenameUserUnprocessableEntity) String() string {
|
||||||
|
return fmt.Sprintf("[POST /admin/users/{username}/rename][%d] adminRenameUserUnprocessableEntity", 422)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminRenameUserUnprocessableEntity) 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,232 @@
|
|||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewAdminSearchEmailsParams creates a new AdminSearchEmailsParams 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 NewAdminSearchEmailsParams() *AdminSearchEmailsParams {
|
||||||
|
return &AdminSearchEmailsParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminSearchEmailsParamsWithTimeout creates a new AdminSearchEmailsParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewAdminSearchEmailsParamsWithTimeout(timeout time.Duration) *AdminSearchEmailsParams {
|
||||||
|
return &AdminSearchEmailsParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminSearchEmailsParamsWithContext creates a new AdminSearchEmailsParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewAdminSearchEmailsParamsWithContext(ctx context.Context) *AdminSearchEmailsParams {
|
||||||
|
return &AdminSearchEmailsParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminSearchEmailsParamsWithHTTPClient creates a new AdminSearchEmailsParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewAdminSearchEmailsParamsWithHTTPClient(client *http.Client) *AdminSearchEmailsParams {
|
||||||
|
return &AdminSearchEmailsParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminSearchEmailsParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the admin search emails operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type AdminSearchEmailsParams struct {
|
||||||
|
|
||||||
|
/* Limit.
|
||||||
|
|
||||||
|
page size of results
|
||||||
|
*/
|
||||||
|
Limit *int64
|
||||||
|
|
||||||
|
/* Page.
|
||||||
|
|
||||||
|
page number of results to return (1-based)
|
||||||
|
*/
|
||||||
|
Page *int64
|
||||||
|
|
||||||
|
/* Q.
|
||||||
|
|
||||||
|
keyword
|
||||||
|
*/
|
||||||
|
Q *string
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the admin search emails params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AdminSearchEmailsParams) WithDefaults() *AdminSearchEmailsParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the admin search emails params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AdminSearchEmailsParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the admin search emails params
|
||||||
|
func (o *AdminSearchEmailsParams) WithTimeout(timeout time.Duration) *AdminSearchEmailsParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the admin search emails params
|
||||||
|
func (o *AdminSearchEmailsParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the admin search emails params
|
||||||
|
func (o *AdminSearchEmailsParams) WithContext(ctx context.Context) *AdminSearchEmailsParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the admin search emails params
|
||||||
|
func (o *AdminSearchEmailsParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the admin search emails params
|
||||||
|
func (o *AdminSearchEmailsParams) WithHTTPClient(client *http.Client) *AdminSearchEmailsParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the admin search emails params
|
||||||
|
func (o *AdminSearchEmailsParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLimit adds the limit to the admin search emails params
|
||||||
|
func (o *AdminSearchEmailsParams) WithLimit(limit *int64) *AdminSearchEmailsParams {
|
||||||
|
o.SetLimit(limit)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLimit adds the limit to the admin search emails params
|
||||||
|
func (o *AdminSearchEmailsParams) SetLimit(limit *int64) {
|
||||||
|
o.Limit = limit
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithPage adds the page to the admin search emails params
|
||||||
|
func (o *AdminSearchEmailsParams) WithPage(page *int64) *AdminSearchEmailsParams {
|
||||||
|
o.SetPage(page)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetPage adds the page to the admin search emails params
|
||||||
|
func (o *AdminSearchEmailsParams) SetPage(page *int64) {
|
||||||
|
o.Page = page
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithQ adds the q to the admin search emails params
|
||||||
|
func (o *AdminSearchEmailsParams) WithQ(q *string) *AdminSearchEmailsParams {
|
||||||
|
o.SetQ(q)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetQ adds the q to the admin search emails params
|
||||||
|
func (o *AdminSearchEmailsParams) SetQ(q *string) {
|
||||||
|
o.Q = q
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *AdminSearchEmailsParams) 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 o.Q != nil {
|
||||||
|
|
||||||
|
// query param q
|
||||||
|
var qrQ string
|
||||||
|
|
||||||
|
if o.Q != nil {
|
||||||
|
qrQ = *o.Q
|
||||||
|
}
|
||||||
|
qQ := qrQ
|
||||||
|
if qQ != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("q", qQ); 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AdminSearchEmailsReader is a Reader for the AdminSearchEmails structure.
|
||||||
|
type AdminSearchEmailsReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *AdminSearchEmailsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewAdminSearchEmailsOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 403:
|
||||||
|
result := NewAdminSearchEmailsForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[GET /admin/emails/search] adminSearchEmails", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminSearchEmailsOK creates a AdminSearchEmailsOK with default headers values
|
||||||
|
func NewAdminSearchEmailsOK() *AdminSearchEmailsOK {
|
||||||
|
return &AdminSearchEmailsOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminSearchEmailsOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
EmailList
|
||||||
|
*/
|
||||||
|
type AdminSearchEmailsOK struct {
|
||||||
|
Payload []*models.Email
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this admin search emails o k response has a 2xx status code
|
||||||
|
func (o *AdminSearchEmailsOK) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this admin search emails o k response has a 3xx status code
|
||||||
|
func (o *AdminSearchEmailsOK) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this admin search emails o k response has a 4xx status code
|
||||||
|
func (o *AdminSearchEmailsOK) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this admin search emails o k response has a 5xx status code
|
||||||
|
func (o *AdminSearchEmailsOK) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this admin search emails o k response a status code equal to that given
|
||||||
|
func (o *AdminSearchEmailsOK) IsCode(code int) bool {
|
||||||
|
return code == 200
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the admin search emails o k response
|
||||||
|
func (o *AdminSearchEmailsOK) Code() int {
|
||||||
|
return 200
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminSearchEmailsOK) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[GET /admin/emails/search][%d] adminSearchEmailsOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminSearchEmailsOK) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[GET /admin/emails/search][%d] adminSearchEmailsOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminSearchEmailsOK) GetPayload() []*models.Email {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminSearchEmailsOK) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminSearchEmailsForbidden creates a AdminSearchEmailsForbidden with default headers values
|
||||||
|
func NewAdminSearchEmailsForbidden() *AdminSearchEmailsForbidden {
|
||||||
|
return &AdminSearchEmailsForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminSearchEmailsForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
APIForbiddenError is a forbidden error response
|
||||||
|
*/
|
||||||
|
type AdminSearchEmailsForbidden struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this admin search emails forbidden response has a 2xx status code
|
||||||
|
func (o *AdminSearchEmailsForbidden) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this admin search emails forbidden response has a 3xx status code
|
||||||
|
func (o *AdminSearchEmailsForbidden) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this admin search emails forbidden response has a 4xx status code
|
||||||
|
func (o *AdminSearchEmailsForbidden) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this admin search emails forbidden response has a 5xx status code
|
||||||
|
func (o *AdminSearchEmailsForbidden) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this admin search emails forbidden response a status code equal to that given
|
||||||
|
func (o *AdminSearchEmailsForbidden) IsCode(code int) bool {
|
||||||
|
return code == 403
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the admin search emails forbidden response
|
||||||
|
func (o *AdminSearchEmailsForbidden) Code() int {
|
||||||
|
return 403
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminSearchEmailsForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /admin/emails/search][%d] adminSearchEmailsForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminSearchEmailsForbidden) String() string {
|
||||||
|
return fmt.Sprintf("[GET /admin/emails/search][%d] adminSearchEmailsForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminSearchEmailsForbidden) 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,268 @@
|
|||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewAdminSearchUsersParams creates a new AdminSearchUsersParams 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 NewAdminSearchUsersParams() *AdminSearchUsersParams {
|
||||||
|
return &AdminSearchUsersParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminSearchUsersParamsWithTimeout creates a new AdminSearchUsersParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewAdminSearchUsersParamsWithTimeout(timeout time.Duration) *AdminSearchUsersParams {
|
||||||
|
return &AdminSearchUsersParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminSearchUsersParamsWithContext creates a new AdminSearchUsersParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewAdminSearchUsersParamsWithContext(ctx context.Context) *AdminSearchUsersParams {
|
||||||
|
return &AdminSearchUsersParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminSearchUsersParamsWithHTTPClient creates a new AdminSearchUsersParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewAdminSearchUsersParamsWithHTTPClient(client *http.Client) *AdminSearchUsersParams {
|
||||||
|
return &AdminSearchUsersParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminSearchUsersParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the admin search users operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type AdminSearchUsersParams struct {
|
||||||
|
|
||||||
|
/* Limit.
|
||||||
|
|
||||||
|
page size of results
|
||||||
|
*/
|
||||||
|
Limit *int64
|
||||||
|
|
||||||
|
/* LoginName.
|
||||||
|
|
||||||
|
user's login name to search for
|
||||||
|
*/
|
||||||
|
LoginName *string
|
||||||
|
|
||||||
|
/* Page.
|
||||||
|
|
||||||
|
page number of results to return (1-based)
|
||||||
|
*/
|
||||||
|
Page *int64
|
||||||
|
|
||||||
|
/* SourceID.
|
||||||
|
|
||||||
|
ID of the user's login source to search for
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
SourceID *int64
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the admin search users params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AdminSearchUsersParams) WithDefaults() *AdminSearchUsersParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the admin search users params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AdminSearchUsersParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the admin search users params
|
||||||
|
func (o *AdminSearchUsersParams) WithTimeout(timeout time.Duration) *AdminSearchUsersParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the admin search users params
|
||||||
|
func (o *AdminSearchUsersParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the admin search users params
|
||||||
|
func (o *AdminSearchUsersParams) WithContext(ctx context.Context) *AdminSearchUsersParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the admin search users params
|
||||||
|
func (o *AdminSearchUsersParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the admin search users params
|
||||||
|
func (o *AdminSearchUsersParams) WithHTTPClient(client *http.Client) *AdminSearchUsersParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the admin search users params
|
||||||
|
func (o *AdminSearchUsersParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLimit adds the limit to the admin search users params
|
||||||
|
func (o *AdminSearchUsersParams) WithLimit(limit *int64) *AdminSearchUsersParams {
|
||||||
|
o.SetLimit(limit)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLimit adds the limit to the admin search users params
|
||||||
|
func (o *AdminSearchUsersParams) SetLimit(limit *int64) {
|
||||||
|
o.Limit = limit
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLoginName adds the loginName to the admin search users params
|
||||||
|
func (o *AdminSearchUsersParams) WithLoginName(loginName *string) *AdminSearchUsersParams {
|
||||||
|
o.SetLoginName(loginName)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLoginName adds the loginName to the admin search users params
|
||||||
|
func (o *AdminSearchUsersParams) SetLoginName(loginName *string) {
|
||||||
|
o.LoginName = loginName
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithPage adds the page to the admin search users params
|
||||||
|
func (o *AdminSearchUsersParams) WithPage(page *int64) *AdminSearchUsersParams {
|
||||||
|
o.SetPage(page)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetPage adds the page to the admin search users params
|
||||||
|
func (o *AdminSearchUsersParams) SetPage(page *int64) {
|
||||||
|
o.Page = page
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSourceID adds the sourceID to the admin search users params
|
||||||
|
func (o *AdminSearchUsersParams) WithSourceID(sourceID *int64) *AdminSearchUsersParams {
|
||||||
|
o.SetSourceID(sourceID)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetSourceID adds the sourceId to the admin search users params
|
||||||
|
func (o *AdminSearchUsersParams) SetSourceID(sourceID *int64) {
|
||||||
|
o.SourceID = sourceID
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *AdminSearchUsersParams) 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.LoginName != nil {
|
||||||
|
|
||||||
|
// query param login_name
|
||||||
|
var qrLoginName string
|
||||||
|
|
||||||
|
if o.LoginName != nil {
|
||||||
|
qrLoginName = *o.LoginName
|
||||||
|
}
|
||||||
|
qLoginName := qrLoginName
|
||||||
|
if qLoginName != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("login_name", qLoginName); 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 o.SourceID != nil {
|
||||||
|
|
||||||
|
// query param source_id
|
||||||
|
var qrSourceID int64
|
||||||
|
|
||||||
|
if o.SourceID != nil {
|
||||||
|
qrSourceID = *o.SourceID
|
||||||
|
}
|
||||||
|
qSourceID := swag.FormatInt64(qrSourceID)
|
||||||
|
if qSourceID != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("source_id", qSourceID); 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AdminSearchUsersReader is a Reader for the AdminSearchUsers structure.
|
||||||
|
type AdminSearchUsersReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *AdminSearchUsersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewAdminSearchUsersOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 403:
|
||||||
|
result := NewAdminSearchUsersForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[GET /admin/users] adminSearchUsers", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminSearchUsersOK creates a AdminSearchUsersOK with default headers values
|
||||||
|
func NewAdminSearchUsersOK() *AdminSearchUsersOK {
|
||||||
|
return &AdminSearchUsersOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminSearchUsersOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
UserList
|
||||||
|
*/
|
||||||
|
type AdminSearchUsersOK struct {
|
||||||
|
Payload []*models.User
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this admin search users o k response has a 2xx status code
|
||||||
|
func (o *AdminSearchUsersOK) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this admin search users o k response has a 3xx status code
|
||||||
|
func (o *AdminSearchUsersOK) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this admin search users o k response has a 4xx status code
|
||||||
|
func (o *AdminSearchUsersOK) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this admin search users o k response has a 5xx status code
|
||||||
|
func (o *AdminSearchUsersOK) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this admin search users o k response a status code equal to that given
|
||||||
|
func (o *AdminSearchUsersOK) IsCode(code int) bool {
|
||||||
|
return code == 200
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the admin search users o k response
|
||||||
|
func (o *AdminSearchUsersOK) Code() int {
|
||||||
|
return 200
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminSearchUsersOK) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[GET /admin/users][%d] adminSearchUsersOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminSearchUsersOK) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[GET /admin/users][%d] adminSearchUsersOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminSearchUsersOK) GetPayload() []*models.User {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminSearchUsersOK) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminSearchUsersForbidden creates a AdminSearchUsersForbidden with default headers values
|
||||||
|
func NewAdminSearchUsersForbidden() *AdminSearchUsersForbidden {
|
||||||
|
return &AdminSearchUsersForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminSearchUsersForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
APIForbiddenError is a forbidden error response
|
||||||
|
*/
|
||||||
|
type AdminSearchUsersForbidden struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this admin search users forbidden response has a 2xx status code
|
||||||
|
func (o *AdminSearchUsersForbidden) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this admin search users forbidden response has a 3xx status code
|
||||||
|
func (o *AdminSearchUsersForbidden) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this admin search users forbidden response has a 4xx status code
|
||||||
|
func (o *AdminSearchUsersForbidden) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this admin search users forbidden response has a 5xx status code
|
||||||
|
func (o *AdminSearchUsersForbidden) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this admin search users forbidden response a status code equal to that given
|
||||||
|
func (o *AdminSearchUsersForbidden) IsCode(code int) bool {
|
||||||
|
return code == 403
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the admin search users forbidden response
|
||||||
|
func (o *AdminSearchUsersForbidden) Code() int {
|
||||||
|
return 403
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminSearchUsersForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /admin/users][%d] adminSearchUsersForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminSearchUsersForbidden) String() string {
|
||||||
|
return fmt.Sprintf("[GET /admin/users][%d] adminSearchUsersForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminSearchUsersForbidden) 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,232 @@
|
|||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewAdminUnadoptedListParams creates a new AdminUnadoptedListParams 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 NewAdminUnadoptedListParams() *AdminUnadoptedListParams {
|
||||||
|
return &AdminUnadoptedListParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminUnadoptedListParamsWithTimeout creates a new AdminUnadoptedListParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewAdminUnadoptedListParamsWithTimeout(timeout time.Duration) *AdminUnadoptedListParams {
|
||||||
|
return &AdminUnadoptedListParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminUnadoptedListParamsWithContext creates a new AdminUnadoptedListParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewAdminUnadoptedListParamsWithContext(ctx context.Context) *AdminUnadoptedListParams {
|
||||||
|
return &AdminUnadoptedListParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminUnadoptedListParamsWithHTTPClient creates a new AdminUnadoptedListParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewAdminUnadoptedListParamsWithHTTPClient(client *http.Client) *AdminUnadoptedListParams {
|
||||||
|
return &AdminUnadoptedListParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminUnadoptedListParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the admin unadopted list operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type AdminUnadoptedListParams struct {
|
||||||
|
|
||||||
|
/* Limit.
|
||||||
|
|
||||||
|
page size of results
|
||||||
|
*/
|
||||||
|
Limit *int64
|
||||||
|
|
||||||
|
/* Page.
|
||||||
|
|
||||||
|
page number of results to return (1-based)
|
||||||
|
*/
|
||||||
|
Page *int64
|
||||||
|
|
||||||
|
/* Pattern.
|
||||||
|
|
||||||
|
pattern of repositories to search for
|
||||||
|
*/
|
||||||
|
Pattern *string
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the admin unadopted list params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AdminUnadoptedListParams) WithDefaults() *AdminUnadoptedListParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the admin unadopted list params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *AdminUnadoptedListParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the admin unadopted list params
|
||||||
|
func (o *AdminUnadoptedListParams) WithTimeout(timeout time.Duration) *AdminUnadoptedListParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the admin unadopted list params
|
||||||
|
func (o *AdminUnadoptedListParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the admin unadopted list params
|
||||||
|
func (o *AdminUnadoptedListParams) WithContext(ctx context.Context) *AdminUnadoptedListParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the admin unadopted list params
|
||||||
|
func (o *AdminUnadoptedListParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the admin unadopted list params
|
||||||
|
func (o *AdminUnadoptedListParams) WithHTTPClient(client *http.Client) *AdminUnadoptedListParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the admin unadopted list params
|
||||||
|
func (o *AdminUnadoptedListParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLimit adds the limit to the admin unadopted list params
|
||||||
|
func (o *AdminUnadoptedListParams) WithLimit(limit *int64) *AdminUnadoptedListParams {
|
||||||
|
o.SetLimit(limit)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLimit adds the limit to the admin unadopted list params
|
||||||
|
func (o *AdminUnadoptedListParams) SetLimit(limit *int64) {
|
||||||
|
o.Limit = limit
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithPage adds the page to the admin unadopted list params
|
||||||
|
func (o *AdminUnadoptedListParams) WithPage(page *int64) *AdminUnadoptedListParams {
|
||||||
|
o.SetPage(page)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetPage adds the page to the admin unadopted list params
|
||||||
|
func (o *AdminUnadoptedListParams) SetPage(page *int64) {
|
||||||
|
o.Page = page
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithPattern adds the pattern to the admin unadopted list params
|
||||||
|
func (o *AdminUnadoptedListParams) WithPattern(pattern *string) *AdminUnadoptedListParams {
|
||||||
|
o.SetPattern(pattern)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetPattern adds the pattern to the admin unadopted list params
|
||||||
|
func (o *AdminUnadoptedListParams) SetPattern(pattern *string) {
|
||||||
|
o.Pattern = pattern
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *AdminUnadoptedListParams) 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 o.Pattern != nil {
|
||||||
|
|
||||||
|
// query param pattern
|
||||||
|
var qrPattern string
|
||||||
|
|
||||||
|
if o.Pattern != nil {
|
||||||
|
qrPattern = *o.Pattern
|
||||||
|
}
|
||||||
|
qPattern := qrPattern
|
||||||
|
if qPattern != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("pattern", qPattern); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
@ -0,0 +1,180 @@
|
|||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AdminUnadoptedListReader is a Reader for the AdminUnadoptedList structure.
|
||||||
|
type AdminUnadoptedListReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *AdminUnadoptedListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewAdminUnadoptedListOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 403:
|
||||||
|
result := NewAdminUnadoptedListForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[GET /admin/unadopted] adminUnadoptedList", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminUnadoptedListOK creates a AdminUnadoptedListOK with default headers values
|
||||||
|
func NewAdminUnadoptedListOK() *AdminUnadoptedListOK {
|
||||||
|
return &AdminUnadoptedListOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminUnadoptedListOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
StringSlice
|
||||||
|
*/
|
||||||
|
type AdminUnadoptedListOK struct {
|
||||||
|
Payload []string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this admin unadopted list o k response has a 2xx status code
|
||||||
|
func (o *AdminUnadoptedListOK) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this admin unadopted list o k response has a 3xx status code
|
||||||
|
func (o *AdminUnadoptedListOK) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this admin unadopted list o k response has a 4xx status code
|
||||||
|
func (o *AdminUnadoptedListOK) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this admin unadopted list o k response has a 5xx status code
|
||||||
|
func (o *AdminUnadoptedListOK) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this admin unadopted list o k response a status code equal to that given
|
||||||
|
func (o *AdminUnadoptedListOK) IsCode(code int) bool {
|
||||||
|
return code == 200
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the admin unadopted list o k response
|
||||||
|
func (o *AdminUnadoptedListOK) Code() int {
|
||||||
|
return 200
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminUnadoptedListOK) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[GET /admin/unadopted][%d] adminUnadoptedListOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminUnadoptedListOK) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[GET /admin/unadopted][%d] adminUnadoptedListOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminUnadoptedListOK) GetPayload() []string {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminUnadoptedListOK) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAdminUnadoptedListForbidden creates a AdminUnadoptedListForbidden with default headers values
|
||||||
|
func NewAdminUnadoptedListForbidden() *AdminUnadoptedListForbidden {
|
||||||
|
return &AdminUnadoptedListForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
AdminUnadoptedListForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
APIForbiddenError is a forbidden error response
|
||||||
|
*/
|
||||||
|
type AdminUnadoptedListForbidden struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this admin unadopted list forbidden response has a 2xx status code
|
||||||
|
func (o *AdminUnadoptedListForbidden) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this admin unadopted list forbidden response has a 3xx status code
|
||||||
|
func (o *AdminUnadoptedListForbidden) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this admin unadopted list forbidden response has a 4xx status code
|
||||||
|
func (o *AdminUnadoptedListForbidden) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this admin unadopted list forbidden response has a 5xx status code
|
||||||
|
func (o *AdminUnadoptedListForbidden) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this admin unadopted list forbidden response a status code equal to that given
|
||||||
|
func (o *AdminUnadoptedListForbidden) IsCode(code int) bool {
|
||||||
|
return code == 403
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the admin unadopted list forbidden response
|
||||||
|
func (o *AdminUnadoptedListForbidden) Code() int {
|
||||||
|
return 403
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminUnadoptedListForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /admin/unadopted][%d] adminUnadoptedListForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminUnadoptedListForbidden) String() string {
|
||||||
|
return fmt.Sprintf("[GET /admin/unadopted][%d] adminUnadoptedListForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *AdminUnadoptedListForbidden) 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
|
||||||
|
}
|
157
bots-common/gitea-generated/client/gitea_api_client.go
Normal file
157
bots-common/gitea-generated/client/gitea_api_client.go
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package client
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
|
httptransport "github.com/go-openapi/runtime/client"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
|
||||||
|
"src.opensuse.org/autogits/common/gitea-generated/client/activitypub"
|
||||||
|
"src.opensuse.org/autogits/common/gitea-generated/client/admin"
|
||||||
|
"src.opensuse.org/autogits/common/gitea-generated/client/issue"
|
||||||
|
"src.opensuse.org/autogits/common/gitea-generated/client/miscellaneous"
|
||||||
|
"src.opensuse.org/autogits/common/gitea-generated/client/notification"
|
||||||
|
"src.opensuse.org/autogits/common/gitea-generated/client/organization"
|
||||||
|
"src.opensuse.org/autogits/common/gitea-generated/client/package_operations"
|
||||||
|
"src.opensuse.org/autogits/common/gitea-generated/client/repository"
|
||||||
|
"src.opensuse.org/autogits/common/gitea-generated/client/settings"
|
||||||
|
"src.opensuse.org/autogits/common/gitea-generated/client/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Default gitea API HTTP client.
|
||||||
|
var Default = NewHTTPClient(nil)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// DefaultHost is the default Host
|
||||||
|
// found in Meta (info) section of spec file
|
||||||
|
DefaultHost string = "localhost"
|
||||||
|
// DefaultBasePath is the default BasePath
|
||||||
|
// found in Meta (info) section of spec file
|
||||||
|
DefaultBasePath string = "/api/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DefaultSchemes are the default schemes found in Meta (info) section of spec file
|
||||||
|
var DefaultSchemes = []string{"http", "https"}
|
||||||
|
|
||||||
|
// NewHTTPClient creates a new gitea API HTTP client.
|
||||||
|
func NewHTTPClient(formats strfmt.Registry) *GiteaAPI {
|
||||||
|
return NewHTTPClientWithConfig(formats, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewHTTPClientWithConfig creates a new gitea API HTTP client,
|
||||||
|
// using a customizable transport config.
|
||||||
|
func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *GiteaAPI {
|
||||||
|
// ensure nullable parameters have default
|
||||||
|
if cfg == nil {
|
||||||
|
cfg = DefaultTransportConfig()
|
||||||
|
}
|
||||||
|
|
||||||
|
// create transport and client
|
||||||
|
transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)
|
||||||
|
return New(transport, formats)
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new gitea API client
|
||||||
|
func New(transport runtime.ClientTransport, formats strfmt.Registry) *GiteaAPI {
|
||||||
|
// ensure nullable parameters have default
|
||||||
|
if formats == nil {
|
||||||
|
formats = strfmt.Default
|
||||||
|
}
|
||||||
|
|
||||||
|
cli := new(GiteaAPI)
|
||||||
|
cli.Transport = transport
|
||||||
|
cli.Activitypub = activitypub.New(transport, formats)
|
||||||
|
cli.Admin = admin.New(transport, formats)
|
||||||
|
cli.Issue = issue.New(transport, formats)
|
||||||
|
cli.Miscellaneous = miscellaneous.New(transport, formats)
|
||||||
|
cli.Notification = notification.New(transport, formats)
|
||||||
|
cli.Organization = organization.New(transport, formats)
|
||||||
|
cli.PackageOperations = package_operations.New(transport, formats)
|
||||||
|
cli.Repository = repository.New(transport, formats)
|
||||||
|
cli.Settings = settings.New(transport, formats)
|
||||||
|
cli.User = user.New(transport, formats)
|
||||||
|
return cli
|
||||||
|
}
|
||||||
|
|
||||||
|
// DefaultTransportConfig creates a TransportConfig with the
|
||||||
|
// default settings taken from the meta section of the spec file.
|
||||||
|
func DefaultTransportConfig() *TransportConfig {
|
||||||
|
return &TransportConfig{
|
||||||
|
Host: DefaultHost,
|
||||||
|
BasePath: DefaultBasePath,
|
||||||
|
Schemes: DefaultSchemes,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TransportConfig contains the transport related info,
|
||||||
|
// found in the meta section of the spec file.
|
||||||
|
type TransportConfig struct {
|
||||||
|
Host string
|
||||||
|
BasePath string
|
||||||
|
Schemes []string
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHost overrides the default host,
|
||||||
|
// provided by the meta section of the spec file.
|
||||||
|
func (cfg *TransportConfig) WithHost(host string) *TransportConfig {
|
||||||
|
cfg.Host = host
|
||||||
|
return cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBasePath overrides the default basePath,
|
||||||
|
// provided by the meta section of the spec file.
|
||||||
|
func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {
|
||||||
|
cfg.BasePath = basePath
|
||||||
|
return cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSchemes overrides the default schemes,
|
||||||
|
// provided by the meta section of the spec file.
|
||||||
|
func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
|
||||||
|
cfg.Schemes = schemes
|
||||||
|
return cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
// GiteaAPI is a client for gitea API
|
||||||
|
type GiteaAPI struct {
|
||||||
|
Activitypub activitypub.ClientService
|
||||||
|
|
||||||
|
Admin admin.ClientService
|
||||||
|
|
||||||
|
Issue issue.ClientService
|
||||||
|
|
||||||
|
Miscellaneous miscellaneous.ClientService
|
||||||
|
|
||||||
|
Notification notification.ClientService
|
||||||
|
|
||||||
|
Organization organization.ClientService
|
||||||
|
|
||||||
|
PackageOperations package_operations.ClientService
|
||||||
|
|
||||||
|
Repository repository.ClientService
|
||||||
|
|
||||||
|
Settings settings.ClientService
|
||||||
|
|
||||||
|
User user.ClientService
|
||||||
|
|
||||||
|
Transport runtime.ClientTransport
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTransport changes the transport on the client and all its subresources
|
||||||
|
func (c *GiteaAPI) SetTransport(transport runtime.ClientTransport) {
|
||||||
|
c.Transport = transport
|
||||||
|
c.Activitypub.SetTransport(transport)
|
||||||
|
c.Admin.SetTransport(transport)
|
||||||
|
c.Issue.SetTransport(transport)
|
||||||
|
c.Miscellaneous.SetTransport(transport)
|
||||||
|
c.Notification.SetTransport(transport)
|
||||||
|
c.Organization.SetTransport(transport)
|
||||||
|
c.PackageOperations.SetTransport(transport)
|
||||||
|
c.Repository.SetTransport(transport)
|
||||||
|
c.Settings.SetTransport(transport)
|
||||||
|
c.User.SetTransport(transport)
|
||||||
|
}
|
@ -0,0 +1,219 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewIssueAddLabelParams creates a new IssueAddLabelParams 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 NewIssueAddLabelParams() *IssueAddLabelParams {
|
||||||
|
return &IssueAddLabelParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueAddLabelParamsWithTimeout creates a new IssueAddLabelParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewIssueAddLabelParamsWithTimeout(timeout time.Duration) *IssueAddLabelParams {
|
||||||
|
return &IssueAddLabelParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueAddLabelParamsWithContext creates a new IssueAddLabelParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewIssueAddLabelParamsWithContext(ctx context.Context) *IssueAddLabelParams {
|
||||||
|
return &IssueAddLabelParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueAddLabelParamsWithHTTPClient creates a new IssueAddLabelParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewIssueAddLabelParamsWithHTTPClient(client *http.Client) *IssueAddLabelParams {
|
||||||
|
return &IssueAddLabelParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueAddLabelParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the issue add label operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type IssueAddLabelParams struct {
|
||||||
|
|
||||||
|
// Body.
|
||||||
|
Body *models.IssueLabelsOption
|
||||||
|
|
||||||
|
/* Index.
|
||||||
|
|
||||||
|
index of the issue
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
Index int64
|
||||||
|
|
||||||
|
/* 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 issue add label params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueAddLabelParams) WithDefaults() *IssueAddLabelParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the issue add label params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueAddLabelParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the issue add label params
|
||||||
|
func (o *IssueAddLabelParams) WithTimeout(timeout time.Duration) *IssueAddLabelParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the issue add label params
|
||||||
|
func (o *IssueAddLabelParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the issue add label params
|
||||||
|
func (o *IssueAddLabelParams) WithContext(ctx context.Context) *IssueAddLabelParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the issue add label params
|
||||||
|
func (o *IssueAddLabelParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the issue add label params
|
||||||
|
func (o *IssueAddLabelParams) WithHTTPClient(client *http.Client) *IssueAddLabelParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the issue add label params
|
||||||
|
func (o *IssueAddLabelParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBody adds the body to the issue add label params
|
||||||
|
func (o *IssueAddLabelParams) WithBody(body *models.IssueLabelsOption) *IssueAddLabelParams {
|
||||||
|
o.SetBody(body)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetBody adds the body to the issue add label params
|
||||||
|
func (o *IssueAddLabelParams) SetBody(body *models.IssueLabelsOption) {
|
||||||
|
o.Body = body
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithIndex adds the index to the issue add label params
|
||||||
|
func (o *IssueAddLabelParams) WithIndex(index int64) *IssueAddLabelParams {
|
||||||
|
o.SetIndex(index)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetIndex adds the index to the issue add label params
|
||||||
|
func (o *IssueAddLabelParams) SetIndex(index int64) {
|
||||||
|
o.Index = index
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOwner adds the owner to the issue add label params
|
||||||
|
func (o *IssueAddLabelParams) WithOwner(owner string) *IssueAddLabelParams {
|
||||||
|
o.SetOwner(owner)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOwner adds the owner to the issue add label params
|
||||||
|
func (o *IssueAddLabelParams) SetOwner(owner string) {
|
||||||
|
o.Owner = owner
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithRepo adds the repo to the issue add label params
|
||||||
|
func (o *IssueAddLabelParams) WithRepo(repo string) *IssueAddLabelParams {
|
||||||
|
o.SetRepo(repo)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetRepo adds the repo to the issue add label params
|
||||||
|
func (o *IssueAddLabelParams) SetRepo(repo string) {
|
||||||
|
o.Repo = repo
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *IssueAddLabelParams) 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 index
|
||||||
|
if err := r.SetPathParam("index", swag.FormatInt64(o.Index)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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,244 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IssueAddLabelReader is a Reader for the IssueAddLabel structure.
|
||||||
|
type IssueAddLabelReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *IssueAddLabelReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewIssueAddLabelOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 403:
|
||||||
|
result := NewIssueAddLabelForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewIssueAddLabelNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[POST /repos/{owner}/{repo}/issues/{index}/labels] issueAddLabel", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueAddLabelOK creates a IssueAddLabelOK with default headers values
|
||||||
|
func NewIssueAddLabelOK() *IssueAddLabelOK {
|
||||||
|
return &IssueAddLabelOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueAddLabelOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
LabelList
|
||||||
|
*/
|
||||||
|
type IssueAddLabelOK struct {
|
||||||
|
Payload []*models.Label
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue add label o k response has a 2xx status code
|
||||||
|
func (o *IssueAddLabelOK) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue add label o k response has a 3xx status code
|
||||||
|
func (o *IssueAddLabelOK) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue add label o k response has a 4xx status code
|
||||||
|
func (o *IssueAddLabelOK) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue add label o k response has a 5xx status code
|
||||||
|
func (o *IssueAddLabelOK) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue add label o k response a status code equal to that given
|
||||||
|
func (o *IssueAddLabelOK) IsCode(code int) bool {
|
||||||
|
return code == 200
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue add label o k response
|
||||||
|
func (o *IssueAddLabelOK) Code() int {
|
||||||
|
return 200
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddLabelOK) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/labels][%d] issueAddLabelOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddLabelOK) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/labels][%d] issueAddLabelOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddLabelOK) GetPayload() []*models.Label {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddLabelOK) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueAddLabelForbidden creates a IssueAddLabelForbidden with default headers values
|
||||||
|
func NewIssueAddLabelForbidden() *IssueAddLabelForbidden {
|
||||||
|
return &IssueAddLabelForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueAddLabelForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
APIForbiddenError is a forbidden error response
|
||||||
|
*/
|
||||||
|
type IssueAddLabelForbidden struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue add label forbidden response has a 2xx status code
|
||||||
|
func (o *IssueAddLabelForbidden) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue add label forbidden response has a 3xx status code
|
||||||
|
func (o *IssueAddLabelForbidden) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue add label forbidden response has a 4xx status code
|
||||||
|
func (o *IssueAddLabelForbidden) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue add label forbidden response has a 5xx status code
|
||||||
|
func (o *IssueAddLabelForbidden) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue add label forbidden response a status code equal to that given
|
||||||
|
func (o *IssueAddLabelForbidden) IsCode(code int) bool {
|
||||||
|
return code == 403
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue add label forbidden response
|
||||||
|
func (o *IssueAddLabelForbidden) Code() int {
|
||||||
|
return 403
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddLabelForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/labels][%d] issueAddLabelForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddLabelForbidden) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/labels][%d] issueAddLabelForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddLabelForbidden) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueAddLabelNotFound creates a IssueAddLabelNotFound with default headers values
|
||||||
|
func NewIssueAddLabelNotFound() *IssueAddLabelNotFound {
|
||||||
|
return &IssueAddLabelNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueAddLabelNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
APINotFound is a not found empty response
|
||||||
|
*/
|
||||||
|
type IssueAddLabelNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue add label not found response has a 2xx status code
|
||||||
|
func (o *IssueAddLabelNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue add label not found response has a 3xx status code
|
||||||
|
func (o *IssueAddLabelNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue add label not found response has a 4xx status code
|
||||||
|
func (o *IssueAddLabelNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue add label not found response has a 5xx status code
|
||||||
|
func (o *IssueAddLabelNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue add label not found response a status code equal to that given
|
||||||
|
func (o *IssueAddLabelNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue add label not found response
|
||||||
|
func (o *IssueAddLabelNotFound) Code() int {
|
||||||
|
return 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddLabelNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/labels][%d] issueAddLabelNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddLabelNotFound) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/labels][%d] issueAddLabelNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddLabelNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
@ -0,0 +1,220 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewIssueAddSubscriptionParams creates a new IssueAddSubscriptionParams 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 NewIssueAddSubscriptionParams() *IssueAddSubscriptionParams {
|
||||||
|
return &IssueAddSubscriptionParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueAddSubscriptionParamsWithTimeout creates a new IssueAddSubscriptionParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewIssueAddSubscriptionParamsWithTimeout(timeout time.Duration) *IssueAddSubscriptionParams {
|
||||||
|
return &IssueAddSubscriptionParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueAddSubscriptionParamsWithContext creates a new IssueAddSubscriptionParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewIssueAddSubscriptionParamsWithContext(ctx context.Context) *IssueAddSubscriptionParams {
|
||||||
|
return &IssueAddSubscriptionParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueAddSubscriptionParamsWithHTTPClient creates a new IssueAddSubscriptionParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewIssueAddSubscriptionParamsWithHTTPClient(client *http.Client) *IssueAddSubscriptionParams {
|
||||||
|
return &IssueAddSubscriptionParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueAddSubscriptionParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the issue add subscription operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type IssueAddSubscriptionParams struct {
|
||||||
|
|
||||||
|
/* Index.
|
||||||
|
|
||||||
|
index of the issue
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
Index int64
|
||||||
|
|
||||||
|
/* Owner.
|
||||||
|
|
||||||
|
owner of the repo
|
||||||
|
*/
|
||||||
|
Owner string
|
||||||
|
|
||||||
|
/* Repo.
|
||||||
|
|
||||||
|
name of the repo
|
||||||
|
*/
|
||||||
|
Repo string
|
||||||
|
|
||||||
|
/* User.
|
||||||
|
|
||||||
|
user to subscribe
|
||||||
|
*/
|
||||||
|
User string
|
||||||
|
|
||||||
|
timeout time.Duration
|
||||||
|
Context context.Context
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDefaults hydrates default values in the issue add subscription params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueAddSubscriptionParams) WithDefaults() *IssueAddSubscriptionParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the issue add subscription params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueAddSubscriptionParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the issue add subscription params
|
||||||
|
func (o *IssueAddSubscriptionParams) WithTimeout(timeout time.Duration) *IssueAddSubscriptionParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the issue add subscription params
|
||||||
|
func (o *IssueAddSubscriptionParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the issue add subscription params
|
||||||
|
func (o *IssueAddSubscriptionParams) WithContext(ctx context.Context) *IssueAddSubscriptionParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the issue add subscription params
|
||||||
|
func (o *IssueAddSubscriptionParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the issue add subscription params
|
||||||
|
func (o *IssueAddSubscriptionParams) WithHTTPClient(client *http.Client) *IssueAddSubscriptionParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the issue add subscription params
|
||||||
|
func (o *IssueAddSubscriptionParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithIndex adds the index to the issue add subscription params
|
||||||
|
func (o *IssueAddSubscriptionParams) WithIndex(index int64) *IssueAddSubscriptionParams {
|
||||||
|
o.SetIndex(index)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetIndex adds the index to the issue add subscription params
|
||||||
|
func (o *IssueAddSubscriptionParams) SetIndex(index int64) {
|
||||||
|
o.Index = index
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOwner adds the owner to the issue add subscription params
|
||||||
|
func (o *IssueAddSubscriptionParams) WithOwner(owner string) *IssueAddSubscriptionParams {
|
||||||
|
o.SetOwner(owner)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOwner adds the owner to the issue add subscription params
|
||||||
|
func (o *IssueAddSubscriptionParams) SetOwner(owner string) {
|
||||||
|
o.Owner = owner
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithRepo adds the repo to the issue add subscription params
|
||||||
|
func (o *IssueAddSubscriptionParams) WithRepo(repo string) *IssueAddSubscriptionParams {
|
||||||
|
o.SetRepo(repo)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetRepo adds the repo to the issue add subscription params
|
||||||
|
func (o *IssueAddSubscriptionParams) SetRepo(repo string) {
|
||||||
|
o.Repo = repo
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithUser adds the user to the issue add subscription params
|
||||||
|
func (o *IssueAddSubscriptionParams) WithUser(user string) *IssueAddSubscriptionParams {
|
||||||
|
o.SetUser(user)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetUser adds the user to the issue add subscription params
|
||||||
|
func (o *IssueAddSubscriptionParams) SetUser(user string) {
|
||||||
|
o.User = user
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *IssueAddSubscriptionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
// path param index
|
||||||
|
if err := r.SetPathParam("index", swag.FormatInt64(o.Index)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// path param user
|
||||||
|
if err := r.SetPathParam("user", o.User); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res) > 0 {
|
||||||
|
return errors.CompositeValidationError(res...)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
@ -0,0 +1,274 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IssueAddSubscriptionReader is a Reader for the IssueAddSubscription structure.
|
||||||
|
type IssueAddSubscriptionReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *IssueAddSubscriptionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewIssueAddSubscriptionOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 201:
|
||||||
|
result := NewIssueAddSubscriptionCreated()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 304:
|
||||||
|
result := NewIssueAddSubscriptionNotModified()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewIssueAddSubscriptionNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[PUT /repos/{owner}/{repo}/issues/{index}/subscriptions/{user}] issueAddSubscription", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueAddSubscriptionOK creates a IssueAddSubscriptionOK with default headers values
|
||||||
|
func NewIssueAddSubscriptionOK() *IssueAddSubscriptionOK {
|
||||||
|
return &IssueAddSubscriptionOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueAddSubscriptionOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
Already subscribed
|
||||||
|
*/
|
||||||
|
type IssueAddSubscriptionOK struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue add subscription o k response has a 2xx status code
|
||||||
|
func (o *IssueAddSubscriptionOK) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue add subscription o k response has a 3xx status code
|
||||||
|
func (o *IssueAddSubscriptionOK) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue add subscription o k response has a 4xx status code
|
||||||
|
func (o *IssueAddSubscriptionOK) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue add subscription o k response has a 5xx status code
|
||||||
|
func (o *IssueAddSubscriptionOK) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue add subscription o k response a status code equal to that given
|
||||||
|
func (o *IssueAddSubscriptionOK) IsCode(code int) bool {
|
||||||
|
return code == 200
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue add subscription o k response
|
||||||
|
func (o *IssueAddSubscriptionOK) Code() int {
|
||||||
|
return 200
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddSubscriptionOK) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/issues/{index}/subscriptions/{user}][%d] issueAddSubscriptionOK", 200)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddSubscriptionOK) String() string {
|
||||||
|
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/issues/{index}/subscriptions/{user}][%d] issueAddSubscriptionOK", 200)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddSubscriptionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueAddSubscriptionCreated creates a IssueAddSubscriptionCreated with default headers values
|
||||||
|
func NewIssueAddSubscriptionCreated() *IssueAddSubscriptionCreated {
|
||||||
|
return &IssueAddSubscriptionCreated{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueAddSubscriptionCreated describes a response with status code 201, with default header values.
|
||||||
|
|
||||||
|
Successfully Subscribed
|
||||||
|
*/
|
||||||
|
type IssueAddSubscriptionCreated struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue add subscription created response has a 2xx status code
|
||||||
|
func (o *IssueAddSubscriptionCreated) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue add subscription created response has a 3xx status code
|
||||||
|
func (o *IssueAddSubscriptionCreated) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue add subscription created response has a 4xx status code
|
||||||
|
func (o *IssueAddSubscriptionCreated) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue add subscription created response has a 5xx status code
|
||||||
|
func (o *IssueAddSubscriptionCreated) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue add subscription created response a status code equal to that given
|
||||||
|
func (o *IssueAddSubscriptionCreated) IsCode(code int) bool {
|
||||||
|
return code == 201
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue add subscription created response
|
||||||
|
func (o *IssueAddSubscriptionCreated) Code() int {
|
||||||
|
return 201
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddSubscriptionCreated) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/issues/{index}/subscriptions/{user}][%d] issueAddSubscriptionCreated", 201)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddSubscriptionCreated) String() string {
|
||||||
|
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/issues/{index}/subscriptions/{user}][%d] issueAddSubscriptionCreated", 201)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddSubscriptionCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueAddSubscriptionNotModified creates a IssueAddSubscriptionNotModified with default headers values
|
||||||
|
func NewIssueAddSubscriptionNotModified() *IssueAddSubscriptionNotModified {
|
||||||
|
return &IssueAddSubscriptionNotModified{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueAddSubscriptionNotModified describes a response with status code 304, with default header values.
|
||||||
|
|
||||||
|
User can only subscribe itself if he is no admin
|
||||||
|
*/
|
||||||
|
type IssueAddSubscriptionNotModified struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue add subscription not modified response has a 2xx status code
|
||||||
|
func (o *IssueAddSubscriptionNotModified) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue add subscription not modified response has a 3xx status code
|
||||||
|
func (o *IssueAddSubscriptionNotModified) IsRedirect() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue add subscription not modified response has a 4xx status code
|
||||||
|
func (o *IssueAddSubscriptionNotModified) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue add subscription not modified response has a 5xx status code
|
||||||
|
func (o *IssueAddSubscriptionNotModified) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue add subscription not modified response a status code equal to that given
|
||||||
|
func (o *IssueAddSubscriptionNotModified) IsCode(code int) bool {
|
||||||
|
return code == 304
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue add subscription not modified response
|
||||||
|
func (o *IssueAddSubscriptionNotModified) Code() int {
|
||||||
|
return 304
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddSubscriptionNotModified) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/issues/{index}/subscriptions/{user}][%d] issueAddSubscriptionNotModified", 304)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddSubscriptionNotModified) String() string {
|
||||||
|
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/issues/{index}/subscriptions/{user}][%d] issueAddSubscriptionNotModified", 304)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddSubscriptionNotModified) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueAddSubscriptionNotFound creates a IssueAddSubscriptionNotFound with default headers values
|
||||||
|
func NewIssueAddSubscriptionNotFound() *IssueAddSubscriptionNotFound {
|
||||||
|
return &IssueAddSubscriptionNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueAddSubscriptionNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
APINotFound is a not found empty response
|
||||||
|
*/
|
||||||
|
type IssueAddSubscriptionNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue add subscription not found response has a 2xx status code
|
||||||
|
func (o *IssueAddSubscriptionNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue add subscription not found response has a 3xx status code
|
||||||
|
func (o *IssueAddSubscriptionNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue add subscription not found response has a 4xx status code
|
||||||
|
func (o *IssueAddSubscriptionNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue add subscription not found response has a 5xx status code
|
||||||
|
func (o *IssueAddSubscriptionNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue add subscription not found response a status code equal to that given
|
||||||
|
func (o *IssueAddSubscriptionNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue add subscription not found response
|
||||||
|
func (o *IssueAddSubscriptionNotFound) Code() int {
|
||||||
|
return 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddSubscriptionNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/issues/{index}/subscriptions/{user}][%d] issueAddSubscriptionNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddSubscriptionNotFound) String() string {
|
||||||
|
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/issues/{index}/subscriptions/{user}][%d] issueAddSubscriptionNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddSubscriptionNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
@ -0,0 +1,219 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewIssueAddTimeParams creates a new IssueAddTimeParams 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 NewIssueAddTimeParams() *IssueAddTimeParams {
|
||||||
|
return &IssueAddTimeParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueAddTimeParamsWithTimeout creates a new IssueAddTimeParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewIssueAddTimeParamsWithTimeout(timeout time.Duration) *IssueAddTimeParams {
|
||||||
|
return &IssueAddTimeParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueAddTimeParamsWithContext creates a new IssueAddTimeParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewIssueAddTimeParamsWithContext(ctx context.Context) *IssueAddTimeParams {
|
||||||
|
return &IssueAddTimeParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueAddTimeParamsWithHTTPClient creates a new IssueAddTimeParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewIssueAddTimeParamsWithHTTPClient(client *http.Client) *IssueAddTimeParams {
|
||||||
|
return &IssueAddTimeParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueAddTimeParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the issue add time operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type IssueAddTimeParams struct {
|
||||||
|
|
||||||
|
// Body.
|
||||||
|
Body *models.AddTimeOption
|
||||||
|
|
||||||
|
/* Index.
|
||||||
|
|
||||||
|
index of the issue
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
Index int64
|
||||||
|
|
||||||
|
/* 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 issue add time params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueAddTimeParams) WithDefaults() *IssueAddTimeParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the issue add time params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueAddTimeParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the issue add time params
|
||||||
|
func (o *IssueAddTimeParams) WithTimeout(timeout time.Duration) *IssueAddTimeParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the issue add time params
|
||||||
|
func (o *IssueAddTimeParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the issue add time params
|
||||||
|
func (o *IssueAddTimeParams) WithContext(ctx context.Context) *IssueAddTimeParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the issue add time params
|
||||||
|
func (o *IssueAddTimeParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the issue add time params
|
||||||
|
func (o *IssueAddTimeParams) WithHTTPClient(client *http.Client) *IssueAddTimeParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the issue add time params
|
||||||
|
func (o *IssueAddTimeParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBody adds the body to the issue add time params
|
||||||
|
func (o *IssueAddTimeParams) WithBody(body *models.AddTimeOption) *IssueAddTimeParams {
|
||||||
|
o.SetBody(body)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetBody adds the body to the issue add time params
|
||||||
|
func (o *IssueAddTimeParams) SetBody(body *models.AddTimeOption) {
|
||||||
|
o.Body = body
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithIndex adds the index to the issue add time params
|
||||||
|
func (o *IssueAddTimeParams) WithIndex(index int64) *IssueAddTimeParams {
|
||||||
|
o.SetIndex(index)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetIndex adds the index to the issue add time params
|
||||||
|
func (o *IssueAddTimeParams) SetIndex(index int64) {
|
||||||
|
o.Index = index
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOwner adds the owner to the issue add time params
|
||||||
|
func (o *IssueAddTimeParams) WithOwner(owner string) *IssueAddTimeParams {
|
||||||
|
o.SetOwner(owner)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOwner adds the owner to the issue add time params
|
||||||
|
func (o *IssueAddTimeParams) SetOwner(owner string) {
|
||||||
|
o.Owner = owner
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithRepo adds the repo to the issue add time params
|
||||||
|
func (o *IssueAddTimeParams) WithRepo(repo string) *IssueAddTimeParams {
|
||||||
|
o.SetRepo(repo)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetRepo adds the repo to the issue add time params
|
||||||
|
func (o *IssueAddTimeParams) SetRepo(repo string) {
|
||||||
|
o.Repo = repo
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *IssueAddTimeParams) 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 index
|
||||||
|
if err := r.SetPathParam("index", swag.FormatInt64(o.Index)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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,324 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IssueAddTimeReader is a Reader for the IssueAddTime structure.
|
||||||
|
type IssueAddTimeReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *IssueAddTimeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewIssueAddTimeOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 400:
|
||||||
|
result := NewIssueAddTimeBadRequest()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewIssueAddTimeForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewIssueAddTimeNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[POST /repos/{owner}/{repo}/issues/{index}/times] issueAddTime", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueAddTimeOK creates a IssueAddTimeOK with default headers values
|
||||||
|
func NewIssueAddTimeOK() *IssueAddTimeOK {
|
||||||
|
return &IssueAddTimeOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueAddTimeOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
TrackedTime
|
||||||
|
*/
|
||||||
|
type IssueAddTimeOK struct {
|
||||||
|
Payload *models.TrackedTime
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue add time o k response has a 2xx status code
|
||||||
|
func (o *IssueAddTimeOK) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue add time o k response has a 3xx status code
|
||||||
|
func (o *IssueAddTimeOK) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue add time o k response has a 4xx status code
|
||||||
|
func (o *IssueAddTimeOK) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue add time o k response has a 5xx status code
|
||||||
|
func (o *IssueAddTimeOK) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue add time o k response a status code equal to that given
|
||||||
|
func (o *IssueAddTimeOK) IsCode(code int) bool {
|
||||||
|
return code == 200
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue add time o k response
|
||||||
|
func (o *IssueAddTimeOK) Code() int {
|
||||||
|
return 200
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddTimeOK) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/times][%d] issueAddTimeOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddTimeOK) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/times][%d] issueAddTimeOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddTimeOK) GetPayload() *models.TrackedTime {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddTimeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(models.TrackedTime)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueAddTimeBadRequest creates a IssueAddTimeBadRequest with default headers values
|
||||||
|
func NewIssueAddTimeBadRequest() *IssueAddTimeBadRequest {
|
||||||
|
return &IssueAddTimeBadRequest{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueAddTimeBadRequest describes a response with status code 400, with default header values.
|
||||||
|
|
||||||
|
APIError is error format response
|
||||||
|
*/
|
||||||
|
type IssueAddTimeBadRequest struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue add time bad request response has a 2xx status code
|
||||||
|
func (o *IssueAddTimeBadRequest) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue add time bad request response has a 3xx status code
|
||||||
|
func (o *IssueAddTimeBadRequest) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue add time bad request response has a 4xx status code
|
||||||
|
func (o *IssueAddTimeBadRequest) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue add time bad request response has a 5xx status code
|
||||||
|
func (o *IssueAddTimeBadRequest) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue add time bad request response a status code equal to that given
|
||||||
|
func (o *IssueAddTimeBadRequest) IsCode(code int) bool {
|
||||||
|
return code == 400
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue add time bad request response
|
||||||
|
func (o *IssueAddTimeBadRequest) Code() int {
|
||||||
|
return 400
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddTimeBadRequest) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/times][%d] issueAddTimeBadRequest", 400)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddTimeBadRequest) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/times][%d] issueAddTimeBadRequest", 400)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddTimeBadRequest) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueAddTimeForbidden creates a IssueAddTimeForbidden with default headers values
|
||||||
|
func NewIssueAddTimeForbidden() *IssueAddTimeForbidden {
|
||||||
|
return &IssueAddTimeForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueAddTimeForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
APIForbiddenError is a forbidden error response
|
||||||
|
*/
|
||||||
|
type IssueAddTimeForbidden struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue add time forbidden response has a 2xx status code
|
||||||
|
func (o *IssueAddTimeForbidden) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue add time forbidden response has a 3xx status code
|
||||||
|
func (o *IssueAddTimeForbidden) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue add time forbidden response has a 4xx status code
|
||||||
|
func (o *IssueAddTimeForbidden) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue add time forbidden response has a 5xx status code
|
||||||
|
func (o *IssueAddTimeForbidden) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue add time forbidden response a status code equal to that given
|
||||||
|
func (o *IssueAddTimeForbidden) IsCode(code int) bool {
|
||||||
|
return code == 403
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue add time forbidden response
|
||||||
|
func (o *IssueAddTimeForbidden) Code() int {
|
||||||
|
return 403
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddTimeForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/times][%d] issueAddTimeForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddTimeForbidden) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/times][%d] issueAddTimeForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddTimeForbidden) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueAddTimeNotFound creates a IssueAddTimeNotFound with default headers values
|
||||||
|
func NewIssueAddTimeNotFound() *IssueAddTimeNotFound {
|
||||||
|
return &IssueAddTimeNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueAddTimeNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
APINotFound is a not found empty response
|
||||||
|
*/
|
||||||
|
type IssueAddTimeNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue add time not found response has a 2xx status code
|
||||||
|
func (o *IssueAddTimeNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue add time not found response has a 3xx status code
|
||||||
|
func (o *IssueAddTimeNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue add time not found response has a 4xx status code
|
||||||
|
func (o *IssueAddTimeNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue add time not found response has a 5xx status code
|
||||||
|
func (o *IssueAddTimeNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue add time not found response a status code equal to that given
|
||||||
|
func (o *IssueAddTimeNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue add time not found response
|
||||||
|
func (o *IssueAddTimeNotFound) Code() int {
|
||||||
|
return 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddTimeNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/times][%d] issueAddTimeNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddTimeNotFound) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/times][%d] issueAddTimeNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueAddTimeNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
@ -0,0 +1,198 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewIssueCheckSubscriptionParams creates a new IssueCheckSubscriptionParams 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 NewIssueCheckSubscriptionParams() *IssueCheckSubscriptionParams {
|
||||||
|
return &IssueCheckSubscriptionParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCheckSubscriptionParamsWithTimeout creates a new IssueCheckSubscriptionParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewIssueCheckSubscriptionParamsWithTimeout(timeout time.Duration) *IssueCheckSubscriptionParams {
|
||||||
|
return &IssueCheckSubscriptionParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCheckSubscriptionParamsWithContext creates a new IssueCheckSubscriptionParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewIssueCheckSubscriptionParamsWithContext(ctx context.Context) *IssueCheckSubscriptionParams {
|
||||||
|
return &IssueCheckSubscriptionParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCheckSubscriptionParamsWithHTTPClient creates a new IssueCheckSubscriptionParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewIssueCheckSubscriptionParamsWithHTTPClient(client *http.Client) *IssueCheckSubscriptionParams {
|
||||||
|
return &IssueCheckSubscriptionParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCheckSubscriptionParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the issue check subscription operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type IssueCheckSubscriptionParams struct {
|
||||||
|
|
||||||
|
/* Index.
|
||||||
|
|
||||||
|
index of the issue
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
Index int64
|
||||||
|
|
||||||
|
/* 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 issue check subscription params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueCheckSubscriptionParams) WithDefaults() *IssueCheckSubscriptionParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the issue check subscription params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueCheckSubscriptionParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the issue check subscription params
|
||||||
|
func (o *IssueCheckSubscriptionParams) WithTimeout(timeout time.Duration) *IssueCheckSubscriptionParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the issue check subscription params
|
||||||
|
func (o *IssueCheckSubscriptionParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the issue check subscription params
|
||||||
|
func (o *IssueCheckSubscriptionParams) WithContext(ctx context.Context) *IssueCheckSubscriptionParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the issue check subscription params
|
||||||
|
func (o *IssueCheckSubscriptionParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the issue check subscription params
|
||||||
|
func (o *IssueCheckSubscriptionParams) WithHTTPClient(client *http.Client) *IssueCheckSubscriptionParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the issue check subscription params
|
||||||
|
func (o *IssueCheckSubscriptionParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithIndex adds the index to the issue check subscription params
|
||||||
|
func (o *IssueCheckSubscriptionParams) WithIndex(index int64) *IssueCheckSubscriptionParams {
|
||||||
|
o.SetIndex(index)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetIndex adds the index to the issue check subscription params
|
||||||
|
func (o *IssueCheckSubscriptionParams) SetIndex(index int64) {
|
||||||
|
o.Index = index
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOwner adds the owner to the issue check subscription params
|
||||||
|
func (o *IssueCheckSubscriptionParams) WithOwner(owner string) *IssueCheckSubscriptionParams {
|
||||||
|
o.SetOwner(owner)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOwner adds the owner to the issue check subscription params
|
||||||
|
func (o *IssueCheckSubscriptionParams) SetOwner(owner string) {
|
||||||
|
o.Owner = owner
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithRepo adds the repo to the issue check subscription params
|
||||||
|
func (o *IssueCheckSubscriptionParams) WithRepo(repo string) *IssueCheckSubscriptionParams {
|
||||||
|
o.SetRepo(repo)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetRepo adds the repo to the issue check subscription params
|
||||||
|
func (o *IssueCheckSubscriptionParams) SetRepo(repo string) {
|
||||||
|
o.Repo = repo
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *IssueCheckSubscriptionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
// path param index
|
||||||
|
if err := r.SetPathParam("index", swag.FormatInt64(o.Index)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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,168 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IssueCheckSubscriptionReader is a Reader for the IssueCheckSubscription structure.
|
||||||
|
type IssueCheckSubscriptionReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *IssueCheckSubscriptionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewIssueCheckSubscriptionOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 404:
|
||||||
|
result := NewIssueCheckSubscriptionNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[GET /repos/{owner}/{repo}/issues/{index}/subscriptions/check] issueCheckSubscription", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCheckSubscriptionOK creates a IssueCheckSubscriptionOK with default headers values
|
||||||
|
func NewIssueCheckSubscriptionOK() *IssueCheckSubscriptionOK {
|
||||||
|
return &IssueCheckSubscriptionOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCheckSubscriptionOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
WatchInfo
|
||||||
|
*/
|
||||||
|
type IssueCheckSubscriptionOK struct {
|
||||||
|
Payload *models.WatchInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue check subscription o k response has a 2xx status code
|
||||||
|
func (o *IssueCheckSubscriptionOK) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue check subscription o k response has a 3xx status code
|
||||||
|
func (o *IssueCheckSubscriptionOK) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue check subscription o k response has a 4xx status code
|
||||||
|
func (o *IssueCheckSubscriptionOK) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue check subscription o k response has a 5xx status code
|
||||||
|
func (o *IssueCheckSubscriptionOK) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue check subscription o k response a status code equal to that given
|
||||||
|
func (o *IssueCheckSubscriptionOK) IsCode(code int) bool {
|
||||||
|
return code == 200
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue check subscription o k response
|
||||||
|
func (o *IssueCheckSubscriptionOK) Code() int {
|
||||||
|
return 200
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCheckSubscriptionOK) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[GET /repos/{owner}/{repo}/issues/{index}/subscriptions/check][%d] issueCheckSubscriptionOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCheckSubscriptionOK) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[GET /repos/{owner}/{repo}/issues/{index}/subscriptions/check][%d] issueCheckSubscriptionOK %s", 200, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCheckSubscriptionOK) GetPayload() *models.WatchInfo {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCheckSubscriptionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(models.WatchInfo)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCheckSubscriptionNotFound creates a IssueCheckSubscriptionNotFound with default headers values
|
||||||
|
func NewIssueCheckSubscriptionNotFound() *IssueCheckSubscriptionNotFound {
|
||||||
|
return &IssueCheckSubscriptionNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCheckSubscriptionNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
APINotFound is a not found empty response
|
||||||
|
*/
|
||||||
|
type IssueCheckSubscriptionNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue check subscription not found response has a 2xx status code
|
||||||
|
func (o *IssueCheckSubscriptionNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue check subscription not found response has a 3xx status code
|
||||||
|
func (o *IssueCheckSubscriptionNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue check subscription not found response has a 4xx status code
|
||||||
|
func (o *IssueCheckSubscriptionNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue check subscription not found response has a 5xx status code
|
||||||
|
func (o *IssueCheckSubscriptionNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue check subscription not found response a status code equal to that given
|
||||||
|
func (o *IssueCheckSubscriptionNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue check subscription not found response
|
||||||
|
func (o *IssueCheckSubscriptionNotFound) Code() int {
|
||||||
|
return 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCheckSubscriptionNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[GET /repos/{owner}/{repo}/issues/{index}/subscriptions/check][%d] issueCheckSubscriptionNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCheckSubscriptionNotFound) String() string {
|
||||||
|
return fmt.Sprintf("[GET /repos/{owner}/{repo}/issues/{index}/subscriptions/check][%d] issueCheckSubscriptionNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCheckSubscriptionNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
@ -0,0 +1,198 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewIssueClearLabelsParams creates a new IssueClearLabelsParams 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 NewIssueClearLabelsParams() *IssueClearLabelsParams {
|
||||||
|
return &IssueClearLabelsParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueClearLabelsParamsWithTimeout creates a new IssueClearLabelsParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewIssueClearLabelsParamsWithTimeout(timeout time.Duration) *IssueClearLabelsParams {
|
||||||
|
return &IssueClearLabelsParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueClearLabelsParamsWithContext creates a new IssueClearLabelsParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewIssueClearLabelsParamsWithContext(ctx context.Context) *IssueClearLabelsParams {
|
||||||
|
return &IssueClearLabelsParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueClearLabelsParamsWithHTTPClient creates a new IssueClearLabelsParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewIssueClearLabelsParamsWithHTTPClient(client *http.Client) *IssueClearLabelsParams {
|
||||||
|
return &IssueClearLabelsParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueClearLabelsParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the issue clear labels operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type IssueClearLabelsParams struct {
|
||||||
|
|
||||||
|
/* Index.
|
||||||
|
|
||||||
|
index of the issue
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
Index int64
|
||||||
|
|
||||||
|
/* 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 issue clear labels params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueClearLabelsParams) WithDefaults() *IssueClearLabelsParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the issue clear labels params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueClearLabelsParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the issue clear labels params
|
||||||
|
func (o *IssueClearLabelsParams) WithTimeout(timeout time.Duration) *IssueClearLabelsParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the issue clear labels params
|
||||||
|
func (o *IssueClearLabelsParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the issue clear labels params
|
||||||
|
func (o *IssueClearLabelsParams) WithContext(ctx context.Context) *IssueClearLabelsParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the issue clear labels params
|
||||||
|
func (o *IssueClearLabelsParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the issue clear labels params
|
||||||
|
func (o *IssueClearLabelsParams) WithHTTPClient(client *http.Client) *IssueClearLabelsParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the issue clear labels params
|
||||||
|
func (o *IssueClearLabelsParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithIndex adds the index to the issue clear labels params
|
||||||
|
func (o *IssueClearLabelsParams) WithIndex(index int64) *IssueClearLabelsParams {
|
||||||
|
o.SetIndex(index)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetIndex adds the index to the issue clear labels params
|
||||||
|
func (o *IssueClearLabelsParams) SetIndex(index int64) {
|
||||||
|
o.Index = index
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOwner adds the owner to the issue clear labels params
|
||||||
|
func (o *IssueClearLabelsParams) WithOwner(owner string) *IssueClearLabelsParams {
|
||||||
|
o.SetOwner(owner)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOwner adds the owner to the issue clear labels params
|
||||||
|
func (o *IssueClearLabelsParams) SetOwner(owner string) {
|
||||||
|
o.Owner = owner
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithRepo adds the repo to the issue clear labels params
|
||||||
|
func (o *IssueClearLabelsParams) WithRepo(repo string) *IssueClearLabelsParams {
|
||||||
|
o.SetRepo(repo)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetRepo adds the repo to the issue clear labels params
|
||||||
|
func (o *IssueClearLabelsParams) SetRepo(repo string) {
|
||||||
|
o.Repo = repo
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *IssueClearLabelsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
|
||||||
|
// path param index
|
||||||
|
if err := r.SetPathParam("index", swag.FormatInt64(o.Index)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IssueClearLabelsReader is a Reader for the IssueClearLabels structure.
|
||||||
|
type IssueClearLabelsReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *IssueClearLabelsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 204:
|
||||||
|
result := NewIssueClearLabelsNoContent()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 403:
|
||||||
|
result := NewIssueClearLabelsForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewIssueClearLabelsNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[DELETE /repos/{owner}/{repo}/issues/{index}/labels] issueClearLabels", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueClearLabelsNoContent creates a IssueClearLabelsNoContent with default headers values
|
||||||
|
func NewIssueClearLabelsNoContent() *IssueClearLabelsNoContent {
|
||||||
|
return &IssueClearLabelsNoContent{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueClearLabelsNoContent describes a response with status code 204, with default header values.
|
||||||
|
|
||||||
|
APIEmpty is an empty response
|
||||||
|
*/
|
||||||
|
type IssueClearLabelsNoContent struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue clear labels no content response has a 2xx status code
|
||||||
|
func (o *IssueClearLabelsNoContent) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue clear labels no content response has a 3xx status code
|
||||||
|
func (o *IssueClearLabelsNoContent) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue clear labels no content response has a 4xx status code
|
||||||
|
func (o *IssueClearLabelsNoContent) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue clear labels no content response has a 5xx status code
|
||||||
|
func (o *IssueClearLabelsNoContent) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue clear labels no content response a status code equal to that given
|
||||||
|
func (o *IssueClearLabelsNoContent) IsCode(code int) bool {
|
||||||
|
return code == 204
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue clear labels no content response
|
||||||
|
func (o *IssueClearLabelsNoContent) Code() int {
|
||||||
|
return 204
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueClearLabelsNoContent) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/{index}/labels][%d] issueClearLabelsNoContent", 204)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueClearLabelsNoContent) String() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/{index}/labels][%d] issueClearLabelsNoContent", 204)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueClearLabelsNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueClearLabelsForbidden creates a IssueClearLabelsForbidden with default headers values
|
||||||
|
func NewIssueClearLabelsForbidden() *IssueClearLabelsForbidden {
|
||||||
|
return &IssueClearLabelsForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueClearLabelsForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
APIForbiddenError is a forbidden error response
|
||||||
|
*/
|
||||||
|
type IssueClearLabelsForbidden struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue clear labels forbidden response has a 2xx status code
|
||||||
|
func (o *IssueClearLabelsForbidden) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue clear labels forbidden response has a 3xx status code
|
||||||
|
func (o *IssueClearLabelsForbidden) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue clear labels forbidden response has a 4xx status code
|
||||||
|
func (o *IssueClearLabelsForbidden) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue clear labels forbidden response has a 5xx status code
|
||||||
|
func (o *IssueClearLabelsForbidden) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue clear labels forbidden response a status code equal to that given
|
||||||
|
func (o *IssueClearLabelsForbidden) IsCode(code int) bool {
|
||||||
|
return code == 403
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue clear labels forbidden response
|
||||||
|
func (o *IssueClearLabelsForbidden) Code() int {
|
||||||
|
return 403
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueClearLabelsForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/{index}/labels][%d] issueClearLabelsForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueClearLabelsForbidden) String() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/{index}/labels][%d] issueClearLabelsForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueClearLabelsForbidden) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueClearLabelsNotFound creates a IssueClearLabelsNotFound with default headers values
|
||||||
|
func NewIssueClearLabelsNotFound() *IssueClearLabelsNotFound {
|
||||||
|
return &IssueClearLabelsNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueClearLabelsNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
APINotFound is a not found empty response
|
||||||
|
*/
|
||||||
|
type IssueClearLabelsNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue clear labels not found response has a 2xx status code
|
||||||
|
func (o *IssueClearLabelsNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue clear labels not found response has a 3xx status code
|
||||||
|
func (o *IssueClearLabelsNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue clear labels not found response has a 4xx status code
|
||||||
|
func (o *IssueClearLabelsNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue clear labels not found response has a 5xx status code
|
||||||
|
func (o *IssueClearLabelsNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue clear labels not found response a status code equal to that given
|
||||||
|
func (o *IssueClearLabelsNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue clear labels not found response
|
||||||
|
func (o *IssueClearLabelsNotFound) Code() int {
|
||||||
|
return 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueClearLabelsNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/{index}/labels][%d] issueClearLabelsNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueClearLabelsNotFound) String() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/{index}/labels][%d] issueClearLabelsNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueClearLabelsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
2868
bots-common/gitea-generated/client/issue/issue_client.go
Normal file
2868
bots-common/gitea-generated/client/issue/issue_client.go
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,219 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewIssueCreateCommentParams creates a new IssueCreateCommentParams 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 NewIssueCreateCommentParams() *IssueCreateCommentParams {
|
||||||
|
return &IssueCreateCommentParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateCommentParamsWithTimeout creates a new IssueCreateCommentParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewIssueCreateCommentParamsWithTimeout(timeout time.Duration) *IssueCreateCommentParams {
|
||||||
|
return &IssueCreateCommentParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateCommentParamsWithContext creates a new IssueCreateCommentParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewIssueCreateCommentParamsWithContext(ctx context.Context) *IssueCreateCommentParams {
|
||||||
|
return &IssueCreateCommentParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateCommentParamsWithHTTPClient creates a new IssueCreateCommentParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewIssueCreateCommentParamsWithHTTPClient(client *http.Client) *IssueCreateCommentParams {
|
||||||
|
return &IssueCreateCommentParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateCommentParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the issue create comment operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type IssueCreateCommentParams struct {
|
||||||
|
|
||||||
|
// Body.
|
||||||
|
Body *models.CreateIssueCommentOption
|
||||||
|
|
||||||
|
/* Index.
|
||||||
|
|
||||||
|
index of the issue
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
Index int64
|
||||||
|
|
||||||
|
/* 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 issue create comment params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueCreateCommentParams) WithDefaults() *IssueCreateCommentParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the issue create comment params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueCreateCommentParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the issue create comment params
|
||||||
|
func (o *IssueCreateCommentParams) WithTimeout(timeout time.Duration) *IssueCreateCommentParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the issue create comment params
|
||||||
|
func (o *IssueCreateCommentParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the issue create comment params
|
||||||
|
func (o *IssueCreateCommentParams) WithContext(ctx context.Context) *IssueCreateCommentParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the issue create comment params
|
||||||
|
func (o *IssueCreateCommentParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the issue create comment params
|
||||||
|
func (o *IssueCreateCommentParams) WithHTTPClient(client *http.Client) *IssueCreateCommentParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the issue create comment params
|
||||||
|
func (o *IssueCreateCommentParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBody adds the body to the issue create comment params
|
||||||
|
func (o *IssueCreateCommentParams) WithBody(body *models.CreateIssueCommentOption) *IssueCreateCommentParams {
|
||||||
|
o.SetBody(body)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetBody adds the body to the issue create comment params
|
||||||
|
func (o *IssueCreateCommentParams) SetBody(body *models.CreateIssueCommentOption) {
|
||||||
|
o.Body = body
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithIndex adds the index to the issue create comment params
|
||||||
|
func (o *IssueCreateCommentParams) WithIndex(index int64) *IssueCreateCommentParams {
|
||||||
|
o.SetIndex(index)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetIndex adds the index to the issue create comment params
|
||||||
|
func (o *IssueCreateCommentParams) SetIndex(index int64) {
|
||||||
|
o.Index = index
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOwner adds the owner to the issue create comment params
|
||||||
|
func (o *IssueCreateCommentParams) WithOwner(owner string) *IssueCreateCommentParams {
|
||||||
|
o.SetOwner(owner)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOwner adds the owner to the issue create comment params
|
||||||
|
func (o *IssueCreateCommentParams) SetOwner(owner string) {
|
||||||
|
o.Owner = owner
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithRepo adds the repo to the issue create comment params
|
||||||
|
func (o *IssueCreateCommentParams) WithRepo(repo string) *IssueCreateCommentParams {
|
||||||
|
o.SetRepo(repo)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetRepo adds the repo to the issue create comment params
|
||||||
|
func (o *IssueCreateCommentParams) SetRepo(repo string) {
|
||||||
|
o.Repo = repo
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *IssueCreateCommentParams) 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 index
|
||||||
|
if err := r.SetPathParam("index", swag.FormatInt64(o.Index)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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,324 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IssueCreateCommentReader is a Reader for the IssueCreateComment structure.
|
||||||
|
type IssueCreateCommentReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *IssueCreateCommentReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 201:
|
||||||
|
result := NewIssueCreateCommentCreated()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 403:
|
||||||
|
result := NewIssueCreateCommentForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewIssueCreateCommentNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 423:
|
||||||
|
result := NewIssueCreateCommentLocked()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[POST /repos/{owner}/{repo}/issues/{index}/comments] issueCreateComment", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateCommentCreated creates a IssueCreateCommentCreated with default headers values
|
||||||
|
func NewIssueCreateCommentCreated() *IssueCreateCommentCreated {
|
||||||
|
return &IssueCreateCommentCreated{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateCommentCreated describes a response with status code 201, with default header values.
|
||||||
|
|
||||||
|
Comment
|
||||||
|
*/
|
||||||
|
type IssueCreateCommentCreated struct {
|
||||||
|
Payload *models.Comment
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create comment created response has a 2xx status code
|
||||||
|
func (o *IssueCreateCommentCreated) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create comment created response has a 3xx status code
|
||||||
|
func (o *IssueCreateCommentCreated) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create comment created response has a 4xx status code
|
||||||
|
func (o *IssueCreateCommentCreated) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create comment created response has a 5xx status code
|
||||||
|
func (o *IssueCreateCommentCreated) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create comment created response a status code equal to that given
|
||||||
|
func (o *IssueCreateCommentCreated) IsCode(code int) bool {
|
||||||
|
return code == 201
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create comment created response
|
||||||
|
func (o *IssueCreateCommentCreated) Code() int {
|
||||||
|
return 201
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateCommentCreated) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/comments][%d] issueCreateCommentCreated %s", 201, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateCommentCreated) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/comments][%d] issueCreateCommentCreated %s", 201, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateCommentCreated) GetPayload() *models.Comment {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateCommentCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(models.Comment)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateCommentForbidden creates a IssueCreateCommentForbidden with default headers values
|
||||||
|
func NewIssueCreateCommentForbidden() *IssueCreateCommentForbidden {
|
||||||
|
return &IssueCreateCommentForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateCommentForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
APIForbiddenError is a forbidden error response
|
||||||
|
*/
|
||||||
|
type IssueCreateCommentForbidden struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create comment forbidden response has a 2xx status code
|
||||||
|
func (o *IssueCreateCommentForbidden) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create comment forbidden response has a 3xx status code
|
||||||
|
func (o *IssueCreateCommentForbidden) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create comment forbidden response has a 4xx status code
|
||||||
|
func (o *IssueCreateCommentForbidden) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create comment forbidden response has a 5xx status code
|
||||||
|
func (o *IssueCreateCommentForbidden) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create comment forbidden response a status code equal to that given
|
||||||
|
func (o *IssueCreateCommentForbidden) IsCode(code int) bool {
|
||||||
|
return code == 403
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create comment forbidden response
|
||||||
|
func (o *IssueCreateCommentForbidden) Code() int {
|
||||||
|
return 403
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateCommentForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/comments][%d] issueCreateCommentForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateCommentForbidden) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/comments][%d] issueCreateCommentForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateCommentForbidden) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateCommentNotFound creates a IssueCreateCommentNotFound with default headers values
|
||||||
|
func NewIssueCreateCommentNotFound() *IssueCreateCommentNotFound {
|
||||||
|
return &IssueCreateCommentNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateCommentNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
APINotFound is a not found empty response
|
||||||
|
*/
|
||||||
|
type IssueCreateCommentNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create comment not found response has a 2xx status code
|
||||||
|
func (o *IssueCreateCommentNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create comment not found response has a 3xx status code
|
||||||
|
func (o *IssueCreateCommentNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create comment not found response has a 4xx status code
|
||||||
|
func (o *IssueCreateCommentNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create comment not found response has a 5xx status code
|
||||||
|
func (o *IssueCreateCommentNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create comment not found response a status code equal to that given
|
||||||
|
func (o *IssueCreateCommentNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create comment not found response
|
||||||
|
func (o *IssueCreateCommentNotFound) Code() int {
|
||||||
|
return 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateCommentNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/comments][%d] issueCreateCommentNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateCommentNotFound) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/comments][%d] issueCreateCommentNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateCommentNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateCommentLocked creates a IssueCreateCommentLocked with default headers values
|
||||||
|
func NewIssueCreateCommentLocked() *IssueCreateCommentLocked {
|
||||||
|
return &IssueCreateCommentLocked{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateCommentLocked describes a response with status code 423, with default header values.
|
||||||
|
|
||||||
|
APIRepoArchivedError is an error that is raised when an archived repo should be modified
|
||||||
|
*/
|
||||||
|
type IssueCreateCommentLocked struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create comment locked response has a 2xx status code
|
||||||
|
func (o *IssueCreateCommentLocked) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create comment locked response has a 3xx status code
|
||||||
|
func (o *IssueCreateCommentLocked) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create comment locked response has a 4xx status code
|
||||||
|
func (o *IssueCreateCommentLocked) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create comment locked response has a 5xx status code
|
||||||
|
func (o *IssueCreateCommentLocked) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create comment locked response a status code equal to that given
|
||||||
|
func (o *IssueCreateCommentLocked) IsCode(code int) bool {
|
||||||
|
return code == 423
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create comment locked response
|
||||||
|
func (o *IssueCreateCommentLocked) Code() int {
|
||||||
|
return 423
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateCommentLocked) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/comments][%d] issueCreateCommentLocked", 423)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateCommentLocked) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/comments][%d] issueCreateCommentLocked", 423)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateCommentLocked) 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,253 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewIssueCreateIssueAttachmentParams creates a new IssueCreateIssueAttachmentParams 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 NewIssueCreateIssueAttachmentParams() *IssueCreateIssueAttachmentParams {
|
||||||
|
return &IssueCreateIssueAttachmentParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueAttachmentParamsWithTimeout creates a new IssueCreateIssueAttachmentParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewIssueCreateIssueAttachmentParamsWithTimeout(timeout time.Duration) *IssueCreateIssueAttachmentParams {
|
||||||
|
return &IssueCreateIssueAttachmentParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueAttachmentParamsWithContext creates a new IssueCreateIssueAttachmentParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewIssueCreateIssueAttachmentParamsWithContext(ctx context.Context) *IssueCreateIssueAttachmentParams {
|
||||||
|
return &IssueCreateIssueAttachmentParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueAttachmentParamsWithHTTPClient creates a new IssueCreateIssueAttachmentParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewIssueCreateIssueAttachmentParamsWithHTTPClient(client *http.Client) *IssueCreateIssueAttachmentParams {
|
||||||
|
return &IssueCreateIssueAttachmentParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueAttachmentParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the issue create issue attachment operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueAttachmentParams struct {
|
||||||
|
|
||||||
|
/* Attachment.
|
||||||
|
|
||||||
|
attachment to upload
|
||||||
|
*/
|
||||||
|
Attachment runtime.NamedReadCloser
|
||||||
|
|
||||||
|
/* Index.
|
||||||
|
|
||||||
|
index of the issue
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
Index int64
|
||||||
|
|
||||||
|
/* Name.
|
||||||
|
|
||||||
|
name of the attachment
|
||||||
|
*/
|
||||||
|
Name *string
|
||||||
|
|
||||||
|
/* 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 issue create issue attachment params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueCreateIssueAttachmentParams) WithDefaults() *IssueCreateIssueAttachmentParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the issue create issue attachment params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueCreateIssueAttachmentParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the issue create issue attachment params
|
||||||
|
func (o *IssueCreateIssueAttachmentParams) WithTimeout(timeout time.Duration) *IssueCreateIssueAttachmentParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the issue create issue attachment params
|
||||||
|
func (o *IssueCreateIssueAttachmentParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the issue create issue attachment params
|
||||||
|
func (o *IssueCreateIssueAttachmentParams) WithContext(ctx context.Context) *IssueCreateIssueAttachmentParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the issue create issue attachment params
|
||||||
|
func (o *IssueCreateIssueAttachmentParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the issue create issue attachment params
|
||||||
|
func (o *IssueCreateIssueAttachmentParams) WithHTTPClient(client *http.Client) *IssueCreateIssueAttachmentParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the issue create issue attachment params
|
||||||
|
func (o *IssueCreateIssueAttachmentParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithAttachment adds the attachment to the issue create issue attachment params
|
||||||
|
func (o *IssueCreateIssueAttachmentParams) WithAttachment(attachment runtime.NamedReadCloser) *IssueCreateIssueAttachmentParams {
|
||||||
|
o.SetAttachment(attachment)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetAttachment adds the attachment to the issue create issue attachment params
|
||||||
|
func (o *IssueCreateIssueAttachmentParams) SetAttachment(attachment runtime.NamedReadCloser) {
|
||||||
|
o.Attachment = attachment
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithIndex adds the index to the issue create issue attachment params
|
||||||
|
func (o *IssueCreateIssueAttachmentParams) WithIndex(index int64) *IssueCreateIssueAttachmentParams {
|
||||||
|
o.SetIndex(index)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetIndex adds the index to the issue create issue attachment params
|
||||||
|
func (o *IssueCreateIssueAttachmentParams) SetIndex(index int64) {
|
||||||
|
o.Index = index
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithName adds the name to the issue create issue attachment params
|
||||||
|
func (o *IssueCreateIssueAttachmentParams) WithName(name *string) *IssueCreateIssueAttachmentParams {
|
||||||
|
o.SetName(name)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetName adds the name to the issue create issue attachment params
|
||||||
|
func (o *IssueCreateIssueAttachmentParams) SetName(name *string) {
|
||||||
|
o.Name = name
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOwner adds the owner to the issue create issue attachment params
|
||||||
|
func (o *IssueCreateIssueAttachmentParams) WithOwner(owner string) *IssueCreateIssueAttachmentParams {
|
||||||
|
o.SetOwner(owner)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOwner adds the owner to the issue create issue attachment params
|
||||||
|
func (o *IssueCreateIssueAttachmentParams) SetOwner(owner string) {
|
||||||
|
o.Owner = owner
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithRepo adds the repo to the issue create issue attachment params
|
||||||
|
func (o *IssueCreateIssueAttachmentParams) WithRepo(repo string) *IssueCreateIssueAttachmentParams {
|
||||||
|
o.SetRepo(repo)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetRepo adds the repo to the issue create issue attachment params
|
||||||
|
func (o *IssueCreateIssueAttachmentParams) SetRepo(repo string) {
|
||||||
|
o.Repo = repo
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *IssueCreateIssueAttachmentParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
// form file param attachment
|
||||||
|
if err := r.SetFileParam("attachment", o.Attachment); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// path param index
|
||||||
|
if err := r.SetPathParam("index", swag.FormatInt64(o.Index)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Name != nil {
|
||||||
|
|
||||||
|
// query param name
|
||||||
|
var qrName string
|
||||||
|
|
||||||
|
if o.Name != nil {
|
||||||
|
qrName = *o.Name
|
||||||
|
}
|
||||||
|
qName := qrName
|
||||||
|
if qName != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("name", qName); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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,418 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IssueCreateIssueAttachmentReader is a Reader for the IssueCreateIssueAttachment structure.
|
||||||
|
type IssueCreateIssueAttachmentReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *IssueCreateIssueAttachmentReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 201:
|
||||||
|
result := NewIssueCreateIssueAttachmentCreated()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 400:
|
||||||
|
result := NewIssueCreateIssueAttachmentBadRequest()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewIssueCreateIssueAttachmentNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewIssueCreateIssueAttachmentUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 423:
|
||||||
|
result := NewIssueCreateIssueAttachmentLocked()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[POST /repos/{owner}/{repo}/issues/{index}/assets] issueCreateIssueAttachment", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueAttachmentCreated creates a IssueCreateIssueAttachmentCreated with default headers values
|
||||||
|
func NewIssueCreateIssueAttachmentCreated() *IssueCreateIssueAttachmentCreated {
|
||||||
|
return &IssueCreateIssueAttachmentCreated{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueAttachmentCreated describes a response with status code 201, with default header values.
|
||||||
|
|
||||||
|
Attachment
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueAttachmentCreated struct {
|
||||||
|
Payload *models.Attachment
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue attachment created response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueAttachmentCreated) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue attachment created response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueAttachmentCreated) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue attachment created response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueAttachmentCreated) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue attachment created response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueAttachmentCreated) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue attachment created response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueAttachmentCreated) IsCode(code int) bool {
|
||||||
|
return code == 201
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue attachment created response
|
||||||
|
func (o *IssueCreateIssueAttachmentCreated) Code() int {
|
||||||
|
return 201
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueAttachmentCreated) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/assets][%d] issueCreateIssueAttachmentCreated %s", 201, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueAttachmentCreated) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/assets][%d] issueCreateIssueAttachmentCreated %s", 201, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueAttachmentCreated) GetPayload() *models.Attachment {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueAttachmentCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(models.Attachment)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueAttachmentBadRequest creates a IssueCreateIssueAttachmentBadRequest with default headers values
|
||||||
|
func NewIssueCreateIssueAttachmentBadRequest() *IssueCreateIssueAttachmentBadRequest {
|
||||||
|
return &IssueCreateIssueAttachmentBadRequest{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueAttachmentBadRequest describes a response with status code 400, with default header values.
|
||||||
|
|
||||||
|
APIError is error format response
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueAttachmentBadRequest struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue attachment bad request response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueAttachmentBadRequest) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue attachment bad request response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueAttachmentBadRequest) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue attachment bad request response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueAttachmentBadRequest) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue attachment bad request response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueAttachmentBadRequest) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue attachment bad request response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueAttachmentBadRequest) IsCode(code int) bool {
|
||||||
|
return code == 400
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue attachment bad request response
|
||||||
|
func (o *IssueCreateIssueAttachmentBadRequest) Code() int {
|
||||||
|
return 400
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueAttachmentBadRequest) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/assets][%d] issueCreateIssueAttachmentBadRequest", 400)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueAttachmentBadRequest) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/assets][%d] issueCreateIssueAttachmentBadRequest", 400)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueAttachmentBadRequest) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueAttachmentNotFound creates a IssueCreateIssueAttachmentNotFound with default headers values
|
||||||
|
func NewIssueCreateIssueAttachmentNotFound() *IssueCreateIssueAttachmentNotFound {
|
||||||
|
return &IssueCreateIssueAttachmentNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueAttachmentNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
APIError is error format response
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueAttachmentNotFound struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue attachment not found response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueAttachmentNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue attachment not found response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueAttachmentNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue attachment not found response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueAttachmentNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue attachment not found response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueAttachmentNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue attachment not found response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueAttachmentNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue attachment not found response
|
||||||
|
func (o *IssueCreateIssueAttachmentNotFound) Code() int {
|
||||||
|
return 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueAttachmentNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/assets][%d] issueCreateIssueAttachmentNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueAttachmentNotFound) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/assets][%d] issueCreateIssueAttachmentNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueAttachmentNotFound) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueAttachmentUnprocessableEntity creates a IssueCreateIssueAttachmentUnprocessableEntity with default headers values
|
||||||
|
func NewIssueCreateIssueAttachmentUnprocessableEntity() *IssueCreateIssueAttachmentUnprocessableEntity {
|
||||||
|
return &IssueCreateIssueAttachmentUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueAttachmentUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
APIValidationError is error format response related to input validation
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueAttachmentUnprocessableEntity struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue attachment unprocessable entity response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueAttachmentUnprocessableEntity) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue attachment unprocessable entity response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueAttachmentUnprocessableEntity) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue attachment unprocessable entity response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueAttachmentUnprocessableEntity) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue attachment unprocessable entity response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueAttachmentUnprocessableEntity) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue attachment unprocessable entity response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueAttachmentUnprocessableEntity) IsCode(code int) bool {
|
||||||
|
return code == 422
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue attachment unprocessable entity response
|
||||||
|
func (o *IssueCreateIssueAttachmentUnprocessableEntity) Code() int {
|
||||||
|
return 422
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueAttachmentUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/assets][%d] issueCreateIssueAttachmentUnprocessableEntity", 422)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueAttachmentUnprocessableEntity) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/assets][%d] issueCreateIssueAttachmentUnprocessableEntity", 422)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueAttachmentUnprocessableEntity) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueAttachmentLocked creates a IssueCreateIssueAttachmentLocked with default headers values
|
||||||
|
func NewIssueCreateIssueAttachmentLocked() *IssueCreateIssueAttachmentLocked {
|
||||||
|
return &IssueCreateIssueAttachmentLocked{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueAttachmentLocked describes a response with status code 423, with default header values.
|
||||||
|
|
||||||
|
APIRepoArchivedError is an error that is raised when an archived repo should be modified
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueAttachmentLocked struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue attachment locked response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueAttachmentLocked) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue attachment locked response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueAttachmentLocked) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue attachment locked response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueAttachmentLocked) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue attachment locked response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueAttachmentLocked) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue attachment locked response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueAttachmentLocked) IsCode(code int) bool {
|
||||||
|
return code == 423
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue attachment locked response
|
||||||
|
func (o *IssueCreateIssueAttachmentLocked) Code() int {
|
||||||
|
return 423
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueAttachmentLocked) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/assets][%d] issueCreateIssueAttachmentLocked", 423)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueAttachmentLocked) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/assets][%d] issueCreateIssueAttachmentLocked", 423)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueAttachmentLocked) 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,216 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewIssueCreateIssueBlockingParams creates a new IssueCreateIssueBlockingParams 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 NewIssueCreateIssueBlockingParams() *IssueCreateIssueBlockingParams {
|
||||||
|
return &IssueCreateIssueBlockingParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueBlockingParamsWithTimeout creates a new IssueCreateIssueBlockingParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewIssueCreateIssueBlockingParamsWithTimeout(timeout time.Duration) *IssueCreateIssueBlockingParams {
|
||||||
|
return &IssueCreateIssueBlockingParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueBlockingParamsWithContext creates a new IssueCreateIssueBlockingParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewIssueCreateIssueBlockingParamsWithContext(ctx context.Context) *IssueCreateIssueBlockingParams {
|
||||||
|
return &IssueCreateIssueBlockingParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueBlockingParamsWithHTTPClient creates a new IssueCreateIssueBlockingParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewIssueCreateIssueBlockingParamsWithHTTPClient(client *http.Client) *IssueCreateIssueBlockingParams {
|
||||||
|
return &IssueCreateIssueBlockingParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueBlockingParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the issue create issue blocking operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueBlockingParams struct {
|
||||||
|
|
||||||
|
// Body.
|
||||||
|
Body *models.IssueMeta
|
||||||
|
|
||||||
|
/* Index.
|
||||||
|
|
||||||
|
index of the issue
|
||||||
|
*/
|
||||||
|
Index string
|
||||||
|
|
||||||
|
/* 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 issue create issue blocking params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueCreateIssueBlockingParams) WithDefaults() *IssueCreateIssueBlockingParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the issue create issue blocking params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueCreateIssueBlockingParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the issue create issue blocking params
|
||||||
|
func (o *IssueCreateIssueBlockingParams) WithTimeout(timeout time.Duration) *IssueCreateIssueBlockingParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the issue create issue blocking params
|
||||||
|
func (o *IssueCreateIssueBlockingParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the issue create issue blocking params
|
||||||
|
func (o *IssueCreateIssueBlockingParams) WithContext(ctx context.Context) *IssueCreateIssueBlockingParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the issue create issue blocking params
|
||||||
|
func (o *IssueCreateIssueBlockingParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the issue create issue blocking params
|
||||||
|
func (o *IssueCreateIssueBlockingParams) WithHTTPClient(client *http.Client) *IssueCreateIssueBlockingParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the issue create issue blocking params
|
||||||
|
func (o *IssueCreateIssueBlockingParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBody adds the body to the issue create issue blocking params
|
||||||
|
func (o *IssueCreateIssueBlockingParams) WithBody(body *models.IssueMeta) *IssueCreateIssueBlockingParams {
|
||||||
|
o.SetBody(body)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetBody adds the body to the issue create issue blocking params
|
||||||
|
func (o *IssueCreateIssueBlockingParams) SetBody(body *models.IssueMeta) {
|
||||||
|
o.Body = body
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithIndex adds the index to the issue create issue blocking params
|
||||||
|
func (o *IssueCreateIssueBlockingParams) WithIndex(index string) *IssueCreateIssueBlockingParams {
|
||||||
|
o.SetIndex(index)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetIndex adds the index to the issue create issue blocking params
|
||||||
|
func (o *IssueCreateIssueBlockingParams) SetIndex(index string) {
|
||||||
|
o.Index = index
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOwner adds the owner to the issue create issue blocking params
|
||||||
|
func (o *IssueCreateIssueBlockingParams) WithOwner(owner string) *IssueCreateIssueBlockingParams {
|
||||||
|
o.SetOwner(owner)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOwner adds the owner to the issue create issue blocking params
|
||||||
|
func (o *IssueCreateIssueBlockingParams) SetOwner(owner string) {
|
||||||
|
o.Owner = owner
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithRepo adds the repo to the issue create issue blocking params
|
||||||
|
func (o *IssueCreateIssueBlockingParams) WithRepo(repo string) *IssueCreateIssueBlockingParams {
|
||||||
|
o.SetRepo(repo)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetRepo adds the repo to the issue create issue blocking params
|
||||||
|
func (o *IssueCreateIssueBlockingParams) SetRepo(repo string) {
|
||||||
|
o.Repo = repo
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *IssueCreateIssueBlockingParams) 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 index
|
||||||
|
if err := r.SetPathParam("index", o.Index); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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,168 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IssueCreateIssueBlockingReader is a Reader for the IssueCreateIssueBlocking structure.
|
||||||
|
type IssueCreateIssueBlockingReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *IssueCreateIssueBlockingReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 201:
|
||||||
|
result := NewIssueCreateIssueBlockingCreated()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 404:
|
||||||
|
result := NewIssueCreateIssueBlockingNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[POST /repos/{owner}/{repo}/issues/{index}/blocks] issueCreateIssueBlocking", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueBlockingCreated creates a IssueCreateIssueBlockingCreated with default headers values
|
||||||
|
func NewIssueCreateIssueBlockingCreated() *IssueCreateIssueBlockingCreated {
|
||||||
|
return &IssueCreateIssueBlockingCreated{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueBlockingCreated describes a response with status code 201, with default header values.
|
||||||
|
|
||||||
|
Issue
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueBlockingCreated struct {
|
||||||
|
Payload *models.Issue
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue blocking created response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueBlockingCreated) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue blocking created response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueBlockingCreated) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue blocking created response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueBlockingCreated) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue blocking created response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueBlockingCreated) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue blocking created response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueBlockingCreated) IsCode(code int) bool {
|
||||||
|
return code == 201
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue blocking created response
|
||||||
|
func (o *IssueCreateIssueBlockingCreated) Code() int {
|
||||||
|
return 201
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueBlockingCreated) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/blocks][%d] issueCreateIssueBlockingCreated %s", 201, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueBlockingCreated) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/blocks][%d] issueCreateIssueBlockingCreated %s", 201, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueBlockingCreated) GetPayload() *models.Issue {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueBlockingCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(models.Issue)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueBlockingNotFound creates a IssueCreateIssueBlockingNotFound with default headers values
|
||||||
|
func NewIssueCreateIssueBlockingNotFound() *IssueCreateIssueBlockingNotFound {
|
||||||
|
return &IssueCreateIssueBlockingNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueBlockingNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
the issue does not exist
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueBlockingNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue blocking not found response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueBlockingNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue blocking not found response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueBlockingNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue blocking not found response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueBlockingNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue blocking not found response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueBlockingNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue blocking not found response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueBlockingNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue blocking not found response
|
||||||
|
func (o *IssueCreateIssueBlockingNotFound) Code() int {
|
||||||
|
return 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueBlockingNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/blocks][%d] issueCreateIssueBlockingNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueBlockingNotFound) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/blocks][%d] issueCreateIssueBlockingNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueBlockingNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
@ -0,0 +1,253 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewIssueCreateIssueCommentAttachmentParams creates a new IssueCreateIssueCommentAttachmentParams 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 NewIssueCreateIssueCommentAttachmentParams() *IssueCreateIssueCommentAttachmentParams {
|
||||||
|
return &IssueCreateIssueCommentAttachmentParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueCommentAttachmentParamsWithTimeout creates a new IssueCreateIssueCommentAttachmentParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewIssueCreateIssueCommentAttachmentParamsWithTimeout(timeout time.Duration) *IssueCreateIssueCommentAttachmentParams {
|
||||||
|
return &IssueCreateIssueCommentAttachmentParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueCommentAttachmentParamsWithContext creates a new IssueCreateIssueCommentAttachmentParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewIssueCreateIssueCommentAttachmentParamsWithContext(ctx context.Context) *IssueCreateIssueCommentAttachmentParams {
|
||||||
|
return &IssueCreateIssueCommentAttachmentParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueCommentAttachmentParamsWithHTTPClient creates a new IssueCreateIssueCommentAttachmentParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewIssueCreateIssueCommentAttachmentParamsWithHTTPClient(client *http.Client) *IssueCreateIssueCommentAttachmentParams {
|
||||||
|
return &IssueCreateIssueCommentAttachmentParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueCommentAttachmentParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the issue create issue comment attachment operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueCommentAttachmentParams struct {
|
||||||
|
|
||||||
|
/* Attachment.
|
||||||
|
|
||||||
|
attachment to upload
|
||||||
|
*/
|
||||||
|
Attachment runtime.NamedReadCloser
|
||||||
|
|
||||||
|
/* ID.
|
||||||
|
|
||||||
|
id of the comment
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
ID int64
|
||||||
|
|
||||||
|
/* Name.
|
||||||
|
|
||||||
|
name of the attachment
|
||||||
|
*/
|
||||||
|
Name *string
|
||||||
|
|
||||||
|
/* 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 issue create issue comment attachment params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentParams) WithDefaults() *IssueCreateIssueCommentAttachmentParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the issue create issue comment attachment params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the issue create issue comment attachment params
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentParams) WithTimeout(timeout time.Duration) *IssueCreateIssueCommentAttachmentParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the issue create issue comment attachment params
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the issue create issue comment attachment params
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentParams) WithContext(ctx context.Context) *IssueCreateIssueCommentAttachmentParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the issue create issue comment attachment params
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the issue create issue comment attachment params
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentParams) WithHTTPClient(client *http.Client) *IssueCreateIssueCommentAttachmentParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the issue create issue comment attachment params
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithAttachment adds the attachment to the issue create issue comment attachment params
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentParams) WithAttachment(attachment runtime.NamedReadCloser) *IssueCreateIssueCommentAttachmentParams {
|
||||||
|
o.SetAttachment(attachment)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetAttachment adds the attachment to the issue create issue comment attachment params
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentParams) SetAttachment(attachment runtime.NamedReadCloser) {
|
||||||
|
o.Attachment = attachment
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithID adds the id to the issue create issue comment attachment params
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentParams) WithID(id int64) *IssueCreateIssueCommentAttachmentParams {
|
||||||
|
o.SetID(id)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetID adds the id to the issue create issue comment attachment params
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentParams) SetID(id int64) {
|
||||||
|
o.ID = id
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithName adds the name to the issue create issue comment attachment params
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentParams) WithName(name *string) *IssueCreateIssueCommentAttachmentParams {
|
||||||
|
o.SetName(name)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetName adds the name to the issue create issue comment attachment params
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentParams) SetName(name *string) {
|
||||||
|
o.Name = name
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOwner adds the owner to the issue create issue comment attachment params
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentParams) WithOwner(owner string) *IssueCreateIssueCommentAttachmentParams {
|
||||||
|
o.SetOwner(owner)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOwner adds the owner to the issue create issue comment attachment params
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentParams) SetOwner(owner string) {
|
||||||
|
o.Owner = owner
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithRepo adds the repo to the issue create issue comment attachment params
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentParams) WithRepo(repo string) *IssueCreateIssueCommentAttachmentParams {
|
||||||
|
o.SetRepo(repo)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetRepo adds the repo to the issue create issue comment attachment params
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentParams) SetRepo(repo string) {
|
||||||
|
o.Repo = repo
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
// form file param attachment
|
||||||
|
if err := r.SetFileParam("attachment", o.Attachment); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// path param id
|
||||||
|
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.Name != nil {
|
||||||
|
|
||||||
|
// query param name
|
||||||
|
var qrName string
|
||||||
|
|
||||||
|
if o.Name != nil {
|
||||||
|
qrName = *o.Name
|
||||||
|
}
|
||||||
|
qName := qrName
|
||||||
|
if qName != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("name", qName); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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,496 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IssueCreateIssueCommentAttachmentReader is a Reader for the IssueCreateIssueCommentAttachment structure.
|
||||||
|
type IssueCreateIssueCommentAttachmentReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 201:
|
||||||
|
result := NewIssueCreateIssueCommentAttachmentCreated()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 400:
|
||||||
|
result := NewIssueCreateIssueCommentAttachmentBadRequest()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 403:
|
||||||
|
result := NewIssueCreateIssueCommentAttachmentForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewIssueCreateIssueCommentAttachmentNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewIssueCreateIssueCommentAttachmentUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 423:
|
||||||
|
result := NewIssueCreateIssueCommentAttachmentLocked()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets] issueCreateIssueCommentAttachment", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueCommentAttachmentCreated creates a IssueCreateIssueCommentAttachmentCreated with default headers values
|
||||||
|
func NewIssueCreateIssueCommentAttachmentCreated() *IssueCreateIssueCommentAttachmentCreated {
|
||||||
|
return &IssueCreateIssueCommentAttachmentCreated{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueCommentAttachmentCreated describes a response with status code 201, with default header values.
|
||||||
|
|
||||||
|
Attachment
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueCommentAttachmentCreated struct {
|
||||||
|
Payload *models.Attachment
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue comment attachment created response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentCreated) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue comment attachment created response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentCreated) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue comment attachment created response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentCreated) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue comment attachment created response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentCreated) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue comment attachment created response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentCreated) IsCode(code int) bool {
|
||||||
|
return code == 201
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue comment attachment created response
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentCreated) Code() int {
|
||||||
|
return 201
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentCreated) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentCreated %s", 201, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentCreated) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentCreated %s", 201, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentCreated) GetPayload() *models.Attachment {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(models.Attachment)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueCommentAttachmentBadRequest creates a IssueCreateIssueCommentAttachmentBadRequest with default headers values
|
||||||
|
func NewIssueCreateIssueCommentAttachmentBadRequest() *IssueCreateIssueCommentAttachmentBadRequest {
|
||||||
|
return &IssueCreateIssueCommentAttachmentBadRequest{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueCommentAttachmentBadRequest describes a response with status code 400, with default header values.
|
||||||
|
|
||||||
|
APIError is error format response
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueCommentAttachmentBadRequest struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue comment attachment bad request response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentBadRequest) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue comment attachment bad request response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentBadRequest) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue comment attachment bad request response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentBadRequest) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue comment attachment bad request response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentBadRequest) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue comment attachment bad request response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentBadRequest) IsCode(code int) bool {
|
||||||
|
return code == 400
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue comment attachment bad request response
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentBadRequest) Code() int {
|
||||||
|
return 400
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentBadRequest) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentBadRequest", 400)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentBadRequest) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentBadRequest", 400)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentBadRequest) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueCommentAttachmentForbidden creates a IssueCreateIssueCommentAttachmentForbidden with default headers values
|
||||||
|
func NewIssueCreateIssueCommentAttachmentForbidden() *IssueCreateIssueCommentAttachmentForbidden {
|
||||||
|
return &IssueCreateIssueCommentAttachmentForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueCommentAttachmentForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
APIForbiddenError is a forbidden error response
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueCommentAttachmentForbidden struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue comment attachment forbidden response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentForbidden) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue comment attachment forbidden response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentForbidden) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue comment attachment forbidden response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentForbidden) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue comment attachment forbidden response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentForbidden) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue comment attachment forbidden response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentForbidden) IsCode(code int) bool {
|
||||||
|
return code == 403
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue comment attachment forbidden response
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentForbidden) Code() int {
|
||||||
|
return 403
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentForbidden) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentForbidden) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueCommentAttachmentNotFound creates a IssueCreateIssueCommentAttachmentNotFound with default headers values
|
||||||
|
func NewIssueCreateIssueCommentAttachmentNotFound() *IssueCreateIssueCommentAttachmentNotFound {
|
||||||
|
return &IssueCreateIssueCommentAttachmentNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueCommentAttachmentNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
APIError is error format response
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueCommentAttachmentNotFound struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue comment attachment not found response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue comment attachment not found response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue comment attachment not found response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue comment attachment not found response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue comment attachment not found response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue comment attachment not found response
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentNotFound) Code() int {
|
||||||
|
return 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentNotFound) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentNotFound) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueCommentAttachmentUnprocessableEntity creates a IssueCreateIssueCommentAttachmentUnprocessableEntity with default headers values
|
||||||
|
func NewIssueCreateIssueCommentAttachmentUnprocessableEntity() *IssueCreateIssueCommentAttachmentUnprocessableEntity {
|
||||||
|
return &IssueCreateIssueCommentAttachmentUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueCommentAttachmentUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
APIValidationError is error format response related to input validation
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueCommentAttachmentUnprocessableEntity struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue comment attachment unprocessable entity response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentUnprocessableEntity) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue comment attachment unprocessable entity response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentUnprocessableEntity) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue comment attachment unprocessable entity response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentUnprocessableEntity) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue comment attachment unprocessable entity response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentUnprocessableEntity) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue comment attachment unprocessable entity response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentUnprocessableEntity) IsCode(code int) bool {
|
||||||
|
return code == 422
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue comment attachment unprocessable entity response
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentUnprocessableEntity) Code() int {
|
||||||
|
return 422
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentUnprocessableEntity", 422)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentUnprocessableEntity) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentUnprocessableEntity", 422)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentUnprocessableEntity) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueCommentAttachmentLocked creates a IssueCreateIssueCommentAttachmentLocked with default headers values
|
||||||
|
func NewIssueCreateIssueCommentAttachmentLocked() *IssueCreateIssueCommentAttachmentLocked {
|
||||||
|
return &IssueCreateIssueCommentAttachmentLocked{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueCommentAttachmentLocked describes a response with status code 423, with default header values.
|
||||||
|
|
||||||
|
APIRepoArchivedError is an error that is raised when an archived repo should be modified
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueCommentAttachmentLocked struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue comment attachment locked response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentLocked) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue comment attachment locked response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentLocked) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue comment attachment locked response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentLocked) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue comment attachment locked response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentLocked) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue comment attachment locked response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentLocked) IsCode(code int) bool {
|
||||||
|
return code == 423
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue comment attachment locked response
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentLocked) Code() int {
|
||||||
|
return 423
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentLocked) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentLocked", 423)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentLocked) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentLocked", 423)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCommentAttachmentLocked) 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,216 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewIssueCreateIssueDependenciesParams creates a new IssueCreateIssueDependenciesParams 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 NewIssueCreateIssueDependenciesParams() *IssueCreateIssueDependenciesParams {
|
||||||
|
return &IssueCreateIssueDependenciesParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueDependenciesParamsWithTimeout creates a new IssueCreateIssueDependenciesParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewIssueCreateIssueDependenciesParamsWithTimeout(timeout time.Duration) *IssueCreateIssueDependenciesParams {
|
||||||
|
return &IssueCreateIssueDependenciesParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueDependenciesParamsWithContext creates a new IssueCreateIssueDependenciesParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewIssueCreateIssueDependenciesParamsWithContext(ctx context.Context) *IssueCreateIssueDependenciesParams {
|
||||||
|
return &IssueCreateIssueDependenciesParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueDependenciesParamsWithHTTPClient creates a new IssueCreateIssueDependenciesParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewIssueCreateIssueDependenciesParamsWithHTTPClient(client *http.Client) *IssueCreateIssueDependenciesParams {
|
||||||
|
return &IssueCreateIssueDependenciesParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueDependenciesParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the issue create issue dependencies operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueDependenciesParams struct {
|
||||||
|
|
||||||
|
// Body.
|
||||||
|
Body *models.IssueMeta
|
||||||
|
|
||||||
|
/* Index.
|
||||||
|
|
||||||
|
index of the issue
|
||||||
|
*/
|
||||||
|
Index string
|
||||||
|
|
||||||
|
/* 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 issue create issue dependencies params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueCreateIssueDependenciesParams) WithDefaults() *IssueCreateIssueDependenciesParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the issue create issue dependencies params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueCreateIssueDependenciesParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the issue create issue dependencies params
|
||||||
|
func (o *IssueCreateIssueDependenciesParams) WithTimeout(timeout time.Duration) *IssueCreateIssueDependenciesParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the issue create issue dependencies params
|
||||||
|
func (o *IssueCreateIssueDependenciesParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the issue create issue dependencies params
|
||||||
|
func (o *IssueCreateIssueDependenciesParams) WithContext(ctx context.Context) *IssueCreateIssueDependenciesParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the issue create issue dependencies params
|
||||||
|
func (o *IssueCreateIssueDependenciesParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the issue create issue dependencies params
|
||||||
|
func (o *IssueCreateIssueDependenciesParams) WithHTTPClient(client *http.Client) *IssueCreateIssueDependenciesParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the issue create issue dependencies params
|
||||||
|
func (o *IssueCreateIssueDependenciesParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBody adds the body to the issue create issue dependencies params
|
||||||
|
func (o *IssueCreateIssueDependenciesParams) WithBody(body *models.IssueMeta) *IssueCreateIssueDependenciesParams {
|
||||||
|
o.SetBody(body)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetBody adds the body to the issue create issue dependencies params
|
||||||
|
func (o *IssueCreateIssueDependenciesParams) SetBody(body *models.IssueMeta) {
|
||||||
|
o.Body = body
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithIndex adds the index to the issue create issue dependencies params
|
||||||
|
func (o *IssueCreateIssueDependenciesParams) WithIndex(index string) *IssueCreateIssueDependenciesParams {
|
||||||
|
o.SetIndex(index)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetIndex adds the index to the issue create issue dependencies params
|
||||||
|
func (o *IssueCreateIssueDependenciesParams) SetIndex(index string) {
|
||||||
|
o.Index = index
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOwner adds the owner to the issue create issue dependencies params
|
||||||
|
func (o *IssueCreateIssueDependenciesParams) WithOwner(owner string) *IssueCreateIssueDependenciesParams {
|
||||||
|
o.SetOwner(owner)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOwner adds the owner to the issue create issue dependencies params
|
||||||
|
func (o *IssueCreateIssueDependenciesParams) SetOwner(owner string) {
|
||||||
|
o.Owner = owner
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithRepo adds the repo to the issue create issue dependencies params
|
||||||
|
func (o *IssueCreateIssueDependenciesParams) WithRepo(repo string) *IssueCreateIssueDependenciesParams {
|
||||||
|
o.SetRepo(repo)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetRepo adds the repo to the issue create issue dependencies params
|
||||||
|
func (o *IssueCreateIssueDependenciesParams) SetRepo(repo string) {
|
||||||
|
o.Repo = repo
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *IssueCreateIssueDependenciesParams) 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 index
|
||||||
|
if err := r.SetPathParam("index", o.Index); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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,246 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IssueCreateIssueDependenciesReader is a Reader for the IssueCreateIssueDependencies structure.
|
||||||
|
type IssueCreateIssueDependenciesReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *IssueCreateIssueDependenciesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 201:
|
||||||
|
result := NewIssueCreateIssueDependenciesCreated()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 404:
|
||||||
|
result := NewIssueCreateIssueDependenciesNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 423:
|
||||||
|
result := NewIssueCreateIssueDependenciesLocked()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[POST /repos/{owner}/{repo}/issues/{index}/dependencies] issueCreateIssueDependencies", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueDependenciesCreated creates a IssueCreateIssueDependenciesCreated with default headers values
|
||||||
|
func NewIssueCreateIssueDependenciesCreated() *IssueCreateIssueDependenciesCreated {
|
||||||
|
return &IssueCreateIssueDependenciesCreated{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueDependenciesCreated describes a response with status code 201, with default header values.
|
||||||
|
|
||||||
|
Issue
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueDependenciesCreated struct {
|
||||||
|
Payload *models.Issue
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue dependencies created response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueDependenciesCreated) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue dependencies created response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueDependenciesCreated) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue dependencies created response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueDependenciesCreated) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue dependencies created response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueDependenciesCreated) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue dependencies created response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueDependenciesCreated) IsCode(code int) bool {
|
||||||
|
return code == 201
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue dependencies created response
|
||||||
|
func (o *IssueCreateIssueDependenciesCreated) Code() int {
|
||||||
|
return 201
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueDependenciesCreated) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/dependencies][%d] issueCreateIssueDependenciesCreated %s", 201, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueDependenciesCreated) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/dependencies][%d] issueCreateIssueDependenciesCreated %s", 201, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueDependenciesCreated) GetPayload() *models.Issue {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueDependenciesCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(models.Issue)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueDependenciesNotFound creates a IssueCreateIssueDependenciesNotFound with default headers values
|
||||||
|
func NewIssueCreateIssueDependenciesNotFound() *IssueCreateIssueDependenciesNotFound {
|
||||||
|
return &IssueCreateIssueDependenciesNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueDependenciesNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
the issue does not exist
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueDependenciesNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue dependencies not found response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueDependenciesNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue dependencies not found response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueDependenciesNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue dependencies not found response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueDependenciesNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue dependencies not found response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueDependenciesNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue dependencies not found response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueDependenciesNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue dependencies not found response
|
||||||
|
func (o *IssueCreateIssueDependenciesNotFound) Code() int {
|
||||||
|
return 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueDependenciesNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/dependencies][%d] issueCreateIssueDependenciesNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueDependenciesNotFound) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/dependencies][%d] issueCreateIssueDependenciesNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueDependenciesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueDependenciesLocked creates a IssueCreateIssueDependenciesLocked with default headers values
|
||||||
|
func NewIssueCreateIssueDependenciesLocked() *IssueCreateIssueDependenciesLocked {
|
||||||
|
return &IssueCreateIssueDependenciesLocked{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueDependenciesLocked describes a response with status code 423, with default header values.
|
||||||
|
|
||||||
|
APIRepoArchivedError is an error that is raised when an archived repo should be modified
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueDependenciesLocked struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue dependencies locked response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueDependenciesLocked) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue dependencies locked response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueDependenciesLocked) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue dependencies locked response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueDependenciesLocked) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue dependencies locked response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueDependenciesLocked) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue dependencies locked response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueDependenciesLocked) IsCode(code int) bool {
|
||||||
|
return code == 423
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue dependencies locked response
|
||||||
|
func (o *IssueCreateIssueDependenciesLocked) Code() int {
|
||||||
|
return 423
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueDependenciesLocked) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/dependencies][%d] issueCreateIssueDependenciesLocked", 423)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueDependenciesLocked) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/dependencies][%d] issueCreateIssueDependenciesLocked", 423)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueDependenciesLocked) 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,194 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewIssueCreateIssueParams creates a new IssueCreateIssueParams 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 NewIssueCreateIssueParams() *IssueCreateIssueParams {
|
||||||
|
return &IssueCreateIssueParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueParamsWithTimeout creates a new IssueCreateIssueParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewIssueCreateIssueParamsWithTimeout(timeout time.Duration) *IssueCreateIssueParams {
|
||||||
|
return &IssueCreateIssueParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueParamsWithContext creates a new IssueCreateIssueParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewIssueCreateIssueParamsWithContext(ctx context.Context) *IssueCreateIssueParams {
|
||||||
|
return &IssueCreateIssueParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueParamsWithHTTPClient creates a new IssueCreateIssueParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewIssueCreateIssueParamsWithHTTPClient(client *http.Client) *IssueCreateIssueParams {
|
||||||
|
return &IssueCreateIssueParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the issue create issue operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueParams struct {
|
||||||
|
|
||||||
|
// Body.
|
||||||
|
Body *models.CreateIssueOption
|
||||||
|
|
||||||
|
/* 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 issue create issue params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueCreateIssueParams) WithDefaults() *IssueCreateIssueParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the issue create issue params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueCreateIssueParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the issue create issue params
|
||||||
|
func (o *IssueCreateIssueParams) WithTimeout(timeout time.Duration) *IssueCreateIssueParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the issue create issue params
|
||||||
|
func (o *IssueCreateIssueParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the issue create issue params
|
||||||
|
func (o *IssueCreateIssueParams) WithContext(ctx context.Context) *IssueCreateIssueParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the issue create issue params
|
||||||
|
func (o *IssueCreateIssueParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the issue create issue params
|
||||||
|
func (o *IssueCreateIssueParams) WithHTTPClient(client *http.Client) *IssueCreateIssueParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the issue create issue params
|
||||||
|
func (o *IssueCreateIssueParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBody adds the body to the issue create issue params
|
||||||
|
func (o *IssueCreateIssueParams) WithBody(body *models.CreateIssueOption) *IssueCreateIssueParams {
|
||||||
|
o.SetBody(body)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetBody adds the body to the issue create issue params
|
||||||
|
func (o *IssueCreateIssueParams) SetBody(body *models.CreateIssueOption) {
|
||||||
|
o.Body = body
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOwner adds the owner to the issue create issue params
|
||||||
|
func (o *IssueCreateIssueParams) WithOwner(owner string) *IssueCreateIssueParams {
|
||||||
|
o.SetOwner(owner)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOwner adds the owner to the issue create issue params
|
||||||
|
func (o *IssueCreateIssueParams) SetOwner(owner string) {
|
||||||
|
o.Owner = owner
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithRepo adds the repo to the issue create issue params
|
||||||
|
func (o *IssueCreateIssueParams) WithRepo(repo string) *IssueCreateIssueParams {
|
||||||
|
o.SetRepo(repo)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetRepo adds the repo to the issue create issue params
|
||||||
|
func (o *IssueCreateIssueParams) SetRepo(repo string) {
|
||||||
|
o.Repo = repo
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *IssueCreateIssueParams) 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 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,480 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IssueCreateIssueReader is a Reader for the IssueCreateIssue structure.
|
||||||
|
type IssueCreateIssueReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *IssueCreateIssueReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 201:
|
||||||
|
result := NewIssueCreateIssueCreated()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 403:
|
||||||
|
result := NewIssueCreateIssueForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewIssueCreateIssueNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 412:
|
||||||
|
result := NewIssueCreateIssuePreconditionFailed()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewIssueCreateIssueUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 423:
|
||||||
|
result := NewIssueCreateIssueLocked()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[POST /repos/{owner}/{repo}/issues] issueCreateIssue", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueCreated creates a IssueCreateIssueCreated with default headers values
|
||||||
|
func NewIssueCreateIssueCreated() *IssueCreateIssueCreated {
|
||||||
|
return &IssueCreateIssueCreated{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueCreated describes a response with status code 201, with default header values.
|
||||||
|
|
||||||
|
Issue
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueCreated struct {
|
||||||
|
Payload *models.Issue
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue created response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueCreated) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue created response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueCreated) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue created response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueCreated) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue created response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueCreated) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue created response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueCreated) IsCode(code int) bool {
|
||||||
|
return code == 201
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue created response
|
||||||
|
func (o *IssueCreateIssueCreated) Code() int {
|
||||||
|
return 201
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCreated) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues][%d] issueCreateIssueCreated %s", 201, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCreated) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues][%d] issueCreateIssueCreated %s", 201, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCreated) GetPayload() *models.Issue {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(models.Issue)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueForbidden creates a IssueCreateIssueForbidden with default headers values
|
||||||
|
func NewIssueCreateIssueForbidden() *IssueCreateIssueForbidden {
|
||||||
|
return &IssueCreateIssueForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
APIForbiddenError is a forbidden error response
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueForbidden struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue forbidden response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueForbidden) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue forbidden response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueForbidden) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue forbidden response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueForbidden) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue forbidden response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueForbidden) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue forbidden response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueForbidden) IsCode(code int) bool {
|
||||||
|
return code == 403
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue forbidden response
|
||||||
|
func (o *IssueCreateIssueForbidden) Code() int {
|
||||||
|
return 403
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues][%d] issueCreateIssueForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueForbidden) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues][%d] issueCreateIssueForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueForbidden) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueNotFound creates a IssueCreateIssueNotFound with default headers values
|
||||||
|
func NewIssueCreateIssueNotFound() *IssueCreateIssueNotFound {
|
||||||
|
return &IssueCreateIssueNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
APINotFound is a not found empty response
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue not found response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue not found response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue not found response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue not found response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue not found response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue not found response
|
||||||
|
func (o *IssueCreateIssueNotFound) Code() int {
|
||||||
|
return 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues][%d] issueCreateIssueNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueNotFound) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues][%d] issueCreateIssueNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssuePreconditionFailed creates a IssueCreateIssuePreconditionFailed with default headers values
|
||||||
|
func NewIssueCreateIssuePreconditionFailed() *IssueCreateIssuePreconditionFailed {
|
||||||
|
return &IssueCreateIssuePreconditionFailed{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssuePreconditionFailed describes a response with status code 412, with default header values.
|
||||||
|
|
||||||
|
APIError is error format response
|
||||||
|
*/
|
||||||
|
type IssueCreateIssuePreconditionFailed struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue precondition failed response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssuePreconditionFailed) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue precondition failed response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssuePreconditionFailed) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue precondition failed response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssuePreconditionFailed) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue precondition failed response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssuePreconditionFailed) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue precondition failed response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssuePreconditionFailed) IsCode(code int) bool {
|
||||||
|
return code == 412
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue precondition failed response
|
||||||
|
func (o *IssueCreateIssuePreconditionFailed) Code() int {
|
||||||
|
return 412
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssuePreconditionFailed) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues][%d] issueCreateIssuePreconditionFailed", 412)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssuePreconditionFailed) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues][%d] issueCreateIssuePreconditionFailed", 412)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssuePreconditionFailed) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueUnprocessableEntity creates a IssueCreateIssueUnprocessableEntity with default headers values
|
||||||
|
func NewIssueCreateIssueUnprocessableEntity() *IssueCreateIssueUnprocessableEntity {
|
||||||
|
return &IssueCreateIssueUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
APIValidationError is error format response related to input validation
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueUnprocessableEntity struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue unprocessable entity response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueUnprocessableEntity) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue unprocessable entity response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueUnprocessableEntity) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue unprocessable entity response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueUnprocessableEntity) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue unprocessable entity response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueUnprocessableEntity) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue unprocessable entity response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueUnprocessableEntity) IsCode(code int) bool {
|
||||||
|
return code == 422
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue unprocessable entity response
|
||||||
|
func (o *IssueCreateIssueUnprocessableEntity) Code() int {
|
||||||
|
return 422
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues][%d] issueCreateIssueUnprocessableEntity", 422)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueUnprocessableEntity) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues][%d] issueCreateIssueUnprocessableEntity", 422)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueUnprocessableEntity) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateIssueLocked creates a IssueCreateIssueLocked with default headers values
|
||||||
|
func NewIssueCreateIssueLocked() *IssueCreateIssueLocked {
|
||||||
|
return &IssueCreateIssueLocked{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateIssueLocked describes a response with status code 423, with default header values.
|
||||||
|
|
||||||
|
APIRepoArchivedError is an error that is raised when an archived repo should be modified
|
||||||
|
*/
|
||||||
|
type IssueCreateIssueLocked struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create issue locked response has a 2xx status code
|
||||||
|
func (o *IssueCreateIssueLocked) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create issue locked response has a 3xx status code
|
||||||
|
func (o *IssueCreateIssueLocked) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create issue locked response has a 4xx status code
|
||||||
|
func (o *IssueCreateIssueLocked) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create issue locked response has a 5xx status code
|
||||||
|
func (o *IssueCreateIssueLocked) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create issue locked response a status code equal to that given
|
||||||
|
func (o *IssueCreateIssueLocked) IsCode(code int) bool {
|
||||||
|
return code == 423
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create issue locked response
|
||||||
|
func (o *IssueCreateIssueLocked) Code() int {
|
||||||
|
return 423
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueLocked) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues][%d] issueCreateIssueLocked", 423)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueLocked) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues][%d] issueCreateIssueLocked", 423)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateIssueLocked) 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,194 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewIssueCreateLabelParams creates a new IssueCreateLabelParams 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 NewIssueCreateLabelParams() *IssueCreateLabelParams {
|
||||||
|
return &IssueCreateLabelParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateLabelParamsWithTimeout creates a new IssueCreateLabelParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewIssueCreateLabelParamsWithTimeout(timeout time.Duration) *IssueCreateLabelParams {
|
||||||
|
return &IssueCreateLabelParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateLabelParamsWithContext creates a new IssueCreateLabelParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewIssueCreateLabelParamsWithContext(ctx context.Context) *IssueCreateLabelParams {
|
||||||
|
return &IssueCreateLabelParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateLabelParamsWithHTTPClient creates a new IssueCreateLabelParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewIssueCreateLabelParamsWithHTTPClient(client *http.Client) *IssueCreateLabelParams {
|
||||||
|
return &IssueCreateLabelParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateLabelParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the issue create label operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type IssueCreateLabelParams struct {
|
||||||
|
|
||||||
|
// Body.
|
||||||
|
Body *models.CreateLabelOption
|
||||||
|
|
||||||
|
/* 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 issue create label params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueCreateLabelParams) WithDefaults() *IssueCreateLabelParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the issue create label params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueCreateLabelParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the issue create label params
|
||||||
|
func (o *IssueCreateLabelParams) WithTimeout(timeout time.Duration) *IssueCreateLabelParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the issue create label params
|
||||||
|
func (o *IssueCreateLabelParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the issue create label params
|
||||||
|
func (o *IssueCreateLabelParams) WithContext(ctx context.Context) *IssueCreateLabelParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the issue create label params
|
||||||
|
func (o *IssueCreateLabelParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the issue create label params
|
||||||
|
func (o *IssueCreateLabelParams) WithHTTPClient(client *http.Client) *IssueCreateLabelParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the issue create label params
|
||||||
|
func (o *IssueCreateLabelParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBody adds the body to the issue create label params
|
||||||
|
func (o *IssueCreateLabelParams) WithBody(body *models.CreateLabelOption) *IssueCreateLabelParams {
|
||||||
|
o.SetBody(body)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetBody adds the body to the issue create label params
|
||||||
|
func (o *IssueCreateLabelParams) SetBody(body *models.CreateLabelOption) {
|
||||||
|
o.Body = body
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOwner adds the owner to the issue create label params
|
||||||
|
func (o *IssueCreateLabelParams) WithOwner(owner string) *IssueCreateLabelParams {
|
||||||
|
o.SetOwner(owner)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOwner adds the owner to the issue create label params
|
||||||
|
func (o *IssueCreateLabelParams) SetOwner(owner string) {
|
||||||
|
o.Owner = owner
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithRepo adds the repo to the issue create label params
|
||||||
|
func (o *IssueCreateLabelParams) WithRepo(repo string) *IssueCreateLabelParams {
|
||||||
|
o.SetRepo(repo)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetRepo adds the repo to the issue create label params
|
||||||
|
func (o *IssueCreateLabelParams) SetRepo(repo string) {
|
||||||
|
o.Repo = repo
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *IssueCreateLabelParams) 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 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,246 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IssueCreateLabelReader is a Reader for the IssueCreateLabel structure.
|
||||||
|
type IssueCreateLabelReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *IssueCreateLabelReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 201:
|
||||||
|
result := NewIssueCreateLabelCreated()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 404:
|
||||||
|
result := NewIssueCreateLabelNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 422:
|
||||||
|
result := NewIssueCreateLabelUnprocessableEntity()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[POST /repos/{owner}/{repo}/labels] issueCreateLabel", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateLabelCreated creates a IssueCreateLabelCreated with default headers values
|
||||||
|
func NewIssueCreateLabelCreated() *IssueCreateLabelCreated {
|
||||||
|
return &IssueCreateLabelCreated{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateLabelCreated describes a response with status code 201, with default header values.
|
||||||
|
|
||||||
|
Label
|
||||||
|
*/
|
||||||
|
type IssueCreateLabelCreated struct {
|
||||||
|
Payload *models.Label
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create label created response has a 2xx status code
|
||||||
|
func (o *IssueCreateLabelCreated) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create label created response has a 3xx status code
|
||||||
|
func (o *IssueCreateLabelCreated) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create label created response has a 4xx status code
|
||||||
|
func (o *IssueCreateLabelCreated) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create label created response has a 5xx status code
|
||||||
|
func (o *IssueCreateLabelCreated) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create label created response a status code equal to that given
|
||||||
|
func (o *IssueCreateLabelCreated) IsCode(code int) bool {
|
||||||
|
return code == 201
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create label created response
|
||||||
|
func (o *IssueCreateLabelCreated) Code() int {
|
||||||
|
return 201
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateLabelCreated) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/labels][%d] issueCreateLabelCreated %s", 201, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateLabelCreated) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/labels][%d] issueCreateLabelCreated %s", 201, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateLabelCreated) GetPayload() *models.Label {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateLabelCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(models.Label)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateLabelNotFound creates a IssueCreateLabelNotFound with default headers values
|
||||||
|
func NewIssueCreateLabelNotFound() *IssueCreateLabelNotFound {
|
||||||
|
return &IssueCreateLabelNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateLabelNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
APINotFound is a not found empty response
|
||||||
|
*/
|
||||||
|
type IssueCreateLabelNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create label not found response has a 2xx status code
|
||||||
|
func (o *IssueCreateLabelNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create label not found response has a 3xx status code
|
||||||
|
func (o *IssueCreateLabelNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create label not found response has a 4xx status code
|
||||||
|
func (o *IssueCreateLabelNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create label not found response has a 5xx status code
|
||||||
|
func (o *IssueCreateLabelNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create label not found response a status code equal to that given
|
||||||
|
func (o *IssueCreateLabelNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create label not found response
|
||||||
|
func (o *IssueCreateLabelNotFound) Code() int {
|
||||||
|
return 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateLabelNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/labels][%d] issueCreateLabelNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateLabelNotFound) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/labels][%d] issueCreateLabelNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateLabelNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateLabelUnprocessableEntity creates a IssueCreateLabelUnprocessableEntity with default headers values
|
||||||
|
func NewIssueCreateLabelUnprocessableEntity() *IssueCreateLabelUnprocessableEntity {
|
||||||
|
return &IssueCreateLabelUnprocessableEntity{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateLabelUnprocessableEntity describes a response with status code 422, with default header values.
|
||||||
|
|
||||||
|
APIValidationError is error format response related to input validation
|
||||||
|
*/
|
||||||
|
type IssueCreateLabelUnprocessableEntity struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create label unprocessable entity response has a 2xx status code
|
||||||
|
func (o *IssueCreateLabelUnprocessableEntity) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create label unprocessable entity response has a 3xx status code
|
||||||
|
func (o *IssueCreateLabelUnprocessableEntity) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create label unprocessable entity response has a 4xx status code
|
||||||
|
func (o *IssueCreateLabelUnprocessableEntity) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create label unprocessable entity response has a 5xx status code
|
||||||
|
func (o *IssueCreateLabelUnprocessableEntity) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create label unprocessable entity response a status code equal to that given
|
||||||
|
func (o *IssueCreateLabelUnprocessableEntity) IsCode(code int) bool {
|
||||||
|
return code == 422
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create label unprocessable entity response
|
||||||
|
func (o *IssueCreateLabelUnprocessableEntity) Code() int {
|
||||||
|
return 422
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateLabelUnprocessableEntity) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/labels][%d] issueCreateLabelUnprocessableEntity", 422)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateLabelUnprocessableEntity) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/labels][%d] issueCreateLabelUnprocessableEntity", 422)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateLabelUnprocessableEntity) 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,194 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewIssueCreateMilestoneParams creates a new IssueCreateMilestoneParams 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 NewIssueCreateMilestoneParams() *IssueCreateMilestoneParams {
|
||||||
|
return &IssueCreateMilestoneParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateMilestoneParamsWithTimeout creates a new IssueCreateMilestoneParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewIssueCreateMilestoneParamsWithTimeout(timeout time.Duration) *IssueCreateMilestoneParams {
|
||||||
|
return &IssueCreateMilestoneParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateMilestoneParamsWithContext creates a new IssueCreateMilestoneParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewIssueCreateMilestoneParamsWithContext(ctx context.Context) *IssueCreateMilestoneParams {
|
||||||
|
return &IssueCreateMilestoneParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateMilestoneParamsWithHTTPClient creates a new IssueCreateMilestoneParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewIssueCreateMilestoneParamsWithHTTPClient(client *http.Client) *IssueCreateMilestoneParams {
|
||||||
|
return &IssueCreateMilestoneParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateMilestoneParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the issue create milestone operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type IssueCreateMilestoneParams struct {
|
||||||
|
|
||||||
|
// Body.
|
||||||
|
Body *models.CreateMilestoneOption
|
||||||
|
|
||||||
|
/* 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 issue create milestone params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueCreateMilestoneParams) WithDefaults() *IssueCreateMilestoneParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the issue create milestone params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueCreateMilestoneParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the issue create milestone params
|
||||||
|
func (o *IssueCreateMilestoneParams) WithTimeout(timeout time.Duration) *IssueCreateMilestoneParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the issue create milestone params
|
||||||
|
func (o *IssueCreateMilestoneParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the issue create milestone params
|
||||||
|
func (o *IssueCreateMilestoneParams) WithContext(ctx context.Context) *IssueCreateMilestoneParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the issue create milestone params
|
||||||
|
func (o *IssueCreateMilestoneParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the issue create milestone params
|
||||||
|
func (o *IssueCreateMilestoneParams) WithHTTPClient(client *http.Client) *IssueCreateMilestoneParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the issue create milestone params
|
||||||
|
func (o *IssueCreateMilestoneParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBody adds the body to the issue create milestone params
|
||||||
|
func (o *IssueCreateMilestoneParams) WithBody(body *models.CreateMilestoneOption) *IssueCreateMilestoneParams {
|
||||||
|
o.SetBody(body)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetBody adds the body to the issue create milestone params
|
||||||
|
func (o *IssueCreateMilestoneParams) SetBody(body *models.CreateMilestoneOption) {
|
||||||
|
o.Body = body
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOwner adds the owner to the issue create milestone params
|
||||||
|
func (o *IssueCreateMilestoneParams) WithOwner(owner string) *IssueCreateMilestoneParams {
|
||||||
|
o.SetOwner(owner)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOwner adds the owner to the issue create milestone params
|
||||||
|
func (o *IssueCreateMilestoneParams) SetOwner(owner string) {
|
||||||
|
o.Owner = owner
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithRepo adds the repo to the issue create milestone params
|
||||||
|
func (o *IssueCreateMilestoneParams) WithRepo(repo string) *IssueCreateMilestoneParams {
|
||||||
|
o.SetRepo(repo)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetRepo adds the repo to the issue create milestone params
|
||||||
|
func (o *IssueCreateMilestoneParams) SetRepo(repo string) {
|
||||||
|
o.Repo = repo
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *IssueCreateMilestoneParams) 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 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,168 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IssueCreateMilestoneReader is a Reader for the IssueCreateMilestone structure.
|
||||||
|
type IssueCreateMilestoneReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *IssueCreateMilestoneReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 201:
|
||||||
|
result := NewIssueCreateMilestoneCreated()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 404:
|
||||||
|
result := NewIssueCreateMilestoneNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[POST /repos/{owner}/{repo}/milestones] issueCreateMilestone", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateMilestoneCreated creates a IssueCreateMilestoneCreated with default headers values
|
||||||
|
func NewIssueCreateMilestoneCreated() *IssueCreateMilestoneCreated {
|
||||||
|
return &IssueCreateMilestoneCreated{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateMilestoneCreated describes a response with status code 201, with default header values.
|
||||||
|
|
||||||
|
Milestone
|
||||||
|
*/
|
||||||
|
type IssueCreateMilestoneCreated struct {
|
||||||
|
Payload *models.Milestone
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create milestone created response has a 2xx status code
|
||||||
|
func (o *IssueCreateMilestoneCreated) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create milestone created response has a 3xx status code
|
||||||
|
func (o *IssueCreateMilestoneCreated) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create milestone created response has a 4xx status code
|
||||||
|
func (o *IssueCreateMilestoneCreated) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create milestone created response has a 5xx status code
|
||||||
|
func (o *IssueCreateMilestoneCreated) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create milestone created response a status code equal to that given
|
||||||
|
func (o *IssueCreateMilestoneCreated) IsCode(code int) bool {
|
||||||
|
return code == 201
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create milestone created response
|
||||||
|
func (o *IssueCreateMilestoneCreated) Code() int {
|
||||||
|
return 201
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateMilestoneCreated) Error() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/milestones][%d] issueCreateMilestoneCreated %s", 201, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateMilestoneCreated) String() string {
|
||||||
|
payload, _ := json.Marshal(o.Payload)
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/milestones][%d] issueCreateMilestoneCreated %s", 201, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateMilestoneCreated) GetPayload() *models.Milestone {
|
||||||
|
return o.Payload
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateMilestoneCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
o.Payload = new(models.Milestone)
|
||||||
|
|
||||||
|
// response payload
|
||||||
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueCreateMilestoneNotFound creates a IssueCreateMilestoneNotFound with default headers values
|
||||||
|
func NewIssueCreateMilestoneNotFound() *IssueCreateMilestoneNotFound {
|
||||||
|
return &IssueCreateMilestoneNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueCreateMilestoneNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
APINotFound is a not found empty response
|
||||||
|
*/
|
||||||
|
type IssueCreateMilestoneNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue create milestone not found response has a 2xx status code
|
||||||
|
func (o *IssueCreateMilestoneNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue create milestone not found response has a 3xx status code
|
||||||
|
func (o *IssueCreateMilestoneNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue create milestone not found response has a 4xx status code
|
||||||
|
func (o *IssueCreateMilestoneNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue create milestone not found response has a 5xx status code
|
||||||
|
func (o *IssueCreateMilestoneNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue create milestone not found response a status code equal to that given
|
||||||
|
func (o *IssueCreateMilestoneNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue create milestone not found response
|
||||||
|
func (o *IssueCreateMilestoneNotFound) Code() int {
|
||||||
|
return 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateMilestoneNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/milestones][%d] issueCreateMilestoneNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateMilestoneNotFound) String() string {
|
||||||
|
return fmt.Sprintf("[POST /repos/{owner}/{repo}/milestones][%d] issueCreateMilestoneNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueCreateMilestoneNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
@ -0,0 +1,220 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentDeprecatedParams creates a new IssueDeleteCommentDeprecatedParams 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 NewIssueDeleteCommentDeprecatedParams() *IssueDeleteCommentDeprecatedParams {
|
||||||
|
return &IssueDeleteCommentDeprecatedParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentDeprecatedParamsWithTimeout creates a new IssueDeleteCommentDeprecatedParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewIssueDeleteCommentDeprecatedParamsWithTimeout(timeout time.Duration) *IssueDeleteCommentDeprecatedParams {
|
||||||
|
return &IssueDeleteCommentDeprecatedParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentDeprecatedParamsWithContext creates a new IssueDeleteCommentDeprecatedParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewIssueDeleteCommentDeprecatedParamsWithContext(ctx context.Context) *IssueDeleteCommentDeprecatedParams {
|
||||||
|
return &IssueDeleteCommentDeprecatedParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentDeprecatedParamsWithHTTPClient creates a new IssueDeleteCommentDeprecatedParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewIssueDeleteCommentDeprecatedParamsWithHTTPClient(client *http.Client) *IssueDeleteCommentDeprecatedParams {
|
||||||
|
return &IssueDeleteCommentDeprecatedParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueDeleteCommentDeprecatedParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the issue delete comment deprecated operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type IssueDeleteCommentDeprecatedParams struct {
|
||||||
|
|
||||||
|
/* ID.
|
||||||
|
|
||||||
|
id of comment to delete
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
ID int64
|
||||||
|
|
||||||
|
/* Index.
|
||||||
|
|
||||||
|
this parameter is ignored
|
||||||
|
*/
|
||||||
|
Index int64
|
||||||
|
|
||||||
|
/* 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 issue delete comment deprecated params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueDeleteCommentDeprecatedParams) WithDefaults() *IssueDeleteCommentDeprecatedParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the issue delete comment deprecated params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueDeleteCommentDeprecatedParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the issue delete comment deprecated params
|
||||||
|
func (o *IssueDeleteCommentDeprecatedParams) WithTimeout(timeout time.Duration) *IssueDeleteCommentDeprecatedParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the issue delete comment deprecated params
|
||||||
|
func (o *IssueDeleteCommentDeprecatedParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the issue delete comment deprecated params
|
||||||
|
func (o *IssueDeleteCommentDeprecatedParams) WithContext(ctx context.Context) *IssueDeleteCommentDeprecatedParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the issue delete comment deprecated params
|
||||||
|
func (o *IssueDeleteCommentDeprecatedParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the issue delete comment deprecated params
|
||||||
|
func (o *IssueDeleteCommentDeprecatedParams) WithHTTPClient(client *http.Client) *IssueDeleteCommentDeprecatedParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the issue delete comment deprecated params
|
||||||
|
func (o *IssueDeleteCommentDeprecatedParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithID adds the id to the issue delete comment deprecated params
|
||||||
|
func (o *IssueDeleteCommentDeprecatedParams) WithID(id int64) *IssueDeleteCommentDeprecatedParams {
|
||||||
|
o.SetID(id)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetID adds the id to the issue delete comment deprecated params
|
||||||
|
func (o *IssueDeleteCommentDeprecatedParams) SetID(id int64) {
|
||||||
|
o.ID = id
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithIndex adds the index to the issue delete comment deprecated params
|
||||||
|
func (o *IssueDeleteCommentDeprecatedParams) WithIndex(index int64) *IssueDeleteCommentDeprecatedParams {
|
||||||
|
o.SetIndex(index)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetIndex adds the index to the issue delete comment deprecated params
|
||||||
|
func (o *IssueDeleteCommentDeprecatedParams) SetIndex(index int64) {
|
||||||
|
o.Index = index
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOwner adds the owner to the issue delete comment deprecated params
|
||||||
|
func (o *IssueDeleteCommentDeprecatedParams) WithOwner(owner string) *IssueDeleteCommentDeprecatedParams {
|
||||||
|
o.SetOwner(owner)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOwner adds the owner to the issue delete comment deprecated params
|
||||||
|
func (o *IssueDeleteCommentDeprecatedParams) SetOwner(owner string) {
|
||||||
|
o.Owner = owner
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithRepo adds the repo to the issue delete comment deprecated params
|
||||||
|
func (o *IssueDeleteCommentDeprecatedParams) WithRepo(repo string) *IssueDeleteCommentDeprecatedParams {
|
||||||
|
o.SetRepo(repo)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetRepo adds the repo to the issue delete comment deprecated params
|
||||||
|
func (o *IssueDeleteCommentDeprecatedParams) SetRepo(repo string) {
|
||||||
|
o.Repo = repo
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *IssueDeleteCommentDeprecatedParams) 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 index
|
||||||
|
if err := r.SetPathParam("index", swag.FormatInt64(o.Index)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IssueDeleteCommentDeprecatedReader is a Reader for the IssueDeleteCommentDeprecated structure.
|
||||||
|
type IssueDeleteCommentDeprecatedReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *IssueDeleteCommentDeprecatedReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 204:
|
||||||
|
result := NewIssueDeleteCommentDeprecatedNoContent()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 403:
|
||||||
|
result := NewIssueDeleteCommentDeprecatedForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewIssueDeleteCommentDeprecatedNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[DELETE /repos/{owner}/{repo}/issues/{index}/comments/{id}] issueDeleteCommentDeprecated", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentDeprecatedNoContent creates a IssueDeleteCommentDeprecatedNoContent with default headers values
|
||||||
|
func NewIssueDeleteCommentDeprecatedNoContent() *IssueDeleteCommentDeprecatedNoContent {
|
||||||
|
return &IssueDeleteCommentDeprecatedNoContent{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueDeleteCommentDeprecatedNoContent describes a response with status code 204, with default header values.
|
||||||
|
|
||||||
|
APIEmpty is an empty response
|
||||||
|
*/
|
||||||
|
type IssueDeleteCommentDeprecatedNoContent struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue delete comment deprecated no content response has a 2xx status code
|
||||||
|
func (o *IssueDeleteCommentDeprecatedNoContent) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue delete comment deprecated no content response has a 3xx status code
|
||||||
|
func (o *IssueDeleteCommentDeprecatedNoContent) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue delete comment deprecated no content response has a 4xx status code
|
||||||
|
func (o *IssueDeleteCommentDeprecatedNoContent) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue delete comment deprecated no content response has a 5xx status code
|
||||||
|
func (o *IssueDeleteCommentDeprecatedNoContent) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue delete comment deprecated no content response a status code equal to that given
|
||||||
|
func (o *IssueDeleteCommentDeprecatedNoContent) IsCode(code int) bool {
|
||||||
|
return code == 204
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue delete comment deprecated no content response
|
||||||
|
func (o *IssueDeleteCommentDeprecatedNoContent) Code() int {
|
||||||
|
return 204
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentDeprecatedNoContent) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/{index}/comments/{id}][%d] issueDeleteCommentDeprecatedNoContent", 204)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentDeprecatedNoContent) String() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/{index}/comments/{id}][%d] issueDeleteCommentDeprecatedNoContent", 204)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentDeprecatedNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentDeprecatedForbidden creates a IssueDeleteCommentDeprecatedForbidden with default headers values
|
||||||
|
func NewIssueDeleteCommentDeprecatedForbidden() *IssueDeleteCommentDeprecatedForbidden {
|
||||||
|
return &IssueDeleteCommentDeprecatedForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueDeleteCommentDeprecatedForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
APIForbiddenError is a forbidden error response
|
||||||
|
*/
|
||||||
|
type IssueDeleteCommentDeprecatedForbidden struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue delete comment deprecated forbidden response has a 2xx status code
|
||||||
|
func (o *IssueDeleteCommentDeprecatedForbidden) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue delete comment deprecated forbidden response has a 3xx status code
|
||||||
|
func (o *IssueDeleteCommentDeprecatedForbidden) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue delete comment deprecated forbidden response has a 4xx status code
|
||||||
|
func (o *IssueDeleteCommentDeprecatedForbidden) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue delete comment deprecated forbidden response has a 5xx status code
|
||||||
|
func (o *IssueDeleteCommentDeprecatedForbidden) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue delete comment deprecated forbidden response a status code equal to that given
|
||||||
|
func (o *IssueDeleteCommentDeprecatedForbidden) IsCode(code int) bool {
|
||||||
|
return code == 403
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue delete comment deprecated forbidden response
|
||||||
|
func (o *IssueDeleteCommentDeprecatedForbidden) Code() int {
|
||||||
|
return 403
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentDeprecatedForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/{index}/comments/{id}][%d] issueDeleteCommentDeprecatedForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentDeprecatedForbidden) String() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/{index}/comments/{id}][%d] issueDeleteCommentDeprecatedForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentDeprecatedForbidden) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentDeprecatedNotFound creates a IssueDeleteCommentDeprecatedNotFound with default headers values
|
||||||
|
func NewIssueDeleteCommentDeprecatedNotFound() *IssueDeleteCommentDeprecatedNotFound {
|
||||||
|
return &IssueDeleteCommentDeprecatedNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueDeleteCommentDeprecatedNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
APINotFound is a not found empty response
|
||||||
|
*/
|
||||||
|
type IssueDeleteCommentDeprecatedNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue delete comment deprecated not found response has a 2xx status code
|
||||||
|
func (o *IssueDeleteCommentDeprecatedNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue delete comment deprecated not found response has a 3xx status code
|
||||||
|
func (o *IssueDeleteCommentDeprecatedNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue delete comment deprecated not found response has a 4xx status code
|
||||||
|
func (o *IssueDeleteCommentDeprecatedNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue delete comment deprecated not found response has a 5xx status code
|
||||||
|
func (o *IssueDeleteCommentDeprecatedNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue delete comment deprecated not found response a status code equal to that given
|
||||||
|
func (o *IssueDeleteCommentDeprecatedNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue delete comment deprecated not found response
|
||||||
|
func (o *IssueDeleteCommentDeprecatedNotFound) Code() int {
|
||||||
|
return 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentDeprecatedNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/{index}/comments/{id}][%d] issueDeleteCommentDeprecatedNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentDeprecatedNotFound) String() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/{index}/comments/{id}][%d] issueDeleteCommentDeprecatedNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentDeprecatedNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
@ -0,0 +1,198 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentParams creates a new IssueDeleteCommentParams 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 NewIssueDeleteCommentParams() *IssueDeleteCommentParams {
|
||||||
|
return &IssueDeleteCommentParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentParamsWithTimeout creates a new IssueDeleteCommentParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewIssueDeleteCommentParamsWithTimeout(timeout time.Duration) *IssueDeleteCommentParams {
|
||||||
|
return &IssueDeleteCommentParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentParamsWithContext creates a new IssueDeleteCommentParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewIssueDeleteCommentParamsWithContext(ctx context.Context) *IssueDeleteCommentParams {
|
||||||
|
return &IssueDeleteCommentParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentParamsWithHTTPClient creates a new IssueDeleteCommentParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewIssueDeleteCommentParamsWithHTTPClient(client *http.Client) *IssueDeleteCommentParams {
|
||||||
|
return &IssueDeleteCommentParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueDeleteCommentParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the issue delete comment operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type IssueDeleteCommentParams struct {
|
||||||
|
|
||||||
|
/* ID.
|
||||||
|
|
||||||
|
id of comment to delete
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
ID int64
|
||||||
|
|
||||||
|
/* 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 issue delete comment params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueDeleteCommentParams) WithDefaults() *IssueDeleteCommentParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the issue delete comment params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueDeleteCommentParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the issue delete comment params
|
||||||
|
func (o *IssueDeleteCommentParams) WithTimeout(timeout time.Duration) *IssueDeleteCommentParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the issue delete comment params
|
||||||
|
func (o *IssueDeleteCommentParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the issue delete comment params
|
||||||
|
func (o *IssueDeleteCommentParams) WithContext(ctx context.Context) *IssueDeleteCommentParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the issue delete comment params
|
||||||
|
func (o *IssueDeleteCommentParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the issue delete comment params
|
||||||
|
func (o *IssueDeleteCommentParams) WithHTTPClient(client *http.Client) *IssueDeleteCommentParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the issue delete comment params
|
||||||
|
func (o *IssueDeleteCommentParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithID adds the id to the issue delete comment params
|
||||||
|
func (o *IssueDeleteCommentParams) WithID(id int64) *IssueDeleteCommentParams {
|
||||||
|
o.SetID(id)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetID adds the id to the issue delete comment params
|
||||||
|
func (o *IssueDeleteCommentParams) SetID(id int64) {
|
||||||
|
o.ID = id
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOwner adds the owner to the issue delete comment params
|
||||||
|
func (o *IssueDeleteCommentParams) WithOwner(owner string) *IssueDeleteCommentParams {
|
||||||
|
o.SetOwner(owner)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOwner adds the owner to the issue delete comment params
|
||||||
|
func (o *IssueDeleteCommentParams) SetOwner(owner string) {
|
||||||
|
o.Owner = owner
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithRepo adds the repo to the issue delete comment params
|
||||||
|
func (o *IssueDeleteCommentParams) WithRepo(repo string) *IssueDeleteCommentParams {
|
||||||
|
o.SetRepo(repo)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetRepo adds the repo to the issue delete comment params
|
||||||
|
func (o *IssueDeleteCommentParams) SetRepo(repo string) {
|
||||||
|
o.Repo = repo
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *IssueDeleteCommentParams) 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 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,219 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentReactionParams creates a new IssueDeleteCommentReactionParams 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 NewIssueDeleteCommentReactionParams() *IssueDeleteCommentReactionParams {
|
||||||
|
return &IssueDeleteCommentReactionParams{
|
||||||
|
timeout: cr.DefaultTimeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentReactionParamsWithTimeout creates a new IssueDeleteCommentReactionParams object
|
||||||
|
// with the ability to set a timeout on a request.
|
||||||
|
func NewIssueDeleteCommentReactionParamsWithTimeout(timeout time.Duration) *IssueDeleteCommentReactionParams {
|
||||||
|
return &IssueDeleteCommentReactionParams{
|
||||||
|
timeout: timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentReactionParamsWithContext creates a new IssueDeleteCommentReactionParams object
|
||||||
|
// with the ability to set a context for a request.
|
||||||
|
func NewIssueDeleteCommentReactionParamsWithContext(ctx context.Context) *IssueDeleteCommentReactionParams {
|
||||||
|
return &IssueDeleteCommentReactionParams{
|
||||||
|
Context: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentReactionParamsWithHTTPClient creates a new IssueDeleteCommentReactionParams object
|
||||||
|
// with the ability to set a custom HTTPClient for a request.
|
||||||
|
func NewIssueDeleteCommentReactionParamsWithHTTPClient(client *http.Client) *IssueDeleteCommentReactionParams {
|
||||||
|
return &IssueDeleteCommentReactionParams{
|
||||||
|
HTTPClient: client,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueDeleteCommentReactionParams contains all the parameters to send to the API endpoint
|
||||||
|
|
||||||
|
for the issue delete comment reaction operation.
|
||||||
|
|
||||||
|
Typically these are written to a http.Request.
|
||||||
|
*/
|
||||||
|
type IssueDeleteCommentReactionParams struct {
|
||||||
|
|
||||||
|
// Content.
|
||||||
|
Content *models.EditReactionOption
|
||||||
|
|
||||||
|
/* ID.
|
||||||
|
|
||||||
|
id of the comment to edit
|
||||||
|
|
||||||
|
Format: int64
|
||||||
|
*/
|
||||||
|
ID int64
|
||||||
|
|
||||||
|
/* 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 issue delete comment reaction params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueDeleteCommentReactionParams) WithDefaults() *IssueDeleteCommentReactionParams {
|
||||||
|
o.SetDefaults()
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults hydrates default values in the issue delete comment reaction params (not the query body).
|
||||||
|
//
|
||||||
|
// All values with no default are reset to their zero value.
|
||||||
|
func (o *IssueDeleteCommentReactionParams) SetDefaults() {
|
||||||
|
// no default values defined for this parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithTimeout adds the timeout to the issue delete comment reaction params
|
||||||
|
func (o *IssueDeleteCommentReactionParams) WithTimeout(timeout time.Duration) *IssueDeleteCommentReactionParams {
|
||||||
|
o.SetTimeout(timeout)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeout adds the timeout to the issue delete comment reaction params
|
||||||
|
func (o *IssueDeleteCommentReactionParams) SetTimeout(timeout time.Duration) {
|
||||||
|
o.timeout = timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContext adds the context to the issue delete comment reaction params
|
||||||
|
func (o *IssueDeleteCommentReactionParams) WithContext(ctx context.Context) *IssueDeleteCommentReactionParams {
|
||||||
|
o.SetContext(ctx)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContext adds the context to the issue delete comment reaction params
|
||||||
|
func (o *IssueDeleteCommentReactionParams) SetContext(ctx context.Context) {
|
||||||
|
o.Context = ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithHTTPClient adds the HTTPClient to the issue delete comment reaction params
|
||||||
|
func (o *IssueDeleteCommentReactionParams) WithHTTPClient(client *http.Client) *IssueDeleteCommentReactionParams {
|
||||||
|
o.SetHTTPClient(client)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetHTTPClient adds the HTTPClient to the issue delete comment reaction params
|
||||||
|
func (o *IssueDeleteCommentReactionParams) SetHTTPClient(client *http.Client) {
|
||||||
|
o.HTTPClient = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithContent adds the content to the issue delete comment reaction params
|
||||||
|
func (o *IssueDeleteCommentReactionParams) WithContent(content *models.EditReactionOption) *IssueDeleteCommentReactionParams {
|
||||||
|
o.SetContent(content)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContent adds the content to the issue delete comment reaction params
|
||||||
|
func (o *IssueDeleteCommentReactionParams) SetContent(content *models.EditReactionOption) {
|
||||||
|
o.Content = content
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithID adds the id to the issue delete comment reaction params
|
||||||
|
func (o *IssueDeleteCommentReactionParams) WithID(id int64) *IssueDeleteCommentReactionParams {
|
||||||
|
o.SetID(id)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetID adds the id to the issue delete comment reaction params
|
||||||
|
func (o *IssueDeleteCommentReactionParams) SetID(id int64) {
|
||||||
|
o.ID = id
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOwner adds the owner to the issue delete comment reaction params
|
||||||
|
func (o *IssueDeleteCommentReactionParams) WithOwner(owner string) *IssueDeleteCommentReactionParams {
|
||||||
|
o.SetOwner(owner)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOwner adds the owner to the issue delete comment reaction params
|
||||||
|
func (o *IssueDeleteCommentReactionParams) SetOwner(owner string) {
|
||||||
|
o.Owner = owner
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithRepo adds the repo to the issue delete comment reaction params
|
||||||
|
func (o *IssueDeleteCommentReactionParams) WithRepo(repo string) *IssueDeleteCommentReactionParams {
|
||||||
|
o.SetRepo(repo)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetRepo adds the repo to the issue delete comment reaction params
|
||||||
|
func (o *IssueDeleteCommentReactionParams) SetRepo(repo string) {
|
||||||
|
o.Repo = repo
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteToRequest writes these params to a swagger request
|
||||||
|
func (o *IssueDeleteCommentReactionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
|
if err := r.SetTimeout(o.timeout); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var res []error
|
||||||
|
if o.Content != nil {
|
||||||
|
if err := r.SetBodyParam(o.Content); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// path param id
|
||||||
|
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IssueDeleteCommentReactionReader is a Reader for the IssueDeleteCommentReaction structure.
|
||||||
|
type IssueDeleteCommentReactionReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *IssueDeleteCommentReactionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 200:
|
||||||
|
result := NewIssueDeleteCommentReactionOK()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 403:
|
||||||
|
result := NewIssueDeleteCommentReactionForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewIssueDeleteCommentReactionNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[DELETE /repos/{owner}/{repo}/issues/comments/{id}/reactions] issueDeleteCommentReaction", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentReactionOK creates a IssueDeleteCommentReactionOK with default headers values
|
||||||
|
func NewIssueDeleteCommentReactionOK() *IssueDeleteCommentReactionOK {
|
||||||
|
return &IssueDeleteCommentReactionOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueDeleteCommentReactionOK describes a response with status code 200, with default header values.
|
||||||
|
|
||||||
|
APIEmpty is an empty response
|
||||||
|
*/
|
||||||
|
type IssueDeleteCommentReactionOK struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue delete comment reaction o k response has a 2xx status code
|
||||||
|
func (o *IssueDeleteCommentReactionOK) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue delete comment reaction o k response has a 3xx status code
|
||||||
|
func (o *IssueDeleteCommentReactionOK) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue delete comment reaction o k response has a 4xx status code
|
||||||
|
func (o *IssueDeleteCommentReactionOK) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue delete comment reaction o k response has a 5xx status code
|
||||||
|
func (o *IssueDeleteCommentReactionOK) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue delete comment reaction o k response a status code equal to that given
|
||||||
|
func (o *IssueDeleteCommentReactionOK) IsCode(code int) bool {
|
||||||
|
return code == 200
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue delete comment reaction o k response
|
||||||
|
func (o *IssueDeleteCommentReactionOK) Code() int {
|
||||||
|
return 200
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentReactionOK) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/comments/{id}/reactions][%d] issueDeleteCommentReactionOK", 200)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentReactionOK) String() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/comments/{id}/reactions][%d] issueDeleteCommentReactionOK", 200)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentReactionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentReactionForbidden creates a IssueDeleteCommentReactionForbidden with default headers values
|
||||||
|
func NewIssueDeleteCommentReactionForbidden() *IssueDeleteCommentReactionForbidden {
|
||||||
|
return &IssueDeleteCommentReactionForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueDeleteCommentReactionForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
APIForbiddenError is a forbidden error response
|
||||||
|
*/
|
||||||
|
type IssueDeleteCommentReactionForbidden struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue delete comment reaction forbidden response has a 2xx status code
|
||||||
|
func (o *IssueDeleteCommentReactionForbidden) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue delete comment reaction forbidden response has a 3xx status code
|
||||||
|
func (o *IssueDeleteCommentReactionForbidden) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue delete comment reaction forbidden response has a 4xx status code
|
||||||
|
func (o *IssueDeleteCommentReactionForbidden) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue delete comment reaction forbidden response has a 5xx status code
|
||||||
|
func (o *IssueDeleteCommentReactionForbidden) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue delete comment reaction forbidden response a status code equal to that given
|
||||||
|
func (o *IssueDeleteCommentReactionForbidden) IsCode(code int) bool {
|
||||||
|
return code == 403
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue delete comment reaction forbidden response
|
||||||
|
func (o *IssueDeleteCommentReactionForbidden) Code() int {
|
||||||
|
return 403
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentReactionForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/comments/{id}/reactions][%d] issueDeleteCommentReactionForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentReactionForbidden) String() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/comments/{id}/reactions][%d] issueDeleteCommentReactionForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentReactionForbidden) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentReactionNotFound creates a IssueDeleteCommentReactionNotFound with default headers values
|
||||||
|
func NewIssueDeleteCommentReactionNotFound() *IssueDeleteCommentReactionNotFound {
|
||||||
|
return &IssueDeleteCommentReactionNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueDeleteCommentReactionNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
APINotFound is a not found empty response
|
||||||
|
*/
|
||||||
|
type IssueDeleteCommentReactionNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue delete comment reaction not found response has a 2xx status code
|
||||||
|
func (o *IssueDeleteCommentReactionNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue delete comment reaction not found response has a 3xx status code
|
||||||
|
func (o *IssueDeleteCommentReactionNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue delete comment reaction not found response has a 4xx status code
|
||||||
|
func (o *IssueDeleteCommentReactionNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue delete comment reaction not found response has a 5xx status code
|
||||||
|
func (o *IssueDeleteCommentReactionNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue delete comment reaction not found response a status code equal to that given
|
||||||
|
func (o *IssueDeleteCommentReactionNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue delete comment reaction not found response
|
||||||
|
func (o *IssueDeleteCommentReactionNotFound) Code() int {
|
||||||
|
return 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentReactionNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/comments/{id}/reactions][%d] issueDeleteCommentReactionNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentReactionNotFound) String() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/comments/{id}/reactions][%d] issueDeleteCommentReactionNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentReactionNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
@ -0,0 +1,228 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
package issue
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IssueDeleteCommentReader is a Reader for the IssueDeleteComment structure.
|
||||||
|
type IssueDeleteCommentReader struct {
|
||||||
|
formats strfmt.Registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadResponse reads a server response into the received o.
|
||||||
|
func (o *IssueDeleteCommentReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||||
|
switch response.Code() {
|
||||||
|
case 204:
|
||||||
|
result := NewIssueDeleteCommentNoContent()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
case 403:
|
||||||
|
result := NewIssueDeleteCommentForbidden()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
case 404:
|
||||||
|
result := NewIssueDeleteCommentNotFound()
|
||||||
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return nil, result
|
||||||
|
default:
|
||||||
|
return nil, runtime.NewAPIError("[DELETE /repos/{owner}/{repo}/issues/comments/{id}] issueDeleteComment", response, response.Code())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentNoContent creates a IssueDeleteCommentNoContent with default headers values
|
||||||
|
func NewIssueDeleteCommentNoContent() *IssueDeleteCommentNoContent {
|
||||||
|
return &IssueDeleteCommentNoContent{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueDeleteCommentNoContent describes a response with status code 204, with default header values.
|
||||||
|
|
||||||
|
APIEmpty is an empty response
|
||||||
|
*/
|
||||||
|
type IssueDeleteCommentNoContent struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue delete comment no content response has a 2xx status code
|
||||||
|
func (o *IssueDeleteCommentNoContent) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue delete comment no content response has a 3xx status code
|
||||||
|
func (o *IssueDeleteCommentNoContent) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue delete comment no content response has a 4xx status code
|
||||||
|
func (o *IssueDeleteCommentNoContent) IsClientError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue delete comment no content response has a 5xx status code
|
||||||
|
func (o *IssueDeleteCommentNoContent) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue delete comment no content response a status code equal to that given
|
||||||
|
func (o *IssueDeleteCommentNoContent) IsCode(code int) bool {
|
||||||
|
return code == 204
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue delete comment no content response
|
||||||
|
func (o *IssueDeleteCommentNoContent) Code() int {
|
||||||
|
return 204
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentNoContent) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/comments/{id}][%d] issueDeleteCommentNoContent", 204)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentNoContent) String() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/comments/{id}][%d] issueDeleteCommentNoContent", 204)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentForbidden creates a IssueDeleteCommentForbidden with default headers values
|
||||||
|
func NewIssueDeleteCommentForbidden() *IssueDeleteCommentForbidden {
|
||||||
|
return &IssueDeleteCommentForbidden{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueDeleteCommentForbidden describes a response with status code 403, with default header values.
|
||||||
|
|
||||||
|
APIForbiddenError is a forbidden error response
|
||||||
|
*/
|
||||||
|
type IssueDeleteCommentForbidden struct {
|
||||||
|
Message string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue delete comment forbidden response has a 2xx status code
|
||||||
|
func (o *IssueDeleteCommentForbidden) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue delete comment forbidden response has a 3xx status code
|
||||||
|
func (o *IssueDeleteCommentForbidden) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue delete comment forbidden response has a 4xx status code
|
||||||
|
func (o *IssueDeleteCommentForbidden) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue delete comment forbidden response has a 5xx status code
|
||||||
|
func (o *IssueDeleteCommentForbidden) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue delete comment forbidden response a status code equal to that given
|
||||||
|
func (o *IssueDeleteCommentForbidden) IsCode(code int) bool {
|
||||||
|
return code == 403
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue delete comment forbidden response
|
||||||
|
func (o *IssueDeleteCommentForbidden) Code() int {
|
||||||
|
return 403
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentForbidden) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/comments/{id}][%d] issueDeleteCommentForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentForbidden) String() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/comments/{id}][%d] issueDeleteCommentForbidden", 403)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentForbidden) 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewIssueDeleteCommentNotFound creates a IssueDeleteCommentNotFound with default headers values
|
||||||
|
func NewIssueDeleteCommentNotFound() *IssueDeleteCommentNotFound {
|
||||||
|
return &IssueDeleteCommentNotFound{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IssueDeleteCommentNotFound describes a response with status code 404, with default header values.
|
||||||
|
|
||||||
|
APINotFound is a not found empty response
|
||||||
|
*/
|
||||||
|
type IssueDeleteCommentNotFound struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuccess returns true when this issue delete comment not found response has a 2xx status code
|
||||||
|
func (o *IssueDeleteCommentNotFound) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRedirect returns true when this issue delete comment not found response has a 3xx status code
|
||||||
|
func (o *IssueDeleteCommentNotFound) IsRedirect() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsClientError returns true when this issue delete comment not found response has a 4xx status code
|
||||||
|
func (o *IssueDeleteCommentNotFound) IsClientError() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsServerError returns true when this issue delete comment not found response has a 5xx status code
|
||||||
|
func (o *IssueDeleteCommentNotFound) IsServerError() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsCode returns true when this issue delete comment not found response a status code equal to that given
|
||||||
|
func (o *IssueDeleteCommentNotFound) IsCode(code int) bool {
|
||||||
|
return code == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code gets the status code for the issue delete comment not found response
|
||||||
|
func (o *IssueDeleteCommentNotFound) Code() int {
|
||||||
|
return 404
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentNotFound) Error() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/comments/{id}][%d] issueDeleteCommentNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentNotFound) String() string {
|
||||||
|
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/comments/{id}][%d] issueDeleteCommentNotFound", 404)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *IssueDeleteCommentNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user