mirror of
https://github.com/go-gitea/gitea
synced 2025-07-06 10:37:20 +00:00
Vendor Update: go-gitlab v0.22.1 -> v0.31.0 (#11136)
* vendor update: go-gitlab to v0.31.0 * migrate client init to v0.31.0 * refactor
This commit is contained in:
27
vendor/github.com/xanzy/go-gitlab/README.md
generated
vendored
27
vendor/github.com/xanzy/go-gitlab/README.md
generated
vendored
@ -20,6 +20,7 @@ incompatible changes that were needed to fully support the V4 Gitlab API.
|
||||
This API client package covers most of the existing Gitlab API calls and is updated regularly
|
||||
to add new and/or missing endpoints. Currently the following services are supported:
|
||||
|
||||
- [x] Applications
|
||||
- [x] Award Emojis
|
||||
- [x] Branches
|
||||
- [x] Broadcast Messages
|
||||
@ -96,8 +97,21 @@ access different parts of the GitLab API. For example, to list all
|
||||
users:
|
||||
|
||||
```go
|
||||
git := gitlab.NewClient(nil, "yourtokengoeshere")
|
||||
//git.SetBaseURL("https://git.mydomain.com/api/v4")
|
||||
git, err := gitlab.NewClient("yourtokengoeshere")
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create client: %v", err)
|
||||
}
|
||||
users, _, err := git.Users.ListUsers(&gitlab.ListUsersOptions{})
|
||||
```
|
||||
|
||||
There are a few `With...` option functions that can be used to customize
|
||||
the API client. For example, to set a custom base URL:
|
||||
|
||||
```go
|
||||
git, err := gitlab.NewClient("yourtokengoeshere", WithBaseURL("https://git.mydomain.com/api/v4"))
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create client: %v", err)
|
||||
}
|
||||
users, _, err := git.Users.ListUsers(&gitlab.ListUsersOptions{})
|
||||
```
|
||||
|
||||
@ -105,7 +119,7 @@ Some API methods have optional parameters that can be passed. For example,
|
||||
to list all projects for user "svanharmelen":
|
||||
|
||||
```go
|
||||
git := gitlab.NewClient(nil)
|
||||
git := gitlab.NewClient("yourtokengoeshere")
|
||||
opt := &ListProjectsOptions{Search: gitlab.String("svanharmelen")}
|
||||
projects, _, err := git.Projects.ListProjects(opt)
|
||||
```
|
||||
@ -125,7 +139,10 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
git := gitlab.NewClient(nil, "yourtokengoeshere")
|
||||
git, err := gitlab.NewClient("yourtokengoeshere")
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create client: %v", err)
|
||||
}
|
||||
|
||||
// Create new project
|
||||
p := &gitlab.CreateProjectOptions{
|
||||
@ -166,7 +183,7 @@ For complete usage of go-gitlab, see the full [package docs](https://godoc.org/g
|
||||
|
||||
## Author
|
||||
|
||||
Sander van Harmelen (<sander@xanzy.io>)
|
||||
Sander van Harmelen (<sander@vanharmelen.nl>)
|
||||
|
||||
## License
|
||||
|
||||
|
Reference in New Issue
Block a user