forked from forgejo/forgejo
code.gitea.io/sdk/gitea v0.14.0 -> v0.15.1 (#18186)
This commit is contained in:
parent
8760af752a
commit
ec6cc38c6c
29 changed files with 695 additions and 133 deletions
25
vendor/code.gitea.io/sdk/gitea/version.go
generated
vendored
25
vendor/code.gitea.io/sdk/gitea/version.go
generated
vendored
|
@ -39,16 +39,39 @@ func (c *Client) CheckServerVersionConstraint(constraint string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// SetGiteaVersion configures the Client to assume the given version of the
|
||||
// Gitea server, instead of querying the server for it when initializing.
|
||||
// Use "" to skip all canonical ways in the SDK to check for versions
|
||||
func SetGiteaVersion(v string) ClientOption {
|
||||
if v == "" {
|
||||
return func(c *Client) error {
|
||||
c.ignoreVersion = true
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return func(c *Client) (err error) {
|
||||
c.getVersionOnce.Do(func() {
|
||||
c.serverVersion, err = version.NewVersion(v)
|
||||
return
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// predefined versions only have to be parsed by library once
|
||||
var (
|
||||
version1_11_0, _ = version.NewVersion("1.11.0")
|
||||
version1_12_0, _ = version.NewVersion("1.12.0")
|
||||
version1_13_0, _ = version.NewVersion("1.13.0")
|
||||
version1_14_0, _ = version.NewVersion("1.14.0")
|
||||
version1_15_0, _ = version.NewVersion("1.15.0")
|
||||
)
|
||||
|
||||
// checkServerVersionGreaterThanOrEqual is internally used to speed up things and ignore issues with prerelease
|
||||
// checkServerVersionGreaterThanOrEqual is the canonical way in the SDK to check for versions for API compatibility reasons
|
||||
func (c *Client) checkServerVersionGreaterThanOrEqual(v *version.Version) error {
|
||||
if c.ignoreVersion {
|
||||
return nil
|
||||
}
|
||||
if err := c.loadServerVersion(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue