SHA256
1
0

285 Commits

Author SHA256 Message Date
c6aa9ea392 Can use values from model instead of our own 2026-01-31 12:49:52 +01:00
a97603b5a7 common: no longer need cast 2026-01-31 12:35:02 +01:00
ed63b37baa common: regenerate client code for Gitea 1.25.4 2026-01-31 12:29:01 +01:00
9b3d6e9a66 pr: Always allow maintainer edits in new packages 2026-01-31 10:38:03 +01:00
f47da62481 common: replace legacy logger with standard impl 2026-01-31 10:18:14 +01:00
79e5345ac6 test: refactor loggin in unit tests
Use test logger when running under a test.
2026-01-31 10:04:08 +01:00
4790ee3096 pr: small refactor 2026-01-30 16:44:11 +01:00
7d85c014d6 pr: test coverage 2026-01-30 16:44:11 +01:00
05aaf56cb7 pr: test coverage 2026-01-30 16:44:11 +01:00
74491cb9cf pr: small refactor 2026-01-30 16:44:11 +01:00
9775320411 pr: close associated PR if issue closed. 2026-01-30 16:44:11 +01:00
790540d6c5 common: test fixes after rebase 2026-01-30 16:44:11 +01:00
990f71677b pr: no need to create PR if already exists. 2026-01-30 16:44:11 +01:00
514725fb0b pr: Only update issues if they are actually open 2026-01-30 16:44:11 +01:00
ea69dcd19f pr: fix tests 2026-01-30 16:44:11 +01:00
055de8c9eb pr: use top 20 commits as base, if available 2026-01-30 16:44:11 +01:00
a13f57e464 common: add test for cloning hashes 2026-01-30 16:44:11 +01:00
b147fc7622 common: add test for directory listing 2026-01-30 16:44:11 +01:00
fc7fb4d49f pr: test updated issue ref
If issue is a SHA ref, and then it's updated, we need to make
sure that the branch is also updated.
2026-01-30 16:44:11 +01:00
40eeb25336 pr: move functions around 2026-01-30 16:44:11 +01:00
68a142046c pr: fix tests 2026-01-30 16:44:11 +01:00
240d79a4d6 pr: new package handling 2026-01-30 16:44:11 +01:00
21a8670674 pr: make sure new repos have fork/parent relationship
If new target repo is "reparented", it will have correct relationship
here. Otherwise PR creation will fail
2026-01-30 16:44:11 +01:00
d2e9abde6e common: more unit tests fixes
TZ needs to be defined, otherwise it was assumed to be local which
then resulted in unpredictable commit hashes. We define it to UTC
for unit tests

PR have state "open" not "opened"
2026-01-30 16:44:11 +01:00
a4f677690a pr: fix more unit tests 2026-01-30 16:44:10 +01:00
70460813f5 pr: merge new package 2026-01-30 16:44:10 +01:00
0651fe01d4 pr: implement first part of issue processing 2026-01-30 16:44:10 +01:00
e03fd0bdcf wip: process issues 2026-01-30 16:44:10 +01:00
c6ee055cb4 pr: add unit test for PrjGit PR to make sure we clone it
This is unit test for previous commit
2026-01-30 16:23:25 +01:00
58e5547a91 pr: fix case where PrjGit not cloned
When the PRSet is of size 1, so only PrjGit, the project git
may not be cloned. This breaks build preperations, etc.
2026-01-30 16:02:13 +01:00
c2709e1894 fix unit tests and mocks 2026-01-28 10:50:36 +01:00
7790e5f301 Merge branch 'main' into always-review-nt 2026-01-27 15:45:12 +01:00
2620aa3ddd Merge branch 'always-review' 2026-01-27 15:44:30 +01:00
59a47cd542 Merge branch 'pr-tests' 2026-01-27 13:41:34 +01:00
a0c51657d4 pr: reset timeline cache when fetching PRSet 2026-01-26 15:34:46 +01:00
edd8c67fc9 obs-staging-bot: allow build-disabling repositories in the QA projects
Using the BuildDisableRepos configuration, it is now possible to
define which repositories to build-disable in the QA project meta.

This is for example useful for the SLES development workflow, where
the product repository should only be enabled after the packagelist
definitions have been built - so it is not desirable to have them
built as soon as the QA project is created.

Example:

    {
      "ObsProject": "SUSE:SLFO:Main",
      "StagingProject": "SUSE:SLFO:Main:PullRequest",
      "QA": [
        {
          "Name": "SLES",
          "Origin": "SUSE:SLFO:Products:SLES:16.1",
          "BuildDisableRepos": ["product"]
        }
      ]
    }

Signed-off-by: Eugenio Paolantonio <eugenio.paolantonio@suse.com>
2026-01-21 19:05:48 +01:00
877e93c9bf pr: always require review, if configured
Implement ReviewRequired option to workflow.config. This will
always require a review by maintainer, unless no other maintainers
are available.

By default, ReviewRequired is false
2026-01-20 19:18:56 +01:00
51403713be pr: always require review, if configured
Implement ReviewRequired option to workflow.config. This will
always require a review by maintainer, unless no other maintainers
are available.

By default, AlwaysRequireReview is false
2026-01-20 19:17:10 +01:00
cc69a9348c Merge commit 'refs/pull/109/head' of src.opensuse.org:git-workflow/autogits 2026-01-20 18:39:23 +01:00
5b5bb9a5bc group-review: fix test name 2026-01-19 13:41:05 +01:00
Antonello Tartamo
2f39fc9836 initial documentation review 2026-01-14 15:43:27 +01:00
f959684540 pr: interfaces moved to main package 2026-01-10 00:57:22 +01:00
18f7ed658a pr: move interfaces and mocks to parent package 2026-01-10 00:40:45 +01:00
c05fa236d1 pr: Add additional unit tests
- Add a test case specifically verifying that `Gitea.SetLabels`
  is called with `staging/Auto` when a *new* project PR is created
  for submodules.
- Verify `PrjGitDescription` and `SetSubmodulesToMatchPRSet` behave
  correctly when a single `PRSet` contains 5+ different package
  repositories.
2026-01-09 18:56:33 +01:00
c866303696 pr: fix PR lists to check packages not just project PRs
Also,
- Add simple unit tests to verify mapping of `models.StateType`
  to internal event strings.
- Verify it correctly wraps `ProcesPullRequest` and handles panics
  via the deferred recovery block.
- Add tests for scenarios where `GetRecentPullRequests` fails.
- Verify the random sleep interval logic (can be tested by mocking
  `time.Sleep` if refactored, or verifying behavior with interval=0).
2026-01-09 17:48:01 +01:00
e806d6ad0d pr: revive PRProcessor sync tests
- Uncomment and fix the existing tests for `synchronized` actions.
- Ensure it uses the new `PullRequestProcessor` interface and mocked dependencies.
2026-01-09 17:12:14 +01:00
abf8aa58fc pr: test PRProcessor that is triggered by webhook
- PullRequestWebhookEvent: Verified that PR events correctly
  trigger processing with all necessary Gitea and Git mocks.
- IssueCommentWebhookEvent: Verified that issue comment events
  (which Gitea often uses for PR comments) are handled correctly.
- Recursion Limit: Verified that the recursion protection logic
  correctly terminates and cleans up when the limit is reached.
- Invalid Data Format: Verified that non-event data types return
  appropriate errors.
2026-01-09 16:59:29 +01:00
4f132ec154 pr: test verifyRepositoryConfiguration 2026-01-09 16:41:25 +01:00
86a7fd072e pr: add test cases for PRProcessor corner cases
- Add scenarios for closed/merged project PRs that trigger
   submodule checks and downstream PR updates (manual merge vs close).
- Test the "Consistency check" logic where submodules are reset
  if they don't match the PR set.
- Test the "superfluous PR" check (no-op PRs that should be closed).
2026-01-09 16:34:07 +01:00
5f5e7d98b5 pr: add some tests for UpdatePrjGitPR 2026-01-09 13:59:02 +01:00
e8738c9585 pr: add tests for RebaseAndSkipSubmoduleCommits 2026-01-09 13:44:53 +01:00
2f18adaa67 pr: move common test helpers to dedicated area 2026-01-09 12:57:42 +01:00
b7f5c97de1 pr: add error handling unit tests 2026-01-08 22:21:33 +01:00
09001ce01b pr: repo_check unit tests 2026-01-08 21:02:18 +01:00
37c9cc7a57 add PRProcessor tests 2026-01-08 20:57:18 +01:00
362e481a09 pr: fix unit tests 2026-01-08 17:54:00 +01:00
38f4c44fd0 group-review: add more unit tests 2026-01-07 11:56:04 +01:00
605d3dee06 group-review: add notification unit tests 2026-01-07 11:32:04 +01:00
6f26bcdccc group-review: add mocked unit test 2026-01-07 10:42:39 +01:00
fffdf4fad3 group-review: add additional unit tests 2026-01-07 10:29:54 +01:00
f6d2239f4d group-review: move globals to struct
This enables easier testing
2026-01-07 10:27:12 +01:00
913fb7c046 group-review: add systemd file 2026-01-05 17:07:27 +01:00
79318dc169 group-review: add env variables
instead of using command-line parameters, we can use env variables
Very helpful for services.
2026-01-05 16:53:30 +01:00
377ed1c37f group-review: set correct comment text on negative review 2026-01-05 14:13:53 +01:00
51b0487b29 pr: parse ADD issue body
Validation of repository and org and other names is for the
consumer of this call. Maybe this can change later.
2025-12-16 18:33:22 +01:00
49e32c0ab1 PR: actually subscribe to PRComments
In previous fix attempt, there were changes to process IssueComments
but PRComments are their instance of IssueComments distinct from
IssueComments webhook events

Fixes: a418b48809
2025-12-12 16:41:25 +01:00
01e4f5f59e pr: fix error reporting for timeline PrjGit parse 2025-12-11 18:45:56 +01:00
19d9fc5f1e pr: request staging only when staging.config is there
If the project git does not have a staging.config, then there is
no reason to request reviews by the staging bot.
2025-12-11 17:01:15 +01:00
c4e184140a pr: handle case when reviews is nil 2025-12-09 17:19:38 +01:00
56c492ccdf PR: do not remove maintainer if also a reviewer
Maintainer review is only required if the PR is created by non-maintainer
or ProjetGit PR is created by non-bot. If maintainer review is not required,
but the maintainer is also listed as a Reviewer, then we cannot remove
this review request from the PR.
2025-12-08 18:03:00 +01:00
3a6009a5a3 pr: review requests cannot be stale
Yes, gitea marks these as stale too, but we should just ignore this
flag in case of requests. Stale requests are still pending.
2025-12-05 10:15:02 +01:00
2c4d25a5eb pr: remove maintainers if submitter is maintainer
If we have case where reviews are already there, for whatever reason
(eg. upgrade from older bot), remove the pending reviews if they
are not needed
2025-12-05 09:36:38 +01:00
052ab37412 common: Loading pending reviews when loading reviews 2025-12-04 19:02:21 +01:00
925f546272 pr: check all reviews, not just ones tagged reviewers 2025-12-04 18:21:32 +01:00
71fd32a707 pr: fix debug statements 2025-12-04 18:04:51 +01:00
581131bdc8 pr: request and unrequest reviewers
Move the function to request and unrequest reviewers to a different
function. This will allow later simplification of the function
that determines if all reviews are complete.

Unrequesting of reviews is only possible in case of bot issued
review requests. The rest are left as-is.
2025-12-03 18:55:10 +01:00
495ed349ea common: refactor: FetchPRSet also fetches Reviews 2025-12-03 18:55:10 +01:00
350a255d6e pr: allow to fetch reviews in PRSet loader 2025-12-03 18:55:10 +01:00
e3087e46c2 PR: skip maintainer review if not needed
If project or package maintainer already reviewed the PR, as
appropriate, they are no longer re-added to the PR. We also need
to remove reviewers, but only if they were previously requested
by the bot and not something else.
2025-12-03 18:55:10 +01:00
ae6b638df6 pr: handle case of … and ... elided title
Also do not change title of PR if not created by bot
2025-12-03 12:41:50 +01:00
2c73cc683a status: placeholder for factory sample data tests 2025-11-28 18:45:24 +01:00
32adfb1111 doc: fix table 2025-11-28 17:46:49 +01:00
fe8fcbae96 status: add test data 2025-11-28 17:22:12 +01:00
5756f7ceea pr: only update PR if elided title not changed
Gitea trims long titles so we need to compare if the trimmed length
is same, not entire string that will always differ.
2025-11-28 12:25:58 +01:00
2be0f808d2 pr: make sure issue list is consistent 2025-11-28 12:08:54 +01:00
7a0f651eaf direct: Gitea can send messages with no default branch
When a repository is created, there appears to be a race condition
where the default branch is not yet set in the message webhook
event.

We should additionally take care if the submodule is "registered"
but it wasn't correctly added, mostly due to earlier error. So,
always deinit submodules
2025-11-25 10:32:59 +01:00
2e47104b17 direct: improve commit messages in auto-updates 2025-11-24 12:58:46 +01:00
76bfa612c5 direct: use local branch name, instead of remote
If we fetch only one commit and force fetch the branch to local,
it seems that the remote head ref is not actually set. So, we should
just use the local version anyway, as it's updated.
2025-11-24 11:38:54 +01:00
71aa0813ad devel: sync migrated project list 2025-11-20 20:30:38 +01:00
cc675c1b24 devel: ignore dot files
magic hash is when no files exist and echo "" is passed to md5sum
2025-11-20 19:57:35 +01:00
44e4941120 devel: handle build.specials.obscpio 2025-11-20 19:40:49 +01:00
86acfa6871 pr: set staging auto label according to config
falls back to staging/Auto if nothing is set
2025-11-20 16:25:06 +01:00
7f09b2d2d3 common: match project config before packages
We need to cycle through all project configs before we try to
match non-project config branches/packages. If we have multiple
project gits in one org, this coudl match wrong config
2025-11-20 13:22:40 +01:00
f3a37f1158 pr: case fold 2025-11-19 19:32:55 +01:00
9d6db86318 pr: log case of no config in verification check 2025-11-19 17:10:08 +01:00
e11993c81f pr: do not stop processing if failed on some pacakge during check 2025-11-19 16:36:48 +01:00
4bd259a2a0 pr: ignore pkg PR if not open and no PrjGit PR 2025-11-19 16:35:17 +01:00
162ae11cdd common: init the cache so not null 2025-11-19 15:29:52 +01:00
8431b47322 group-review: allow dots in org and package names 2025-11-19 10:00:39 +01:00
3ed5ecc3f0 pr: add staging/Auto on new PRs
also, cache timeline fetches
2025-11-17 11:01:45 +01:00
d08ab3efd6 direct: support reverts 2025-11-13 23:52:05 +01:00
a4f6628e52 direct: always deinit, even if dirty 2025-11-13 23:51:18 +01:00
25073dd619 direct: use correct remote name for submodules
should be "origin"
2025-11-13 22:15:00 +01:00
4293181b4e pr: improve logging of review errors
when user is missing, log only the missing user
2025-11-12 21:39:26 +01:00
551a4ef577 direct: use origin for submodule checkout 2025-11-10 11:03:54 +01:00
6afb18fc58 direct: use correct repo for default branch 2025-11-10 10:24:33 +01:00
f310220261 direct: log default branch 2025-11-10 10:11:11 +01:00
ef7c0c1cea direct: fix debug logging 2025-11-10 09:42:43 +01:00
27230fa03b direct: fix debug logging 2025-11-10 09:34:10 +01:00
c52d40b760 direct: explicit path for config bind 2025-11-09 23:26:04 +01:00
d3ba579a8b common: fix systemd execution
In case when we are running under older systemd that does not set
transient home, we need to improvise when connecting via SSH
and passing the identity file explicitly
2025-11-09 23:10:08 +01:00
9ef8209622 direct: bind config to working directory
Use temp /run instance directory for the config
Use ./config.json as default from within the process
2025-11-07 17:06:27 +01:00
ba66dd868e direct: fix running bot without any config params
Only use env variables.
2025-11-07 16:19:13 +01:00
17755fa2b5 status: fix repo links for monitor page 2025-11-07 13:59:52 +01:00
f94d3a8942 status: update README 2025-11-05 16:56:30 +01:00
20e1109602 spec: packaging fixes
* Update Version to 1, since we now have devel project and updates
should have version bump instead of downgrade
* other fixes
2025-11-05 16:38:15 +01:00
c25d3be44e direct: add systemd unit file 2025-11-05 13:24:54 +01:00
8db558891a direct: remove config.Branch clobbering
use our own copy of branch instead of writing it in the config.
This should fix handling of default branches where the default
branch differs between repositories.
2025-11-04 18:00:21 +01:00
0e06ba5993 common: classifying rm branches on name
Branches with suffixes

  -rm
  -removed
  -deleted

are now classified as removed. This is important in case project
config refers to default branch names which must exist so we need
to be able to classify such branches to either use them or ignore
them
2025-11-04 18:00:21 +01:00
736769d630 direct: add a repo with branch but no submodule 2025-11-04 18:00:21 +01:00
93c970d0dd direct: move logging to common.Log* function 2025-11-04 18:00:21 +01:00
5544a65947 obs-staging-bot: Expand possible branch of QA repos
That way a source merge of any product is not triggering rebuilds in
pull request QA sub projects. We may need a config option here to
enable/disable this.
2025-11-03 17:54:57 +01:00
918723d57b Merge commit '55846562c1d9dcb395e545f7c8e0bcb74c47b85693f4e955ef488530781b9bf2'
PR!88
2025-11-03 17:49:45 +01:00
a418b48809 pr: process PR on comments, not issue changes 2025-10-31 13:07:18 +01:00
55846562c1 Add simple readme for gitea_status_proxy 2025-10-31 10:33:58 +01:00
95c7770cad Change log level for auth errors 2025-10-31 10:33:58 +01:00
1b900e3202 Properly proxy json input directly to gitea 2025-10-31 10:33:51 +01:00
d083acfd1c Be more verbose about authentication errors 2025-10-30 13:09:17 +01:00
244160e20e Update authorization headers
For gitea API AuthorizationHeaderToken tokens must be prepended with "token" followed by a space, also fix content type
2025-10-30 13:09:17 +01:00
ed2847a2c6 README: devel-project follows main
And use home:adamm:autogits/autogits for building staging branch, if any
2025-10-28 12:54:22 +01:00
1457caa64b Merge branch 'main' of src.opensuse.org:git-workflow/autogits 2025-10-28 12:51:12 +01:00
b9a38c1724 Update README.md 2025-10-28 12:09:10 +01:00
74edad5d3e devel: fix pool setting script 2025-10-28 11:32:51 +01:00
Jan Zerebecki
e5cad365ee Run go tests from rpm check
Skip some failing tests to be able to run the rest.
Add missing config to make git commit succeed inside rpmbuild.
2025-10-27 14:42:21 +01:00
Jan Zerebecki
53851ba10f Add ci jobs for go vendor 2025-10-24 11:45:41 +02:00
Jan Zerebecki
056e5208c8 Add ci jobs for go generate
either to check it produces no diff, or to manually trigger pushing any
diff as a commmit to the current branch.
2025-10-24 11:45:38 +02:00
Jan Zerebecki
af142fdb15 Prefix packages and build rest
Add some dependencies from Containerfiles, so containers can be built
from the rpm and implicitly pull those in.
Build some binaries that where added since and add sub-package for them.
2025-10-24 11:22:52 +02:00
Jan Zerebecki
5ce92beb52 Add go generate result 2025-10-24 10:39:34 +02:00
Gitea Actions
ae379ec408 CI run result of: go mod vendor 2025-10-24 10:39:31 +02:00
458837b007 status: complete the fix for insufficient Clone()
Ammends: 58d1f2de91
2025-10-15 18:46:46 +02:00
a3feab6f7e status: use obs+xml mime header instead of xml
browsers request application/xml on their Accept: headers by default,
which causes status to return XML to them instead of falling back
to SVG
2025-10-15 18:42:52 +02:00
fa647ab2d8 status: do not marshall empty XMLName in json 2025-10-15 18:24:52 +02:00
19902813b5 status: fix xml output 2025-10-15 18:09:21 +02:00
23a7f310c5 status: Add application/xml support in output 2025-10-15 16:59:52 +02:00
58d1f2de91 status: make a copy before overwriting 2025-10-14 19:37:36 +02:00
d623844411 pr: do not fail checkout 2025-10-13 18:37:42 +02:00
04825b552e pr: use force-merge instead of force-push
The permission is to accept a change without required reviews, not
to actually force-push

Fixes 7bad8eb5a9
2025-10-12 10:22:49 +02:00
ca7966f3e0 pr: sanity check
make sure that the checked out PR matches what Gitea is sending
us, otherwise pause for a few seconds and retry.
2025-10-11 18:10:15 +02:00
0c47ca4d32 pr: updating PR needs to update the SHA
If we are updating a Project Git PR, we need to save the updated
hash or we may be lookign at pre-update PR for various operations,
including merging.

This mostly only affects project gits in devel projects where
the project git could be updated by direct workflow bot, but then
the project is incorrectly resulting in no package update.
2025-10-11 17:25:48 +02:00
7bad8eb5a9 pr: Add config definitions for permission set 2025-10-09 18:43:56 +02:00
c2c60b77e5 use autogits package prefix 2025-10-08 13:03:06 +02:00
76b5a5dc0d import: factory hash setting utility 2025-10-07 22:55:58 +02:00
58da491049 common: handle translation to SSH if already SSH 2025-10-07 17:26:27 +02:00
626bead304 status: improve request logging 2025-10-06 14:07:35 +02:00
30bac996f4 status: redundant entry in service file 2025-10-06 14:03:38 +02:00
9adc718b6f spec: hujson moved to utils subpackage 2025-10-06 13:52:39 +02:00
070f45bc25 status: add no lock function
Locking is not re-entrant, so these are useful if we need
to find things while we already lock the strctures
2025-10-06 13:49:19 +02:00
d061f29699 status: use env as parameters to service
Instead of having to rewrite the service file with parameters,
leverage Env file to pass default parameters values.
2025-10-06 13:49:12 +02:00
f6fd96881d staging: improve docs 2025-10-02 17:40:00 +02:00
2be785676a reparent: add readme 2025-10-02 17:05:34 +02:00
1b9ee2d46a PR: ref requries PR fetch, and not in timeline 2025-10-02 15:13:43 +02:00
b7bbafacf8 PR: limit search to bot account for ProjectGit PRs 2025-10-02 13:45:31 +02:00
240896f101 status: fix delete function logic 2025-10-01 19:35:43 +02:00
a7b326fceb status: limit results to specific packages 2025-10-01 19:28:47 +02:00
76ed03f86f status: add json output support
if Accept: application/json is present, return JSON output
of build results instead of SVG
2025-10-01 18:58:08 +02:00
1af2f53755 PR: Fix case where PR repo != target repo
Was using a check that the label has the repo name in it, but
this is not always reliable. So, check repo.ID if it's the same.
2025-10-01 15:33:39 +02:00
0de9071f92 group-review: we need to clone before modifying a slice 2025-09-30 17:27:36 +02:00
855faea659 imported devel:openSUSE:Factory 2025-09-29 15:10:25 +02:00
dbd581ffef import: packages are not just in factory
Some packages share names of openSUSE:Factory packages but actually
have nothing in common with them. So before importing the Factory
package, check if the package is actually a devel project for Factory
and only proceed if it is. Otherwise, assume that the devel
project package is independent.
2025-09-29 15:08:30 +02:00
1390225614 PR: list missing PRs in the logs 2025-09-29 14:58:43 +02:00
a03491f75c Keep maintainers from staging template project
They need to keep access as they might need to be able to modify the
stage project. They could grant access anyway, by adding themselfs
as they own the upper project. No reason to force them the
extra trip or to hide build results first to them
2025-09-24 10:39:07 +02:00
2092fc4f42 Fix handling of all project flags
We skipped access and sourceaccess flags before
2025-09-24 09:33:29 +02:00
d2973f4792 PR: only consider open PR when creating new PRs 2025-09-21 23:21:40 +02:00
58022c6edc update transition project list 2025-09-21 20:21:15 +02:00
994e6b3ca2 status: fix typo regression 2025-09-18 19:18:03 +02:00
6414336ee6 status: add basic project level build results 2025-09-18 19:05:35 +02:00
1104581eb6 status: superflous Sprintf 2025-09-18 16:50:59 +02:00
6ad110e5d3 status: escape strings 2025-09-18 16:30:34 +02:00
e39ce302b8 status: fix README 2025-09-18 13:07:08 +02:00
3f216dc275 docs: improve README 2025-09-16 22:30:18 +02:00
8af7e58534 common: handle group data in PR reviews 2025-09-16 18:13:35 +02:00
043673d9ac common: handle ReviewGroup in maintainership data
ReviewGroups can be added as maintainers and can be optionally
expanded. This is handy when a ReviewGroup is a project maintainer
2025-09-16 17:40:18 +02:00
73737be16a rabbitmq: add support for forwarding status events to Rabbit 2025-09-16 13:23:43 +02:00
1d3ed81ac5 staging: use https cloning always
We can just pass the token, so SSH option for cloning is obsolete
2025-09-16 10:11:28 +02:00
49c4784e70 staging: handle case of no staging config 2025-09-15 17:58:21 +02:00
be15c86973 staging: use correct gitea token 2025-09-15 17:44:52 +02:00
72857db561 staging: add gitea token as user for cloning
For private repos, we need to identify ourselves to Gitea
2025-09-15 17:28:38 +02:00
faf53aaae2 move staging-bot env file to /etc/default 2025-09-15 14:00:56 +02:00
9e058101f0 Merge commit '4ae45d9913dcd473fc931c27dcc5dee93c70723121bf6f77c256c7dd196ea768' of src.opensuse.org:adamm/autogits 2025-09-15 13:54:46 +02:00
Elisei Roca
4ae45d9913 Look for configuration file in /etc/default
Files in /etc/sysconfig/ should have all the sysconfig headers an so on.
2025-09-15 13:24:18 +02:00
56cf8293ed staging: clone via target repo only 2025-09-15 12:30:08 +02:00
fd5b3598bf Don't crash when new packages got added
The build result request of the base project is failing in this
situation, since the requested package does not exist.

Therefore we need to have seperate lists for proper handling.
2025-09-13 15:47:50 +02:00
9dd5a57b81 staging: fix no config case 2025-09-11 17:22:02 +02:00
1cd385e227 common: handle case of non-existing config file 2025-09-11 16:56:03 +02:00
3c20eb567b staging: allow wider character set in pr regex 2025-09-11 16:09:42 +02:00
ff7df44d37 staging: assume changed directories are packages
Ignore any non-top level direcotries here. This should be fixed
to handle _manifest files
2025-09-11 14:56:27 +02:00
1a19873f77 Merge remote-tracking branch 'gitea/main' 2025-09-11 09:35:05 +02:00
6a09bf021e Revert "common: use X-Total-Count in multi-page results"
This reverts commit 5addde0a71.
2025-09-11 09:34:13 +02:00
f2089f99fc staging: use helper function to SetCommitStatus 2025-09-09 12:55:14 +02:00
10ea3a8f8f obs-staging-bot: Fix setting of commit status 2025-09-09 12:46:43 +02:00
9faa6ead49 Log errors on SetCommitStatus 2025-09-09 12:46:21 +02:00
29cce5741a staging: typo fix 2025-09-09 12:46:11 +02:00
804e542c3f Decline too large staging projects
In most cases anyway an error in pull request.
2025-09-09 12:41:07 +02:00
72899162b0 status: need to fetch repositories during sync
We need to fetch repositories so that we can have package
data. We only need to fetch one set of results per project,
not all repos.
2025-09-03 16:42:01 +02:00
168a419bbe status: allow for package search endpoint
OBS has issues searching for packages in scmsynced projects.
Since we have a list of all the repositories, we can allow
for a search endpoint here.

/search?q=term1&q=term2...

results is JSON

[
   project1/pkgA,
   project2/pkgB
]
2025-09-03 14:35:15 +02:00
6a71641295 common: take care of empty result sets
In case of empty result pages, we should ignore the X-Total-Count
header.

Fixes: 5addde0a71
2025-09-03 12:21:07 +02:00
5addde0a71 common: use X-Total-Count in multi-page results 2025-09-03 01:00:33 +02:00
90ea1c9463 common: remove duplicate 2025-09-02 20:50:23 +02:00
a4fb3e6151 PR: Don't clobber other's PrjGit description
If we did not create the PRjGit PR, don't touch the title
and description

Closes: #68
2025-09-02 19:47:47 +02:00
e2abbfcc63 staging: improve cleanup logging 2025-09-01 12:49:55 +02:00
f6cb35acca spec: add obs-staging-bot.service 2025-09-01 12:29:29 +02:00
f4386c3d12 Try to use Staging Master Project as default build target if available
This allows us to set custom build configuration or repository sets for
pull request projects.
2025-09-01 11:52:30 +02:00
f8594af8c6 obs-status: report error on monitor page if error
If we have error with REDIS connection, report it as error 500
on the / default page. Otherwise, report the 404 there instead
as before.
2025-09-01 11:20:54 +02:00
b8ef69a5a7 group-review: react on comment events
Instead of just polling for events, we can use issue_comment events
to process PRs more quickly.

At same time increased default polling interval to 10 minutes if
we use events

Closes #67
2025-08-30 10:41:29 +02:00
c980b9f84d group-review: improve comment made by the bot
Bot name should be expanded for easy copy-pasta
2025-08-29 18:19:03 +02:00
4651440457 Revert "Fixing creation or PR even when we don't want it"
This reverts commit e90ba95869.

We need to assign reviews anyway...
2025-08-29 17:09:08 +02:00
7d58882ed8 Accept review (instead of removal) on no submodule change
Because we require approval by staging bot in the workflow bot.
2025-08-29 15:08:05 +02:00
e90ba95869 Fixing creation or PR even when we don't want it 2025-08-29 15:08:05 +02:00
1015e79026 PR: don't try to update PR if PrjGit only being updated 2025-08-29 14:36:20 +02:00
833cb8b430 PR: marshall config before logging it 2025-08-28 18:13:11 +02:00
a882ae283f PR: workaround lfs errors
in case where files are not in lfs but should be, the checkout
causes files to be modified. Then the checkout of the PR.Head fails.
There should be better way of dealing with this
2025-08-28 16:30:04 +02:00
305e90b254 common: fix logging format string 2025-08-28 13:09:32 +02:00
c80683182d group-review: handle case when not yet reviewed 2025-08-28 10:16:49 +02:00
51cd4da97b group-review: use suggested wording
Closes: #50
2025-08-27 19:27:59 +02:00
cf71fe49d6 group-review: don't spam reviews if already there
Check if review is already in the timeline and don't spam it again

Closes: #51
2025-08-27 19:16:51 +02:00
85a9a81804 Add HuJSON helper 2025-08-27 17:04:48 +02:00
72b979b587 PR: remove closed package PRs from a PRset
This used to happen as a side-effect of a different code path
that was removed in b96b784b38
2025-08-27 14:57:43 +02:00
bb4350519b common: fix invalid log message
Log message complained about request processing even when
it finished request processing.
2025-08-27 14:54:32 +02:00
62658e23a7 PR: quiet submodule deinit output 2025-08-27 14:49:16 +02:00
6a1f92af12 tests: comment out tests that crash 2025-08-27 11:49:26 +02:00
24ed21ce7d tests: fix panics 2025-08-26 23:51:14 +02:00
46a187a60e pr: error format fix 2025-08-26 23:50:48 +02:00
e0c7ea44ea tests: make sure to vendor all the modules 2025-08-26 22:54:54 +02:00
f013180c4b PR: assign reviewers only when not merging 2025-08-26 22:41:37 +02:00
b96b784b38 PR: remove broken code 2025-08-26 19:57:48 +02:00
6864e95404 PR: merge correct branches
Add sanity check that we merge correct branches too
2025-08-26 19:43:51 +02:00
0ba4652595 common: use older git --heads instead of --branches 2025-08-26 19:17:32 +02:00
8d0047649a PR: if we have unpushed commits, update PRset
PRset is used elsewhere and if the pending, unpushed commits
are not part of it, we have an old state
2025-08-26 18:59:38 +02:00
2f180c264e PR: check pending changes, pushed changes 2025-08-26 18:16:42 +02:00
7b87c4fd73 PR: fix parsing of project prs in timeline
Fixes: 933ca9a3db
2025-08-26 17:56:38 +02:00
7d2233dd4a PR: add NoProjectGitPR option 2025-08-26 16:19:56 +02:00
c30ae5750b PR: clone fixes 2025-08-26 15:47:58 +02:00
ea2134c6e9 PR: checkout a commit, for safety - we can't push to non-branch 2025-08-26 13:51:09 +02:00
b22f418595 PR: process with ProjectGit originating from non-local 2025-08-26 13:37:11 +02:00
c4c9a16e7f PR: fix PR parsing with ! 2025-08-26 12:50:21 +02:00
5b1e6941c2 PR: typo in command line 2025-08-26 11:39:52 +02:00
923bcd89db common: timeline items can be null? 2025-08-26 11:36:51 +02:00
e96f4d343b PR: catch panic in PR processing 2025-08-26 11:36:28 +02:00
bcb63fe1e9 Add build status to README 2025-08-25 19:58:37 +02:00
f4e78e53d3 spec: install workflow bots and remove importer
importer is one-off kidn of a program and can't really be run
by itself. It requires git-importer + database + ability to register
to git-obs-bridge which is internal only
2025-08-25 19:54:03 +02:00
082db173f3 vendor: move vendored sources in-tree
This should make it easier to see changes instead of just a blob
2025-08-25 19:48:19 +02:00
7e055c3169 Merge branch 'jzerebecki-fix-pr-link' 2025-08-25 19:12:59 +02:00
7e59e527d8 PR: fix type errors 2025-08-25 18:18:00 +02:00
518845b3d8 importer: dedup maintainer and expand groups 2025-08-25 17:40:38 +02:00
b091e0e98d common: panic if the config is unresoveable
either branch for project config must be defined in the config, OR
it can be fetched as default branch from Gitea. If neither happens,
it's best not to do any guessing here
2025-08-25 17:04:43 +02:00
cedb7c0e76 Add Container files 2025-08-25 13:53:09 +02:00
7209f9f519 update READMEs for workflow bots 2025-08-25 11:32:51 +02:00
bd5482d54e status: use toplevel window for opening links 2025-08-24 19:36:40 +02:00
bc95d50378 [group-review]: Add config options 2025-08-23 13:04:58 +02:00
fff996b497 [group-review]: submitter member of group
submitter cannot be reviewer. Added to the help message

Closes: #59
2025-08-22 17:50:30 +02:00
2b67e6d80e group-review: Add Silent option
Closes: #60
2025-08-22 17:39:29 +02:00
5a875c19a0 PR: handle issues webhooks
These issues have to be associated with a PR. Otherwise processing
is ignored. We need these to handle comments to bot
2025-08-22 16:28:43 +02:00
538698373a common: API can fail... 2025-08-22 15:30:09 +02:00
84b8ca65ce staging: adapt to updated result types 2025-08-22 15:03:02 +02:00
a02358e641 PR: proces PRs on comments too, like "merge ok" 2025-08-22 14:59:24 +02:00
33c9bffc2e Merge messages and handle gitea manual merge race 2025-08-22 13:55:04 +02:00
4894c0d90a mark manual merge instead of relying on Gitea -- delays? 2025-08-22 09:07:34 +02:00
090c291f8a prjgit manual merge check 2025-08-21 17:39:52 +02:00
42cedb6267 Verify that pool is sha256 2025-08-21 17:38:51 +02:00
f7229dfaf9 Merge branch 'main' of src.opensuse.org:adamm/autogits 2025-08-19 17:30:16 +02:00
Jan Zerebecki
933ca9a3db Fix PR link
to use ! instead of # . The later is for issues and only works due to
a redirect, which currently fails in gitea if a repo has its issue
tracker disabled.
2025-08-19 16:27:39 +02:00
390cb89702 import: import SHA1 -> SHA256 repos
Also, always import all files to LFS when exported from scmsync
archives, as more often than not they are forgotten
2025-08-17 19:51:01 +02:00
6cbeaef6f2 import: import SHA1 -> SHA256 repos
Also, always import all files to LFS when exported from scmsync
archives, as more often than not they are forgotten
2025-08-17 19:43:45 +02:00
d146fb8c4e common: add last-updated obs status field 2025-08-13 17:05:47 +02:00
7e78ee83c1 common: fix detection of branches 2025-08-13 17:04:48 +02:00
17e925bfd7 importer: follow scmsync'ed repos HEAD 2025-08-13 16:45:47 +02:00
878df15e58 Merge branch 'main' of src.opensuse.org:adamm/autogits 2025-08-13 12:48:35 +02:00
c84af6286d Fix crash on connection
Setting channel object in Rabbit listener object.
2025-08-12 11:29:25 +02:00
d2cbb8fd34 importer: rework according to updated git-importer 2025-08-12 10:38:50 +02:00
8436a49c5d br: build results as svg for packages 2025-08-05 16:08:52 +02:00
106e36d6bf importer: use -packages instead of -package
Improve docs to allow multiple packages specified and how
2025-07-29 13:19:39 +02:00
0ec4986163 importer: continue processing repos ...
continue vs. break issue
2025-07-29 13:16:43 +02:00
fb7f6adc98 importer: allow multiple packages in the -package param 2025-07-28 20:07:07 +02:00
231f29b065 Merge remote-tracking branch 'gitea/main' 2025-07-28 14:04:31 +02:00
3f3645a453 importer: remove branches when exist
Don't generate errors on imports that we ignore. Problem is this
slows donw the import
2025-07-28 14:03:20 +02:00
1102 changed files with 199236 additions and 3687 deletions

View File

@@ -0,0 +1,33 @@
name: go-generate-check
on:
push:
branches: ['main']
paths:
- '**.go'
- '**.mod'
- '**.sum'
pull_request:
paths:
- '**.go'
- '**.mod'
- '**.sum'
workflow_dispatch:
jobs:
go-generate-check:
name: go-generate-check
container:
image: registry.opensuse.org/devel/factory/git-workflow/containers/opensuse/bci/golang-extended:latest
steps:
- run: git clone --no-checkout --depth 1 ${{ gitea.server_url }}/${{ gitea.repository }} .
- run: git fetch origin ${{ gitea.ref }}
- run: git checkout FETCH_HEAD
- run: go generate -C common
- run: go generate -C workflow-pr
- run: git add -N .; git diff
- run: |
status=$(git status --short)
if [[ -n "$status" ]]; then
echo -e "$status"
echo "Please commit the differences from running: go generate"
false
fi

View File

@@ -0,0 +1,24 @@
name: go-generate-push
on:
workflow_dispatch:
jobs:
go-generate-push:
name: go-generate-push
container:
image: registry.opensuse.org/devel/factory/git-workflow/containers/opensuse/bci/golang-extended:latest
steps:
- run: git clone --no-checkout --depth 1 ${{ gitea.server_url }}/${{ gitea.repository }} .
- run: git fetch origin ${{ gitea.ref }}
- run: git checkout FETCH_HEAD
- run: go generate -C common
- run: go generate -C workflow-pr
- run: |
host=${{ gitea.server_url }}
host=${host#https://}
echo $host
git remote set-url origin "https://x-access-token:${{ secrets.GITEA_TOKEN }}@$host/${{ gitea.repository }}"
git config user.name "Gitea Actions"
git config user.email "gitea_noreply@opensuse.org"
- run: 'git status --short; git status --porcelain=2|grep --quiet -v . || ( git add .;git commit -m "CI run result of: go generate"; git push origin HEAD:${{ gitea.ref }} )'
- run: git log -p FETCH_HEAD...HEAD
- run: git log --numstat FETCH_HEAD...HEAD

View File

@@ -0,0 +1,33 @@
name: go-vendor-check
on:
push:
branches: ['main']
paths:
- '**.mod'
- '**.sum'
pull_request:
paths:
- '**.mod'
- '**.sum'
workflow_dispatch:
jobs:
go-generate-check:
name: go-vendor-check
container:
image: registry.opensuse.org/devel/factory/git-workflow/containers/opensuse/bci/golang-extended:latest
steps:
- run: git clone --no-checkout --depth 1 ${{ gitea.server_url }}/${{ gitea.repository }} .
- run: git fetch origin ${{ gitea.ref }}
- run: git checkout FETCH_HEAD
- run: go mod download
- run: go mod vendor
- run: go mod verify
- run: git add -N .; git diff
- run: go mod tidy -diff || true
- run: |
status=$(git status --short)
if [[ -n "$status" ]]; then
echo -e "$status"
echo "Please commit the differences from running: go generate"
false
fi

View File

@@ -0,0 +1,26 @@
name: go-generate-push
on:
workflow_dispatch:
jobs:
go-generate-push:
name: go-generate-push
container:
image: registry.opensuse.org/devel/factory/git-workflow/containers/opensuse/bci/golang-extended:latest
steps:
- run: git clone --no-checkout --depth 1 ${{ gitea.server_url }}/${{ gitea.repository }} .
- run: git fetch origin ${{ gitea.ref }}
- run: git checkout FETCH_HEAD
- run: go mod download
- run: go mod vendor
- run: go mod verify
- run: |
host=${{ gitea.server_url }}
host=${host#https://}
echo $host
git remote set-url origin "https://x-access-token:${{ secrets.GITEA_TOKEN }}@$host/${{ gitea.repository }}"
git config user.name "Gitea Actions"
git config user.email "gitea_noreply@opensuse.org"
- run: 'git status --short; git status --porcelain=2|grep --quiet -v . || ( git add .;git commit -m "CI run result of: go mod vendor"; git push origin HEAD:${{ gitea.ref }} )'
- run: go mod tidy -diff || true
- run: git log -p FETCH_HEAD...HEAD
- run: git log --numstat FETCH_HEAD...HEAD

5
.gitignore vendored
View File

@@ -1,5 +1,2 @@
mock
node_modules
*.obscpio
autogits-tmp.tar.zst
*.osc
*.conf

View File

@@ -5,11 +5,15 @@ The bots that drive Git Workflow for package management
* devel-importer -- helper to import an OBS devel project into a Gitea organization
* gitea-events-rabbitmq-publisher -- takes all events from a Gitea organization (webhook) and publishes it on a RabbitMQ instance
* gitea-status-proxy -- allows bots without code owner permission to set Gitea's commit status
* group-review -- group review proxy
* hujson -- translates JWCC (json with commas and comments) to Standard JSON
* obs-forward-bot -- forwards PR as OBS sr (TODO)
* obs-staging-bot -- build bot for a PR
* obs-status-service -- report build status of an OBS project as an SVG
* workflow-pr -- keeps PR to _ObsPrj consistent with a PR to a package update
* workflow-direct -- update _ObsPrj based on direct pushes and repo creations/removals from organization
* staging-utils -- review tooling for PR
* staging-utils -- review tooling for PR (TODO)
- list PR
- merge PR
- split PR
@@ -19,7 +23,18 @@ The bots that drive Git Workflow for package management
Bugs
----
Report bugs to issue tracker at https://src.opensuse.org/adamm/autogits
Report bugs to issue tracker at https://src.opensuse.org/git-workflow/autogits
Build Status
------------
Devel project build status (`main` branch):
![devel:Factory:git-workflow](https://br.opensuse.org/status/devel:Factory:git-workflow/autogits)
`staging` branch build status:
![Staging Build Status](https://br.opensuse.org/status/home:adamm:autogits/autogits)

View File

@@ -1,15 +0,0 @@
<services>
<!-- workaround, go_modules needs a tar and obs_scm doesn't take file://. -->
<service name="roast" mode="manual">
<param name="target">.</param>
<param name="reproducible">true</param>
<param name="outfile">autogits-tmp.tar.zst</param>
<param name="exclude">autogits-tmp.tar.zst</param>
</service>
<service name="go_modules" mode="manual">
<param name="basename">./</param>
<param name="compression">zst</param>
<param name="vendorname">vendor</param>
</service>
</services>

View File

@@ -17,15 +17,14 @@
Name: autogits
Version: 0
Version: 1
Release: 0
Summary: GitWorkflow utilities
License: GPL-2.0-or-later
URL: https://src.opensuse.org/adamm/autogits
Source1: vendor.tar.zst
BuildRequires: golang-packaging
BuildRequires: git
BuildRequires: systemd-rpm-macros
BuildRequires: zstd
BuildRequires: go
%{?systemd_ordering}
%description
@@ -33,160 +32,268 @@ Git Workflow tooling and utilities enabling automated handing of OBS projects
as git repositories
%package -n gitea-events-rabbitmq-publisher
%package devel-importer
Summary: Imports devel projects from obs to git
%description -n autogits-devel-importer
Command-line tool to import devel projects from obs to git
%package doc
Summary: Common documentation files
BuildArch: noarch
%description -n autogits-doc
Common documentation files
%package gitea-events-rabbitmq-publisher
Summary: Publishes Gitea webhook data via RabbitMQ
%description -n gitea-events-rabbitmq-publisher
%description gitea-events-rabbitmq-publisher
Listens on an HTTP socket and publishes Gitea events on a RabbitMQ instance
with a topic
<scope>.src.$organization.$webhook_type.[$webhook_action_type]
%package -n doc
Summary: Common documentation files
%package gitea-status-proxy
Summary: Proxy for setting commit status in Gitea
%description -n doc
Common documentation files
%description gitea-status-proxy
Setting commit status requires code write access token. This proxy
is middleware that delegates status setting without access to other APIs
%package -n devel-importer
Summary: Imports devel projects from obs to git
%description -n devel-importer
Command-line tool to import devel projects from obs to git
%package -n group-review
%package group-review
Summary: Reviews of groups defined in ProjectGit
%description -n group-review
%description group-review
Is used to handle reviews associated with groups defined in the
ProjectGit.
%package -n obs-staging-bot
%package obs-forward-bot
Summary: obs-forward-bot
%description obs-forward-bot
%package obs-staging-bot
Summary: Build a PR against a ProjectGit, if review is requested
%description -n obs-staging-bot
%description obs-staging-bot
Build a PR against a ProjectGit, if review is requested.
%package -n obs-status-service
%package obs-status-service
Summary: Reports build status of OBS service as an easily to produce SVG
%description -n obs-status-service
%description obs-status-service
Reports build status of OBS service as an easily to produce SVG
%package -n workflow-direct
Summary: Keep ProjectGit in sync for a devel project
%package utils
Summary: HuJSON to JSON parser
Provides: hujson
Provides: /usr/bin/hujson
%description -n workflow-direct
%description utils
HuJSON to JSON parser, using stdin -> stdout pipe
%package workflow-direct
Summary: Keep ProjectGit in sync for a devel project
Requires: openssh-clients
Requires: git-core
%description workflow-direct
Keep ProjectGit in sync with packages in the organization of a devel project
%package -n workflow-pr
%package workflow-pr
Summary: Keeps ProjectGit PR in-sync with a PackageGit PR
Requires: openssh-clients
Requires: git-core
%description -n workflow-pr
%description workflow-pr
Keeps ProjectGit PR in-sync with a PackageGit PR
%prep
cp -r /home/abuild/rpmbuild/SOURCES/* ./
tar x --zstd -f %{SOURCE1}
%build
go build \
-C gitea-events-rabbitmq-publisher \
-mod=vendor \
-C devel-importer \
-buildmode=pie
go build \
-C devel-importer \
-mod=vendor \
-C utils/hujson \
-buildmode=pie
go build \
-C gitea-events-rabbitmq-publisher \
-buildmode=pie
go build \
-C gitea_status_proxy \
-buildmode=pie
go build \
-C group-review \
-mod=vendor \
-buildmode=pie
go build \
-C obs-forward-bot \
-buildmode=pie
go build \
-C obs-staging-bot \
-mod=vendor \
-buildmode=pie
go build \
-C obs-status-service \
-mod=vendor \
-buildmode=pie
#go build \
# -C workflow-direct \
# -mod=vendor \
# -buildmode=pie
#go build \
# -C workflow-pr \
# -mod=vendor \
# -buildmode=pie
go build \
-C workflow-direct \
-buildmode=pie
go build \
-C workflow-pr \
-buildmode=pie
%check
go test -C common -v
go test -C group-review -v
go test -C obs-staging-bot -v
go test -C obs-status-service -v
go test -C workflow-direct -v
# TODO build fails
#go test -C workflow-pr -v
%install
install -D -m0755 devel-importer/devel-importer %{buildroot}%{_bindir}/devel-importer
install -D -m0755 gitea-events-rabbitmq-publisher/gitea-events-rabbitmq-publisher %{buildroot}%{_bindir}/gitea-events-rabbitmq-publisher
install -D -m0644 systemd/gitea-events-rabbitmq-publisher.service %{buildroot}%{_unitdir}/gitea-events-rabbitmq-publisher.service
install -D -m0755 devel-importer/devel-importer %{buildroot}%{_bindir}/devel-importer
install -D -m0755 gitea_status_proxy/gitea_status_proxy %{buildroot}%{_bindir}/gitea_status_proxy
install -D -m0755 group-review/group-review %{buildroot}%{_bindir}/group-review
install -D -m0644 systemd/group-review@.service %{buildroot}%{_unitdir}/group-review@.service
install -D -m0755 obs-forward-bot/obs-forward-bot %{buildroot}%{_bindir}/obs-forward-bot
install -D -m0755 obs-staging-bot/obs-staging-bot %{buildroot}%{_bindir}/obs-staging-bot
install -D -m0644 systemd/obs-staging-bot.service %{buildroot}%{_unitdir}/obs-staging-bot.service
install -D -m0755 obs-status-service/obs-status-service %{buildroot}%{_bindir}/obs-status-service
#install -D -m0755 workflow-direct/workflow-direct %{buildroot}%{_bindir}/workflow-direct
#install -D -m0755 workflow-pr/workflow-pr %{buildroot}%{_bindir}/workflow-pr
install -D -m0644 systemd/obs-status-service.service %{buildroot}%{_unitdir}/obs-status-service.service
install -D -m0755 workflow-direct/workflow-direct %{buildroot}%{_bindir}/workflow-direct
install -D -m0644 systemd/workflow-direct@.service %{buildroot}%{_unitdir}/workflow-direct@.service
install -D -m0755 workflow-pr/workflow-pr %{buildroot}%{_bindir}/workflow-pr
install -D -m0755 utils/hujson/hujson %{buildroot}%{_bindir}/hujson
%pre -n gitea-events-rabbitmq-publisher
%pre gitea-events-rabbitmq-publisher
%service_add_pre gitea-events-rabbitmq-publisher.service
%post -n gitea-events-rabbitmq-publisher
%post gitea-events-rabbitmq-publisher
%service_add_post gitea-events-rabbitmq-publisher.service
%preun -n gitea-events-rabbitmq-publisher
%preun gitea-events-rabbitmq-publisher
%service_del_preun gitea-events-rabbitmq-publisher.service
%postun -n gitea-events-rabbitmq-publisher
%postun gitea-events-rabbitmq-publisher
%service_del_postun gitea-events-rabbitmq-publisher.service
%files -n gitea-events-rabbitmq-publisher
%pre group-review
%service_add_pre group-review@.service
%post group-review
%service_add_post group-review@.service
%preun group-review
%service_del_preun group-review@.service
%postun group-review
%service_del_postun group-review@.service
%pre obs-staging-bot
%service_add_pre obs-staging-bot.service
%post obs-staging-bot
%service_add_post obs-staging-bot.service
%preun obs-staging-bot
%service_del_preun obs-staging-bot.service
%postun obs-staging-bot
%service_del_postun obs-staging-bot.service
%pre obs-status-service
%service_add_pre obs-status-service.service
%post obs-status-service
%service_add_post obs-status-service.service
%preun obs-status-service
%service_del_preun obs-status-service.service
%postun obs-status-service
%service_del_postun obs-status-service.service
%pre workflow-pr
%service_add_pre workflow-direct@.service
%post workflow-pr
%service_add_post workflow-direct@.service
%preun workflow-pr
%service_del_preun workflow-direct@.service
%postun workflow-pr
%service_del_postun workflow-direct@.service
%files devel-importer
%license COPYING
%doc devel-importer/README.md
%{_bindir}/devel-importer
%files doc
%license COPYING
%doc doc/README.md
%doc doc/workflows.md
%files gitea-events-rabbitmq-publisher
%license COPYING
%doc gitea-events-rabbitmq-publisher/README.md
%{_bindir}/gitea-events-rabbitmq-publisher
%{_unitdir}/gitea-events-rabbitmq-publisher.service
%files -n doc
%files gitea-status-proxy
%license COPYING
%doc doc/README.md
%doc doc/workflows.md
%{_bindir}/gitea_status_proxy
%files -n devel-importer
%license COPYING
%doc devel-importer/README.md
%{_bindir}/devel-importer
%files -n group-review
%files group-review
%license COPYING
%doc group-review/README.md
%{_bindir}/group-review
%{_unitdir}/group-review@.service
%files -n obs-staging-bot
%files obs-forward-bot
%license COPYING
%{_bindir}/obs-forward-bot
%files obs-staging-bot
%license COPYING
%doc obs-staging-bot/README.md
%{_bindir}/obs-staging-bot
%{_unitdir}/obs-staging-bot.service
%files -n obs-status-service
%files obs-status-service
%license COPYING
%doc obs-status-service/README.md
%{_bindir}/obs-status-service
%{_unitdir}/obs-status-service.service
%files -n workflow-direct
%files utils
%license COPYING
%{_bindir}/hujson
%files workflow-direct
%license COPYING
%doc workflow-direct/README.md
#%{_bindir}/workflow-direct
%{_bindir}/workflow-direct
%{_unitdir}/workflow-direct@.service
%files -n workflow-pr
%files workflow-pr
%license COPYING
%doc workflow-pr/README.md
#%{_bindir}/workflow-pr
%{_bindir}/workflow-pr

File diff suppressed because it is too large Load Diff

View File

@@ -11,7 +11,7 @@ import (
"strings"
)
const PrPattern = "PR: %s/%s#%d"
const PrPattern = "PR: %s/%s!%d"
type BasicPR struct {
Org, Repo string
@@ -36,10 +36,14 @@ func parsePrLine(line string) (BasicPR, error) {
return ret, errors.New("missing / separator")
}
repo := strings.SplitN(org[1], "#", 2)
repo := strings.SplitN(org[1], "!", 2)
ret.Repo = repo[0]
if len(repo) != 2 {
return ret, errors.New("Missing # separator")
repo = strings.SplitN(org[1], "#", 2)
ret.Repo = repo[0]
}
if len(repo) != 2 {
return ret, errors.New("Missing ! or # separator")
}
// Gitea requires that each org and repo be [A-Za-z0-9_-]+

View File

@@ -14,6 +14,7 @@ func newStringScanner(s string) *bufio.Scanner {
}
func TestAssociatedPRScanner(t *testing.T) {
common.SetTestLogger(t)
testTable := []struct {
name string
input string
@@ -34,7 +35,7 @@ func TestAssociatedPRScanner(t *testing.T) {
},
{
"Multiple PRs",
"Some header of the issue\n\nFollowed by some description\nPR: test/foo#4\n\nPR: test/goo#5\n",
"Some header of the issue\n\nFollowed by some description\nPR: test/foo#4\n\nPR: test/goo!5\n",
[]common.BasicPR{
{Org: "test", Repo: "foo", Num: 4},
{Org: "test", Repo: "goo", Num: 5},
@@ -95,6 +96,7 @@ func TestAssociatedPRScanner(t *testing.T) {
}
func TestAppendingPRsToDescription(t *testing.T) {
common.SetTestLogger(t)
testTable := []struct {
name string
desc string
@@ -107,7 +109,7 @@ func TestAppendingPRsToDescription(t *testing.T) {
[]common.BasicPR{
{Org: "a", Repo: "b", Num: 100},
},
"something\n\nPR: a/b#100",
"something\n\nPR: a/b!100",
},
{
"Append multiple PR to end of description",
@@ -119,7 +121,7 @@ func TestAppendingPRsToDescription(t *testing.T) {
{Org: "b", Repo: "b", Num: 100},
{Org: "c", Repo: "b", Num: 100},
},
"something\n\nPR: a1/b#100\nPR: a1/c#100\nPR: a1/c#101\nPR: b/b#100\nPR: c/b#100",
"something\n\nPR: a1/b!100\nPR: a1/c!100\nPR: a1/c!101\nPR: b/b!100\nPR: c/b!100",
},
{
"Append multiple sorted PR to end of description and remove dups",
@@ -133,7 +135,7 @@ func TestAppendingPRsToDescription(t *testing.T) {
{Org: "a1", Repo: "c", Num: 101},
{Org: "a1", Repo: "b", Num: 100},
},
"something\n\nPR: a1/b#100\nPR: a1/c#100\nPR: a1/c#101\nPR: b/b#100\nPR: c/b#100",
"something\n\nPR: a1/b!100\nPR: a1/c!100\nPR: a1/c!101\nPR: b/b!100\nPR: c/b!100",
},
}

View File

@@ -25,6 +25,7 @@ import (
"io"
"log"
"os"
"slices"
"strings"
"github.com/tailscale/hujson"
@@ -35,6 +36,9 @@ import (
const (
ProjectConfigFile = "workflow.config"
StagingConfigFile = "staging.config"
Permission_ForceMerge = "force-merge"
Permission_Group = "release-engineering"
)
type ConfigFile struct {
@@ -43,26 +47,53 @@ type ConfigFile struct {
type ReviewGroup struct {
Name string
Silent bool // will not request reviews from group members
Reviewers []string
}
type QAConfig struct {
Name string
Origin string
BuildDisableRepos []string // which repos to build disable in the new project
}
type Permissions struct {
Permission string
Members []string
}
const (
Label_StagingAuto = "staging/Auto"
Label_ReviewPending = "review/Pending"
Label_ReviewDone = "review/Done"
Label_NewRepository = "new/New Repository"
)
func LabelKey(tag_value string) string {
// capitalize first letter and remove /
if len(tag_value) == 0 {
return ""
}
return strings.ToUpper(tag_value[0:1]) + strings.ReplaceAll(tag_value[1:], "/", "")
}
type AutogitConfig struct {
Workflows []string // [pr, direct, test]
Organization string
GitProjectName string // Organization/GitProjectName.git is PrjGit
Branch string // branch name of PkgGit that aligns with PrjGit submodules
Reviewers []string // only used by `pr` workflow
ReviewGroups []ReviewGroup
GitProjectName string // Organization/GitProjectName.git is PrjGit
Branch string // branch name of PkgGit that aligns with PrjGit submodules
Reviewers []string // only used by `pr` workflow
Permissions []*Permissions // only used by `pr` workflow
ReviewGroups []*ReviewGroup
Committers []string // group in addition to Reviewers and Maintainers that can order the bot around, mostly as helper for factory-maintainers
Subdirs []string // list of directories to sort submodules into. Needed b/c _manifest cannot list non-existent directories
Labels map[string]string // list of tags, if not default, to apply
NoProjectGitPR bool // do not automatically create project git PRs, just assign reviewers and assume somethign else creates the ProjectGit PR
ManualMergeOnly bool // only merge with "Merge OK" comment by Project Maintainers and/or Package Maintainers and/or reviewers
ManualMergeProject bool // require merge of ProjectGit PRs with "Merge OK" by ProjectMaintainers and/or reviewers
ReviewRequired bool // always require a maintainer review, even if maintainer submits it. Only ignored if no other package or project reviewers
}
type AutogitConfigs []*AutogitConfig
@@ -176,6 +207,8 @@ func (configs AutogitConfigs) GetPrjGitConfig(org, repo, branch string) *Autogit
if c.GitProjectName == prjgit {
return c
}
}
for _, c := range configs {
if c.Organization == org && c.Branch == branch {
return c
}
@@ -184,6 +217,27 @@ func (configs AutogitConfigs) GetPrjGitConfig(org, repo, branch string) *Autogit
return nil
}
func (config *AutogitConfig) HasPermission(user, permission string) bool {
if config == nil {
return false
}
for _, p := range config.Permissions {
if p.Permission == permission {
if slices.Contains(p.Members, user) {
return true
}
for _, m := range p.Members {
if members, err := config.GetReviewGroupMembers(m); err == nil && slices.Contains(members, user) {
return true
}
}
}
}
return false
}
func (config *AutogitConfig) GetReviewGroupMembers(reviewer string) ([]string, error) {
for _, g := range config.ReviewGroups {
if g.Name == reviewer {
@@ -194,10 +248,19 @@ func (config *AutogitConfig) GetReviewGroupMembers(reviewer string) ([]string, e
return nil, errors.New("User " + reviewer + " not found as group reviewer for " + config.GitProjectName)
}
func (config *AutogitConfig) GetReviewGroup(reviewer string) (*ReviewGroup, error) {
for _, g := range config.ReviewGroups {
if g.Name == reviewer {
return g, nil
}
}
return nil, errors.New("User " + reviewer + " not found as group reviewer for " + config.GitProjectName)
}
func (config *AutogitConfig) GetPrjGit() (string, string, string) {
org := config.Organization
repo := DefaultGitPrj
branch := "master"
branch := ""
a := strings.Split(config.GitProjectName, "/")
if len(a[0]) > 0 {
@@ -221,6 +284,9 @@ func (config *AutogitConfig) GetPrjGit() (string, string, string) {
}
}
if len(branch) == 0 {
panic("branch for project is undefined. Should not happend." + org + "/" + repo)
}
return org, repo, branch
}
@@ -228,6 +294,14 @@ func (config *AutogitConfig) GetRemoteBranch() string {
return "origin_" + config.Branch
}
func (config *AutogitConfig) Label(label string) string {
if t, found := config.Labels[LabelKey(label)]; found {
return t
}
return label
}
type StagingConfig struct {
ObsProject string
RebuildAll bool
@@ -240,6 +314,9 @@ type StagingConfig struct {
func ParseStagingConfig(data []byte) (*StagingConfig, error) {
var staging StagingConfig
if len(data) == 0 {
return nil, errors.New("non-existent config file.")
}
data, err := hujson.Standardize(data)
if err != nil {
return nil, err

View File

@@ -4,12 +4,72 @@ import (
"slices"
"testing"
"go.uber.org/mock/gomock"
"src.opensuse.org/autogits/common"
"src.opensuse.org/autogits/common/gitea-generated/models"
mock_common "src.opensuse.org/autogits/common/mock"
)
func TestLabelKey(t *testing.T) {
tests := map[string]string{
"": "",
"foo": "Foo",
"foo/bar": "Foobar",
"foo/Bar": "FooBar",
}
for k, v := range tests {
if c := common.LabelKey(k); c != v {
t.Error("expected", v, "got", c, "input", k)
}
}
}
func TestConfigLabelParser(t *testing.T) {
tests := []struct {
name string
json string
label_value string
}{
{
name: "empty",
json: "{}",
label_value: "path/String",
},
{
name: "defined",
json: `{"Labels": {"foo": "bar", "PathString": "moo/Label"}}`,
label_value: "moo/Label",
},
{
name: "undefined",
json: `{"Labels": {"foo": "bar", "NotPathString": "moo/Label"}}`,
label_value: "path/String",
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
repo := models.Repository{
DefaultBranch: "master",
}
ctl := NewController(t)
gitea := mock_common.NewMockGiteaFileContentAndRepoFetcher(ctl)
gitea.EXPECT().GetRepositoryFileContent("foo", "bar", "", "workflow.config").Return([]byte(test.json), "abc", nil)
gitea.EXPECT().GetRepository("foo", "bar").Return(&repo, nil)
config, err := common.ReadWorkflowConfig(gitea, "foo/bar")
if err != nil || config == nil {
t.Fatal(err)
}
if l := config.Label("path/String"); l != test.label_value {
t.Error("Expecting", test.label_value, "got", l)
}
})
}
}
func TestProjectConfigMatcher(t *testing.T) {
configs := common.AutogitConfigs{
{
@@ -21,6 +81,15 @@ func TestProjectConfigMatcher(t *testing.T) {
Branch: "main",
GitProjectName: "test/prjgit#main",
},
{
Organization: "test",
Branch: "main",
GitProjectName: "test/bar#never_match",
},
{
Organization: "test",
GitProjectName: "test/bar#main",
},
}
tests := []struct {
@@ -50,6 +119,20 @@ func TestProjectConfigMatcher(t *testing.T) {
branch: "main",
config: 1,
},
{
name: "prjgit only match",
org: "test",
repo: "bar",
branch: "main",
config: 3,
},
{
name: "non-default branch match",
org: "test",
repo: "bar",
branch: "something_main",
config: -1,
},
}
for _, test := range tests {
@@ -92,7 +175,7 @@ func TestConfigWorkflowParser(t *testing.T) {
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
ctl := gomock.NewController(t)
ctl := NewController(t)
gitea := mock_common.NewMockGiteaFileContentAndRepoFetcher(ctl)
gitea.EXPECT().GetRepositoryFileContent("foo", "bar", "", "workflow.config").Return([]byte(test.config_json), "abc", nil)
gitea.EXPECT().GetRepository("foo", "bar").Return(&test.repo, nil)
@@ -105,10 +188,15 @@ func TestConfigWorkflowParser(t *testing.T) {
if config.ManualMergeOnly != false {
t.Fatal("This should be false")
}
if config.Label("foobar") != "foobar" {
t.Fatal("undefined label should return default value")
}
})
}
}
// FIXME: should test ReadWorkflowConfig as it will always set prjgit completely
func TestProjectGitParser(t *testing.T) {
tests := []struct {
name string
@@ -119,20 +207,21 @@ func TestProjectGitParser(t *testing.T) {
}{
{
name: "repo only",
prjgit: "repo.git",
prjgit: "repo.git#master",
org: "org",
branch: "br",
res: [3]string{"org", "repo.git", "master"},
},
{
name: "default",
org: "org",
res: [3]string{"org", common.DefaultGitPrj, "master"},
name: "default",
org: "org",
prjgit: "org/_ObsPrj#master",
res: [3]string{"org", common.DefaultGitPrj, "master"},
},
{
name: "repo with branch",
org: "org2",
prjgit: "repo.git#somebranch",
prjgit: "org2/repo.git#somebranch",
res: [3]string{"org2", "repo.git", "somebranch"},
},
{
@@ -149,25 +238,25 @@ func TestProjectGitParser(t *testing.T) {
{
name: "repo org and empty branch",
org: "org3",
prjgit: "oorg/foo.bar#",
prjgit: "oorg/foo.bar#master",
res: [3]string{"oorg", "foo.bar", "master"},
},
{
name: "only branch defined",
org: "org3",
prjgit: "#mybranch",
prjgit: "org3/_ObsPrj#mybranch",
res: [3]string{"org3", "_ObsPrj", "mybranch"},
},
{
name: "only org and branch defined",
org: "org3",
prjgit: "org1/#mybranch",
prjgit: "org1/_ObsPrj#mybranch",
res: [3]string{"org1", "_ObsPrj", "mybranch"},
},
{
name: "empty org and repo",
org: "org3",
prjgit: "/repo#",
prjgit: "org3/repo#master",
res: [3]string{"org3", "repo", "master"},
},
}
@@ -188,3 +277,67 @@ func TestProjectGitParser(t *testing.T) {
})
}
}
func TestConfigPermissions(t *testing.T) {
tests := []struct {
name string
permission string
user string
config *common.AutogitConfig
result bool
}{
{
name: "NoPermissions",
permission: common.Permission_ForceMerge,
},
{
name: "NoPermissions",
permission: common.Permission_Group,
},
{
name: "Regular permission ForcePush",
permission: common.Permission_ForceMerge,
result: true,
user: "user",
config: &common.AutogitConfig{
Permissions: []*common.Permissions{
&common.Permissions{
Permission: common.Permission_ForceMerge,
Members: []string{"user"},
},
},
},
},
{
name: "User is part of a group",
permission: common.Permission_ForceMerge,
result: true,
user: "user",
config: &common.AutogitConfig{
Permissions: []*common.Permissions{
&common.Permissions{
Permission: common.Permission_ForceMerge,
Members: []string{"group"},
},
},
ReviewGroups: []*common.ReviewGroup{
&common.ReviewGroup{
Name: "group",
Reviewers: []string{"some", "members", "including", "user"},
},
},
},
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
if r := test.config.HasPermission(test.user, test.permission); r != test.result {
t.Error("Expecting", test.result, "but got opposite")
}
if r := test.config.HasPermission(test.user+test.user, test.permission); r {
t.Error("Expecting false for fake user, but got opposite")
}
})
}
}

View File

@@ -1731,3 +1731,246 @@ const requestedReviewJSON = `{
"commit_id": "",
"review": null
}`
const requestStatusJSON=`{
"commit": {
"id": "e637d86cbbdd438edbf60148e28f9d75a74d51b27b01f75610f247cd18394c8e",
"message": "Update nodejs-common.changes\n",
"url": "https://src.opensuse.org/autogits/nodejs-common/commit/e637d86cbbdd438edbf60148e28f9d75a74d51b27b01f75610f247cd18394c8e",
"author": {
"name": "Adam Majer",
"email": "adamm@noreply.src.opensuse.org",
"username": "adamm"
},
"committer": {
"name": "Adam Majer",
"email": "adamm@noreply.src.opensuse.org",
"username": "adamm"
},
"verification": null,
"timestamp": "2025-09-16T12:41:02+02:00",
"added": [],
"removed": [],
"modified": [
"nodejs-common.changes"
]
},
"context": "test",
"created_at": "2025-09-16T10:50:32Z",
"description": "",
"id": 21663,
"repository": {
"id": 90520,
"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": "nodejs-common",
"full_name": "autogits/nodejs-common",
"description": "",
"empty": false,
"private": false,
"fork": true,
"template": false,
"parent": {
"id": 62649,
"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": 2,
"following_count": 0,
"starred_repos_count": 0,
"username": "pool"
},
"name": "nodejs-common",
"full_name": "pool/nodejs-common",
"description": "",
"empty": false,
"private": false,
"fork": false,
"template": false,
"mirror": false,
"size": 134,
"language": "",
"languages_url": "https://src.opensuse.org/api/v1/repos/pool/nodejs-common/languages",
"html_url": "https://src.opensuse.org/pool/nodejs-common",
"url": "https://src.opensuse.org/api/v1/repos/pool/nodejs-common",
"link": "",
"ssh_url": "gitea@src.opensuse.org:pool/nodejs-common.git",
"clone_url": "https://src.opensuse.org/pool/nodejs-common.git",
"original_url": "",
"website": "",
"stars_count": 0,
"forks_count": 3,
"watchers_count": 12,
"open_issues_count": 0,
"open_pr_counter": 0,
"release_counter": 0,
"default_branch": "factory",
"archived": false,
"created_at": "2024-06-17T17:08:45+02:00",
"updated_at": "2025-08-21T21:58:31+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": 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,
"allow_manual_merge": true,
"autodetect_manual_merge": true,
"default_delete_branch_after_merge": false,
"default_merge_style": "merge",
"default_allow_maintainer_edit": false,
"avatar_url": "",
"internal": false,
"mirror_interval": "",
"object_format_name": "sha256",
"mirror_updated": "0001-01-01T00:00:00Z",
"topics": [],
"licenses": []
},
"mirror": false,
"size": 143,
"language": "",
"languages_url": "https://src.opensuse.org/api/v1/repos/autogits/nodejs-common/languages",
"html_url": "https://src.opensuse.org/autogits/nodejs-common",
"url": "https://src.opensuse.org/api/v1/repos/autogits/nodejs-common",
"link": "",
"ssh_url": "gitea@src.opensuse.org:autogits/nodejs-common.git",
"clone_url": "https://src.opensuse.org/autogits/nodejs-common.git",
"original_url": "",
"website": "",
"stars_count": 0,
"forks_count": 1,
"watchers_count": 4,
"open_issues_count": 0,
"open_pr_counter": 1,
"release_counter": 0,
"default_branch": "factory",
"archived": false,
"created_at": "2024-07-01T13:29:03+02:00",
"updated_at": "2025-09-16T12:41:03+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,
"allow_manual_merge": true,
"autodetect_manual_merge": true,
"default_delete_branch_after_merge": false,
"default_merge_style": "merge",
"default_allow_maintainer_edit": false,
"avatar_url": "",
"internal": false,
"mirror_interval": "",
"object_format_name": "sha256",
"mirror_updated": "0001-01-01T00:00:00Z",
"topics": [],
"licenses": [
"MIT"
]
},
"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/avatars/3e8917bfbf04293f7c20c28cacd83dae2ba9b78a6c6a9a1bedf14c683d8a3763",
"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": 1,
"following_count": 0,
"starred_repos_count": 0,
"username": "adamm"
},
"sha": "e637d86cbbdd438edbf60148e28f9d75a74d51b27b01f75610f247cd18394c8e",
"state": "pending",
"target_url": "https://src.opensuse.org/",
"updated_at": "2025-09-16T10:50:32Z"
}`

View File

@@ -40,6 +40,11 @@ type GitSubmoduleLister interface {
GitSubmoduleCommitId(cwd, packageName, commitId string) (subCommitId string, valid bool)
}
type GitDirectoryLister interface {
GitDirectoryList(gitPath, commitId string) (dirlist map[string]string, err error)
GitDirectoryContentList(gitPath, commitId string) (dirlist map[string]string, err error)
}
type GitStatusLister interface {
GitStatus(cwd string) ([]GitStatusData, error)
}
@@ -61,12 +66,14 @@ type Git interface {
io.Closer
GitSubmoduleLister
GitDirectoryLister
GitStatusLister
GitExecWithOutputOrPanic(cwd string, params ...string) string
GitExecOrPanic(cwd string, params ...string)
GitExec(cwd string, params ...string) error
GitExecWithOutput(cwd string, params ...string) (string, error)
GitExecQuietOrPanic(cwd string, params ...string)
GitDiffLister
}
@@ -76,7 +83,8 @@ type GitHandlerImpl struct {
GitCommiter string
GitEmail string
lock *sync.Mutex
lock *sync.Mutex
quiet bool
}
func (s *GitHandlerImpl) GetPath() string {
@@ -211,7 +219,7 @@ func (e *GitHandlerImpl) GitClone(repo, branch, remoteUrl string) (string, error
return "", fmt.Errorf("Cannot parse remote URL: %w", err)
}
remoteBranch := "HEAD"
if len(branch) == 0 && remoteUrlComp != nil {
if len(branch) == 0 && remoteUrlComp != nil && remoteUrlComp.Commit != "HEAD" {
branch = remoteUrlComp.Commit
remoteBranch = branch
} else if len(branch) > 0 {
@@ -240,46 +248,55 @@ func (e *GitHandlerImpl) GitClone(repo, branch, remoteUrl string) (string, error
// check if we have submodule to deinit
if list, _ := e.GitSubmoduleList(repo, "HEAD"); len(list) > 0 {
e.GitExecOrPanic(repo, "submodule", "deinit", "--all", "--force")
e.GitExecQuietOrPanic(repo, "submodule", "deinit", "--all", "--force")
}
e.GitExecOrPanic(repo, "fetch", "--prune", remoteName, remoteBranch)
}
/*
refsBytes, err := os.ReadFile(path.Join(e.GitPath, repo, ".git/refs/remotes", remoteName, "HEAD"))
if err != nil {
LogError("Cannot read HEAD of remote", remoteName)
return remoteName, fmt.Errorf("Cannot read HEAD of remote %s", remoteName)
}
refsBytes, err := os.ReadFile(path.Join(e.GitPath, repo, ".git/refs/remotes", remoteName, "HEAD"))
if err != nil {
LogError("Cannot read HEAD of remote", remoteName)
return remoteName, fmt.Errorf("Cannot read HEAD of remote %s", remoteName)
refs := string(refsBytes)
if refs[0:5] != "ref: " {
LogError("Unexpected format of remote HEAD ref:", refs)
return remoteName, fmt.Errorf("Unexpected format of remote HEAD ref: %s", refs)
}
if len(branch) == 0 || branch == "HEAD" {
remoteRef = strings.TrimSpace(refs[5:])
branch = remoteRef[strings.LastIndex(remoteRef, "/")+1:]
LogDebug("remoteRef", remoteRef)
LogDebug("branch", branch)
}
*/
args := []string{"fetch", "--prune", remoteName}
if len(branch) > 0 {
args = append(args, branch)
}
refs := string(refsBytes)
if refs[0:5] != "ref: " {
LogError("Unexpected format of remote HEAD ref:", refs)
return remoteName, fmt.Errorf("Unexpected format of remote HEAD ref: %s", refs)
}
if len(branch) == 0 || branch == "HEAD" {
remoteRef = strings.TrimSpace(refs[5:])
branch = remoteRef[strings.LastIndex(remoteRef, "/")+1:]
LogDebug("remoteRef", remoteRef)
LogDebug("branch", branch)
}
args := []string{"fetch", "--prune", remoteName, branch}
if strings.TrimSpace(e.GitExecWithOutputOrPanic(repo, "rev-parse", "--is-shallow-repository")) == "true" {
args = slices.Insert(args, 1, "--unshallow")
}
e.GitExecOrPanic(repo, args...)
return remoteName, e.GitExec(repo, "checkout", "--track", "-B", branch, remoteRef)
return remoteName, e.GitExec(repo, "checkout", "-f", "--track", "-B", branch, remoteRef)
}
func (e *GitHandlerImpl) GitBranchHead(gitDir, branchName string) (string, error) {
id, err := e.GitExecWithOutput(gitDir, "show-ref", "--hash", "--verify", "refs/heads/"+branchName)
id, err := e.GitExecWithOutput(gitDir, "show-ref", "--heads", "--hash", branchName)
if err != nil {
return "", fmt.Errorf("Can't find default branch: %s", branchName)
}
return strings.TrimSpace(id), nil
id = strings.TrimSpace(SplitLines(id)[0])
if len(id) < 10 {
return "", fmt.Errorf("Can't find branch: %s", branchName)
}
return id, nil
}
func (e *GitHandlerImpl) GitRemoteHead(gitDir, remote, branchName string) (string, error) {
@@ -338,6 +355,10 @@ var ExtraGitParams []string
func (e *GitHandlerImpl) GitExecWithOutput(cwd string, params ...string) (string, error) {
cmd := exec.Command("/usr/bin/git", params...)
var identityFile string
if i := os.Getenv("AUTOGITS_IDENTITY_FILE"); len(i) > 0 {
identityFile = " -i " + i
}
cmd.Env = []string{
"GIT_CEILING_DIRECTORIES=" + e.GitPath,
"GIT_CONFIG_GLOBAL=/dev/null",
@@ -345,7 +366,8 @@ func (e *GitHandlerImpl) GitExecWithOutput(cwd string, params ...string) (string
"GIT_COMMITTER_NAME=" + e.GitCommiter,
"EMAIL=not@exist@src.opensuse.org",
"GIT_LFS_SKIP_SMUDGE=1",
"GIT_SSH_COMMAND=/usr/bin/ssh -o StrictHostKeyChecking=yes",
"GIT_LFS_SKIP_PUSH=1",
"GIT_SSH_COMMAND=/usr/bin/ssh -o StrictHostKeyChecking=yes" + identityFile,
}
if len(ExtraGitParams) > 0 {
cmd.Env = append(cmd.Env, ExtraGitParams...)
@@ -355,7 +377,9 @@ func (e *GitHandlerImpl) GitExecWithOutput(cwd string, params ...string) (string
LogDebug("git execute @", cwd, ":", cmd.Args)
out, err := cmd.CombinedOutput()
LogDebug(string(out))
if !e.quiet {
LogDebug(string(out))
}
if err != nil {
LogError("git", cmd.Args, " error:", err)
return "", fmt.Errorf("error executing: git %#v \n%s\n err: %w", cmd.Args, out, err)
@@ -364,6 +388,13 @@ func (e *GitHandlerImpl) GitExecWithOutput(cwd string, params ...string) (string
return string(out), nil
}
func (e *GitHandlerImpl) GitExecQuietOrPanic(cwd string, params ...string) {
e.quiet = true
e.GitExecOrPanic(cwd, params...)
e.quiet = false
return
}
type ChanIO struct {
ch chan byte
}
@@ -761,6 +792,156 @@ func (e *GitHandlerImpl) GitCatFile(cwd, commitId, filename string) (data []byte
return
}
// return (directory) -> (hash) map for all submodules
func (e *GitHandlerImpl) GitDirectoryList(gitPath, commitId string) (directoryList map[string]string, err error) {
var done sync.Mutex
directoryList = make(map[string]string)
done.Lock()
data_in, data_out := ChanIO{make(chan byte)}, ChanIO{make(chan byte)}
LogDebug("Getting directory for:", commitId)
go func() {
defer done.Unlock()
defer close(data_out.ch)
data_out.Write([]byte(commitId))
data_out.ch <- '\x00'
var c GitCommit
c, err = parseGitCommit(data_in.ch)
if err != nil {
err = fmt.Errorf("Error parsing git commit. Err: %w", err)
return
}
trees := make(map[string]string)
trees[""] = c.Tree
for len(trees) > 0 {
for p, tree := range trees {
delete(trees, p)
data_out.Write([]byte(tree))
data_out.ch <- '\x00'
var tree GitTree
tree, err = parseGitTree(data_in.ch)
if err != nil {
err = fmt.Errorf("Error parsing git tree: %w", err)
return
}
for _, te := range tree.items {
if te.isTree() {
directoryList[p+te.name] = te.hash
}
}
}
}
}()
cmd := exec.Command("/usr/bin/git", "cat-file", "--batch", "-Z")
cmd.Env = []string{
"GIT_CEILING_DIRECTORIES=" + e.GitPath,
"GIT_LFS_SKIP_SMUDGE=1",
"GIT_CONFIG_GLOBAL=/dev/null",
}
cmd.Dir = filepath.Join(e.GitPath, gitPath)
cmd.Stdout = &data_in
cmd.Stdin = &data_out
cmd.Stderr = writeFunc(func(data []byte) (int, error) {
LogError(string(data))
return len(data), nil
})
LogDebug("command run:", cmd.Args)
if e := cmd.Run(); e != nil {
LogError(e)
close(data_in.ch)
close(data_out.ch)
return directoryList, e
}
done.Lock()
return directoryList, err
}
// return (directory) -> (hash) map for all submodules
func (e *GitHandlerImpl) GitDirectoryContentList(gitPath, commitId string) (directoryList map[string]string, err error) {
var done sync.Mutex
directoryList = make(map[string]string)
done.Lock()
data_in, data_out := ChanIO{make(chan byte)}, ChanIO{make(chan byte)}
LogDebug("Getting directory content for:", commitId)
go func() {
defer done.Unlock()
defer close(data_out.ch)
data_out.Write([]byte(commitId))
data_out.ch <- '\x00'
var c GitCommit
c, err = parseGitCommit(data_in.ch)
if err != nil {
err = fmt.Errorf("Error parsing git commit. Err: %w", err)
return
}
trees := make(map[string]string)
trees[""] = c.Tree
for len(trees) > 0 {
for p, tree := range trees {
delete(trees, p)
data_out.Write([]byte(tree))
data_out.ch <- '\x00'
var tree GitTree
tree, err = parseGitTree(data_in.ch)
if err != nil {
err = fmt.Errorf("Error parsing git tree: %w", err)
return
}
for _, te := range tree.items {
if te.isBlob() || te.isSubmodule() {
directoryList[p+te.name] = te.hash
} else if te.isTree() {
trees[p+te.name] = te.hash
}
}
}
}
}()
cmd := exec.Command("/usr/bin/git", "cat-file", "--batch", "-Z")
cmd.Env = []string{
"GIT_CEILING_DIRECTORIES=" + e.GitPath,
"GIT_LFS_SKIP_SMUDGE=1",
"GIT_CONFIG_GLOBAL=/dev/null",
}
cmd.Dir = filepath.Join(e.GitPath, gitPath)
cmd.Stdout = &data_in
cmd.Stdin = &data_out
cmd.Stderr = writeFunc(func(data []byte) (int, error) {
LogError(string(data))
return len(data), nil
})
LogDebug("command run:", cmd.Args)
if e := cmd.Run(); e != nil {
LogError(e)
close(data_in.ch)
close(data_out.ch)
return directoryList, e
}
done.Lock()
return directoryList, err
}
// return (filename) -> (hash) map for all submodules
func (e *GitHandlerImpl) GitSubmoduleList(gitPath, commitId string) (submoduleList map[string]string, err error) {
var done sync.Mutex

View File

@@ -24,12 +24,14 @@ import (
"os"
"os/exec"
"path"
"path/filepath"
"slices"
"strings"
"testing"
)
func TestGitClone(t *testing.T) {
SetTestLogger(t)
tests := []struct {
name string
@@ -93,7 +95,59 @@ func TestGitClone(t *testing.T) {
}
}
func TestGitCloneCommitID(t *testing.T) {
SetTestLogger(t)
execPath, err := os.Getwd()
if err != nil {
t.Fatal(err)
}
d := t.TempDir()
if err := os.Chdir(d); err != nil {
t.Fatal(err)
}
defer os.Chdir(execPath)
cmd := exec.Command(path.Join(execPath, "test_repo_setup.sh"))
if out, err := cmd.CombinedOutput(); err != nil {
t.Log(string(out))
t.Fatal(err)
}
gh, err := AllocateGitWorkTree(d, "Test", "test@example.com")
if err != nil {
t.Fatal(err)
}
g, err := gh.CreateGitHandler("org")
if err != nil {
t.Fatal(err)
}
// Get a commit ID from pkgA
remoteUrl := "file://" + d + "/pkgA"
out, err := exec.Command("git", "-C", path.Join(d, "pkgA"), "rev-parse", "main").Output()
if err != nil {
t.Fatal(err)
}
commitID := strings.TrimSpace(string(out))
repo := "pkgAcloneCommitID"
if _, err := g.GitClone(repo, commitID, remoteUrl); err != nil {
t.Skip("TODO: Add GitClone CommitID support")
t.Fatalf("GitClone failed with commit ID: %v", err)
}
// Verify we are at the right commit
head, err := g.GitBranchHead(repo, commitID)
if err != nil {
t.Fatalf("GitBranchHead failed: %v", err)
}
if head != commitID {
t.Errorf("Expected head %s, got %s", commitID, head)
}
}
func TestGitMsgParsing(t *testing.T) {
SetTestLogger(t)
t.Run("tree message with size 56", func(t *testing.T) {
const hdr = "f40888ea4515fe2e8eea617a16f5f50a45f652d894de3ad181d58de3aafb8f98 tree 56\x00"
@@ -172,6 +226,7 @@ func TestGitMsgParsing(t *testing.T) {
}
func TestGitCommitParsing(t *testing.T) {
SetTestLogger(t)
t.Run("parse valid commit message", func(t *testing.T) {
const commitData = "f40888ea4515fe2e8eea617a16f5f50a45f652d894de3ad181d58de3aafb8f99 commit 253\000" +
`tree e20033df9f18780756ba4a96dbc7eb1a626253961039cb674156f266ba7a4e53
@@ -382,6 +437,7 @@ dummy change, don't merge
}
func TestCommitTreeParsing(t *testing.T) {
SetTestLogger(t)
gitDir := t.TempDir()
testDir, _ := os.Getwd()
var commitId string
@@ -392,6 +448,7 @@ func TestCommitTreeParsing(t *testing.T) {
commitId = commitId + strings.TrimSpace(string(data))
return len(data), nil
})
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
t.Fatal(err.Error())
}
@@ -489,6 +546,7 @@ func TestCommitTreeParsing(t *testing.T) {
}
func TestGitStatusParse(t *testing.T) {
SetTestLogger(t)
testData := []struct {
name string
data []byte
@@ -595,3 +653,67 @@ func TestGitStatusParse(t *testing.T) {
})
}
}
func TestGitDirectoryListRepro(t *testing.T) {
SetTestLogger(t)
d := t.TempDir()
// Setup a mock environment for GitHandlerImpl
gh, err := AllocateGitWorkTree(d, "Test", "test@example.com")
if err != nil {
t.Fatal(err)
}
org := "repo-org"
repoName := "test-repo"
repoPath := filepath.Join(d, org, repoName)
err = os.MkdirAll(repoPath, 0755)
if err != nil {
t.Fatal(err)
}
runGit := func(args ...string) {
cmd := exec.Command("git", args...)
cmd.Dir = repoPath
if out, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("git %v failed: %v\n%s", args, err, out)
}
}
runGit("init", "-b", "main", "--object-format=sha256")
runGit("config", "user.email", "test@example.com")
runGit("config", "user.name", "test")
// Create a directory and a file
err = os.Mkdir(filepath.Join(repoPath, "subdir"), 0755)
if err != nil {
t.Fatal(err)
}
err = os.WriteFile(filepath.Join(repoPath, "subdir", "file.txt"), []byte("hello"), 0644)
if err != nil {
t.Fatal(err)
}
runGit("add", "subdir/file.txt")
runGit("commit", "-m", "add subdir")
// Now create the handler
g, err := gh.CreateGitHandler(org)
if err != nil {
t.Fatal(err)
}
// Call GitDirectoryList
dirs, err := g.GitDirectoryList(repoName, "HEAD")
if err != nil {
t.Fatal(err)
}
t.Logf("Directories found: %v", dirs)
if len(dirs) == 0 {
t.Error("No directories found, but 'subdir' should be there")
}
if _, ok := dirs["subdir"]; !ok {
t.Errorf("Expected 'subdir' in directory list, got %v", dirs)
}
}

View File

@@ -68,7 +68,7 @@ type AdminAddUserBadgesParams struct {
/* Username.
username of user
username of the user to whom a badge is to be added
*/
Username string

View File

@@ -92,6 +92,8 @@ type ClientService interface {
AdminCreateRepo(params *AdminCreateRepoParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminCreateRepoCreated, error)
AdminCreateRunnerRegistrationToken(params *AdminCreateRunnerRegistrationTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminCreateRunnerRegistrationTokenOK, error)
AdminCreateUser(params *AdminCreateUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminCreateUserCreated, error)
AdminCronList(params *AdminCronListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminCronListOK, error)
@@ -132,6 +134,16 @@ type ClientService interface {
AdminUnadoptedList(params *AdminUnadoptedListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminUnadoptedListOK, error)
DeleteAdminRunner(params *DeleteAdminRunnerParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAdminRunnerNoContent, error)
GetAdminRunner(params *GetAdminRunnerParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAdminRunnerOK, error)
GetAdminRunners(params *GetAdminRunnersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAdminRunnersOK, error)
ListAdminWorkflowJobs(params *ListAdminWorkflowJobsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListAdminWorkflowJobsOK, error)
ListAdminWorkflowRuns(params *ListAdminWorkflowRunsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListAdminWorkflowRunsOK, error)
SetTransport(transport runtime.ClientTransport)
}
@@ -369,6 +381,45 @@ func (a *Client) AdminCreateRepo(params *AdminCreateRepoParams, authInfo runtime
panic(msg)
}
/*
AdminCreateRunnerRegistrationToken gets an global actions runner registration token
*/
func (a *Client) AdminCreateRunnerRegistrationToken(params *AdminCreateRunnerRegistrationTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminCreateRunnerRegistrationTokenOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewAdminCreateRunnerRegistrationTokenParams()
}
op := &runtime.ClientOperation{
ID: "adminCreateRunnerRegistrationToken",
Method: "POST",
PathPattern: "/admin/actions/runners/registration-token",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "text/plain"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &AdminCreateRunnerRegistrationTokenReader{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.(*AdminCreateRunnerRegistrationTokenOK)
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 adminCreateRunnerRegistrationToken: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
AdminCreateUser creates a user
*/
@@ -1149,6 +1200,201 @@ func (a *Client) AdminUnadoptedList(params *AdminUnadoptedListParams, authInfo r
panic(msg)
}
/*
DeleteAdminRunner deletes an global runner
*/
func (a *Client) DeleteAdminRunner(params *DeleteAdminRunnerParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAdminRunnerNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteAdminRunnerParams()
}
op := &runtime.ClientOperation{
ID: "deleteAdminRunner",
Method: "DELETE",
PathPattern: "/admin/actions/runners/{runner_id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "text/plain"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &DeleteAdminRunnerReader{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.(*DeleteAdminRunnerNoContent)
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 deleteAdminRunner: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAdminRunner gets an global runner
*/
func (a *Client) GetAdminRunner(params *GetAdminRunnerParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAdminRunnerOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAdminRunnerParams()
}
op := &runtime.ClientOperation{
ID: "getAdminRunner",
Method: "GET",
PathPattern: "/admin/actions/runners/{runner_id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "text/plain"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetAdminRunnerReader{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.(*GetAdminRunnerOK)
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 getAdminRunner: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAdminRunners gets all runners
*/
func (a *Client) GetAdminRunners(params *GetAdminRunnersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAdminRunnersOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAdminRunnersParams()
}
op := &runtime.ClientOperation{
ID: "getAdminRunners",
Method: "GET",
PathPattern: "/admin/actions/runners",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "text/plain"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetAdminRunnersReader{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.(*GetAdminRunnersOK)
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 getAdminRunners: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
ListAdminWorkflowJobs lists all jobs
*/
func (a *Client) ListAdminWorkflowJobs(params *ListAdminWorkflowJobsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListAdminWorkflowJobsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListAdminWorkflowJobsParams()
}
op := &runtime.ClientOperation{
ID: "listAdminWorkflowJobs",
Method: "GET",
PathPattern: "/admin/actions/jobs",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "text/plain"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &ListAdminWorkflowJobsReader{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.(*ListAdminWorkflowJobsOK)
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 listAdminWorkflowJobs: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
ListAdminWorkflowRuns lists all runs
*/
func (a *Client) ListAdminWorkflowRuns(params *ListAdminWorkflowRunsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListAdminWorkflowRunsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListAdminWorkflowRunsParams()
}
op := &runtime.ClientOperation{
ID: "listAdminWorkflowRuns",
Method: "GET",
PathPattern: "/admin/actions/runs",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "text/plain"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &ListAdminWorkflowRunsReader{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.(*ListAdminWorkflowRunsOK)
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 listAdminWorkflowRuns: 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

View File

@@ -68,7 +68,7 @@ type AdminCreateOrgParams struct {
/* Username.
username of the user that will own the created organization
username of the user who will own the created organization
*/
Username string

View File

@@ -68,7 +68,7 @@ type AdminCreatePublicKeyParams struct {
/* Username.
username of the user
username of the user who is to receive a public key
*/
Username string

View File

@@ -68,7 +68,7 @@ type AdminCreateRepoParams struct {
/* Username.
username of the user. This user will own the created repository
username of the user who will own the created repository
*/
Username string

View File

@@ -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"
)
// NewAdminCreateRunnerRegistrationTokenParams creates a new AdminCreateRunnerRegistrationTokenParams 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 NewAdminCreateRunnerRegistrationTokenParams() *AdminCreateRunnerRegistrationTokenParams {
return &AdminCreateRunnerRegistrationTokenParams{
timeout: cr.DefaultTimeout,
}
}
// NewAdminCreateRunnerRegistrationTokenParamsWithTimeout creates a new AdminCreateRunnerRegistrationTokenParams object
// with the ability to set a timeout on a request.
func NewAdminCreateRunnerRegistrationTokenParamsWithTimeout(timeout time.Duration) *AdminCreateRunnerRegistrationTokenParams {
return &AdminCreateRunnerRegistrationTokenParams{
timeout: timeout,
}
}
// NewAdminCreateRunnerRegistrationTokenParamsWithContext creates a new AdminCreateRunnerRegistrationTokenParams object
// with the ability to set a context for a request.
func NewAdminCreateRunnerRegistrationTokenParamsWithContext(ctx context.Context) *AdminCreateRunnerRegistrationTokenParams {
return &AdminCreateRunnerRegistrationTokenParams{
Context: ctx,
}
}
// NewAdminCreateRunnerRegistrationTokenParamsWithHTTPClient creates a new AdminCreateRunnerRegistrationTokenParams object
// with the ability to set a custom HTTPClient for a request.
func NewAdminCreateRunnerRegistrationTokenParamsWithHTTPClient(client *http.Client) *AdminCreateRunnerRegistrationTokenParams {
return &AdminCreateRunnerRegistrationTokenParams{
HTTPClient: client,
}
}
/*
AdminCreateRunnerRegistrationTokenParams contains all the parameters to send to the API endpoint
for the admin create runner registration token operation.
Typically these are written to a http.Request.
*/
type AdminCreateRunnerRegistrationTokenParams struct {
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the admin create runner registration token params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *AdminCreateRunnerRegistrationTokenParams) WithDefaults() *AdminCreateRunnerRegistrationTokenParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the admin create runner registration token params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *AdminCreateRunnerRegistrationTokenParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the admin create runner registration token params
func (o *AdminCreateRunnerRegistrationTokenParams) WithTimeout(timeout time.Duration) *AdminCreateRunnerRegistrationTokenParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the admin create runner registration token params
func (o *AdminCreateRunnerRegistrationTokenParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the admin create runner registration token params
func (o *AdminCreateRunnerRegistrationTokenParams) WithContext(ctx context.Context) *AdminCreateRunnerRegistrationTokenParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the admin create runner registration token params
func (o *AdminCreateRunnerRegistrationTokenParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the admin create runner registration token params
func (o *AdminCreateRunnerRegistrationTokenParams) WithHTTPClient(client *http.Client) *AdminCreateRunnerRegistrationTokenParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the admin create runner registration token params
func (o *AdminCreateRunnerRegistrationTokenParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WriteToRequest writes these params to a swagger request
func (o *AdminCreateRunnerRegistrationTokenParams) 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
}

View File

@@ -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"
)
// AdminCreateRunnerRegistrationTokenReader is a Reader for the AdminCreateRunnerRegistrationToken structure.
type AdminCreateRunnerRegistrationTokenReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *AdminCreateRunnerRegistrationTokenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewAdminCreateRunnerRegistrationTokenOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("[POST /admin/actions/runners/registration-token] adminCreateRunnerRegistrationToken", response, response.Code())
}
}
// NewAdminCreateRunnerRegistrationTokenOK creates a AdminCreateRunnerRegistrationTokenOK with default headers values
func NewAdminCreateRunnerRegistrationTokenOK() *AdminCreateRunnerRegistrationTokenOK {
return &AdminCreateRunnerRegistrationTokenOK{}
}
/*
AdminCreateRunnerRegistrationTokenOK describes a response with status code 200, with default header values.
RegistrationToken is response related to registration token
*/
type AdminCreateRunnerRegistrationTokenOK struct {
Token string
}
// IsSuccess returns true when this admin create runner registration token o k response has a 2xx status code
func (o *AdminCreateRunnerRegistrationTokenOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this admin create runner registration token o k response has a 3xx status code
func (o *AdminCreateRunnerRegistrationTokenOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this admin create runner registration token o k response has a 4xx status code
func (o *AdminCreateRunnerRegistrationTokenOK) IsClientError() bool {
return false
}
// IsServerError returns true when this admin create runner registration token o k response has a 5xx status code
func (o *AdminCreateRunnerRegistrationTokenOK) IsServerError() bool {
return false
}
// IsCode returns true when this admin create runner registration token o k response a status code equal to that given
func (o *AdminCreateRunnerRegistrationTokenOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the admin create runner registration token o k response
func (o *AdminCreateRunnerRegistrationTokenOK) Code() int {
return 200
}
func (o *AdminCreateRunnerRegistrationTokenOK) Error() string {
return fmt.Sprintf("[POST /admin/actions/runners/registration-token][%d] adminCreateRunnerRegistrationTokenOK", 200)
}
func (o *AdminCreateRunnerRegistrationTokenOK) String() string {
return fmt.Sprintf("[POST /admin/actions/runners/registration-token][%d] adminCreateRunnerRegistrationTokenOK", 200)
}
func (o *AdminCreateRunnerRegistrationTokenOK) 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
}

View File

@@ -68,7 +68,7 @@ type AdminDeleteUserBadgesParams struct {
/* Username.
username of user
username of the user whose badge is to be deleted
*/
Username string

View File

@@ -70,7 +70,7 @@ type AdminDeleteUserParams struct {
/* Username.
username of user to delete
username of the user to delete
*/
Username string

View File

@@ -72,7 +72,7 @@ type AdminDeleteUserPublicKeyParams struct {
/* Username.
username of user
username of the user whose public key is to be deleted
*/
Username string

View File

@@ -68,7 +68,7 @@ type AdminEditUserParams struct {
/* Username.
username of user to edit
username of the user whose data is to be edited
*/
Username string

View File

@@ -74,6 +74,14 @@ type AdminListHooksParams struct {
*/
Page *int64
/* Type.
system, default or both kinds of webhooks
Default: "system"
*/
Type *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
@@ -91,7 +99,18 @@ func (o *AdminListHooksParams) WithDefaults() *AdminListHooksParams {
//
// All values with no default are reset to their zero value.
func (o *AdminListHooksParams) SetDefaults() {
// no default values defined for this parameter
var (
typeVarDefault = string("system")
)
val := AdminListHooksParams{
Type: &typeVarDefault,
}
val.timeout = o.timeout
val.Context = o.Context
val.HTTPClient = o.HTTPClient
*o = val
}
// WithTimeout adds the timeout to the admin list hooks params
@@ -149,6 +168,17 @@ func (o *AdminListHooksParams) SetPage(page *int64) {
o.Page = page
}
// WithType adds the typeVar to the admin list hooks params
func (o *AdminListHooksParams) WithType(typeVar *string) *AdminListHooksParams {
o.SetType(typeVar)
return o
}
// SetType adds the type to the admin list hooks params
func (o *AdminListHooksParams) SetType(typeVar *string) {
o.Type = typeVar
}
// WriteToRequest writes these params to a swagger request
func (o *AdminListHooksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
@@ -191,6 +221,23 @@ func (o *AdminListHooksParams) WriteToRequest(r runtime.ClientRequest, reg strfm
}
}
if o.Type != nil {
// query param type
var qrType string
if o.Type != nil {
qrType = *o.Type
}
qType := qrType
if qType != "" {
if err := r.SetQueryParam("type", qType); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}

View File

@@ -63,7 +63,7 @@ type AdminListUserBadgesParams struct {
/* Username.
username of user
username of the user whose badges are to be listed
*/
Username string

View File

@@ -68,7 +68,7 @@ type AdminRenameUserParams struct {
/* Username.
existing username of user
current username of the user
*/
Username string

View File

@@ -70,7 +70,7 @@ type AdminSearchUsersParams struct {
/* LoginName.
user's login name to search for
identifier of the user, provided by the external authenticator
*/
LoginName *string

View File

@@ -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"
)
// NewDeleteAdminRunnerParams creates a new DeleteAdminRunnerParams 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 NewDeleteAdminRunnerParams() *DeleteAdminRunnerParams {
return &DeleteAdminRunnerParams{
timeout: cr.DefaultTimeout,
}
}
// NewDeleteAdminRunnerParamsWithTimeout creates a new DeleteAdminRunnerParams object
// with the ability to set a timeout on a request.
func NewDeleteAdminRunnerParamsWithTimeout(timeout time.Duration) *DeleteAdminRunnerParams {
return &DeleteAdminRunnerParams{
timeout: timeout,
}
}
// NewDeleteAdminRunnerParamsWithContext creates a new DeleteAdminRunnerParams object
// with the ability to set a context for a request.
func NewDeleteAdminRunnerParamsWithContext(ctx context.Context) *DeleteAdminRunnerParams {
return &DeleteAdminRunnerParams{
Context: ctx,
}
}
// NewDeleteAdminRunnerParamsWithHTTPClient creates a new DeleteAdminRunnerParams object
// with the ability to set a custom HTTPClient for a request.
func NewDeleteAdminRunnerParamsWithHTTPClient(client *http.Client) *DeleteAdminRunnerParams {
return &DeleteAdminRunnerParams{
HTTPClient: client,
}
}
/*
DeleteAdminRunnerParams contains all the parameters to send to the API endpoint
for the delete admin runner operation.
Typically these are written to a http.Request.
*/
type DeleteAdminRunnerParams struct {
/* RunnerID.
id of the runner
*/
RunnerID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the delete admin runner params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *DeleteAdminRunnerParams) WithDefaults() *DeleteAdminRunnerParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the delete admin runner params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *DeleteAdminRunnerParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the delete admin runner params
func (o *DeleteAdminRunnerParams) WithTimeout(timeout time.Duration) *DeleteAdminRunnerParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete admin runner params
func (o *DeleteAdminRunnerParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the delete admin runner params
func (o *DeleteAdminRunnerParams) WithContext(ctx context.Context) *DeleteAdminRunnerParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete admin runner params
func (o *DeleteAdminRunnerParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete admin runner params
func (o *DeleteAdminRunnerParams) WithHTTPClient(client *http.Client) *DeleteAdminRunnerParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete admin runner params
func (o *DeleteAdminRunnerParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithRunnerID adds the runnerID to the delete admin runner params
func (o *DeleteAdminRunnerParams) WithRunnerID(runnerID string) *DeleteAdminRunnerParams {
o.SetRunnerID(runnerID)
return o
}
// SetRunnerID adds the runnerId to the delete admin runner params
func (o *DeleteAdminRunnerParams) SetRunnerID(runnerID string) {
o.RunnerID = runnerID
}
// WriteToRequest writes these params to a swagger request
func (o *DeleteAdminRunnerParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param runner_id
if err := r.SetPathParam("runner_id", o.RunnerID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -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"
)
// DeleteAdminRunnerReader is a Reader for the DeleteAdminRunner structure.
type DeleteAdminRunnerReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *DeleteAdminRunnerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 204:
result := NewDeleteAdminRunnerNoContent()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewDeleteAdminRunnerBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewDeleteAdminRunnerNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[DELETE /admin/actions/runners/{runner_id}] deleteAdminRunner", response, response.Code())
}
}
// NewDeleteAdminRunnerNoContent creates a DeleteAdminRunnerNoContent with default headers values
func NewDeleteAdminRunnerNoContent() *DeleteAdminRunnerNoContent {
return &DeleteAdminRunnerNoContent{}
}
/*
DeleteAdminRunnerNoContent describes a response with status code 204, with default header values.
runner has been deleted
*/
type DeleteAdminRunnerNoContent struct {
}
// IsSuccess returns true when this delete admin runner no content response has a 2xx status code
func (o *DeleteAdminRunnerNoContent) IsSuccess() bool {
return true
}
// IsRedirect returns true when this delete admin runner no content response has a 3xx status code
func (o *DeleteAdminRunnerNoContent) IsRedirect() bool {
return false
}
// IsClientError returns true when this delete admin runner no content response has a 4xx status code
func (o *DeleteAdminRunnerNoContent) IsClientError() bool {
return false
}
// IsServerError returns true when this delete admin runner no content response has a 5xx status code
func (o *DeleteAdminRunnerNoContent) IsServerError() bool {
return false
}
// IsCode returns true when this delete admin runner no content response a status code equal to that given
func (o *DeleteAdminRunnerNoContent) IsCode(code int) bool {
return code == 204
}
// Code gets the status code for the delete admin runner no content response
func (o *DeleteAdminRunnerNoContent) Code() int {
return 204
}
func (o *DeleteAdminRunnerNoContent) Error() string {
return fmt.Sprintf("[DELETE /admin/actions/runners/{runner_id}][%d] deleteAdminRunnerNoContent", 204)
}
func (o *DeleteAdminRunnerNoContent) String() string {
return fmt.Sprintf("[DELETE /admin/actions/runners/{runner_id}][%d] deleteAdminRunnerNoContent", 204)
}
func (o *DeleteAdminRunnerNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewDeleteAdminRunnerBadRequest creates a DeleteAdminRunnerBadRequest with default headers values
func NewDeleteAdminRunnerBadRequest() *DeleteAdminRunnerBadRequest {
return &DeleteAdminRunnerBadRequest{}
}
/*
DeleteAdminRunnerBadRequest describes a response with status code 400, with default header values.
APIError is error format response
*/
type DeleteAdminRunnerBadRequest struct {
Message string
URL string
}
// IsSuccess returns true when this delete admin runner bad request response has a 2xx status code
func (o *DeleteAdminRunnerBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this delete admin runner bad request response has a 3xx status code
func (o *DeleteAdminRunnerBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this delete admin runner bad request response has a 4xx status code
func (o *DeleteAdminRunnerBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this delete admin runner bad request response has a 5xx status code
func (o *DeleteAdminRunnerBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this delete admin runner bad request response a status code equal to that given
func (o *DeleteAdminRunnerBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the delete admin runner bad request response
func (o *DeleteAdminRunnerBadRequest) Code() int {
return 400
}
func (o *DeleteAdminRunnerBadRequest) Error() string {
return fmt.Sprintf("[DELETE /admin/actions/runners/{runner_id}][%d] deleteAdminRunnerBadRequest", 400)
}
func (o *DeleteAdminRunnerBadRequest) String() string {
return fmt.Sprintf("[DELETE /admin/actions/runners/{runner_id}][%d] deleteAdminRunnerBadRequest", 400)
}
func (o *DeleteAdminRunnerBadRequest) 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
}
// NewDeleteAdminRunnerNotFound creates a DeleteAdminRunnerNotFound with default headers values
func NewDeleteAdminRunnerNotFound() *DeleteAdminRunnerNotFound {
return &DeleteAdminRunnerNotFound{}
}
/*
DeleteAdminRunnerNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type DeleteAdminRunnerNotFound struct {
}
// IsSuccess returns true when this delete admin runner not found response has a 2xx status code
func (o *DeleteAdminRunnerNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this delete admin runner not found response has a 3xx status code
func (o *DeleteAdminRunnerNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this delete admin runner not found response has a 4xx status code
func (o *DeleteAdminRunnerNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this delete admin runner not found response has a 5xx status code
func (o *DeleteAdminRunnerNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this delete admin runner not found response a status code equal to that given
func (o *DeleteAdminRunnerNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the delete admin runner not found response
func (o *DeleteAdminRunnerNotFound) Code() int {
return 404
}
func (o *DeleteAdminRunnerNotFound) Error() string {
return fmt.Sprintf("[DELETE /admin/actions/runners/{runner_id}][%d] deleteAdminRunnerNotFound", 404)
}
func (o *DeleteAdminRunnerNotFound) String() string {
return fmt.Sprintf("[DELETE /admin/actions/runners/{runner_id}][%d] deleteAdminRunnerNotFound", 404)
}
func (o *DeleteAdminRunnerNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -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"
)
// NewGetAdminRunnerParams creates a new GetAdminRunnerParams 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 NewGetAdminRunnerParams() *GetAdminRunnerParams {
return &GetAdminRunnerParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAdminRunnerParamsWithTimeout creates a new GetAdminRunnerParams object
// with the ability to set a timeout on a request.
func NewGetAdminRunnerParamsWithTimeout(timeout time.Duration) *GetAdminRunnerParams {
return &GetAdminRunnerParams{
timeout: timeout,
}
}
// NewGetAdminRunnerParamsWithContext creates a new GetAdminRunnerParams object
// with the ability to set a context for a request.
func NewGetAdminRunnerParamsWithContext(ctx context.Context) *GetAdminRunnerParams {
return &GetAdminRunnerParams{
Context: ctx,
}
}
// NewGetAdminRunnerParamsWithHTTPClient creates a new GetAdminRunnerParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetAdminRunnerParamsWithHTTPClient(client *http.Client) *GetAdminRunnerParams {
return &GetAdminRunnerParams{
HTTPClient: client,
}
}
/*
GetAdminRunnerParams contains all the parameters to send to the API endpoint
for the get admin runner operation.
Typically these are written to a http.Request.
*/
type GetAdminRunnerParams struct {
/* RunnerID.
id of the runner
*/
RunnerID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get admin runner params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAdminRunnerParams) WithDefaults() *GetAdminRunnerParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get admin runner params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAdminRunnerParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get admin runner params
func (o *GetAdminRunnerParams) WithTimeout(timeout time.Duration) *GetAdminRunnerParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get admin runner params
func (o *GetAdminRunnerParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get admin runner params
func (o *GetAdminRunnerParams) WithContext(ctx context.Context) *GetAdminRunnerParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get admin runner params
func (o *GetAdminRunnerParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get admin runner params
func (o *GetAdminRunnerParams) WithHTTPClient(client *http.Client) *GetAdminRunnerParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get admin runner params
func (o *GetAdminRunnerParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithRunnerID adds the runnerID to the get admin runner params
func (o *GetAdminRunnerParams) WithRunnerID(runnerID string) *GetAdminRunnerParams {
o.SetRunnerID(runnerID)
return o
}
// SetRunnerID adds the runnerId to the get admin runner params
func (o *GetAdminRunnerParams) SetRunnerID(runnerID string) {
o.RunnerID = runnerID
}
// WriteToRequest writes these params to a swagger request
func (o *GetAdminRunnerParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param runner_id
if err := r.SetPathParam("runner_id", o.RunnerID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -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"
)
// GetAdminRunnerReader is a Reader for the GetAdminRunner structure.
type GetAdminRunnerReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAdminRunnerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAdminRunnerOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewGetAdminRunnerBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewGetAdminRunnerNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /admin/actions/runners/{runner_id}] getAdminRunner", response, response.Code())
}
}
// NewGetAdminRunnerOK creates a GetAdminRunnerOK with default headers values
func NewGetAdminRunnerOK() *GetAdminRunnerOK {
return &GetAdminRunnerOK{}
}
/*
GetAdminRunnerOK describes a response with status code 200, with default header values.
ActionRunner represents a Runner
*/
type GetAdminRunnerOK struct {
}
// IsSuccess returns true when this get admin runner o k response has a 2xx status code
func (o *GetAdminRunnerOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get admin runner o k response has a 3xx status code
func (o *GetAdminRunnerOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get admin runner o k response has a 4xx status code
func (o *GetAdminRunnerOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get admin runner o k response has a 5xx status code
func (o *GetAdminRunnerOK) IsServerError() bool {
return false
}
// IsCode returns true when this get admin runner o k response a status code equal to that given
func (o *GetAdminRunnerOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the get admin runner o k response
func (o *GetAdminRunnerOK) Code() int {
return 200
}
func (o *GetAdminRunnerOK) Error() string {
return fmt.Sprintf("[GET /admin/actions/runners/{runner_id}][%d] getAdminRunnerOK", 200)
}
func (o *GetAdminRunnerOK) String() string {
return fmt.Sprintf("[GET /admin/actions/runners/{runner_id}][%d] getAdminRunnerOK", 200)
}
func (o *GetAdminRunnerOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewGetAdminRunnerBadRequest creates a GetAdminRunnerBadRequest with default headers values
func NewGetAdminRunnerBadRequest() *GetAdminRunnerBadRequest {
return &GetAdminRunnerBadRequest{}
}
/*
GetAdminRunnerBadRequest describes a response with status code 400, with default header values.
APIError is error format response
*/
type GetAdminRunnerBadRequest struct {
Message string
URL string
}
// IsSuccess returns true when this get admin runner bad request response has a 2xx status code
func (o *GetAdminRunnerBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get admin runner bad request response has a 3xx status code
func (o *GetAdminRunnerBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this get admin runner bad request response has a 4xx status code
func (o *GetAdminRunnerBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this get admin runner bad request response has a 5xx status code
func (o *GetAdminRunnerBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this get admin runner bad request response a status code equal to that given
func (o *GetAdminRunnerBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the get admin runner bad request response
func (o *GetAdminRunnerBadRequest) Code() int {
return 400
}
func (o *GetAdminRunnerBadRequest) Error() string {
return fmt.Sprintf("[GET /admin/actions/runners/{runner_id}][%d] getAdminRunnerBadRequest", 400)
}
func (o *GetAdminRunnerBadRequest) String() string {
return fmt.Sprintf("[GET /admin/actions/runners/{runner_id}][%d] getAdminRunnerBadRequest", 400)
}
func (o *GetAdminRunnerBadRequest) 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
}
// NewGetAdminRunnerNotFound creates a GetAdminRunnerNotFound with default headers values
func NewGetAdminRunnerNotFound() *GetAdminRunnerNotFound {
return &GetAdminRunnerNotFound{}
}
/*
GetAdminRunnerNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type GetAdminRunnerNotFound struct {
}
// IsSuccess returns true when this get admin runner not found response has a 2xx status code
func (o *GetAdminRunnerNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get admin runner not found response has a 3xx status code
func (o *GetAdminRunnerNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this get admin runner not found response has a 4xx status code
func (o *GetAdminRunnerNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this get admin runner not found response has a 5xx status code
func (o *GetAdminRunnerNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this get admin runner not found response a status code equal to that given
func (o *GetAdminRunnerNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the get admin runner not found response
func (o *GetAdminRunnerNotFound) Code() int {
return 404
}
func (o *GetAdminRunnerNotFound) Error() string {
return fmt.Sprintf("[GET /admin/actions/runners/{runner_id}][%d] getAdminRunnerNotFound", 404)
}
func (o *GetAdminRunnerNotFound) String() string {
return fmt.Sprintf("[GET /admin/actions/runners/{runner_id}][%d] getAdminRunnerNotFound", 404)
}
func (o *GetAdminRunnerNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -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"
)
// NewGetAdminRunnersParams creates a new GetAdminRunnersParams 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 NewGetAdminRunnersParams() *GetAdminRunnersParams {
return &GetAdminRunnersParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAdminRunnersParamsWithTimeout creates a new GetAdminRunnersParams object
// with the ability to set a timeout on a request.
func NewGetAdminRunnersParamsWithTimeout(timeout time.Duration) *GetAdminRunnersParams {
return &GetAdminRunnersParams{
timeout: timeout,
}
}
// NewGetAdminRunnersParamsWithContext creates a new GetAdminRunnersParams object
// with the ability to set a context for a request.
func NewGetAdminRunnersParamsWithContext(ctx context.Context) *GetAdminRunnersParams {
return &GetAdminRunnersParams{
Context: ctx,
}
}
// NewGetAdminRunnersParamsWithHTTPClient creates a new GetAdminRunnersParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetAdminRunnersParamsWithHTTPClient(client *http.Client) *GetAdminRunnersParams {
return &GetAdminRunnersParams{
HTTPClient: client,
}
}
/*
GetAdminRunnersParams contains all the parameters to send to the API endpoint
for the get admin runners operation.
Typically these are written to a http.Request.
*/
type GetAdminRunnersParams struct {
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get admin runners params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAdminRunnersParams) WithDefaults() *GetAdminRunnersParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get admin runners params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAdminRunnersParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get admin runners params
func (o *GetAdminRunnersParams) WithTimeout(timeout time.Duration) *GetAdminRunnersParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get admin runners params
func (o *GetAdminRunnersParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get admin runners params
func (o *GetAdminRunnersParams) WithContext(ctx context.Context) *GetAdminRunnersParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get admin runners params
func (o *GetAdminRunnersParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get admin runners params
func (o *GetAdminRunnersParams) WithHTTPClient(client *http.Client) *GetAdminRunnersParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get admin runners params
func (o *GetAdminRunnersParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WriteToRequest writes these params to a swagger request
func (o *GetAdminRunnersParams) 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
}

View File

@@ -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"
)
// GetAdminRunnersReader is a Reader for the GetAdminRunners structure.
type GetAdminRunnersReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAdminRunnersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAdminRunnersOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewGetAdminRunnersBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewGetAdminRunnersNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /admin/actions/runners] getAdminRunners", response, response.Code())
}
}
// NewGetAdminRunnersOK creates a GetAdminRunnersOK with default headers values
func NewGetAdminRunnersOK() *GetAdminRunnersOK {
return &GetAdminRunnersOK{}
}
/*
GetAdminRunnersOK describes a response with status code 200, with default header values.
ActionRunnersResponse returns Runners
*/
type GetAdminRunnersOK struct {
}
// IsSuccess returns true when this get admin runners o k response has a 2xx status code
func (o *GetAdminRunnersOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get admin runners o k response has a 3xx status code
func (o *GetAdminRunnersOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get admin runners o k response has a 4xx status code
func (o *GetAdminRunnersOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get admin runners o k response has a 5xx status code
func (o *GetAdminRunnersOK) IsServerError() bool {
return false
}
// IsCode returns true when this get admin runners o k response a status code equal to that given
func (o *GetAdminRunnersOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the get admin runners o k response
func (o *GetAdminRunnersOK) Code() int {
return 200
}
func (o *GetAdminRunnersOK) Error() string {
return fmt.Sprintf("[GET /admin/actions/runners][%d] getAdminRunnersOK", 200)
}
func (o *GetAdminRunnersOK) String() string {
return fmt.Sprintf("[GET /admin/actions/runners][%d] getAdminRunnersOK", 200)
}
func (o *GetAdminRunnersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewGetAdminRunnersBadRequest creates a GetAdminRunnersBadRequest with default headers values
func NewGetAdminRunnersBadRequest() *GetAdminRunnersBadRequest {
return &GetAdminRunnersBadRequest{}
}
/*
GetAdminRunnersBadRequest describes a response with status code 400, with default header values.
APIError is error format response
*/
type GetAdminRunnersBadRequest struct {
Message string
URL string
}
// IsSuccess returns true when this get admin runners bad request response has a 2xx status code
func (o *GetAdminRunnersBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get admin runners bad request response has a 3xx status code
func (o *GetAdminRunnersBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this get admin runners bad request response has a 4xx status code
func (o *GetAdminRunnersBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this get admin runners bad request response has a 5xx status code
func (o *GetAdminRunnersBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this get admin runners bad request response a status code equal to that given
func (o *GetAdminRunnersBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the get admin runners bad request response
func (o *GetAdminRunnersBadRequest) Code() int {
return 400
}
func (o *GetAdminRunnersBadRequest) Error() string {
return fmt.Sprintf("[GET /admin/actions/runners][%d] getAdminRunnersBadRequest", 400)
}
func (o *GetAdminRunnersBadRequest) String() string {
return fmt.Sprintf("[GET /admin/actions/runners][%d] getAdminRunnersBadRequest", 400)
}
func (o *GetAdminRunnersBadRequest) 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
}
// NewGetAdminRunnersNotFound creates a GetAdminRunnersNotFound with default headers values
func NewGetAdminRunnersNotFound() *GetAdminRunnersNotFound {
return &GetAdminRunnersNotFound{}
}
/*
GetAdminRunnersNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type GetAdminRunnersNotFound struct {
}
// IsSuccess returns true when this get admin runners not found response has a 2xx status code
func (o *GetAdminRunnersNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get admin runners not found response has a 3xx status code
func (o *GetAdminRunnersNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this get admin runners not found response has a 4xx status code
func (o *GetAdminRunnersNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this get admin runners not found response has a 5xx status code
func (o *GetAdminRunnersNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this get admin runners not found response a status code equal to that given
func (o *GetAdminRunnersNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the get admin runners not found response
func (o *GetAdminRunnersNotFound) Code() int {
return 404
}
func (o *GetAdminRunnersNotFound) Error() string {
return fmt.Sprintf("[GET /admin/actions/runners][%d] getAdminRunnersNotFound", 404)
}
func (o *GetAdminRunnersNotFound) String() string {
return fmt.Sprintf("[GET /admin/actions/runners][%d] getAdminRunnersNotFound", 404)
}
func (o *GetAdminRunnersNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -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"
)
// NewListAdminWorkflowJobsParams creates a new ListAdminWorkflowJobsParams 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 NewListAdminWorkflowJobsParams() *ListAdminWorkflowJobsParams {
return &ListAdminWorkflowJobsParams{
timeout: cr.DefaultTimeout,
}
}
// NewListAdminWorkflowJobsParamsWithTimeout creates a new ListAdminWorkflowJobsParams object
// with the ability to set a timeout on a request.
func NewListAdminWorkflowJobsParamsWithTimeout(timeout time.Duration) *ListAdminWorkflowJobsParams {
return &ListAdminWorkflowJobsParams{
timeout: timeout,
}
}
// NewListAdminWorkflowJobsParamsWithContext creates a new ListAdminWorkflowJobsParams object
// with the ability to set a context for a request.
func NewListAdminWorkflowJobsParamsWithContext(ctx context.Context) *ListAdminWorkflowJobsParams {
return &ListAdminWorkflowJobsParams{
Context: ctx,
}
}
// NewListAdminWorkflowJobsParamsWithHTTPClient creates a new ListAdminWorkflowJobsParams object
// with the ability to set a custom HTTPClient for a request.
func NewListAdminWorkflowJobsParamsWithHTTPClient(client *http.Client) *ListAdminWorkflowJobsParams {
return &ListAdminWorkflowJobsParams{
HTTPClient: client,
}
}
/*
ListAdminWorkflowJobsParams contains all the parameters to send to the API endpoint
for the list admin workflow jobs operation.
Typically these are written to a http.Request.
*/
type ListAdminWorkflowJobsParams struct {
/* Limit.
page size of results
*/
Limit *int64
/* Page.
page number of results to return (1-based)
*/
Page *int64
/* Status.
workflow status (pending, queued, in_progress, failure, success, skipped)
*/
Status *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the list admin workflow jobs params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListAdminWorkflowJobsParams) WithDefaults() *ListAdminWorkflowJobsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the list admin workflow jobs params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListAdminWorkflowJobsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the list admin workflow jobs params
func (o *ListAdminWorkflowJobsParams) WithTimeout(timeout time.Duration) *ListAdminWorkflowJobsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the list admin workflow jobs params
func (o *ListAdminWorkflowJobsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the list admin workflow jobs params
func (o *ListAdminWorkflowJobsParams) WithContext(ctx context.Context) *ListAdminWorkflowJobsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the list admin workflow jobs params
func (o *ListAdminWorkflowJobsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the list admin workflow jobs params
func (o *ListAdminWorkflowJobsParams) WithHTTPClient(client *http.Client) *ListAdminWorkflowJobsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the list admin workflow jobs params
func (o *ListAdminWorkflowJobsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithLimit adds the limit to the list admin workflow jobs params
func (o *ListAdminWorkflowJobsParams) WithLimit(limit *int64) *ListAdminWorkflowJobsParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the list admin workflow jobs params
func (o *ListAdminWorkflowJobsParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithPage adds the page to the list admin workflow jobs params
func (o *ListAdminWorkflowJobsParams) WithPage(page *int64) *ListAdminWorkflowJobsParams {
o.SetPage(page)
return o
}
// SetPage adds the page to the list admin workflow jobs params
func (o *ListAdminWorkflowJobsParams) SetPage(page *int64) {
o.Page = page
}
// WithStatus adds the status to the list admin workflow jobs params
func (o *ListAdminWorkflowJobsParams) WithStatus(status *string) *ListAdminWorkflowJobsParams {
o.SetStatus(status)
return o
}
// SetStatus adds the status to the list admin workflow jobs params
func (o *ListAdminWorkflowJobsParams) SetStatus(status *string) {
o.Status = status
}
// WriteToRequest writes these params to a swagger request
func (o *ListAdminWorkflowJobsParams) 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.Status != nil {
// query param status
var qrStatus string
if o.Status != nil {
qrStatus = *o.Status
}
qStatus := qrStatus
if qStatus != "" {
if err := r.SetQueryParam("status", qStatus); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,246 @@
// 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"
)
// ListAdminWorkflowJobsReader is a Reader for the ListAdminWorkflowJobs structure.
type ListAdminWorkflowJobsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ListAdminWorkflowJobsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewListAdminWorkflowJobsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewListAdminWorkflowJobsBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewListAdminWorkflowJobsNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /admin/actions/jobs] listAdminWorkflowJobs", response, response.Code())
}
}
// NewListAdminWorkflowJobsOK creates a ListAdminWorkflowJobsOK with default headers values
func NewListAdminWorkflowJobsOK() *ListAdminWorkflowJobsOK {
return &ListAdminWorkflowJobsOK{}
}
/*
ListAdminWorkflowJobsOK describes a response with status code 200, with default header values.
WorkflowJobsList
*/
type ListAdminWorkflowJobsOK struct {
Payload *models.ActionWorkflowJobsResponse
}
// IsSuccess returns true when this list admin workflow jobs o k response has a 2xx status code
func (o *ListAdminWorkflowJobsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this list admin workflow jobs o k response has a 3xx status code
func (o *ListAdminWorkflowJobsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this list admin workflow jobs o k response has a 4xx status code
func (o *ListAdminWorkflowJobsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this list admin workflow jobs o k response has a 5xx status code
func (o *ListAdminWorkflowJobsOK) IsServerError() bool {
return false
}
// IsCode returns true when this list admin workflow jobs o k response a status code equal to that given
func (o *ListAdminWorkflowJobsOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the list admin workflow jobs o k response
func (o *ListAdminWorkflowJobsOK) Code() int {
return 200
}
func (o *ListAdminWorkflowJobsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /admin/actions/jobs][%d] listAdminWorkflowJobsOK %s", 200, payload)
}
func (o *ListAdminWorkflowJobsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /admin/actions/jobs][%d] listAdminWorkflowJobsOK %s", 200, payload)
}
func (o *ListAdminWorkflowJobsOK) GetPayload() *models.ActionWorkflowJobsResponse {
return o.Payload
}
func (o *ListAdminWorkflowJobsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.ActionWorkflowJobsResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewListAdminWorkflowJobsBadRequest creates a ListAdminWorkflowJobsBadRequest with default headers values
func NewListAdminWorkflowJobsBadRequest() *ListAdminWorkflowJobsBadRequest {
return &ListAdminWorkflowJobsBadRequest{}
}
/*
ListAdminWorkflowJobsBadRequest describes a response with status code 400, with default header values.
APIError is error format response
*/
type ListAdminWorkflowJobsBadRequest struct {
Message string
URL string
}
// IsSuccess returns true when this list admin workflow jobs bad request response has a 2xx status code
func (o *ListAdminWorkflowJobsBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this list admin workflow jobs bad request response has a 3xx status code
func (o *ListAdminWorkflowJobsBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this list admin workflow jobs bad request response has a 4xx status code
func (o *ListAdminWorkflowJobsBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this list admin workflow jobs bad request response has a 5xx status code
func (o *ListAdminWorkflowJobsBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this list admin workflow jobs bad request response a status code equal to that given
func (o *ListAdminWorkflowJobsBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the list admin workflow jobs bad request response
func (o *ListAdminWorkflowJobsBadRequest) Code() int {
return 400
}
func (o *ListAdminWorkflowJobsBadRequest) Error() string {
return fmt.Sprintf("[GET /admin/actions/jobs][%d] listAdminWorkflowJobsBadRequest", 400)
}
func (o *ListAdminWorkflowJobsBadRequest) String() string {
return fmt.Sprintf("[GET /admin/actions/jobs][%d] listAdminWorkflowJobsBadRequest", 400)
}
func (o *ListAdminWorkflowJobsBadRequest) 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
}
// NewListAdminWorkflowJobsNotFound creates a ListAdminWorkflowJobsNotFound with default headers values
func NewListAdminWorkflowJobsNotFound() *ListAdminWorkflowJobsNotFound {
return &ListAdminWorkflowJobsNotFound{}
}
/*
ListAdminWorkflowJobsNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type ListAdminWorkflowJobsNotFound struct {
}
// IsSuccess returns true when this list admin workflow jobs not found response has a 2xx status code
func (o *ListAdminWorkflowJobsNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this list admin workflow jobs not found response has a 3xx status code
func (o *ListAdminWorkflowJobsNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this list admin workflow jobs not found response has a 4xx status code
func (o *ListAdminWorkflowJobsNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this list admin workflow jobs not found response has a 5xx status code
func (o *ListAdminWorkflowJobsNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this list admin workflow jobs not found response a status code equal to that given
func (o *ListAdminWorkflowJobsNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the list admin workflow jobs not found response
func (o *ListAdminWorkflowJobsNotFound) Code() int {
return 404
}
func (o *ListAdminWorkflowJobsNotFound) Error() string {
return fmt.Sprintf("[GET /admin/actions/jobs][%d] listAdminWorkflowJobsNotFound", 404)
}
func (o *ListAdminWorkflowJobsNotFound) String() string {
return fmt.Sprintf("[GET /admin/actions/jobs][%d] listAdminWorkflowJobsNotFound", 404)
}
func (o *ListAdminWorkflowJobsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -0,0 +1,368 @@
// 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"
)
// NewListAdminWorkflowRunsParams creates a new ListAdminWorkflowRunsParams 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 NewListAdminWorkflowRunsParams() *ListAdminWorkflowRunsParams {
return &ListAdminWorkflowRunsParams{
timeout: cr.DefaultTimeout,
}
}
// NewListAdminWorkflowRunsParamsWithTimeout creates a new ListAdminWorkflowRunsParams object
// with the ability to set a timeout on a request.
func NewListAdminWorkflowRunsParamsWithTimeout(timeout time.Duration) *ListAdminWorkflowRunsParams {
return &ListAdminWorkflowRunsParams{
timeout: timeout,
}
}
// NewListAdminWorkflowRunsParamsWithContext creates a new ListAdminWorkflowRunsParams object
// with the ability to set a context for a request.
func NewListAdminWorkflowRunsParamsWithContext(ctx context.Context) *ListAdminWorkflowRunsParams {
return &ListAdminWorkflowRunsParams{
Context: ctx,
}
}
// NewListAdminWorkflowRunsParamsWithHTTPClient creates a new ListAdminWorkflowRunsParams object
// with the ability to set a custom HTTPClient for a request.
func NewListAdminWorkflowRunsParamsWithHTTPClient(client *http.Client) *ListAdminWorkflowRunsParams {
return &ListAdminWorkflowRunsParams{
HTTPClient: client,
}
}
/*
ListAdminWorkflowRunsParams contains all the parameters to send to the API endpoint
for the list admin workflow runs operation.
Typically these are written to a http.Request.
*/
type ListAdminWorkflowRunsParams struct {
/* Actor.
triggered by user
*/
Actor *string
/* Branch.
workflow branch
*/
Branch *string
/* Event.
workflow event name
*/
Event *string
/* HeadSha.
triggering sha of the workflow run
*/
HeadSha *string
/* Limit.
page size of results
*/
Limit *int64
/* Page.
page number of results to return (1-based)
*/
Page *int64
/* Status.
workflow status (pending, queued, in_progress, failure, success, skipped)
*/
Status *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the list admin workflow runs params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListAdminWorkflowRunsParams) WithDefaults() *ListAdminWorkflowRunsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the list admin workflow runs params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListAdminWorkflowRunsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the list admin workflow runs params
func (o *ListAdminWorkflowRunsParams) WithTimeout(timeout time.Duration) *ListAdminWorkflowRunsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the list admin workflow runs params
func (o *ListAdminWorkflowRunsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the list admin workflow runs params
func (o *ListAdminWorkflowRunsParams) WithContext(ctx context.Context) *ListAdminWorkflowRunsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the list admin workflow runs params
func (o *ListAdminWorkflowRunsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the list admin workflow runs params
func (o *ListAdminWorkflowRunsParams) WithHTTPClient(client *http.Client) *ListAdminWorkflowRunsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the list admin workflow runs params
func (o *ListAdminWorkflowRunsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithActor adds the actor to the list admin workflow runs params
func (o *ListAdminWorkflowRunsParams) WithActor(actor *string) *ListAdminWorkflowRunsParams {
o.SetActor(actor)
return o
}
// SetActor adds the actor to the list admin workflow runs params
func (o *ListAdminWorkflowRunsParams) SetActor(actor *string) {
o.Actor = actor
}
// WithBranch adds the branch to the list admin workflow runs params
func (o *ListAdminWorkflowRunsParams) WithBranch(branch *string) *ListAdminWorkflowRunsParams {
o.SetBranch(branch)
return o
}
// SetBranch adds the branch to the list admin workflow runs params
func (o *ListAdminWorkflowRunsParams) SetBranch(branch *string) {
o.Branch = branch
}
// WithEvent adds the event to the list admin workflow runs params
func (o *ListAdminWorkflowRunsParams) WithEvent(event *string) *ListAdminWorkflowRunsParams {
o.SetEvent(event)
return o
}
// SetEvent adds the event to the list admin workflow runs params
func (o *ListAdminWorkflowRunsParams) SetEvent(event *string) {
o.Event = event
}
// WithHeadSha adds the headSha to the list admin workflow runs params
func (o *ListAdminWorkflowRunsParams) WithHeadSha(headSha *string) *ListAdminWorkflowRunsParams {
o.SetHeadSha(headSha)
return o
}
// SetHeadSha adds the headSha to the list admin workflow runs params
func (o *ListAdminWorkflowRunsParams) SetHeadSha(headSha *string) {
o.HeadSha = headSha
}
// WithLimit adds the limit to the list admin workflow runs params
func (o *ListAdminWorkflowRunsParams) WithLimit(limit *int64) *ListAdminWorkflowRunsParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the list admin workflow runs params
func (o *ListAdminWorkflowRunsParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithPage adds the page to the list admin workflow runs params
func (o *ListAdminWorkflowRunsParams) WithPage(page *int64) *ListAdminWorkflowRunsParams {
o.SetPage(page)
return o
}
// SetPage adds the page to the list admin workflow runs params
func (o *ListAdminWorkflowRunsParams) SetPage(page *int64) {
o.Page = page
}
// WithStatus adds the status to the list admin workflow runs params
func (o *ListAdminWorkflowRunsParams) WithStatus(status *string) *ListAdminWorkflowRunsParams {
o.SetStatus(status)
return o
}
// SetStatus adds the status to the list admin workflow runs params
func (o *ListAdminWorkflowRunsParams) SetStatus(status *string) {
o.Status = status
}
// WriteToRequest writes these params to a swagger request
func (o *ListAdminWorkflowRunsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.Actor != nil {
// query param actor
var qrActor string
if o.Actor != nil {
qrActor = *o.Actor
}
qActor := qrActor
if qActor != "" {
if err := r.SetQueryParam("actor", qActor); err != nil {
return err
}
}
}
if o.Branch != nil {
// query param branch
var qrBranch string
if o.Branch != nil {
qrBranch = *o.Branch
}
qBranch := qrBranch
if qBranch != "" {
if err := r.SetQueryParam("branch", qBranch); err != nil {
return err
}
}
}
if o.Event != nil {
// query param event
var qrEvent string
if o.Event != nil {
qrEvent = *o.Event
}
qEvent := qrEvent
if qEvent != "" {
if err := r.SetQueryParam("event", qEvent); err != nil {
return err
}
}
}
if o.HeadSha != nil {
// query param head_sha
var qrHeadSha string
if o.HeadSha != nil {
qrHeadSha = *o.HeadSha
}
qHeadSha := qrHeadSha
if qHeadSha != "" {
if err := r.SetQueryParam("head_sha", qHeadSha); err != nil {
return err
}
}
}
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.Status != nil {
// query param status
var qrStatus string
if o.Status != nil {
qrStatus = *o.Status
}
qStatus := qrStatus
if qStatus != "" {
if err := r.SetQueryParam("status", qStatus); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,246 @@
// 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"
)
// ListAdminWorkflowRunsReader is a Reader for the ListAdminWorkflowRuns structure.
type ListAdminWorkflowRunsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ListAdminWorkflowRunsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewListAdminWorkflowRunsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewListAdminWorkflowRunsBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewListAdminWorkflowRunsNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /admin/actions/runs] listAdminWorkflowRuns", response, response.Code())
}
}
// NewListAdminWorkflowRunsOK creates a ListAdminWorkflowRunsOK with default headers values
func NewListAdminWorkflowRunsOK() *ListAdminWorkflowRunsOK {
return &ListAdminWorkflowRunsOK{}
}
/*
ListAdminWorkflowRunsOK describes a response with status code 200, with default header values.
WorkflowRunsList
*/
type ListAdminWorkflowRunsOK struct {
Payload *models.ActionWorkflowRunsResponse
}
// IsSuccess returns true when this list admin workflow runs o k response has a 2xx status code
func (o *ListAdminWorkflowRunsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this list admin workflow runs o k response has a 3xx status code
func (o *ListAdminWorkflowRunsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this list admin workflow runs o k response has a 4xx status code
func (o *ListAdminWorkflowRunsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this list admin workflow runs o k response has a 5xx status code
func (o *ListAdminWorkflowRunsOK) IsServerError() bool {
return false
}
// IsCode returns true when this list admin workflow runs o k response a status code equal to that given
func (o *ListAdminWorkflowRunsOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the list admin workflow runs o k response
func (o *ListAdminWorkflowRunsOK) Code() int {
return 200
}
func (o *ListAdminWorkflowRunsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /admin/actions/runs][%d] listAdminWorkflowRunsOK %s", 200, payload)
}
func (o *ListAdminWorkflowRunsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /admin/actions/runs][%d] listAdminWorkflowRunsOK %s", 200, payload)
}
func (o *ListAdminWorkflowRunsOK) GetPayload() *models.ActionWorkflowRunsResponse {
return o.Payload
}
func (o *ListAdminWorkflowRunsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.ActionWorkflowRunsResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewListAdminWorkflowRunsBadRequest creates a ListAdminWorkflowRunsBadRequest with default headers values
func NewListAdminWorkflowRunsBadRequest() *ListAdminWorkflowRunsBadRequest {
return &ListAdminWorkflowRunsBadRequest{}
}
/*
ListAdminWorkflowRunsBadRequest describes a response with status code 400, with default header values.
APIError is error format response
*/
type ListAdminWorkflowRunsBadRequest struct {
Message string
URL string
}
// IsSuccess returns true when this list admin workflow runs bad request response has a 2xx status code
func (o *ListAdminWorkflowRunsBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this list admin workflow runs bad request response has a 3xx status code
func (o *ListAdminWorkflowRunsBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this list admin workflow runs bad request response has a 4xx status code
func (o *ListAdminWorkflowRunsBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this list admin workflow runs bad request response has a 5xx status code
func (o *ListAdminWorkflowRunsBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this list admin workflow runs bad request response a status code equal to that given
func (o *ListAdminWorkflowRunsBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the list admin workflow runs bad request response
func (o *ListAdminWorkflowRunsBadRequest) Code() int {
return 400
}
func (o *ListAdminWorkflowRunsBadRequest) Error() string {
return fmt.Sprintf("[GET /admin/actions/runs][%d] listAdminWorkflowRunsBadRequest", 400)
}
func (o *ListAdminWorkflowRunsBadRequest) String() string {
return fmt.Sprintf("[GET /admin/actions/runs][%d] listAdminWorkflowRunsBadRequest", 400)
}
func (o *ListAdminWorkflowRunsBadRequest) 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
}
// NewListAdminWorkflowRunsNotFound creates a ListAdminWorkflowRunsNotFound with default headers values
func NewListAdminWorkflowRunsNotFound() *ListAdminWorkflowRunsNotFound {
return &ListAdminWorkflowRunsNotFound{}
}
/*
ListAdminWorkflowRunsNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type ListAdminWorkflowRunsNotFound struct {
}
// IsSuccess returns true when this list admin workflow runs not found response has a 2xx status code
func (o *ListAdminWorkflowRunsNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this list admin workflow runs not found response has a 3xx status code
func (o *ListAdminWorkflowRunsNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this list admin workflow runs not found response has a 4xx status code
func (o *ListAdminWorkflowRunsNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this list admin workflow runs not found response has a 5xx status code
func (o *ListAdminWorkflowRunsNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this list admin workflow runs not found response a status code equal to that given
func (o *ListAdminWorkflowRunsNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the list admin workflow runs not found response
func (o *ListAdminWorkflowRunsNotFound) Code() int {
return 404
}
func (o *ListAdminWorkflowRunsNotFound) Error() string {
return fmt.Sprintf("[GET /admin/actions/runs][%d] listAdminWorkflowRunsNotFound", 404)
}
func (o *ListAdminWorkflowRunsNotFound) String() string {
return fmt.Sprintf("[GET /admin/actions/runs][%d] listAdminWorkflowRunsNotFound", 404)
}
func (o *ListAdminWorkflowRunsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -84,7 +84,7 @@ type IssueAddSubscriptionParams struct {
/* User.
user to subscribe
username of the user to subscribe the issue to
*/
User string

View File

@@ -209,6 +209,8 @@ type ClientService interface {
IssueListLabels(params *IssueListLabelsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*IssueListLabelsOK, error)
IssueLockIssue(params *IssueLockIssueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*IssueLockIssueNoContent, error)
IssuePostCommentReaction(params *IssuePostCommentReactionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*IssuePostCommentReactionOK, *IssuePostCommentReactionCreated, error)
IssuePostIssueReaction(params *IssuePostIssueReactionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*IssuePostIssueReactionOK, *IssuePostIssueReactionCreated, error)
@@ -233,6 +235,8 @@ type ClientService interface {
IssueTrackedTimes(params *IssueTrackedTimesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*IssueTrackedTimesOK, error)
IssueUnlockIssue(params *IssueUnlockIssueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*IssueUnlockIssueNoContent, error)
MoveIssuePin(params *MoveIssuePinParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MoveIssuePinNoContent, error)
PinIssue(params *PinIssueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PinIssueNoContent, error)
@@ -2275,6 +2279,45 @@ func (a *Client) IssueListLabels(params *IssueListLabelsParams, authInfo runtime
panic(msg)
}
/*
IssueLockIssue locks an issue
*/
func (a *Client) IssueLockIssue(params *IssueLockIssueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*IssueLockIssueNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewIssueLockIssueParams()
}
op := &runtime.ClientOperation{
ID: "issueLockIssue",
Method: "PUT",
PathPattern: "/repos/{owner}/{repo}/issues/{index}/lock",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &IssueLockIssueReader{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.(*IssueLockIssueNoContent)
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 issueLockIssue: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
IssuePostCommentReaction adds a reaction to a comment of an issue
*/
@@ -2745,6 +2788,45 @@ func (a *Client) IssueTrackedTimes(params *IssueTrackedTimesParams, authInfo run
panic(msg)
}
/*
IssueUnlockIssue unlocks an issue
*/
func (a *Client) IssueUnlockIssue(params *IssueUnlockIssueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*IssueUnlockIssueNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewIssueUnlockIssueParams()
}
op := &runtime.ClientOperation{
ID: "issueUnlockIssue",
Method: "DELETE",
PathPattern: "/repos/{owner}/{repo}/issues/{index}/lock",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &IssueUnlockIssueReader{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.(*IssueUnlockIssueNoContent)
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 issueUnlockIssue: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
MoveIssuePin moves the pin to the given position
*/

View File

@@ -42,6 +42,12 @@ func (o *IssueCreateIssueAttachmentReader) ReadResponse(response runtime.ClientR
return nil, err
}
return nil, result
case 413:
result := NewIssueCreateIssueAttachmentRequestEntityTooLarge()
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 {
@@ -273,6 +279,78 @@ func (o *IssueCreateIssueAttachmentNotFound) readResponse(response runtime.Clien
return nil
}
// NewIssueCreateIssueAttachmentRequestEntityTooLarge creates a IssueCreateIssueAttachmentRequestEntityTooLarge with default headers values
func NewIssueCreateIssueAttachmentRequestEntityTooLarge() *IssueCreateIssueAttachmentRequestEntityTooLarge {
return &IssueCreateIssueAttachmentRequestEntityTooLarge{}
}
/*
IssueCreateIssueAttachmentRequestEntityTooLarge describes a response with status code 413, with default header values.
APIError is error format response
*/
type IssueCreateIssueAttachmentRequestEntityTooLarge struct {
Message string
URL string
}
// IsSuccess returns true when this issue create issue attachment request entity too large response has a 2xx status code
func (o *IssueCreateIssueAttachmentRequestEntityTooLarge) IsSuccess() bool {
return false
}
// IsRedirect returns true when this issue create issue attachment request entity too large response has a 3xx status code
func (o *IssueCreateIssueAttachmentRequestEntityTooLarge) IsRedirect() bool {
return false
}
// IsClientError returns true when this issue create issue attachment request entity too large response has a 4xx status code
func (o *IssueCreateIssueAttachmentRequestEntityTooLarge) IsClientError() bool {
return true
}
// IsServerError returns true when this issue create issue attachment request entity too large response has a 5xx status code
func (o *IssueCreateIssueAttachmentRequestEntityTooLarge) IsServerError() bool {
return false
}
// IsCode returns true when this issue create issue attachment request entity too large response a status code equal to that given
func (o *IssueCreateIssueAttachmentRequestEntityTooLarge) IsCode(code int) bool {
return code == 413
}
// Code gets the status code for the issue create issue attachment request entity too large response
func (o *IssueCreateIssueAttachmentRequestEntityTooLarge) Code() int {
return 413
}
func (o *IssueCreateIssueAttachmentRequestEntityTooLarge) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/assets][%d] issueCreateIssueAttachmentRequestEntityTooLarge", 413)
}
func (o *IssueCreateIssueAttachmentRequestEntityTooLarge) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/assets][%d] issueCreateIssueAttachmentRequestEntityTooLarge", 413)
}
func (o *IssueCreateIssueAttachmentRequestEntityTooLarge) 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{}

View File

@@ -48,6 +48,12 @@ func (o *IssueCreateIssueCommentAttachmentReader) ReadResponse(response runtime.
return nil, err
}
return nil, result
case 413:
result := NewIssueCreateIssueCommentAttachmentRequestEntityTooLarge()
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 {
@@ -351,6 +357,78 @@ func (o *IssueCreateIssueCommentAttachmentNotFound) readResponse(response runtim
return nil
}
// NewIssueCreateIssueCommentAttachmentRequestEntityTooLarge creates a IssueCreateIssueCommentAttachmentRequestEntityTooLarge with default headers values
func NewIssueCreateIssueCommentAttachmentRequestEntityTooLarge() *IssueCreateIssueCommentAttachmentRequestEntityTooLarge {
return &IssueCreateIssueCommentAttachmentRequestEntityTooLarge{}
}
/*
IssueCreateIssueCommentAttachmentRequestEntityTooLarge describes a response with status code 413, with default header values.
APIError is error format response
*/
type IssueCreateIssueCommentAttachmentRequestEntityTooLarge struct {
Message string
URL string
}
// IsSuccess returns true when this issue create issue comment attachment request entity too large response has a 2xx status code
func (o *IssueCreateIssueCommentAttachmentRequestEntityTooLarge) IsSuccess() bool {
return false
}
// IsRedirect returns true when this issue create issue comment attachment request entity too large response has a 3xx status code
func (o *IssueCreateIssueCommentAttachmentRequestEntityTooLarge) IsRedirect() bool {
return false
}
// IsClientError returns true when this issue create issue comment attachment request entity too large response has a 4xx status code
func (o *IssueCreateIssueCommentAttachmentRequestEntityTooLarge) IsClientError() bool {
return true
}
// IsServerError returns true when this issue create issue comment attachment request entity too large response has a 5xx status code
func (o *IssueCreateIssueCommentAttachmentRequestEntityTooLarge) IsServerError() bool {
return false
}
// IsCode returns true when this issue create issue comment attachment request entity too large response a status code equal to that given
func (o *IssueCreateIssueCommentAttachmentRequestEntityTooLarge) IsCode(code int) bool {
return code == 413
}
// Code gets the status code for the issue create issue comment attachment request entity too large response
func (o *IssueCreateIssueCommentAttachmentRequestEntityTooLarge) Code() int {
return 413
}
func (o *IssueCreateIssueCommentAttachmentRequestEntityTooLarge) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentRequestEntityTooLarge", 413)
}
func (o *IssueCreateIssueCommentAttachmentRequestEntityTooLarge) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentRequestEntityTooLarge", 413)
}
func (o *IssueCreateIssueCommentAttachmentRequestEntityTooLarge) 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{}

View File

@@ -225,7 +225,7 @@ func NewIssueDeleteStopWatchConflict() *IssueDeleteStopWatchConflict {
/*
IssueDeleteStopWatchConflict describes a response with status code 409, with default header values.
Cannot cancel a non existent stopwatch
Cannot cancel a non-existent stopwatch
*/
type IssueDeleteStopWatchConflict struct {
}

View File

@@ -84,7 +84,7 @@ type IssueDeleteSubscriptionParams struct {
/* User.
user witch unsubscribe
username of the user to unsubscribe from an issue
*/
User string

View File

@@ -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"
)
// NewIssueLockIssueParams creates a new IssueLockIssueParams 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 NewIssueLockIssueParams() *IssueLockIssueParams {
return &IssueLockIssueParams{
timeout: cr.DefaultTimeout,
}
}
// NewIssueLockIssueParamsWithTimeout creates a new IssueLockIssueParams object
// with the ability to set a timeout on a request.
func NewIssueLockIssueParamsWithTimeout(timeout time.Duration) *IssueLockIssueParams {
return &IssueLockIssueParams{
timeout: timeout,
}
}
// NewIssueLockIssueParamsWithContext creates a new IssueLockIssueParams object
// with the ability to set a context for a request.
func NewIssueLockIssueParamsWithContext(ctx context.Context) *IssueLockIssueParams {
return &IssueLockIssueParams{
Context: ctx,
}
}
// NewIssueLockIssueParamsWithHTTPClient creates a new IssueLockIssueParams object
// with the ability to set a custom HTTPClient for a request.
func NewIssueLockIssueParamsWithHTTPClient(client *http.Client) *IssueLockIssueParams {
return &IssueLockIssueParams{
HTTPClient: client,
}
}
/*
IssueLockIssueParams contains all the parameters to send to the API endpoint
for the issue lock issue operation.
Typically these are written to a http.Request.
*/
type IssueLockIssueParams struct {
// Body.
Body *models.LockIssueOption
/* 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 lock issue params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *IssueLockIssueParams) WithDefaults() *IssueLockIssueParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the issue lock issue params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *IssueLockIssueParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the issue lock issue params
func (o *IssueLockIssueParams) WithTimeout(timeout time.Duration) *IssueLockIssueParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the issue lock issue params
func (o *IssueLockIssueParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the issue lock issue params
func (o *IssueLockIssueParams) WithContext(ctx context.Context) *IssueLockIssueParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the issue lock issue params
func (o *IssueLockIssueParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the issue lock issue params
func (o *IssueLockIssueParams) WithHTTPClient(client *http.Client) *IssueLockIssueParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the issue lock issue params
func (o *IssueLockIssueParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the issue lock issue params
func (o *IssueLockIssueParams) WithBody(body *models.LockIssueOption) *IssueLockIssueParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the issue lock issue params
func (o *IssueLockIssueParams) SetBody(body *models.LockIssueOption) {
o.Body = body
}
// WithIndex adds the index to the issue lock issue params
func (o *IssueLockIssueParams) WithIndex(index int64) *IssueLockIssueParams {
o.SetIndex(index)
return o
}
// SetIndex adds the index to the issue lock issue params
func (o *IssueLockIssueParams) SetIndex(index int64) {
o.Index = index
}
// WithOwner adds the owner to the issue lock issue params
func (o *IssueLockIssueParams) WithOwner(owner string) *IssueLockIssueParams {
o.SetOwner(owner)
return o
}
// SetOwner adds the owner to the issue lock issue params
func (o *IssueLockIssueParams) SetOwner(owner string) {
o.Owner = owner
}
// WithRepo adds the repo to the issue lock issue params
func (o *IssueLockIssueParams) WithRepo(repo string) *IssueLockIssueParams {
o.SetRepo(repo)
return o
}
// SetRepo adds the repo to the issue lock issue params
func (o *IssueLockIssueParams) SetRepo(repo string) {
o.Repo = repo
}
// WriteToRequest writes these params to a swagger request
func (o *IssueLockIssueParams) 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
}

View File

@@ -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"
)
// IssueLockIssueReader is a Reader for the IssueLockIssue structure.
type IssueLockIssueReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *IssueLockIssueReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 204:
result := NewIssueLockIssueNoContent()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 403:
result := NewIssueLockIssueForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewIssueLockIssueNotFound()
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}/lock] issueLockIssue", response, response.Code())
}
}
// NewIssueLockIssueNoContent creates a IssueLockIssueNoContent with default headers values
func NewIssueLockIssueNoContent() *IssueLockIssueNoContent {
return &IssueLockIssueNoContent{}
}
/*
IssueLockIssueNoContent describes a response with status code 204, with default header values.
APIEmpty is an empty response
*/
type IssueLockIssueNoContent struct {
}
// IsSuccess returns true when this issue lock issue no content response has a 2xx status code
func (o *IssueLockIssueNoContent) IsSuccess() bool {
return true
}
// IsRedirect returns true when this issue lock issue no content response has a 3xx status code
func (o *IssueLockIssueNoContent) IsRedirect() bool {
return false
}
// IsClientError returns true when this issue lock issue no content response has a 4xx status code
func (o *IssueLockIssueNoContent) IsClientError() bool {
return false
}
// IsServerError returns true when this issue lock issue no content response has a 5xx status code
func (o *IssueLockIssueNoContent) IsServerError() bool {
return false
}
// IsCode returns true when this issue lock issue no content response a status code equal to that given
func (o *IssueLockIssueNoContent) IsCode(code int) bool {
return code == 204
}
// Code gets the status code for the issue lock issue no content response
func (o *IssueLockIssueNoContent) Code() int {
return 204
}
func (o *IssueLockIssueNoContent) Error() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/issues/{index}/lock][%d] issueLockIssueNoContent", 204)
}
func (o *IssueLockIssueNoContent) String() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/issues/{index}/lock][%d] issueLockIssueNoContent", 204)
}
func (o *IssueLockIssueNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewIssueLockIssueForbidden creates a IssueLockIssueForbidden with default headers values
func NewIssueLockIssueForbidden() *IssueLockIssueForbidden {
return &IssueLockIssueForbidden{}
}
/*
IssueLockIssueForbidden describes a response with status code 403, with default header values.
APIForbiddenError is a forbidden error response
*/
type IssueLockIssueForbidden struct {
Message string
URL string
}
// IsSuccess returns true when this issue lock issue forbidden response has a 2xx status code
func (o *IssueLockIssueForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this issue lock issue forbidden response has a 3xx status code
func (o *IssueLockIssueForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this issue lock issue forbidden response has a 4xx status code
func (o *IssueLockIssueForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this issue lock issue forbidden response has a 5xx status code
func (o *IssueLockIssueForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this issue lock issue forbidden response a status code equal to that given
func (o *IssueLockIssueForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the issue lock issue forbidden response
func (o *IssueLockIssueForbidden) Code() int {
return 403
}
func (o *IssueLockIssueForbidden) Error() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/issues/{index}/lock][%d] issueLockIssueForbidden", 403)
}
func (o *IssueLockIssueForbidden) String() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/issues/{index}/lock][%d] issueLockIssueForbidden", 403)
}
func (o *IssueLockIssueForbidden) 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
}
// NewIssueLockIssueNotFound creates a IssueLockIssueNotFound with default headers values
func NewIssueLockIssueNotFound() *IssueLockIssueNotFound {
return &IssueLockIssueNotFound{}
}
/*
IssueLockIssueNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type IssueLockIssueNotFound struct {
}
// IsSuccess returns true when this issue lock issue not found response has a 2xx status code
func (o *IssueLockIssueNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this issue lock issue not found response has a 3xx status code
func (o *IssueLockIssueNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this issue lock issue not found response has a 4xx status code
func (o *IssueLockIssueNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this issue lock issue not found response has a 5xx status code
func (o *IssueLockIssueNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this issue lock issue not found response a status code equal to that given
func (o *IssueLockIssueNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the issue lock issue not found response
func (o *IssueLockIssueNotFound) Code() int {
return 404
}
func (o *IssueLockIssueNotFound) Error() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/issues/{index}/lock][%d] issueLockIssueNotFound", 404)
}
func (o *IssueLockIssueNotFound) String() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/issues/{index}/lock][%d] issueLockIssueNotFound", 404)
}
func (o *IssueLockIssueNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -225,7 +225,7 @@ func NewIssueStopStopWatchConflict() *IssueStopStopWatchConflict {
/*
IssueStopStopWatchConflict describes a response with status code 409, with default header values.
Cannot stop a non existent stopwatch
Cannot stop a non-existent stopwatch
*/
type IssueStopStopWatchConflict struct {
}

View File

@@ -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"
)
// NewIssueUnlockIssueParams creates a new IssueUnlockIssueParams 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 NewIssueUnlockIssueParams() *IssueUnlockIssueParams {
return &IssueUnlockIssueParams{
timeout: cr.DefaultTimeout,
}
}
// NewIssueUnlockIssueParamsWithTimeout creates a new IssueUnlockIssueParams object
// with the ability to set a timeout on a request.
func NewIssueUnlockIssueParamsWithTimeout(timeout time.Duration) *IssueUnlockIssueParams {
return &IssueUnlockIssueParams{
timeout: timeout,
}
}
// NewIssueUnlockIssueParamsWithContext creates a new IssueUnlockIssueParams object
// with the ability to set a context for a request.
func NewIssueUnlockIssueParamsWithContext(ctx context.Context) *IssueUnlockIssueParams {
return &IssueUnlockIssueParams{
Context: ctx,
}
}
// NewIssueUnlockIssueParamsWithHTTPClient creates a new IssueUnlockIssueParams object
// with the ability to set a custom HTTPClient for a request.
func NewIssueUnlockIssueParamsWithHTTPClient(client *http.Client) *IssueUnlockIssueParams {
return &IssueUnlockIssueParams{
HTTPClient: client,
}
}
/*
IssueUnlockIssueParams contains all the parameters to send to the API endpoint
for the issue unlock issue operation.
Typically these are written to a http.Request.
*/
type IssueUnlockIssueParams 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 unlock issue params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *IssueUnlockIssueParams) WithDefaults() *IssueUnlockIssueParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the issue unlock issue params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *IssueUnlockIssueParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the issue unlock issue params
func (o *IssueUnlockIssueParams) WithTimeout(timeout time.Duration) *IssueUnlockIssueParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the issue unlock issue params
func (o *IssueUnlockIssueParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the issue unlock issue params
func (o *IssueUnlockIssueParams) WithContext(ctx context.Context) *IssueUnlockIssueParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the issue unlock issue params
func (o *IssueUnlockIssueParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the issue unlock issue params
func (o *IssueUnlockIssueParams) WithHTTPClient(client *http.Client) *IssueUnlockIssueParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the issue unlock issue params
func (o *IssueUnlockIssueParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithIndex adds the index to the issue unlock issue params
func (o *IssueUnlockIssueParams) WithIndex(index int64) *IssueUnlockIssueParams {
o.SetIndex(index)
return o
}
// SetIndex adds the index to the issue unlock issue params
func (o *IssueUnlockIssueParams) SetIndex(index int64) {
o.Index = index
}
// WithOwner adds the owner to the issue unlock issue params
func (o *IssueUnlockIssueParams) WithOwner(owner string) *IssueUnlockIssueParams {
o.SetOwner(owner)
return o
}
// SetOwner adds the owner to the issue unlock issue params
func (o *IssueUnlockIssueParams) SetOwner(owner string) {
o.Owner = owner
}
// WithRepo adds the repo to the issue unlock issue params
func (o *IssueUnlockIssueParams) WithRepo(repo string) *IssueUnlockIssueParams {
o.SetRepo(repo)
return o
}
// SetRepo adds the repo to the issue unlock issue params
func (o *IssueUnlockIssueParams) SetRepo(repo string) {
o.Repo = repo
}
// WriteToRequest writes these params to a swagger request
func (o *IssueUnlockIssueParams) 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
}

View File

@@ -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"
)
// IssueUnlockIssueReader is a Reader for the IssueUnlockIssue structure.
type IssueUnlockIssueReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *IssueUnlockIssueReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 204:
result := NewIssueUnlockIssueNoContent()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 403:
result := NewIssueUnlockIssueForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewIssueUnlockIssueNotFound()
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}/lock] issueUnlockIssue", response, response.Code())
}
}
// NewIssueUnlockIssueNoContent creates a IssueUnlockIssueNoContent with default headers values
func NewIssueUnlockIssueNoContent() *IssueUnlockIssueNoContent {
return &IssueUnlockIssueNoContent{}
}
/*
IssueUnlockIssueNoContent describes a response with status code 204, with default header values.
APIEmpty is an empty response
*/
type IssueUnlockIssueNoContent struct {
}
// IsSuccess returns true when this issue unlock issue no content response has a 2xx status code
func (o *IssueUnlockIssueNoContent) IsSuccess() bool {
return true
}
// IsRedirect returns true when this issue unlock issue no content response has a 3xx status code
func (o *IssueUnlockIssueNoContent) IsRedirect() bool {
return false
}
// IsClientError returns true when this issue unlock issue no content response has a 4xx status code
func (o *IssueUnlockIssueNoContent) IsClientError() bool {
return false
}
// IsServerError returns true when this issue unlock issue no content response has a 5xx status code
func (o *IssueUnlockIssueNoContent) IsServerError() bool {
return false
}
// IsCode returns true when this issue unlock issue no content response a status code equal to that given
func (o *IssueUnlockIssueNoContent) IsCode(code int) bool {
return code == 204
}
// Code gets the status code for the issue unlock issue no content response
func (o *IssueUnlockIssueNoContent) Code() int {
return 204
}
func (o *IssueUnlockIssueNoContent) Error() string {
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/{index}/lock][%d] issueUnlockIssueNoContent", 204)
}
func (o *IssueUnlockIssueNoContent) String() string {
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/{index}/lock][%d] issueUnlockIssueNoContent", 204)
}
func (o *IssueUnlockIssueNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewIssueUnlockIssueForbidden creates a IssueUnlockIssueForbidden with default headers values
func NewIssueUnlockIssueForbidden() *IssueUnlockIssueForbidden {
return &IssueUnlockIssueForbidden{}
}
/*
IssueUnlockIssueForbidden describes a response with status code 403, with default header values.
APIForbiddenError is a forbidden error response
*/
type IssueUnlockIssueForbidden struct {
Message string
URL string
}
// IsSuccess returns true when this issue unlock issue forbidden response has a 2xx status code
func (o *IssueUnlockIssueForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this issue unlock issue forbidden response has a 3xx status code
func (o *IssueUnlockIssueForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this issue unlock issue forbidden response has a 4xx status code
func (o *IssueUnlockIssueForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this issue unlock issue forbidden response has a 5xx status code
func (o *IssueUnlockIssueForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this issue unlock issue forbidden response a status code equal to that given
func (o *IssueUnlockIssueForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the issue unlock issue forbidden response
func (o *IssueUnlockIssueForbidden) Code() int {
return 403
}
func (o *IssueUnlockIssueForbidden) Error() string {
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/{index}/lock][%d] issueUnlockIssueForbidden", 403)
}
func (o *IssueUnlockIssueForbidden) String() string {
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/{index}/lock][%d] issueUnlockIssueForbidden", 403)
}
func (o *IssueUnlockIssueForbidden) 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
}
// NewIssueUnlockIssueNotFound creates a IssueUnlockIssueNotFound with default headers values
func NewIssueUnlockIssueNotFound() *IssueUnlockIssueNotFound {
return &IssueUnlockIssueNotFound{}
}
/*
IssueUnlockIssueNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type IssueUnlockIssueNotFound struct {
}
// IsSuccess returns true when this issue unlock issue not found response has a 2xx status code
func (o *IssueUnlockIssueNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this issue unlock issue not found response has a 3xx status code
func (o *IssueUnlockIssueNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this issue unlock issue not found response has a 4xx status code
func (o *IssueUnlockIssueNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this issue unlock issue not found response has a 5xx status code
func (o *IssueUnlockIssueNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this issue unlock issue not found response a status code equal to that given
func (o *IssueUnlockIssueNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the issue unlock issue not found response
func (o *IssueUnlockIssueNotFound) Code() int {
return 404
}
func (o *IssueUnlockIssueNotFound) Error() string {
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/{index}/lock][%d] issueUnlockIssueNotFound", 404)
}
func (o *IssueUnlockIssueNotFound) String() string {
return fmt.Sprintf("[DELETE /repos/{owner}/{repo}/issues/{index}/lock][%d] issueUnlockIssueNotFound", 404)
}
func (o *IssueUnlockIssueNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -0,0 +1,128 @@
// Code generated by go-swagger; DO NOT EDIT.
package miscellaneous
// 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"
)
// NewGetSigningKeySSHParams creates a new GetSigningKeySSHParams 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 NewGetSigningKeySSHParams() *GetSigningKeySSHParams {
return &GetSigningKeySSHParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetSigningKeySSHParamsWithTimeout creates a new GetSigningKeySSHParams object
// with the ability to set a timeout on a request.
func NewGetSigningKeySSHParamsWithTimeout(timeout time.Duration) *GetSigningKeySSHParams {
return &GetSigningKeySSHParams{
timeout: timeout,
}
}
// NewGetSigningKeySSHParamsWithContext creates a new GetSigningKeySSHParams object
// with the ability to set a context for a request.
func NewGetSigningKeySSHParamsWithContext(ctx context.Context) *GetSigningKeySSHParams {
return &GetSigningKeySSHParams{
Context: ctx,
}
}
// NewGetSigningKeySSHParamsWithHTTPClient creates a new GetSigningKeySSHParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetSigningKeySSHParamsWithHTTPClient(client *http.Client) *GetSigningKeySSHParams {
return &GetSigningKeySSHParams{
HTTPClient: client,
}
}
/*
GetSigningKeySSHParams contains all the parameters to send to the API endpoint
for the get signing key SSH operation.
Typically these are written to a http.Request.
*/
type GetSigningKeySSHParams struct {
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get signing key SSH params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetSigningKeySSHParams) WithDefaults() *GetSigningKeySSHParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get signing key SSH params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetSigningKeySSHParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get signing key SSH params
func (o *GetSigningKeySSHParams) WithTimeout(timeout time.Duration) *GetSigningKeySSHParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get signing key SSH params
func (o *GetSigningKeySSHParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get signing key SSH params
func (o *GetSigningKeySSHParams) WithContext(ctx context.Context) *GetSigningKeySSHParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get signing key SSH params
func (o *GetSigningKeySSHParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get signing key SSH params
func (o *GetSigningKeySSHParams) WithHTTPClient(client *http.Client) *GetSigningKeySSHParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get signing key SSH params
func (o *GetSigningKeySSHParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WriteToRequest writes these params to a swagger request
func (o *GetSigningKeySSHParams) 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
}

View File

@@ -0,0 +1,102 @@
// Code generated by go-swagger; DO NOT EDIT.
package miscellaneous
// 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"
)
// GetSigningKeySSHReader is a Reader for the GetSigningKeySSH structure.
type GetSigningKeySSHReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetSigningKeySSHReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetSigningKeySSHOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("[GET /signing-key.pub] getSigningKeySSH", response, response.Code())
}
}
// NewGetSigningKeySSHOK creates a GetSigningKeySSHOK with default headers values
func NewGetSigningKeySSHOK() *GetSigningKeySSHOK {
return &GetSigningKeySSHOK{}
}
/*
GetSigningKeySSHOK describes a response with status code 200, with default header values.
ssh public key
*/
type GetSigningKeySSHOK struct {
Payload string
}
// IsSuccess returns true when this get signing key Ssh o k response has a 2xx status code
func (o *GetSigningKeySSHOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get signing key Ssh o k response has a 3xx status code
func (o *GetSigningKeySSHOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get signing key Ssh o k response has a 4xx status code
func (o *GetSigningKeySSHOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get signing key Ssh o k response has a 5xx status code
func (o *GetSigningKeySSHOK) IsServerError() bool {
return false
}
// IsCode returns true when this get signing key Ssh o k response a status code equal to that given
func (o *GetSigningKeySSHOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the get signing key Ssh o k response
func (o *GetSigningKeySSHOK) Code() int {
return 200
}
func (o *GetSigningKeySSHOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /signing-key.pub][%d] getSigningKeySshOK %s", 200, payload)
}
func (o *GetSigningKeySSHOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /signing-key.pub][%d] getSigningKeySshOK %s", 200, payload)
}
func (o *GetSigningKeySSHOK) GetPayload() string {
return o.Payload
}
func (o *GetSigningKeySSHOK) 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
}

View File

@@ -115,6 +115,8 @@ type ClientService interface {
GetSigningKey(params *GetSigningKeyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSigningKeyOK, error)
GetSigningKeySSH(params *GetSigningKeySSHParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSigningKeySSHOK, error)
GetVersion(params *GetVersionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetVersionOK, error)
ListGitignoresTemplates(params *ListGitignoresTemplatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListGitignoresTemplatesOK, error)
@@ -327,6 +329,45 @@ func (a *Client) GetSigningKey(params *GetSigningKeyParams, authInfo runtime.Cli
panic(msg)
}
/*
GetSigningKeySSH gets default signing key pub
*/
func (a *Client) GetSigningKeySSH(params *GetSigningKeySSHParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSigningKeySSHOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetSigningKeySSHParams()
}
op := &runtime.ClientOperation{
ID: "getSigningKeySSH",
Method: "GET",
PathPattern: "/signing-key.pub",
ProducesMediaTypes: []string{"text/plain"},
ConsumesMediaTypes: []string{"application/json", "text/plain"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetSigningKeySSHReader{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.(*GetSigningKeySSHOK)
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 getSigningKeySSH: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetVersion returns the version of the gitea application
*/

View File

@@ -26,20 +26,20 @@ func (o *CreateOrgVariableReader) ReadResponse(response runtime.ClientResponse,
return nil, err
}
return result, nil
case 204:
result := NewCreateOrgVariableNoContent()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewCreateOrgVariableBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewCreateOrgVariableNotFound()
case 409:
result := NewCreateOrgVariableConflict()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewCreateOrgVariableInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
@@ -57,7 +57,7 @@ func NewCreateOrgVariableCreated() *CreateOrgVariableCreated {
/*
CreateOrgVariableCreated describes a response with status code 201, with default header values.
response when creating an org-level variable
successfully created the org-level variable
*/
type CreateOrgVariableCreated struct {
}
@@ -105,62 +105,6 @@ func (o *CreateOrgVariableCreated) readResponse(response runtime.ClientResponse,
return nil
}
// NewCreateOrgVariableNoContent creates a CreateOrgVariableNoContent with default headers values
func NewCreateOrgVariableNoContent() *CreateOrgVariableNoContent {
return &CreateOrgVariableNoContent{}
}
/*
CreateOrgVariableNoContent describes a response with status code 204, with default header values.
response when creating an org-level variable
*/
type CreateOrgVariableNoContent struct {
}
// IsSuccess returns true when this create org variable no content response has a 2xx status code
func (o *CreateOrgVariableNoContent) IsSuccess() bool {
return true
}
// IsRedirect returns true when this create org variable no content response has a 3xx status code
func (o *CreateOrgVariableNoContent) IsRedirect() bool {
return false
}
// IsClientError returns true when this create org variable no content response has a 4xx status code
func (o *CreateOrgVariableNoContent) IsClientError() bool {
return false
}
// IsServerError returns true when this create org variable no content response has a 5xx status code
func (o *CreateOrgVariableNoContent) IsServerError() bool {
return false
}
// IsCode returns true when this create org variable no content response a status code equal to that given
func (o *CreateOrgVariableNoContent) IsCode(code int) bool {
return code == 204
}
// Code gets the status code for the create org variable no content response
func (o *CreateOrgVariableNoContent) Code() int {
return 204
}
func (o *CreateOrgVariableNoContent) Error() string {
return fmt.Sprintf("[POST /orgs/{org}/actions/variables/{variablename}][%d] createOrgVariableNoContent", 204)
}
func (o *CreateOrgVariableNoContent) String() string {
return fmt.Sprintf("[POST /orgs/{org}/actions/variables/{variablename}][%d] createOrgVariableNoContent", 204)
}
func (o *CreateOrgVariableNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewCreateOrgVariableBadRequest creates a CreateOrgVariableBadRequest with default headers values
func NewCreateOrgVariableBadRequest() *CreateOrgVariableBadRequest {
return &CreateOrgVariableBadRequest{}
@@ -233,58 +177,130 @@ func (o *CreateOrgVariableBadRequest) readResponse(response runtime.ClientRespon
return nil
}
// NewCreateOrgVariableNotFound creates a CreateOrgVariableNotFound with default headers values
func NewCreateOrgVariableNotFound() *CreateOrgVariableNotFound {
return &CreateOrgVariableNotFound{}
// NewCreateOrgVariableConflict creates a CreateOrgVariableConflict with default headers values
func NewCreateOrgVariableConflict() *CreateOrgVariableConflict {
return &CreateOrgVariableConflict{}
}
/*
CreateOrgVariableNotFound describes a response with status code 404, with default header values.
CreateOrgVariableConflict describes a response with status code 409, with default header values.
APINotFound is a not found empty response
variable name already exists.
*/
type CreateOrgVariableNotFound struct {
type CreateOrgVariableConflict struct {
}
// IsSuccess returns true when this create org variable not found response has a 2xx status code
func (o *CreateOrgVariableNotFound) IsSuccess() bool {
// IsSuccess returns true when this create org variable conflict response has a 2xx status code
func (o *CreateOrgVariableConflict) IsSuccess() bool {
return false
}
// IsRedirect returns true when this create org variable not found response has a 3xx status code
func (o *CreateOrgVariableNotFound) IsRedirect() bool {
// IsRedirect returns true when this create org variable conflict response has a 3xx status code
func (o *CreateOrgVariableConflict) IsRedirect() bool {
return false
}
// IsClientError returns true when this create org variable not found response has a 4xx status code
func (o *CreateOrgVariableNotFound) IsClientError() bool {
// IsClientError returns true when this create org variable conflict response has a 4xx status code
func (o *CreateOrgVariableConflict) IsClientError() bool {
return true
}
// IsServerError returns true when this create org variable not found response has a 5xx status code
func (o *CreateOrgVariableNotFound) IsServerError() bool {
// IsServerError returns true when this create org variable conflict response has a 5xx status code
func (o *CreateOrgVariableConflict) IsServerError() bool {
return false
}
// IsCode returns true when this create org variable not found response a status code equal to that given
func (o *CreateOrgVariableNotFound) IsCode(code int) bool {
return code == 404
// IsCode returns true when this create org variable conflict response a status code equal to that given
func (o *CreateOrgVariableConflict) IsCode(code int) bool {
return code == 409
}
// Code gets the status code for the create org variable not found response
func (o *CreateOrgVariableNotFound) Code() int {
return 404
// Code gets the status code for the create org variable conflict response
func (o *CreateOrgVariableConflict) Code() int {
return 409
}
func (o *CreateOrgVariableNotFound) Error() string {
return fmt.Sprintf("[POST /orgs/{org}/actions/variables/{variablename}][%d] createOrgVariableNotFound", 404)
func (o *CreateOrgVariableConflict) Error() string {
return fmt.Sprintf("[POST /orgs/{org}/actions/variables/{variablename}][%d] createOrgVariableConflict", 409)
}
func (o *CreateOrgVariableNotFound) String() string {
return fmt.Sprintf("[POST /orgs/{org}/actions/variables/{variablename}][%d] createOrgVariableNotFound", 404)
func (o *CreateOrgVariableConflict) String() string {
return fmt.Sprintf("[POST /orgs/{org}/actions/variables/{variablename}][%d] createOrgVariableConflict", 409)
}
func (o *CreateOrgVariableNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
func (o *CreateOrgVariableConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewCreateOrgVariableInternalServerError creates a CreateOrgVariableInternalServerError with default headers values
func NewCreateOrgVariableInternalServerError() *CreateOrgVariableInternalServerError {
return &CreateOrgVariableInternalServerError{}
}
/*
CreateOrgVariableInternalServerError describes a response with status code 500, with default header values.
APIError is error format response
*/
type CreateOrgVariableInternalServerError struct {
Message string
URL string
}
// IsSuccess returns true when this create org variable internal server error response has a 2xx status code
func (o *CreateOrgVariableInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this create org variable internal server error response has a 3xx status code
func (o *CreateOrgVariableInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this create org variable internal server error response has a 4xx status code
func (o *CreateOrgVariableInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this create org variable internal server error response has a 5xx status code
func (o *CreateOrgVariableInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this create org variable internal server error response a status code equal to that given
func (o *CreateOrgVariableInternalServerError) IsCode(code int) bool {
return code == 500
}
// Code gets the status code for the create org variable internal server error response
func (o *CreateOrgVariableInternalServerError) Code() int {
return 500
}
func (o *CreateOrgVariableInternalServerError) Error() string {
return fmt.Sprintf("[POST /orgs/{org}/actions/variables/{variablename}][%d] createOrgVariableInternalServerError", 500)
}
func (o *CreateOrgVariableInternalServerError) String() string {
return fmt.Sprintf("[POST /orgs/{org}/actions/variables/{variablename}][%d] createOrgVariableInternalServerError", 500)
}
func (o *CreateOrgVariableInternalServerError) 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
}

View File

@@ -0,0 +1,173 @@
// Code generated by go-swagger; DO NOT EDIT.
package organization
// 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"
)
// NewDeleteOrgRunnerParams creates a new DeleteOrgRunnerParams 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 NewDeleteOrgRunnerParams() *DeleteOrgRunnerParams {
return &DeleteOrgRunnerParams{
timeout: cr.DefaultTimeout,
}
}
// NewDeleteOrgRunnerParamsWithTimeout creates a new DeleteOrgRunnerParams object
// with the ability to set a timeout on a request.
func NewDeleteOrgRunnerParamsWithTimeout(timeout time.Duration) *DeleteOrgRunnerParams {
return &DeleteOrgRunnerParams{
timeout: timeout,
}
}
// NewDeleteOrgRunnerParamsWithContext creates a new DeleteOrgRunnerParams object
// with the ability to set a context for a request.
func NewDeleteOrgRunnerParamsWithContext(ctx context.Context) *DeleteOrgRunnerParams {
return &DeleteOrgRunnerParams{
Context: ctx,
}
}
// NewDeleteOrgRunnerParamsWithHTTPClient creates a new DeleteOrgRunnerParams object
// with the ability to set a custom HTTPClient for a request.
func NewDeleteOrgRunnerParamsWithHTTPClient(client *http.Client) *DeleteOrgRunnerParams {
return &DeleteOrgRunnerParams{
HTTPClient: client,
}
}
/*
DeleteOrgRunnerParams contains all the parameters to send to the API endpoint
for the delete org runner operation.
Typically these are written to a http.Request.
*/
type DeleteOrgRunnerParams struct {
/* Org.
name of the organization
*/
Org string
/* RunnerID.
id of the runner
*/
RunnerID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the delete org runner params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *DeleteOrgRunnerParams) WithDefaults() *DeleteOrgRunnerParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the delete org runner params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *DeleteOrgRunnerParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the delete org runner params
func (o *DeleteOrgRunnerParams) WithTimeout(timeout time.Duration) *DeleteOrgRunnerParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete org runner params
func (o *DeleteOrgRunnerParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the delete org runner params
func (o *DeleteOrgRunnerParams) WithContext(ctx context.Context) *DeleteOrgRunnerParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete org runner params
func (o *DeleteOrgRunnerParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete org runner params
func (o *DeleteOrgRunnerParams) WithHTTPClient(client *http.Client) *DeleteOrgRunnerParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete org runner params
func (o *DeleteOrgRunnerParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithOrg adds the org to the delete org runner params
func (o *DeleteOrgRunnerParams) WithOrg(org string) *DeleteOrgRunnerParams {
o.SetOrg(org)
return o
}
// SetOrg adds the org to the delete org runner params
func (o *DeleteOrgRunnerParams) SetOrg(org string) {
o.Org = org
}
// WithRunnerID adds the runnerID to the delete org runner params
func (o *DeleteOrgRunnerParams) WithRunnerID(runnerID string) *DeleteOrgRunnerParams {
o.SetRunnerID(runnerID)
return o
}
// SetRunnerID adds the runnerId to the delete org runner params
func (o *DeleteOrgRunnerParams) SetRunnerID(runnerID string) {
o.RunnerID = runnerID
}
// WriteToRequest writes these params to a swagger request
func (o *DeleteOrgRunnerParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param org
if err := r.SetPathParam("org", o.Org); err != nil {
return err
}
// path param runner_id
if err := r.SetPathParam("runner_id", o.RunnerID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,228 @@
// Code generated by go-swagger; DO NOT EDIT.
package organization
// 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"
)
// DeleteOrgRunnerReader is a Reader for the DeleteOrgRunner structure.
type DeleteOrgRunnerReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *DeleteOrgRunnerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 204:
result := NewDeleteOrgRunnerNoContent()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewDeleteOrgRunnerBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewDeleteOrgRunnerNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[DELETE /orgs/{org}/actions/runners/{runner_id}] deleteOrgRunner", response, response.Code())
}
}
// NewDeleteOrgRunnerNoContent creates a DeleteOrgRunnerNoContent with default headers values
func NewDeleteOrgRunnerNoContent() *DeleteOrgRunnerNoContent {
return &DeleteOrgRunnerNoContent{}
}
/*
DeleteOrgRunnerNoContent describes a response with status code 204, with default header values.
runner has been deleted
*/
type DeleteOrgRunnerNoContent struct {
}
// IsSuccess returns true when this delete org runner no content response has a 2xx status code
func (o *DeleteOrgRunnerNoContent) IsSuccess() bool {
return true
}
// IsRedirect returns true when this delete org runner no content response has a 3xx status code
func (o *DeleteOrgRunnerNoContent) IsRedirect() bool {
return false
}
// IsClientError returns true when this delete org runner no content response has a 4xx status code
func (o *DeleteOrgRunnerNoContent) IsClientError() bool {
return false
}
// IsServerError returns true when this delete org runner no content response has a 5xx status code
func (o *DeleteOrgRunnerNoContent) IsServerError() bool {
return false
}
// IsCode returns true when this delete org runner no content response a status code equal to that given
func (o *DeleteOrgRunnerNoContent) IsCode(code int) bool {
return code == 204
}
// Code gets the status code for the delete org runner no content response
func (o *DeleteOrgRunnerNoContent) Code() int {
return 204
}
func (o *DeleteOrgRunnerNoContent) Error() string {
return fmt.Sprintf("[DELETE /orgs/{org}/actions/runners/{runner_id}][%d] deleteOrgRunnerNoContent", 204)
}
func (o *DeleteOrgRunnerNoContent) String() string {
return fmt.Sprintf("[DELETE /orgs/{org}/actions/runners/{runner_id}][%d] deleteOrgRunnerNoContent", 204)
}
func (o *DeleteOrgRunnerNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewDeleteOrgRunnerBadRequest creates a DeleteOrgRunnerBadRequest with default headers values
func NewDeleteOrgRunnerBadRequest() *DeleteOrgRunnerBadRequest {
return &DeleteOrgRunnerBadRequest{}
}
/*
DeleteOrgRunnerBadRequest describes a response with status code 400, with default header values.
APIError is error format response
*/
type DeleteOrgRunnerBadRequest struct {
Message string
URL string
}
// IsSuccess returns true when this delete org runner bad request response has a 2xx status code
func (o *DeleteOrgRunnerBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this delete org runner bad request response has a 3xx status code
func (o *DeleteOrgRunnerBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this delete org runner bad request response has a 4xx status code
func (o *DeleteOrgRunnerBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this delete org runner bad request response has a 5xx status code
func (o *DeleteOrgRunnerBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this delete org runner bad request response a status code equal to that given
func (o *DeleteOrgRunnerBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the delete org runner bad request response
func (o *DeleteOrgRunnerBadRequest) Code() int {
return 400
}
func (o *DeleteOrgRunnerBadRequest) Error() string {
return fmt.Sprintf("[DELETE /orgs/{org}/actions/runners/{runner_id}][%d] deleteOrgRunnerBadRequest", 400)
}
func (o *DeleteOrgRunnerBadRequest) String() string {
return fmt.Sprintf("[DELETE /orgs/{org}/actions/runners/{runner_id}][%d] deleteOrgRunnerBadRequest", 400)
}
func (o *DeleteOrgRunnerBadRequest) 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
}
// NewDeleteOrgRunnerNotFound creates a DeleteOrgRunnerNotFound with default headers values
func NewDeleteOrgRunnerNotFound() *DeleteOrgRunnerNotFound {
return &DeleteOrgRunnerNotFound{}
}
/*
DeleteOrgRunnerNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type DeleteOrgRunnerNotFound struct {
}
// IsSuccess returns true when this delete org runner not found response has a 2xx status code
func (o *DeleteOrgRunnerNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this delete org runner not found response has a 3xx status code
func (o *DeleteOrgRunnerNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this delete org runner not found response has a 4xx status code
func (o *DeleteOrgRunnerNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this delete org runner not found response has a 5xx status code
func (o *DeleteOrgRunnerNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this delete org runner not found response a status code equal to that given
func (o *DeleteOrgRunnerNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the delete org runner not found response
func (o *DeleteOrgRunnerNotFound) Code() int {
return 404
}
func (o *DeleteOrgRunnerNotFound) Error() string {
return fmt.Sprintf("[DELETE /orgs/{org}/actions/runners/{runner_id}][%d] deleteOrgRunnerNotFound", 404)
}
func (o *DeleteOrgRunnerNotFound) String() string {
return fmt.Sprintf("[DELETE /orgs/{org}/actions/runners/{runner_id}][%d] deleteOrgRunnerNotFound", 404)
}
func (o *DeleteOrgRunnerNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -0,0 +1,173 @@
// Code generated by go-swagger; DO NOT EDIT.
package organization
// 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"
)
// NewGetOrgRunnerParams creates a new GetOrgRunnerParams 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 NewGetOrgRunnerParams() *GetOrgRunnerParams {
return &GetOrgRunnerParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetOrgRunnerParamsWithTimeout creates a new GetOrgRunnerParams object
// with the ability to set a timeout on a request.
func NewGetOrgRunnerParamsWithTimeout(timeout time.Duration) *GetOrgRunnerParams {
return &GetOrgRunnerParams{
timeout: timeout,
}
}
// NewGetOrgRunnerParamsWithContext creates a new GetOrgRunnerParams object
// with the ability to set a context for a request.
func NewGetOrgRunnerParamsWithContext(ctx context.Context) *GetOrgRunnerParams {
return &GetOrgRunnerParams{
Context: ctx,
}
}
// NewGetOrgRunnerParamsWithHTTPClient creates a new GetOrgRunnerParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetOrgRunnerParamsWithHTTPClient(client *http.Client) *GetOrgRunnerParams {
return &GetOrgRunnerParams{
HTTPClient: client,
}
}
/*
GetOrgRunnerParams contains all the parameters to send to the API endpoint
for the get org runner operation.
Typically these are written to a http.Request.
*/
type GetOrgRunnerParams struct {
/* Org.
name of the organization
*/
Org string
/* RunnerID.
id of the runner
*/
RunnerID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get org runner params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetOrgRunnerParams) WithDefaults() *GetOrgRunnerParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get org runner params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetOrgRunnerParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get org runner params
func (o *GetOrgRunnerParams) WithTimeout(timeout time.Duration) *GetOrgRunnerParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get org runner params
func (o *GetOrgRunnerParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get org runner params
func (o *GetOrgRunnerParams) WithContext(ctx context.Context) *GetOrgRunnerParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get org runner params
func (o *GetOrgRunnerParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get org runner params
func (o *GetOrgRunnerParams) WithHTTPClient(client *http.Client) *GetOrgRunnerParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get org runner params
func (o *GetOrgRunnerParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithOrg adds the org to the get org runner params
func (o *GetOrgRunnerParams) WithOrg(org string) *GetOrgRunnerParams {
o.SetOrg(org)
return o
}
// SetOrg adds the org to the get org runner params
func (o *GetOrgRunnerParams) SetOrg(org string) {
o.Org = org
}
// WithRunnerID adds the runnerID to the get org runner params
func (o *GetOrgRunnerParams) WithRunnerID(runnerID string) *GetOrgRunnerParams {
o.SetRunnerID(runnerID)
return o
}
// SetRunnerID adds the runnerId to the get org runner params
func (o *GetOrgRunnerParams) SetRunnerID(runnerID string) {
o.RunnerID = runnerID
}
// WriteToRequest writes these params to a swagger request
func (o *GetOrgRunnerParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param org
if err := r.SetPathParam("org", o.Org); err != nil {
return err
}
// path param runner_id
if err := r.SetPathParam("runner_id", o.RunnerID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,228 @@
// Code generated by go-swagger; DO NOT EDIT.
package organization
// 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"
)
// GetOrgRunnerReader is a Reader for the GetOrgRunner structure.
type GetOrgRunnerReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetOrgRunnerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetOrgRunnerOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewGetOrgRunnerBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewGetOrgRunnerNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /orgs/{org}/actions/runners/{runner_id}] getOrgRunner", response, response.Code())
}
}
// NewGetOrgRunnerOK creates a GetOrgRunnerOK with default headers values
func NewGetOrgRunnerOK() *GetOrgRunnerOK {
return &GetOrgRunnerOK{}
}
/*
GetOrgRunnerOK describes a response with status code 200, with default header values.
ActionRunner represents a Runner
*/
type GetOrgRunnerOK struct {
}
// IsSuccess returns true when this get org runner o k response has a 2xx status code
func (o *GetOrgRunnerOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get org runner o k response has a 3xx status code
func (o *GetOrgRunnerOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get org runner o k response has a 4xx status code
func (o *GetOrgRunnerOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get org runner o k response has a 5xx status code
func (o *GetOrgRunnerOK) IsServerError() bool {
return false
}
// IsCode returns true when this get org runner o k response a status code equal to that given
func (o *GetOrgRunnerOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the get org runner o k response
func (o *GetOrgRunnerOK) Code() int {
return 200
}
func (o *GetOrgRunnerOK) Error() string {
return fmt.Sprintf("[GET /orgs/{org}/actions/runners/{runner_id}][%d] getOrgRunnerOK", 200)
}
func (o *GetOrgRunnerOK) String() string {
return fmt.Sprintf("[GET /orgs/{org}/actions/runners/{runner_id}][%d] getOrgRunnerOK", 200)
}
func (o *GetOrgRunnerOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewGetOrgRunnerBadRequest creates a GetOrgRunnerBadRequest with default headers values
func NewGetOrgRunnerBadRequest() *GetOrgRunnerBadRequest {
return &GetOrgRunnerBadRequest{}
}
/*
GetOrgRunnerBadRequest describes a response with status code 400, with default header values.
APIError is error format response
*/
type GetOrgRunnerBadRequest struct {
Message string
URL string
}
// IsSuccess returns true when this get org runner bad request response has a 2xx status code
func (o *GetOrgRunnerBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get org runner bad request response has a 3xx status code
func (o *GetOrgRunnerBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this get org runner bad request response has a 4xx status code
func (o *GetOrgRunnerBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this get org runner bad request response has a 5xx status code
func (o *GetOrgRunnerBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this get org runner bad request response a status code equal to that given
func (o *GetOrgRunnerBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the get org runner bad request response
func (o *GetOrgRunnerBadRequest) Code() int {
return 400
}
func (o *GetOrgRunnerBadRequest) Error() string {
return fmt.Sprintf("[GET /orgs/{org}/actions/runners/{runner_id}][%d] getOrgRunnerBadRequest", 400)
}
func (o *GetOrgRunnerBadRequest) String() string {
return fmt.Sprintf("[GET /orgs/{org}/actions/runners/{runner_id}][%d] getOrgRunnerBadRequest", 400)
}
func (o *GetOrgRunnerBadRequest) 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
}
// NewGetOrgRunnerNotFound creates a GetOrgRunnerNotFound with default headers values
func NewGetOrgRunnerNotFound() *GetOrgRunnerNotFound {
return &GetOrgRunnerNotFound{}
}
/*
GetOrgRunnerNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type GetOrgRunnerNotFound struct {
}
// IsSuccess returns true when this get org runner not found response has a 2xx status code
func (o *GetOrgRunnerNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get org runner not found response has a 3xx status code
func (o *GetOrgRunnerNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this get org runner not found response has a 4xx status code
func (o *GetOrgRunnerNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this get org runner not found response has a 5xx status code
func (o *GetOrgRunnerNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this get org runner not found response a status code equal to that given
func (o *GetOrgRunnerNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the get org runner not found response
func (o *GetOrgRunnerNotFound) Code() int {
return 404
}
func (o *GetOrgRunnerNotFound) Error() string {
return fmt.Sprintf("[GET /orgs/{org}/actions/runners/{runner_id}][%d] getOrgRunnerNotFound", 404)
}
func (o *GetOrgRunnerNotFound) String() string {
return fmt.Sprintf("[GET /orgs/{org}/actions/runners/{runner_id}][%d] getOrgRunnerNotFound", 404)
}
func (o *GetOrgRunnerNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package organization
// 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"
)
// NewGetOrgRunnersParams creates a new GetOrgRunnersParams 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 NewGetOrgRunnersParams() *GetOrgRunnersParams {
return &GetOrgRunnersParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetOrgRunnersParamsWithTimeout creates a new GetOrgRunnersParams object
// with the ability to set a timeout on a request.
func NewGetOrgRunnersParamsWithTimeout(timeout time.Duration) *GetOrgRunnersParams {
return &GetOrgRunnersParams{
timeout: timeout,
}
}
// NewGetOrgRunnersParamsWithContext creates a new GetOrgRunnersParams object
// with the ability to set a context for a request.
func NewGetOrgRunnersParamsWithContext(ctx context.Context) *GetOrgRunnersParams {
return &GetOrgRunnersParams{
Context: ctx,
}
}
// NewGetOrgRunnersParamsWithHTTPClient creates a new GetOrgRunnersParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetOrgRunnersParamsWithHTTPClient(client *http.Client) *GetOrgRunnersParams {
return &GetOrgRunnersParams{
HTTPClient: client,
}
}
/*
GetOrgRunnersParams contains all the parameters to send to the API endpoint
for the get org runners operation.
Typically these are written to a http.Request.
*/
type GetOrgRunnersParams struct {
/* Org.
name of the organization
*/
Org string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get org runners params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetOrgRunnersParams) WithDefaults() *GetOrgRunnersParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get org runners params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetOrgRunnersParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get org runners params
func (o *GetOrgRunnersParams) WithTimeout(timeout time.Duration) *GetOrgRunnersParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get org runners params
func (o *GetOrgRunnersParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get org runners params
func (o *GetOrgRunnersParams) WithContext(ctx context.Context) *GetOrgRunnersParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get org runners params
func (o *GetOrgRunnersParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get org runners params
func (o *GetOrgRunnersParams) WithHTTPClient(client *http.Client) *GetOrgRunnersParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get org runners params
func (o *GetOrgRunnersParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithOrg adds the org to the get org runners params
func (o *GetOrgRunnersParams) WithOrg(org string) *GetOrgRunnersParams {
o.SetOrg(org)
return o
}
// SetOrg adds the org to the get org runners params
func (o *GetOrgRunnersParams) SetOrg(org string) {
o.Org = org
}
// WriteToRequest writes these params to a swagger request
func (o *GetOrgRunnersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param org
if err := r.SetPathParam("org", o.Org); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,228 @@
// Code generated by go-swagger; DO NOT EDIT.
package organization
// 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"
)
// GetOrgRunnersReader is a Reader for the GetOrgRunners structure.
type GetOrgRunnersReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetOrgRunnersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetOrgRunnersOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewGetOrgRunnersBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewGetOrgRunnersNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /orgs/{org}/actions/runners] getOrgRunners", response, response.Code())
}
}
// NewGetOrgRunnersOK creates a GetOrgRunnersOK with default headers values
func NewGetOrgRunnersOK() *GetOrgRunnersOK {
return &GetOrgRunnersOK{}
}
/*
GetOrgRunnersOK describes a response with status code 200, with default header values.
ActionRunnersResponse returns Runners
*/
type GetOrgRunnersOK struct {
}
// IsSuccess returns true when this get org runners o k response has a 2xx status code
func (o *GetOrgRunnersOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get org runners o k response has a 3xx status code
func (o *GetOrgRunnersOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get org runners o k response has a 4xx status code
func (o *GetOrgRunnersOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get org runners o k response has a 5xx status code
func (o *GetOrgRunnersOK) IsServerError() bool {
return false
}
// IsCode returns true when this get org runners o k response a status code equal to that given
func (o *GetOrgRunnersOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the get org runners o k response
func (o *GetOrgRunnersOK) Code() int {
return 200
}
func (o *GetOrgRunnersOK) Error() string {
return fmt.Sprintf("[GET /orgs/{org}/actions/runners][%d] getOrgRunnersOK", 200)
}
func (o *GetOrgRunnersOK) String() string {
return fmt.Sprintf("[GET /orgs/{org}/actions/runners][%d] getOrgRunnersOK", 200)
}
func (o *GetOrgRunnersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewGetOrgRunnersBadRequest creates a GetOrgRunnersBadRequest with default headers values
func NewGetOrgRunnersBadRequest() *GetOrgRunnersBadRequest {
return &GetOrgRunnersBadRequest{}
}
/*
GetOrgRunnersBadRequest describes a response with status code 400, with default header values.
APIError is error format response
*/
type GetOrgRunnersBadRequest struct {
Message string
URL string
}
// IsSuccess returns true when this get org runners bad request response has a 2xx status code
func (o *GetOrgRunnersBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get org runners bad request response has a 3xx status code
func (o *GetOrgRunnersBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this get org runners bad request response has a 4xx status code
func (o *GetOrgRunnersBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this get org runners bad request response has a 5xx status code
func (o *GetOrgRunnersBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this get org runners bad request response a status code equal to that given
func (o *GetOrgRunnersBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the get org runners bad request response
func (o *GetOrgRunnersBadRequest) Code() int {
return 400
}
func (o *GetOrgRunnersBadRequest) Error() string {
return fmt.Sprintf("[GET /orgs/{org}/actions/runners][%d] getOrgRunnersBadRequest", 400)
}
func (o *GetOrgRunnersBadRequest) String() string {
return fmt.Sprintf("[GET /orgs/{org}/actions/runners][%d] getOrgRunnersBadRequest", 400)
}
func (o *GetOrgRunnersBadRequest) 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
}
// NewGetOrgRunnersNotFound creates a GetOrgRunnersNotFound with default headers values
func NewGetOrgRunnersNotFound() *GetOrgRunnersNotFound {
return &GetOrgRunnersNotFound{}
}
/*
GetOrgRunnersNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type GetOrgRunnersNotFound struct {
}
// IsSuccess returns true when this get org runners not found response has a 2xx status code
func (o *GetOrgRunnersNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get org runners not found response has a 3xx status code
func (o *GetOrgRunnersNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this get org runners not found response has a 4xx status code
func (o *GetOrgRunnersNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this get org runners not found response has a 5xx status code
func (o *GetOrgRunnersNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this get org runners not found response a status code equal to that given
func (o *GetOrgRunnersNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the get org runners not found response
func (o *GetOrgRunnersNotFound) Code() int {
return 404
}
func (o *GetOrgRunnersNotFound) Error() string {
return fmt.Sprintf("[GET /orgs/{org}/actions/runners][%d] getOrgRunnersNotFound", 404)
}
func (o *GetOrgRunnersNotFound) String() string {
return fmt.Sprintf("[GET /orgs/{org}/actions/runners][%d] getOrgRunnersNotFound", 404)
}
func (o *GetOrgRunnersNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -0,0 +1,254 @@
// Code generated by go-swagger; DO NOT EDIT.
package organization
// 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"
)
// NewGetOrgWorkflowJobsParams creates a new GetOrgWorkflowJobsParams 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 NewGetOrgWorkflowJobsParams() *GetOrgWorkflowJobsParams {
return &GetOrgWorkflowJobsParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetOrgWorkflowJobsParamsWithTimeout creates a new GetOrgWorkflowJobsParams object
// with the ability to set a timeout on a request.
func NewGetOrgWorkflowJobsParamsWithTimeout(timeout time.Duration) *GetOrgWorkflowJobsParams {
return &GetOrgWorkflowJobsParams{
timeout: timeout,
}
}
// NewGetOrgWorkflowJobsParamsWithContext creates a new GetOrgWorkflowJobsParams object
// with the ability to set a context for a request.
func NewGetOrgWorkflowJobsParamsWithContext(ctx context.Context) *GetOrgWorkflowJobsParams {
return &GetOrgWorkflowJobsParams{
Context: ctx,
}
}
// NewGetOrgWorkflowJobsParamsWithHTTPClient creates a new GetOrgWorkflowJobsParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetOrgWorkflowJobsParamsWithHTTPClient(client *http.Client) *GetOrgWorkflowJobsParams {
return &GetOrgWorkflowJobsParams{
HTTPClient: client,
}
}
/*
GetOrgWorkflowJobsParams contains all the parameters to send to the API endpoint
for the get org workflow jobs operation.
Typically these are written to a http.Request.
*/
type GetOrgWorkflowJobsParams struct {
/* Limit.
page size of results
*/
Limit *int64
/* Org.
name of the organization
*/
Org string
/* Page.
page number of results to return (1-based)
*/
Page *int64
/* Status.
workflow status (pending, queued, in_progress, failure, success, skipped)
*/
Status *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get org workflow jobs params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetOrgWorkflowJobsParams) WithDefaults() *GetOrgWorkflowJobsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get org workflow jobs params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetOrgWorkflowJobsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get org workflow jobs params
func (o *GetOrgWorkflowJobsParams) WithTimeout(timeout time.Duration) *GetOrgWorkflowJobsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get org workflow jobs params
func (o *GetOrgWorkflowJobsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get org workflow jobs params
func (o *GetOrgWorkflowJobsParams) WithContext(ctx context.Context) *GetOrgWorkflowJobsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get org workflow jobs params
func (o *GetOrgWorkflowJobsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get org workflow jobs params
func (o *GetOrgWorkflowJobsParams) WithHTTPClient(client *http.Client) *GetOrgWorkflowJobsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get org workflow jobs params
func (o *GetOrgWorkflowJobsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithLimit adds the limit to the get org workflow jobs params
func (o *GetOrgWorkflowJobsParams) WithLimit(limit *int64) *GetOrgWorkflowJobsParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the get org workflow jobs params
func (o *GetOrgWorkflowJobsParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithOrg adds the org to the get org workflow jobs params
func (o *GetOrgWorkflowJobsParams) WithOrg(org string) *GetOrgWorkflowJobsParams {
o.SetOrg(org)
return o
}
// SetOrg adds the org to the get org workflow jobs params
func (o *GetOrgWorkflowJobsParams) SetOrg(org string) {
o.Org = org
}
// WithPage adds the page to the get org workflow jobs params
func (o *GetOrgWorkflowJobsParams) WithPage(page *int64) *GetOrgWorkflowJobsParams {
o.SetPage(page)
return o
}
// SetPage adds the page to the get org workflow jobs params
func (o *GetOrgWorkflowJobsParams) SetPage(page *int64) {
o.Page = page
}
// WithStatus adds the status to the get org workflow jobs params
func (o *GetOrgWorkflowJobsParams) WithStatus(status *string) *GetOrgWorkflowJobsParams {
o.SetStatus(status)
return o
}
// SetStatus adds the status to the get org workflow jobs params
func (o *GetOrgWorkflowJobsParams) SetStatus(status *string) {
o.Status = status
}
// WriteToRequest writes these params to a swagger request
func (o *GetOrgWorkflowJobsParams) 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
}
}
}
// path param org
if err := r.SetPathParam("org", o.Org); 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.Status != nil {
// query param status
var qrStatus string
if o.Status != nil {
qrStatus = *o.Status
}
qStatus := qrStatus
if qStatus != "" {
if err := r.SetQueryParam("status", qStatus); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,246 @@
// Code generated by go-swagger; DO NOT EDIT.
package organization
// 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"
)
// GetOrgWorkflowJobsReader is a Reader for the GetOrgWorkflowJobs structure.
type GetOrgWorkflowJobsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetOrgWorkflowJobsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetOrgWorkflowJobsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewGetOrgWorkflowJobsBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewGetOrgWorkflowJobsNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /orgs/{org}/actions/jobs] getOrgWorkflowJobs", response, response.Code())
}
}
// NewGetOrgWorkflowJobsOK creates a GetOrgWorkflowJobsOK with default headers values
func NewGetOrgWorkflowJobsOK() *GetOrgWorkflowJobsOK {
return &GetOrgWorkflowJobsOK{}
}
/*
GetOrgWorkflowJobsOK describes a response with status code 200, with default header values.
WorkflowJobsList
*/
type GetOrgWorkflowJobsOK struct {
Payload *models.ActionWorkflowJobsResponse
}
// IsSuccess returns true when this get org workflow jobs o k response has a 2xx status code
func (o *GetOrgWorkflowJobsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get org workflow jobs o k response has a 3xx status code
func (o *GetOrgWorkflowJobsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get org workflow jobs o k response has a 4xx status code
func (o *GetOrgWorkflowJobsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get org workflow jobs o k response has a 5xx status code
func (o *GetOrgWorkflowJobsOK) IsServerError() bool {
return false
}
// IsCode returns true when this get org workflow jobs o k response a status code equal to that given
func (o *GetOrgWorkflowJobsOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the get org workflow jobs o k response
func (o *GetOrgWorkflowJobsOK) Code() int {
return 200
}
func (o *GetOrgWorkflowJobsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /orgs/{org}/actions/jobs][%d] getOrgWorkflowJobsOK %s", 200, payload)
}
func (o *GetOrgWorkflowJobsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /orgs/{org}/actions/jobs][%d] getOrgWorkflowJobsOK %s", 200, payload)
}
func (o *GetOrgWorkflowJobsOK) GetPayload() *models.ActionWorkflowJobsResponse {
return o.Payload
}
func (o *GetOrgWorkflowJobsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.ActionWorkflowJobsResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetOrgWorkflowJobsBadRequest creates a GetOrgWorkflowJobsBadRequest with default headers values
func NewGetOrgWorkflowJobsBadRequest() *GetOrgWorkflowJobsBadRequest {
return &GetOrgWorkflowJobsBadRequest{}
}
/*
GetOrgWorkflowJobsBadRequest describes a response with status code 400, with default header values.
APIError is error format response
*/
type GetOrgWorkflowJobsBadRequest struct {
Message string
URL string
}
// IsSuccess returns true when this get org workflow jobs bad request response has a 2xx status code
func (o *GetOrgWorkflowJobsBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get org workflow jobs bad request response has a 3xx status code
func (o *GetOrgWorkflowJobsBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this get org workflow jobs bad request response has a 4xx status code
func (o *GetOrgWorkflowJobsBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this get org workflow jobs bad request response has a 5xx status code
func (o *GetOrgWorkflowJobsBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this get org workflow jobs bad request response a status code equal to that given
func (o *GetOrgWorkflowJobsBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the get org workflow jobs bad request response
func (o *GetOrgWorkflowJobsBadRequest) Code() int {
return 400
}
func (o *GetOrgWorkflowJobsBadRequest) Error() string {
return fmt.Sprintf("[GET /orgs/{org}/actions/jobs][%d] getOrgWorkflowJobsBadRequest", 400)
}
func (o *GetOrgWorkflowJobsBadRequest) String() string {
return fmt.Sprintf("[GET /orgs/{org}/actions/jobs][%d] getOrgWorkflowJobsBadRequest", 400)
}
func (o *GetOrgWorkflowJobsBadRequest) 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
}
// NewGetOrgWorkflowJobsNotFound creates a GetOrgWorkflowJobsNotFound with default headers values
func NewGetOrgWorkflowJobsNotFound() *GetOrgWorkflowJobsNotFound {
return &GetOrgWorkflowJobsNotFound{}
}
/*
GetOrgWorkflowJobsNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type GetOrgWorkflowJobsNotFound struct {
}
// IsSuccess returns true when this get org workflow jobs not found response has a 2xx status code
func (o *GetOrgWorkflowJobsNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get org workflow jobs not found response has a 3xx status code
func (o *GetOrgWorkflowJobsNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this get org workflow jobs not found response has a 4xx status code
func (o *GetOrgWorkflowJobsNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this get org workflow jobs not found response has a 5xx status code
func (o *GetOrgWorkflowJobsNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this get org workflow jobs not found response a status code equal to that given
func (o *GetOrgWorkflowJobsNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the get org workflow jobs not found response
func (o *GetOrgWorkflowJobsNotFound) Code() int {
return 404
}
func (o *GetOrgWorkflowJobsNotFound) Error() string {
return fmt.Sprintf("[GET /orgs/{org}/actions/jobs][%d] getOrgWorkflowJobsNotFound", 404)
}
func (o *GetOrgWorkflowJobsNotFound) String() string {
return fmt.Sprintf("[GET /orgs/{org}/actions/jobs][%d] getOrgWorkflowJobsNotFound", 404)
}
func (o *GetOrgWorkflowJobsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -0,0 +1,390 @@
// Code generated by go-swagger; DO NOT EDIT.
package organization
// 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"
)
// NewGetOrgWorkflowRunsParams creates a new GetOrgWorkflowRunsParams 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 NewGetOrgWorkflowRunsParams() *GetOrgWorkflowRunsParams {
return &GetOrgWorkflowRunsParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetOrgWorkflowRunsParamsWithTimeout creates a new GetOrgWorkflowRunsParams object
// with the ability to set a timeout on a request.
func NewGetOrgWorkflowRunsParamsWithTimeout(timeout time.Duration) *GetOrgWorkflowRunsParams {
return &GetOrgWorkflowRunsParams{
timeout: timeout,
}
}
// NewGetOrgWorkflowRunsParamsWithContext creates a new GetOrgWorkflowRunsParams object
// with the ability to set a context for a request.
func NewGetOrgWorkflowRunsParamsWithContext(ctx context.Context) *GetOrgWorkflowRunsParams {
return &GetOrgWorkflowRunsParams{
Context: ctx,
}
}
// NewGetOrgWorkflowRunsParamsWithHTTPClient creates a new GetOrgWorkflowRunsParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetOrgWorkflowRunsParamsWithHTTPClient(client *http.Client) *GetOrgWorkflowRunsParams {
return &GetOrgWorkflowRunsParams{
HTTPClient: client,
}
}
/*
GetOrgWorkflowRunsParams contains all the parameters to send to the API endpoint
for the get org workflow runs operation.
Typically these are written to a http.Request.
*/
type GetOrgWorkflowRunsParams struct {
/* Actor.
triggered by user
*/
Actor *string
/* Branch.
workflow branch
*/
Branch *string
/* Event.
workflow event name
*/
Event *string
/* HeadSha.
triggering sha of the workflow run
*/
HeadSha *string
/* Limit.
page size of results
*/
Limit *int64
/* Org.
name of the organization
*/
Org string
/* Page.
page number of results to return (1-based)
*/
Page *int64
/* Status.
workflow status (pending, queued, in_progress, failure, success, skipped)
*/
Status *string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get org workflow runs params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetOrgWorkflowRunsParams) WithDefaults() *GetOrgWorkflowRunsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get org workflow runs params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetOrgWorkflowRunsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) WithTimeout(timeout time.Duration) *GetOrgWorkflowRunsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) WithContext(ctx context.Context) *GetOrgWorkflowRunsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) WithHTTPClient(client *http.Client) *GetOrgWorkflowRunsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithActor adds the actor to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) WithActor(actor *string) *GetOrgWorkflowRunsParams {
o.SetActor(actor)
return o
}
// SetActor adds the actor to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) SetActor(actor *string) {
o.Actor = actor
}
// WithBranch adds the branch to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) WithBranch(branch *string) *GetOrgWorkflowRunsParams {
o.SetBranch(branch)
return o
}
// SetBranch adds the branch to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) SetBranch(branch *string) {
o.Branch = branch
}
// WithEvent adds the event to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) WithEvent(event *string) *GetOrgWorkflowRunsParams {
o.SetEvent(event)
return o
}
// SetEvent adds the event to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) SetEvent(event *string) {
o.Event = event
}
// WithHeadSha adds the headSha to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) WithHeadSha(headSha *string) *GetOrgWorkflowRunsParams {
o.SetHeadSha(headSha)
return o
}
// SetHeadSha adds the headSha to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) SetHeadSha(headSha *string) {
o.HeadSha = headSha
}
// WithLimit adds the limit to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) WithLimit(limit *int64) *GetOrgWorkflowRunsParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithOrg adds the org to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) WithOrg(org string) *GetOrgWorkflowRunsParams {
o.SetOrg(org)
return o
}
// SetOrg adds the org to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) SetOrg(org string) {
o.Org = org
}
// WithPage adds the page to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) WithPage(page *int64) *GetOrgWorkflowRunsParams {
o.SetPage(page)
return o
}
// SetPage adds the page to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) SetPage(page *int64) {
o.Page = page
}
// WithStatus adds the status to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) WithStatus(status *string) *GetOrgWorkflowRunsParams {
o.SetStatus(status)
return o
}
// SetStatus adds the status to the get org workflow runs params
func (o *GetOrgWorkflowRunsParams) SetStatus(status *string) {
o.Status = status
}
// WriteToRequest writes these params to a swagger request
func (o *GetOrgWorkflowRunsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.Actor != nil {
// query param actor
var qrActor string
if o.Actor != nil {
qrActor = *o.Actor
}
qActor := qrActor
if qActor != "" {
if err := r.SetQueryParam("actor", qActor); err != nil {
return err
}
}
}
if o.Branch != nil {
// query param branch
var qrBranch string
if o.Branch != nil {
qrBranch = *o.Branch
}
qBranch := qrBranch
if qBranch != "" {
if err := r.SetQueryParam("branch", qBranch); err != nil {
return err
}
}
}
if o.Event != nil {
// query param event
var qrEvent string
if o.Event != nil {
qrEvent = *o.Event
}
qEvent := qrEvent
if qEvent != "" {
if err := r.SetQueryParam("event", qEvent); err != nil {
return err
}
}
}
if o.HeadSha != nil {
// query param head_sha
var qrHeadSha string
if o.HeadSha != nil {
qrHeadSha = *o.HeadSha
}
qHeadSha := qrHeadSha
if qHeadSha != "" {
if err := r.SetQueryParam("head_sha", qHeadSha); err != nil {
return err
}
}
}
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
}
}
}
// path param org
if err := r.SetPathParam("org", o.Org); 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.Status != nil {
// query param status
var qrStatus string
if o.Status != nil {
qrStatus = *o.Status
}
qStatus := qrStatus
if qStatus != "" {
if err := r.SetQueryParam("status", qStatus); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,246 @@
// Code generated by go-swagger; DO NOT EDIT.
package organization
// 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"
)
// GetOrgWorkflowRunsReader is a Reader for the GetOrgWorkflowRuns structure.
type GetOrgWorkflowRunsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetOrgWorkflowRunsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetOrgWorkflowRunsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewGetOrgWorkflowRunsBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewGetOrgWorkflowRunsNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /orgs/{org}/actions/runs] getOrgWorkflowRuns", response, response.Code())
}
}
// NewGetOrgWorkflowRunsOK creates a GetOrgWorkflowRunsOK with default headers values
func NewGetOrgWorkflowRunsOK() *GetOrgWorkflowRunsOK {
return &GetOrgWorkflowRunsOK{}
}
/*
GetOrgWorkflowRunsOK describes a response with status code 200, with default header values.
WorkflowRunsList
*/
type GetOrgWorkflowRunsOK struct {
Payload *models.ActionWorkflowRunsResponse
}
// IsSuccess returns true when this get org workflow runs o k response has a 2xx status code
func (o *GetOrgWorkflowRunsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get org workflow runs o k response has a 3xx status code
func (o *GetOrgWorkflowRunsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get org workflow runs o k response has a 4xx status code
func (o *GetOrgWorkflowRunsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get org workflow runs o k response has a 5xx status code
func (o *GetOrgWorkflowRunsOK) IsServerError() bool {
return false
}
// IsCode returns true when this get org workflow runs o k response a status code equal to that given
func (o *GetOrgWorkflowRunsOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the get org workflow runs o k response
func (o *GetOrgWorkflowRunsOK) Code() int {
return 200
}
func (o *GetOrgWorkflowRunsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /orgs/{org}/actions/runs][%d] getOrgWorkflowRunsOK %s", 200, payload)
}
func (o *GetOrgWorkflowRunsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /orgs/{org}/actions/runs][%d] getOrgWorkflowRunsOK %s", 200, payload)
}
func (o *GetOrgWorkflowRunsOK) GetPayload() *models.ActionWorkflowRunsResponse {
return o.Payload
}
func (o *GetOrgWorkflowRunsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.ActionWorkflowRunsResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetOrgWorkflowRunsBadRequest creates a GetOrgWorkflowRunsBadRequest with default headers values
func NewGetOrgWorkflowRunsBadRequest() *GetOrgWorkflowRunsBadRequest {
return &GetOrgWorkflowRunsBadRequest{}
}
/*
GetOrgWorkflowRunsBadRequest describes a response with status code 400, with default header values.
APIError is error format response
*/
type GetOrgWorkflowRunsBadRequest struct {
Message string
URL string
}
// IsSuccess returns true when this get org workflow runs bad request response has a 2xx status code
func (o *GetOrgWorkflowRunsBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get org workflow runs bad request response has a 3xx status code
func (o *GetOrgWorkflowRunsBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this get org workflow runs bad request response has a 4xx status code
func (o *GetOrgWorkflowRunsBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this get org workflow runs bad request response has a 5xx status code
func (o *GetOrgWorkflowRunsBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this get org workflow runs bad request response a status code equal to that given
func (o *GetOrgWorkflowRunsBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the get org workflow runs bad request response
func (o *GetOrgWorkflowRunsBadRequest) Code() int {
return 400
}
func (o *GetOrgWorkflowRunsBadRequest) Error() string {
return fmt.Sprintf("[GET /orgs/{org}/actions/runs][%d] getOrgWorkflowRunsBadRequest", 400)
}
func (o *GetOrgWorkflowRunsBadRequest) String() string {
return fmt.Sprintf("[GET /orgs/{org}/actions/runs][%d] getOrgWorkflowRunsBadRequest", 400)
}
func (o *GetOrgWorkflowRunsBadRequest) 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
}
// NewGetOrgWorkflowRunsNotFound creates a GetOrgWorkflowRunsNotFound with default headers values
func NewGetOrgWorkflowRunsNotFound() *GetOrgWorkflowRunsNotFound {
return &GetOrgWorkflowRunsNotFound{}
}
/*
GetOrgWorkflowRunsNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type GetOrgWorkflowRunsNotFound struct {
}
// IsSuccess returns true when this get org workflow runs not found response has a 2xx status code
func (o *GetOrgWorkflowRunsNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get org workflow runs not found response has a 3xx status code
func (o *GetOrgWorkflowRunsNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this get org workflow runs not found response has a 4xx status code
func (o *GetOrgWorkflowRunsNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this get org workflow runs not found response has a 5xx status code
func (o *GetOrgWorkflowRunsNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this get org workflow runs not found response a status code equal to that given
func (o *GetOrgWorkflowRunsNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the get org workflow runs not found response
func (o *GetOrgWorkflowRunsNotFound) Code() int {
return 404
}
func (o *GetOrgWorkflowRunsNotFound) Error() string {
return fmt.Sprintf("[GET /orgs/{org}/actions/runs][%d] getOrgWorkflowRunsNotFound", 404)
}
func (o *GetOrgWorkflowRunsNotFound) String() string {
return fmt.Sprintf("[GET /orgs/{org}/actions/runs][%d] getOrgWorkflowRunsNotFound", 404)
}
func (o *GetOrgWorkflowRunsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -72,7 +72,7 @@ type OrgAddTeamMemberParams struct {
/* Username.
username of the user to add
username of the user to add to a team
*/
Username string

View File

@@ -69,7 +69,7 @@ type OrgConcealMemberParams struct {
/* Username.
username of the user
username of the user whose membership is to be concealed
*/
Username string

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package organization
// 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"
)
// NewOrgCreateRunnerRegistrationTokenParams creates a new OrgCreateRunnerRegistrationTokenParams 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 NewOrgCreateRunnerRegistrationTokenParams() *OrgCreateRunnerRegistrationTokenParams {
return &OrgCreateRunnerRegistrationTokenParams{
timeout: cr.DefaultTimeout,
}
}
// NewOrgCreateRunnerRegistrationTokenParamsWithTimeout creates a new OrgCreateRunnerRegistrationTokenParams object
// with the ability to set a timeout on a request.
func NewOrgCreateRunnerRegistrationTokenParamsWithTimeout(timeout time.Duration) *OrgCreateRunnerRegistrationTokenParams {
return &OrgCreateRunnerRegistrationTokenParams{
timeout: timeout,
}
}
// NewOrgCreateRunnerRegistrationTokenParamsWithContext creates a new OrgCreateRunnerRegistrationTokenParams object
// with the ability to set a context for a request.
func NewOrgCreateRunnerRegistrationTokenParamsWithContext(ctx context.Context) *OrgCreateRunnerRegistrationTokenParams {
return &OrgCreateRunnerRegistrationTokenParams{
Context: ctx,
}
}
// NewOrgCreateRunnerRegistrationTokenParamsWithHTTPClient creates a new OrgCreateRunnerRegistrationTokenParams object
// with the ability to set a custom HTTPClient for a request.
func NewOrgCreateRunnerRegistrationTokenParamsWithHTTPClient(client *http.Client) *OrgCreateRunnerRegistrationTokenParams {
return &OrgCreateRunnerRegistrationTokenParams{
HTTPClient: client,
}
}
/*
OrgCreateRunnerRegistrationTokenParams contains all the parameters to send to the API endpoint
for the org create runner registration token operation.
Typically these are written to a http.Request.
*/
type OrgCreateRunnerRegistrationTokenParams struct {
/* Org.
name of the organization
*/
Org string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the org create runner registration token params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *OrgCreateRunnerRegistrationTokenParams) WithDefaults() *OrgCreateRunnerRegistrationTokenParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the org create runner registration token params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *OrgCreateRunnerRegistrationTokenParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the org create runner registration token params
func (o *OrgCreateRunnerRegistrationTokenParams) WithTimeout(timeout time.Duration) *OrgCreateRunnerRegistrationTokenParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the org create runner registration token params
func (o *OrgCreateRunnerRegistrationTokenParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the org create runner registration token params
func (o *OrgCreateRunnerRegistrationTokenParams) WithContext(ctx context.Context) *OrgCreateRunnerRegistrationTokenParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the org create runner registration token params
func (o *OrgCreateRunnerRegistrationTokenParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the org create runner registration token params
func (o *OrgCreateRunnerRegistrationTokenParams) WithHTTPClient(client *http.Client) *OrgCreateRunnerRegistrationTokenParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the org create runner registration token params
func (o *OrgCreateRunnerRegistrationTokenParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithOrg adds the org to the org create runner registration token params
func (o *OrgCreateRunnerRegistrationTokenParams) WithOrg(org string) *OrgCreateRunnerRegistrationTokenParams {
o.SetOrg(org)
return o
}
// SetOrg adds the org to the org create runner registration token params
func (o *OrgCreateRunnerRegistrationTokenParams) SetOrg(org string) {
o.Org = org
}
// WriteToRequest writes these params to a swagger request
func (o *OrgCreateRunnerRegistrationTokenParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param org
if err := r.SetPathParam("org", o.Org); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,96 @@
// Code generated by go-swagger; DO NOT EDIT.
package organization
// 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"
)
// OrgCreateRunnerRegistrationTokenReader is a Reader for the OrgCreateRunnerRegistrationToken structure.
type OrgCreateRunnerRegistrationTokenReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *OrgCreateRunnerRegistrationTokenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewOrgCreateRunnerRegistrationTokenOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("[POST /orgs/{org}/actions/runners/registration-token] orgCreateRunnerRegistrationToken", response, response.Code())
}
}
// NewOrgCreateRunnerRegistrationTokenOK creates a OrgCreateRunnerRegistrationTokenOK with default headers values
func NewOrgCreateRunnerRegistrationTokenOK() *OrgCreateRunnerRegistrationTokenOK {
return &OrgCreateRunnerRegistrationTokenOK{}
}
/*
OrgCreateRunnerRegistrationTokenOK describes a response with status code 200, with default header values.
RegistrationToken is response related to registration token
*/
type OrgCreateRunnerRegistrationTokenOK struct {
Token string
}
// IsSuccess returns true when this org create runner registration token o k response has a 2xx status code
func (o *OrgCreateRunnerRegistrationTokenOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this org create runner registration token o k response has a 3xx status code
func (o *OrgCreateRunnerRegistrationTokenOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this org create runner registration token o k response has a 4xx status code
func (o *OrgCreateRunnerRegistrationTokenOK) IsClientError() bool {
return false
}
// IsServerError returns true when this org create runner registration token o k response has a 5xx status code
func (o *OrgCreateRunnerRegistrationTokenOK) IsServerError() bool {
return false
}
// IsCode returns true when this org create runner registration token o k response a status code equal to that given
func (o *OrgCreateRunnerRegistrationTokenOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the org create runner registration token o k response
func (o *OrgCreateRunnerRegistrationTokenOK) Code() int {
return 200
}
func (o *OrgCreateRunnerRegistrationTokenOK) Error() string {
return fmt.Sprintf("[POST /orgs/{org}/actions/runners/registration-token][%d] orgCreateRunnerRegistrationTokenOK", 200)
}
func (o *OrgCreateRunnerRegistrationTokenOK) String() string {
return fmt.Sprintf("[POST /orgs/{org}/actions/runners/registration-token][%d] orgCreateRunnerRegistrationTokenOK", 200)
}
func (o *OrgCreateRunnerRegistrationTokenOK) 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
}

View File

@@ -69,7 +69,7 @@ type OrgDeleteMemberParams struct {
/* Username.
username of the user
username of the user to remove from the organization
*/
Username string

View File

@@ -69,7 +69,7 @@ type OrgGetUserPermissionsParams struct {
/* Username.
username of user
username of the user whose permissions are to be obtained
*/
Username string

View File

@@ -69,7 +69,7 @@ type OrgIsMemberParams struct {
/* Username.
username of the user
username of the user to check for an organization membership
*/
Username string

View File

@@ -69,7 +69,7 @@ type OrgIsPublicMemberParams struct {
/* Username.
username of the user
username of the user to check for a public organization membership
*/
Username string

View File

@@ -72,7 +72,7 @@ type OrgListTeamMemberParams struct {
/* Username.
username of the member to list
username of the user whose data is to be listed
*/
Username string

View File

@@ -76,7 +76,7 @@ type OrgListUserOrgsParams struct {
/* Username.
username of user
username of the user whose organizations are to be listed
*/
Username string

View File

@@ -69,7 +69,7 @@ type OrgPublicizeMemberParams struct {
/* Username.
username of the user
username of the user whose membership is to be publicized
*/
Username string

View File

@@ -72,7 +72,7 @@ type OrgRemoveTeamMemberParams struct {
/* Username.
username of the user to remove
username of the user to remove from a team
*/
Username string

View File

@@ -75,7 +75,7 @@ type OrganizationBlockUserParams struct {
/* Username.
user to block
username of the user to block
*/
Username string

View File

@@ -69,7 +69,7 @@ type OrganizationCheckUserBlockParams struct {
/* Username.
user to check
username of the user to check
*/
Username string

View File

@@ -104,16 +104,26 @@ type ClientService interface {
CreateOrgRepoDeprecated(params *CreateOrgRepoDeprecatedParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateOrgRepoDeprecatedCreated, error)
CreateOrgVariable(params *CreateOrgVariableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateOrgVariableCreated, *CreateOrgVariableNoContent, error)
CreateOrgVariable(params *CreateOrgVariableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateOrgVariableCreated, error)
DeleteOrgRunner(params *DeleteOrgRunnerParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteOrgRunnerNoContent, error)
DeleteOrgSecret(params *DeleteOrgSecretParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteOrgSecretNoContent, error)
DeleteOrgVariable(params *DeleteOrgVariableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteOrgVariableOK, *DeleteOrgVariableCreated, *DeleteOrgVariableNoContent, error)
GetOrgRunner(params *GetOrgRunnerParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrgRunnerOK, error)
GetOrgRunners(params *GetOrgRunnersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrgRunnersOK, error)
GetOrgVariable(params *GetOrgVariableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrgVariableOK, error)
GetOrgVariablesList(params *GetOrgVariablesListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrgVariablesListOK, error)
GetOrgWorkflowJobs(params *GetOrgWorkflowJobsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrgWorkflowJobsOK, error)
GetOrgWorkflowRuns(params *GetOrgWorkflowRunsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrgWorkflowRunsOK, error)
OrgAddTeamMember(params *OrgAddTeamMemberParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*OrgAddTeamMemberNoContent, error)
OrgAddTeamRepository(params *OrgAddTeamRepositoryParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*OrgAddTeamRepositoryNoContent, error)
@@ -126,6 +136,8 @@ type ClientService interface {
OrgCreateLabel(params *OrgCreateLabelParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*OrgCreateLabelCreated, error)
OrgCreateRunnerRegistrationToken(params *OrgCreateRunnerRegistrationTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*OrgCreateRunnerRegistrationTokenOK, error)
OrgCreateTeam(params *OrgCreateTeamParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*OrgCreateTeamCreated, error)
OrgDelete(params *OrgDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*OrgDeleteNoContent, error)
@@ -212,6 +224,8 @@ type ClientService interface {
OrganizationUnblockUser(params *OrganizationUnblockUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*OrganizationUnblockUserNoContent, error)
RenameOrg(params *RenameOrgParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RenameOrgNoContent, error)
TeamSearch(params *TeamSearchParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TeamSearchOK, error)
UpdateOrgSecret(params *UpdateOrgSecretParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateOrgSecretCreated, *UpdateOrgSecretNoContent, error)
@@ -302,7 +316,7 @@ func (a *Client) CreateOrgRepoDeprecated(params *CreateOrgRepoDeprecatedParams,
/*
CreateOrgVariable creates an org level variable
*/
func (a *Client) CreateOrgVariable(params *CreateOrgVariableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateOrgVariableCreated, *CreateOrgVariableNoContent, error) {
func (a *Client) CreateOrgVariable(params *CreateOrgVariableParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateOrgVariableCreated, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCreateOrgVariableParams()
@@ -326,16 +340,54 @@ func (a *Client) CreateOrgVariable(params *CreateOrgVariableParams, authInfo run
result, err := a.transport.Submit(op)
if err != nil {
return nil, nil, err
return nil, err
}
switch value := result.(type) {
case *CreateOrgVariableCreated:
return value, nil, nil
case *CreateOrgVariableNoContent:
return nil, value, nil
success, ok := result.(*CreateOrgVariableCreated)
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 organization: API contract not enforced by server. Client expected to get an error, but got: %T", result)
msg := fmt.Sprintf("unexpected success response for createOrgVariable: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
DeleteOrgRunner deletes an org level runner
*/
func (a *Client) DeleteOrgRunner(params *DeleteOrgRunnerParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteOrgRunnerNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteOrgRunnerParams()
}
op := &runtime.ClientOperation{
ID: "deleteOrgRunner",
Method: "DELETE",
PathPattern: "/orgs/{org}/actions/runners/{runner_id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "text/plain"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &DeleteOrgRunnerReader{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.(*DeleteOrgRunnerNoContent)
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 deleteOrgRunner: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
@@ -420,6 +472,84 @@ func (a *Client) DeleteOrgVariable(params *DeleteOrgVariableParams, authInfo run
panic(msg)
}
/*
GetOrgRunner gets an org level runner
*/
func (a *Client) GetOrgRunner(params *GetOrgRunnerParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrgRunnerOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetOrgRunnerParams()
}
op := &runtime.ClientOperation{
ID: "getOrgRunner",
Method: "GET",
PathPattern: "/orgs/{org}/actions/runners/{runner_id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "text/plain"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetOrgRunnerReader{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.(*GetOrgRunnerOK)
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 getOrgRunner: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetOrgRunners gets org level runners
*/
func (a *Client) GetOrgRunners(params *GetOrgRunnersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrgRunnersOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetOrgRunnersParams()
}
op := &runtime.ClientOperation{
ID: "getOrgRunners",
Method: "GET",
PathPattern: "/orgs/{org}/actions/runners",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "text/plain"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetOrgRunnersReader{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.(*GetOrgRunnersOK)
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 getOrgRunners: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetOrgVariable gets an org level variable
*/
@@ -498,6 +628,84 @@ func (a *Client) GetOrgVariablesList(params *GetOrgVariablesListParams, authInfo
panic(msg)
}
/*
GetOrgWorkflowJobs gets org level workflow jobs
*/
func (a *Client) GetOrgWorkflowJobs(params *GetOrgWorkflowJobsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrgWorkflowJobsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetOrgWorkflowJobsParams()
}
op := &runtime.ClientOperation{
ID: "getOrgWorkflowJobs",
Method: "GET",
PathPattern: "/orgs/{org}/actions/jobs",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "text/plain"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetOrgWorkflowJobsReader{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.(*GetOrgWorkflowJobsOK)
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 getOrgWorkflowJobs: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetOrgWorkflowRuns gets org level workflow runs
*/
func (a *Client) GetOrgWorkflowRuns(params *GetOrgWorkflowRunsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrgWorkflowRunsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetOrgWorkflowRunsParams()
}
op := &runtime.ClientOperation{
ID: "getOrgWorkflowRuns",
Method: "GET",
PathPattern: "/orgs/{org}/actions/runs",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "text/plain"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetOrgWorkflowRunsReader{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.(*GetOrgWorkflowRunsOK)
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 getOrgWorkflowRuns: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
OrgAddTeamMember adds a team member
*/
@@ -732,6 +940,45 @@ func (a *Client) OrgCreateLabel(params *OrgCreateLabelParams, authInfo runtime.C
panic(msg)
}
/*
OrgCreateRunnerRegistrationToken gets an organization s actions runner registration token
*/
func (a *Client) OrgCreateRunnerRegistrationToken(params *OrgCreateRunnerRegistrationTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*OrgCreateRunnerRegistrationTokenOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewOrgCreateRunnerRegistrationTokenParams()
}
op := &runtime.ClientOperation{
ID: "orgCreateRunnerRegistrationToken",
Method: "POST",
PathPattern: "/orgs/{org}/actions/runners/registration-token",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "text/plain"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &OrgCreateRunnerRegistrationTokenReader{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.(*OrgCreateRunnerRegistrationTokenOK)
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 orgCreateRunnerRegistrationToken: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
OrgCreateTeam creates a team
*/
@@ -2411,6 +2658,45 @@ func (a *Client) OrganizationUnblockUser(params *OrganizationUnblockUserParams,
panic(msg)
}
/*
RenameOrg renames an organization
*/
func (a *Client) RenameOrg(params *RenameOrgParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RenameOrgNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewRenameOrgParams()
}
op := &runtime.ClientOperation{
ID: "renameOrg",
Method: "POST",
PathPattern: "/orgs/{org}/rename",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "text/plain"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &RenameOrgReader{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.(*RenameOrgNoContent)
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 renameOrg: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
TeamSearch searches for teams within an organization
*/

View File

@@ -69,7 +69,7 @@ type OrganizationUnblockUserParams struct {
/* Username.
user to unblock
username of the user to unblock
*/
Username string

View File

@@ -0,0 +1,172 @@
// Code generated by go-swagger; DO NOT EDIT.
package organization
// 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"
)
// NewRenameOrgParams creates a new RenameOrgParams 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 NewRenameOrgParams() *RenameOrgParams {
return &RenameOrgParams{
timeout: cr.DefaultTimeout,
}
}
// NewRenameOrgParamsWithTimeout creates a new RenameOrgParams object
// with the ability to set a timeout on a request.
func NewRenameOrgParamsWithTimeout(timeout time.Duration) *RenameOrgParams {
return &RenameOrgParams{
timeout: timeout,
}
}
// NewRenameOrgParamsWithContext creates a new RenameOrgParams object
// with the ability to set a context for a request.
func NewRenameOrgParamsWithContext(ctx context.Context) *RenameOrgParams {
return &RenameOrgParams{
Context: ctx,
}
}
// NewRenameOrgParamsWithHTTPClient creates a new RenameOrgParams object
// with the ability to set a custom HTTPClient for a request.
func NewRenameOrgParamsWithHTTPClient(client *http.Client) *RenameOrgParams {
return &RenameOrgParams{
HTTPClient: client,
}
}
/*
RenameOrgParams contains all the parameters to send to the API endpoint
for the rename org operation.
Typically these are written to a http.Request.
*/
type RenameOrgParams struct {
// Body.
Body *models.RenameOrgOption
/* Org.
existing org name
*/
Org string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the rename org params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *RenameOrgParams) WithDefaults() *RenameOrgParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the rename org params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *RenameOrgParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the rename org params
func (o *RenameOrgParams) WithTimeout(timeout time.Duration) *RenameOrgParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the rename org params
func (o *RenameOrgParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the rename org params
func (o *RenameOrgParams) WithContext(ctx context.Context) *RenameOrgParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the rename org params
func (o *RenameOrgParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the rename org params
func (o *RenameOrgParams) WithHTTPClient(client *http.Client) *RenameOrgParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the rename org params
func (o *RenameOrgParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the rename org params
func (o *RenameOrgParams) WithBody(body *models.RenameOrgOption) *RenameOrgParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the rename org params
func (o *RenameOrgParams) SetBody(body *models.RenameOrgOption) {
o.Body = body
}
// WithOrg adds the org to the rename org params
func (o *RenameOrgParams) WithOrg(org string) *RenameOrgParams {
o.SetOrg(org)
return o
}
// SetOrg adds the org to the rename org params
func (o *RenameOrgParams) SetOrg(org string) {
o.Org = org
}
// WriteToRequest writes these params to a swagger request
func (o *RenameOrgParams) 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 org
if err := r.SetPathParam("org", o.Org); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,244 @@
// Code generated by go-swagger; DO NOT EDIT.
package organization
// 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"
)
// RenameOrgReader is a Reader for the RenameOrg structure.
type RenameOrgReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *RenameOrgReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 204:
result := NewRenameOrgNoContent()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 403:
result := NewRenameOrgForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewRenameOrgUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[POST /orgs/{org}/rename] renameOrg", response, response.Code())
}
}
// NewRenameOrgNoContent creates a RenameOrgNoContent with default headers values
func NewRenameOrgNoContent() *RenameOrgNoContent {
return &RenameOrgNoContent{}
}
/*
RenameOrgNoContent describes a response with status code 204, with default header values.
APIEmpty is an empty response
*/
type RenameOrgNoContent struct {
}
// IsSuccess returns true when this rename org no content response has a 2xx status code
func (o *RenameOrgNoContent) IsSuccess() bool {
return true
}
// IsRedirect returns true when this rename org no content response has a 3xx status code
func (o *RenameOrgNoContent) IsRedirect() bool {
return false
}
// IsClientError returns true when this rename org no content response has a 4xx status code
func (o *RenameOrgNoContent) IsClientError() bool {
return false
}
// IsServerError returns true when this rename org no content response has a 5xx status code
func (o *RenameOrgNoContent) IsServerError() bool {
return false
}
// IsCode returns true when this rename org no content response a status code equal to that given
func (o *RenameOrgNoContent) IsCode(code int) bool {
return code == 204
}
// Code gets the status code for the rename org no content response
func (o *RenameOrgNoContent) Code() int {
return 204
}
func (o *RenameOrgNoContent) Error() string {
return fmt.Sprintf("[POST /orgs/{org}/rename][%d] renameOrgNoContent", 204)
}
func (o *RenameOrgNoContent) String() string {
return fmt.Sprintf("[POST /orgs/{org}/rename][%d] renameOrgNoContent", 204)
}
func (o *RenameOrgNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewRenameOrgForbidden creates a RenameOrgForbidden with default headers values
func NewRenameOrgForbidden() *RenameOrgForbidden {
return &RenameOrgForbidden{}
}
/*
RenameOrgForbidden describes a response with status code 403, with default header values.
APIForbiddenError is a forbidden error response
*/
type RenameOrgForbidden struct {
Message string
URL string
}
// IsSuccess returns true when this rename org forbidden response has a 2xx status code
func (o *RenameOrgForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this rename org forbidden response has a 3xx status code
func (o *RenameOrgForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this rename org forbidden response has a 4xx status code
func (o *RenameOrgForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this rename org forbidden response has a 5xx status code
func (o *RenameOrgForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this rename org forbidden response a status code equal to that given
func (o *RenameOrgForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the rename org forbidden response
func (o *RenameOrgForbidden) Code() int {
return 403
}
func (o *RenameOrgForbidden) Error() string {
return fmt.Sprintf("[POST /orgs/{org}/rename][%d] renameOrgForbidden", 403)
}
func (o *RenameOrgForbidden) String() string {
return fmt.Sprintf("[POST /orgs/{org}/rename][%d] renameOrgForbidden", 403)
}
func (o *RenameOrgForbidden) 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
}
// NewRenameOrgUnprocessableEntity creates a RenameOrgUnprocessableEntity with default headers values
func NewRenameOrgUnprocessableEntity() *RenameOrgUnprocessableEntity {
return &RenameOrgUnprocessableEntity{}
}
/*
RenameOrgUnprocessableEntity describes a response with status code 422, with default header values.
APIValidationError is error format response related to input validation
*/
type RenameOrgUnprocessableEntity struct {
Message string
URL string
}
// IsSuccess returns true when this rename org unprocessable entity response has a 2xx status code
func (o *RenameOrgUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this rename org unprocessable entity response has a 3xx status code
func (o *RenameOrgUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this rename org unprocessable entity response has a 4xx status code
func (o *RenameOrgUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this rename org unprocessable entity response has a 5xx status code
func (o *RenameOrgUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this rename org unprocessable entity response a status code equal to that given
func (o *RenameOrgUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the rename org unprocessable entity response
func (o *RenameOrgUnprocessableEntity) Code() int {
return 422
}
func (o *RenameOrgUnprocessableEntity) Error() string {
return fmt.Sprintf("[POST /orgs/{org}/rename][%d] renameOrgUnprocessableEntity", 422)
}
func (o *RenameOrgUnprocessableEntity) String() string {
return fmt.Sprintf("[POST /orgs/{org}/rename][%d] renameOrgUnprocessableEntity", 422)
}
func (o *RenameOrgUnprocessableEntity) 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
}

View File

@@ -0,0 +1,195 @@
// Code generated by go-swagger; DO NOT EDIT.
package package_operations
// 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"
)
// NewGetLatestPackageVersionParams creates a new GetLatestPackageVersionParams 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 NewGetLatestPackageVersionParams() *GetLatestPackageVersionParams {
return &GetLatestPackageVersionParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetLatestPackageVersionParamsWithTimeout creates a new GetLatestPackageVersionParams object
// with the ability to set a timeout on a request.
func NewGetLatestPackageVersionParamsWithTimeout(timeout time.Duration) *GetLatestPackageVersionParams {
return &GetLatestPackageVersionParams{
timeout: timeout,
}
}
// NewGetLatestPackageVersionParamsWithContext creates a new GetLatestPackageVersionParams object
// with the ability to set a context for a request.
func NewGetLatestPackageVersionParamsWithContext(ctx context.Context) *GetLatestPackageVersionParams {
return &GetLatestPackageVersionParams{
Context: ctx,
}
}
// NewGetLatestPackageVersionParamsWithHTTPClient creates a new GetLatestPackageVersionParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetLatestPackageVersionParamsWithHTTPClient(client *http.Client) *GetLatestPackageVersionParams {
return &GetLatestPackageVersionParams{
HTTPClient: client,
}
}
/*
GetLatestPackageVersionParams contains all the parameters to send to the API endpoint
for the get latest package version operation.
Typically these are written to a http.Request.
*/
type GetLatestPackageVersionParams struct {
/* Name.
name of the package
*/
Name string
/* Owner.
owner of the package
*/
Owner string
/* Type.
type of the package
*/
Type string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get latest package version params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetLatestPackageVersionParams) WithDefaults() *GetLatestPackageVersionParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get latest package version params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetLatestPackageVersionParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get latest package version params
func (o *GetLatestPackageVersionParams) WithTimeout(timeout time.Duration) *GetLatestPackageVersionParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get latest package version params
func (o *GetLatestPackageVersionParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get latest package version params
func (o *GetLatestPackageVersionParams) WithContext(ctx context.Context) *GetLatestPackageVersionParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get latest package version params
func (o *GetLatestPackageVersionParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get latest package version params
func (o *GetLatestPackageVersionParams) WithHTTPClient(client *http.Client) *GetLatestPackageVersionParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get latest package version params
func (o *GetLatestPackageVersionParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithName adds the name to the get latest package version params
func (o *GetLatestPackageVersionParams) WithName(name string) *GetLatestPackageVersionParams {
o.SetName(name)
return o
}
// SetName adds the name to the get latest package version params
func (o *GetLatestPackageVersionParams) SetName(name string) {
o.Name = name
}
// WithOwner adds the owner to the get latest package version params
func (o *GetLatestPackageVersionParams) WithOwner(owner string) *GetLatestPackageVersionParams {
o.SetOwner(owner)
return o
}
// SetOwner adds the owner to the get latest package version params
func (o *GetLatestPackageVersionParams) SetOwner(owner string) {
o.Owner = owner
}
// WithType adds the typeVar to the get latest package version params
func (o *GetLatestPackageVersionParams) WithType(typeVar string) *GetLatestPackageVersionParams {
o.SetType(typeVar)
return o
}
// SetType adds the type to the get latest package version params
func (o *GetLatestPackageVersionParams) SetType(typeVar string) {
o.Type = typeVar
}
// WriteToRequest writes these params to a swagger request
func (o *GetLatestPackageVersionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param name
if err := r.SetPathParam("name", o.Name); err != nil {
return err
}
// path param owner
if err := r.SetPathParam("owner", o.Owner); err != nil {
return err
}
// path param type
if err := r.SetPathParam("type", o.Type); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,168 @@
// Code generated by go-swagger; DO NOT EDIT.
package package_operations
// 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"
)
// GetLatestPackageVersionReader is a Reader for the GetLatestPackageVersion structure.
type GetLatestPackageVersionReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetLatestPackageVersionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetLatestPackageVersionOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewGetLatestPackageVersionNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /packages/{owner}/{type}/{name}/-/latest] getLatestPackageVersion", response, response.Code())
}
}
// NewGetLatestPackageVersionOK creates a GetLatestPackageVersionOK with default headers values
func NewGetLatestPackageVersionOK() *GetLatestPackageVersionOK {
return &GetLatestPackageVersionOK{}
}
/*
GetLatestPackageVersionOK describes a response with status code 200, with default header values.
Package
*/
type GetLatestPackageVersionOK struct {
Payload *models.Package
}
// IsSuccess returns true when this get latest package version o k response has a 2xx status code
func (o *GetLatestPackageVersionOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get latest package version o k response has a 3xx status code
func (o *GetLatestPackageVersionOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get latest package version o k response has a 4xx status code
func (o *GetLatestPackageVersionOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get latest package version o k response has a 5xx status code
func (o *GetLatestPackageVersionOK) IsServerError() bool {
return false
}
// IsCode returns true when this get latest package version o k response a status code equal to that given
func (o *GetLatestPackageVersionOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the get latest package version o k response
func (o *GetLatestPackageVersionOK) Code() int {
return 200
}
func (o *GetLatestPackageVersionOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /packages/{owner}/{type}/{name}/-/latest][%d] getLatestPackageVersionOK %s", 200, payload)
}
func (o *GetLatestPackageVersionOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /packages/{owner}/{type}/{name}/-/latest][%d] getLatestPackageVersionOK %s", 200, payload)
}
func (o *GetLatestPackageVersionOK) GetPayload() *models.Package {
return o.Payload
}
func (o *GetLatestPackageVersionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Package)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetLatestPackageVersionNotFound creates a GetLatestPackageVersionNotFound with default headers values
func NewGetLatestPackageVersionNotFound() *GetLatestPackageVersionNotFound {
return &GetLatestPackageVersionNotFound{}
}
/*
GetLatestPackageVersionNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type GetLatestPackageVersionNotFound struct {
}
// IsSuccess returns true when this get latest package version not found response has a 2xx status code
func (o *GetLatestPackageVersionNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get latest package version not found response has a 3xx status code
func (o *GetLatestPackageVersionNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this get latest package version not found response has a 4xx status code
func (o *GetLatestPackageVersionNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this get latest package version not found response has a 5xx status code
func (o *GetLatestPackageVersionNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this get latest package version not found response a status code equal to that given
func (o *GetLatestPackageVersionNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the get latest package version not found response
func (o *GetLatestPackageVersionNotFound) Code() int {
return 404
}
func (o *GetLatestPackageVersionNotFound) Error() string {
return fmt.Sprintf("[GET /packages/{owner}/{type}/{name}/-/latest][%d] getLatestPackageVersionNotFound", 404)
}
func (o *GetLatestPackageVersionNotFound) String() string {
return fmt.Sprintf("[GET /packages/{owner}/{type}/{name}/-/latest][%d] getLatestPackageVersionNotFound", 404)
}
func (o *GetLatestPackageVersionNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -0,0 +1,217 @@
// Code generated by go-swagger; DO NOT EDIT.
package package_operations
// 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"
)
// NewLinkPackageParams creates a new LinkPackageParams 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 NewLinkPackageParams() *LinkPackageParams {
return &LinkPackageParams{
timeout: cr.DefaultTimeout,
}
}
// NewLinkPackageParamsWithTimeout creates a new LinkPackageParams object
// with the ability to set a timeout on a request.
func NewLinkPackageParamsWithTimeout(timeout time.Duration) *LinkPackageParams {
return &LinkPackageParams{
timeout: timeout,
}
}
// NewLinkPackageParamsWithContext creates a new LinkPackageParams object
// with the ability to set a context for a request.
func NewLinkPackageParamsWithContext(ctx context.Context) *LinkPackageParams {
return &LinkPackageParams{
Context: ctx,
}
}
// NewLinkPackageParamsWithHTTPClient creates a new LinkPackageParams object
// with the ability to set a custom HTTPClient for a request.
func NewLinkPackageParamsWithHTTPClient(client *http.Client) *LinkPackageParams {
return &LinkPackageParams{
HTTPClient: client,
}
}
/*
LinkPackageParams contains all the parameters to send to the API endpoint
for the link package operation.
Typically these are written to a http.Request.
*/
type LinkPackageParams struct {
/* Name.
name of the package
*/
Name string
/* Owner.
owner of the package
*/
Owner string
/* RepoName.
name of the repository to link.
*/
RepoName string
/* Type.
type of the package
*/
Type string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the link package params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *LinkPackageParams) WithDefaults() *LinkPackageParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the link package params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *LinkPackageParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the link package params
func (o *LinkPackageParams) WithTimeout(timeout time.Duration) *LinkPackageParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the link package params
func (o *LinkPackageParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the link package params
func (o *LinkPackageParams) WithContext(ctx context.Context) *LinkPackageParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the link package params
func (o *LinkPackageParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the link package params
func (o *LinkPackageParams) WithHTTPClient(client *http.Client) *LinkPackageParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the link package params
func (o *LinkPackageParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithName adds the name to the link package params
func (o *LinkPackageParams) WithName(name string) *LinkPackageParams {
o.SetName(name)
return o
}
// SetName adds the name to the link package params
func (o *LinkPackageParams) SetName(name string) {
o.Name = name
}
// WithOwner adds the owner to the link package params
func (o *LinkPackageParams) WithOwner(owner string) *LinkPackageParams {
o.SetOwner(owner)
return o
}
// SetOwner adds the owner to the link package params
func (o *LinkPackageParams) SetOwner(owner string) {
o.Owner = owner
}
// WithRepoName adds the repoName to the link package params
func (o *LinkPackageParams) WithRepoName(repoName string) *LinkPackageParams {
o.SetRepoName(repoName)
return o
}
// SetRepoName adds the repoName to the link package params
func (o *LinkPackageParams) SetRepoName(repoName string) {
o.RepoName = repoName
}
// WithType adds the typeVar to the link package params
func (o *LinkPackageParams) WithType(typeVar string) *LinkPackageParams {
o.SetType(typeVar)
return o
}
// SetType adds the type to the link package params
func (o *LinkPackageParams) SetType(typeVar string) {
o.Type = typeVar
}
// WriteToRequest writes these params to a swagger request
func (o *LinkPackageParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param name
if err := r.SetPathParam("name", o.Name); err != nil {
return err
}
// path param owner
if err := r.SetPathParam("owner", o.Owner); err != nil {
return err
}
// path param repo_name
if err := r.SetPathParam("repo_name", o.RepoName); err != nil {
return err
}
// path param type
if err := r.SetPathParam("type", o.Type); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,150 @@
// Code generated by go-swagger; DO NOT EDIT.
package package_operations
// 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"
)
// LinkPackageReader is a Reader for the LinkPackage structure.
type LinkPackageReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *LinkPackageReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 201:
result := NewLinkPackageCreated()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewLinkPackageNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[POST /packages/{owner}/{type}/{name}/-/link/{repo_name}] linkPackage", response, response.Code())
}
}
// NewLinkPackageCreated creates a LinkPackageCreated with default headers values
func NewLinkPackageCreated() *LinkPackageCreated {
return &LinkPackageCreated{}
}
/*
LinkPackageCreated describes a response with status code 201, with default header values.
APIEmpty is an empty response
*/
type LinkPackageCreated struct {
}
// IsSuccess returns true when this link package created response has a 2xx status code
func (o *LinkPackageCreated) IsSuccess() bool {
return true
}
// IsRedirect returns true when this link package created response has a 3xx status code
func (o *LinkPackageCreated) IsRedirect() bool {
return false
}
// IsClientError returns true when this link package created response has a 4xx status code
func (o *LinkPackageCreated) IsClientError() bool {
return false
}
// IsServerError returns true when this link package created response has a 5xx status code
func (o *LinkPackageCreated) IsServerError() bool {
return false
}
// IsCode returns true when this link package created response a status code equal to that given
func (o *LinkPackageCreated) IsCode(code int) bool {
return code == 201
}
// Code gets the status code for the link package created response
func (o *LinkPackageCreated) Code() int {
return 201
}
func (o *LinkPackageCreated) Error() string {
return fmt.Sprintf("[POST /packages/{owner}/{type}/{name}/-/link/{repo_name}][%d] linkPackageCreated", 201)
}
func (o *LinkPackageCreated) String() string {
return fmt.Sprintf("[POST /packages/{owner}/{type}/{name}/-/link/{repo_name}][%d] linkPackageCreated", 201)
}
func (o *LinkPackageCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewLinkPackageNotFound creates a LinkPackageNotFound with default headers values
func NewLinkPackageNotFound() *LinkPackageNotFound {
return &LinkPackageNotFound{}
}
/*
LinkPackageNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type LinkPackageNotFound struct {
}
// IsSuccess returns true when this link package not found response has a 2xx status code
func (o *LinkPackageNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this link package not found response has a 3xx status code
func (o *LinkPackageNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this link package not found response has a 4xx status code
func (o *LinkPackageNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this link package not found response has a 5xx status code
func (o *LinkPackageNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this link package not found response a status code equal to that given
func (o *LinkPackageNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the link package not found response
func (o *LinkPackageNotFound) Code() int {
return 404
}
func (o *LinkPackageNotFound) Error() string {
return fmt.Sprintf("[POST /packages/{owner}/{type}/{name}/-/link/{repo_name}][%d] linkPackageNotFound", 404)
}
func (o *LinkPackageNotFound) String() string {
return fmt.Sprintf("[POST /packages/{owner}/{type}/{name}/-/link/{repo_name}][%d] linkPackageNotFound", 404)
}
func (o *LinkPackageNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -0,0 +1,264 @@
// Code generated by go-swagger; DO NOT EDIT.
package package_operations
// 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"
)
// NewListPackageVersionsParams creates a new ListPackageVersionsParams 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 NewListPackageVersionsParams() *ListPackageVersionsParams {
return &ListPackageVersionsParams{
timeout: cr.DefaultTimeout,
}
}
// NewListPackageVersionsParamsWithTimeout creates a new ListPackageVersionsParams object
// with the ability to set a timeout on a request.
func NewListPackageVersionsParamsWithTimeout(timeout time.Duration) *ListPackageVersionsParams {
return &ListPackageVersionsParams{
timeout: timeout,
}
}
// NewListPackageVersionsParamsWithContext creates a new ListPackageVersionsParams object
// with the ability to set a context for a request.
func NewListPackageVersionsParamsWithContext(ctx context.Context) *ListPackageVersionsParams {
return &ListPackageVersionsParams{
Context: ctx,
}
}
// NewListPackageVersionsParamsWithHTTPClient creates a new ListPackageVersionsParams object
// with the ability to set a custom HTTPClient for a request.
func NewListPackageVersionsParamsWithHTTPClient(client *http.Client) *ListPackageVersionsParams {
return &ListPackageVersionsParams{
HTTPClient: client,
}
}
/*
ListPackageVersionsParams contains all the parameters to send to the API endpoint
for the list package versions operation.
Typically these are written to a http.Request.
*/
type ListPackageVersionsParams struct {
/* Limit.
page size of results
*/
Limit *int64
/* Name.
name of the package
*/
Name string
/* Owner.
owner of the package
*/
Owner string
/* Page.
page number of results to return (1-based)
*/
Page *int64
/* Type.
type of the package
*/
Type string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the list package versions params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListPackageVersionsParams) WithDefaults() *ListPackageVersionsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the list package versions params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListPackageVersionsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the list package versions params
func (o *ListPackageVersionsParams) WithTimeout(timeout time.Duration) *ListPackageVersionsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the list package versions params
func (o *ListPackageVersionsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the list package versions params
func (o *ListPackageVersionsParams) WithContext(ctx context.Context) *ListPackageVersionsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the list package versions params
func (o *ListPackageVersionsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the list package versions params
func (o *ListPackageVersionsParams) WithHTTPClient(client *http.Client) *ListPackageVersionsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the list package versions params
func (o *ListPackageVersionsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithLimit adds the limit to the list package versions params
func (o *ListPackageVersionsParams) WithLimit(limit *int64) *ListPackageVersionsParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the list package versions params
func (o *ListPackageVersionsParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithName adds the name to the list package versions params
func (o *ListPackageVersionsParams) WithName(name string) *ListPackageVersionsParams {
o.SetName(name)
return o
}
// SetName adds the name to the list package versions params
func (o *ListPackageVersionsParams) SetName(name string) {
o.Name = name
}
// WithOwner adds the owner to the list package versions params
func (o *ListPackageVersionsParams) WithOwner(owner string) *ListPackageVersionsParams {
o.SetOwner(owner)
return o
}
// SetOwner adds the owner to the list package versions params
func (o *ListPackageVersionsParams) SetOwner(owner string) {
o.Owner = owner
}
// WithPage adds the page to the list package versions params
func (o *ListPackageVersionsParams) WithPage(page *int64) *ListPackageVersionsParams {
o.SetPage(page)
return o
}
// SetPage adds the page to the list package versions params
func (o *ListPackageVersionsParams) SetPage(page *int64) {
o.Page = page
}
// WithType adds the typeVar to the list package versions params
func (o *ListPackageVersionsParams) WithType(typeVar string) *ListPackageVersionsParams {
o.SetType(typeVar)
return o
}
// SetType adds the type to the list package versions params
func (o *ListPackageVersionsParams) SetType(typeVar string) {
o.Type = typeVar
}
// WriteToRequest writes these params to a swagger request
func (o *ListPackageVersionsParams) 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
}
}
}
// path param name
if err := r.SetPathParam("name", o.Name); err != nil {
return err
}
// path param owner
if err := r.SetPathParam("owner", o.Owner); 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
}
}
}
// path param type
if err := r.SetPathParam("type", o.Type); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,166 @@
// Code generated by go-swagger; DO NOT EDIT.
package package_operations
// 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"
)
// ListPackageVersionsReader is a Reader for the ListPackageVersions structure.
type ListPackageVersionsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ListPackageVersionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewListPackageVersionsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewListPackageVersionsNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /packages/{owner}/{type}/{name}] listPackageVersions", response, response.Code())
}
}
// NewListPackageVersionsOK creates a ListPackageVersionsOK with default headers values
func NewListPackageVersionsOK() *ListPackageVersionsOK {
return &ListPackageVersionsOK{}
}
/*
ListPackageVersionsOK describes a response with status code 200, with default header values.
PackageList
*/
type ListPackageVersionsOK struct {
Payload []*models.Package
}
// IsSuccess returns true when this list package versions o k response has a 2xx status code
func (o *ListPackageVersionsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this list package versions o k response has a 3xx status code
func (o *ListPackageVersionsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this list package versions o k response has a 4xx status code
func (o *ListPackageVersionsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this list package versions o k response has a 5xx status code
func (o *ListPackageVersionsOK) IsServerError() bool {
return false
}
// IsCode returns true when this list package versions o k response a status code equal to that given
func (o *ListPackageVersionsOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the list package versions o k response
func (o *ListPackageVersionsOK) Code() int {
return 200
}
func (o *ListPackageVersionsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /packages/{owner}/{type}/{name}][%d] listPackageVersionsOK %s", 200, payload)
}
func (o *ListPackageVersionsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /packages/{owner}/{type}/{name}][%d] listPackageVersionsOK %s", 200, payload)
}
func (o *ListPackageVersionsOK) GetPayload() []*models.Package {
return o.Payload
}
func (o *ListPackageVersionsOK) 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
}
// NewListPackageVersionsNotFound creates a ListPackageVersionsNotFound with default headers values
func NewListPackageVersionsNotFound() *ListPackageVersionsNotFound {
return &ListPackageVersionsNotFound{}
}
/*
ListPackageVersionsNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type ListPackageVersionsNotFound struct {
}
// IsSuccess returns true when this list package versions not found response has a 2xx status code
func (o *ListPackageVersionsNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this list package versions not found response has a 3xx status code
func (o *ListPackageVersionsNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this list package versions not found response has a 4xx status code
func (o *ListPackageVersionsNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this list package versions not found response has a 5xx status code
func (o *ListPackageVersionsNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this list package versions not found response a status code equal to that given
func (o *ListPackageVersionsNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the list package versions not found response
func (o *ListPackageVersionsNotFound) Code() int {
return 404
}
func (o *ListPackageVersionsNotFound) Error() string {
return fmt.Sprintf("[GET /packages/{owner}/{type}/{name}][%d] listPackageVersionsNotFound", 404)
}
func (o *ListPackageVersionsNotFound) String() string {
return fmt.Sprintf("[GET /packages/{owner}/{type}/{name}][%d] listPackageVersionsNotFound", 404)
}
func (o *ListPackageVersionsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -102,12 +102,20 @@ func WithAcceptTextHTML(r *runtime.ClientOperation) {
type ClientService interface {
DeletePackage(params *DeletePackageParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeletePackageNoContent, error)
GetLatestPackageVersion(params *GetLatestPackageVersionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLatestPackageVersionOK, error)
GetPackage(params *GetPackageParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetPackageOK, error)
LinkPackage(params *LinkPackageParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*LinkPackageCreated, error)
ListPackageFiles(params *ListPackageFilesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListPackageFilesOK, error)
ListPackageVersions(params *ListPackageVersionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListPackageVersionsOK, error)
ListPackages(params *ListPackagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListPackagesOK, error)
UnlinkPackage(params *UnlinkPackageParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UnlinkPackageCreated, error)
SetTransport(transport runtime.ClientTransport)
}
@@ -150,6 +158,45 @@ func (a *Client) DeletePackage(params *DeletePackageParams, authInfo runtime.Cli
panic(msg)
}
/*
GetLatestPackageVersion gets the latest version of a package
*/
func (a *Client) GetLatestPackageVersion(params *GetLatestPackageVersionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLatestPackageVersionOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetLatestPackageVersionParams()
}
op := &runtime.ClientOperation{
ID: "getLatestPackageVersion",
Method: "GET",
PathPattern: "/packages/{owner}/{type}/{name}/-/latest",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "text/plain"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetLatestPackageVersionReader{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.(*GetLatestPackageVersionOK)
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 getLatestPackageVersion: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetPackage gets a package
*/
@@ -189,6 +236,45 @@ func (a *Client) GetPackage(params *GetPackageParams, authInfo runtime.ClientAut
panic(msg)
}
/*
LinkPackage links a package to a repository
*/
func (a *Client) LinkPackage(params *LinkPackageParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*LinkPackageCreated, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewLinkPackageParams()
}
op := &runtime.ClientOperation{
ID: "linkPackage",
Method: "POST",
PathPattern: "/packages/{owner}/{type}/{name}/-/link/{repo_name}",
ProducesMediaTypes: []string{"application/json", "text/html"},
ConsumesMediaTypes: []string{"application/json", "text/plain"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &LinkPackageReader{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.(*LinkPackageCreated)
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 linkPackage: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
ListPackageFiles gets all files of a package
*/
@@ -228,6 +314,45 @@ func (a *Client) ListPackageFiles(params *ListPackageFilesParams, authInfo runti
panic(msg)
}
/*
ListPackageVersions gets all versions of a package
*/
func (a *Client) ListPackageVersions(params *ListPackageVersionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListPackageVersionsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListPackageVersionsParams()
}
op := &runtime.ClientOperation{
ID: "listPackageVersions",
Method: "GET",
PathPattern: "/packages/{owner}/{type}/{name}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "text/plain"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &ListPackageVersionsReader{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.(*ListPackageVersionsOK)
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 listPackageVersions: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
ListPackages gets all packages of an owner
*/
@@ -267,6 +392,45 @@ func (a *Client) ListPackages(params *ListPackagesParams, authInfo runtime.Clien
panic(msg)
}
/*
UnlinkPackage unlinks a package from a repository
*/
func (a *Client) UnlinkPackage(params *UnlinkPackageParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UnlinkPackageCreated, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewUnlinkPackageParams()
}
op := &runtime.ClientOperation{
ID: "unlinkPackage",
Method: "POST",
PathPattern: "/packages/{owner}/{type}/{name}/-/unlink",
ProducesMediaTypes: []string{"application/json", "text/html"},
ConsumesMediaTypes: []string{"application/json", "text/plain"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &UnlinkPackageReader{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.(*UnlinkPackageCreated)
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 unlinkPackage: 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

View File

@@ -0,0 +1,195 @@
// Code generated by go-swagger; DO NOT EDIT.
package package_operations
// 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"
)
// NewUnlinkPackageParams creates a new UnlinkPackageParams 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 NewUnlinkPackageParams() *UnlinkPackageParams {
return &UnlinkPackageParams{
timeout: cr.DefaultTimeout,
}
}
// NewUnlinkPackageParamsWithTimeout creates a new UnlinkPackageParams object
// with the ability to set a timeout on a request.
func NewUnlinkPackageParamsWithTimeout(timeout time.Duration) *UnlinkPackageParams {
return &UnlinkPackageParams{
timeout: timeout,
}
}
// NewUnlinkPackageParamsWithContext creates a new UnlinkPackageParams object
// with the ability to set a context for a request.
func NewUnlinkPackageParamsWithContext(ctx context.Context) *UnlinkPackageParams {
return &UnlinkPackageParams{
Context: ctx,
}
}
// NewUnlinkPackageParamsWithHTTPClient creates a new UnlinkPackageParams object
// with the ability to set a custom HTTPClient for a request.
func NewUnlinkPackageParamsWithHTTPClient(client *http.Client) *UnlinkPackageParams {
return &UnlinkPackageParams{
HTTPClient: client,
}
}
/*
UnlinkPackageParams contains all the parameters to send to the API endpoint
for the unlink package operation.
Typically these are written to a http.Request.
*/
type UnlinkPackageParams struct {
/* Name.
name of the package
*/
Name string
/* Owner.
owner of the package
*/
Owner string
/* Type.
type of the package
*/
Type string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the unlink package params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *UnlinkPackageParams) WithDefaults() *UnlinkPackageParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the unlink package params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *UnlinkPackageParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the unlink package params
func (o *UnlinkPackageParams) WithTimeout(timeout time.Duration) *UnlinkPackageParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the unlink package params
func (o *UnlinkPackageParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the unlink package params
func (o *UnlinkPackageParams) WithContext(ctx context.Context) *UnlinkPackageParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the unlink package params
func (o *UnlinkPackageParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the unlink package params
func (o *UnlinkPackageParams) WithHTTPClient(client *http.Client) *UnlinkPackageParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the unlink package params
func (o *UnlinkPackageParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithName adds the name to the unlink package params
func (o *UnlinkPackageParams) WithName(name string) *UnlinkPackageParams {
o.SetName(name)
return o
}
// SetName adds the name to the unlink package params
func (o *UnlinkPackageParams) SetName(name string) {
o.Name = name
}
// WithOwner adds the owner to the unlink package params
func (o *UnlinkPackageParams) WithOwner(owner string) *UnlinkPackageParams {
o.SetOwner(owner)
return o
}
// SetOwner adds the owner to the unlink package params
func (o *UnlinkPackageParams) SetOwner(owner string) {
o.Owner = owner
}
// WithType adds the typeVar to the unlink package params
func (o *UnlinkPackageParams) WithType(typeVar string) *UnlinkPackageParams {
o.SetType(typeVar)
return o
}
// SetType adds the type to the unlink package params
func (o *UnlinkPackageParams) SetType(typeVar string) {
o.Type = typeVar
}
// WriteToRequest writes these params to a swagger request
func (o *UnlinkPackageParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param name
if err := r.SetPathParam("name", o.Name); err != nil {
return err
}
// path param owner
if err := r.SetPathParam("owner", o.Owner); err != nil {
return err
}
// path param type
if err := r.SetPathParam("type", o.Type); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,150 @@
// Code generated by go-swagger; DO NOT EDIT.
package package_operations
// 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"
)
// UnlinkPackageReader is a Reader for the UnlinkPackage structure.
type UnlinkPackageReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *UnlinkPackageReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 201:
result := NewUnlinkPackageCreated()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
result := NewUnlinkPackageNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[POST /packages/{owner}/{type}/{name}/-/unlink] unlinkPackage", response, response.Code())
}
}
// NewUnlinkPackageCreated creates a UnlinkPackageCreated with default headers values
func NewUnlinkPackageCreated() *UnlinkPackageCreated {
return &UnlinkPackageCreated{}
}
/*
UnlinkPackageCreated describes a response with status code 201, with default header values.
APIEmpty is an empty response
*/
type UnlinkPackageCreated struct {
}
// IsSuccess returns true when this unlink package created response has a 2xx status code
func (o *UnlinkPackageCreated) IsSuccess() bool {
return true
}
// IsRedirect returns true when this unlink package created response has a 3xx status code
func (o *UnlinkPackageCreated) IsRedirect() bool {
return false
}
// IsClientError returns true when this unlink package created response has a 4xx status code
func (o *UnlinkPackageCreated) IsClientError() bool {
return false
}
// IsServerError returns true when this unlink package created response has a 5xx status code
func (o *UnlinkPackageCreated) IsServerError() bool {
return false
}
// IsCode returns true when this unlink package created response a status code equal to that given
func (o *UnlinkPackageCreated) IsCode(code int) bool {
return code == 201
}
// Code gets the status code for the unlink package created response
func (o *UnlinkPackageCreated) Code() int {
return 201
}
func (o *UnlinkPackageCreated) Error() string {
return fmt.Sprintf("[POST /packages/{owner}/{type}/{name}/-/unlink][%d] unlinkPackageCreated", 201)
}
func (o *UnlinkPackageCreated) String() string {
return fmt.Sprintf("[POST /packages/{owner}/{type}/{name}/-/unlink][%d] unlinkPackageCreated", 201)
}
func (o *UnlinkPackageCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewUnlinkPackageNotFound creates a UnlinkPackageNotFound with default headers values
func NewUnlinkPackageNotFound() *UnlinkPackageNotFound {
return &UnlinkPackageNotFound{}
}
/*
UnlinkPackageNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type UnlinkPackageNotFound struct {
}
// IsSuccess returns true when this unlink package not found response has a 2xx status code
func (o *UnlinkPackageNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this unlink package not found response has a 3xx status code
func (o *UnlinkPackageNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this unlink package not found response has a 4xx status code
func (o *UnlinkPackageNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this unlink package not found response has a 5xx status code
func (o *UnlinkPackageNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this unlink package not found response a status code equal to that given
func (o *UnlinkPackageNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the unlink package not found response
func (o *UnlinkPackageNotFound) Code() int {
return 404
}
func (o *UnlinkPackageNotFound) Error() string {
return fmt.Sprintf("[POST /packages/{owner}/{type}/{name}/-/unlink][%d] unlinkPackageNotFound", 404)
}
func (o *UnlinkPackageNotFound) String() string {
return fmt.Sprintf("[POST /packages/{owner}/{type}/{name}/-/unlink][%d] unlinkPackageNotFound", 404)
}
func (o *UnlinkPackageNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@@ -0,0 +1,195 @@
// Code generated by go-swagger; DO NOT EDIT.
package repository
// 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"
)
// NewActionsDisableWorkflowParams creates a new ActionsDisableWorkflowParams 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 NewActionsDisableWorkflowParams() *ActionsDisableWorkflowParams {
return &ActionsDisableWorkflowParams{
timeout: cr.DefaultTimeout,
}
}
// NewActionsDisableWorkflowParamsWithTimeout creates a new ActionsDisableWorkflowParams object
// with the ability to set a timeout on a request.
func NewActionsDisableWorkflowParamsWithTimeout(timeout time.Duration) *ActionsDisableWorkflowParams {
return &ActionsDisableWorkflowParams{
timeout: timeout,
}
}
// NewActionsDisableWorkflowParamsWithContext creates a new ActionsDisableWorkflowParams object
// with the ability to set a context for a request.
func NewActionsDisableWorkflowParamsWithContext(ctx context.Context) *ActionsDisableWorkflowParams {
return &ActionsDisableWorkflowParams{
Context: ctx,
}
}
// NewActionsDisableWorkflowParamsWithHTTPClient creates a new ActionsDisableWorkflowParams object
// with the ability to set a custom HTTPClient for a request.
func NewActionsDisableWorkflowParamsWithHTTPClient(client *http.Client) *ActionsDisableWorkflowParams {
return &ActionsDisableWorkflowParams{
HTTPClient: client,
}
}
/*
ActionsDisableWorkflowParams contains all the parameters to send to the API endpoint
for the actions disable workflow operation.
Typically these are written to a http.Request.
*/
type ActionsDisableWorkflowParams struct {
/* Owner.
owner of the repo
*/
Owner string
/* Repo.
name of the repo
*/
Repo string
/* WorkflowID.
id of the workflow
*/
WorkflowID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the actions disable workflow params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ActionsDisableWorkflowParams) WithDefaults() *ActionsDisableWorkflowParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the actions disable workflow params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ActionsDisableWorkflowParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the actions disable workflow params
func (o *ActionsDisableWorkflowParams) WithTimeout(timeout time.Duration) *ActionsDisableWorkflowParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the actions disable workflow params
func (o *ActionsDisableWorkflowParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the actions disable workflow params
func (o *ActionsDisableWorkflowParams) WithContext(ctx context.Context) *ActionsDisableWorkflowParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the actions disable workflow params
func (o *ActionsDisableWorkflowParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the actions disable workflow params
func (o *ActionsDisableWorkflowParams) WithHTTPClient(client *http.Client) *ActionsDisableWorkflowParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the actions disable workflow params
func (o *ActionsDisableWorkflowParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithOwner adds the owner to the actions disable workflow params
func (o *ActionsDisableWorkflowParams) WithOwner(owner string) *ActionsDisableWorkflowParams {
o.SetOwner(owner)
return o
}
// SetOwner adds the owner to the actions disable workflow params
func (o *ActionsDisableWorkflowParams) SetOwner(owner string) {
o.Owner = owner
}
// WithRepo adds the repo to the actions disable workflow params
func (o *ActionsDisableWorkflowParams) WithRepo(repo string) *ActionsDisableWorkflowParams {
o.SetRepo(repo)
return o
}
// SetRepo adds the repo to the actions disable workflow params
func (o *ActionsDisableWorkflowParams) SetRepo(repo string) {
o.Repo = repo
}
// WithWorkflowID adds the workflowID to the actions disable workflow params
func (o *ActionsDisableWorkflowParams) WithWorkflowID(workflowID string) *ActionsDisableWorkflowParams {
o.SetWorkflowID(workflowID)
return o
}
// SetWorkflowID adds the workflowId to the actions disable workflow params
func (o *ActionsDisableWorkflowParams) SetWorkflowID(workflowID string) {
o.WorkflowID = workflowID
}
// WriteToRequest writes these params to a swagger request
func (o *ActionsDisableWorkflowParams) 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
}
// path param workflow_id
if err := r.SetPathParam("workflow_id", o.WorkflowID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,384 @@
// Code generated by go-swagger; DO NOT EDIT.
package repository
// 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"
)
// ActionsDisableWorkflowReader is a Reader for the ActionsDisableWorkflow structure.
type ActionsDisableWorkflowReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ActionsDisableWorkflowReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 204:
result := NewActionsDisableWorkflowNoContent()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewActionsDisableWorkflowBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewActionsDisableWorkflowForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewActionsDisableWorkflowNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewActionsDisableWorkflowUnprocessableEntity()
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}/actions/workflows/{workflow_id}/disable] ActionsDisableWorkflow", response, response.Code())
}
}
// NewActionsDisableWorkflowNoContent creates a ActionsDisableWorkflowNoContent with default headers values
func NewActionsDisableWorkflowNoContent() *ActionsDisableWorkflowNoContent {
return &ActionsDisableWorkflowNoContent{}
}
/*
ActionsDisableWorkflowNoContent describes a response with status code 204, with default header values.
No Content
*/
type ActionsDisableWorkflowNoContent struct {
}
// IsSuccess returns true when this actions disable workflow no content response has a 2xx status code
func (o *ActionsDisableWorkflowNoContent) IsSuccess() bool {
return true
}
// IsRedirect returns true when this actions disable workflow no content response has a 3xx status code
func (o *ActionsDisableWorkflowNoContent) IsRedirect() bool {
return false
}
// IsClientError returns true when this actions disable workflow no content response has a 4xx status code
func (o *ActionsDisableWorkflowNoContent) IsClientError() bool {
return false
}
// IsServerError returns true when this actions disable workflow no content response has a 5xx status code
func (o *ActionsDisableWorkflowNoContent) IsServerError() bool {
return false
}
// IsCode returns true when this actions disable workflow no content response a status code equal to that given
func (o *ActionsDisableWorkflowNoContent) IsCode(code int) bool {
return code == 204
}
// Code gets the status code for the actions disable workflow no content response
func (o *ActionsDisableWorkflowNoContent) Code() int {
return 204
}
func (o *ActionsDisableWorkflowNoContent) Error() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable][%d] actionsDisableWorkflowNoContent", 204)
}
func (o *ActionsDisableWorkflowNoContent) String() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable][%d] actionsDisableWorkflowNoContent", 204)
}
func (o *ActionsDisableWorkflowNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewActionsDisableWorkflowBadRequest creates a ActionsDisableWorkflowBadRequest with default headers values
func NewActionsDisableWorkflowBadRequest() *ActionsDisableWorkflowBadRequest {
return &ActionsDisableWorkflowBadRequest{}
}
/*
ActionsDisableWorkflowBadRequest describes a response with status code 400, with default header values.
APIError is error format response
*/
type ActionsDisableWorkflowBadRequest struct {
Message string
URL string
}
// IsSuccess returns true when this actions disable workflow bad request response has a 2xx status code
func (o *ActionsDisableWorkflowBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this actions disable workflow bad request response has a 3xx status code
func (o *ActionsDisableWorkflowBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this actions disable workflow bad request response has a 4xx status code
func (o *ActionsDisableWorkflowBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this actions disable workflow bad request response has a 5xx status code
func (o *ActionsDisableWorkflowBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this actions disable workflow bad request response a status code equal to that given
func (o *ActionsDisableWorkflowBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the actions disable workflow bad request response
func (o *ActionsDisableWorkflowBadRequest) Code() int {
return 400
}
func (o *ActionsDisableWorkflowBadRequest) Error() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable][%d] actionsDisableWorkflowBadRequest", 400)
}
func (o *ActionsDisableWorkflowBadRequest) String() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable][%d] actionsDisableWorkflowBadRequest", 400)
}
func (o *ActionsDisableWorkflowBadRequest) 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
}
// NewActionsDisableWorkflowForbidden creates a ActionsDisableWorkflowForbidden with default headers values
func NewActionsDisableWorkflowForbidden() *ActionsDisableWorkflowForbidden {
return &ActionsDisableWorkflowForbidden{}
}
/*
ActionsDisableWorkflowForbidden describes a response with status code 403, with default header values.
APIForbiddenError is a forbidden error response
*/
type ActionsDisableWorkflowForbidden struct {
Message string
URL string
}
// IsSuccess returns true when this actions disable workflow forbidden response has a 2xx status code
func (o *ActionsDisableWorkflowForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this actions disable workflow forbidden response has a 3xx status code
func (o *ActionsDisableWorkflowForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this actions disable workflow forbidden response has a 4xx status code
func (o *ActionsDisableWorkflowForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this actions disable workflow forbidden response has a 5xx status code
func (o *ActionsDisableWorkflowForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this actions disable workflow forbidden response a status code equal to that given
func (o *ActionsDisableWorkflowForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the actions disable workflow forbidden response
func (o *ActionsDisableWorkflowForbidden) Code() int {
return 403
}
func (o *ActionsDisableWorkflowForbidden) Error() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable][%d] actionsDisableWorkflowForbidden", 403)
}
func (o *ActionsDisableWorkflowForbidden) String() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable][%d] actionsDisableWorkflowForbidden", 403)
}
func (o *ActionsDisableWorkflowForbidden) 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
}
// NewActionsDisableWorkflowNotFound creates a ActionsDisableWorkflowNotFound with default headers values
func NewActionsDisableWorkflowNotFound() *ActionsDisableWorkflowNotFound {
return &ActionsDisableWorkflowNotFound{}
}
/*
ActionsDisableWorkflowNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type ActionsDisableWorkflowNotFound struct {
}
// IsSuccess returns true when this actions disable workflow not found response has a 2xx status code
func (o *ActionsDisableWorkflowNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this actions disable workflow not found response has a 3xx status code
func (o *ActionsDisableWorkflowNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this actions disable workflow not found response has a 4xx status code
func (o *ActionsDisableWorkflowNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this actions disable workflow not found response has a 5xx status code
func (o *ActionsDisableWorkflowNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this actions disable workflow not found response a status code equal to that given
func (o *ActionsDisableWorkflowNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the actions disable workflow not found response
func (o *ActionsDisableWorkflowNotFound) Code() int {
return 404
}
func (o *ActionsDisableWorkflowNotFound) Error() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable][%d] actionsDisableWorkflowNotFound", 404)
}
func (o *ActionsDisableWorkflowNotFound) String() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable][%d] actionsDisableWorkflowNotFound", 404)
}
func (o *ActionsDisableWorkflowNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewActionsDisableWorkflowUnprocessableEntity creates a ActionsDisableWorkflowUnprocessableEntity with default headers values
func NewActionsDisableWorkflowUnprocessableEntity() *ActionsDisableWorkflowUnprocessableEntity {
return &ActionsDisableWorkflowUnprocessableEntity{}
}
/*
ActionsDisableWorkflowUnprocessableEntity describes a response with status code 422, with default header values.
APIValidationError is error format response related to input validation
*/
type ActionsDisableWorkflowUnprocessableEntity struct {
Message string
URL string
}
// IsSuccess returns true when this actions disable workflow unprocessable entity response has a 2xx status code
func (o *ActionsDisableWorkflowUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this actions disable workflow unprocessable entity response has a 3xx status code
func (o *ActionsDisableWorkflowUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this actions disable workflow unprocessable entity response has a 4xx status code
func (o *ActionsDisableWorkflowUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this actions disable workflow unprocessable entity response has a 5xx status code
func (o *ActionsDisableWorkflowUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this actions disable workflow unprocessable entity response a status code equal to that given
func (o *ActionsDisableWorkflowUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the actions disable workflow unprocessable entity response
func (o *ActionsDisableWorkflowUnprocessableEntity) Code() int {
return 422
}
func (o *ActionsDisableWorkflowUnprocessableEntity) Error() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable][%d] actionsDisableWorkflowUnprocessableEntity", 422)
}
func (o *ActionsDisableWorkflowUnprocessableEntity) String() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable][%d] actionsDisableWorkflowUnprocessableEntity", 422)
}
func (o *ActionsDisableWorkflowUnprocessableEntity) 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
}

View File

@@ -0,0 +1,216 @@
// Code generated by go-swagger; DO NOT EDIT.
package repository
// 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"
)
// NewActionsDispatchWorkflowParams creates a new ActionsDispatchWorkflowParams 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 NewActionsDispatchWorkflowParams() *ActionsDispatchWorkflowParams {
return &ActionsDispatchWorkflowParams{
timeout: cr.DefaultTimeout,
}
}
// NewActionsDispatchWorkflowParamsWithTimeout creates a new ActionsDispatchWorkflowParams object
// with the ability to set a timeout on a request.
func NewActionsDispatchWorkflowParamsWithTimeout(timeout time.Duration) *ActionsDispatchWorkflowParams {
return &ActionsDispatchWorkflowParams{
timeout: timeout,
}
}
// NewActionsDispatchWorkflowParamsWithContext creates a new ActionsDispatchWorkflowParams object
// with the ability to set a context for a request.
func NewActionsDispatchWorkflowParamsWithContext(ctx context.Context) *ActionsDispatchWorkflowParams {
return &ActionsDispatchWorkflowParams{
Context: ctx,
}
}
// NewActionsDispatchWorkflowParamsWithHTTPClient creates a new ActionsDispatchWorkflowParams object
// with the ability to set a custom HTTPClient for a request.
func NewActionsDispatchWorkflowParamsWithHTTPClient(client *http.Client) *ActionsDispatchWorkflowParams {
return &ActionsDispatchWorkflowParams{
HTTPClient: client,
}
}
/*
ActionsDispatchWorkflowParams contains all the parameters to send to the API endpoint
for the actions dispatch workflow operation.
Typically these are written to a http.Request.
*/
type ActionsDispatchWorkflowParams struct {
// Body.
Body *models.CreateActionWorkflowDispatch
/* Owner.
owner of the repo
*/
Owner string
/* Repo.
name of the repo
*/
Repo string
/* WorkflowID.
id of the workflow
*/
WorkflowID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the actions dispatch workflow params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ActionsDispatchWorkflowParams) WithDefaults() *ActionsDispatchWorkflowParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the actions dispatch workflow params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ActionsDispatchWorkflowParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the actions dispatch workflow params
func (o *ActionsDispatchWorkflowParams) WithTimeout(timeout time.Duration) *ActionsDispatchWorkflowParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the actions dispatch workflow params
func (o *ActionsDispatchWorkflowParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the actions dispatch workflow params
func (o *ActionsDispatchWorkflowParams) WithContext(ctx context.Context) *ActionsDispatchWorkflowParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the actions dispatch workflow params
func (o *ActionsDispatchWorkflowParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the actions dispatch workflow params
func (o *ActionsDispatchWorkflowParams) WithHTTPClient(client *http.Client) *ActionsDispatchWorkflowParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the actions dispatch workflow params
func (o *ActionsDispatchWorkflowParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the actions dispatch workflow params
func (o *ActionsDispatchWorkflowParams) WithBody(body *models.CreateActionWorkflowDispatch) *ActionsDispatchWorkflowParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the actions dispatch workflow params
func (o *ActionsDispatchWorkflowParams) SetBody(body *models.CreateActionWorkflowDispatch) {
o.Body = body
}
// WithOwner adds the owner to the actions dispatch workflow params
func (o *ActionsDispatchWorkflowParams) WithOwner(owner string) *ActionsDispatchWorkflowParams {
o.SetOwner(owner)
return o
}
// SetOwner adds the owner to the actions dispatch workflow params
func (o *ActionsDispatchWorkflowParams) SetOwner(owner string) {
o.Owner = owner
}
// WithRepo adds the repo to the actions dispatch workflow params
func (o *ActionsDispatchWorkflowParams) WithRepo(repo string) *ActionsDispatchWorkflowParams {
o.SetRepo(repo)
return o
}
// SetRepo adds the repo to the actions dispatch workflow params
func (o *ActionsDispatchWorkflowParams) SetRepo(repo string) {
o.Repo = repo
}
// WithWorkflowID adds the workflowID to the actions dispatch workflow params
func (o *ActionsDispatchWorkflowParams) WithWorkflowID(workflowID string) *ActionsDispatchWorkflowParams {
o.SetWorkflowID(workflowID)
return o
}
// SetWorkflowID adds the workflowId to the actions dispatch workflow params
func (o *ActionsDispatchWorkflowParams) SetWorkflowID(workflowID string) {
o.WorkflowID = workflowID
}
// WriteToRequest writes these params to a swagger request
func (o *ActionsDispatchWorkflowParams) 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
}
// path param workflow_id
if err := r.SetPathParam("workflow_id", o.WorkflowID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,384 @@
// Code generated by go-swagger; DO NOT EDIT.
package repository
// 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"
)
// ActionsDispatchWorkflowReader is a Reader for the ActionsDispatchWorkflow structure.
type ActionsDispatchWorkflowReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ActionsDispatchWorkflowReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 204:
result := NewActionsDispatchWorkflowNoContent()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewActionsDispatchWorkflowBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewActionsDispatchWorkflowForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewActionsDispatchWorkflowNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewActionsDispatchWorkflowUnprocessableEntity()
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}/actions/workflows/{workflow_id}/dispatches] ActionsDispatchWorkflow", response, response.Code())
}
}
// NewActionsDispatchWorkflowNoContent creates a ActionsDispatchWorkflowNoContent with default headers values
func NewActionsDispatchWorkflowNoContent() *ActionsDispatchWorkflowNoContent {
return &ActionsDispatchWorkflowNoContent{}
}
/*
ActionsDispatchWorkflowNoContent describes a response with status code 204, with default header values.
No Content
*/
type ActionsDispatchWorkflowNoContent struct {
}
// IsSuccess returns true when this actions dispatch workflow no content response has a 2xx status code
func (o *ActionsDispatchWorkflowNoContent) IsSuccess() bool {
return true
}
// IsRedirect returns true when this actions dispatch workflow no content response has a 3xx status code
func (o *ActionsDispatchWorkflowNoContent) IsRedirect() bool {
return false
}
// IsClientError returns true when this actions dispatch workflow no content response has a 4xx status code
func (o *ActionsDispatchWorkflowNoContent) IsClientError() bool {
return false
}
// IsServerError returns true when this actions dispatch workflow no content response has a 5xx status code
func (o *ActionsDispatchWorkflowNoContent) IsServerError() bool {
return false
}
// IsCode returns true when this actions dispatch workflow no content response a status code equal to that given
func (o *ActionsDispatchWorkflowNoContent) IsCode(code int) bool {
return code == 204
}
// Code gets the status code for the actions dispatch workflow no content response
func (o *ActionsDispatchWorkflowNoContent) Code() int {
return 204
}
func (o *ActionsDispatchWorkflowNoContent) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches][%d] actionsDispatchWorkflowNoContent", 204)
}
func (o *ActionsDispatchWorkflowNoContent) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches][%d] actionsDispatchWorkflowNoContent", 204)
}
func (o *ActionsDispatchWorkflowNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewActionsDispatchWorkflowBadRequest creates a ActionsDispatchWorkflowBadRequest with default headers values
func NewActionsDispatchWorkflowBadRequest() *ActionsDispatchWorkflowBadRequest {
return &ActionsDispatchWorkflowBadRequest{}
}
/*
ActionsDispatchWorkflowBadRequest describes a response with status code 400, with default header values.
APIError is error format response
*/
type ActionsDispatchWorkflowBadRequest struct {
Message string
URL string
}
// IsSuccess returns true when this actions dispatch workflow bad request response has a 2xx status code
func (o *ActionsDispatchWorkflowBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this actions dispatch workflow bad request response has a 3xx status code
func (o *ActionsDispatchWorkflowBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this actions dispatch workflow bad request response has a 4xx status code
func (o *ActionsDispatchWorkflowBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this actions dispatch workflow bad request response has a 5xx status code
func (o *ActionsDispatchWorkflowBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this actions dispatch workflow bad request response a status code equal to that given
func (o *ActionsDispatchWorkflowBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the actions dispatch workflow bad request response
func (o *ActionsDispatchWorkflowBadRequest) Code() int {
return 400
}
func (o *ActionsDispatchWorkflowBadRequest) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches][%d] actionsDispatchWorkflowBadRequest", 400)
}
func (o *ActionsDispatchWorkflowBadRequest) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches][%d] actionsDispatchWorkflowBadRequest", 400)
}
func (o *ActionsDispatchWorkflowBadRequest) 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
}
// NewActionsDispatchWorkflowForbidden creates a ActionsDispatchWorkflowForbidden with default headers values
func NewActionsDispatchWorkflowForbidden() *ActionsDispatchWorkflowForbidden {
return &ActionsDispatchWorkflowForbidden{}
}
/*
ActionsDispatchWorkflowForbidden describes a response with status code 403, with default header values.
APIForbiddenError is a forbidden error response
*/
type ActionsDispatchWorkflowForbidden struct {
Message string
URL string
}
// IsSuccess returns true when this actions dispatch workflow forbidden response has a 2xx status code
func (o *ActionsDispatchWorkflowForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this actions dispatch workflow forbidden response has a 3xx status code
func (o *ActionsDispatchWorkflowForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this actions dispatch workflow forbidden response has a 4xx status code
func (o *ActionsDispatchWorkflowForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this actions dispatch workflow forbidden response has a 5xx status code
func (o *ActionsDispatchWorkflowForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this actions dispatch workflow forbidden response a status code equal to that given
func (o *ActionsDispatchWorkflowForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the actions dispatch workflow forbidden response
func (o *ActionsDispatchWorkflowForbidden) Code() int {
return 403
}
func (o *ActionsDispatchWorkflowForbidden) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches][%d] actionsDispatchWorkflowForbidden", 403)
}
func (o *ActionsDispatchWorkflowForbidden) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches][%d] actionsDispatchWorkflowForbidden", 403)
}
func (o *ActionsDispatchWorkflowForbidden) 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
}
// NewActionsDispatchWorkflowNotFound creates a ActionsDispatchWorkflowNotFound with default headers values
func NewActionsDispatchWorkflowNotFound() *ActionsDispatchWorkflowNotFound {
return &ActionsDispatchWorkflowNotFound{}
}
/*
ActionsDispatchWorkflowNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type ActionsDispatchWorkflowNotFound struct {
}
// IsSuccess returns true when this actions dispatch workflow not found response has a 2xx status code
func (o *ActionsDispatchWorkflowNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this actions dispatch workflow not found response has a 3xx status code
func (o *ActionsDispatchWorkflowNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this actions dispatch workflow not found response has a 4xx status code
func (o *ActionsDispatchWorkflowNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this actions dispatch workflow not found response has a 5xx status code
func (o *ActionsDispatchWorkflowNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this actions dispatch workflow not found response a status code equal to that given
func (o *ActionsDispatchWorkflowNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the actions dispatch workflow not found response
func (o *ActionsDispatchWorkflowNotFound) Code() int {
return 404
}
func (o *ActionsDispatchWorkflowNotFound) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches][%d] actionsDispatchWorkflowNotFound", 404)
}
func (o *ActionsDispatchWorkflowNotFound) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches][%d] actionsDispatchWorkflowNotFound", 404)
}
func (o *ActionsDispatchWorkflowNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewActionsDispatchWorkflowUnprocessableEntity creates a ActionsDispatchWorkflowUnprocessableEntity with default headers values
func NewActionsDispatchWorkflowUnprocessableEntity() *ActionsDispatchWorkflowUnprocessableEntity {
return &ActionsDispatchWorkflowUnprocessableEntity{}
}
/*
ActionsDispatchWorkflowUnprocessableEntity describes a response with status code 422, with default header values.
APIValidationError is error format response related to input validation
*/
type ActionsDispatchWorkflowUnprocessableEntity struct {
Message string
URL string
}
// IsSuccess returns true when this actions dispatch workflow unprocessable entity response has a 2xx status code
func (o *ActionsDispatchWorkflowUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this actions dispatch workflow unprocessable entity response has a 3xx status code
func (o *ActionsDispatchWorkflowUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this actions dispatch workflow unprocessable entity response has a 4xx status code
func (o *ActionsDispatchWorkflowUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this actions dispatch workflow unprocessable entity response has a 5xx status code
func (o *ActionsDispatchWorkflowUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this actions dispatch workflow unprocessable entity response a status code equal to that given
func (o *ActionsDispatchWorkflowUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the actions dispatch workflow unprocessable entity response
func (o *ActionsDispatchWorkflowUnprocessableEntity) Code() int {
return 422
}
func (o *ActionsDispatchWorkflowUnprocessableEntity) Error() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches][%d] actionsDispatchWorkflowUnprocessableEntity", 422)
}
func (o *ActionsDispatchWorkflowUnprocessableEntity) String() string {
return fmt.Sprintf("[POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches][%d] actionsDispatchWorkflowUnprocessableEntity", 422)
}
func (o *ActionsDispatchWorkflowUnprocessableEntity) 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
}

View File

@@ -0,0 +1,195 @@
// Code generated by go-swagger; DO NOT EDIT.
package repository
// 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"
)
// NewActionsEnableWorkflowParams creates a new ActionsEnableWorkflowParams 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 NewActionsEnableWorkflowParams() *ActionsEnableWorkflowParams {
return &ActionsEnableWorkflowParams{
timeout: cr.DefaultTimeout,
}
}
// NewActionsEnableWorkflowParamsWithTimeout creates a new ActionsEnableWorkflowParams object
// with the ability to set a timeout on a request.
func NewActionsEnableWorkflowParamsWithTimeout(timeout time.Duration) *ActionsEnableWorkflowParams {
return &ActionsEnableWorkflowParams{
timeout: timeout,
}
}
// NewActionsEnableWorkflowParamsWithContext creates a new ActionsEnableWorkflowParams object
// with the ability to set a context for a request.
func NewActionsEnableWorkflowParamsWithContext(ctx context.Context) *ActionsEnableWorkflowParams {
return &ActionsEnableWorkflowParams{
Context: ctx,
}
}
// NewActionsEnableWorkflowParamsWithHTTPClient creates a new ActionsEnableWorkflowParams object
// with the ability to set a custom HTTPClient for a request.
func NewActionsEnableWorkflowParamsWithHTTPClient(client *http.Client) *ActionsEnableWorkflowParams {
return &ActionsEnableWorkflowParams{
HTTPClient: client,
}
}
/*
ActionsEnableWorkflowParams contains all the parameters to send to the API endpoint
for the actions enable workflow operation.
Typically these are written to a http.Request.
*/
type ActionsEnableWorkflowParams struct {
/* Owner.
owner of the repo
*/
Owner string
/* Repo.
name of the repo
*/
Repo string
/* WorkflowID.
id of the workflow
*/
WorkflowID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the actions enable workflow params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ActionsEnableWorkflowParams) WithDefaults() *ActionsEnableWorkflowParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the actions enable workflow params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ActionsEnableWorkflowParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the actions enable workflow params
func (o *ActionsEnableWorkflowParams) WithTimeout(timeout time.Duration) *ActionsEnableWorkflowParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the actions enable workflow params
func (o *ActionsEnableWorkflowParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the actions enable workflow params
func (o *ActionsEnableWorkflowParams) WithContext(ctx context.Context) *ActionsEnableWorkflowParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the actions enable workflow params
func (o *ActionsEnableWorkflowParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the actions enable workflow params
func (o *ActionsEnableWorkflowParams) WithHTTPClient(client *http.Client) *ActionsEnableWorkflowParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the actions enable workflow params
func (o *ActionsEnableWorkflowParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithOwner adds the owner to the actions enable workflow params
func (o *ActionsEnableWorkflowParams) WithOwner(owner string) *ActionsEnableWorkflowParams {
o.SetOwner(owner)
return o
}
// SetOwner adds the owner to the actions enable workflow params
func (o *ActionsEnableWorkflowParams) SetOwner(owner string) {
o.Owner = owner
}
// WithRepo adds the repo to the actions enable workflow params
func (o *ActionsEnableWorkflowParams) WithRepo(repo string) *ActionsEnableWorkflowParams {
o.SetRepo(repo)
return o
}
// SetRepo adds the repo to the actions enable workflow params
func (o *ActionsEnableWorkflowParams) SetRepo(repo string) {
o.Repo = repo
}
// WithWorkflowID adds the workflowID to the actions enable workflow params
func (o *ActionsEnableWorkflowParams) WithWorkflowID(workflowID string) *ActionsEnableWorkflowParams {
o.SetWorkflowID(workflowID)
return o
}
// SetWorkflowID adds the workflowId to the actions enable workflow params
func (o *ActionsEnableWorkflowParams) SetWorkflowID(workflowID string) {
o.WorkflowID = workflowID
}
// WriteToRequest writes these params to a swagger request
func (o *ActionsEnableWorkflowParams) 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
}
// path param workflow_id
if err := r.SetPathParam("workflow_id", o.WorkflowID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,446 @@
// Code generated by go-swagger; DO NOT EDIT.
package repository
// 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"
)
// ActionsEnableWorkflowReader is a Reader for the ActionsEnableWorkflow structure.
type ActionsEnableWorkflowReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ActionsEnableWorkflowReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 204:
result := NewActionsEnableWorkflowNoContent()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewActionsEnableWorkflowBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewActionsEnableWorkflowForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewActionsEnableWorkflowNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 409:
result := NewActionsEnableWorkflowConflict()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewActionsEnableWorkflowUnprocessableEntity()
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}/actions/workflows/{workflow_id}/enable] ActionsEnableWorkflow", response, response.Code())
}
}
// NewActionsEnableWorkflowNoContent creates a ActionsEnableWorkflowNoContent with default headers values
func NewActionsEnableWorkflowNoContent() *ActionsEnableWorkflowNoContent {
return &ActionsEnableWorkflowNoContent{}
}
/*
ActionsEnableWorkflowNoContent describes a response with status code 204, with default header values.
No Content
*/
type ActionsEnableWorkflowNoContent struct {
}
// IsSuccess returns true when this actions enable workflow no content response has a 2xx status code
func (o *ActionsEnableWorkflowNoContent) IsSuccess() bool {
return true
}
// IsRedirect returns true when this actions enable workflow no content response has a 3xx status code
func (o *ActionsEnableWorkflowNoContent) IsRedirect() bool {
return false
}
// IsClientError returns true when this actions enable workflow no content response has a 4xx status code
func (o *ActionsEnableWorkflowNoContent) IsClientError() bool {
return false
}
// IsServerError returns true when this actions enable workflow no content response has a 5xx status code
func (o *ActionsEnableWorkflowNoContent) IsServerError() bool {
return false
}
// IsCode returns true when this actions enable workflow no content response a status code equal to that given
func (o *ActionsEnableWorkflowNoContent) IsCode(code int) bool {
return code == 204
}
// Code gets the status code for the actions enable workflow no content response
func (o *ActionsEnableWorkflowNoContent) Code() int {
return 204
}
func (o *ActionsEnableWorkflowNoContent) Error() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable][%d] actionsEnableWorkflowNoContent", 204)
}
func (o *ActionsEnableWorkflowNoContent) String() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable][%d] actionsEnableWorkflowNoContent", 204)
}
func (o *ActionsEnableWorkflowNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewActionsEnableWorkflowBadRequest creates a ActionsEnableWorkflowBadRequest with default headers values
func NewActionsEnableWorkflowBadRequest() *ActionsEnableWorkflowBadRequest {
return &ActionsEnableWorkflowBadRequest{}
}
/*
ActionsEnableWorkflowBadRequest describes a response with status code 400, with default header values.
APIError is error format response
*/
type ActionsEnableWorkflowBadRequest struct {
Message string
URL string
}
// IsSuccess returns true when this actions enable workflow bad request response has a 2xx status code
func (o *ActionsEnableWorkflowBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this actions enable workflow bad request response has a 3xx status code
func (o *ActionsEnableWorkflowBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this actions enable workflow bad request response has a 4xx status code
func (o *ActionsEnableWorkflowBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this actions enable workflow bad request response has a 5xx status code
func (o *ActionsEnableWorkflowBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this actions enable workflow bad request response a status code equal to that given
func (o *ActionsEnableWorkflowBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the actions enable workflow bad request response
func (o *ActionsEnableWorkflowBadRequest) Code() int {
return 400
}
func (o *ActionsEnableWorkflowBadRequest) Error() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable][%d] actionsEnableWorkflowBadRequest", 400)
}
func (o *ActionsEnableWorkflowBadRequest) String() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable][%d] actionsEnableWorkflowBadRequest", 400)
}
func (o *ActionsEnableWorkflowBadRequest) 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
}
// NewActionsEnableWorkflowForbidden creates a ActionsEnableWorkflowForbidden with default headers values
func NewActionsEnableWorkflowForbidden() *ActionsEnableWorkflowForbidden {
return &ActionsEnableWorkflowForbidden{}
}
/*
ActionsEnableWorkflowForbidden describes a response with status code 403, with default header values.
APIForbiddenError is a forbidden error response
*/
type ActionsEnableWorkflowForbidden struct {
Message string
URL string
}
// IsSuccess returns true when this actions enable workflow forbidden response has a 2xx status code
func (o *ActionsEnableWorkflowForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this actions enable workflow forbidden response has a 3xx status code
func (o *ActionsEnableWorkflowForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this actions enable workflow forbidden response has a 4xx status code
func (o *ActionsEnableWorkflowForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this actions enable workflow forbidden response has a 5xx status code
func (o *ActionsEnableWorkflowForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this actions enable workflow forbidden response a status code equal to that given
func (o *ActionsEnableWorkflowForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the actions enable workflow forbidden response
func (o *ActionsEnableWorkflowForbidden) Code() int {
return 403
}
func (o *ActionsEnableWorkflowForbidden) Error() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable][%d] actionsEnableWorkflowForbidden", 403)
}
func (o *ActionsEnableWorkflowForbidden) String() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable][%d] actionsEnableWorkflowForbidden", 403)
}
func (o *ActionsEnableWorkflowForbidden) 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
}
// NewActionsEnableWorkflowNotFound creates a ActionsEnableWorkflowNotFound with default headers values
func NewActionsEnableWorkflowNotFound() *ActionsEnableWorkflowNotFound {
return &ActionsEnableWorkflowNotFound{}
}
/*
ActionsEnableWorkflowNotFound describes a response with status code 404, with default header values.
APINotFound is a not found empty response
*/
type ActionsEnableWorkflowNotFound struct {
}
// IsSuccess returns true when this actions enable workflow not found response has a 2xx status code
func (o *ActionsEnableWorkflowNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this actions enable workflow not found response has a 3xx status code
func (o *ActionsEnableWorkflowNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this actions enable workflow not found response has a 4xx status code
func (o *ActionsEnableWorkflowNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this actions enable workflow not found response has a 5xx status code
func (o *ActionsEnableWorkflowNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this actions enable workflow not found response a status code equal to that given
func (o *ActionsEnableWorkflowNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the actions enable workflow not found response
func (o *ActionsEnableWorkflowNotFound) Code() int {
return 404
}
func (o *ActionsEnableWorkflowNotFound) Error() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable][%d] actionsEnableWorkflowNotFound", 404)
}
func (o *ActionsEnableWorkflowNotFound) String() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable][%d] actionsEnableWorkflowNotFound", 404)
}
func (o *ActionsEnableWorkflowNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewActionsEnableWorkflowConflict creates a ActionsEnableWorkflowConflict with default headers values
func NewActionsEnableWorkflowConflict() *ActionsEnableWorkflowConflict {
return &ActionsEnableWorkflowConflict{}
}
/*
ActionsEnableWorkflowConflict describes a response with status code 409, with default header values.
APIConflict is a conflict empty response
*/
type ActionsEnableWorkflowConflict struct {
}
// IsSuccess returns true when this actions enable workflow conflict response has a 2xx status code
func (o *ActionsEnableWorkflowConflict) IsSuccess() bool {
return false
}
// IsRedirect returns true when this actions enable workflow conflict response has a 3xx status code
func (o *ActionsEnableWorkflowConflict) IsRedirect() bool {
return false
}
// IsClientError returns true when this actions enable workflow conflict response has a 4xx status code
func (o *ActionsEnableWorkflowConflict) IsClientError() bool {
return true
}
// IsServerError returns true when this actions enable workflow conflict response has a 5xx status code
func (o *ActionsEnableWorkflowConflict) IsServerError() bool {
return false
}
// IsCode returns true when this actions enable workflow conflict response a status code equal to that given
func (o *ActionsEnableWorkflowConflict) IsCode(code int) bool {
return code == 409
}
// Code gets the status code for the actions enable workflow conflict response
func (o *ActionsEnableWorkflowConflict) Code() int {
return 409
}
func (o *ActionsEnableWorkflowConflict) Error() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable][%d] actionsEnableWorkflowConflict", 409)
}
func (o *ActionsEnableWorkflowConflict) String() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable][%d] actionsEnableWorkflowConflict", 409)
}
func (o *ActionsEnableWorkflowConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewActionsEnableWorkflowUnprocessableEntity creates a ActionsEnableWorkflowUnprocessableEntity with default headers values
func NewActionsEnableWorkflowUnprocessableEntity() *ActionsEnableWorkflowUnprocessableEntity {
return &ActionsEnableWorkflowUnprocessableEntity{}
}
/*
ActionsEnableWorkflowUnprocessableEntity describes a response with status code 422, with default header values.
APIValidationError is error format response related to input validation
*/
type ActionsEnableWorkflowUnprocessableEntity struct {
Message string
URL string
}
// IsSuccess returns true when this actions enable workflow unprocessable entity response has a 2xx status code
func (o *ActionsEnableWorkflowUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this actions enable workflow unprocessable entity response has a 3xx status code
func (o *ActionsEnableWorkflowUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this actions enable workflow unprocessable entity response has a 4xx status code
func (o *ActionsEnableWorkflowUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this actions enable workflow unprocessable entity response has a 5xx status code
func (o *ActionsEnableWorkflowUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this actions enable workflow unprocessable entity response a status code equal to that given
func (o *ActionsEnableWorkflowUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the actions enable workflow unprocessable entity response
func (o *ActionsEnableWorkflowUnprocessableEntity) Code() int {
return 422
}
func (o *ActionsEnableWorkflowUnprocessableEntity) Error() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable][%d] actionsEnableWorkflowUnprocessableEntity", 422)
}
func (o *ActionsEnableWorkflowUnprocessableEntity) String() string {
return fmt.Sprintf("[PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable][%d] actionsEnableWorkflowUnprocessableEntity", 422)
}
func (o *ActionsEnableWorkflowUnprocessableEntity) 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
}

View File

@@ -0,0 +1,195 @@
// Code generated by go-swagger; DO NOT EDIT.
package repository
// 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"
)
// NewActionsGetWorkflowParams creates a new ActionsGetWorkflowParams 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 NewActionsGetWorkflowParams() *ActionsGetWorkflowParams {
return &ActionsGetWorkflowParams{
timeout: cr.DefaultTimeout,
}
}
// NewActionsGetWorkflowParamsWithTimeout creates a new ActionsGetWorkflowParams object
// with the ability to set a timeout on a request.
func NewActionsGetWorkflowParamsWithTimeout(timeout time.Duration) *ActionsGetWorkflowParams {
return &ActionsGetWorkflowParams{
timeout: timeout,
}
}
// NewActionsGetWorkflowParamsWithContext creates a new ActionsGetWorkflowParams object
// with the ability to set a context for a request.
func NewActionsGetWorkflowParamsWithContext(ctx context.Context) *ActionsGetWorkflowParams {
return &ActionsGetWorkflowParams{
Context: ctx,
}
}
// NewActionsGetWorkflowParamsWithHTTPClient creates a new ActionsGetWorkflowParams object
// with the ability to set a custom HTTPClient for a request.
func NewActionsGetWorkflowParamsWithHTTPClient(client *http.Client) *ActionsGetWorkflowParams {
return &ActionsGetWorkflowParams{
HTTPClient: client,
}
}
/*
ActionsGetWorkflowParams contains all the parameters to send to the API endpoint
for the actions get workflow operation.
Typically these are written to a http.Request.
*/
type ActionsGetWorkflowParams struct {
/* Owner.
owner of the repo
*/
Owner string
/* Repo.
name of the repo
*/
Repo string
/* WorkflowID.
id of the workflow
*/
WorkflowID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the actions get workflow params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ActionsGetWorkflowParams) WithDefaults() *ActionsGetWorkflowParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the actions get workflow params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ActionsGetWorkflowParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the actions get workflow params
func (o *ActionsGetWorkflowParams) WithTimeout(timeout time.Duration) *ActionsGetWorkflowParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the actions get workflow params
func (o *ActionsGetWorkflowParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the actions get workflow params
func (o *ActionsGetWorkflowParams) WithContext(ctx context.Context) *ActionsGetWorkflowParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the actions get workflow params
func (o *ActionsGetWorkflowParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the actions get workflow params
func (o *ActionsGetWorkflowParams) WithHTTPClient(client *http.Client) *ActionsGetWorkflowParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the actions get workflow params
func (o *ActionsGetWorkflowParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithOwner adds the owner to the actions get workflow params
func (o *ActionsGetWorkflowParams) WithOwner(owner string) *ActionsGetWorkflowParams {
o.SetOwner(owner)
return o
}
// SetOwner adds the owner to the actions get workflow params
func (o *ActionsGetWorkflowParams) SetOwner(owner string) {
o.Owner = owner
}
// WithRepo adds the repo to the actions get workflow params
func (o *ActionsGetWorkflowParams) WithRepo(repo string) *ActionsGetWorkflowParams {
o.SetRepo(repo)
return o
}
// SetRepo adds the repo to the actions get workflow params
func (o *ActionsGetWorkflowParams) SetRepo(repo string) {
o.Repo = repo
}
// WithWorkflowID adds the workflowID to the actions get workflow params
func (o *ActionsGetWorkflowParams) WithWorkflowID(workflowID string) *ActionsGetWorkflowParams {
o.SetWorkflowID(workflowID)
return o
}
// SetWorkflowID adds the workflowId to the actions get workflow params
func (o *ActionsGetWorkflowParams) SetWorkflowID(workflowID string) {
o.WorkflowID = workflowID
}
// WriteToRequest writes these params to a swagger request
func (o *ActionsGetWorkflowParams) 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
}
// path param workflow_id
if err := r.SetPathParam("workflow_id", o.WorkflowID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

Some files were not shown because too many files have changed in this diff Show More