This PR adds support for the `confidential_client` in `oauth2` to reflect the swagger APIs.
It has been surfaced here: https://github.com/Lerentis/terraform-provider-gitea/pull/46
Simple tests have also been added.
Please note that in this PR I am considering the current behaviour:
> if confidential_client is not set, it's assumed that it's false
However, from the swagger, it seems that the implicit default is `true` instead.
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/625
Co-authored-by: Alessandro De Blasis <alex@deblasis.net>
Co-committed-by: Alessandro De Blasis <alex@deblasis.net>
This PR adds the missing parameters for MergePullRequestOption `head_commit_id` and `merge_when_checks_succed` like in the current Gitea API.
Resolves#623
Signed-off-by: Johannes Lauffer <johnwalkerx@mailbox.org>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/624
Co-authored-by: JohnWalkerx <johnwalkerx@mailbox.org>
Co-committed-by: JohnWalkerx <johnwalkerx@mailbox.org>
This API was added in 1.16, [template forms](https://github.com/go-gitea/gitea/pull/20987) will be in 1.18.
I don't think we need to add version checks, as the respective `.Form` field will just be empty on unsupported versions, but correct me if I'm wrong here.
fixes#547
- i took the freedom to change the struct property names from the API names for clarity
- I didn't add tests because it would effectively just test gitea's API to be functional (as long as there is only this GET method)
Co-authored-by: John Olheiser <john+gitea@jolheiser.com>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/603
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.io>
Reviewed-by: John Olheiser <john+gitea@jolheiser.com>
Co-authored-by: Norwin <git@nroo.de>
Co-committed-by: Norwin <git@nroo.de>
Closes#616
/cc @chmouel
---
This should work fine, as the Gitea API accepts a string array and then internally converts the scopes.
Co-authored-by: Chmouel Boudjnah <chmouel@chmouel.com>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/617
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.io>
Co-authored-by: jolheiser <john.olheiser@gmail.com>
Co-committed-by: jolheiser <john.olheiser@gmail.com>
This is a possible resolution for gitea/tea#531
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/612
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: John Olheiser <john+gitea@jolheiser.com>
Co-committed-by: John Olheiser <john+gitea@jolheiser.com>
This PR pins the CI and various versions of tools in our Makefile to ensure a more stable run.
Note that they aren't necessarily the most current versions, as the SDK likely needs more work to bring it back up to par with the main repo.
Co-authored-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/614
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: John Olheiser <john+gitea@jolheiser.com>
Co-committed-by: John Olheiser <john+gitea@jolheiser.com>
Just updating the struct to match the current API
Co-authored-by: jolheiser <john.olheiser@gmail.com>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/613
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: John Olheiser <john+gitea@jolheiser.com>
Co-committed-by: John Olheiser <john+gitea@jolheiser.com>
- This is a breaking change.
- Return the relevant notifications when the Gitea server is 1.16.0 or higher.
- Ref: https://github.com/go-gitea/gitea/pull/17064
- Resolves#543
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/590
Reviewed-by: 6543 <6543@obermui.de>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-committed-by: Gusted <williamzijl7@hotmail.com>
It is common to create PR review with Comments only, where foreword Body is empty. This is allowed by Gitea API, therefore SDK should return empty body error only if there are no comments.
Co-authored-by: Petr Vaněk <arkamar@atlas.cz>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/570
Reviewed-by: Norwin <noerw@noreply.gitea.io>
Reviewed-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: arkamar <arkamar@noreply.gitea.io>
Co-committed-by: arkamar <arkamar@noreply.gitea.io>
- Allow to specify to only get commit history of specific file.
- Ref: https://github.com/go-gitea/gitea/pull/17652
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/588
Reviewed-by: John Olheiser <john.olheiser@gmail.com>
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-committed-by: Gusted <williamzijl7@hotmail.com>
- Enforce [gofumpt](https://github.com/mvdan/gofumpt) to enforce a more idiomatic go style.
- Enforce golangci-lint a bunch of linters! Which were able to detect a few issues in the current codebase and have been fixed by this PR.
- Updated the Makefile to use `go install ....` instead of the old deprecated way of `go get`
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/587
Reviewed-by: John Olheiser <john.olheiser@gmail.com>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-committed-by: Gusted <williamzijl7@hotmail.com>
Resolves#582Resolves#551
As noted in both issues, we _could_ put the `resp.Body` back, however I think this should also suffice, as it will return error messages when appropriate based on the JSON response.
Co-authored-by: jolheiser <john.olheiser@gmail.com>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/583
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-committed-by: John Olheiser <john.olheiser@gmail.com>
- Allow to Accept or Reject a transfer of a repository via the API. Only
- available for v1.16+
- Ref: https://github.com/go-gitea/gitea/pull/17963
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/586
Reviewed-by: John Olheiser <john.olheiser@gmail.com>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-committed-by: Gusted <williamzijl7@hotmail.com>
- Add sorting by Owner and Team for the user list issues endpoint.
- Ref: https://github.com/go-gitea/gitea/pull/16662
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/585
Reviewed-by: John Olheiser <john.olheiser@gmail.com>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-committed-by: Gusted <williamzijl7@hotmail.com>
- Add the API to search for teams on a organization by the `/orgs/{org}/teams/search` API of Gitea.
- The response body of the API is a bit weird because it the JSON can return three fields "data", "error", "ok", first check if there's a general HTTP error. Otherwise when ok is set to false, return a error with the given error message of the error field. When ok is set to true, simply return the data.
CC @fnetx
Co-authored-by: Andrew Thornton <art27@cantab.net>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/577
Reviewed-by: Andrew Thornton <art27@cantab.net>
Reviewed-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-committed-by: Gusted <williamzijl7@hotmail.com>
- As per #558, due https://github.com/go-gitea/gitea/pull/18066
Co-authored-by: Andrew Thornton <art27@cantab.net>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/576
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-by: Andrew Thornton <art27@cantab.net>
Reviewed-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-committed-by: Gusted <williamzijl7@hotmail.com>
This PR adds a func for verifying incoming webhooks from Gitea, as well as a middleware for easier addition to a router stack.
Co-authored-by: jolheiser <john.olheiser@gmail.com>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/580
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: Gusted <williamzijl7@hotmail.com>
- `master` -> `main`, due to https://github.com/go-gitea/gitea/pull/19354
- Fix incorrect variable being passed into assert in `TestPull`.
- Fix `createTestRepo` to only delete existing TestRepo if the result's repo wasn't redirected(e.g. due to being transferred or renamed). Fixes the error in TransferRepo.
- Remove a check for tag verfication, for some developers this will always fail due to local git configs forcing signing on tags.
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/579
Reviewed-by: 6543 <6543@obermui.de>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-committed-by: Gusted <williamzijl7@hotmail.com>
- Bump amount of cron tasks that the dev image of Gitea has to 21.
- Fix TestAdminCronTasks.
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/578
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-committed-by: Gusted <williamzijl7@hotmail.com>
- Update testify to v1.7.0(Thus fixing vulnerabilities https://deps.dev/go/code.gitea.io%2Fsdk%2Fgitea/, quite minor because testify is only used for test code).
- Update go-version to v1.4.0
Co-authored-by: Andrew Thornton <art27@cantab.net>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/575
Reviewed-by: Andrew Thornton <art27@cantab.net>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-committed-by: Gusted <williamzijl7@hotmail.com>
When creating a repository using gitea client, it performs some validation on client options and the errors returned are not descriptive enough. This PR makes the errors more precise so that the user can fix the errors easily.
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/567
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: Norwin <noerw@noreply.gitea.io>
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: takirala <takirala@noreply.gitea.io>
Co-committed-by: takirala <takirala@noreply.gitea.io>
be able to skip version check if needed.
!!! Be careful, because using it incorrectly can result in infinite loops with pagination !!!
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/560
Reviewed-by: Andrew Thornton <art27@cantab.net>
Reviewed-by: Norwin <noerw@noreply.gitea.io>