diff --git a/blurp b/blurp index 6dee445..2f0865d 100755 Binary files a/blurp and b/blurp differ diff --git a/blurp.go b/blurp.go index b63a1ea..a41e106 100644 --- a/blurp.go +++ b/blurp.go @@ -43,6 +43,7 @@ func init() { func main() { if err := rootCmd.Execute(); err != nil { slog.Error("woops, something went wrong", "error", err) + os.Exit(1) } } @@ -69,21 +70,25 @@ var archiveCmd = &cobra.Command{ authClient, err := auth.NewAuthClient(user) if err != nil { slog.Error("unable to create auth client", "error", err) + os.Exit(1) } acc, err := getAccount(authClient) if err != nil { slog.Error("unable to retrieve account", "error", err) + os.Exit(1) } statuses, err := readAllPaged(authClient, acc.ID) if err != nil { slog.Error("unable to download paged response", "error", err) + os.Exit(1) } basePath := filepath.Join(".", "archive") if err := os.MkdirAll(basePath, 0755); err != nil { slog.Error("unable to create status directory", "error", err) + os.Exit(1) } for _, status := range statuses { @@ -94,18 +99,21 @@ var archiveCmd = &cobra.Command{ if err := os.MkdirAll(basePath, 0755); err != nil { slog.Error("unable to create status directory", "error", err) + os.Exit(1) } for _, media := range status.MediaAttachments { parsed, err := url.Parse(media.URL) if err != nil { slog.Error("unable to parse media URL", "error", err) + os.Exit(1) } imagePath := filepath.Join(basePath, filepath.Base(parsed.Path)) if _, err := os.Stat(imagePath); errors.Is(err, os.ErrNotExist) { if err := httpGetFile(imagePath, media.URL); err != nil { slog.Error("unable to download file", "error", err) + os.Exit(1) } slog.Info(fmt.Sprintf("archived %s", imagePath)) } @@ -115,12 +123,14 @@ var archiveCmd = &cobra.Command{ payload, err := json.MarshalIndent(status, "", " ") if err != nil { slog.Error("unable to marshal", "error", err) + os.Exit(1) } jsonPath := filepath.Join(basePath, fmt.Sprintf("%s.json", status.ID)) if _, err := os.Stat(jsonPath); errors.Is(err, os.ErrNotExist) { if err = ioutil.WriteFile(jsonPath, payload, 0644); err != nil { slog.Error("unable to write JSON file", "error", err) + os.Exit(1) } slog.Info(fmt.Sprintf("archived %s", jsonPath)) } @@ -136,7 +146,8 @@ var deleteCmd = &cobra.Command{ RunE: func(cmd *cobra.Command, args []string) error { authClient, err := auth.NewAuthClient(user) if err != nil { - slog.Error("unable to create auth client", err) + slog.Error("unable to create auth client", "error", err) + os.Exit(1) } slog.Info(fmt.Sprintf("keeping statuses NEWER than %d weeks", weeks)) @@ -144,11 +155,13 @@ var deleteCmd = &cobra.Command{ acc, err := getAccount(authClient) if err != nil { slog.Error("unable to retrieve account", "error", err) + os.Exit(1) } allStatuses, err := readAllPaged(authClient, acc.ID) if err != nil { slog.Error("unable to download paged response", "error", err) + os.Exit(1) } ISO8601 := "2006-01-02T15:04:05.000Z" @@ -156,6 +169,7 @@ var deleteCmd = &cobra.Command{ t, err := time.Parse(ISO8601, status.CreatedAt) if err != nil { slog.Error("unable to parse status 'CreatedAt' value", "error", err) + os.Exit(1) } numHours := time.Duration(168 * weeks) @@ -165,6 +179,7 @@ var deleteCmd = &cobra.Command{ }, authClient.Auth) if err != nil { slog.Error("unable to delete status", "error", err) + os.Exit(1) } slog.Info(fmt.Sprintf("deleted %s (created: %s)", status.ID, t.Format(time.DateOnly))) diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib-auth-keyring/.drone.yml b/vendor/git.coopcloud.tech/decentral1se/gtslib-auth-keyring/.drone.yml new file mode 100644 index 0000000..6a73401 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib-auth-keyring/.drone.yml @@ -0,0 +1,8 @@ +--- +kind: pipeline +name: gtslib-auth-keyring +steps: + - name: build + image: golang:1.21 + commands: + - go build -v ./... diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib-auth-keyring/LICENSE b/vendor/git.coopcloud.tech/decentral1se/gtslib-auth-keyring/LICENSE new file mode 100644 index 0000000..1fc29a8 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib-auth-keyring/LICENSE @@ -0,0 +1,15 @@ +gtslib-auth-keyring: GoToSocial client auth with keyring support +Copyright (C) 2024 decentral1se + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU Affero General Public License as published by the Free +Software Foundation, either version 3 of the License, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU Affero General Public License for more +details. + +You should have received a copy of the GNU Affero General Public License along +with this program. If not, see . diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib-auth-keyring/README.md b/vendor/git.coopcloud.tech/decentral1se/gtslib-auth-keyring/README.md new file mode 100644 index 0000000..f55c651 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib-auth-keyring/README.md @@ -0,0 +1,32 @@ +# gtslib-auth-keyring + +[![Build Status](https://build.coopcloud.tech/api/badges/decentral1se/gtslib-auth-keyring/status.svg?ref=refs/heads/main)](https://build.coopcloud.tech/decentral1se/gtslib-auth-keyring) + +> [GoToSocial](https://gotosocial.org) client auth with keyring support + +**ALPHA SOFTWARE** just like GoToSocial. Uses [`go-keyring`](https://github.com/zalando/go-keyring). + +```go +import ( + "log/slog" + + auth "git.coopcloud.tech/decentral1se/gtslib-auth-keyring" +) + +func main() { + if err := auth.Login("foo@bar.zone"); err != nil { + slog.Error("unable to login", err) + } +} + +``` + +## ACK + +Made possible by the good work of [`slurp`](https://github.com/VyrCossont/slurp). + +## License + + + + diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib-auth-keyring/gtslib_auth_keyring.go b/vendor/git.coopcloud.tech/decentral1se/gtslib-auth-keyring/gtslib_auth_keyring.go new file mode 100644 index 0000000..8300d76 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib-auth-keyring/gtslib_auth_keyring.go @@ -0,0 +1,593 @@ +package gtslib_auth_keyring + +import ( + "bufio" + "context" + "encoding/json" + "log/slog" + "net/http" + neturl "net/url" + "os" + "path/filepath" + "strings" + + "github.com/adrg/xdg" + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/pkg/browser" + "github.com/pkg/errors" + "github.com/zalando/go-keyring" + "golang.org/x/time/rate" + "webfinger.net/go/webfinger" + + apiclient "git.coopcloud.tech/decentral1se/gtslib/client" + "git.coopcloud.tech/decentral1se/gtslib/client/apps" + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +func Ptr[T any](v T) *T { return &v } + +// Config is a client configuration. +type Config struct { + Name string // client name + Website string // client website +} + +// Option with operates on a client config. +type Option func(c *Config) + +// NewConfig creates a new client config. +func NewConfig(opts ...Option) *Config { + conf := &Config{ + Name: "gtslib-auth-keyring", + Website: "https://doesnt.exist/gtslib-auth-keyring", + } + for _, optFunc := range opts { + optFunc(conf) + } + return conf +} + +// WithName sets a client name. +func WithName(name string) Option { + return func(c *Config) { + c.Name = name + } +} + +// WithWebsite sets a client website. +func WithWebsite(website string) Option { + return func(c *Config) { + c.Website = website + } +} + +// Prefs stores persisted preferences. +type Prefs struct { + // Instances is a map of instance names to instance preferences. + Instances map[string]PrefsInstance `json:"instances,omitempty"` + + // Users is a map of user usernames@domains to instance data. + Users map[string]PrefsUser `json:"users,omitempty"` + + // DefaultUser is the username@domain of the last user we successfully + // authenticated as, if there is one. + DefaultUser string `json:"default_user,omitempty"` +} + +// PrefsInstance stores preferences for a given instance. OAuth2 app secrets +// are stored in the system keychain. +type PrefsInstance struct { + // ClientID is the OAuth2 client ID on this instance. + ClientID string `json:"client_id"` +} + +// PrefsUser stores preferences for a given user. User access tokens are stored +// in the system keychain. +type PrefsUser struct { + // Instance is the name of the instance that the user is on. + Instance string `json:"instance"` +} + +// prefsDir is the path to the directory containing all preference files. +var prefsDir string + +// prefsPath is the path to the file within that directory that stores all of our prefs. +var prefsPath string + +func init() { + prefsDir = filepath.Join(xdg.ConfigHome, "gtslib.auth.keyring") + prefsPath = filepath.Join(prefsDir, "prefs.json") +} + +// LoadPrefs returns preferences from disk or an empty prefs object if there +// are none stored or accessible. +func LoadPrefs() (*Prefs, error) { + f, err := os.Open(prefsPath) + if err != nil { + return &Prefs{ + Instances: map[string]PrefsInstance{}, + Users: map[string]PrefsUser{}, + }, nil + } + defer func() { _ = f.Close() }() + + var prefs Prefs + err = json.NewDecoder(f).Decode(&prefs) + if err != nil { + return nil, errors.WithStack(err) + } + + if prefs.Instances == nil { + prefs.Instances = map[string]PrefsInstance{} + } + if prefs.Users == nil { + prefs.Users = map[string]PrefsUser{} + } + + return &prefs, nil +} + +// SavePrefs creates on-disk preferences or overwrites existing ones. +func SavePrefs(prefs *Prefs) error { + err := os.MkdirAll(prefsDir, 0o755) + if err != nil { + return errors.WithStack(err) + } + + f, err := os.Create(prefsPath) + if err != nil { + return errors.WithStack(err) + } + defer func() { _ = f.Close() }() + + encoder := json.NewEncoder(f) + encoder.SetIndent("", " ") + encoder.SetEscapeHTML(false) + err = encoder.Encode(prefs) + if err != nil { + return errors.WithStack(err) + } + + return nil +} + +// PrefNotFound represents an error in which no preference is found. +var PrefNotFound = errors.New("preference value not found") + +// getPrefValue retrieves a preference value. +func getPrefValue(get func(prefs *Prefs) (string, bool)) (string, error) { + prefs, err := LoadPrefs() + if err != nil { + return "", err + } + + value, exists := get(prefs) + if !exists { + return "", errors.WithStack(PrefNotFound) + } + + return value, nil +} + +// setPrefValue sets a preference value. +func setPrefValue(set func(prefs *Prefs)) error { + prefs, err := LoadPrefs() + if err != nil { + return err + } + + set(prefs) + + err = SavePrefs(prefs) + if err != nil { + return err + } + + return nil +} + +// GetDefaultUser retrieves the default user. +func GetDefaultUser() (string, error) { + return getPrefValue(func(prefs *Prefs) (string, bool) { + if prefs.DefaultUser == "" { + return "", false + } + return prefs.DefaultUser, true + }) +} + +// SetDefaultUser sets the default user. +func SetDefaultUser(user string) error { + return setPrefValue(func(prefs *Prefs) { + prefs.DefaultUser = user + }) +} + +// GetInstanceClientID retrieves the instance client ID. +func GetInstanceClientID(instance string) (string, error) { + return getPrefValue(func(prefs *Prefs) (string, bool) { + prefsInstance, exists := prefs.Instances[instance] + if !exists { + return "", false + } + return prefsInstance.ClientID, true + }) +} + +// SetInstanceClientID sets the instance client ID. +func SetInstanceClientID(instance string, clientID string) error { + return setPrefValue(func(prefs *Prefs) { + prefsInstance := prefs.Instances[instance] + prefsInstance.ClientID = clientID + prefs.Instances[instance] = prefsInstance + }) +} + +// GetUserInstance gets the user instance. +func GetUserInstance(user string) (string, error) { + return getPrefValue(func(prefs *Prefs) (string, bool) { + prefsUser, exists := prefs.Users[user] + if !exists { + return "", false + } + return prefsUser.Instance, true + }) +} + +// SetUserInstance sets the user instance. +func SetUserInstance(user string, instance string) error { + return setPrefValue(func(prefs *Prefs) { + prefsUser := prefs.Users[user] + prefsUser.Instance = instance + prefs.Users[user] = prefsUser + }) +} + +// Client is a GtS API client with attached authentication credentials and rate +// limiter. Credentials may be no-op. +type Client struct { + Client *apiclient.GoToSocialSwaggerDocumentation + Auth runtime.ClientAuthInfoWriter + limiter *rate.Limiter + ctx context.Context +} + +func (c *Client) Wait() error { + if err := c.limiter.Wait(c.ctx); err != nil { + return errors.WithStack(err) + } + + return nil +} + +// NewAuthClient creates a new authentication client. +func NewAuthClient(user string) (*Client, error) { + var err error + + if user == "" { + user, err = GetDefaultUser() + if err != nil { + slog.Error("no user provided, couldn't get default user from prefs (did you log in first?)") + return nil, err + } + } + + instance, err := GetUserInstance(user) + if err != nil { + slog.Error("couldn't get user's instance from prefs (did you log in first?)", "user", user) + return nil, err + } + + accessToken, err := keyring.Get(keyringServiceAccessToken, user) + if err != nil { + slog.Error("couldn't find user's access token (did you log in first?)", "user", user) + return nil, err + } + + return &Client{ + Client: clientForInstance(instance), + Auth: httptransport.BearerToken(accessToken), + limiter: rate.NewLimiter(1.0, 300), + ctx: context.Background(), + }, nil +} + +const ( + keyringServiceAccessToken = "gtslib.auth.keyring.access-token" + keyringServiceClientSecret = "gtslib.auth.keyring.client-secret" +) + +const ( + oauthRedirect = "urn:ietf:wg:oauth:2.0:oob" + oauthScopes = "read write" +) + +// Login authenticates the user and saves the credentials in the system +// keychain. +func Login(user string, opts ...Option) error { + var err error + + if user == "" { + user, err = GetDefaultUser() + if err != nil { + slog.Error("no user provided, couldn't get default user from prefs (have you logged in before?)") + return err + } + } + + if user == "" { + return errors.WithStack(errors.New("a user is required")) + } + if !strings.ContainsRune(user, '@') { + return errors.WithStack(errors.New("a fully qualified user with a domain is required")) + } + if user[0] == '@' { + return errors.WithStack(errors.New("take the leading @ off the user and try again")) + } + + if _, err := keyring.Get(keyringServiceAccessToken, user); err == nil { + slog.Warn("already logged in, will log in again", "user", user) + } + + instance, err := ensureInstance(user) + if err != nil { + slog.Error("couldn't get user's instance", "user", user, "error", err) + return err + } + + conf := NewConfig(opts...) + client := clientForInstance(instance) + clientID, clientSecret, err := ensureAppCredentials(instance, client, conf) + if err != nil { + slog.Error("OAuth2 app setup failed", "user", user, "instance", instance, "error", err) + return err + } + + code := promptForOAuthCode(instance, clientID) + + accessToken, err := exchangeCodeForToken(instance, clientID, clientSecret, code) + if err != nil { + slog.Error("couldn't exchange OAuth2 authorization code for access token", "user", user, "instance", instance, "error", err) + return err + } + + err = keyring.Set(keyringServiceAccessToken, user, accessToken) + if err != nil { + slog.Error("couldn't set access token in keychain", "user", user, "instance", instance, "error", err) + return err + } + + err = SetDefaultUser(user) + if err != nil { + slog.Error("couldn't set default user in prefs", "user", user, "instance", instance, "error", err) + return err + } + + slog.Info("login successful", "user", user, "instance", instance) + + return nil +} + +// ensureInstance finds a user's instance or retrieves a previously cached +// instance for them. +func ensureInstance(user string) (string, error) { + if instance, err := GetUserInstance(user); err == nil { + return instance, nil + } + + instance, err := findInstance(user) + if err != nil { + slog.Error("WebFinger lookup failed", "user", user, "error", err) + return "", err + } + + err = SetUserInstance(user, instance) + if err != nil { + slog.Error("couldn't set instance in prefs", "user", user, "instance", instance, "error", err) + return "", err + } + + return instance, nil +} + +// findInstance does a WebFinger lookup to find the domain of the instance API +// for a given user. +func findInstance(user string) (string, error) { + webfingerClient := webfinger.NewClient(nil) + jrd, err := webfingerClient.Lookup(user, nil) + if err != nil { + return "", err + } + + var href string + for _, link := range jrd.Links { + if link.Rel == "self" && link.Type == "application/activity+json" { + href = link.Href + break + } + } + if href == "" { + return "", errors.New("no link with rel=\"self\" and type=\"application/activity+json\"") + } + + url, err := neturl.Parse(href) + if err != nil { + return "", err + } + + if url.Scheme != "https" || !(url.Port() == "" || url.Port() == "443") || url.Hostname() == "" { + return "", errors.New("unexpected URL format") + } + + return url.Hostname(), nil +} + +// clientForInstance retrieves the client for a specific instance. +func clientForInstance(instance string) *apiclient.GoToSocialSwaggerDocumentation { + return apiclient.New(httptransport.New(instance, "", []string{"https"}), strfmt.Default) +} + +// ensureAppCredentials retrieves or creates and stores app credentials. +func ensureAppCredentials( + instance string, + client *apiclient.GoToSocialSwaggerDocumentation, + conf *Config) (string, string, error) { + shouldCreateNewApp := false + + clientID, err := GetInstanceClientID(instance) + if clientID == "" || errors.Is(err, keyring.ErrNotFound) { + shouldCreateNewApp = true + } else if err != nil { + slog.Error("couldn't get client ID from prefs", "instance", instance, "error", err) + return "", "", err + } + + clientSecret, err := keyring.Get(keyringServiceClientSecret, instance) + if clientSecret == "" || errors.Is(err, keyring.ErrNotFound) { + shouldCreateNewApp = true + } else if err != nil { + slog.Error("couldn't get client secret from keychain", "instance", instance, "error", err) + return "", "", err + } + + if !shouldCreateNewApp { + return clientID, clientSecret, nil + } + + app, err := createApp(client, conf) + if err != nil { + slog.Error("couldn't create OAuth2 app", "instance", instance, "error", err) + return "", "", err + } + clientID = app.ClientID + clientSecret = app.ClientSecret + + err = SetInstanceClientID(instance, clientID) + if err != nil { + slog.Error("couldn't set client ID in prefs", "instance", instance, "error", err) + return "", "", err + } + err = keyring.Set(keyringServiceClientSecret, instance, clientSecret) + if err != nil { + slog.Error("couldn't set client secret in keychain", "instance", instance, "error", err) + return "", "", err + } + + return clientID, clientSecret, nil +} + +// createApp registers a new OAuth2 application. +func createApp( + client *apiclient.GoToSocialSwaggerDocumentation, + conf *Config) (*models.Application, error) { + resp, err := client.Apps.AppCreate( + &apps.AppCreateParams{ + ClientName: conf.Name, + RedirectURIs: oauthRedirect, + Scopes: Ptr(oauthScopes), + Website: Ptr(conf.Website), + }, + func(op *runtime.ClientOperation) { + op.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} + }, + ) + if err != nil { + return nil, err + } + return resp.GetPayload(), nil +} + +// promptForOAuthCode prompts for an OAuth code. +func promptForOAuthCode(instance string, clientID string) string { + oauthAuthorizeURL := (&neturl.URL{ + Scheme: "https", + Host: instance, + Path: "/oauth/authorize", + RawQuery: neturl.Values{ + "response_type": []string{"code"}, + "client_id": []string{clientID}, + "redirect_uri": []string{oauthRedirect}, + "scope": []string{oauthScopes}, + }.Encode(), + }).String() + err := browser.OpenURL(oauthAuthorizeURL) + if err != nil { + slog.Warn("couldn't open browser to authorize", "error", err) + print("Please open this URL in your browser:", oauthAuthorizeURL) + } + + print("Enter authorization code: ") + scanner := bufio.NewScanner(os.Stdin) + scanner.Scan() + code := strings.TrimSpace(scanner.Text()) + + return code +} + +type oauthTokenOK struct { + AccessToken string `json:"access_token"` + TokenType string `json:"token_type"` + Scope string `json:"scope"` + CreatedAt int64 `json:"created_at"` +} + +type oauthTokenError struct { + Error string `json:"error"` + ErrorDescription string `json:"error_description"` +} + +// exchangeCodeForToken exchanges an authorization code for an access token. +func exchangeCodeForToken(instance string, clientID string, clientSecret string, code string) (string, error) { + oauthTokenURL := (&neturl.URL{ + Scheme: "https", + Host: instance, + Path: "/oauth/token", + }).String() + + // TODO: add this to GtS Swagger doc + resp, err := http.Post(oauthTokenURL, "application/x-www-form-urlencoded", strings.NewReader(neturl.Values{ + "grant_type": []string{"authorization_code"}, + "code": []string{code}, + "client_id": []string{clientID}, + "client_secret": []string{clientSecret}, + "redirect_uri": []string{oauthRedirect}, + "scope": []string{oauthScopes}, + }.Encode())) + if err != nil { + slog.Error("call to OAuth2 token endpoint failed", "instance", instance, "error", err) + return "", err + } + + if resp.StatusCode != http.StatusOK { + var payload oauthTokenError + err = json.NewDecoder(resp.Body).Decode(&payload) + if err != nil { + slog.Error("couldn't decode OAuth2 token endpoint error response", "instance", instance, "error", err) + return "", err + } + return "", errors.WithStack(errors.New(payload.ErrorDescription)) + } + + var payload oauthTokenOK + err = json.NewDecoder(resp.Body).Decode(&payload) + if err != nil { + slog.Error("couldn't decode OAuth2 token endpoint success response", "instance", instance, "error", err) + return "", err + } + + if payload.TokenType != "Bearer" { + err = errors.WithStack(errors.New("unknown access token type")) + slog.Error("unexpected response from OAuth2 token endpoint", "instance", instance, "token_type", payload.TokenType) + return "", err + } + + if payload.Scope != oauthScopes { + err = errors.WithStack(errors.New("scopes are not what we asked for")) + slog.Error("unexpected response from OAuth2 token endpoint", "instance", instance, "scopes", payload.Scope) + return "", err + } + + return payload.AccessToken, nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/LICENSE b/vendor/git.coopcloud.tech/decentral1se/gtslib/LICENSE new file mode 100644 index 0000000..034880d --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/LICENSE @@ -0,0 +1,15 @@ +gtslib: Go API bindings for GoToSocial +Copyright (C) 2024 decentral1se + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU Affero General Public License as published by the Free +Software Foundation, either version 3 of the License, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU Affero General Public License for more +details. + +You should have received a copy of the GNU Affero General Public License along +with this program. If not, see . diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_alias_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_alias_parameters.go new file mode 100644 index 0000000..7b66072 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_alias_parameters.go @@ -0,0 +1,156 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountAliasParams creates a new AccountAliasParams 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 NewAccountAliasParams() *AccountAliasParams { + return &AccountAliasParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountAliasParamsWithTimeout creates a new AccountAliasParams object +// with the ability to set a timeout on a request. +func NewAccountAliasParamsWithTimeout(timeout time.Duration) *AccountAliasParams { + return &AccountAliasParams{ + timeout: timeout, + } +} + +// NewAccountAliasParamsWithContext creates a new AccountAliasParams object +// with the ability to set a context for a request. +func NewAccountAliasParamsWithContext(ctx context.Context) *AccountAliasParams { + return &AccountAliasParams{ + Context: ctx, + } +} + +// NewAccountAliasParamsWithHTTPClient creates a new AccountAliasParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountAliasParamsWithHTTPClient(client *http.Client) *AccountAliasParams { + return &AccountAliasParams{ + HTTPClient: client, + } +} + +/* +AccountAliasParams contains all the parameters to send to the API endpoint + + for the account alias operation. + + Typically these are written to a http.Request. +*/ +type AccountAliasParams struct { + + /* AlsoKnownAsUris. + + ActivityPub URI/IDs of target accounts to which this account is being aliased. Eg., `["https://example.org/users/some_account"]`. + Use an empty array to unset alsoKnownAs, clearing the aliases. + */ + AlsoKnownAsUris string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account alias params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountAliasParams) WithDefaults() *AccountAliasParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account alias params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountAliasParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account alias params +func (o *AccountAliasParams) WithTimeout(timeout time.Duration) *AccountAliasParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account alias params +func (o *AccountAliasParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account alias params +func (o *AccountAliasParams) WithContext(ctx context.Context) *AccountAliasParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account alias params +func (o *AccountAliasParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account alias params +func (o *AccountAliasParams) WithHTTPClient(client *http.Client) *AccountAliasParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account alias params +func (o *AccountAliasParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAlsoKnownAsUris adds the alsoKnownAsUris to the account alias params +func (o *AccountAliasParams) WithAlsoKnownAsUris(alsoKnownAsUris string) *AccountAliasParams { + o.SetAlsoKnownAsUris(alsoKnownAsUris) + return o +} + +// SetAlsoKnownAsUris adds the alsoKnownAsUris to the account alias params +func (o *AccountAliasParams) SetAlsoKnownAsUris(alsoKnownAsUris string) { + o.AlsoKnownAsUris = alsoKnownAsUris +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountAliasParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param also_known_as_uris + frAlsoKnownAsUris := o.AlsoKnownAsUris + fAlsoKnownAsUris := frAlsoKnownAsUris + if fAlsoKnownAsUris != "" { + if err := r.SetFormParam("also_known_as_uris", fAlsoKnownAsUris); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_alias_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_alias_responses.go new file mode 100644 index 0000000..45699e7 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_alias_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountAliasReader is a Reader for the AccountAlias structure. +type AccountAliasReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountAliasReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountAliasOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountAliasBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountAliasUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountAliasNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountAliasNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewAccountAliasUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountAliasInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts/alias] accountAlias", response, response.Code()) + } +} + +// NewAccountAliasOK creates a AccountAliasOK with default headers values +func NewAccountAliasOK() *AccountAliasOK { + return &AccountAliasOK{} +} + +/* +AccountAliasOK describes a response with status code 200, with default header values. + +The newly updated account. +*/ +type AccountAliasOK struct { + Payload *models.Account +} + +// IsSuccess returns true when this account alias o k response has a 2xx status code +func (o *AccountAliasOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account alias o k response has a 3xx status code +func (o *AccountAliasOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account alias o k response has a 4xx status code +func (o *AccountAliasOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account alias o k response has a 5xx status code +func (o *AccountAliasOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account alias o k response a status code equal to that given +func (o *AccountAliasOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account alias o k response +func (o *AccountAliasOK) Code() int { + return 200 +} + +func (o *AccountAliasOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasOK %s", 200, payload) +} + +func (o *AccountAliasOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasOK %s", 200, payload) +} + +func (o *AccountAliasOK) GetPayload() *models.Account { + return o.Payload +} + +func (o *AccountAliasOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Account) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountAliasBadRequest creates a AccountAliasBadRequest with default headers values +func NewAccountAliasBadRequest() *AccountAliasBadRequest { + return &AccountAliasBadRequest{} +} + +/* +AccountAliasBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountAliasBadRequest struct { +} + +// IsSuccess returns true when this account alias bad request response has a 2xx status code +func (o *AccountAliasBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account alias bad request response has a 3xx status code +func (o *AccountAliasBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account alias bad request response has a 4xx status code +func (o *AccountAliasBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account alias bad request response has a 5xx status code +func (o *AccountAliasBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account alias bad request response a status code equal to that given +func (o *AccountAliasBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account alias bad request response +func (o *AccountAliasBadRequest) Code() int { + return 400 +} + +func (o *AccountAliasBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasBadRequest", 400) +} + +func (o *AccountAliasBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasBadRequest", 400) +} + +func (o *AccountAliasBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountAliasUnauthorized creates a AccountAliasUnauthorized with default headers values +func NewAccountAliasUnauthorized() *AccountAliasUnauthorized { + return &AccountAliasUnauthorized{} +} + +/* +AccountAliasUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountAliasUnauthorized struct { +} + +// IsSuccess returns true when this account alias unauthorized response has a 2xx status code +func (o *AccountAliasUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account alias unauthorized response has a 3xx status code +func (o *AccountAliasUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account alias unauthorized response has a 4xx status code +func (o *AccountAliasUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account alias unauthorized response has a 5xx status code +func (o *AccountAliasUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account alias unauthorized response a status code equal to that given +func (o *AccountAliasUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account alias unauthorized response +func (o *AccountAliasUnauthorized) Code() int { + return 401 +} + +func (o *AccountAliasUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasUnauthorized", 401) +} + +func (o *AccountAliasUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasUnauthorized", 401) +} + +func (o *AccountAliasUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountAliasNotFound creates a AccountAliasNotFound with default headers values +func NewAccountAliasNotFound() *AccountAliasNotFound { + return &AccountAliasNotFound{} +} + +/* +AccountAliasNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountAliasNotFound struct { +} + +// IsSuccess returns true when this account alias not found response has a 2xx status code +func (o *AccountAliasNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account alias not found response has a 3xx status code +func (o *AccountAliasNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account alias not found response has a 4xx status code +func (o *AccountAliasNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account alias not found response has a 5xx status code +func (o *AccountAliasNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account alias not found response a status code equal to that given +func (o *AccountAliasNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account alias not found response +func (o *AccountAliasNotFound) Code() int { + return 404 +} + +func (o *AccountAliasNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasNotFound", 404) +} + +func (o *AccountAliasNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasNotFound", 404) +} + +func (o *AccountAliasNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountAliasNotAcceptable creates a AccountAliasNotAcceptable with default headers values +func NewAccountAliasNotAcceptable() *AccountAliasNotAcceptable { + return &AccountAliasNotAcceptable{} +} + +/* +AccountAliasNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountAliasNotAcceptable struct { +} + +// IsSuccess returns true when this account alias not acceptable response has a 2xx status code +func (o *AccountAliasNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account alias not acceptable response has a 3xx status code +func (o *AccountAliasNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account alias not acceptable response has a 4xx status code +func (o *AccountAliasNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account alias not acceptable response has a 5xx status code +func (o *AccountAliasNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account alias not acceptable response a status code equal to that given +func (o *AccountAliasNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account alias not acceptable response +func (o *AccountAliasNotAcceptable) Code() int { + return 406 +} + +func (o *AccountAliasNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasNotAcceptable", 406) +} + +func (o *AccountAliasNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasNotAcceptable", 406) +} + +func (o *AccountAliasNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountAliasUnprocessableEntity creates a AccountAliasUnprocessableEntity with default headers values +func NewAccountAliasUnprocessableEntity() *AccountAliasUnprocessableEntity { + return &AccountAliasUnprocessableEntity{} +} + +/* +AccountAliasUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable. Check the response body for more details. +*/ +type AccountAliasUnprocessableEntity struct { +} + +// IsSuccess returns true when this account alias unprocessable entity response has a 2xx status code +func (o *AccountAliasUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account alias unprocessable entity response has a 3xx status code +func (o *AccountAliasUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account alias unprocessable entity response has a 4xx status code +func (o *AccountAliasUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this account alias unprocessable entity response has a 5xx status code +func (o *AccountAliasUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this account alias unprocessable entity response a status code equal to that given +func (o *AccountAliasUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the account alias unprocessable entity response +func (o *AccountAliasUnprocessableEntity) Code() int { + return 422 +} + +func (o *AccountAliasUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasUnprocessableEntity", 422) +} + +func (o *AccountAliasUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasUnprocessableEntity", 422) +} + +func (o *AccountAliasUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountAliasInternalServerError creates a AccountAliasInternalServerError with default headers values +func NewAccountAliasInternalServerError() *AccountAliasInternalServerError { + return &AccountAliasInternalServerError{} +} + +/* +AccountAliasInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountAliasInternalServerError struct { +} + +// IsSuccess returns true when this account alias internal server error response has a 2xx status code +func (o *AccountAliasInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account alias internal server error response has a 3xx status code +func (o *AccountAliasInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account alias internal server error response has a 4xx status code +func (o *AccountAliasInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account alias internal server error response has a 5xx status code +func (o *AccountAliasInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account alias internal server error response a status code equal to that given +func (o *AccountAliasInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account alias internal server error response +func (o *AccountAliasInternalServerError) Code() int { + return 500 +} + +func (o *AccountAliasInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasInternalServerError", 500) +} + +func (o *AccountAliasInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasInternalServerError", 500) +} + +func (o *AccountAliasInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_avatar_delete_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_avatar_delete_parameters.go new file mode 100644 index 0000000..98b1d35 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_avatar_delete_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountAvatarDeleteParams creates a new AccountAvatarDeleteParams 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 NewAccountAvatarDeleteParams() *AccountAvatarDeleteParams { + return &AccountAvatarDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountAvatarDeleteParamsWithTimeout creates a new AccountAvatarDeleteParams object +// with the ability to set a timeout on a request. +func NewAccountAvatarDeleteParamsWithTimeout(timeout time.Duration) *AccountAvatarDeleteParams { + return &AccountAvatarDeleteParams{ + timeout: timeout, + } +} + +// NewAccountAvatarDeleteParamsWithContext creates a new AccountAvatarDeleteParams object +// with the ability to set a context for a request. +func NewAccountAvatarDeleteParamsWithContext(ctx context.Context) *AccountAvatarDeleteParams { + return &AccountAvatarDeleteParams{ + Context: ctx, + } +} + +// NewAccountAvatarDeleteParamsWithHTTPClient creates a new AccountAvatarDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountAvatarDeleteParamsWithHTTPClient(client *http.Client) *AccountAvatarDeleteParams { + return &AccountAvatarDeleteParams{ + HTTPClient: client, + } +} + +/* +AccountAvatarDeleteParams contains all the parameters to send to the API endpoint + + for the account avatar delete operation. + + Typically these are written to a http.Request. +*/ +type AccountAvatarDeleteParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account avatar delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountAvatarDeleteParams) WithDefaults() *AccountAvatarDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account avatar delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountAvatarDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account avatar delete params +func (o *AccountAvatarDeleteParams) WithTimeout(timeout time.Duration) *AccountAvatarDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account avatar delete params +func (o *AccountAvatarDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account avatar delete params +func (o *AccountAvatarDeleteParams) WithContext(ctx context.Context) *AccountAvatarDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account avatar delete params +func (o *AccountAvatarDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account avatar delete params +func (o *AccountAvatarDeleteParams) WithHTTPClient(client *http.Client) *AccountAvatarDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account avatar delete params +func (o *AccountAvatarDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountAvatarDeleteParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_avatar_delete_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_avatar_delete_responses.go new file mode 100644 index 0000000..b01a3c3 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_avatar_delete_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountAvatarDeleteReader is a Reader for the AccountAvatarDelete structure. +type AccountAvatarDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountAvatarDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountAvatarDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountAvatarDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountAvatarDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewAccountAvatarDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountAvatarDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountAvatarDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/profile/avatar] accountAvatarDelete", response, response.Code()) + } +} + +// NewAccountAvatarDeleteOK creates a AccountAvatarDeleteOK with default headers values +func NewAccountAvatarDeleteOK() *AccountAvatarDeleteOK { + return &AccountAvatarDeleteOK{} +} + +/* +AccountAvatarDeleteOK describes a response with status code 200, with default header values. + +The updated account, including profile source information. +*/ +type AccountAvatarDeleteOK struct { + Payload *models.Account +} + +// IsSuccess returns true when this account avatar delete o k response has a 2xx status code +func (o *AccountAvatarDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account avatar delete o k response has a 3xx status code +func (o *AccountAvatarDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account avatar delete o k response has a 4xx status code +func (o *AccountAvatarDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account avatar delete o k response has a 5xx status code +func (o *AccountAvatarDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account avatar delete o k response a status code equal to that given +func (o *AccountAvatarDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account avatar delete o k response +func (o *AccountAvatarDeleteOK) Code() int { + return 200 +} + +func (o *AccountAvatarDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteOK %s", 200, payload) +} + +func (o *AccountAvatarDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteOK %s", 200, payload) +} + +func (o *AccountAvatarDeleteOK) GetPayload() *models.Account { + return o.Payload +} + +func (o *AccountAvatarDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Account) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountAvatarDeleteBadRequest creates a AccountAvatarDeleteBadRequest with default headers values +func NewAccountAvatarDeleteBadRequest() *AccountAvatarDeleteBadRequest { + return &AccountAvatarDeleteBadRequest{} +} + +/* +AccountAvatarDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountAvatarDeleteBadRequest struct { +} + +// IsSuccess returns true when this account avatar delete bad request response has a 2xx status code +func (o *AccountAvatarDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account avatar delete bad request response has a 3xx status code +func (o *AccountAvatarDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account avatar delete bad request response has a 4xx status code +func (o *AccountAvatarDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account avatar delete bad request response has a 5xx status code +func (o *AccountAvatarDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account avatar delete bad request response a status code equal to that given +func (o *AccountAvatarDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account avatar delete bad request response +func (o *AccountAvatarDeleteBadRequest) Code() int { + return 400 +} + +func (o *AccountAvatarDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteBadRequest", 400) +} + +func (o *AccountAvatarDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteBadRequest", 400) +} + +func (o *AccountAvatarDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountAvatarDeleteUnauthorized creates a AccountAvatarDeleteUnauthorized with default headers values +func NewAccountAvatarDeleteUnauthorized() *AccountAvatarDeleteUnauthorized { + return &AccountAvatarDeleteUnauthorized{} +} + +/* +AccountAvatarDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountAvatarDeleteUnauthorized struct { +} + +// IsSuccess returns true when this account avatar delete unauthorized response has a 2xx status code +func (o *AccountAvatarDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account avatar delete unauthorized response has a 3xx status code +func (o *AccountAvatarDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account avatar delete unauthorized response has a 4xx status code +func (o *AccountAvatarDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account avatar delete unauthorized response has a 5xx status code +func (o *AccountAvatarDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account avatar delete unauthorized response a status code equal to that given +func (o *AccountAvatarDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account avatar delete unauthorized response +func (o *AccountAvatarDeleteUnauthorized) Code() int { + return 401 +} + +func (o *AccountAvatarDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteUnauthorized", 401) +} + +func (o *AccountAvatarDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteUnauthorized", 401) +} + +func (o *AccountAvatarDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountAvatarDeleteForbidden creates a AccountAvatarDeleteForbidden with default headers values +func NewAccountAvatarDeleteForbidden() *AccountAvatarDeleteForbidden { + return &AccountAvatarDeleteForbidden{} +} + +/* +AccountAvatarDeleteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type AccountAvatarDeleteForbidden struct { +} + +// IsSuccess returns true when this account avatar delete forbidden response has a 2xx status code +func (o *AccountAvatarDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account avatar delete forbidden response has a 3xx status code +func (o *AccountAvatarDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account avatar delete forbidden response has a 4xx status code +func (o *AccountAvatarDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this account avatar delete forbidden response has a 5xx status code +func (o *AccountAvatarDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this account avatar delete forbidden response a status code equal to that given +func (o *AccountAvatarDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the account avatar delete forbidden response +func (o *AccountAvatarDeleteForbidden) Code() int { + return 403 +} + +func (o *AccountAvatarDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteForbidden", 403) +} + +func (o *AccountAvatarDeleteForbidden) String() string { + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteForbidden", 403) +} + +func (o *AccountAvatarDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountAvatarDeleteNotAcceptable creates a AccountAvatarDeleteNotAcceptable with default headers values +func NewAccountAvatarDeleteNotAcceptable() *AccountAvatarDeleteNotAcceptable { + return &AccountAvatarDeleteNotAcceptable{} +} + +/* +AccountAvatarDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountAvatarDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this account avatar delete not acceptable response has a 2xx status code +func (o *AccountAvatarDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account avatar delete not acceptable response has a 3xx status code +func (o *AccountAvatarDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account avatar delete not acceptable response has a 4xx status code +func (o *AccountAvatarDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account avatar delete not acceptable response has a 5xx status code +func (o *AccountAvatarDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account avatar delete not acceptable response a status code equal to that given +func (o *AccountAvatarDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account avatar delete not acceptable response +func (o *AccountAvatarDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *AccountAvatarDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteNotAcceptable", 406) +} + +func (o *AccountAvatarDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteNotAcceptable", 406) +} + +func (o *AccountAvatarDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountAvatarDeleteInternalServerError creates a AccountAvatarDeleteInternalServerError with default headers values +func NewAccountAvatarDeleteInternalServerError() *AccountAvatarDeleteInternalServerError { + return &AccountAvatarDeleteInternalServerError{} +} + +/* +AccountAvatarDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountAvatarDeleteInternalServerError struct { +} + +// IsSuccess returns true when this account avatar delete internal server error response has a 2xx status code +func (o *AccountAvatarDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account avatar delete internal server error response has a 3xx status code +func (o *AccountAvatarDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account avatar delete internal server error response has a 4xx status code +func (o *AccountAvatarDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account avatar delete internal server error response has a 5xx status code +func (o *AccountAvatarDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account avatar delete internal server error response a status code equal to that given +func (o *AccountAvatarDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account avatar delete internal server error response +func (o *AccountAvatarDeleteInternalServerError) Code() int { + return 500 +} + +func (o *AccountAvatarDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteInternalServerError", 500) +} + +func (o *AccountAvatarDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteInternalServerError", 500) +} + +func (o *AccountAvatarDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_block_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_block_parameters.go new file mode 100644 index 0000000..af3bfb8 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_block_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountBlockParams creates a new AccountBlockParams 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 NewAccountBlockParams() *AccountBlockParams { + return &AccountBlockParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountBlockParamsWithTimeout creates a new AccountBlockParams object +// with the ability to set a timeout on a request. +func NewAccountBlockParamsWithTimeout(timeout time.Duration) *AccountBlockParams { + return &AccountBlockParams{ + timeout: timeout, + } +} + +// NewAccountBlockParamsWithContext creates a new AccountBlockParams object +// with the ability to set a context for a request. +func NewAccountBlockParamsWithContext(ctx context.Context) *AccountBlockParams { + return &AccountBlockParams{ + Context: ctx, + } +} + +// NewAccountBlockParamsWithHTTPClient creates a new AccountBlockParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountBlockParamsWithHTTPClient(client *http.Client) *AccountBlockParams { + return &AccountBlockParams{ + HTTPClient: client, + } +} + +/* +AccountBlockParams contains all the parameters to send to the API endpoint + + for the account block operation. + + Typically these are written to a http.Request. +*/ +type AccountBlockParams struct { + + /* ID. + + The id of the account to block. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account block params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountBlockParams) WithDefaults() *AccountBlockParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account block params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountBlockParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account block params +func (o *AccountBlockParams) WithTimeout(timeout time.Duration) *AccountBlockParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account block params +func (o *AccountBlockParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account block params +func (o *AccountBlockParams) WithContext(ctx context.Context) *AccountBlockParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account block params +func (o *AccountBlockParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account block params +func (o *AccountBlockParams) WithHTTPClient(client *http.Client) *AccountBlockParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account block params +func (o *AccountBlockParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the account block params +func (o *AccountBlockParams) WithID(id string) *AccountBlockParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account block params +func (o *AccountBlockParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountBlockParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_block_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_block_responses.go new file mode 100644 index 0000000..17d62d9 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_block_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountBlockReader is a Reader for the AccountBlock structure. +type AccountBlockReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountBlockReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountBlockOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountBlockBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountBlockUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountBlockNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountBlockNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountBlockInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts/{id}/block] accountBlock", response, response.Code()) + } +} + +// NewAccountBlockOK creates a AccountBlockOK with default headers values +func NewAccountBlockOK() *AccountBlockOK { + return &AccountBlockOK{} +} + +/* +AccountBlockOK describes a response with status code 200, with default header values. + +Your relationship to the account. +*/ +type AccountBlockOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this account block o k response has a 2xx status code +func (o *AccountBlockOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account block o k response has a 3xx status code +func (o *AccountBlockOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account block o k response has a 4xx status code +func (o *AccountBlockOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account block o k response has a 5xx status code +func (o *AccountBlockOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account block o k response a status code equal to that given +func (o *AccountBlockOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account block o k response +func (o *AccountBlockOK) Code() int { + return 200 +} + +func (o *AccountBlockOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockOK %s", 200, payload) +} + +func (o *AccountBlockOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockOK %s", 200, payload) +} + +func (o *AccountBlockOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *AccountBlockOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountBlockBadRequest creates a AccountBlockBadRequest with default headers values +func NewAccountBlockBadRequest() *AccountBlockBadRequest { + return &AccountBlockBadRequest{} +} + +/* +AccountBlockBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountBlockBadRequest struct { +} + +// IsSuccess returns true when this account block bad request response has a 2xx status code +func (o *AccountBlockBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account block bad request response has a 3xx status code +func (o *AccountBlockBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account block bad request response has a 4xx status code +func (o *AccountBlockBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account block bad request response has a 5xx status code +func (o *AccountBlockBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account block bad request response a status code equal to that given +func (o *AccountBlockBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account block bad request response +func (o *AccountBlockBadRequest) Code() int { + return 400 +} + +func (o *AccountBlockBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockBadRequest", 400) +} + +func (o *AccountBlockBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockBadRequest", 400) +} + +func (o *AccountBlockBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountBlockUnauthorized creates a AccountBlockUnauthorized with default headers values +func NewAccountBlockUnauthorized() *AccountBlockUnauthorized { + return &AccountBlockUnauthorized{} +} + +/* +AccountBlockUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountBlockUnauthorized struct { +} + +// IsSuccess returns true when this account block unauthorized response has a 2xx status code +func (o *AccountBlockUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account block unauthorized response has a 3xx status code +func (o *AccountBlockUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account block unauthorized response has a 4xx status code +func (o *AccountBlockUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account block unauthorized response has a 5xx status code +func (o *AccountBlockUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account block unauthorized response a status code equal to that given +func (o *AccountBlockUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account block unauthorized response +func (o *AccountBlockUnauthorized) Code() int { + return 401 +} + +func (o *AccountBlockUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockUnauthorized", 401) +} + +func (o *AccountBlockUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockUnauthorized", 401) +} + +func (o *AccountBlockUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountBlockNotFound creates a AccountBlockNotFound with default headers values +func NewAccountBlockNotFound() *AccountBlockNotFound { + return &AccountBlockNotFound{} +} + +/* +AccountBlockNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountBlockNotFound struct { +} + +// IsSuccess returns true when this account block not found response has a 2xx status code +func (o *AccountBlockNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account block not found response has a 3xx status code +func (o *AccountBlockNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account block not found response has a 4xx status code +func (o *AccountBlockNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account block not found response has a 5xx status code +func (o *AccountBlockNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account block not found response a status code equal to that given +func (o *AccountBlockNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account block not found response +func (o *AccountBlockNotFound) Code() int { + return 404 +} + +func (o *AccountBlockNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockNotFound", 404) +} + +func (o *AccountBlockNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockNotFound", 404) +} + +func (o *AccountBlockNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountBlockNotAcceptable creates a AccountBlockNotAcceptable with default headers values +func NewAccountBlockNotAcceptable() *AccountBlockNotAcceptable { + return &AccountBlockNotAcceptable{} +} + +/* +AccountBlockNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountBlockNotAcceptable struct { +} + +// IsSuccess returns true when this account block not acceptable response has a 2xx status code +func (o *AccountBlockNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account block not acceptable response has a 3xx status code +func (o *AccountBlockNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account block not acceptable response has a 4xx status code +func (o *AccountBlockNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account block not acceptable response has a 5xx status code +func (o *AccountBlockNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account block not acceptable response a status code equal to that given +func (o *AccountBlockNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account block not acceptable response +func (o *AccountBlockNotAcceptable) Code() int { + return 406 +} + +func (o *AccountBlockNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockNotAcceptable", 406) +} + +func (o *AccountBlockNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockNotAcceptable", 406) +} + +func (o *AccountBlockNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountBlockInternalServerError creates a AccountBlockInternalServerError with default headers values +func NewAccountBlockInternalServerError() *AccountBlockInternalServerError { + return &AccountBlockInternalServerError{} +} + +/* +AccountBlockInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountBlockInternalServerError struct { +} + +// IsSuccess returns true when this account block internal server error response has a 2xx status code +func (o *AccountBlockInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account block internal server error response has a 3xx status code +func (o *AccountBlockInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account block internal server error response has a 4xx status code +func (o *AccountBlockInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account block internal server error response has a 5xx status code +func (o *AccountBlockInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account block internal server error response a status code equal to that given +func (o *AccountBlockInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account block internal server error response +func (o *AccountBlockInternalServerError) Code() int { + return 500 +} + +func (o *AccountBlockInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockInternalServerError", 500) +} + +func (o *AccountBlockInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockInternalServerError", 500) +} + +func (o *AccountBlockInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_create_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_create_parameters.go new file mode 100644 index 0000000..e655f6b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_create_parameters.go @@ -0,0 +1,334 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountCreateParams creates a new AccountCreateParams 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 NewAccountCreateParams() *AccountCreateParams { + return &AccountCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountCreateParamsWithTimeout creates a new AccountCreateParams object +// with the ability to set a timeout on a request. +func NewAccountCreateParamsWithTimeout(timeout time.Duration) *AccountCreateParams { + return &AccountCreateParams{ + timeout: timeout, + } +} + +// NewAccountCreateParamsWithContext creates a new AccountCreateParams object +// with the ability to set a context for a request. +func NewAccountCreateParamsWithContext(ctx context.Context) *AccountCreateParams { + return &AccountCreateParams{ + Context: ctx, + } +} + +// NewAccountCreateParamsWithHTTPClient creates a new AccountCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountCreateParamsWithHTTPClient(client *http.Client) *AccountCreateParams { + return &AccountCreateParams{ + HTTPClient: client, + } +} + +/* +AccountCreateParams contains all the parameters to send to the API endpoint + + for the account create operation. + + Typically these are written to a http.Request. +*/ +type AccountCreateParams struct { + + /* Agreement. + + The user agrees to the terms, conditions, and policies of the instance. + */ + Agreement *bool + + /* Email. + + The email address to be used for login. + */ + Email *string + + /* Locale. + + The language of the confirmation email that will be sent. + */ + Locale *string + + /* Password. + + The password to be used for login. This will be hashed before storage. + */ + Password *string + + /* Reason. + + Text that will be reviewed by moderators if registrations require manual approval. + */ + Reason *string + + /* Username. + + The desired username for the account. + */ + Username *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountCreateParams) WithDefaults() *AccountCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountCreateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account create params +func (o *AccountCreateParams) WithTimeout(timeout time.Duration) *AccountCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account create params +func (o *AccountCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account create params +func (o *AccountCreateParams) WithContext(ctx context.Context) *AccountCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account create params +func (o *AccountCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account create params +func (o *AccountCreateParams) WithHTTPClient(client *http.Client) *AccountCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account create params +func (o *AccountCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAgreement adds the agreement to the account create params +func (o *AccountCreateParams) WithAgreement(agreement *bool) *AccountCreateParams { + o.SetAgreement(agreement) + return o +} + +// SetAgreement adds the agreement to the account create params +func (o *AccountCreateParams) SetAgreement(agreement *bool) { + o.Agreement = agreement +} + +// WithEmail adds the email to the account create params +func (o *AccountCreateParams) WithEmail(email *string) *AccountCreateParams { + o.SetEmail(email) + return o +} + +// SetEmail adds the email to the account create params +func (o *AccountCreateParams) SetEmail(email *string) { + o.Email = email +} + +// WithLocale adds the locale to the account create params +func (o *AccountCreateParams) WithLocale(locale *string) *AccountCreateParams { + o.SetLocale(locale) + return o +} + +// SetLocale adds the locale to the account create params +func (o *AccountCreateParams) SetLocale(locale *string) { + o.Locale = locale +} + +// WithPassword adds the password to the account create params +func (o *AccountCreateParams) WithPassword(password *string) *AccountCreateParams { + o.SetPassword(password) + return o +} + +// SetPassword adds the password to the account create params +func (o *AccountCreateParams) SetPassword(password *string) { + o.Password = password +} + +// WithReason adds the reason to the account create params +func (o *AccountCreateParams) WithReason(reason *string) *AccountCreateParams { + o.SetReason(reason) + return o +} + +// SetReason adds the reason to the account create params +func (o *AccountCreateParams) SetReason(reason *string) { + o.Reason = reason +} + +// WithUsername adds the username to the account create params +func (o *AccountCreateParams) WithUsername(username *string) *AccountCreateParams { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the account create params +func (o *AccountCreateParams) SetUsername(username *string) { + o.Username = username +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Agreement != nil { + + // query param agreement + var qrAgreement bool + + if o.Agreement != nil { + qrAgreement = *o.Agreement + } + qAgreement := swag.FormatBool(qrAgreement) + if qAgreement != "" { + + if err := r.SetQueryParam("agreement", qAgreement); err != nil { + return err + } + } + } + + if o.Email != nil { + + // query param email + var qrEmail string + + if o.Email != nil { + qrEmail = *o.Email + } + qEmail := qrEmail + if qEmail != "" { + + if err := r.SetQueryParam("email", qEmail); err != nil { + return err + } + } + } + + if o.Locale != nil { + + // query param locale + var qrLocale string + + if o.Locale != nil { + qrLocale = *o.Locale + } + qLocale := qrLocale + if qLocale != "" { + + if err := r.SetQueryParam("locale", qLocale); err != nil { + return err + } + } + } + + if o.Password != nil { + + // query param password + var qrPassword string + + if o.Password != nil { + qrPassword = *o.Password + } + qPassword := qrPassword + if qPassword != "" { + + if err := r.SetQueryParam("password", qPassword); err != nil { + return err + } + } + } + + if o.Reason != nil { + + // query param reason + var qrReason string + + if o.Reason != nil { + qrReason = *o.Reason + } + qReason := qrReason + if qReason != "" { + + if err := r.SetQueryParam("reason", qReason); err != nil { + return err + } + } + } + + if o.Username != nil { + + // query param username + var qrUsername string + + if o.Username != nil { + qrUsername = *o.Username + } + qUsername := qrUsername + if qUsername != "" { + + if err := r.SetQueryParam("username", qUsername); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_create_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_create_responses.go new file mode 100644 index 0000000..17a4ad9 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_create_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountCreateReader is a Reader for the AccountCreate structure. +type AccountCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountCreateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountCreateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewAccountCreateUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts] accountCreate", response, response.Code()) + } +} + +// NewAccountCreateOK creates a AccountCreateOK with default headers values +func NewAccountCreateOK() *AccountCreateOK { + return &AccountCreateOK{} +} + +/* +AccountCreateOK describes a response with status code 200, with default header values. + +An OAuth2 access token for the newly-created account. +*/ +type AccountCreateOK struct { + Payload *models.Token +} + +// IsSuccess returns true when this account create o k response has a 2xx status code +func (o *AccountCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account create o k response has a 3xx status code +func (o *AccountCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account create o k response has a 4xx status code +func (o *AccountCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account create o k response has a 5xx status code +func (o *AccountCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account create o k response a status code equal to that given +func (o *AccountCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account create o k response +func (o *AccountCreateOK) Code() int { + return 200 +} + +func (o *AccountCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateOK %s", 200, payload) +} + +func (o *AccountCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateOK %s", 200, payload) +} + +func (o *AccountCreateOK) GetPayload() *models.Token { + return o.Payload +} + +func (o *AccountCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Token) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountCreateBadRequest creates a AccountCreateBadRequest with default headers values +func NewAccountCreateBadRequest() *AccountCreateBadRequest { + return &AccountCreateBadRequest{} +} + +/* +AccountCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountCreateBadRequest struct { +} + +// IsSuccess returns true when this account create bad request response has a 2xx status code +func (o *AccountCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account create bad request response has a 3xx status code +func (o *AccountCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account create bad request response has a 4xx status code +func (o *AccountCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account create bad request response has a 5xx status code +func (o *AccountCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account create bad request response a status code equal to that given +func (o *AccountCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account create bad request response +func (o *AccountCreateBadRequest) Code() int { + return 400 +} + +func (o *AccountCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateBadRequest", 400) +} + +func (o *AccountCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateBadRequest", 400) +} + +func (o *AccountCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountCreateUnauthorized creates a AccountCreateUnauthorized with default headers values +func NewAccountCreateUnauthorized() *AccountCreateUnauthorized { + return &AccountCreateUnauthorized{} +} + +/* +AccountCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountCreateUnauthorized struct { +} + +// IsSuccess returns true when this account create unauthorized response has a 2xx status code +func (o *AccountCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account create unauthorized response has a 3xx status code +func (o *AccountCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account create unauthorized response has a 4xx status code +func (o *AccountCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account create unauthorized response has a 5xx status code +func (o *AccountCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account create unauthorized response a status code equal to that given +func (o *AccountCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account create unauthorized response +func (o *AccountCreateUnauthorized) Code() int { + return 401 +} + +func (o *AccountCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateUnauthorized", 401) +} + +func (o *AccountCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateUnauthorized", 401) +} + +func (o *AccountCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountCreateNotFound creates a AccountCreateNotFound with default headers values +func NewAccountCreateNotFound() *AccountCreateNotFound { + return &AccountCreateNotFound{} +} + +/* +AccountCreateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountCreateNotFound struct { +} + +// IsSuccess returns true when this account create not found response has a 2xx status code +func (o *AccountCreateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account create not found response has a 3xx status code +func (o *AccountCreateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account create not found response has a 4xx status code +func (o *AccountCreateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account create not found response has a 5xx status code +func (o *AccountCreateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account create not found response a status code equal to that given +func (o *AccountCreateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account create not found response +func (o *AccountCreateNotFound) Code() int { + return 404 +} + +func (o *AccountCreateNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateNotFound", 404) +} + +func (o *AccountCreateNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateNotFound", 404) +} + +func (o *AccountCreateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountCreateNotAcceptable creates a AccountCreateNotAcceptable with default headers values +func NewAccountCreateNotAcceptable() *AccountCreateNotAcceptable { + return &AccountCreateNotAcceptable{} +} + +/* +AccountCreateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountCreateNotAcceptable struct { +} + +// IsSuccess returns true when this account create not acceptable response has a 2xx status code +func (o *AccountCreateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account create not acceptable response has a 3xx status code +func (o *AccountCreateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account create not acceptable response has a 4xx status code +func (o *AccountCreateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account create not acceptable response has a 5xx status code +func (o *AccountCreateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account create not acceptable response a status code equal to that given +func (o *AccountCreateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account create not acceptable response +func (o *AccountCreateNotAcceptable) Code() int { + return 406 +} + +func (o *AccountCreateNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateNotAcceptable", 406) +} + +func (o *AccountCreateNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateNotAcceptable", 406) +} + +func (o *AccountCreateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountCreateUnprocessableEntity creates a AccountCreateUnprocessableEntity with default headers values +func NewAccountCreateUnprocessableEntity() *AccountCreateUnprocessableEntity { + return &AccountCreateUnprocessableEntity{} +} + +/* +AccountCreateUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable. Your account creation request cannot be processed because either too many accounts have been created on this instance in the last 24h, or the pending account backlog is full. +*/ +type AccountCreateUnprocessableEntity struct { +} + +// IsSuccess returns true when this account create unprocessable entity response has a 2xx status code +func (o *AccountCreateUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account create unprocessable entity response has a 3xx status code +func (o *AccountCreateUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account create unprocessable entity response has a 4xx status code +func (o *AccountCreateUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this account create unprocessable entity response has a 5xx status code +func (o *AccountCreateUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this account create unprocessable entity response a status code equal to that given +func (o *AccountCreateUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the account create unprocessable entity response +func (o *AccountCreateUnprocessableEntity) Code() int { + return 422 +} + +func (o *AccountCreateUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateUnprocessableEntity", 422) +} + +func (o *AccountCreateUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateUnprocessableEntity", 422) +} + +func (o *AccountCreateUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountCreateInternalServerError creates a AccountCreateInternalServerError with default headers values +func NewAccountCreateInternalServerError() *AccountCreateInternalServerError { + return &AccountCreateInternalServerError{} +} + +/* +AccountCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountCreateInternalServerError struct { +} + +// IsSuccess returns true when this account create internal server error response has a 2xx status code +func (o *AccountCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account create internal server error response has a 3xx status code +func (o *AccountCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account create internal server error response has a 4xx status code +func (o *AccountCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account create internal server error response has a 5xx status code +func (o *AccountCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account create internal server error response a status code equal to that given +func (o *AccountCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account create internal server error response +func (o *AccountCreateInternalServerError) Code() int { + return 500 +} + +func (o *AccountCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateInternalServerError", 500) +} + +func (o *AccountCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateInternalServerError", 500) +} + +func (o *AccountCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_delete_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_delete_parameters.go new file mode 100644 index 0000000..0666fcb --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_delete_parameters.go @@ -0,0 +1,155 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountDeleteParams creates a new AccountDeleteParams 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 NewAccountDeleteParams() *AccountDeleteParams { + return &AccountDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountDeleteParamsWithTimeout creates a new AccountDeleteParams object +// with the ability to set a timeout on a request. +func NewAccountDeleteParamsWithTimeout(timeout time.Duration) *AccountDeleteParams { + return &AccountDeleteParams{ + timeout: timeout, + } +} + +// NewAccountDeleteParamsWithContext creates a new AccountDeleteParams object +// with the ability to set a context for a request. +func NewAccountDeleteParamsWithContext(ctx context.Context) *AccountDeleteParams { + return &AccountDeleteParams{ + Context: ctx, + } +} + +// NewAccountDeleteParamsWithHTTPClient creates a new AccountDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountDeleteParamsWithHTTPClient(client *http.Client) *AccountDeleteParams { + return &AccountDeleteParams{ + HTTPClient: client, + } +} + +/* +AccountDeleteParams contains all the parameters to send to the API endpoint + + for the account delete operation. + + Typically these are written to a http.Request. +*/ +type AccountDeleteParams struct { + + /* Password. + + Password of the account user, for confirmation. + */ + Password string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountDeleteParams) WithDefaults() *AccountDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account delete params +func (o *AccountDeleteParams) WithTimeout(timeout time.Duration) *AccountDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account delete params +func (o *AccountDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account delete params +func (o *AccountDeleteParams) WithContext(ctx context.Context) *AccountDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account delete params +func (o *AccountDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account delete params +func (o *AccountDeleteParams) WithHTTPClient(client *http.Client) *AccountDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account delete params +func (o *AccountDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithPassword adds the password to the account delete params +func (o *AccountDeleteParams) WithPassword(password string) *AccountDeleteParams { + o.SetPassword(password) + return o +} + +// SetPassword adds the password to the account delete params +func (o *AccountDeleteParams) SetPassword(password string) { + o.Password = password +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param password + frPassword := o.Password + fPassword := frPassword + if fPassword != "" { + if err := r.SetFormParam("password", fPassword); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_delete_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_delete_responses.go new file mode 100644 index 0000000..ae33a0c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_delete_responses.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// AccountDeleteReader is a Reader for the AccountDelete structure. +type AccountDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewAccountDeleteAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts/delete] accountDelete", response, response.Code()) + } +} + +// NewAccountDeleteAccepted creates a AccountDeleteAccepted with default headers values +func NewAccountDeleteAccepted() *AccountDeleteAccepted { + return &AccountDeleteAccepted{} +} + +/* +AccountDeleteAccepted describes a response with status code 202, with default header values. + +The account deletion has been accepted and the account will be deleted. +*/ +type AccountDeleteAccepted struct { +} + +// IsSuccess returns true when this account delete accepted response has a 2xx status code +func (o *AccountDeleteAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account delete accepted response has a 3xx status code +func (o *AccountDeleteAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account delete accepted response has a 4xx status code +func (o *AccountDeleteAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this account delete accepted response has a 5xx status code +func (o *AccountDeleteAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this account delete accepted response a status code equal to that given +func (o *AccountDeleteAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the account delete accepted response +func (o *AccountDeleteAccepted) Code() int { + return 202 +} + +func (o *AccountDeleteAccepted) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteAccepted", 202) +} + +func (o *AccountDeleteAccepted) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteAccepted", 202) +} + +func (o *AccountDeleteAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountDeleteBadRequest creates a AccountDeleteBadRequest with default headers values +func NewAccountDeleteBadRequest() *AccountDeleteBadRequest { + return &AccountDeleteBadRequest{} +} + +/* +AccountDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountDeleteBadRequest struct { +} + +// IsSuccess returns true when this account delete bad request response has a 2xx status code +func (o *AccountDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account delete bad request response has a 3xx status code +func (o *AccountDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account delete bad request response has a 4xx status code +func (o *AccountDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account delete bad request response has a 5xx status code +func (o *AccountDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account delete bad request response a status code equal to that given +func (o *AccountDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account delete bad request response +func (o *AccountDeleteBadRequest) Code() int { + return 400 +} + +func (o *AccountDeleteBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteBadRequest", 400) +} + +func (o *AccountDeleteBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteBadRequest", 400) +} + +func (o *AccountDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountDeleteUnauthorized creates a AccountDeleteUnauthorized with default headers values +func NewAccountDeleteUnauthorized() *AccountDeleteUnauthorized { + return &AccountDeleteUnauthorized{} +} + +/* +AccountDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountDeleteUnauthorized struct { +} + +// IsSuccess returns true when this account delete unauthorized response has a 2xx status code +func (o *AccountDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account delete unauthorized response has a 3xx status code +func (o *AccountDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account delete unauthorized response has a 4xx status code +func (o *AccountDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account delete unauthorized response has a 5xx status code +func (o *AccountDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account delete unauthorized response a status code equal to that given +func (o *AccountDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account delete unauthorized response +func (o *AccountDeleteUnauthorized) Code() int { + return 401 +} + +func (o *AccountDeleteUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteUnauthorized", 401) +} + +func (o *AccountDeleteUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteUnauthorized", 401) +} + +func (o *AccountDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountDeleteNotFound creates a AccountDeleteNotFound with default headers values +func NewAccountDeleteNotFound() *AccountDeleteNotFound { + return &AccountDeleteNotFound{} +} + +/* +AccountDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountDeleteNotFound struct { +} + +// IsSuccess returns true when this account delete not found response has a 2xx status code +func (o *AccountDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account delete not found response has a 3xx status code +func (o *AccountDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account delete not found response has a 4xx status code +func (o *AccountDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account delete not found response has a 5xx status code +func (o *AccountDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account delete not found response a status code equal to that given +func (o *AccountDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account delete not found response +func (o *AccountDeleteNotFound) Code() int { + return 404 +} + +func (o *AccountDeleteNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteNotFound", 404) +} + +func (o *AccountDeleteNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteNotFound", 404) +} + +func (o *AccountDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountDeleteNotAcceptable creates a AccountDeleteNotAcceptable with default headers values +func NewAccountDeleteNotAcceptable() *AccountDeleteNotAcceptable { + return &AccountDeleteNotAcceptable{} +} + +/* +AccountDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this account delete not acceptable response has a 2xx status code +func (o *AccountDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account delete not acceptable response has a 3xx status code +func (o *AccountDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account delete not acceptable response has a 4xx status code +func (o *AccountDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account delete not acceptable response has a 5xx status code +func (o *AccountDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account delete not acceptable response a status code equal to that given +func (o *AccountDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account delete not acceptable response +func (o *AccountDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *AccountDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteNotAcceptable", 406) +} + +func (o *AccountDeleteNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteNotAcceptable", 406) +} + +func (o *AccountDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountDeleteInternalServerError creates a AccountDeleteInternalServerError with default headers values +func NewAccountDeleteInternalServerError() *AccountDeleteInternalServerError { + return &AccountDeleteInternalServerError{} +} + +/* +AccountDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountDeleteInternalServerError struct { +} + +// IsSuccess returns true when this account delete internal server error response has a 2xx status code +func (o *AccountDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account delete internal server error response has a 3xx status code +func (o *AccountDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account delete internal server error response has a 4xx status code +func (o *AccountDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account delete internal server error response has a 5xx status code +func (o *AccountDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account delete internal server error response a status code equal to that given +func (o *AccountDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account delete internal server error response +func (o *AccountDeleteInternalServerError) Code() int { + return 500 +} + +func (o *AccountDeleteInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteInternalServerError", 500) +} + +func (o *AccountDeleteInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteInternalServerError", 500) +} + +func (o *AccountDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_follow_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_follow_parameters.go new file mode 100644 index 0000000..9919012 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_follow_parameters.go @@ -0,0 +1,232 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountFollowParams creates a new AccountFollowParams 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 NewAccountFollowParams() *AccountFollowParams { + return &AccountFollowParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountFollowParamsWithTimeout creates a new AccountFollowParams object +// with the ability to set a timeout on a request. +func NewAccountFollowParamsWithTimeout(timeout time.Duration) *AccountFollowParams { + return &AccountFollowParams{ + timeout: timeout, + } +} + +// NewAccountFollowParamsWithContext creates a new AccountFollowParams object +// with the ability to set a context for a request. +func NewAccountFollowParamsWithContext(ctx context.Context) *AccountFollowParams { + return &AccountFollowParams{ + Context: ctx, + } +} + +// NewAccountFollowParamsWithHTTPClient creates a new AccountFollowParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountFollowParamsWithHTTPClient(client *http.Client) *AccountFollowParams { + return &AccountFollowParams{ + HTTPClient: client, + } +} + +/* +AccountFollowParams contains all the parameters to send to the API endpoint + + for the account follow operation. + + Typically these are written to a http.Request. +*/ +type AccountFollowParams struct { + + /* ID. + + ID of the account to follow. + */ + ID string + + /* Notify. + + Notify when this account posts. + */ + Notify *bool + + /* Reblogs. + + Show reblogs from this account. + + Default: true + */ + Reblogs *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account follow params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountFollowParams) WithDefaults() *AccountFollowParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account follow params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountFollowParams) SetDefaults() { + var ( + notifyDefault = bool(false) + + reblogsDefault = bool(true) + ) + + val := AccountFollowParams{ + Notify: ¬ifyDefault, + Reblogs: &reblogsDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the account follow params +func (o *AccountFollowParams) WithTimeout(timeout time.Duration) *AccountFollowParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account follow params +func (o *AccountFollowParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account follow params +func (o *AccountFollowParams) WithContext(ctx context.Context) *AccountFollowParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account follow params +func (o *AccountFollowParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account follow params +func (o *AccountFollowParams) WithHTTPClient(client *http.Client) *AccountFollowParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account follow params +func (o *AccountFollowParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the account follow params +func (o *AccountFollowParams) WithID(id string) *AccountFollowParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account follow params +func (o *AccountFollowParams) SetID(id string) { + o.ID = id +} + +// WithNotify adds the notify to the account follow params +func (o *AccountFollowParams) WithNotify(notify *bool) *AccountFollowParams { + o.SetNotify(notify) + return o +} + +// SetNotify adds the notify to the account follow params +func (o *AccountFollowParams) SetNotify(notify *bool) { + o.Notify = notify +} + +// WithReblogs adds the reblogs to the account follow params +func (o *AccountFollowParams) WithReblogs(reblogs *bool) *AccountFollowParams { + o.SetReblogs(reblogs) + return o +} + +// SetReblogs adds the reblogs to the account follow params +func (o *AccountFollowParams) SetReblogs(reblogs *bool) { + o.Reblogs = reblogs +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountFollowParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Notify != nil { + + // form param notify + var frNotify bool + if o.Notify != nil { + frNotify = *o.Notify + } + fNotify := swag.FormatBool(frNotify) + if fNotify != "" { + if err := r.SetFormParam("notify", fNotify); err != nil { + return err + } + } + } + + if o.Reblogs != nil { + + // form param reblogs + var frReblogs bool + if o.Reblogs != nil { + frReblogs = *o.Reblogs + } + fReblogs := swag.FormatBool(frReblogs) + if fReblogs != "" { + if err := r.SetFormParam("reblogs", fReblogs); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_follow_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_follow_responses.go new file mode 100644 index 0000000..f25afd1 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_follow_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountFollowReader is a Reader for the AccountFollow structure. +type AccountFollowReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountFollowReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountFollowOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountFollowBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountFollowUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountFollowNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountFollowNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountFollowInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts/{id}/follow] accountFollow", response, response.Code()) + } +} + +// NewAccountFollowOK creates a AccountFollowOK with default headers values +func NewAccountFollowOK() *AccountFollowOK { + return &AccountFollowOK{} +} + +/* +AccountFollowOK describes a response with status code 200, with default header values. + +Your relationship to this account. +*/ +type AccountFollowOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this account follow o k response has a 2xx status code +func (o *AccountFollowOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account follow o k response has a 3xx status code +func (o *AccountFollowOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account follow o k response has a 4xx status code +func (o *AccountFollowOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account follow o k response has a 5xx status code +func (o *AccountFollowOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account follow o k response a status code equal to that given +func (o *AccountFollowOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account follow o k response +func (o *AccountFollowOK) Code() int { + return 200 +} + +func (o *AccountFollowOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowOK %s", 200, payload) +} + +func (o *AccountFollowOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowOK %s", 200, payload) +} + +func (o *AccountFollowOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *AccountFollowOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountFollowBadRequest creates a AccountFollowBadRequest with default headers values +func NewAccountFollowBadRequest() *AccountFollowBadRequest { + return &AccountFollowBadRequest{} +} + +/* +AccountFollowBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountFollowBadRequest struct { +} + +// IsSuccess returns true when this account follow bad request response has a 2xx status code +func (o *AccountFollowBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account follow bad request response has a 3xx status code +func (o *AccountFollowBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account follow bad request response has a 4xx status code +func (o *AccountFollowBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account follow bad request response has a 5xx status code +func (o *AccountFollowBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account follow bad request response a status code equal to that given +func (o *AccountFollowBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account follow bad request response +func (o *AccountFollowBadRequest) Code() int { + return 400 +} + +func (o *AccountFollowBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowBadRequest", 400) +} + +func (o *AccountFollowBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowBadRequest", 400) +} + +func (o *AccountFollowBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowUnauthorized creates a AccountFollowUnauthorized with default headers values +func NewAccountFollowUnauthorized() *AccountFollowUnauthorized { + return &AccountFollowUnauthorized{} +} + +/* +AccountFollowUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountFollowUnauthorized struct { +} + +// IsSuccess returns true when this account follow unauthorized response has a 2xx status code +func (o *AccountFollowUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account follow unauthorized response has a 3xx status code +func (o *AccountFollowUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account follow unauthorized response has a 4xx status code +func (o *AccountFollowUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account follow unauthorized response has a 5xx status code +func (o *AccountFollowUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account follow unauthorized response a status code equal to that given +func (o *AccountFollowUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account follow unauthorized response +func (o *AccountFollowUnauthorized) Code() int { + return 401 +} + +func (o *AccountFollowUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowUnauthorized", 401) +} + +func (o *AccountFollowUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowUnauthorized", 401) +} + +func (o *AccountFollowUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowNotFound creates a AccountFollowNotFound with default headers values +func NewAccountFollowNotFound() *AccountFollowNotFound { + return &AccountFollowNotFound{} +} + +/* +AccountFollowNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountFollowNotFound struct { +} + +// IsSuccess returns true when this account follow not found response has a 2xx status code +func (o *AccountFollowNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account follow not found response has a 3xx status code +func (o *AccountFollowNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account follow not found response has a 4xx status code +func (o *AccountFollowNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account follow not found response has a 5xx status code +func (o *AccountFollowNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account follow not found response a status code equal to that given +func (o *AccountFollowNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account follow not found response +func (o *AccountFollowNotFound) Code() int { + return 404 +} + +func (o *AccountFollowNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowNotFound", 404) +} + +func (o *AccountFollowNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowNotFound", 404) +} + +func (o *AccountFollowNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowNotAcceptable creates a AccountFollowNotAcceptable with default headers values +func NewAccountFollowNotAcceptable() *AccountFollowNotAcceptable { + return &AccountFollowNotAcceptable{} +} + +/* +AccountFollowNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountFollowNotAcceptable struct { +} + +// IsSuccess returns true when this account follow not acceptable response has a 2xx status code +func (o *AccountFollowNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account follow not acceptable response has a 3xx status code +func (o *AccountFollowNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account follow not acceptable response has a 4xx status code +func (o *AccountFollowNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account follow not acceptable response has a 5xx status code +func (o *AccountFollowNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account follow not acceptable response a status code equal to that given +func (o *AccountFollowNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account follow not acceptable response +func (o *AccountFollowNotAcceptable) Code() int { + return 406 +} + +func (o *AccountFollowNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowNotAcceptable", 406) +} + +func (o *AccountFollowNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowNotAcceptable", 406) +} + +func (o *AccountFollowNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowInternalServerError creates a AccountFollowInternalServerError with default headers values +func NewAccountFollowInternalServerError() *AccountFollowInternalServerError { + return &AccountFollowInternalServerError{} +} + +/* +AccountFollowInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountFollowInternalServerError struct { +} + +// IsSuccess returns true when this account follow internal server error response has a 2xx status code +func (o *AccountFollowInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account follow internal server error response has a 3xx status code +func (o *AccountFollowInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account follow internal server error response has a 4xx status code +func (o *AccountFollowInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account follow internal server error response has a 5xx status code +func (o *AccountFollowInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account follow internal server error response a status code equal to that given +func (o *AccountFollowInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account follow internal server error response +func (o *AccountFollowInternalServerError) Code() int { + return 500 +} + +func (o *AccountFollowInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowInternalServerError", 500) +} + +func (o *AccountFollowInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowInternalServerError", 500) +} + +func (o *AccountFollowInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_followers_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_followers_parameters.go new file mode 100644 index 0000000..73aee3c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_followers_parameters.go @@ -0,0 +1,301 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountFollowersParams creates a new AccountFollowersParams 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 NewAccountFollowersParams() *AccountFollowersParams { + return &AccountFollowersParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountFollowersParamsWithTimeout creates a new AccountFollowersParams object +// with the ability to set a timeout on a request. +func NewAccountFollowersParamsWithTimeout(timeout time.Duration) *AccountFollowersParams { + return &AccountFollowersParams{ + timeout: timeout, + } +} + +// NewAccountFollowersParamsWithContext creates a new AccountFollowersParams object +// with the ability to set a context for a request. +func NewAccountFollowersParamsWithContext(ctx context.Context) *AccountFollowersParams { + return &AccountFollowersParams{ + Context: ctx, + } +} + +// NewAccountFollowersParamsWithHTTPClient creates a new AccountFollowersParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountFollowersParamsWithHTTPClient(client *http.Client) *AccountFollowersParams { + return &AccountFollowersParams{ + HTTPClient: client, + } +} + +/* +AccountFollowersParams contains all the parameters to send to the API endpoint + + for the account followers operation. + + Typically these are written to a http.Request. +*/ +type AccountFollowersParams struct { + + /* ID. + + Account ID. + */ + ID string + + /* Limit. + + Number of follower accounts to return. + + Default: 40 + */ + Limit *int64 + + /* MaxID. + + Return only follower accounts *OLDER* than the given max ID. The follower account with the specified ID will not be included in the response. NOTE: the ID is of the internal follow, NOT any of the returned accounts. + */ + MaxID *string + + /* MinID. + + Return only follower accounts *IMMEDIATELY NEWER* than the given min ID. The follower account with the specified ID will not be included in the response. NOTE: the ID is of the internal follow, NOT any of the returned accounts. + */ + MinID *string + + /* SinceID. + + Return only follower accounts *NEWER* than the given since ID. The follower account with the specified ID will not be included in the response. NOTE: the ID is of the internal follow, NOT any of the returned accounts. + */ + SinceID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account followers params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountFollowersParams) WithDefaults() *AccountFollowersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account followers params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountFollowersParams) SetDefaults() { + var ( + limitDefault = int64(40) + ) + + val := AccountFollowersParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the account followers params +func (o *AccountFollowersParams) WithTimeout(timeout time.Duration) *AccountFollowersParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account followers params +func (o *AccountFollowersParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account followers params +func (o *AccountFollowersParams) WithContext(ctx context.Context) *AccountFollowersParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account followers params +func (o *AccountFollowersParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account followers params +func (o *AccountFollowersParams) WithHTTPClient(client *http.Client) *AccountFollowersParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account followers params +func (o *AccountFollowersParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the account followers params +func (o *AccountFollowersParams) WithID(id string) *AccountFollowersParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account followers params +func (o *AccountFollowersParams) SetID(id string) { + o.ID = id +} + +// WithLimit adds the limit to the account followers params +func (o *AccountFollowersParams) WithLimit(limit *int64) *AccountFollowersParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the account followers params +func (o *AccountFollowersParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the account followers params +func (o *AccountFollowersParams) WithMaxID(maxID *string) *AccountFollowersParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the account followers params +func (o *AccountFollowersParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the account followers params +func (o *AccountFollowersParams) WithMinID(minID *string) *AccountFollowersParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the account followers params +func (o *AccountFollowersParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the account followers params +func (o *AccountFollowersParams) WithSinceID(sinceID *string) *AccountFollowersParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the account followers params +func (o *AccountFollowersParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountFollowersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); 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.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if o.SinceID != nil { + + // query param since_id + var qrSinceID string + + if o.SinceID != nil { + qrSinceID = *o.SinceID + } + qSinceID := qrSinceID + if qSinceID != "" { + + if err := r.SetQueryParam("since_id", qSinceID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_followers_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_followers_responses.go new file mode 100644 index 0000000..dd9ea24 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_followers_responses.go @@ -0,0 +1,426 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountFollowersReader is a Reader for the AccountFollowers structure. +type AccountFollowersReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountFollowersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountFollowersOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountFollowersBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountFollowersUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountFollowersNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountFollowersNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountFollowersInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/accounts/{id}/followers] accountFollowers", response, response.Code()) + } +} + +// NewAccountFollowersOK creates a AccountFollowersOK with default headers values +func NewAccountFollowersOK() *AccountFollowersOK { + return &AccountFollowersOK{} +} + +/* +AccountFollowersOK describes a response with status code 200, with default header values. + +Array of accounts that follow this account. +*/ +type AccountFollowersOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Account +} + +// IsSuccess returns true when this account followers o k response has a 2xx status code +func (o *AccountFollowersOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account followers o k response has a 3xx status code +func (o *AccountFollowersOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account followers o k response has a 4xx status code +func (o *AccountFollowersOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account followers o k response has a 5xx status code +func (o *AccountFollowersOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account followers o k response a status code equal to that given +func (o *AccountFollowersOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account followers o k response +func (o *AccountFollowersOK) Code() int { + return 200 +} + +func (o *AccountFollowersOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersOK %s", 200, payload) +} + +func (o *AccountFollowersOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersOK %s", 200, payload) +} + +func (o *AccountFollowersOK) GetPayload() []*models.Account { + return o.Payload +} + +func (o *AccountFollowersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountFollowersBadRequest creates a AccountFollowersBadRequest with default headers values +func NewAccountFollowersBadRequest() *AccountFollowersBadRequest { + return &AccountFollowersBadRequest{} +} + +/* +AccountFollowersBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountFollowersBadRequest struct { +} + +// IsSuccess returns true when this account followers bad request response has a 2xx status code +func (o *AccountFollowersBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account followers bad request response has a 3xx status code +func (o *AccountFollowersBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account followers bad request response has a 4xx status code +func (o *AccountFollowersBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account followers bad request response has a 5xx status code +func (o *AccountFollowersBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account followers bad request response a status code equal to that given +func (o *AccountFollowersBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account followers bad request response +func (o *AccountFollowersBadRequest) Code() int { + return 400 +} + +func (o *AccountFollowersBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersBadRequest", 400) +} + +func (o *AccountFollowersBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersBadRequest", 400) +} + +func (o *AccountFollowersBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowersUnauthorized creates a AccountFollowersUnauthorized with default headers values +func NewAccountFollowersUnauthorized() *AccountFollowersUnauthorized { + return &AccountFollowersUnauthorized{} +} + +/* +AccountFollowersUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountFollowersUnauthorized struct { +} + +// IsSuccess returns true when this account followers unauthorized response has a 2xx status code +func (o *AccountFollowersUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account followers unauthorized response has a 3xx status code +func (o *AccountFollowersUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account followers unauthorized response has a 4xx status code +func (o *AccountFollowersUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account followers unauthorized response has a 5xx status code +func (o *AccountFollowersUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account followers unauthorized response a status code equal to that given +func (o *AccountFollowersUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account followers unauthorized response +func (o *AccountFollowersUnauthorized) Code() int { + return 401 +} + +func (o *AccountFollowersUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersUnauthorized", 401) +} + +func (o *AccountFollowersUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersUnauthorized", 401) +} + +func (o *AccountFollowersUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowersNotFound creates a AccountFollowersNotFound with default headers values +func NewAccountFollowersNotFound() *AccountFollowersNotFound { + return &AccountFollowersNotFound{} +} + +/* +AccountFollowersNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountFollowersNotFound struct { +} + +// IsSuccess returns true when this account followers not found response has a 2xx status code +func (o *AccountFollowersNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account followers not found response has a 3xx status code +func (o *AccountFollowersNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account followers not found response has a 4xx status code +func (o *AccountFollowersNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account followers not found response has a 5xx status code +func (o *AccountFollowersNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account followers not found response a status code equal to that given +func (o *AccountFollowersNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account followers not found response +func (o *AccountFollowersNotFound) Code() int { + return 404 +} + +func (o *AccountFollowersNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersNotFound", 404) +} + +func (o *AccountFollowersNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersNotFound", 404) +} + +func (o *AccountFollowersNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowersNotAcceptable creates a AccountFollowersNotAcceptable with default headers values +func NewAccountFollowersNotAcceptable() *AccountFollowersNotAcceptable { + return &AccountFollowersNotAcceptable{} +} + +/* +AccountFollowersNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountFollowersNotAcceptable struct { +} + +// IsSuccess returns true when this account followers not acceptable response has a 2xx status code +func (o *AccountFollowersNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account followers not acceptable response has a 3xx status code +func (o *AccountFollowersNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account followers not acceptable response has a 4xx status code +func (o *AccountFollowersNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account followers not acceptable response has a 5xx status code +func (o *AccountFollowersNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account followers not acceptable response a status code equal to that given +func (o *AccountFollowersNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account followers not acceptable response +func (o *AccountFollowersNotAcceptable) Code() int { + return 406 +} + +func (o *AccountFollowersNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersNotAcceptable", 406) +} + +func (o *AccountFollowersNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersNotAcceptable", 406) +} + +func (o *AccountFollowersNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowersInternalServerError creates a AccountFollowersInternalServerError with default headers values +func NewAccountFollowersInternalServerError() *AccountFollowersInternalServerError { + return &AccountFollowersInternalServerError{} +} + +/* +AccountFollowersInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountFollowersInternalServerError struct { +} + +// IsSuccess returns true when this account followers internal server error response has a 2xx status code +func (o *AccountFollowersInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account followers internal server error response has a 3xx status code +func (o *AccountFollowersInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account followers internal server error response has a 4xx status code +func (o *AccountFollowersInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account followers internal server error response has a 5xx status code +func (o *AccountFollowersInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account followers internal server error response a status code equal to that given +func (o *AccountFollowersInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account followers internal server error response +func (o *AccountFollowersInternalServerError) Code() int { + return 500 +} + +func (o *AccountFollowersInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersInternalServerError", 500) +} + +func (o *AccountFollowersInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersInternalServerError", 500) +} + +func (o *AccountFollowersInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_following_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_following_parameters.go new file mode 100644 index 0000000..03471eb --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_following_parameters.go @@ -0,0 +1,301 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountFollowingParams creates a new AccountFollowingParams 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 NewAccountFollowingParams() *AccountFollowingParams { + return &AccountFollowingParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountFollowingParamsWithTimeout creates a new AccountFollowingParams object +// with the ability to set a timeout on a request. +func NewAccountFollowingParamsWithTimeout(timeout time.Duration) *AccountFollowingParams { + return &AccountFollowingParams{ + timeout: timeout, + } +} + +// NewAccountFollowingParamsWithContext creates a new AccountFollowingParams object +// with the ability to set a context for a request. +func NewAccountFollowingParamsWithContext(ctx context.Context) *AccountFollowingParams { + return &AccountFollowingParams{ + Context: ctx, + } +} + +// NewAccountFollowingParamsWithHTTPClient creates a new AccountFollowingParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountFollowingParamsWithHTTPClient(client *http.Client) *AccountFollowingParams { + return &AccountFollowingParams{ + HTTPClient: client, + } +} + +/* +AccountFollowingParams contains all the parameters to send to the API endpoint + + for the account following operation. + + Typically these are written to a http.Request. +*/ +type AccountFollowingParams struct { + + /* ID. + + Account ID. + */ + ID string + + /* Limit. + + Number of following accounts to return. + + Default: 40 + */ + Limit *int64 + + /* MaxID. + + Return only following accounts *OLDER* than the given max ID. The following account with the specified ID will not be included in the response. NOTE: the ID is of the internal follow, NOT any of the returned accounts. + */ + MaxID *string + + /* MinID. + + Return only following accounts *IMMEDIATELY NEWER* than the given min ID. The following account with the specified ID will not be included in the response. NOTE: the ID is of the internal follow, NOT any of the returned accounts. + */ + MinID *string + + /* SinceID. + + Return only following accounts *NEWER* than the given since ID. The following account with the specified ID will not be included in the response. NOTE: the ID is of the internal follow, NOT any of the returned accounts. + */ + SinceID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account following params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountFollowingParams) WithDefaults() *AccountFollowingParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account following params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountFollowingParams) SetDefaults() { + var ( + limitDefault = int64(40) + ) + + val := AccountFollowingParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the account following params +func (o *AccountFollowingParams) WithTimeout(timeout time.Duration) *AccountFollowingParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account following params +func (o *AccountFollowingParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account following params +func (o *AccountFollowingParams) WithContext(ctx context.Context) *AccountFollowingParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account following params +func (o *AccountFollowingParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account following params +func (o *AccountFollowingParams) WithHTTPClient(client *http.Client) *AccountFollowingParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account following params +func (o *AccountFollowingParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the account following params +func (o *AccountFollowingParams) WithID(id string) *AccountFollowingParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account following params +func (o *AccountFollowingParams) SetID(id string) { + o.ID = id +} + +// WithLimit adds the limit to the account following params +func (o *AccountFollowingParams) WithLimit(limit *int64) *AccountFollowingParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the account following params +func (o *AccountFollowingParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the account following params +func (o *AccountFollowingParams) WithMaxID(maxID *string) *AccountFollowingParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the account following params +func (o *AccountFollowingParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the account following params +func (o *AccountFollowingParams) WithMinID(minID *string) *AccountFollowingParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the account following params +func (o *AccountFollowingParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the account following params +func (o *AccountFollowingParams) WithSinceID(sinceID *string) *AccountFollowingParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the account following params +func (o *AccountFollowingParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountFollowingParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); 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.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if o.SinceID != nil { + + // query param since_id + var qrSinceID string + + if o.SinceID != nil { + qrSinceID = *o.SinceID + } + qSinceID := qrSinceID + if qSinceID != "" { + + if err := r.SetQueryParam("since_id", qSinceID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_following_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_following_responses.go new file mode 100644 index 0000000..3e0c985 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_following_responses.go @@ -0,0 +1,426 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountFollowingReader is a Reader for the AccountFollowing structure. +type AccountFollowingReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountFollowingReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountFollowingOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountFollowingBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountFollowingUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountFollowingNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountFollowingNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountFollowingInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/accounts/{id}/following] accountFollowing", response, response.Code()) + } +} + +// NewAccountFollowingOK creates a AccountFollowingOK with default headers values +func NewAccountFollowingOK() *AccountFollowingOK { + return &AccountFollowingOK{} +} + +/* +AccountFollowingOK describes a response with status code 200, with default header values. + +Array of accounts that are followed by this account. +*/ +type AccountFollowingOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Account +} + +// IsSuccess returns true when this account following o k response has a 2xx status code +func (o *AccountFollowingOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account following o k response has a 3xx status code +func (o *AccountFollowingOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account following o k response has a 4xx status code +func (o *AccountFollowingOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account following o k response has a 5xx status code +func (o *AccountFollowingOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account following o k response a status code equal to that given +func (o *AccountFollowingOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account following o k response +func (o *AccountFollowingOK) Code() int { + return 200 +} + +func (o *AccountFollowingOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingOK %s", 200, payload) +} + +func (o *AccountFollowingOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingOK %s", 200, payload) +} + +func (o *AccountFollowingOK) GetPayload() []*models.Account { + return o.Payload +} + +func (o *AccountFollowingOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountFollowingBadRequest creates a AccountFollowingBadRequest with default headers values +func NewAccountFollowingBadRequest() *AccountFollowingBadRequest { + return &AccountFollowingBadRequest{} +} + +/* +AccountFollowingBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountFollowingBadRequest struct { +} + +// IsSuccess returns true when this account following bad request response has a 2xx status code +func (o *AccountFollowingBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account following bad request response has a 3xx status code +func (o *AccountFollowingBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account following bad request response has a 4xx status code +func (o *AccountFollowingBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account following bad request response has a 5xx status code +func (o *AccountFollowingBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account following bad request response a status code equal to that given +func (o *AccountFollowingBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account following bad request response +func (o *AccountFollowingBadRequest) Code() int { + return 400 +} + +func (o *AccountFollowingBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingBadRequest", 400) +} + +func (o *AccountFollowingBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingBadRequest", 400) +} + +func (o *AccountFollowingBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowingUnauthorized creates a AccountFollowingUnauthorized with default headers values +func NewAccountFollowingUnauthorized() *AccountFollowingUnauthorized { + return &AccountFollowingUnauthorized{} +} + +/* +AccountFollowingUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountFollowingUnauthorized struct { +} + +// IsSuccess returns true when this account following unauthorized response has a 2xx status code +func (o *AccountFollowingUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account following unauthorized response has a 3xx status code +func (o *AccountFollowingUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account following unauthorized response has a 4xx status code +func (o *AccountFollowingUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account following unauthorized response has a 5xx status code +func (o *AccountFollowingUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account following unauthorized response a status code equal to that given +func (o *AccountFollowingUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account following unauthorized response +func (o *AccountFollowingUnauthorized) Code() int { + return 401 +} + +func (o *AccountFollowingUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingUnauthorized", 401) +} + +func (o *AccountFollowingUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingUnauthorized", 401) +} + +func (o *AccountFollowingUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowingNotFound creates a AccountFollowingNotFound with default headers values +func NewAccountFollowingNotFound() *AccountFollowingNotFound { + return &AccountFollowingNotFound{} +} + +/* +AccountFollowingNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountFollowingNotFound struct { +} + +// IsSuccess returns true when this account following not found response has a 2xx status code +func (o *AccountFollowingNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account following not found response has a 3xx status code +func (o *AccountFollowingNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account following not found response has a 4xx status code +func (o *AccountFollowingNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account following not found response has a 5xx status code +func (o *AccountFollowingNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account following not found response a status code equal to that given +func (o *AccountFollowingNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account following not found response +func (o *AccountFollowingNotFound) Code() int { + return 404 +} + +func (o *AccountFollowingNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingNotFound", 404) +} + +func (o *AccountFollowingNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingNotFound", 404) +} + +func (o *AccountFollowingNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowingNotAcceptable creates a AccountFollowingNotAcceptable with default headers values +func NewAccountFollowingNotAcceptable() *AccountFollowingNotAcceptable { + return &AccountFollowingNotAcceptable{} +} + +/* +AccountFollowingNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountFollowingNotAcceptable struct { +} + +// IsSuccess returns true when this account following not acceptable response has a 2xx status code +func (o *AccountFollowingNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account following not acceptable response has a 3xx status code +func (o *AccountFollowingNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account following not acceptable response has a 4xx status code +func (o *AccountFollowingNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account following not acceptable response has a 5xx status code +func (o *AccountFollowingNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account following not acceptable response a status code equal to that given +func (o *AccountFollowingNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account following not acceptable response +func (o *AccountFollowingNotAcceptable) Code() int { + return 406 +} + +func (o *AccountFollowingNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingNotAcceptable", 406) +} + +func (o *AccountFollowingNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingNotAcceptable", 406) +} + +func (o *AccountFollowingNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowingInternalServerError creates a AccountFollowingInternalServerError with default headers values +func NewAccountFollowingInternalServerError() *AccountFollowingInternalServerError { + return &AccountFollowingInternalServerError{} +} + +/* +AccountFollowingInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountFollowingInternalServerError struct { +} + +// IsSuccess returns true when this account following internal server error response has a 2xx status code +func (o *AccountFollowingInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account following internal server error response has a 3xx status code +func (o *AccountFollowingInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account following internal server error response has a 4xx status code +func (o *AccountFollowingInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account following internal server error response has a 5xx status code +func (o *AccountFollowingInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account following internal server error response a status code equal to that given +func (o *AccountFollowingInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account following internal server error response +func (o *AccountFollowingInternalServerError) Code() int { + return 500 +} + +func (o *AccountFollowingInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingInternalServerError", 500) +} + +func (o *AccountFollowingInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingInternalServerError", 500) +} + +func (o *AccountFollowingInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_get_parameters.go new file mode 100644 index 0000000..21d7921 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountGetParams creates a new AccountGetParams 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 NewAccountGetParams() *AccountGetParams { + return &AccountGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountGetParamsWithTimeout creates a new AccountGetParams object +// with the ability to set a timeout on a request. +func NewAccountGetParamsWithTimeout(timeout time.Duration) *AccountGetParams { + return &AccountGetParams{ + timeout: timeout, + } +} + +// NewAccountGetParamsWithContext creates a new AccountGetParams object +// with the ability to set a context for a request. +func NewAccountGetParamsWithContext(ctx context.Context) *AccountGetParams { + return &AccountGetParams{ + Context: ctx, + } +} + +// NewAccountGetParamsWithHTTPClient creates a new AccountGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountGetParamsWithHTTPClient(client *http.Client) *AccountGetParams { + return &AccountGetParams{ + HTTPClient: client, + } +} + +/* +AccountGetParams contains all the parameters to send to the API endpoint + + for the account get operation. + + Typically these are written to a http.Request. +*/ +type AccountGetParams struct { + + /* ID. + + The id of the requested account. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountGetParams) WithDefaults() *AccountGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account get params +func (o *AccountGetParams) WithTimeout(timeout time.Duration) *AccountGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account get params +func (o *AccountGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account get params +func (o *AccountGetParams) WithContext(ctx context.Context) *AccountGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account get params +func (o *AccountGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account get params +func (o *AccountGetParams) WithHTTPClient(client *http.Client) *AccountGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account get params +func (o *AccountGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the account get params +func (o *AccountGetParams) WithID(id string) *AccountGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account get params +func (o *AccountGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_get_responses.go new file mode 100644 index 0000000..4507041 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_get_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountGetReader is a Reader for the AccountGet structure. +type AccountGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/accounts/{id}] accountGet", response, response.Code()) + } +} + +// NewAccountGetOK creates a AccountGetOK with default headers values +func NewAccountGetOK() *AccountGetOK { + return &AccountGetOK{} +} + +/* +AccountGetOK describes a response with status code 200, with default header values. + +The requested account. +*/ +type AccountGetOK struct { + Payload *models.Account +} + +// IsSuccess returns true when this account get o k response has a 2xx status code +func (o *AccountGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account get o k response has a 3xx status code +func (o *AccountGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account get o k response has a 4xx status code +func (o *AccountGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account get o k response has a 5xx status code +func (o *AccountGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account get o k response a status code equal to that given +func (o *AccountGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account get o k response +func (o *AccountGetOK) Code() int { + return 200 +} + +func (o *AccountGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetOK %s", 200, payload) +} + +func (o *AccountGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetOK %s", 200, payload) +} + +func (o *AccountGetOK) GetPayload() *models.Account { + return o.Payload +} + +func (o *AccountGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Account) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountGetBadRequest creates a AccountGetBadRequest with default headers values +func NewAccountGetBadRequest() *AccountGetBadRequest { + return &AccountGetBadRequest{} +} + +/* +AccountGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountGetBadRequest struct { +} + +// IsSuccess returns true when this account get bad request response has a 2xx status code +func (o *AccountGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account get bad request response has a 3xx status code +func (o *AccountGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account get bad request response has a 4xx status code +func (o *AccountGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account get bad request response has a 5xx status code +func (o *AccountGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account get bad request response a status code equal to that given +func (o *AccountGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account get bad request response +func (o *AccountGetBadRequest) Code() int { + return 400 +} + +func (o *AccountGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetBadRequest", 400) +} + +func (o *AccountGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetBadRequest", 400) +} + +func (o *AccountGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountGetUnauthorized creates a AccountGetUnauthorized with default headers values +func NewAccountGetUnauthorized() *AccountGetUnauthorized { + return &AccountGetUnauthorized{} +} + +/* +AccountGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountGetUnauthorized struct { +} + +// IsSuccess returns true when this account get unauthorized response has a 2xx status code +func (o *AccountGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account get unauthorized response has a 3xx status code +func (o *AccountGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account get unauthorized response has a 4xx status code +func (o *AccountGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account get unauthorized response has a 5xx status code +func (o *AccountGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account get unauthorized response a status code equal to that given +func (o *AccountGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account get unauthorized response +func (o *AccountGetUnauthorized) Code() int { + return 401 +} + +func (o *AccountGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetUnauthorized", 401) +} + +func (o *AccountGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetUnauthorized", 401) +} + +func (o *AccountGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountGetNotFound creates a AccountGetNotFound with default headers values +func NewAccountGetNotFound() *AccountGetNotFound { + return &AccountGetNotFound{} +} + +/* +AccountGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountGetNotFound struct { +} + +// IsSuccess returns true when this account get not found response has a 2xx status code +func (o *AccountGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account get not found response has a 3xx status code +func (o *AccountGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account get not found response has a 4xx status code +func (o *AccountGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account get not found response has a 5xx status code +func (o *AccountGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account get not found response a status code equal to that given +func (o *AccountGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account get not found response +func (o *AccountGetNotFound) Code() int { + return 404 +} + +func (o *AccountGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetNotFound", 404) +} + +func (o *AccountGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetNotFound", 404) +} + +func (o *AccountGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountGetNotAcceptable creates a AccountGetNotAcceptable with default headers values +func NewAccountGetNotAcceptable() *AccountGetNotAcceptable { + return &AccountGetNotAcceptable{} +} + +/* +AccountGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountGetNotAcceptable struct { +} + +// IsSuccess returns true when this account get not acceptable response has a 2xx status code +func (o *AccountGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account get not acceptable response has a 3xx status code +func (o *AccountGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account get not acceptable response has a 4xx status code +func (o *AccountGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account get not acceptable response has a 5xx status code +func (o *AccountGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account get not acceptable response a status code equal to that given +func (o *AccountGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account get not acceptable response +func (o *AccountGetNotAcceptable) Code() int { + return 406 +} + +func (o *AccountGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetNotAcceptable", 406) +} + +func (o *AccountGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetNotAcceptable", 406) +} + +func (o *AccountGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountGetInternalServerError creates a AccountGetInternalServerError with default headers values +func NewAccountGetInternalServerError() *AccountGetInternalServerError { + return &AccountGetInternalServerError{} +} + +/* +AccountGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountGetInternalServerError struct { +} + +// IsSuccess returns true when this account get internal server error response has a 2xx status code +func (o *AccountGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account get internal server error response has a 3xx status code +func (o *AccountGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account get internal server error response has a 4xx status code +func (o *AccountGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account get internal server error response has a 5xx status code +func (o *AccountGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account get internal server error response a status code equal to that given +func (o *AccountGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account get internal server error response +func (o *AccountGetInternalServerError) Code() int { + return 500 +} + +func (o *AccountGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetInternalServerError", 500) +} + +func (o *AccountGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetInternalServerError", 500) +} + +func (o *AccountGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_header_delete_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_header_delete_parameters.go new file mode 100644 index 0000000..e0b6a28 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_header_delete_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountHeaderDeleteParams creates a new AccountHeaderDeleteParams 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 NewAccountHeaderDeleteParams() *AccountHeaderDeleteParams { + return &AccountHeaderDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountHeaderDeleteParamsWithTimeout creates a new AccountHeaderDeleteParams object +// with the ability to set a timeout on a request. +func NewAccountHeaderDeleteParamsWithTimeout(timeout time.Duration) *AccountHeaderDeleteParams { + return &AccountHeaderDeleteParams{ + timeout: timeout, + } +} + +// NewAccountHeaderDeleteParamsWithContext creates a new AccountHeaderDeleteParams object +// with the ability to set a context for a request. +func NewAccountHeaderDeleteParamsWithContext(ctx context.Context) *AccountHeaderDeleteParams { + return &AccountHeaderDeleteParams{ + Context: ctx, + } +} + +// NewAccountHeaderDeleteParamsWithHTTPClient creates a new AccountHeaderDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountHeaderDeleteParamsWithHTTPClient(client *http.Client) *AccountHeaderDeleteParams { + return &AccountHeaderDeleteParams{ + HTTPClient: client, + } +} + +/* +AccountHeaderDeleteParams contains all the parameters to send to the API endpoint + + for the account header delete operation. + + Typically these are written to a http.Request. +*/ +type AccountHeaderDeleteParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account header delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountHeaderDeleteParams) WithDefaults() *AccountHeaderDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account header delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountHeaderDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account header delete params +func (o *AccountHeaderDeleteParams) WithTimeout(timeout time.Duration) *AccountHeaderDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account header delete params +func (o *AccountHeaderDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account header delete params +func (o *AccountHeaderDeleteParams) WithContext(ctx context.Context) *AccountHeaderDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account header delete params +func (o *AccountHeaderDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account header delete params +func (o *AccountHeaderDeleteParams) WithHTTPClient(client *http.Client) *AccountHeaderDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account header delete params +func (o *AccountHeaderDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountHeaderDeleteParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_header_delete_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_header_delete_responses.go new file mode 100644 index 0000000..4bfe10a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_header_delete_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountHeaderDeleteReader is a Reader for the AccountHeaderDelete structure. +type AccountHeaderDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountHeaderDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountHeaderDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountHeaderDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountHeaderDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewAccountHeaderDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountHeaderDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountHeaderDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/profile/header] accountHeaderDelete", response, response.Code()) + } +} + +// NewAccountHeaderDeleteOK creates a AccountHeaderDeleteOK with default headers values +func NewAccountHeaderDeleteOK() *AccountHeaderDeleteOK { + return &AccountHeaderDeleteOK{} +} + +/* +AccountHeaderDeleteOK describes a response with status code 200, with default header values. + +The updated account, including profile source information. +*/ +type AccountHeaderDeleteOK struct { + Payload *models.Account +} + +// IsSuccess returns true when this account header delete o k response has a 2xx status code +func (o *AccountHeaderDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account header delete o k response has a 3xx status code +func (o *AccountHeaderDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account header delete o k response has a 4xx status code +func (o *AccountHeaderDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account header delete o k response has a 5xx status code +func (o *AccountHeaderDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account header delete o k response a status code equal to that given +func (o *AccountHeaderDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account header delete o k response +func (o *AccountHeaderDeleteOK) Code() int { + return 200 +} + +func (o *AccountHeaderDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteOK %s", 200, payload) +} + +func (o *AccountHeaderDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteOK %s", 200, payload) +} + +func (o *AccountHeaderDeleteOK) GetPayload() *models.Account { + return o.Payload +} + +func (o *AccountHeaderDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Account) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountHeaderDeleteBadRequest creates a AccountHeaderDeleteBadRequest with default headers values +func NewAccountHeaderDeleteBadRequest() *AccountHeaderDeleteBadRequest { + return &AccountHeaderDeleteBadRequest{} +} + +/* +AccountHeaderDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountHeaderDeleteBadRequest struct { +} + +// IsSuccess returns true when this account header delete bad request response has a 2xx status code +func (o *AccountHeaderDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account header delete bad request response has a 3xx status code +func (o *AccountHeaderDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account header delete bad request response has a 4xx status code +func (o *AccountHeaderDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account header delete bad request response has a 5xx status code +func (o *AccountHeaderDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account header delete bad request response a status code equal to that given +func (o *AccountHeaderDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account header delete bad request response +func (o *AccountHeaderDeleteBadRequest) Code() int { + return 400 +} + +func (o *AccountHeaderDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteBadRequest", 400) +} + +func (o *AccountHeaderDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteBadRequest", 400) +} + +func (o *AccountHeaderDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountHeaderDeleteUnauthorized creates a AccountHeaderDeleteUnauthorized with default headers values +func NewAccountHeaderDeleteUnauthorized() *AccountHeaderDeleteUnauthorized { + return &AccountHeaderDeleteUnauthorized{} +} + +/* +AccountHeaderDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountHeaderDeleteUnauthorized struct { +} + +// IsSuccess returns true when this account header delete unauthorized response has a 2xx status code +func (o *AccountHeaderDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account header delete unauthorized response has a 3xx status code +func (o *AccountHeaderDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account header delete unauthorized response has a 4xx status code +func (o *AccountHeaderDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account header delete unauthorized response has a 5xx status code +func (o *AccountHeaderDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account header delete unauthorized response a status code equal to that given +func (o *AccountHeaderDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account header delete unauthorized response +func (o *AccountHeaderDeleteUnauthorized) Code() int { + return 401 +} + +func (o *AccountHeaderDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteUnauthorized", 401) +} + +func (o *AccountHeaderDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteUnauthorized", 401) +} + +func (o *AccountHeaderDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountHeaderDeleteForbidden creates a AccountHeaderDeleteForbidden with default headers values +func NewAccountHeaderDeleteForbidden() *AccountHeaderDeleteForbidden { + return &AccountHeaderDeleteForbidden{} +} + +/* +AccountHeaderDeleteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type AccountHeaderDeleteForbidden struct { +} + +// IsSuccess returns true when this account header delete forbidden response has a 2xx status code +func (o *AccountHeaderDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account header delete forbidden response has a 3xx status code +func (o *AccountHeaderDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account header delete forbidden response has a 4xx status code +func (o *AccountHeaderDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this account header delete forbidden response has a 5xx status code +func (o *AccountHeaderDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this account header delete forbidden response a status code equal to that given +func (o *AccountHeaderDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the account header delete forbidden response +func (o *AccountHeaderDeleteForbidden) Code() int { + return 403 +} + +func (o *AccountHeaderDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteForbidden", 403) +} + +func (o *AccountHeaderDeleteForbidden) String() string { + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteForbidden", 403) +} + +func (o *AccountHeaderDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountHeaderDeleteNotAcceptable creates a AccountHeaderDeleteNotAcceptable with default headers values +func NewAccountHeaderDeleteNotAcceptable() *AccountHeaderDeleteNotAcceptable { + return &AccountHeaderDeleteNotAcceptable{} +} + +/* +AccountHeaderDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountHeaderDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this account header delete not acceptable response has a 2xx status code +func (o *AccountHeaderDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account header delete not acceptable response has a 3xx status code +func (o *AccountHeaderDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account header delete not acceptable response has a 4xx status code +func (o *AccountHeaderDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account header delete not acceptable response has a 5xx status code +func (o *AccountHeaderDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account header delete not acceptable response a status code equal to that given +func (o *AccountHeaderDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account header delete not acceptable response +func (o *AccountHeaderDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *AccountHeaderDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteNotAcceptable", 406) +} + +func (o *AccountHeaderDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteNotAcceptable", 406) +} + +func (o *AccountHeaderDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountHeaderDeleteInternalServerError creates a AccountHeaderDeleteInternalServerError with default headers values +func NewAccountHeaderDeleteInternalServerError() *AccountHeaderDeleteInternalServerError { + return &AccountHeaderDeleteInternalServerError{} +} + +/* +AccountHeaderDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountHeaderDeleteInternalServerError struct { +} + +// IsSuccess returns true when this account header delete internal server error response has a 2xx status code +func (o *AccountHeaderDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account header delete internal server error response has a 3xx status code +func (o *AccountHeaderDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account header delete internal server error response has a 4xx status code +func (o *AccountHeaderDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account header delete internal server error response has a 5xx status code +func (o *AccountHeaderDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account header delete internal server error response a status code equal to that given +func (o *AccountHeaderDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account header delete internal server error response +func (o *AccountHeaderDeleteInternalServerError) Code() int { + return 500 +} + +func (o *AccountHeaderDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteInternalServerError", 500) +} + +func (o *AccountHeaderDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteInternalServerError", 500) +} + +func (o *AccountHeaderDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_lists_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_lists_parameters.go new file mode 100644 index 0000000..f2baab2 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_lists_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountListsParams creates a new AccountListsParams 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 NewAccountListsParams() *AccountListsParams { + return &AccountListsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountListsParamsWithTimeout creates a new AccountListsParams object +// with the ability to set a timeout on a request. +func NewAccountListsParamsWithTimeout(timeout time.Duration) *AccountListsParams { + return &AccountListsParams{ + timeout: timeout, + } +} + +// NewAccountListsParamsWithContext creates a new AccountListsParams object +// with the ability to set a context for a request. +func NewAccountListsParamsWithContext(ctx context.Context) *AccountListsParams { + return &AccountListsParams{ + Context: ctx, + } +} + +// NewAccountListsParamsWithHTTPClient creates a new AccountListsParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountListsParamsWithHTTPClient(client *http.Client) *AccountListsParams { + return &AccountListsParams{ + HTTPClient: client, + } +} + +/* +AccountListsParams contains all the parameters to send to the API endpoint + + for the account lists operation. + + Typically these are written to a http.Request. +*/ +type AccountListsParams struct { + + /* ID. + + Account ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account lists params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountListsParams) WithDefaults() *AccountListsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account lists params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountListsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account lists params +func (o *AccountListsParams) WithTimeout(timeout time.Duration) *AccountListsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account lists params +func (o *AccountListsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account lists params +func (o *AccountListsParams) WithContext(ctx context.Context) *AccountListsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account lists params +func (o *AccountListsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account lists params +func (o *AccountListsParams) WithHTTPClient(client *http.Client) *AccountListsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account lists params +func (o *AccountListsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the account lists params +func (o *AccountListsParams) WithID(id string) *AccountListsParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account lists params +func (o *AccountListsParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountListsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_lists_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_lists_responses.go new file mode 100644 index 0000000..06f2da8 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_lists_responses.go @@ -0,0 +1,414 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountListsReader is a Reader for the AccountLists structure. +type AccountListsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountListsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountListsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountListsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountListsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountListsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountListsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountListsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/accounts/{id}/lists] accountLists", response, response.Code()) + } +} + +// NewAccountListsOK creates a AccountListsOK with default headers values +func NewAccountListsOK() *AccountListsOK { + return &AccountListsOK{} +} + +/* +AccountListsOK describes a response with status code 200, with default header values. + +Array of all lists containing this account. +*/ +type AccountListsOK struct { + Payload []*models.List +} + +// IsSuccess returns true when this account lists o k response has a 2xx status code +func (o *AccountListsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account lists o k response has a 3xx status code +func (o *AccountListsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lists o k response has a 4xx status code +func (o *AccountListsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account lists o k response has a 5xx status code +func (o *AccountListsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account lists o k response a status code equal to that given +func (o *AccountListsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account lists o k response +func (o *AccountListsOK) Code() int { + return 200 +} + +func (o *AccountListsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsOK %s", 200, payload) +} + +func (o *AccountListsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsOK %s", 200, payload) +} + +func (o *AccountListsOK) GetPayload() []*models.List { + return o.Payload +} + +func (o *AccountListsOK) 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 +} + +// NewAccountListsBadRequest creates a AccountListsBadRequest with default headers values +func NewAccountListsBadRequest() *AccountListsBadRequest { + return &AccountListsBadRequest{} +} + +/* +AccountListsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountListsBadRequest struct { +} + +// IsSuccess returns true when this account lists bad request response has a 2xx status code +func (o *AccountListsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account lists bad request response has a 3xx status code +func (o *AccountListsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lists bad request response has a 4xx status code +func (o *AccountListsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account lists bad request response has a 5xx status code +func (o *AccountListsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account lists bad request response a status code equal to that given +func (o *AccountListsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account lists bad request response +func (o *AccountListsBadRequest) Code() int { + return 400 +} + +func (o *AccountListsBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsBadRequest", 400) +} + +func (o *AccountListsBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsBadRequest", 400) +} + +func (o *AccountListsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountListsUnauthorized creates a AccountListsUnauthorized with default headers values +func NewAccountListsUnauthorized() *AccountListsUnauthorized { + return &AccountListsUnauthorized{} +} + +/* +AccountListsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountListsUnauthorized struct { +} + +// IsSuccess returns true when this account lists unauthorized response has a 2xx status code +func (o *AccountListsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account lists unauthorized response has a 3xx status code +func (o *AccountListsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lists unauthorized response has a 4xx status code +func (o *AccountListsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account lists unauthorized response has a 5xx status code +func (o *AccountListsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account lists unauthorized response a status code equal to that given +func (o *AccountListsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account lists unauthorized response +func (o *AccountListsUnauthorized) Code() int { + return 401 +} + +func (o *AccountListsUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsUnauthorized", 401) +} + +func (o *AccountListsUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsUnauthorized", 401) +} + +func (o *AccountListsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountListsNotFound creates a AccountListsNotFound with default headers values +func NewAccountListsNotFound() *AccountListsNotFound { + return &AccountListsNotFound{} +} + +/* +AccountListsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountListsNotFound struct { +} + +// IsSuccess returns true when this account lists not found response has a 2xx status code +func (o *AccountListsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account lists not found response has a 3xx status code +func (o *AccountListsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lists not found response has a 4xx status code +func (o *AccountListsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account lists not found response has a 5xx status code +func (o *AccountListsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account lists not found response a status code equal to that given +func (o *AccountListsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account lists not found response +func (o *AccountListsNotFound) Code() int { + return 404 +} + +func (o *AccountListsNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsNotFound", 404) +} + +func (o *AccountListsNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsNotFound", 404) +} + +func (o *AccountListsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountListsNotAcceptable creates a AccountListsNotAcceptable with default headers values +func NewAccountListsNotAcceptable() *AccountListsNotAcceptable { + return &AccountListsNotAcceptable{} +} + +/* +AccountListsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountListsNotAcceptable struct { +} + +// IsSuccess returns true when this account lists not acceptable response has a 2xx status code +func (o *AccountListsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account lists not acceptable response has a 3xx status code +func (o *AccountListsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lists not acceptable response has a 4xx status code +func (o *AccountListsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account lists not acceptable response has a 5xx status code +func (o *AccountListsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account lists not acceptable response a status code equal to that given +func (o *AccountListsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account lists not acceptable response +func (o *AccountListsNotAcceptable) Code() int { + return 406 +} + +func (o *AccountListsNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsNotAcceptable", 406) +} + +func (o *AccountListsNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsNotAcceptable", 406) +} + +func (o *AccountListsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountListsInternalServerError creates a AccountListsInternalServerError with default headers values +func NewAccountListsInternalServerError() *AccountListsInternalServerError { + return &AccountListsInternalServerError{} +} + +/* +AccountListsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountListsInternalServerError struct { +} + +// IsSuccess returns true when this account lists internal server error response has a 2xx status code +func (o *AccountListsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account lists internal server error response has a 3xx status code +func (o *AccountListsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lists internal server error response has a 4xx status code +func (o *AccountListsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account lists internal server error response has a 5xx status code +func (o *AccountListsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account lists internal server error response a status code equal to that given +func (o *AccountListsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account lists internal server error response +func (o *AccountListsInternalServerError) Code() int { + return 500 +} + +func (o *AccountListsInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsInternalServerError", 500) +} + +func (o *AccountListsInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsInternalServerError", 500) +} + +func (o *AccountListsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_lookup_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_lookup_get_parameters.go new file mode 100644 index 0000000..be84cb7 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_lookup_get_parameters.go @@ -0,0 +1,156 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountLookupGetParams creates a new AccountLookupGetParams 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 NewAccountLookupGetParams() *AccountLookupGetParams { + return &AccountLookupGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountLookupGetParamsWithTimeout creates a new AccountLookupGetParams object +// with the ability to set a timeout on a request. +func NewAccountLookupGetParamsWithTimeout(timeout time.Duration) *AccountLookupGetParams { + return &AccountLookupGetParams{ + timeout: timeout, + } +} + +// NewAccountLookupGetParamsWithContext creates a new AccountLookupGetParams object +// with the ability to set a context for a request. +func NewAccountLookupGetParamsWithContext(ctx context.Context) *AccountLookupGetParams { + return &AccountLookupGetParams{ + Context: ctx, + } +} + +// NewAccountLookupGetParamsWithHTTPClient creates a new AccountLookupGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountLookupGetParamsWithHTTPClient(client *http.Client) *AccountLookupGetParams { + return &AccountLookupGetParams{ + HTTPClient: client, + } +} + +/* +AccountLookupGetParams contains all the parameters to send to the API endpoint + + for the account lookup get operation. + + Typically these are written to a http.Request. +*/ +type AccountLookupGetParams struct { + + /* Acct. + + The username or Webfinger address to lookup. + */ + Acct string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account lookup get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountLookupGetParams) WithDefaults() *AccountLookupGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account lookup get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountLookupGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account lookup get params +func (o *AccountLookupGetParams) WithTimeout(timeout time.Duration) *AccountLookupGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account lookup get params +func (o *AccountLookupGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account lookup get params +func (o *AccountLookupGetParams) WithContext(ctx context.Context) *AccountLookupGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account lookup get params +func (o *AccountLookupGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account lookup get params +func (o *AccountLookupGetParams) WithHTTPClient(client *http.Client) *AccountLookupGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account lookup get params +func (o *AccountLookupGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAcct adds the acct to the account lookup get params +func (o *AccountLookupGetParams) WithAcct(acct string) *AccountLookupGetParams { + o.SetAcct(acct) + return o +} + +// SetAcct adds the acct to the account lookup get params +func (o *AccountLookupGetParams) SetAcct(acct string) { + o.Acct = acct +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountLookupGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param acct + qrAcct := o.Acct + qAcct := qrAcct + if qAcct != "" { + + if err := r.SetQueryParam("acct", qAcct); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_lookup_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_lookup_get_responses.go new file mode 100644 index 0000000..3a8bec4 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_lookup_get_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountLookupGetReader is a Reader for the AccountLookupGet structure. +type AccountLookupGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountLookupGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountLookupGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountLookupGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountLookupGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountLookupGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountLookupGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountLookupGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/accounts/lookup] accountLookupGet", response, response.Code()) + } +} + +// NewAccountLookupGetOK creates a AccountLookupGetOK with default headers values +func NewAccountLookupGetOK() *AccountLookupGetOK { + return &AccountLookupGetOK{} +} + +/* +AccountLookupGetOK describes a response with status code 200, with default header values. + +Result of the lookup. +*/ +type AccountLookupGetOK struct { + Payload *models.Account +} + +// IsSuccess returns true when this account lookup get o k response has a 2xx status code +func (o *AccountLookupGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account lookup get o k response has a 3xx status code +func (o *AccountLookupGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lookup get o k response has a 4xx status code +func (o *AccountLookupGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account lookup get o k response has a 5xx status code +func (o *AccountLookupGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account lookup get o k response a status code equal to that given +func (o *AccountLookupGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account lookup get o k response +func (o *AccountLookupGetOK) Code() int { + return 200 +} + +func (o *AccountLookupGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetOK %s", 200, payload) +} + +func (o *AccountLookupGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetOK %s", 200, payload) +} + +func (o *AccountLookupGetOK) GetPayload() *models.Account { + return o.Payload +} + +func (o *AccountLookupGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Account) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountLookupGetBadRequest creates a AccountLookupGetBadRequest with default headers values +func NewAccountLookupGetBadRequest() *AccountLookupGetBadRequest { + return &AccountLookupGetBadRequest{} +} + +/* +AccountLookupGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountLookupGetBadRequest struct { +} + +// IsSuccess returns true when this account lookup get bad request response has a 2xx status code +func (o *AccountLookupGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account lookup get bad request response has a 3xx status code +func (o *AccountLookupGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lookup get bad request response has a 4xx status code +func (o *AccountLookupGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account lookup get bad request response has a 5xx status code +func (o *AccountLookupGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account lookup get bad request response a status code equal to that given +func (o *AccountLookupGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account lookup get bad request response +func (o *AccountLookupGetBadRequest) Code() int { + return 400 +} + +func (o *AccountLookupGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetBadRequest", 400) +} + +func (o *AccountLookupGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetBadRequest", 400) +} + +func (o *AccountLookupGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountLookupGetUnauthorized creates a AccountLookupGetUnauthorized with default headers values +func NewAccountLookupGetUnauthorized() *AccountLookupGetUnauthorized { + return &AccountLookupGetUnauthorized{} +} + +/* +AccountLookupGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountLookupGetUnauthorized struct { +} + +// IsSuccess returns true when this account lookup get unauthorized response has a 2xx status code +func (o *AccountLookupGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account lookup get unauthorized response has a 3xx status code +func (o *AccountLookupGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lookup get unauthorized response has a 4xx status code +func (o *AccountLookupGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account lookup get unauthorized response has a 5xx status code +func (o *AccountLookupGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account lookup get unauthorized response a status code equal to that given +func (o *AccountLookupGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account lookup get unauthorized response +func (o *AccountLookupGetUnauthorized) Code() int { + return 401 +} + +func (o *AccountLookupGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetUnauthorized", 401) +} + +func (o *AccountLookupGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetUnauthorized", 401) +} + +func (o *AccountLookupGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountLookupGetNotFound creates a AccountLookupGetNotFound with default headers values +func NewAccountLookupGetNotFound() *AccountLookupGetNotFound { + return &AccountLookupGetNotFound{} +} + +/* +AccountLookupGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountLookupGetNotFound struct { +} + +// IsSuccess returns true when this account lookup get not found response has a 2xx status code +func (o *AccountLookupGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account lookup get not found response has a 3xx status code +func (o *AccountLookupGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lookup get not found response has a 4xx status code +func (o *AccountLookupGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account lookup get not found response has a 5xx status code +func (o *AccountLookupGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account lookup get not found response a status code equal to that given +func (o *AccountLookupGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account lookup get not found response +func (o *AccountLookupGetNotFound) Code() int { + return 404 +} + +func (o *AccountLookupGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetNotFound", 404) +} + +func (o *AccountLookupGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetNotFound", 404) +} + +func (o *AccountLookupGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountLookupGetNotAcceptable creates a AccountLookupGetNotAcceptable with default headers values +func NewAccountLookupGetNotAcceptable() *AccountLookupGetNotAcceptable { + return &AccountLookupGetNotAcceptable{} +} + +/* +AccountLookupGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountLookupGetNotAcceptable struct { +} + +// IsSuccess returns true when this account lookup get not acceptable response has a 2xx status code +func (o *AccountLookupGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account lookup get not acceptable response has a 3xx status code +func (o *AccountLookupGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lookup get not acceptable response has a 4xx status code +func (o *AccountLookupGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account lookup get not acceptable response has a 5xx status code +func (o *AccountLookupGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account lookup get not acceptable response a status code equal to that given +func (o *AccountLookupGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account lookup get not acceptable response +func (o *AccountLookupGetNotAcceptable) Code() int { + return 406 +} + +func (o *AccountLookupGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetNotAcceptable", 406) +} + +func (o *AccountLookupGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetNotAcceptable", 406) +} + +func (o *AccountLookupGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountLookupGetInternalServerError creates a AccountLookupGetInternalServerError with default headers values +func NewAccountLookupGetInternalServerError() *AccountLookupGetInternalServerError { + return &AccountLookupGetInternalServerError{} +} + +/* +AccountLookupGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountLookupGetInternalServerError struct { +} + +// IsSuccess returns true when this account lookup get internal server error response has a 2xx status code +func (o *AccountLookupGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account lookup get internal server error response has a 3xx status code +func (o *AccountLookupGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lookup get internal server error response has a 4xx status code +func (o *AccountLookupGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account lookup get internal server error response has a 5xx status code +func (o *AccountLookupGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account lookup get internal server error response a status code equal to that given +func (o *AccountLookupGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account lookup get internal server error response +func (o *AccountLookupGetInternalServerError) Code() int { + return 500 +} + +func (o *AccountLookupGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetInternalServerError", 500) +} + +func (o *AccountLookupGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetInternalServerError", 500) +} + +func (o *AccountLookupGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_move_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_move_parameters.go new file mode 100644 index 0000000..5b77e0b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_move_parameters.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountMoveParams creates a new AccountMoveParams 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 NewAccountMoveParams() *AccountMoveParams { + return &AccountMoveParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountMoveParamsWithTimeout creates a new AccountMoveParams object +// with the ability to set a timeout on a request. +func NewAccountMoveParamsWithTimeout(timeout time.Duration) *AccountMoveParams { + return &AccountMoveParams{ + timeout: timeout, + } +} + +// NewAccountMoveParamsWithContext creates a new AccountMoveParams object +// with the ability to set a context for a request. +func NewAccountMoveParamsWithContext(ctx context.Context) *AccountMoveParams { + return &AccountMoveParams{ + Context: ctx, + } +} + +// NewAccountMoveParamsWithHTTPClient creates a new AccountMoveParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountMoveParamsWithHTTPClient(client *http.Client) *AccountMoveParams { + return &AccountMoveParams{ + HTTPClient: client, + } +} + +/* +AccountMoveParams contains all the parameters to send to the API endpoint + + for the account move operation. + + Typically these are written to a http.Request. +*/ +type AccountMoveParams struct { + + /* MovedToURI. + + ActivityPub URI/ID of the target account. Eg., `https://example.org/users/some_account`. The target account must be alsoKnownAs the requesting account in order for the move to be successful. + */ + MovedToURI string + + /* Password. + + Password of the account user, for confirmation. + */ + Password string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account move params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountMoveParams) WithDefaults() *AccountMoveParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account move params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountMoveParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account move params +func (o *AccountMoveParams) WithTimeout(timeout time.Duration) *AccountMoveParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account move params +func (o *AccountMoveParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account move params +func (o *AccountMoveParams) WithContext(ctx context.Context) *AccountMoveParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account move params +func (o *AccountMoveParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account move params +func (o *AccountMoveParams) WithHTTPClient(client *http.Client) *AccountMoveParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account move params +func (o *AccountMoveParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithMovedToURI adds the movedToURI to the account move params +func (o *AccountMoveParams) WithMovedToURI(movedToURI string) *AccountMoveParams { + o.SetMovedToURI(movedToURI) + return o +} + +// SetMovedToURI adds the movedToUri to the account move params +func (o *AccountMoveParams) SetMovedToURI(movedToURI string) { + o.MovedToURI = movedToURI +} + +// WithPassword adds the password to the account move params +func (o *AccountMoveParams) WithPassword(password string) *AccountMoveParams { + o.SetPassword(password) + return o +} + +// SetPassword adds the password to the account move params +func (o *AccountMoveParams) SetPassword(password string) { + o.Password = password +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountMoveParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param moved_to_uri + frMovedToURI := o.MovedToURI + fMovedToURI := frMovedToURI + if fMovedToURI != "" { + if err := r.SetFormParam("moved_to_uri", fMovedToURI); err != nil { + return err + } + } + + // form param password + frPassword := o.Password + fPassword := frPassword + if fPassword != "" { + if err := r.SetFormParam("password", fPassword); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_move_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_move_responses.go new file mode 100644 index 0000000..6c8a909 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_move_responses.go @@ -0,0 +1,460 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// AccountMoveReader is a Reader for the AccountMove structure. +type AccountMoveReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountMoveReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewAccountMoveAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountMoveBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountMoveUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountMoveNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountMoveNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewAccountMoveUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountMoveInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts/move] accountMove", response, response.Code()) + } +} + +// NewAccountMoveAccepted creates a AccountMoveAccepted with default headers values +func NewAccountMoveAccepted() *AccountMoveAccepted { + return &AccountMoveAccepted{} +} + +/* +AccountMoveAccepted describes a response with status code 202, with default header values. + +The account move has been accepted and the account will be moved. +*/ +type AccountMoveAccepted struct { +} + +// IsSuccess returns true when this account move accepted response has a 2xx status code +func (o *AccountMoveAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account move accepted response has a 3xx status code +func (o *AccountMoveAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account move accepted response has a 4xx status code +func (o *AccountMoveAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this account move accepted response has a 5xx status code +func (o *AccountMoveAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this account move accepted response a status code equal to that given +func (o *AccountMoveAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the account move accepted response +func (o *AccountMoveAccepted) Code() int { + return 202 +} + +func (o *AccountMoveAccepted) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveAccepted", 202) +} + +func (o *AccountMoveAccepted) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveAccepted", 202) +} + +func (o *AccountMoveAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMoveBadRequest creates a AccountMoveBadRequest with default headers values +func NewAccountMoveBadRequest() *AccountMoveBadRequest { + return &AccountMoveBadRequest{} +} + +/* +AccountMoveBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountMoveBadRequest struct { +} + +// IsSuccess returns true when this account move bad request response has a 2xx status code +func (o *AccountMoveBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account move bad request response has a 3xx status code +func (o *AccountMoveBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account move bad request response has a 4xx status code +func (o *AccountMoveBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account move bad request response has a 5xx status code +func (o *AccountMoveBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account move bad request response a status code equal to that given +func (o *AccountMoveBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account move bad request response +func (o *AccountMoveBadRequest) Code() int { + return 400 +} + +func (o *AccountMoveBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveBadRequest", 400) +} + +func (o *AccountMoveBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveBadRequest", 400) +} + +func (o *AccountMoveBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMoveUnauthorized creates a AccountMoveUnauthorized with default headers values +func NewAccountMoveUnauthorized() *AccountMoveUnauthorized { + return &AccountMoveUnauthorized{} +} + +/* +AccountMoveUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountMoveUnauthorized struct { +} + +// IsSuccess returns true when this account move unauthorized response has a 2xx status code +func (o *AccountMoveUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account move unauthorized response has a 3xx status code +func (o *AccountMoveUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account move unauthorized response has a 4xx status code +func (o *AccountMoveUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account move unauthorized response has a 5xx status code +func (o *AccountMoveUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account move unauthorized response a status code equal to that given +func (o *AccountMoveUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account move unauthorized response +func (o *AccountMoveUnauthorized) Code() int { + return 401 +} + +func (o *AccountMoveUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveUnauthorized", 401) +} + +func (o *AccountMoveUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveUnauthorized", 401) +} + +func (o *AccountMoveUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMoveNotFound creates a AccountMoveNotFound with default headers values +func NewAccountMoveNotFound() *AccountMoveNotFound { + return &AccountMoveNotFound{} +} + +/* +AccountMoveNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountMoveNotFound struct { +} + +// IsSuccess returns true when this account move not found response has a 2xx status code +func (o *AccountMoveNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account move not found response has a 3xx status code +func (o *AccountMoveNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account move not found response has a 4xx status code +func (o *AccountMoveNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account move not found response has a 5xx status code +func (o *AccountMoveNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account move not found response a status code equal to that given +func (o *AccountMoveNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account move not found response +func (o *AccountMoveNotFound) Code() int { + return 404 +} + +func (o *AccountMoveNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveNotFound", 404) +} + +func (o *AccountMoveNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveNotFound", 404) +} + +func (o *AccountMoveNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMoveNotAcceptable creates a AccountMoveNotAcceptable with default headers values +func NewAccountMoveNotAcceptable() *AccountMoveNotAcceptable { + return &AccountMoveNotAcceptable{} +} + +/* +AccountMoveNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountMoveNotAcceptable struct { +} + +// IsSuccess returns true when this account move not acceptable response has a 2xx status code +func (o *AccountMoveNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account move not acceptable response has a 3xx status code +func (o *AccountMoveNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account move not acceptable response has a 4xx status code +func (o *AccountMoveNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account move not acceptable response has a 5xx status code +func (o *AccountMoveNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account move not acceptable response a status code equal to that given +func (o *AccountMoveNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account move not acceptable response +func (o *AccountMoveNotAcceptable) Code() int { + return 406 +} + +func (o *AccountMoveNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveNotAcceptable", 406) +} + +func (o *AccountMoveNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveNotAcceptable", 406) +} + +func (o *AccountMoveNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMoveUnprocessableEntity creates a AccountMoveUnprocessableEntity with default headers values +func NewAccountMoveUnprocessableEntity() *AccountMoveUnprocessableEntity { + return &AccountMoveUnprocessableEntity{} +} + +/* +AccountMoveUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable. Check the response body for more details. +*/ +type AccountMoveUnprocessableEntity struct { +} + +// IsSuccess returns true when this account move unprocessable entity response has a 2xx status code +func (o *AccountMoveUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account move unprocessable entity response has a 3xx status code +func (o *AccountMoveUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account move unprocessable entity response has a 4xx status code +func (o *AccountMoveUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this account move unprocessable entity response has a 5xx status code +func (o *AccountMoveUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this account move unprocessable entity response a status code equal to that given +func (o *AccountMoveUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the account move unprocessable entity response +func (o *AccountMoveUnprocessableEntity) Code() int { + return 422 +} + +func (o *AccountMoveUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveUnprocessableEntity", 422) +} + +func (o *AccountMoveUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveUnprocessableEntity", 422) +} + +func (o *AccountMoveUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMoveInternalServerError creates a AccountMoveInternalServerError with default headers values +func NewAccountMoveInternalServerError() *AccountMoveInternalServerError { + return &AccountMoveInternalServerError{} +} + +/* +AccountMoveInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountMoveInternalServerError struct { +} + +// IsSuccess returns true when this account move internal server error response has a 2xx status code +func (o *AccountMoveInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account move internal server error response has a 3xx status code +func (o *AccountMoveInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account move internal server error response has a 4xx status code +func (o *AccountMoveInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account move internal server error response has a 5xx status code +func (o *AccountMoveInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account move internal server error response a status code equal to that given +func (o *AccountMoveInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account move internal server error response +func (o *AccountMoveInternalServerError) Code() int { + return 500 +} + +func (o *AccountMoveInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveInternalServerError", 500) +} + +func (o *AccountMoveInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveInternalServerError", 500) +} + +func (o *AccountMoveInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_mute_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_mute_parameters.go new file mode 100644 index 0000000..8d2c138 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_mute_parameters.go @@ -0,0 +1,230 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountMuteParams creates a new AccountMuteParams 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 NewAccountMuteParams() *AccountMuteParams { + return &AccountMuteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountMuteParamsWithTimeout creates a new AccountMuteParams object +// with the ability to set a timeout on a request. +func NewAccountMuteParamsWithTimeout(timeout time.Duration) *AccountMuteParams { + return &AccountMuteParams{ + timeout: timeout, + } +} + +// NewAccountMuteParamsWithContext creates a new AccountMuteParams object +// with the ability to set a context for a request. +func NewAccountMuteParamsWithContext(ctx context.Context) *AccountMuteParams { + return &AccountMuteParams{ + Context: ctx, + } +} + +// NewAccountMuteParamsWithHTTPClient creates a new AccountMuteParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountMuteParamsWithHTTPClient(client *http.Client) *AccountMuteParams { + return &AccountMuteParams{ + HTTPClient: client, + } +} + +/* +AccountMuteParams contains all the parameters to send to the API endpoint + + for the account mute operation. + + Typically these are written to a http.Request. +*/ +type AccountMuteParams struct { + + /* Duration. + + How long the mute should last, in seconds. If 0 or not provided, mute lasts indefinitely. + */ + Duration *float64 + + /* ID. + + The ID of the account to block. + */ + ID string + + /* Notifications. + + Mute notifications as well as posts. + */ + Notifications *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account mute params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountMuteParams) WithDefaults() *AccountMuteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account mute params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountMuteParams) SetDefaults() { + var ( + durationDefault = float64(0) + + notificationsDefault = bool(false) + ) + + val := AccountMuteParams{ + Duration: &durationDefault, + Notifications: ¬ificationsDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the account mute params +func (o *AccountMuteParams) WithTimeout(timeout time.Duration) *AccountMuteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account mute params +func (o *AccountMuteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account mute params +func (o *AccountMuteParams) WithContext(ctx context.Context) *AccountMuteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account mute params +func (o *AccountMuteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account mute params +func (o *AccountMuteParams) WithHTTPClient(client *http.Client) *AccountMuteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account mute params +func (o *AccountMuteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDuration adds the duration to the account mute params +func (o *AccountMuteParams) WithDuration(duration *float64) *AccountMuteParams { + o.SetDuration(duration) + return o +} + +// SetDuration adds the duration to the account mute params +func (o *AccountMuteParams) SetDuration(duration *float64) { + o.Duration = duration +} + +// WithID adds the id to the account mute params +func (o *AccountMuteParams) WithID(id string) *AccountMuteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account mute params +func (o *AccountMuteParams) SetID(id string) { + o.ID = id +} + +// WithNotifications adds the notifications to the account mute params +func (o *AccountMuteParams) WithNotifications(notifications *bool) *AccountMuteParams { + o.SetNotifications(notifications) + return o +} + +// SetNotifications adds the notifications to the account mute params +func (o *AccountMuteParams) SetNotifications(notifications *bool) { + o.Notifications = notifications +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountMuteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Duration != nil { + + // form param duration + var frDuration float64 + if o.Duration != nil { + frDuration = *o.Duration + } + fDuration := swag.FormatFloat64(frDuration) + if fDuration != "" { + if err := r.SetFormParam("duration", fDuration); err != nil { + return err + } + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Notifications != nil { + + // form param notifications + var frNotifications bool + if o.Notifications != nil { + frNotifications = *o.Notifications + } + fNotifications := swag.FormatBool(frNotifications) + if fNotifications != "" { + if err := r.SetFormParam("notifications", fNotifications); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_mute_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_mute_responses.go new file mode 100644 index 0000000..1a6a9f8 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_mute_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountMuteReader is a Reader for the AccountMute structure. +type AccountMuteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountMuteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountMuteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountMuteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountMuteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewAccountMuteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountMuteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountMuteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountMuteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts/{id}/mute] accountMute", response, response.Code()) + } +} + +// NewAccountMuteOK creates a AccountMuteOK with default headers values +func NewAccountMuteOK() *AccountMuteOK { + return &AccountMuteOK{} +} + +/* +AccountMuteOK describes a response with status code 200, with default header values. + +Your relationship to the account. +*/ +type AccountMuteOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this account mute o k response has a 2xx status code +func (o *AccountMuteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account mute o k response has a 3xx status code +func (o *AccountMuteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account mute o k response has a 4xx status code +func (o *AccountMuteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account mute o k response has a 5xx status code +func (o *AccountMuteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account mute o k response a status code equal to that given +func (o *AccountMuteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account mute o k response +func (o *AccountMuteOK) Code() int { + return 200 +} + +func (o *AccountMuteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteOK %s", 200, payload) +} + +func (o *AccountMuteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteOK %s", 200, payload) +} + +func (o *AccountMuteOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *AccountMuteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountMuteBadRequest creates a AccountMuteBadRequest with default headers values +func NewAccountMuteBadRequest() *AccountMuteBadRequest { + return &AccountMuteBadRequest{} +} + +/* +AccountMuteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountMuteBadRequest struct { +} + +// IsSuccess returns true when this account mute bad request response has a 2xx status code +func (o *AccountMuteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account mute bad request response has a 3xx status code +func (o *AccountMuteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account mute bad request response has a 4xx status code +func (o *AccountMuteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account mute bad request response has a 5xx status code +func (o *AccountMuteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account mute bad request response a status code equal to that given +func (o *AccountMuteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account mute bad request response +func (o *AccountMuteBadRequest) Code() int { + return 400 +} + +func (o *AccountMuteBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteBadRequest", 400) +} + +func (o *AccountMuteBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteBadRequest", 400) +} + +func (o *AccountMuteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMuteUnauthorized creates a AccountMuteUnauthorized with default headers values +func NewAccountMuteUnauthorized() *AccountMuteUnauthorized { + return &AccountMuteUnauthorized{} +} + +/* +AccountMuteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountMuteUnauthorized struct { +} + +// IsSuccess returns true when this account mute unauthorized response has a 2xx status code +func (o *AccountMuteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account mute unauthorized response has a 3xx status code +func (o *AccountMuteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account mute unauthorized response has a 4xx status code +func (o *AccountMuteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account mute unauthorized response has a 5xx status code +func (o *AccountMuteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account mute unauthorized response a status code equal to that given +func (o *AccountMuteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account mute unauthorized response +func (o *AccountMuteUnauthorized) Code() int { + return 401 +} + +func (o *AccountMuteUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteUnauthorized", 401) +} + +func (o *AccountMuteUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteUnauthorized", 401) +} + +func (o *AccountMuteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMuteForbidden creates a AccountMuteForbidden with default headers values +func NewAccountMuteForbidden() *AccountMuteForbidden { + return &AccountMuteForbidden{} +} + +/* +AccountMuteForbidden describes a response with status code 403, with default header values. + +forbidden to moved accounts +*/ +type AccountMuteForbidden struct { +} + +// IsSuccess returns true when this account mute forbidden response has a 2xx status code +func (o *AccountMuteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account mute forbidden response has a 3xx status code +func (o *AccountMuteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account mute forbidden response has a 4xx status code +func (o *AccountMuteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this account mute forbidden response has a 5xx status code +func (o *AccountMuteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this account mute forbidden response a status code equal to that given +func (o *AccountMuteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the account mute forbidden response +func (o *AccountMuteForbidden) Code() int { + return 403 +} + +func (o *AccountMuteForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteForbidden", 403) +} + +func (o *AccountMuteForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteForbidden", 403) +} + +func (o *AccountMuteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMuteNotFound creates a AccountMuteNotFound with default headers values +func NewAccountMuteNotFound() *AccountMuteNotFound { + return &AccountMuteNotFound{} +} + +/* +AccountMuteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountMuteNotFound struct { +} + +// IsSuccess returns true when this account mute not found response has a 2xx status code +func (o *AccountMuteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account mute not found response has a 3xx status code +func (o *AccountMuteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account mute not found response has a 4xx status code +func (o *AccountMuteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account mute not found response has a 5xx status code +func (o *AccountMuteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account mute not found response a status code equal to that given +func (o *AccountMuteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account mute not found response +func (o *AccountMuteNotFound) Code() int { + return 404 +} + +func (o *AccountMuteNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteNotFound", 404) +} + +func (o *AccountMuteNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteNotFound", 404) +} + +func (o *AccountMuteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMuteNotAcceptable creates a AccountMuteNotAcceptable with default headers values +func NewAccountMuteNotAcceptable() *AccountMuteNotAcceptable { + return &AccountMuteNotAcceptable{} +} + +/* +AccountMuteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountMuteNotAcceptable struct { +} + +// IsSuccess returns true when this account mute not acceptable response has a 2xx status code +func (o *AccountMuteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account mute not acceptable response has a 3xx status code +func (o *AccountMuteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account mute not acceptable response has a 4xx status code +func (o *AccountMuteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account mute not acceptable response has a 5xx status code +func (o *AccountMuteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account mute not acceptable response a status code equal to that given +func (o *AccountMuteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account mute not acceptable response +func (o *AccountMuteNotAcceptable) Code() int { + return 406 +} + +func (o *AccountMuteNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteNotAcceptable", 406) +} + +func (o *AccountMuteNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteNotAcceptable", 406) +} + +func (o *AccountMuteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMuteInternalServerError creates a AccountMuteInternalServerError with default headers values +func NewAccountMuteInternalServerError() *AccountMuteInternalServerError { + return &AccountMuteInternalServerError{} +} + +/* +AccountMuteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountMuteInternalServerError struct { +} + +// IsSuccess returns true when this account mute internal server error response has a 2xx status code +func (o *AccountMuteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account mute internal server error response has a 3xx status code +func (o *AccountMuteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account mute internal server error response has a 4xx status code +func (o *AccountMuteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account mute internal server error response has a 5xx status code +func (o *AccountMuteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account mute internal server error response a status code equal to that given +func (o *AccountMuteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account mute internal server error response +func (o *AccountMuteInternalServerError) Code() int { + return 500 +} + +func (o *AccountMuteInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteInternalServerError", 500) +} + +func (o *AccountMuteInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteInternalServerError", 500) +} + +func (o *AccountMuteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_note_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_note_parameters.go new file mode 100644 index 0000000..a14b8b3 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_note_parameters.go @@ -0,0 +1,194 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountNoteParams creates a new AccountNoteParams 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 NewAccountNoteParams() *AccountNoteParams { + return &AccountNoteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountNoteParamsWithTimeout creates a new AccountNoteParams object +// with the ability to set a timeout on a request. +func NewAccountNoteParamsWithTimeout(timeout time.Duration) *AccountNoteParams { + return &AccountNoteParams{ + timeout: timeout, + } +} + +// NewAccountNoteParamsWithContext creates a new AccountNoteParams object +// with the ability to set a context for a request. +func NewAccountNoteParamsWithContext(ctx context.Context) *AccountNoteParams { + return &AccountNoteParams{ + Context: ctx, + } +} + +// NewAccountNoteParamsWithHTTPClient creates a new AccountNoteParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountNoteParamsWithHTTPClient(client *http.Client) *AccountNoteParams { + return &AccountNoteParams{ + HTTPClient: client, + } +} + +/* +AccountNoteParams contains all the parameters to send to the API endpoint + + for the account note operation. + + Typically these are written to a http.Request. +*/ +type AccountNoteParams struct { + + /* Comment. + + The text of the note. Omit this parameter or send an empty string to clear the note. + */ + Comment *string + + /* ID. + + The id of the account for which to set a note. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account note params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountNoteParams) WithDefaults() *AccountNoteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account note params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountNoteParams) SetDefaults() { + var ( + commentDefault = string("") + ) + + val := AccountNoteParams{ + Comment: &commentDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the account note params +func (o *AccountNoteParams) WithTimeout(timeout time.Duration) *AccountNoteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account note params +func (o *AccountNoteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account note params +func (o *AccountNoteParams) WithContext(ctx context.Context) *AccountNoteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account note params +func (o *AccountNoteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account note params +func (o *AccountNoteParams) WithHTTPClient(client *http.Client) *AccountNoteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account note params +func (o *AccountNoteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithComment adds the comment to the account note params +func (o *AccountNoteParams) WithComment(comment *string) *AccountNoteParams { + o.SetComment(comment) + return o +} + +// SetComment adds the comment to the account note params +func (o *AccountNoteParams) SetComment(comment *string) { + o.Comment = comment +} + +// WithID adds the id to the account note params +func (o *AccountNoteParams) WithID(id string) *AccountNoteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account note params +func (o *AccountNoteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountNoteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Comment != nil { + + // form param comment + var frComment string + if o.Comment != nil { + frComment = *o.Comment + } + fComment := frComment + if fComment != "" { + if err := r.SetFormParam("comment", fComment); err != nil { + return err + } + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_note_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_note_responses.go new file mode 100644 index 0000000..d79a178 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_note_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountNoteReader is a Reader for the AccountNote structure. +type AccountNoteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountNoteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountNoteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountNoteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountNoteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountNoteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountNoteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountNoteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts/{id}/note] accountNote", response, response.Code()) + } +} + +// NewAccountNoteOK creates a AccountNoteOK with default headers values +func NewAccountNoteOK() *AccountNoteOK { + return &AccountNoteOK{} +} + +/* +AccountNoteOK describes a response with status code 200, with default header values. + +Your relationship to the account. +*/ +type AccountNoteOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this account note o k response has a 2xx status code +func (o *AccountNoteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account note o k response has a 3xx status code +func (o *AccountNoteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account note o k response has a 4xx status code +func (o *AccountNoteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account note o k response has a 5xx status code +func (o *AccountNoteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account note o k response a status code equal to that given +func (o *AccountNoteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account note o k response +func (o *AccountNoteOK) Code() int { + return 200 +} + +func (o *AccountNoteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteOK %s", 200, payload) +} + +func (o *AccountNoteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteOK %s", 200, payload) +} + +func (o *AccountNoteOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *AccountNoteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountNoteBadRequest creates a AccountNoteBadRequest with default headers values +func NewAccountNoteBadRequest() *AccountNoteBadRequest { + return &AccountNoteBadRequest{} +} + +/* +AccountNoteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountNoteBadRequest struct { +} + +// IsSuccess returns true when this account note bad request response has a 2xx status code +func (o *AccountNoteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account note bad request response has a 3xx status code +func (o *AccountNoteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account note bad request response has a 4xx status code +func (o *AccountNoteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account note bad request response has a 5xx status code +func (o *AccountNoteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account note bad request response a status code equal to that given +func (o *AccountNoteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account note bad request response +func (o *AccountNoteBadRequest) Code() int { + return 400 +} + +func (o *AccountNoteBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteBadRequest", 400) +} + +func (o *AccountNoteBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteBadRequest", 400) +} + +func (o *AccountNoteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountNoteUnauthorized creates a AccountNoteUnauthorized with default headers values +func NewAccountNoteUnauthorized() *AccountNoteUnauthorized { + return &AccountNoteUnauthorized{} +} + +/* +AccountNoteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountNoteUnauthorized struct { +} + +// IsSuccess returns true when this account note unauthorized response has a 2xx status code +func (o *AccountNoteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account note unauthorized response has a 3xx status code +func (o *AccountNoteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account note unauthorized response has a 4xx status code +func (o *AccountNoteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account note unauthorized response has a 5xx status code +func (o *AccountNoteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account note unauthorized response a status code equal to that given +func (o *AccountNoteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account note unauthorized response +func (o *AccountNoteUnauthorized) Code() int { + return 401 +} + +func (o *AccountNoteUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteUnauthorized", 401) +} + +func (o *AccountNoteUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteUnauthorized", 401) +} + +func (o *AccountNoteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountNoteNotFound creates a AccountNoteNotFound with default headers values +func NewAccountNoteNotFound() *AccountNoteNotFound { + return &AccountNoteNotFound{} +} + +/* +AccountNoteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountNoteNotFound struct { +} + +// IsSuccess returns true when this account note not found response has a 2xx status code +func (o *AccountNoteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account note not found response has a 3xx status code +func (o *AccountNoteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account note not found response has a 4xx status code +func (o *AccountNoteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account note not found response has a 5xx status code +func (o *AccountNoteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account note not found response a status code equal to that given +func (o *AccountNoteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account note not found response +func (o *AccountNoteNotFound) Code() int { + return 404 +} + +func (o *AccountNoteNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteNotFound", 404) +} + +func (o *AccountNoteNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteNotFound", 404) +} + +func (o *AccountNoteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountNoteNotAcceptable creates a AccountNoteNotAcceptable with default headers values +func NewAccountNoteNotAcceptable() *AccountNoteNotAcceptable { + return &AccountNoteNotAcceptable{} +} + +/* +AccountNoteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountNoteNotAcceptable struct { +} + +// IsSuccess returns true when this account note not acceptable response has a 2xx status code +func (o *AccountNoteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account note not acceptable response has a 3xx status code +func (o *AccountNoteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account note not acceptable response has a 4xx status code +func (o *AccountNoteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account note not acceptable response has a 5xx status code +func (o *AccountNoteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account note not acceptable response a status code equal to that given +func (o *AccountNoteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account note not acceptable response +func (o *AccountNoteNotAcceptable) Code() int { + return 406 +} + +func (o *AccountNoteNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteNotAcceptable", 406) +} + +func (o *AccountNoteNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteNotAcceptable", 406) +} + +func (o *AccountNoteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountNoteInternalServerError creates a AccountNoteInternalServerError with default headers values +func NewAccountNoteInternalServerError() *AccountNoteInternalServerError { + return &AccountNoteInternalServerError{} +} + +/* +AccountNoteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountNoteInternalServerError struct { +} + +// IsSuccess returns true when this account note internal server error response has a 2xx status code +func (o *AccountNoteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account note internal server error response has a 3xx status code +func (o *AccountNoteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account note internal server error response has a 4xx status code +func (o *AccountNoteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account note internal server error response has a 5xx status code +func (o *AccountNoteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account note internal server error response a status code equal to that given +func (o *AccountNoteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account note internal server error response +func (o *AccountNoteInternalServerError) Code() int { + return 500 +} + +func (o *AccountNoteInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteInternalServerError", 500) +} + +func (o *AccountNoteInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteInternalServerError", 500) +} + +func (o *AccountNoteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_relationships_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_relationships_parameters.go new file mode 100644 index 0000000..af44769 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_relationships_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountRelationshipsParams creates a new AccountRelationshipsParams 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 NewAccountRelationshipsParams() *AccountRelationshipsParams { + return &AccountRelationshipsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountRelationshipsParamsWithTimeout creates a new AccountRelationshipsParams object +// with the ability to set a timeout on a request. +func NewAccountRelationshipsParamsWithTimeout(timeout time.Duration) *AccountRelationshipsParams { + return &AccountRelationshipsParams{ + timeout: timeout, + } +} + +// NewAccountRelationshipsParamsWithContext creates a new AccountRelationshipsParams object +// with the ability to set a context for a request. +func NewAccountRelationshipsParamsWithContext(ctx context.Context) *AccountRelationshipsParams { + return &AccountRelationshipsParams{ + Context: ctx, + } +} + +// NewAccountRelationshipsParamsWithHTTPClient creates a new AccountRelationshipsParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountRelationshipsParamsWithHTTPClient(client *http.Client) *AccountRelationshipsParams { + return &AccountRelationshipsParams{ + HTTPClient: client, + } +} + +/* +AccountRelationshipsParams contains all the parameters to send to the API endpoint + + for the account relationships operation. + + Typically these are written to a http.Request. +*/ +type AccountRelationshipsParams struct { + + /* ID. + + Account IDs. + */ + ID []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account relationships params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountRelationshipsParams) WithDefaults() *AccountRelationshipsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account relationships params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountRelationshipsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account relationships params +func (o *AccountRelationshipsParams) WithTimeout(timeout time.Duration) *AccountRelationshipsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account relationships params +func (o *AccountRelationshipsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account relationships params +func (o *AccountRelationshipsParams) WithContext(ctx context.Context) *AccountRelationshipsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account relationships params +func (o *AccountRelationshipsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account relationships params +func (o *AccountRelationshipsParams) WithHTTPClient(client *http.Client) *AccountRelationshipsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account relationships params +func (o *AccountRelationshipsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the account relationships params +func (o *AccountRelationshipsParams) WithID(id []string) *AccountRelationshipsParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account relationships params +func (o *AccountRelationshipsParams) SetID(id []string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountRelationshipsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ID != nil { + + // binding items for id[] + joinedID := o.bindParamID(reg) + + // query array param id[] + if err := r.SetQueryParam("id[]", joinedID...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamAccountRelationships binds the parameter id[] +func (o *AccountRelationshipsParams) bindParamID(formats strfmt.Registry) []string { + iDIR := o.ID + + var iDIC []string + for _, iDIIR := range iDIR { // explode []string + + iDIIV := iDIIR // string as string + iDIC = append(iDIC, iDIIV) + } + + // items.CollectionFormat: "multi" + iDIS := swag.JoinByFormat(iDIC, "multi") + + return iDIS +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_relationships_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_relationships_responses.go new file mode 100644 index 0000000..481c53e --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_relationships_responses.go @@ -0,0 +1,414 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountRelationshipsReader is a Reader for the AccountRelationships structure. +type AccountRelationshipsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountRelationshipsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountRelationshipsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountRelationshipsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountRelationshipsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountRelationshipsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountRelationshipsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountRelationshipsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/accounts/relationships] accountRelationships", response, response.Code()) + } +} + +// NewAccountRelationshipsOK creates a AccountRelationshipsOK with default headers values +func NewAccountRelationshipsOK() *AccountRelationshipsOK { + return &AccountRelationshipsOK{} +} + +/* +AccountRelationshipsOK describes a response with status code 200, with default header values. + +Array of account relationships. +*/ +type AccountRelationshipsOK struct { + Payload []*models.Relationship +} + +// IsSuccess returns true when this account relationships o k response has a 2xx status code +func (o *AccountRelationshipsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account relationships o k response has a 3xx status code +func (o *AccountRelationshipsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account relationships o k response has a 4xx status code +func (o *AccountRelationshipsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account relationships o k response has a 5xx status code +func (o *AccountRelationshipsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account relationships o k response a status code equal to that given +func (o *AccountRelationshipsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account relationships o k response +func (o *AccountRelationshipsOK) Code() int { + return 200 +} + +func (o *AccountRelationshipsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsOK %s", 200, payload) +} + +func (o *AccountRelationshipsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsOK %s", 200, payload) +} + +func (o *AccountRelationshipsOK) GetPayload() []*models.Relationship { + return o.Payload +} + +func (o *AccountRelationshipsOK) 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 +} + +// NewAccountRelationshipsBadRequest creates a AccountRelationshipsBadRequest with default headers values +func NewAccountRelationshipsBadRequest() *AccountRelationshipsBadRequest { + return &AccountRelationshipsBadRequest{} +} + +/* +AccountRelationshipsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountRelationshipsBadRequest struct { +} + +// IsSuccess returns true when this account relationships bad request response has a 2xx status code +func (o *AccountRelationshipsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account relationships bad request response has a 3xx status code +func (o *AccountRelationshipsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account relationships bad request response has a 4xx status code +func (o *AccountRelationshipsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account relationships bad request response has a 5xx status code +func (o *AccountRelationshipsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account relationships bad request response a status code equal to that given +func (o *AccountRelationshipsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account relationships bad request response +func (o *AccountRelationshipsBadRequest) Code() int { + return 400 +} + +func (o *AccountRelationshipsBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsBadRequest", 400) +} + +func (o *AccountRelationshipsBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsBadRequest", 400) +} + +func (o *AccountRelationshipsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountRelationshipsUnauthorized creates a AccountRelationshipsUnauthorized with default headers values +func NewAccountRelationshipsUnauthorized() *AccountRelationshipsUnauthorized { + return &AccountRelationshipsUnauthorized{} +} + +/* +AccountRelationshipsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountRelationshipsUnauthorized struct { +} + +// IsSuccess returns true when this account relationships unauthorized response has a 2xx status code +func (o *AccountRelationshipsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account relationships unauthorized response has a 3xx status code +func (o *AccountRelationshipsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account relationships unauthorized response has a 4xx status code +func (o *AccountRelationshipsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account relationships unauthorized response has a 5xx status code +func (o *AccountRelationshipsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account relationships unauthorized response a status code equal to that given +func (o *AccountRelationshipsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account relationships unauthorized response +func (o *AccountRelationshipsUnauthorized) Code() int { + return 401 +} + +func (o *AccountRelationshipsUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsUnauthorized", 401) +} + +func (o *AccountRelationshipsUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsUnauthorized", 401) +} + +func (o *AccountRelationshipsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountRelationshipsNotFound creates a AccountRelationshipsNotFound with default headers values +func NewAccountRelationshipsNotFound() *AccountRelationshipsNotFound { + return &AccountRelationshipsNotFound{} +} + +/* +AccountRelationshipsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountRelationshipsNotFound struct { +} + +// IsSuccess returns true when this account relationships not found response has a 2xx status code +func (o *AccountRelationshipsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account relationships not found response has a 3xx status code +func (o *AccountRelationshipsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account relationships not found response has a 4xx status code +func (o *AccountRelationshipsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account relationships not found response has a 5xx status code +func (o *AccountRelationshipsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account relationships not found response a status code equal to that given +func (o *AccountRelationshipsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account relationships not found response +func (o *AccountRelationshipsNotFound) Code() int { + return 404 +} + +func (o *AccountRelationshipsNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsNotFound", 404) +} + +func (o *AccountRelationshipsNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsNotFound", 404) +} + +func (o *AccountRelationshipsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountRelationshipsNotAcceptable creates a AccountRelationshipsNotAcceptable with default headers values +func NewAccountRelationshipsNotAcceptable() *AccountRelationshipsNotAcceptable { + return &AccountRelationshipsNotAcceptable{} +} + +/* +AccountRelationshipsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountRelationshipsNotAcceptable struct { +} + +// IsSuccess returns true when this account relationships not acceptable response has a 2xx status code +func (o *AccountRelationshipsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account relationships not acceptable response has a 3xx status code +func (o *AccountRelationshipsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account relationships not acceptable response has a 4xx status code +func (o *AccountRelationshipsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account relationships not acceptable response has a 5xx status code +func (o *AccountRelationshipsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account relationships not acceptable response a status code equal to that given +func (o *AccountRelationshipsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account relationships not acceptable response +func (o *AccountRelationshipsNotAcceptable) Code() int { + return 406 +} + +func (o *AccountRelationshipsNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsNotAcceptable", 406) +} + +func (o *AccountRelationshipsNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsNotAcceptable", 406) +} + +func (o *AccountRelationshipsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountRelationshipsInternalServerError creates a AccountRelationshipsInternalServerError with default headers values +func NewAccountRelationshipsInternalServerError() *AccountRelationshipsInternalServerError { + return &AccountRelationshipsInternalServerError{} +} + +/* +AccountRelationshipsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountRelationshipsInternalServerError struct { +} + +// IsSuccess returns true when this account relationships internal server error response has a 2xx status code +func (o *AccountRelationshipsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account relationships internal server error response has a 3xx status code +func (o *AccountRelationshipsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account relationships internal server error response has a 4xx status code +func (o *AccountRelationshipsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account relationships internal server error response has a 5xx status code +func (o *AccountRelationshipsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account relationships internal server error response a status code equal to that given +func (o *AccountRelationshipsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account relationships internal server error response +func (o *AccountRelationshipsInternalServerError) Code() int { + return 500 +} + +func (o *AccountRelationshipsInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsInternalServerError", 500) +} + +func (o *AccountRelationshipsInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsInternalServerError", 500) +} + +func (o *AccountRelationshipsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_search_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_search_get_parameters.go new file mode 100644 index 0000000..7f5ab6c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_search_get_parameters.go @@ -0,0 +1,318 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountSearchGetParams creates a new AccountSearchGetParams 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 NewAccountSearchGetParams() *AccountSearchGetParams { + return &AccountSearchGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountSearchGetParamsWithTimeout creates a new AccountSearchGetParams object +// with the ability to set a timeout on a request. +func NewAccountSearchGetParamsWithTimeout(timeout time.Duration) *AccountSearchGetParams { + return &AccountSearchGetParams{ + timeout: timeout, + } +} + +// NewAccountSearchGetParamsWithContext creates a new AccountSearchGetParams object +// with the ability to set a context for a request. +func NewAccountSearchGetParamsWithContext(ctx context.Context) *AccountSearchGetParams { + return &AccountSearchGetParams{ + Context: ctx, + } +} + +// NewAccountSearchGetParamsWithHTTPClient creates a new AccountSearchGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountSearchGetParamsWithHTTPClient(client *http.Client) *AccountSearchGetParams { + return &AccountSearchGetParams{ + HTTPClient: client, + } +} + +/* +AccountSearchGetParams contains all the parameters to send to the API endpoint + + for the account search get operation. + + Typically these are written to a http.Request. +*/ +type AccountSearchGetParams struct { + + /* Following. + + Show only accounts that the requesting account follows. If this is set to `true`, then the GoToSocial instance will enhance the search by also searching within account notes, not just in usernames and display names. + */ + Following *bool + + /* Limit. + + Number of results to try to return. + + Default: 40 + */ + Limit *int64 + + /* Offset. + + Page number of results to return (starts at 0). This parameter is currently not used, offsets over 0 will always return 0 results. + */ + Offset *int64 + + /* Q. + + Query string to search for. This can be in the following forms: + - `@[username]` -- search for an account with the given username on any domain. Can return multiple results. + - `@[username]@[domain]` -- search for a remote account with exact username and domain. Will only ever return 1 result at most. + - any arbitrary string -- search for accounts containing the given string in their username or display name. Can return multiple results. + */ + Q string + + /* Resolve. + + If query is for `@[username]@[domain]`, or a URL, allow the GoToSocial instance to resolve the search by making calls to remote instances (webfinger, ActivityPub, etc). + */ + Resolve *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account search get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountSearchGetParams) WithDefaults() *AccountSearchGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account search get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountSearchGetParams) SetDefaults() { + var ( + followingDefault = bool(false) + + limitDefault = int64(40) + + offsetDefault = int64(0) + + resolveDefault = bool(false) + ) + + val := AccountSearchGetParams{ + Following: &followingDefault, + Limit: &limitDefault, + Offset: &offsetDefault, + Resolve: &resolveDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the account search get params +func (o *AccountSearchGetParams) WithTimeout(timeout time.Duration) *AccountSearchGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account search get params +func (o *AccountSearchGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account search get params +func (o *AccountSearchGetParams) WithContext(ctx context.Context) *AccountSearchGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account search get params +func (o *AccountSearchGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account search get params +func (o *AccountSearchGetParams) WithHTTPClient(client *http.Client) *AccountSearchGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account search get params +func (o *AccountSearchGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithFollowing adds the following to the account search get params +func (o *AccountSearchGetParams) WithFollowing(following *bool) *AccountSearchGetParams { + o.SetFollowing(following) + return o +} + +// SetFollowing adds the following to the account search get params +func (o *AccountSearchGetParams) SetFollowing(following *bool) { + o.Following = following +} + +// WithLimit adds the limit to the account search get params +func (o *AccountSearchGetParams) WithLimit(limit *int64) *AccountSearchGetParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the account search get params +func (o *AccountSearchGetParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithOffset adds the offset to the account search get params +func (o *AccountSearchGetParams) WithOffset(offset *int64) *AccountSearchGetParams { + o.SetOffset(offset) + return o +} + +// SetOffset adds the offset to the account search get params +func (o *AccountSearchGetParams) SetOffset(offset *int64) { + o.Offset = offset +} + +// WithQ adds the q to the account search get params +func (o *AccountSearchGetParams) WithQ(q string) *AccountSearchGetParams { + o.SetQ(q) + return o +} + +// SetQ adds the q to the account search get params +func (o *AccountSearchGetParams) SetQ(q string) { + o.Q = q +} + +// WithResolve adds the resolve to the account search get params +func (o *AccountSearchGetParams) WithResolve(resolve *bool) *AccountSearchGetParams { + o.SetResolve(resolve) + return o +} + +// SetResolve adds the resolve to the account search get params +func (o *AccountSearchGetParams) SetResolve(resolve *bool) { + o.Resolve = resolve +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountSearchGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Following != nil { + + // query param following + var qrFollowing bool + + if o.Following != nil { + qrFollowing = *o.Following + } + qFollowing := swag.FormatBool(qrFollowing) + if qFollowing != "" { + + if err := r.SetQueryParam("following", qFollowing); 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.Offset != nil { + + // query param offset + var qrOffset int64 + + if o.Offset != nil { + qrOffset = *o.Offset + } + qOffset := swag.FormatInt64(qrOffset) + if qOffset != "" { + + if err := r.SetQueryParam("offset", qOffset); err != nil { + return err + } + } + } + + // query param q + qrQ := o.Q + qQ := qrQ + if qQ != "" { + + if err := r.SetQueryParam("q", qQ); err != nil { + return err + } + } + + if o.Resolve != nil { + + // query param resolve + var qrResolve bool + + if o.Resolve != nil { + qrResolve = *o.Resolve + } + qResolve := swag.FormatBool(qrResolve) + if qResolve != "" { + + if err := r.SetQueryParam("resolve", qResolve); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_search_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_search_get_responses.go new file mode 100644 index 0000000..1d65bd8 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_search_get_responses.go @@ -0,0 +1,414 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountSearchGetReader is a Reader for the AccountSearchGet structure. +type AccountSearchGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountSearchGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountSearchGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountSearchGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountSearchGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountSearchGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountSearchGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountSearchGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/accounts/search] accountSearchGet", response, response.Code()) + } +} + +// NewAccountSearchGetOK creates a AccountSearchGetOK with default headers values +func NewAccountSearchGetOK() *AccountSearchGetOK { + return &AccountSearchGetOK{} +} + +/* +AccountSearchGetOK describes a response with status code 200, with default header values. + +Results of the search. +*/ +type AccountSearchGetOK struct { + Payload []*models.Account +} + +// IsSuccess returns true when this account search get o k response has a 2xx status code +func (o *AccountSearchGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account search get o k response has a 3xx status code +func (o *AccountSearchGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account search get o k response has a 4xx status code +func (o *AccountSearchGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account search get o k response has a 5xx status code +func (o *AccountSearchGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account search get o k response a status code equal to that given +func (o *AccountSearchGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account search get o k response +func (o *AccountSearchGetOK) Code() int { + return 200 +} + +func (o *AccountSearchGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetOK %s", 200, payload) +} + +func (o *AccountSearchGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetOK %s", 200, payload) +} + +func (o *AccountSearchGetOK) GetPayload() []*models.Account { + return o.Payload +} + +func (o *AccountSearchGetOK) 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 +} + +// NewAccountSearchGetBadRequest creates a AccountSearchGetBadRequest with default headers values +func NewAccountSearchGetBadRequest() *AccountSearchGetBadRequest { + return &AccountSearchGetBadRequest{} +} + +/* +AccountSearchGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountSearchGetBadRequest struct { +} + +// IsSuccess returns true when this account search get bad request response has a 2xx status code +func (o *AccountSearchGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account search get bad request response has a 3xx status code +func (o *AccountSearchGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account search get bad request response has a 4xx status code +func (o *AccountSearchGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account search get bad request response has a 5xx status code +func (o *AccountSearchGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account search get bad request response a status code equal to that given +func (o *AccountSearchGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account search get bad request response +func (o *AccountSearchGetBadRequest) Code() int { + return 400 +} + +func (o *AccountSearchGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetBadRequest", 400) +} + +func (o *AccountSearchGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetBadRequest", 400) +} + +func (o *AccountSearchGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountSearchGetUnauthorized creates a AccountSearchGetUnauthorized with default headers values +func NewAccountSearchGetUnauthorized() *AccountSearchGetUnauthorized { + return &AccountSearchGetUnauthorized{} +} + +/* +AccountSearchGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountSearchGetUnauthorized struct { +} + +// IsSuccess returns true when this account search get unauthorized response has a 2xx status code +func (o *AccountSearchGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account search get unauthorized response has a 3xx status code +func (o *AccountSearchGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account search get unauthorized response has a 4xx status code +func (o *AccountSearchGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account search get unauthorized response has a 5xx status code +func (o *AccountSearchGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account search get unauthorized response a status code equal to that given +func (o *AccountSearchGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account search get unauthorized response +func (o *AccountSearchGetUnauthorized) Code() int { + return 401 +} + +func (o *AccountSearchGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetUnauthorized", 401) +} + +func (o *AccountSearchGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetUnauthorized", 401) +} + +func (o *AccountSearchGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountSearchGetNotFound creates a AccountSearchGetNotFound with default headers values +func NewAccountSearchGetNotFound() *AccountSearchGetNotFound { + return &AccountSearchGetNotFound{} +} + +/* +AccountSearchGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountSearchGetNotFound struct { +} + +// IsSuccess returns true when this account search get not found response has a 2xx status code +func (o *AccountSearchGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account search get not found response has a 3xx status code +func (o *AccountSearchGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account search get not found response has a 4xx status code +func (o *AccountSearchGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account search get not found response has a 5xx status code +func (o *AccountSearchGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account search get not found response a status code equal to that given +func (o *AccountSearchGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account search get not found response +func (o *AccountSearchGetNotFound) Code() int { + return 404 +} + +func (o *AccountSearchGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetNotFound", 404) +} + +func (o *AccountSearchGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetNotFound", 404) +} + +func (o *AccountSearchGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountSearchGetNotAcceptable creates a AccountSearchGetNotAcceptable with default headers values +func NewAccountSearchGetNotAcceptable() *AccountSearchGetNotAcceptable { + return &AccountSearchGetNotAcceptable{} +} + +/* +AccountSearchGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountSearchGetNotAcceptable struct { +} + +// IsSuccess returns true when this account search get not acceptable response has a 2xx status code +func (o *AccountSearchGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account search get not acceptable response has a 3xx status code +func (o *AccountSearchGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account search get not acceptable response has a 4xx status code +func (o *AccountSearchGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account search get not acceptable response has a 5xx status code +func (o *AccountSearchGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account search get not acceptable response a status code equal to that given +func (o *AccountSearchGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account search get not acceptable response +func (o *AccountSearchGetNotAcceptable) Code() int { + return 406 +} + +func (o *AccountSearchGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetNotAcceptable", 406) +} + +func (o *AccountSearchGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetNotAcceptable", 406) +} + +func (o *AccountSearchGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountSearchGetInternalServerError creates a AccountSearchGetInternalServerError with default headers values +func NewAccountSearchGetInternalServerError() *AccountSearchGetInternalServerError { + return &AccountSearchGetInternalServerError{} +} + +/* +AccountSearchGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountSearchGetInternalServerError struct { +} + +// IsSuccess returns true when this account search get internal server error response has a 2xx status code +func (o *AccountSearchGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account search get internal server error response has a 3xx status code +func (o *AccountSearchGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account search get internal server error response has a 4xx status code +func (o *AccountSearchGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account search get internal server error response has a 5xx status code +func (o *AccountSearchGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account search get internal server error response a status code equal to that given +func (o *AccountSearchGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account search get internal server error response +func (o *AccountSearchGetInternalServerError) Code() int { + return 500 +} + +func (o *AccountSearchGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetInternalServerError", 500) +} + +func (o *AccountSearchGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetInternalServerError", 500) +} + +func (o *AccountSearchGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_statuses_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_statuses_parameters.go new file mode 100644 index 0000000..dd8920a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_statuses_parameters.go @@ -0,0 +1,452 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountStatusesParams creates a new AccountStatusesParams 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 NewAccountStatusesParams() *AccountStatusesParams { + return &AccountStatusesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountStatusesParamsWithTimeout creates a new AccountStatusesParams object +// with the ability to set a timeout on a request. +func NewAccountStatusesParamsWithTimeout(timeout time.Duration) *AccountStatusesParams { + return &AccountStatusesParams{ + timeout: timeout, + } +} + +// NewAccountStatusesParamsWithContext creates a new AccountStatusesParams object +// with the ability to set a context for a request. +func NewAccountStatusesParamsWithContext(ctx context.Context) *AccountStatusesParams { + return &AccountStatusesParams{ + Context: ctx, + } +} + +// NewAccountStatusesParamsWithHTTPClient creates a new AccountStatusesParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountStatusesParamsWithHTTPClient(client *http.Client) *AccountStatusesParams { + return &AccountStatusesParams{ + HTTPClient: client, + } +} + +/* +AccountStatusesParams contains all the parameters to send to the API endpoint + + for the account statuses operation. + + Typically these are written to a http.Request. +*/ +type AccountStatusesParams struct { + + /* ExcludeReblogs. + + Exclude statuses that are a reblog/boost of another status. + */ + ExcludeReblogs *bool + + /* ExcludeReplies. + + Exclude statuses that are a reply to another status. + */ + ExcludeReplies *bool + + /* ID. + + Account ID. + */ + ID string + + /* Limit. + + Number of statuses to return. + + Default: 30 + */ + Limit *int64 + + /* MaxID. + + Return only statuses *OLDER* than the given max status ID. The status with the specified ID will not be included in the response. + */ + MaxID *string + + /* MinID. + + Return only statuses *NEWER* than the given min status ID. The status with the specified ID will not be included in the response. + */ + MinID *string + + /* OnlyMedia. + + Show only statuses with media attachments. + */ + OnlyMedia *bool + + /* OnlyPublic. + + Show only statuses with a privacy setting of 'public'. + */ + OnlyPublic *bool + + /* Pinned. + + Show only pinned statuses. In other words, exclude statuses that are not pinned to the given account ID. + */ + Pinned *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account statuses params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountStatusesParams) WithDefaults() *AccountStatusesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account statuses params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountStatusesParams) SetDefaults() { + var ( + excludeReblogsDefault = bool(false) + + excludeRepliesDefault = bool(false) + + limitDefault = int64(30) + + onlyMediaDefault = bool(false) + + onlyPublicDefault = bool(false) + + pinnedDefault = bool(false) + ) + + val := AccountStatusesParams{ + ExcludeReblogs: &excludeReblogsDefault, + ExcludeReplies: &excludeRepliesDefault, + Limit: &limitDefault, + OnlyMedia: &onlyMediaDefault, + OnlyPublic: &onlyPublicDefault, + Pinned: &pinnedDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the account statuses params +func (o *AccountStatusesParams) WithTimeout(timeout time.Duration) *AccountStatusesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account statuses params +func (o *AccountStatusesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account statuses params +func (o *AccountStatusesParams) WithContext(ctx context.Context) *AccountStatusesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account statuses params +func (o *AccountStatusesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account statuses params +func (o *AccountStatusesParams) WithHTTPClient(client *http.Client) *AccountStatusesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account statuses params +func (o *AccountStatusesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExcludeReblogs adds the excludeReblogs to the account statuses params +func (o *AccountStatusesParams) WithExcludeReblogs(excludeReblogs *bool) *AccountStatusesParams { + o.SetExcludeReblogs(excludeReblogs) + return o +} + +// SetExcludeReblogs adds the excludeReblogs to the account statuses params +func (o *AccountStatusesParams) SetExcludeReblogs(excludeReblogs *bool) { + o.ExcludeReblogs = excludeReblogs +} + +// WithExcludeReplies adds the excludeReplies to the account statuses params +func (o *AccountStatusesParams) WithExcludeReplies(excludeReplies *bool) *AccountStatusesParams { + o.SetExcludeReplies(excludeReplies) + return o +} + +// SetExcludeReplies adds the excludeReplies to the account statuses params +func (o *AccountStatusesParams) SetExcludeReplies(excludeReplies *bool) { + o.ExcludeReplies = excludeReplies +} + +// WithID adds the id to the account statuses params +func (o *AccountStatusesParams) WithID(id string) *AccountStatusesParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account statuses params +func (o *AccountStatusesParams) SetID(id string) { + o.ID = id +} + +// WithLimit adds the limit to the account statuses params +func (o *AccountStatusesParams) WithLimit(limit *int64) *AccountStatusesParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the account statuses params +func (o *AccountStatusesParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the account statuses params +func (o *AccountStatusesParams) WithMaxID(maxID *string) *AccountStatusesParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the account statuses params +func (o *AccountStatusesParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the account statuses params +func (o *AccountStatusesParams) WithMinID(minID *string) *AccountStatusesParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the account statuses params +func (o *AccountStatusesParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithOnlyMedia adds the onlyMedia to the account statuses params +func (o *AccountStatusesParams) WithOnlyMedia(onlyMedia *bool) *AccountStatusesParams { + o.SetOnlyMedia(onlyMedia) + return o +} + +// SetOnlyMedia adds the onlyMedia to the account statuses params +func (o *AccountStatusesParams) SetOnlyMedia(onlyMedia *bool) { + o.OnlyMedia = onlyMedia +} + +// WithOnlyPublic adds the onlyPublic to the account statuses params +func (o *AccountStatusesParams) WithOnlyPublic(onlyPublic *bool) *AccountStatusesParams { + o.SetOnlyPublic(onlyPublic) + return o +} + +// SetOnlyPublic adds the onlyPublic to the account statuses params +func (o *AccountStatusesParams) SetOnlyPublic(onlyPublic *bool) { + o.OnlyPublic = onlyPublic +} + +// WithPinned adds the pinned to the account statuses params +func (o *AccountStatusesParams) WithPinned(pinned *bool) *AccountStatusesParams { + o.SetPinned(pinned) + return o +} + +// SetPinned adds the pinned to the account statuses params +func (o *AccountStatusesParams) SetPinned(pinned *bool) { + o.Pinned = pinned +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountStatusesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ExcludeReblogs != nil { + + // query param exclude_reblogs + var qrExcludeReblogs bool + + if o.ExcludeReblogs != nil { + qrExcludeReblogs = *o.ExcludeReblogs + } + qExcludeReblogs := swag.FormatBool(qrExcludeReblogs) + if qExcludeReblogs != "" { + + if err := r.SetQueryParam("exclude_reblogs", qExcludeReblogs); err != nil { + return err + } + } + } + + if o.ExcludeReplies != nil { + + // query param exclude_replies + var qrExcludeReplies bool + + if o.ExcludeReplies != nil { + qrExcludeReplies = *o.ExcludeReplies + } + qExcludeReplies := swag.FormatBool(qrExcludeReplies) + if qExcludeReplies != "" { + + if err := r.SetQueryParam("exclude_replies", qExcludeReplies); err != nil { + return err + } + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); 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.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if o.OnlyMedia != nil { + + // query param only_media + var qrOnlyMedia bool + + if o.OnlyMedia != nil { + qrOnlyMedia = *o.OnlyMedia + } + qOnlyMedia := swag.FormatBool(qrOnlyMedia) + if qOnlyMedia != "" { + + if err := r.SetQueryParam("only_media", qOnlyMedia); err != nil { + return err + } + } + } + + if o.OnlyPublic != nil { + + // query param only_public + var qrOnlyPublic bool + + if o.OnlyPublic != nil { + qrOnlyPublic = *o.OnlyPublic + } + qOnlyPublic := swag.FormatBool(qrOnlyPublic) + if qOnlyPublic != "" { + + if err := r.SetQueryParam("only_public", qOnlyPublic); err != nil { + return err + } + } + } + + if o.Pinned != nil { + + // query param pinned + var qrPinned bool + + if o.Pinned != nil { + qrPinned = *o.Pinned + } + qPinned := swag.FormatBool(qrPinned) + if qPinned != "" { + + if err := r.SetQueryParam("pinned", qPinned); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_statuses_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_statuses_responses.go new file mode 100644 index 0000000..90e98c2 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_statuses_responses.go @@ -0,0 +1,426 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountStatusesReader is a Reader for the AccountStatuses structure. +type AccountStatusesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountStatusesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountStatusesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountStatusesBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountStatusesUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountStatusesNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountStatusesNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountStatusesInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/accounts/{id}/statuses] accountStatuses", response, response.Code()) + } +} + +// NewAccountStatusesOK creates a AccountStatusesOK with default headers values +func NewAccountStatusesOK() *AccountStatusesOK { + return &AccountStatusesOK{} +} + +/* +AccountStatusesOK describes a response with status code 200, with default header values. + +Array of statuses. +*/ +type AccountStatusesOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Status +} + +// IsSuccess returns true when this account statuses o k response has a 2xx status code +func (o *AccountStatusesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account statuses o k response has a 3xx status code +func (o *AccountStatusesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account statuses o k response has a 4xx status code +func (o *AccountStatusesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account statuses o k response has a 5xx status code +func (o *AccountStatusesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account statuses o k response a status code equal to that given +func (o *AccountStatusesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account statuses o k response +func (o *AccountStatusesOK) Code() int { + return 200 +} + +func (o *AccountStatusesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesOK %s", 200, payload) +} + +func (o *AccountStatusesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesOK %s", 200, payload) +} + +func (o *AccountStatusesOK) GetPayload() []*models.Status { + return o.Payload +} + +func (o *AccountStatusesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountStatusesBadRequest creates a AccountStatusesBadRequest with default headers values +func NewAccountStatusesBadRequest() *AccountStatusesBadRequest { + return &AccountStatusesBadRequest{} +} + +/* +AccountStatusesBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountStatusesBadRequest struct { +} + +// IsSuccess returns true when this account statuses bad request response has a 2xx status code +func (o *AccountStatusesBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account statuses bad request response has a 3xx status code +func (o *AccountStatusesBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account statuses bad request response has a 4xx status code +func (o *AccountStatusesBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account statuses bad request response has a 5xx status code +func (o *AccountStatusesBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account statuses bad request response a status code equal to that given +func (o *AccountStatusesBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account statuses bad request response +func (o *AccountStatusesBadRequest) Code() int { + return 400 +} + +func (o *AccountStatusesBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesBadRequest", 400) +} + +func (o *AccountStatusesBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesBadRequest", 400) +} + +func (o *AccountStatusesBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountStatusesUnauthorized creates a AccountStatusesUnauthorized with default headers values +func NewAccountStatusesUnauthorized() *AccountStatusesUnauthorized { + return &AccountStatusesUnauthorized{} +} + +/* +AccountStatusesUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountStatusesUnauthorized struct { +} + +// IsSuccess returns true when this account statuses unauthorized response has a 2xx status code +func (o *AccountStatusesUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account statuses unauthorized response has a 3xx status code +func (o *AccountStatusesUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account statuses unauthorized response has a 4xx status code +func (o *AccountStatusesUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account statuses unauthorized response has a 5xx status code +func (o *AccountStatusesUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account statuses unauthorized response a status code equal to that given +func (o *AccountStatusesUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account statuses unauthorized response +func (o *AccountStatusesUnauthorized) Code() int { + return 401 +} + +func (o *AccountStatusesUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesUnauthorized", 401) +} + +func (o *AccountStatusesUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesUnauthorized", 401) +} + +func (o *AccountStatusesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountStatusesNotFound creates a AccountStatusesNotFound with default headers values +func NewAccountStatusesNotFound() *AccountStatusesNotFound { + return &AccountStatusesNotFound{} +} + +/* +AccountStatusesNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountStatusesNotFound struct { +} + +// IsSuccess returns true when this account statuses not found response has a 2xx status code +func (o *AccountStatusesNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account statuses not found response has a 3xx status code +func (o *AccountStatusesNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account statuses not found response has a 4xx status code +func (o *AccountStatusesNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account statuses not found response has a 5xx status code +func (o *AccountStatusesNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account statuses not found response a status code equal to that given +func (o *AccountStatusesNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account statuses not found response +func (o *AccountStatusesNotFound) Code() int { + return 404 +} + +func (o *AccountStatusesNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesNotFound", 404) +} + +func (o *AccountStatusesNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesNotFound", 404) +} + +func (o *AccountStatusesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountStatusesNotAcceptable creates a AccountStatusesNotAcceptable with default headers values +func NewAccountStatusesNotAcceptable() *AccountStatusesNotAcceptable { + return &AccountStatusesNotAcceptable{} +} + +/* +AccountStatusesNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountStatusesNotAcceptable struct { +} + +// IsSuccess returns true when this account statuses not acceptable response has a 2xx status code +func (o *AccountStatusesNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account statuses not acceptable response has a 3xx status code +func (o *AccountStatusesNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account statuses not acceptable response has a 4xx status code +func (o *AccountStatusesNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account statuses not acceptable response has a 5xx status code +func (o *AccountStatusesNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account statuses not acceptable response a status code equal to that given +func (o *AccountStatusesNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account statuses not acceptable response +func (o *AccountStatusesNotAcceptable) Code() int { + return 406 +} + +func (o *AccountStatusesNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesNotAcceptable", 406) +} + +func (o *AccountStatusesNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesNotAcceptable", 406) +} + +func (o *AccountStatusesNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountStatusesInternalServerError creates a AccountStatusesInternalServerError with default headers values +func NewAccountStatusesInternalServerError() *AccountStatusesInternalServerError { + return &AccountStatusesInternalServerError{} +} + +/* +AccountStatusesInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountStatusesInternalServerError struct { +} + +// IsSuccess returns true when this account statuses internal server error response has a 2xx status code +func (o *AccountStatusesInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account statuses internal server error response has a 3xx status code +func (o *AccountStatusesInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account statuses internal server error response has a 4xx status code +func (o *AccountStatusesInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account statuses internal server error response has a 5xx status code +func (o *AccountStatusesInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account statuses internal server error response a status code equal to that given +func (o *AccountStatusesInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account statuses internal server error response +func (o *AccountStatusesInternalServerError) Code() int { + return 500 +} + +func (o *AccountStatusesInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesInternalServerError", 500) +} + +func (o *AccountStatusesInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesInternalServerError", 500) +} + +func (o *AccountStatusesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_themes_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_themes_parameters.go new file mode 100644 index 0000000..cc79bd1 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_themes_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountThemesParams creates a new AccountThemesParams 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 NewAccountThemesParams() *AccountThemesParams { + return &AccountThemesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountThemesParamsWithTimeout creates a new AccountThemesParams object +// with the ability to set a timeout on a request. +func NewAccountThemesParamsWithTimeout(timeout time.Duration) *AccountThemesParams { + return &AccountThemesParams{ + timeout: timeout, + } +} + +// NewAccountThemesParamsWithContext creates a new AccountThemesParams object +// with the ability to set a context for a request. +func NewAccountThemesParamsWithContext(ctx context.Context) *AccountThemesParams { + return &AccountThemesParams{ + Context: ctx, + } +} + +// NewAccountThemesParamsWithHTTPClient creates a new AccountThemesParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountThemesParamsWithHTTPClient(client *http.Client) *AccountThemesParams { + return &AccountThemesParams{ + HTTPClient: client, + } +} + +/* +AccountThemesParams contains all the parameters to send to the API endpoint + + for the account themes operation. + + Typically these are written to a http.Request. +*/ +type AccountThemesParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account themes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountThemesParams) WithDefaults() *AccountThemesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account themes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountThemesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account themes params +func (o *AccountThemesParams) WithTimeout(timeout time.Duration) *AccountThemesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account themes params +func (o *AccountThemesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account themes params +func (o *AccountThemesParams) WithContext(ctx context.Context) *AccountThemesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account themes params +func (o *AccountThemesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account themes params +func (o *AccountThemesParams) WithHTTPClient(client *http.Client) *AccountThemesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account themes params +func (o *AccountThemesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountThemesParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_themes_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_themes_responses.go new file mode 100644 index 0000000..55620f4 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_themes_responses.go @@ -0,0 +1,414 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountThemesReader is a Reader for the AccountThemes structure. +type AccountThemesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountThemesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountThemesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountThemesBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountThemesUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountThemesNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountThemesNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountThemesInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/accounts/themes] accountThemes", response, response.Code()) + } +} + +// NewAccountThemesOK creates a AccountThemesOK with default headers values +func NewAccountThemesOK() *AccountThemesOK { + return &AccountThemesOK{} +} + +/* +AccountThemesOK describes a response with status code 200, with default header values. + +Array of themes. +*/ +type AccountThemesOK struct { + Payload []*models.Theme +} + +// IsSuccess returns true when this account themes o k response has a 2xx status code +func (o *AccountThemesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account themes o k response has a 3xx status code +func (o *AccountThemesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account themes o k response has a 4xx status code +func (o *AccountThemesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account themes o k response has a 5xx status code +func (o *AccountThemesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account themes o k response a status code equal to that given +func (o *AccountThemesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account themes o k response +func (o *AccountThemesOK) Code() int { + return 200 +} + +func (o *AccountThemesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesOK %s", 200, payload) +} + +func (o *AccountThemesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesOK %s", 200, payload) +} + +func (o *AccountThemesOK) GetPayload() []*models.Theme { + return o.Payload +} + +func (o *AccountThemesOK) 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 +} + +// NewAccountThemesBadRequest creates a AccountThemesBadRequest with default headers values +func NewAccountThemesBadRequest() *AccountThemesBadRequest { + return &AccountThemesBadRequest{} +} + +/* +AccountThemesBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountThemesBadRequest struct { +} + +// IsSuccess returns true when this account themes bad request response has a 2xx status code +func (o *AccountThemesBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account themes bad request response has a 3xx status code +func (o *AccountThemesBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account themes bad request response has a 4xx status code +func (o *AccountThemesBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account themes bad request response has a 5xx status code +func (o *AccountThemesBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account themes bad request response a status code equal to that given +func (o *AccountThemesBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account themes bad request response +func (o *AccountThemesBadRequest) Code() int { + return 400 +} + +func (o *AccountThemesBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesBadRequest", 400) +} + +func (o *AccountThemesBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesBadRequest", 400) +} + +func (o *AccountThemesBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountThemesUnauthorized creates a AccountThemesUnauthorized with default headers values +func NewAccountThemesUnauthorized() *AccountThemesUnauthorized { + return &AccountThemesUnauthorized{} +} + +/* +AccountThemesUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountThemesUnauthorized struct { +} + +// IsSuccess returns true when this account themes unauthorized response has a 2xx status code +func (o *AccountThemesUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account themes unauthorized response has a 3xx status code +func (o *AccountThemesUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account themes unauthorized response has a 4xx status code +func (o *AccountThemesUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account themes unauthorized response has a 5xx status code +func (o *AccountThemesUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account themes unauthorized response a status code equal to that given +func (o *AccountThemesUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account themes unauthorized response +func (o *AccountThemesUnauthorized) Code() int { + return 401 +} + +func (o *AccountThemesUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesUnauthorized", 401) +} + +func (o *AccountThemesUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesUnauthorized", 401) +} + +func (o *AccountThemesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountThemesNotFound creates a AccountThemesNotFound with default headers values +func NewAccountThemesNotFound() *AccountThemesNotFound { + return &AccountThemesNotFound{} +} + +/* +AccountThemesNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountThemesNotFound struct { +} + +// IsSuccess returns true when this account themes not found response has a 2xx status code +func (o *AccountThemesNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account themes not found response has a 3xx status code +func (o *AccountThemesNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account themes not found response has a 4xx status code +func (o *AccountThemesNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account themes not found response has a 5xx status code +func (o *AccountThemesNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account themes not found response a status code equal to that given +func (o *AccountThemesNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account themes not found response +func (o *AccountThemesNotFound) Code() int { + return 404 +} + +func (o *AccountThemesNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesNotFound", 404) +} + +func (o *AccountThemesNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesNotFound", 404) +} + +func (o *AccountThemesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountThemesNotAcceptable creates a AccountThemesNotAcceptable with default headers values +func NewAccountThemesNotAcceptable() *AccountThemesNotAcceptable { + return &AccountThemesNotAcceptable{} +} + +/* +AccountThemesNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountThemesNotAcceptable struct { +} + +// IsSuccess returns true when this account themes not acceptable response has a 2xx status code +func (o *AccountThemesNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account themes not acceptable response has a 3xx status code +func (o *AccountThemesNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account themes not acceptable response has a 4xx status code +func (o *AccountThemesNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account themes not acceptable response has a 5xx status code +func (o *AccountThemesNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account themes not acceptable response a status code equal to that given +func (o *AccountThemesNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account themes not acceptable response +func (o *AccountThemesNotAcceptable) Code() int { + return 406 +} + +func (o *AccountThemesNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesNotAcceptable", 406) +} + +func (o *AccountThemesNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesNotAcceptable", 406) +} + +func (o *AccountThemesNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountThemesInternalServerError creates a AccountThemesInternalServerError with default headers values +func NewAccountThemesInternalServerError() *AccountThemesInternalServerError { + return &AccountThemesInternalServerError{} +} + +/* +AccountThemesInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountThemesInternalServerError struct { +} + +// IsSuccess returns true when this account themes internal server error response has a 2xx status code +func (o *AccountThemesInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account themes internal server error response has a 3xx status code +func (o *AccountThemesInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account themes internal server error response has a 4xx status code +func (o *AccountThemesInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account themes internal server error response has a 5xx status code +func (o *AccountThemesInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account themes internal server error response a status code equal to that given +func (o *AccountThemesInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account themes internal server error response +func (o *AccountThemesInternalServerError) Code() int { + return 500 +} + +func (o *AccountThemesInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesInternalServerError", 500) +} + +func (o *AccountThemesInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesInternalServerError", 500) +} + +func (o *AccountThemesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_unblock_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_unblock_parameters.go new file mode 100644 index 0000000..379bdf2 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_unblock_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountUnblockParams creates a new AccountUnblockParams 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 NewAccountUnblockParams() *AccountUnblockParams { + return &AccountUnblockParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountUnblockParamsWithTimeout creates a new AccountUnblockParams object +// with the ability to set a timeout on a request. +func NewAccountUnblockParamsWithTimeout(timeout time.Duration) *AccountUnblockParams { + return &AccountUnblockParams{ + timeout: timeout, + } +} + +// NewAccountUnblockParamsWithContext creates a new AccountUnblockParams object +// with the ability to set a context for a request. +func NewAccountUnblockParamsWithContext(ctx context.Context) *AccountUnblockParams { + return &AccountUnblockParams{ + Context: ctx, + } +} + +// NewAccountUnblockParamsWithHTTPClient creates a new AccountUnblockParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountUnblockParamsWithHTTPClient(client *http.Client) *AccountUnblockParams { + return &AccountUnblockParams{ + HTTPClient: client, + } +} + +/* +AccountUnblockParams contains all the parameters to send to the API endpoint + + for the account unblock operation. + + Typically these are written to a http.Request. +*/ +type AccountUnblockParams struct { + + /* ID. + + The id of the account to unblock. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account unblock params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountUnblockParams) WithDefaults() *AccountUnblockParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account unblock params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountUnblockParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account unblock params +func (o *AccountUnblockParams) WithTimeout(timeout time.Duration) *AccountUnblockParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account unblock params +func (o *AccountUnblockParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account unblock params +func (o *AccountUnblockParams) WithContext(ctx context.Context) *AccountUnblockParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account unblock params +func (o *AccountUnblockParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account unblock params +func (o *AccountUnblockParams) WithHTTPClient(client *http.Client) *AccountUnblockParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account unblock params +func (o *AccountUnblockParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the account unblock params +func (o *AccountUnblockParams) WithID(id string) *AccountUnblockParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account unblock params +func (o *AccountUnblockParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountUnblockParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_unblock_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_unblock_responses.go new file mode 100644 index 0000000..bc0f27b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_unblock_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountUnblockReader is a Reader for the AccountUnblock structure. +type AccountUnblockReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountUnblockReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountUnblockOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountUnblockBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountUnblockUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountUnblockNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountUnblockNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountUnblockInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts/{id}/unblock] accountUnblock", response, response.Code()) + } +} + +// NewAccountUnblockOK creates a AccountUnblockOK with default headers values +func NewAccountUnblockOK() *AccountUnblockOK { + return &AccountUnblockOK{} +} + +/* +AccountUnblockOK describes a response with status code 200, with default header values. + +Your relationship to this account. +*/ +type AccountUnblockOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this account unblock o k response has a 2xx status code +func (o *AccountUnblockOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account unblock o k response has a 3xx status code +func (o *AccountUnblockOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unblock o k response has a 4xx status code +func (o *AccountUnblockOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account unblock o k response has a 5xx status code +func (o *AccountUnblockOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account unblock o k response a status code equal to that given +func (o *AccountUnblockOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account unblock o k response +func (o *AccountUnblockOK) Code() int { + return 200 +} + +func (o *AccountUnblockOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockOK %s", 200, payload) +} + +func (o *AccountUnblockOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockOK %s", 200, payload) +} + +func (o *AccountUnblockOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *AccountUnblockOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountUnblockBadRequest creates a AccountUnblockBadRequest with default headers values +func NewAccountUnblockBadRequest() *AccountUnblockBadRequest { + return &AccountUnblockBadRequest{} +} + +/* +AccountUnblockBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountUnblockBadRequest struct { +} + +// IsSuccess returns true when this account unblock bad request response has a 2xx status code +func (o *AccountUnblockBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unblock bad request response has a 3xx status code +func (o *AccountUnblockBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unblock bad request response has a 4xx status code +func (o *AccountUnblockBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unblock bad request response has a 5xx status code +func (o *AccountUnblockBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account unblock bad request response a status code equal to that given +func (o *AccountUnblockBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account unblock bad request response +func (o *AccountUnblockBadRequest) Code() int { + return 400 +} + +func (o *AccountUnblockBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockBadRequest", 400) +} + +func (o *AccountUnblockBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockBadRequest", 400) +} + +func (o *AccountUnblockBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnblockUnauthorized creates a AccountUnblockUnauthorized with default headers values +func NewAccountUnblockUnauthorized() *AccountUnblockUnauthorized { + return &AccountUnblockUnauthorized{} +} + +/* +AccountUnblockUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountUnblockUnauthorized struct { +} + +// IsSuccess returns true when this account unblock unauthorized response has a 2xx status code +func (o *AccountUnblockUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unblock unauthorized response has a 3xx status code +func (o *AccountUnblockUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unblock unauthorized response has a 4xx status code +func (o *AccountUnblockUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unblock unauthorized response has a 5xx status code +func (o *AccountUnblockUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account unblock unauthorized response a status code equal to that given +func (o *AccountUnblockUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account unblock unauthorized response +func (o *AccountUnblockUnauthorized) Code() int { + return 401 +} + +func (o *AccountUnblockUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockUnauthorized", 401) +} + +func (o *AccountUnblockUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockUnauthorized", 401) +} + +func (o *AccountUnblockUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnblockNotFound creates a AccountUnblockNotFound with default headers values +func NewAccountUnblockNotFound() *AccountUnblockNotFound { + return &AccountUnblockNotFound{} +} + +/* +AccountUnblockNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountUnblockNotFound struct { +} + +// IsSuccess returns true when this account unblock not found response has a 2xx status code +func (o *AccountUnblockNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unblock not found response has a 3xx status code +func (o *AccountUnblockNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unblock not found response has a 4xx status code +func (o *AccountUnblockNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unblock not found response has a 5xx status code +func (o *AccountUnblockNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account unblock not found response a status code equal to that given +func (o *AccountUnblockNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account unblock not found response +func (o *AccountUnblockNotFound) Code() int { + return 404 +} + +func (o *AccountUnblockNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockNotFound", 404) +} + +func (o *AccountUnblockNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockNotFound", 404) +} + +func (o *AccountUnblockNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnblockNotAcceptable creates a AccountUnblockNotAcceptable with default headers values +func NewAccountUnblockNotAcceptable() *AccountUnblockNotAcceptable { + return &AccountUnblockNotAcceptable{} +} + +/* +AccountUnblockNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountUnblockNotAcceptable struct { +} + +// IsSuccess returns true when this account unblock not acceptable response has a 2xx status code +func (o *AccountUnblockNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unblock not acceptable response has a 3xx status code +func (o *AccountUnblockNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unblock not acceptable response has a 4xx status code +func (o *AccountUnblockNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unblock not acceptable response has a 5xx status code +func (o *AccountUnblockNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account unblock not acceptable response a status code equal to that given +func (o *AccountUnblockNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account unblock not acceptable response +func (o *AccountUnblockNotAcceptable) Code() int { + return 406 +} + +func (o *AccountUnblockNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockNotAcceptable", 406) +} + +func (o *AccountUnblockNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockNotAcceptable", 406) +} + +func (o *AccountUnblockNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnblockInternalServerError creates a AccountUnblockInternalServerError with default headers values +func NewAccountUnblockInternalServerError() *AccountUnblockInternalServerError { + return &AccountUnblockInternalServerError{} +} + +/* +AccountUnblockInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountUnblockInternalServerError struct { +} + +// IsSuccess returns true when this account unblock internal server error response has a 2xx status code +func (o *AccountUnblockInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unblock internal server error response has a 3xx status code +func (o *AccountUnblockInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unblock internal server error response has a 4xx status code +func (o *AccountUnblockInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account unblock internal server error response has a 5xx status code +func (o *AccountUnblockInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account unblock internal server error response a status code equal to that given +func (o *AccountUnblockInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account unblock internal server error response +func (o *AccountUnblockInternalServerError) Code() int { + return 500 +} + +func (o *AccountUnblockInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockInternalServerError", 500) +} + +func (o *AccountUnblockInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockInternalServerError", 500) +} + +func (o *AccountUnblockInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_unfollow_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_unfollow_parameters.go new file mode 100644 index 0000000..cd88514 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_unfollow_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountUnfollowParams creates a new AccountUnfollowParams 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 NewAccountUnfollowParams() *AccountUnfollowParams { + return &AccountUnfollowParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountUnfollowParamsWithTimeout creates a new AccountUnfollowParams object +// with the ability to set a timeout on a request. +func NewAccountUnfollowParamsWithTimeout(timeout time.Duration) *AccountUnfollowParams { + return &AccountUnfollowParams{ + timeout: timeout, + } +} + +// NewAccountUnfollowParamsWithContext creates a new AccountUnfollowParams object +// with the ability to set a context for a request. +func NewAccountUnfollowParamsWithContext(ctx context.Context) *AccountUnfollowParams { + return &AccountUnfollowParams{ + Context: ctx, + } +} + +// NewAccountUnfollowParamsWithHTTPClient creates a new AccountUnfollowParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountUnfollowParamsWithHTTPClient(client *http.Client) *AccountUnfollowParams { + return &AccountUnfollowParams{ + HTTPClient: client, + } +} + +/* +AccountUnfollowParams contains all the parameters to send to the API endpoint + + for the account unfollow operation. + + Typically these are written to a http.Request. +*/ +type AccountUnfollowParams struct { + + /* ID. + + The id of the account to unfollow. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account unfollow params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountUnfollowParams) WithDefaults() *AccountUnfollowParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account unfollow params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountUnfollowParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account unfollow params +func (o *AccountUnfollowParams) WithTimeout(timeout time.Duration) *AccountUnfollowParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account unfollow params +func (o *AccountUnfollowParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account unfollow params +func (o *AccountUnfollowParams) WithContext(ctx context.Context) *AccountUnfollowParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account unfollow params +func (o *AccountUnfollowParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account unfollow params +func (o *AccountUnfollowParams) WithHTTPClient(client *http.Client) *AccountUnfollowParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account unfollow params +func (o *AccountUnfollowParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the account unfollow params +func (o *AccountUnfollowParams) WithID(id string) *AccountUnfollowParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account unfollow params +func (o *AccountUnfollowParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountUnfollowParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_unfollow_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_unfollow_responses.go new file mode 100644 index 0000000..03e6d9c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_unfollow_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountUnfollowReader is a Reader for the AccountUnfollow structure. +type AccountUnfollowReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountUnfollowReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountUnfollowOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountUnfollowBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountUnfollowUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountUnfollowNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountUnfollowNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountUnfollowInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts/{id}/unfollow] accountUnfollow", response, response.Code()) + } +} + +// NewAccountUnfollowOK creates a AccountUnfollowOK with default headers values +func NewAccountUnfollowOK() *AccountUnfollowOK { + return &AccountUnfollowOK{} +} + +/* +AccountUnfollowOK describes a response with status code 200, with default header values. + +Your relationship to this account. +*/ +type AccountUnfollowOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this account unfollow o k response has a 2xx status code +func (o *AccountUnfollowOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account unfollow o k response has a 3xx status code +func (o *AccountUnfollowOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unfollow o k response has a 4xx status code +func (o *AccountUnfollowOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account unfollow o k response has a 5xx status code +func (o *AccountUnfollowOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account unfollow o k response a status code equal to that given +func (o *AccountUnfollowOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account unfollow o k response +func (o *AccountUnfollowOK) Code() int { + return 200 +} + +func (o *AccountUnfollowOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowOK %s", 200, payload) +} + +func (o *AccountUnfollowOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowOK %s", 200, payload) +} + +func (o *AccountUnfollowOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *AccountUnfollowOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountUnfollowBadRequest creates a AccountUnfollowBadRequest with default headers values +func NewAccountUnfollowBadRequest() *AccountUnfollowBadRequest { + return &AccountUnfollowBadRequest{} +} + +/* +AccountUnfollowBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountUnfollowBadRequest struct { +} + +// IsSuccess returns true when this account unfollow bad request response has a 2xx status code +func (o *AccountUnfollowBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unfollow bad request response has a 3xx status code +func (o *AccountUnfollowBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unfollow bad request response has a 4xx status code +func (o *AccountUnfollowBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unfollow bad request response has a 5xx status code +func (o *AccountUnfollowBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account unfollow bad request response a status code equal to that given +func (o *AccountUnfollowBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account unfollow bad request response +func (o *AccountUnfollowBadRequest) Code() int { + return 400 +} + +func (o *AccountUnfollowBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowBadRequest", 400) +} + +func (o *AccountUnfollowBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowBadRequest", 400) +} + +func (o *AccountUnfollowBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnfollowUnauthorized creates a AccountUnfollowUnauthorized with default headers values +func NewAccountUnfollowUnauthorized() *AccountUnfollowUnauthorized { + return &AccountUnfollowUnauthorized{} +} + +/* +AccountUnfollowUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountUnfollowUnauthorized struct { +} + +// IsSuccess returns true when this account unfollow unauthorized response has a 2xx status code +func (o *AccountUnfollowUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unfollow unauthorized response has a 3xx status code +func (o *AccountUnfollowUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unfollow unauthorized response has a 4xx status code +func (o *AccountUnfollowUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unfollow unauthorized response has a 5xx status code +func (o *AccountUnfollowUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account unfollow unauthorized response a status code equal to that given +func (o *AccountUnfollowUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account unfollow unauthorized response +func (o *AccountUnfollowUnauthorized) Code() int { + return 401 +} + +func (o *AccountUnfollowUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowUnauthorized", 401) +} + +func (o *AccountUnfollowUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowUnauthorized", 401) +} + +func (o *AccountUnfollowUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnfollowNotFound creates a AccountUnfollowNotFound with default headers values +func NewAccountUnfollowNotFound() *AccountUnfollowNotFound { + return &AccountUnfollowNotFound{} +} + +/* +AccountUnfollowNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountUnfollowNotFound struct { +} + +// IsSuccess returns true when this account unfollow not found response has a 2xx status code +func (o *AccountUnfollowNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unfollow not found response has a 3xx status code +func (o *AccountUnfollowNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unfollow not found response has a 4xx status code +func (o *AccountUnfollowNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unfollow not found response has a 5xx status code +func (o *AccountUnfollowNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account unfollow not found response a status code equal to that given +func (o *AccountUnfollowNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account unfollow not found response +func (o *AccountUnfollowNotFound) Code() int { + return 404 +} + +func (o *AccountUnfollowNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowNotFound", 404) +} + +func (o *AccountUnfollowNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowNotFound", 404) +} + +func (o *AccountUnfollowNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnfollowNotAcceptable creates a AccountUnfollowNotAcceptable with default headers values +func NewAccountUnfollowNotAcceptable() *AccountUnfollowNotAcceptable { + return &AccountUnfollowNotAcceptable{} +} + +/* +AccountUnfollowNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountUnfollowNotAcceptable struct { +} + +// IsSuccess returns true when this account unfollow not acceptable response has a 2xx status code +func (o *AccountUnfollowNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unfollow not acceptable response has a 3xx status code +func (o *AccountUnfollowNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unfollow not acceptable response has a 4xx status code +func (o *AccountUnfollowNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unfollow not acceptable response has a 5xx status code +func (o *AccountUnfollowNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account unfollow not acceptable response a status code equal to that given +func (o *AccountUnfollowNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account unfollow not acceptable response +func (o *AccountUnfollowNotAcceptable) Code() int { + return 406 +} + +func (o *AccountUnfollowNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowNotAcceptable", 406) +} + +func (o *AccountUnfollowNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowNotAcceptable", 406) +} + +func (o *AccountUnfollowNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnfollowInternalServerError creates a AccountUnfollowInternalServerError with default headers values +func NewAccountUnfollowInternalServerError() *AccountUnfollowInternalServerError { + return &AccountUnfollowInternalServerError{} +} + +/* +AccountUnfollowInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountUnfollowInternalServerError struct { +} + +// IsSuccess returns true when this account unfollow internal server error response has a 2xx status code +func (o *AccountUnfollowInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unfollow internal server error response has a 3xx status code +func (o *AccountUnfollowInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unfollow internal server error response has a 4xx status code +func (o *AccountUnfollowInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account unfollow internal server error response has a 5xx status code +func (o *AccountUnfollowInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account unfollow internal server error response a status code equal to that given +func (o *AccountUnfollowInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account unfollow internal server error response +func (o *AccountUnfollowInternalServerError) Code() int { + return 500 +} + +func (o *AccountUnfollowInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowInternalServerError", 500) +} + +func (o *AccountUnfollowInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowInternalServerError", 500) +} + +func (o *AccountUnfollowInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_unmute_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_unmute_parameters.go new file mode 100644 index 0000000..0e30c9e --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_unmute_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountUnmuteParams creates a new AccountUnmuteParams 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 NewAccountUnmuteParams() *AccountUnmuteParams { + return &AccountUnmuteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountUnmuteParamsWithTimeout creates a new AccountUnmuteParams object +// with the ability to set a timeout on a request. +func NewAccountUnmuteParamsWithTimeout(timeout time.Duration) *AccountUnmuteParams { + return &AccountUnmuteParams{ + timeout: timeout, + } +} + +// NewAccountUnmuteParamsWithContext creates a new AccountUnmuteParams object +// with the ability to set a context for a request. +func NewAccountUnmuteParamsWithContext(ctx context.Context) *AccountUnmuteParams { + return &AccountUnmuteParams{ + Context: ctx, + } +} + +// NewAccountUnmuteParamsWithHTTPClient creates a new AccountUnmuteParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountUnmuteParamsWithHTTPClient(client *http.Client) *AccountUnmuteParams { + return &AccountUnmuteParams{ + HTTPClient: client, + } +} + +/* +AccountUnmuteParams contains all the parameters to send to the API endpoint + + for the account unmute operation. + + Typically these are written to a http.Request. +*/ +type AccountUnmuteParams struct { + + /* ID. + + The ID of the account to unmute. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account unmute params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountUnmuteParams) WithDefaults() *AccountUnmuteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account unmute params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountUnmuteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account unmute params +func (o *AccountUnmuteParams) WithTimeout(timeout time.Duration) *AccountUnmuteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account unmute params +func (o *AccountUnmuteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account unmute params +func (o *AccountUnmuteParams) WithContext(ctx context.Context) *AccountUnmuteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account unmute params +func (o *AccountUnmuteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account unmute params +func (o *AccountUnmuteParams) WithHTTPClient(client *http.Client) *AccountUnmuteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account unmute params +func (o *AccountUnmuteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the account unmute params +func (o *AccountUnmuteParams) WithID(id string) *AccountUnmuteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account unmute params +func (o *AccountUnmuteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountUnmuteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_unmute_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_unmute_responses.go new file mode 100644 index 0000000..a2371a3 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_unmute_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountUnmuteReader is a Reader for the AccountUnmute structure. +type AccountUnmuteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountUnmuteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountUnmuteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountUnmuteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountUnmuteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountUnmuteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountUnmuteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountUnmuteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts/{id}/unmute] accountUnmute", response, response.Code()) + } +} + +// NewAccountUnmuteOK creates a AccountUnmuteOK with default headers values +func NewAccountUnmuteOK() *AccountUnmuteOK { + return &AccountUnmuteOK{} +} + +/* +AccountUnmuteOK describes a response with status code 200, with default header values. + +Your relationship to this account. +*/ +type AccountUnmuteOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this account unmute o k response has a 2xx status code +func (o *AccountUnmuteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account unmute o k response has a 3xx status code +func (o *AccountUnmuteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unmute o k response has a 4xx status code +func (o *AccountUnmuteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account unmute o k response has a 5xx status code +func (o *AccountUnmuteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account unmute o k response a status code equal to that given +func (o *AccountUnmuteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account unmute o k response +func (o *AccountUnmuteOK) Code() int { + return 200 +} + +func (o *AccountUnmuteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteOK %s", 200, payload) +} + +func (o *AccountUnmuteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteOK %s", 200, payload) +} + +func (o *AccountUnmuteOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *AccountUnmuteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountUnmuteBadRequest creates a AccountUnmuteBadRequest with default headers values +func NewAccountUnmuteBadRequest() *AccountUnmuteBadRequest { + return &AccountUnmuteBadRequest{} +} + +/* +AccountUnmuteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountUnmuteBadRequest struct { +} + +// IsSuccess returns true when this account unmute bad request response has a 2xx status code +func (o *AccountUnmuteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unmute bad request response has a 3xx status code +func (o *AccountUnmuteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unmute bad request response has a 4xx status code +func (o *AccountUnmuteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unmute bad request response has a 5xx status code +func (o *AccountUnmuteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account unmute bad request response a status code equal to that given +func (o *AccountUnmuteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account unmute bad request response +func (o *AccountUnmuteBadRequest) Code() int { + return 400 +} + +func (o *AccountUnmuteBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteBadRequest", 400) +} + +func (o *AccountUnmuteBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteBadRequest", 400) +} + +func (o *AccountUnmuteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnmuteUnauthorized creates a AccountUnmuteUnauthorized with default headers values +func NewAccountUnmuteUnauthorized() *AccountUnmuteUnauthorized { + return &AccountUnmuteUnauthorized{} +} + +/* +AccountUnmuteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountUnmuteUnauthorized struct { +} + +// IsSuccess returns true when this account unmute unauthorized response has a 2xx status code +func (o *AccountUnmuteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unmute unauthorized response has a 3xx status code +func (o *AccountUnmuteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unmute unauthorized response has a 4xx status code +func (o *AccountUnmuteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unmute unauthorized response has a 5xx status code +func (o *AccountUnmuteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account unmute unauthorized response a status code equal to that given +func (o *AccountUnmuteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account unmute unauthorized response +func (o *AccountUnmuteUnauthorized) Code() int { + return 401 +} + +func (o *AccountUnmuteUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteUnauthorized", 401) +} + +func (o *AccountUnmuteUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteUnauthorized", 401) +} + +func (o *AccountUnmuteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnmuteNotFound creates a AccountUnmuteNotFound with default headers values +func NewAccountUnmuteNotFound() *AccountUnmuteNotFound { + return &AccountUnmuteNotFound{} +} + +/* +AccountUnmuteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountUnmuteNotFound struct { +} + +// IsSuccess returns true when this account unmute not found response has a 2xx status code +func (o *AccountUnmuteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unmute not found response has a 3xx status code +func (o *AccountUnmuteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unmute not found response has a 4xx status code +func (o *AccountUnmuteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unmute not found response has a 5xx status code +func (o *AccountUnmuteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account unmute not found response a status code equal to that given +func (o *AccountUnmuteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account unmute not found response +func (o *AccountUnmuteNotFound) Code() int { + return 404 +} + +func (o *AccountUnmuteNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteNotFound", 404) +} + +func (o *AccountUnmuteNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteNotFound", 404) +} + +func (o *AccountUnmuteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnmuteNotAcceptable creates a AccountUnmuteNotAcceptable with default headers values +func NewAccountUnmuteNotAcceptable() *AccountUnmuteNotAcceptable { + return &AccountUnmuteNotAcceptable{} +} + +/* +AccountUnmuteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountUnmuteNotAcceptable struct { +} + +// IsSuccess returns true when this account unmute not acceptable response has a 2xx status code +func (o *AccountUnmuteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unmute not acceptable response has a 3xx status code +func (o *AccountUnmuteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unmute not acceptable response has a 4xx status code +func (o *AccountUnmuteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unmute not acceptable response has a 5xx status code +func (o *AccountUnmuteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account unmute not acceptable response a status code equal to that given +func (o *AccountUnmuteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account unmute not acceptable response +func (o *AccountUnmuteNotAcceptable) Code() int { + return 406 +} + +func (o *AccountUnmuteNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteNotAcceptable", 406) +} + +func (o *AccountUnmuteNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteNotAcceptable", 406) +} + +func (o *AccountUnmuteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnmuteInternalServerError creates a AccountUnmuteInternalServerError with default headers values +func NewAccountUnmuteInternalServerError() *AccountUnmuteInternalServerError { + return &AccountUnmuteInternalServerError{} +} + +/* +AccountUnmuteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountUnmuteInternalServerError struct { +} + +// IsSuccess returns true when this account unmute internal server error response has a 2xx status code +func (o *AccountUnmuteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unmute internal server error response has a 3xx status code +func (o *AccountUnmuteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unmute internal server error response has a 4xx status code +func (o *AccountUnmuteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account unmute internal server error response has a 5xx status code +func (o *AccountUnmuteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account unmute internal server error response a status code equal to that given +func (o *AccountUnmuteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account unmute internal server error response +func (o *AccountUnmuteInternalServerError) Code() int { + return 500 +} + +func (o *AccountUnmuteInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteInternalServerError", 500) +} + +func (o *AccountUnmuteInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteInternalServerError", 500) +} + +func (o *AccountUnmuteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_update_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_update_parameters.go new file mode 100644 index 0000000..a149197 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_update_parameters.go @@ -0,0 +1,1016 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountUpdateParams creates a new AccountUpdateParams 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 NewAccountUpdateParams() *AccountUpdateParams { + return &AccountUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountUpdateParamsWithTimeout creates a new AccountUpdateParams object +// with the ability to set a timeout on a request. +func NewAccountUpdateParamsWithTimeout(timeout time.Duration) *AccountUpdateParams { + return &AccountUpdateParams{ + timeout: timeout, + } +} + +// NewAccountUpdateParamsWithContext creates a new AccountUpdateParams object +// with the ability to set a context for a request. +func NewAccountUpdateParamsWithContext(ctx context.Context) *AccountUpdateParams { + return &AccountUpdateParams{ + Context: ctx, + } +} + +// NewAccountUpdateParamsWithHTTPClient creates a new AccountUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountUpdateParamsWithHTTPClient(client *http.Client) *AccountUpdateParams { + return &AccountUpdateParams{ + HTTPClient: client, + } +} + +/* +AccountUpdateParams contains all the parameters to send to the API endpoint + + for the account update operation. + + Typically these are written to a http.Request. +*/ +type AccountUpdateParams struct { + + /* Avatar. + + Avatar of the user. + */ + Avatar runtime.NamedReadCloser + + /* AvatarDescription. + + Description of avatar image, for alt-text. + */ + AvatarDescription string + + /* Bot. + + Account is flagged as a bot. + */ + Bot *bool + + /* CustomCSS. + + Custom CSS to use when rendering this account's profile or statuses. String must be no more than 5,000 characters (~5kb). + */ + CustomCSS *string + + /* Discoverable. + + Account should be made discoverable and shown in the profile directory (if enabled). + */ + Discoverable *bool + + /* DisplayName. + + The display name to use for the account. + */ + DisplayName string + + /* EnableRss. + + Enable RSS feed for this account's Public posts at `/[username]/feed.rss` + */ + EnableRss *bool + + /* FieldsAttributes0Name. + + Name of 1st profile field to be added to this account's profile. (The index may be any string; add more indexes to send more fields.) + */ + FieldsAttributes0Name *string + + /* FieldsAttributes0Value. + + Value of 1st profile field to be added to this account's profile. (The index may be any string; add more indexes to send more fields.) + */ + FieldsAttributes0Value *string + + /* FieldsAttributes1Name. + + Name of 2nd profile field to be added to this account's profile. + */ + FieldsAttributes1Name *string + + /* FieldsAttributes1Value. + + Value of 2nd profile field to be added to this account's profile. + */ + FieldsAttributes1Value *string + + /* FieldsAttributes2Name. + + Name of 3rd profile field to be added to this account's profile. + */ + FieldsAttributes2Name *string + + /* FieldsAttributes2Value. + + Value of 3rd profile field to be added to this account's profile. + */ + FieldsAttributes2Value *string + + /* FieldsAttributes3Name. + + Name of 4th profile field to be added to this account's profile. + */ + FieldsAttributes3Name *string + + /* FieldsAttributes3Value. + + Value of 4th profile field to be added to this account's profile. + */ + FieldsAttributes3Value *string + + /* FieldsAttributes4Name. + + Name of 5th profile field to be added to this account's profile. + */ + FieldsAttributes4Name *string + + /* FieldsAttributes4Value. + + Value of 5th profile field to be added to this account's profile. + */ + FieldsAttributes4Value *string + + /* FieldsAttributes5Name. + + Name of 6th profile field to be added to this account's profile. + */ + FieldsAttributes5Name *string + + /* FieldsAttributes5Value. + + Value of 6th profile field to be added to this account's profile. + */ + FieldsAttributes5Value *string + + /* Header. + + Header of the user. + */ + Header runtime.NamedReadCloser + + /* HeaderDescription. + + Description of header image, for alt-text. + */ + HeaderDescription string + + /* HideCollections. + + Hide the account's following/followers collections. + */ + HideCollections *bool + + /* Locked. + + Require manual approval of follow requests. + */ + Locked *bool + + /* Note. + + Bio/description of this account. + */ + Note string + + /* SourceLanguage. + + Default language to use for authored statuses (ISO 6391). + */ + SourceLanguage *string + + /* SourcePrivacy. + + Default post privacy for authored statuses. + */ + SourcePrivacy *string + + /* SourceSensitive. + + Mark authored statuses as sensitive by default. + */ + SourceSensitive *bool + + /* SourceStatusContentType. + + Default content type to use for authored statuses (text/plain or text/markdown). + */ + SourceStatusContentType *string + + /* Theme. + + FileName of the theme to use when rendering this account's profile or statuses. The theme must exist on this server, as indicated by /api/v1/accounts/themes. Empty string unsets theme and returns to the default GoToSocial theme. + */ + Theme *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountUpdateParams) WithDefaults() *AccountUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account update params +func (o *AccountUpdateParams) WithTimeout(timeout time.Duration) *AccountUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account update params +func (o *AccountUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account update params +func (o *AccountUpdateParams) WithContext(ctx context.Context) *AccountUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account update params +func (o *AccountUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account update params +func (o *AccountUpdateParams) WithHTTPClient(client *http.Client) *AccountUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account update params +func (o *AccountUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAvatar adds the avatar to the account update params +func (o *AccountUpdateParams) WithAvatar(avatar runtime.NamedReadCloser) *AccountUpdateParams { + o.SetAvatar(avatar) + return o +} + +// SetAvatar adds the avatar to the account update params +func (o *AccountUpdateParams) SetAvatar(avatar runtime.NamedReadCloser) { + o.Avatar = avatar +} + +// WithAvatarDescription adds the avatarDescription to the account update params +func (o *AccountUpdateParams) WithAvatarDescription(avatarDescription string) *AccountUpdateParams { + o.SetAvatarDescription(avatarDescription) + return o +} + +// SetAvatarDescription adds the avatarDescription to the account update params +func (o *AccountUpdateParams) SetAvatarDescription(avatarDescription string) { + o.AvatarDescription = avatarDescription +} + +// WithBot adds the bot to the account update params +func (o *AccountUpdateParams) WithBot(bot *bool) *AccountUpdateParams { + o.SetBot(bot) + return o +} + +// SetBot adds the bot to the account update params +func (o *AccountUpdateParams) SetBot(bot *bool) { + o.Bot = bot +} + +// WithCustomCSS adds the customCSS to the account update params +func (o *AccountUpdateParams) WithCustomCSS(customCSS *string) *AccountUpdateParams { + o.SetCustomCSS(customCSS) + return o +} + +// SetCustomCSS adds the customCss to the account update params +func (o *AccountUpdateParams) SetCustomCSS(customCSS *string) { + o.CustomCSS = customCSS +} + +// WithDiscoverable adds the discoverable to the account update params +func (o *AccountUpdateParams) WithDiscoverable(discoverable *bool) *AccountUpdateParams { + o.SetDiscoverable(discoverable) + return o +} + +// SetDiscoverable adds the discoverable to the account update params +func (o *AccountUpdateParams) SetDiscoverable(discoverable *bool) { + o.Discoverable = discoverable +} + +// WithDisplayName adds the displayName to the account update params +func (o *AccountUpdateParams) WithDisplayName(displayName string) *AccountUpdateParams { + o.SetDisplayName(displayName) + return o +} + +// SetDisplayName adds the displayName to the account update params +func (o *AccountUpdateParams) SetDisplayName(displayName string) { + o.DisplayName = displayName +} + +// WithEnableRss adds the enableRss to the account update params +func (o *AccountUpdateParams) WithEnableRss(enableRss *bool) *AccountUpdateParams { + o.SetEnableRss(enableRss) + return o +} + +// SetEnableRss adds the enableRss to the account update params +func (o *AccountUpdateParams) SetEnableRss(enableRss *bool) { + o.EnableRss = enableRss +} + +// WithFieldsAttributes0Name adds the fieldsAttributes0Name to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes0Name(fieldsAttributes0Name *string) *AccountUpdateParams { + o.SetFieldsAttributes0Name(fieldsAttributes0Name) + return o +} + +// SetFieldsAttributes0Name adds the fieldsAttributes0Name to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes0Name(fieldsAttributes0Name *string) { + o.FieldsAttributes0Name = fieldsAttributes0Name +} + +// WithFieldsAttributes0Value adds the fieldsAttributes0Value to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes0Value(fieldsAttributes0Value *string) *AccountUpdateParams { + o.SetFieldsAttributes0Value(fieldsAttributes0Value) + return o +} + +// SetFieldsAttributes0Value adds the fieldsAttributes0Value to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes0Value(fieldsAttributes0Value *string) { + o.FieldsAttributes0Value = fieldsAttributes0Value +} + +// WithFieldsAttributes1Name adds the fieldsAttributes1Name to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes1Name(fieldsAttributes1Name *string) *AccountUpdateParams { + o.SetFieldsAttributes1Name(fieldsAttributes1Name) + return o +} + +// SetFieldsAttributes1Name adds the fieldsAttributes1Name to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes1Name(fieldsAttributes1Name *string) { + o.FieldsAttributes1Name = fieldsAttributes1Name +} + +// WithFieldsAttributes1Value adds the fieldsAttributes1Value to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes1Value(fieldsAttributes1Value *string) *AccountUpdateParams { + o.SetFieldsAttributes1Value(fieldsAttributes1Value) + return o +} + +// SetFieldsAttributes1Value adds the fieldsAttributes1Value to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes1Value(fieldsAttributes1Value *string) { + o.FieldsAttributes1Value = fieldsAttributes1Value +} + +// WithFieldsAttributes2Name adds the fieldsAttributes2Name to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes2Name(fieldsAttributes2Name *string) *AccountUpdateParams { + o.SetFieldsAttributes2Name(fieldsAttributes2Name) + return o +} + +// SetFieldsAttributes2Name adds the fieldsAttributes2Name to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes2Name(fieldsAttributes2Name *string) { + o.FieldsAttributes2Name = fieldsAttributes2Name +} + +// WithFieldsAttributes2Value adds the fieldsAttributes2Value to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes2Value(fieldsAttributes2Value *string) *AccountUpdateParams { + o.SetFieldsAttributes2Value(fieldsAttributes2Value) + return o +} + +// SetFieldsAttributes2Value adds the fieldsAttributes2Value to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes2Value(fieldsAttributes2Value *string) { + o.FieldsAttributes2Value = fieldsAttributes2Value +} + +// WithFieldsAttributes3Name adds the fieldsAttributes3Name to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes3Name(fieldsAttributes3Name *string) *AccountUpdateParams { + o.SetFieldsAttributes3Name(fieldsAttributes3Name) + return o +} + +// SetFieldsAttributes3Name adds the fieldsAttributes3Name to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes3Name(fieldsAttributes3Name *string) { + o.FieldsAttributes3Name = fieldsAttributes3Name +} + +// WithFieldsAttributes3Value adds the fieldsAttributes3Value to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes3Value(fieldsAttributes3Value *string) *AccountUpdateParams { + o.SetFieldsAttributes3Value(fieldsAttributes3Value) + return o +} + +// SetFieldsAttributes3Value adds the fieldsAttributes3Value to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes3Value(fieldsAttributes3Value *string) { + o.FieldsAttributes3Value = fieldsAttributes3Value +} + +// WithFieldsAttributes4Name adds the fieldsAttributes4Name to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes4Name(fieldsAttributes4Name *string) *AccountUpdateParams { + o.SetFieldsAttributes4Name(fieldsAttributes4Name) + return o +} + +// SetFieldsAttributes4Name adds the fieldsAttributes4Name to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes4Name(fieldsAttributes4Name *string) { + o.FieldsAttributes4Name = fieldsAttributes4Name +} + +// WithFieldsAttributes4Value adds the fieldsAttributes4Value to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes4Value(fieldsAttributes4Value *string) *AccountUpdateParams { + o.SetFieldsAttributes4Value(fieldsAttributes4Value) + return o +} + +// SetFieldsAttributes4Value adds the fieldsAttributes4Value to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes4Value(fieldsAttributes4Value *string) { + o.FieldsAttributes4Value = fieldsAttributes4Value +} + +// WithFieldsAttributes5Name adds the fieldsAttributes5Name to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes5Name(fieldsAttributes5Name *string) *AccountUpdateParams { + o.SetFieldsAttributes5Name(fieldsAttributes5Name) + return o +} + +// SetFieldsAttributes5Name adds the fieldsAttributes5Name to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes5Name(fieldsAttributes5Name *string) { + o.FieldsAttributes5Name = fieldsAttributes5Name +} + +// WithFieldsAttributes5Value adds the fieldsAttributes5Value to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes5Value(fieldsAttributes5Value *string) *AccountUpdateParams { + o.SetFieldsAttributes5Value(fieldsAttributes5Value) + return o +} + +// SetFieldsAttributes5Value adds the fieldsAttributes5Value to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes5Value(fieldsAttributes5Value *string) { + o.FieldsAttributes5Value = fieldsAttributes5Value +} + +// WithHeader adds the header to the account update params +func (o *AccountUpdateParams) WithHeader(header runtime.NamedReadCloser) *AccountUpdateParams { + o.SetHeader(header) + return o +} + +// SetHeader adds the header to the account update params +func (o *AccountUpdateParams) SetHeader(header runtime.NamedReadCloser) { + o.Header = header +} + +// WithHeaderDescription adds the headerDescription to the account update params +func (o *AccountUpdateParams) WithHeaderDescription(headerDescription string) *AccountUpdateParams { + o.SetHeaderDescription(headerDescription) + return o +} + +// SetHeaderDescription adds the headerDescription to the account update params +func (o *AccountUpdateParams) SetHeaderDescription(headerDescription string) { + o.HeaderDescription = headerDescription +} + +// WithHideCollections adds the hideCollections to the account update params +func (o *AccountUpdateParams) WithHideCollections(hideCollections *bool) *AccountUpdateParams { + o.SetHideCollections(hideCollections) + return o +} + +// SetHideCollections adds the hideCollections to the account update params +func (o *AccountUpdateParams) SetHideCollections(hideCollections *bool) { + o.HideCollections = hideCollections +} + +// WithLocked adds the locked to the account update params +func (o *AccountUpdateParams) WithLocked(locked *bool) *AccountUpdateParams { + o.SetLocked(locked) + return o +} + +// SetLocked adds the locked to the account update params +func (o *AccountUpdateParams) SetLocked(locked *bool) { + o.Locked = locked +} + +// WithNote adds the note to the account update params +func (o *AccountUpdateParams) WithNote(note string) *AccountUpdateParams { + o.SetNote(note) + return o +} + +// SetNote adds the note to the account update params +func (o *AccountUpdateParams) SetNote(note string) { + o.Note = note +} + +// WithSourceLanguage adds the sourceLanguage to the account update params +func (o *AccountUpdateParams) WithSourceLanguage(sourceLanguage *string) *AccountUpdateParams { + o.SetSourceLanguage(sourceLanguage) + return o +} + +// SetSourceLanguage adds the sourceLanguage to the account update params +func (o *AccountUpdateParams) SetSourceLanguage(sourceLanguage *string) { + o.SourceLanguage = sourceLanguage +} + +// WithSourcePrivacy adds the sourcePrivacy to the account update params +func (o *AccountUpdateParams) WithSourcePrivacy(sourcePrivacy *string) *AccountUpdateParams { + o.SetSourcePrivacy(sourcePrivacy) + return o +} + +// SetSourcePrivacy adds the sourcePrivacy to the account update params +func (o *AccountUpdateParams) SetSourcePrivacy(sourcePrivacy *string) { + o.SourcePrivacy = sourcePrivacy +} + +// WithSourceSensitive adds the sourceSensitive to the account update params +func (o *AccountUpdateParams) WithSourceSensitive(sourceSensitive *bool) *AccountUpdateParams { + o.SetSourceSensitive(sourceSensitive) + return o +} + +// SetSourceSensitive adds the sourceSensitive to the account update params +func (o *AccountUpdateParams) SetSourceSensitive(sourceSensitive *bool) { + o.SourceSensitive = sourceSensitive +} + +// WithSourceStatusContentType adds the sourceStatusContentType to the account update params +func (o *AccountUpdateParams) WithSourceStatusContentType(sourceStatusContentType *string) *AccountUpdateParams { + o.SetSourceStatusContentType(sourceStatusContentType) + return o +} + +// SetSourceStatusContentType adds the sourceStatusContentType to the account update params +func (o *AccountUpdateParams) SetSourceStatusContentType(sourceStatusContentType *string) { + o.SourceStatusContentType = sourceStatusContentType +} + +// WithTheme adds the theme to the account update params +func (o *AccountUpdateParams) WithTheme(theme *string) *AccountUpdateParams { + o.SetTheme(theme) + return o +} + +// SetTheme adds the theme to the account update params +func (o *AccountUpdateParams) SetTheme(theme *string) { + o.Theme = theme +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Avatar != nil { + + if o.Avatar != nil { + // form file param avatar + if err := r.SetFileParam("avatar", o.Avatar); err != nil { + return err + } + } + } + + // form param avatar_description + frAvatarDescription := o.AvatarDescription + fAvatarDescription := frAvatarDescription + if err := r.SetFormParam("avatar_description", fAvatarDescription); err != nil { + return err + } + + if o.Bot != nil { + + // form param bot + var frBot bool + if o.Bot != nil { + frBot = *o.Bot + } + fBot := swag.FormatBool(frBot) + if fBot != "" { + if err := r.SetFormParam("bot", fBot); err != nil { + return err + } + } + } + + if o.CustomCSS != nil { + + // form param custom_css + var frCustomCSS string + if o.CustomCSS != nil { + frCustomCSS = *o.CustomCSS + } + fCustomCSS := frCustomCSS + if fCustomCSS != "" { + if err := r.SetFormParam("custom_css", fCustomCSS); err != nil { + return err + } + } + } + + if o.Discoverable != nil { + + // form param discoverable + var frDiscoverable bool + if o.Discoverable != nil { + frDiscoverable = *o.Discoverable + } + fDiscoverable := swag.FormatBool(frDiscoverable) + if fDiscoverable != "" { + if err := r.SetFormParam("discoverable", fDiscoverable); err != nil { + return err + } + } + } + + // form param display_name + frDisplayName := o.DisplayName + fDisplayName := frDisplayName + if err := r.SetFormParam("display_name", fDisplayName); err != nil { + return err + } + + if o.EnableRss != nil { + + // form param enable_rss + var frEnableRss bool + if o.EnableRss != nil { + frEnableRss = *o.EnableRss + } + fEnableRss := swag.FormatBool(frEnableRss) + if fEnableRss != "" { + if err := r.SetFormParam("enable_rss", fEnableRss); err != nil { + return err + } + } + } + + if o.FieldsAttributes0Name != nil { + + // form param fields_attributes[0][name] + var frFieldsAttributes0Name string + if o.FieldsAttributes0Name != nil { + frFieldsAttributes0Name = *o.FieldsAttributes0Name + } + fFieldsAttributes0Name := frFieldsAttributes0Name + if fFieldsAttributes0Name != "" { + if err := r.SetFormParam("fields_attributes[0][name]", fFieldsAttributes0Name); err != nil { + return err + } + } + } + + if o.FieldsAttributes0Value != nil { + + // form param fields_attributes[0][value] + var frFieldsAttributes0Value string + if o.FieldsAttributes0Value != nil { + frFieldsAttributes0Value = *o.FieldsAttributes0Value + } + fFieldsAttributes0Value := frFieldsAttributes0Value + if fFieldsAttributes0Value != "" { + if err := r.SetFormParam("fields_attributes[0][value]", fFieldsAttributes0Value); err != nil { + return err + } + } + } + + if o.FieldsAttributes1Name != nil { + + // form param fields_attributes[1][name] + var frFieldsAttributes1Name string + if o.FieldsAttributes1Name != nil { + frFieldsAttributes1Name = *o.FieldsAttributes1Name + } + fFieldsAttributes1Name := frFieldsAttributes1Name + if fFieldsAttributes1Name != "" { + if err := r.SetFormParam("fields_attributes[1][name]", fFieldsAttributes1Name); err != nil { + return err + } + } + } + + if o.FieldsAttributes1Value != nil { + + // form param fields_attributes[1][value] + var frFieldsAttributes1Value string + if o.FieldsAttributes1Value != nil { + frFieldsAttributes1Value = *o.FieldsAttributes1Value + } + fFieldsAttributes1Value := frFieldsAttributes1Value + if fFieldsAttributes1Value != "" { + if err := r.SetFormParam("fields_attributes[1][value]", fFieldsAttributes1Value); err != nil { + return err + } + } + } + + if o.FieldsAttributes2Name != nil { + + // form param fields_attributes[2][name] + var frFieldsAttributes2Name string + if o.FieldsAttributes2Name != nil { + frFieldsAttributes2Name = *o.FieldsAttributes2Name + } + fFieldsAttributes2Name := frFieldsAttributes2Name + if fFieldsAttributes2Name != "" { + if err := r.SetFormParam("fields_attributes[2][name]", fFieldsAttributes2Name); err != nil { + return err + } + } + } + + if o.FieldsAttributes2Value != nil { + + // form param fields_attributes[2][value] + var frFieldsAttributes2Value string + if o.FieldsAttributes2Value != nil { + frFieldsAttributes2Value = *o.FieldsAttributes2Value + } + fFieldsAttributes2Value := frFieldsAttributes2Value + if fFieldsAttributes2Value != "" { + if err := r.SetFormParam("fields_attributes[2][value]", fFieldsAttributes2Value); err != nil { + return err + } + } + } + + if o.FieldsAttributes3Name != nil { + + // form param fields_attributes[3][name] + var frFieldsAttributes3Name string + if o.FieldsAttributes3Name != nil { + frFieldsAttributes3Name = *o.FieldsAttributes3Name + } + fFieldsAttributes3Name := frFieldsAttributes3Name + if fFieldsAttributes3Name != "" { + if err := r.SetFormParam("fields_attributes[3][name]", fFieldsAttributes3Name); err != nil { + return err + } + } + } + + if o.FieldsAttributes3Value != nil { + + // form param fields_attributes[3][value] + var frFieldsAttributes3Value string + if o.FieldsAttributes3Value != nil { + frFieldsAttributes3Value = *o.FieldsAttributes3Value + } + fFieldsAttributes3Value := frFieldsAttributes3Value + if fFieldsAttributes3Value != "" { + if err := r.SetFormParam("fields_attributes[3][value]", fFieldsAttributes3Value); err != nil { + return err + } + } + } + + if o.FieldsAttributes4Name != nil { + + // form param fields_attributes[4][name] + var frFieldsAttributes4Name string + if o.FieldsAttributes4Name != nil { + frFieldsAttributes4Name = *o.FieldsAttributes4Name + } + fFieldsAttributes4Name := frFieldsAttributes4Name + if fFieldsAttributes4Name != "" { + if err := r.SetFormParam("fields_attributes[4][name]", fFieldsAttributes4Name); err != nil { + return err + } + } + } + + if o.FieldsAttributes4Value != nil { + + // form param fields_attributes[4][value] + var frFieldsAttributes4Value string + if o.FieldsAttributes4Value != nil { + frFieldsAttributes4Value = *o.FieldsAttributes4Value + } + fFieldsAttributes4Value := frFieldsAttributes4Value + if fFieldsAttributes4Value != "" { + if err := r.SetFormParam("fields_attributes[4][value]", fFieldsAttributes4Value); err != nil { + return err + } + } + } + + if o.FieldsAttributes5Name != nil { + + // form param fields_attributes[5][name] + var frFieldsAttributes5Name string + if o.FieldsAttributes5Name != nil { + frFieldsAttributes5Name = *o.FieldsAttributes5Name + } + fFieldsAttributes5Name := frFieldsAttributes5Name + if fFieldsAttributes5Name != "" { + if err := r.SetFormParam("fields_attributes[5][name]", fFieldsAttributes5Name); err != nil { + return err + } + } + } + + if o.FieldsAttributes5Value != nil { + + // form param fields_attributes[5][value] + var frFieldsAttributes5Value string + if o.FieldsAttributes5Value != nil { + frFieldsAttributes5Value = *o.FieldsAttributes5Value + } + fFieldsAttributes5Value := frFieldsAttributes5Value + if fFieldsAttributes5Value != "" { + if err := r.SetFormParam("fields_attributes[5][value]", fFieldsAttributes5Value); err != nil { + return err + } + } + } + + if o.Header != nil { + + if o.Header != nil { + // form file param header + if err := r.SetFileParam("header", o.Header); err != nil { + return err + } + } + } + + // form param header_description + frHeaderDescription := o.HeaderDescription + fHeaderDescription := frHeaderDescription + if err := r.SetFormParam("header_description", fHeaderDescription); err != nil { + return err + } + + if o.HideCollections != nil { + + // form param hide_collections + var frHideCollections bool + if o.HideCollections != nil { + frHideCollections = *o.HideCollections + } + fHideCollections := swag.FormatBool(frHideCollections) + if fHideCollections != "" { + if err := r.SetFormParam("hide_collections", fHideCollections); err != nil { + return err + } + } + } + + if o.Locked != nil { + + // form param locked + var frLocked bool + if o.Locked != nil { + frLocked = *o.Locked + } + fLocked := swag.FormatBool(frLocked) + if fLocked != "" { + if err := r.SetFormParam("locked", fLocked); err != nil { + return err + } + } + } + + // form param note + frNote := o.Note + fNote := frNote + if err := r.SetFormParam("note", fNote); err != nil { + return err + } + + if o.SourceLanguage != nil { + + // form param source[language] + var frSourceLanguage string + if o.SourceLanguage != nil { + frSourceLanguage = *o.SourceLanguage + } + fSourceLanguage := frSourceLanguage + if fSourceLanguage != "" { + if err := r.SetFormParam("source[language]", fSourceLanguage); err != nil { + return err + } + } + } + + if o.SourcePrivacy != nil { + + // form param source[privacy] + var frSourcePrivacy string + if o.SourcePrivacy != nil { + frSourcePrivacy = *o.SourcePrivacy + } + fSourcePrivacy := frSourcePrivacy + if fSourcePrivacy != "" { + if err := r.SetFormParam("source[privacy]", fSourcePrivacy); err != nil { + return err + } + } + } + + if o.SourceSensitive != nil { + + // form param source[sensitive] + var frSourceSensitive bool + if o.SourceSensitive != nil { + frSourceSensitive = *o.SourceSensitive + } + fSourceSensitive := swag.FormatBool(frSourceSensitive) + if fSourceSensitive != "" { + if err := r.SetFormParam("source[sensitive]", fSourceSensitive); err != nil { + return err + } + } + } + + if o.SourceStatusContentType != nil { + + // form param source[status_content_type] + var frSourceStatusContentType string + if o.SourceStatusContentType != nil { + frSourceStatusContentType = *o.SourceStatusContentType + } + fSourceStatusContentType := frSourceStatusContentType + if fSourceStatusContentType != "" { + if err := r.SetFormParam("source[status_content_type]", fSourceStatusContentType); err != nil { + return err + } + } + } + + if o.Theme != nil { + + // form param theme + var frTheme string + if o.Theme != nil { + frTheme = *o.Theme + } + fTheme := frTheme + if fTheme != "" { + if err := r.SetFormParam("theme", fTheme); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_update_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_update_responses.go new file mode 100644 index 0000000..51c3400 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_update_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountUpdateReader is a Reader for the AccountUpdate structure. +type AccountUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountUpdateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountUpdateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountUpdateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountUpdateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountUpdateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PATCH /api/v1/accounts/update_credentials] accountUpdate", response, response.Code()) + } +} + +// NewAccountUpdateOK creates a AccountUpdateOK with default headers values +func NewAccountUpdateOK() *AccountUpdateOK { + return &AccountUpdateOK{} +} + +/* +AccountUpdateOK describes a response with status code 200, with default header values. + +The newly updated account. +*/ +type AccountUpdateOK struct { + Payload *models.Account +} + +// IsSuccess returns true when this account update o k response has a 2xx status code +func (o *AccountUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account update o k response has a 3xx status code +func (o *AccountUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account update o k response has a 4xx status code +func (o *AccountUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account update o k response has a 5xx status code +func (o *AccountUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account update o k response a status code equal to that given +func (o *AccountUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account update o k response +func (o *AccountUpdateOK) Code() int { + return 200 +} + +func (o *AccountUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateOK %s", 200, payload) +} + +func (o *AccountUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateOK %s", 200, payload) +} + +func (o *AccountUpdateOK) GetPayload() *models.Account { + return o.Payload +} + +func (o *AccountUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Account) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountUpdateBadRequest creates a AccountUpdateBadRequest with default headers values +func NewAccountUpdateBadRequest() *AccountUpdateBadRequest { + return &AccountUpdateBadRequest{} +} + +/* +AccountUpdateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountUpdateBadRequest struct { +} + +// IsSuccess returns true when this account update bad request response has a 2xx status code +func (o *AccountUpdateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account update bad request response has a 3xx status code +func (o *AccountUpdateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account update bad request response has a 4xx status code +func (o *AccountUpdateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account update bad request response has a 5xx status code +func (o *AccountUpdateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account update bad request response a status code equal to that given +func (o *AccountUpdateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account update bad request response +func (o *AccountUpdateBadRequest) Code() int { + return 400 +} + +func (o *AccountUpdateBadRequest) Error() string { + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateBadRequest", 400) +} + +func (o *AccountUpdateBadRequest) String() string { + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateBadRequest", 400) +} + +func (o *AccountUpdateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUpdateUnauthorized creates a AccountUpdateUnauthorized with default headers values +func NewAccountUpdateUnauthorized() *AccountUpdateUnauthorized { + return &AccountUpdateUnauthorized{} +} + +/* +AccountUpdateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountUpdateUnauthorized struct { +} + +// IsSuccess returns true when this account update unauthorized response has a 2xx status code +func (o *AccountUpdateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account update unauthorized response has a 3xx status code +func (o *AccountUpdateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account update unauthorized response has a 4xx status code +func (o *AccountUpdateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account update unauthorized response has a 5xx status code +func (o *AccountUpdateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account update unauthorized response a status code equal to that given +func (o *AccountUpdateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account update unauthorized response +func (o *AccountUpdateUnauthorized) Code() int { + return 401 +} + +func (o *AccountUpdateUnauthorized) Error() string { + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateUnauthorized", 401) +} + +func (o *AccountUpdateUnauthorized) String() string { + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateUnauthorized", 401) +} + +func (o *AccountUpdateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUpdateNotFound creates a AccountUpdateNotFound with default headers values +func NewAccountUpdateNotFound() *AccountUpdateNotFound { + return &AccountUpdateNotFound{} +} + +/* +AccountUpdateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountUpdateNotFound struct { +} + +// IsSuccess returns true when this account update not found response has a 2xx status code +func (o *AccountUpdateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account update not found response has a 3xx status code +func (o *AccountUpdateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account update not found response has a 4xx status code +func (o *AccountUpdateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account update not found response has a 5xx status code +func (o *AccountUpdateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account update not found response a status code equal to that given +func (o *AccountUpdateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account update not found response +func (o *AccountUpdateNotFound) Code() int { + return 404 +} + +func (o *AccountUpdateNotFound) Error() string { + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateNotFound", 404) +} + +func (o *AccountUpdateNotFound) String() string { + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateNotFound", 404) +} + +func (o *AccountUpdateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUpdateNotAcceptable creates a AccountUpdateNotAcceptable with default headers values +func NewAccountUpdateNotAcceptable() *AccountUpdateNotAcceptable { + return &AccountUpdateNotAcceptable{} +} + +/* +AccountUpdateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountUpdateNotAcceptable struct { +} + +// IsSuccess returns true when this account update not acceptable response has a 2xx status code +func (o *AccountUpdateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account update not acceptable response has a 3xx status code +func (o *AccountUpdateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account update not acceptable response has a 4xx status code +func (o *AccountUpdateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account update not acceptable response has a 5xx status code +func (o *AccountUpdateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account update not acceptable response a status code equal to that given +func (o *AccountUpdateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account update not acceptable response +func (o *AccountUpdateNotAcceptable) Code() int { + return 406 +} + +func (o *AccountUpdateNotAcceptable) Error() string { + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateNotAcceptable", 406) +} + +func (o *AccountUpdateNotAcceptable) String() string { + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateNotAcceptable", 406) +} + +func (o *AccountUpdateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUpdateInternalServerError creates a AccountUpdateInternalServerError with default headers values +func NewAccountUpdateInternalServerError() *AccountUpdateInternalServerError { + return &AccountUpdateInternalServerError{} +} + +/* +AccountUpdateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountUpdateInternalServerError struct { +} + +// IsSuccess returns true when this account update internal server error response has a 2xx status code +func (o *AccountUpdateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account update internal server error response has a 3xx status code +func (o *AccountUpdateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account update internal server error response has a 4xx status code +func (o *AccountUpdateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account update internal server error response has a 5xx status code +func (o *AccountUpdateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account update internal server error response a status code equal to that given +func (o *AccountUpdateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account update internal server error response +func (o *AccountUpdateInternalServerError) Code() int { + return 500 +} + +func (o *AccountUpdateInternalServerError) Error() string { + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateInternalServerError", 500) +} + +func (o *AccountUpdateInternalServerError) String() string { + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateInternalServerError", 500) +} + +func (o *AccountUpdateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_verify_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_verify_parameters.go new file mode 100644 index 0000000..55ebf74 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_verify_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" +) + +// NewAccountVerifyParams creates a new AccountVerifyParams 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 NewAccountVerifyParams() *AccountVerifyParams { + return &AccountVerifyParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountVerifyParamsWithTimeout creates a new AccountVerifyParams object +// with the ability to set a timeout on a request. +func NewAccountVerifyParamsWithTimeout(timeout time.Duration) *AccountVerifyParams { + return &AccountVerifyParams{ + timeout: timeout, + } +} + +// NewAccountVerifyParamsWithContext creates a new AccountVerifyParams object +// with the ability to set a context for a request. +func NewAccountVerifyParamsWithContext(ctx context.Context) *AccountVerifyParams { + return &AccountVerifyParams{ + Context: ctx, + } +} + +// NewAccountVerifyParamsWithHTTPClient creates a new AccountVerifyParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountVerifyParamsWithHTTPClient(client *http.Client) *AccountVerifyParams { + return &AccountVerifyParams{ + HTTPClient: client, + } +} + +/* +AccountVerifyParams contains all the parameters to send to the API endpoint + + for the account verify operation. + + Typically these are written to a http.Request. +*/ +type AccountVerifyParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account verify params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountVerifyParams) WithDefaults() *AccountVerifyParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account verify params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountVerifyParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account verify params +func (o *AccountVerifyParams) WithTimeout(timeout time.Duration) *AccountVerifyParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account verify params +func (o *AccountVerifyParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account verify params +func (o *AccountVerifyParams) WithContext(ctx context.Context) *AccountVerifyParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account verify params +func (o *AccountVerifyParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account verify params +func (o *AccountVerifyParams) WithHTTPClient(client *http.Client) *AccountVerifyParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account verify params +func (o *AccountVerifyParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountVerifyParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_verify_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_verify_responses.go new file mode 100644 index 0000000..d19a829 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/account_verify_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountVerifyReader is a Reader for the AccountVerify structure. +type AccountVerifyReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountVerifyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountVerifyOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountVerifyBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountVerifyUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountVerifyNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountVerifyNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountVerifyInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/accounts/verify_credentials] accountVerify", response, response.Code()) + } +} + +// NewAccountVerifyOK creates a AccountVerifyOK with default headers values +func NewAccountVerifyOK() *AccountVerifyOK { + return &AccountVerifyOK{} +} + +/* +AccountVerifyOK describes a response with status code 200, with default header values. + +AccountVerifyOK account verify o k +*/ +type AccountVerifyOK struct { + Payload *models.Account +} + +// IsSuccess returns true when this account verify o k response has a 2xx status code +func (o *AccountVerifyOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account verify o k response has a 3xx status code +func (o *AccountVerifyOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account verify o k response has a 4xx status code +func (o *AccountVerifyOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account verify o k response has a 5xx status code +func (o *AccountVerifyOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account verify o k response a status code equal to that given +func (o *AccountVerifyOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account verify o k response +func (o *AccountVerifyOK) Code() int { + return 200 +} + +func (o *AccountVerifyOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyOK %s", 200, payload) +} + +func (o *AccountVerifyOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyOK %s", 200, payload) +} + +func (o *AccountVerifyOK) GetPayload() *models.Account { + return o.Payload +} + +func (o *AccountVerifyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Account) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountVerifyBadRequest creates a AccountVerifyBadRequest with default headers values +func NewAccountVerifyBadRequest() *AccountVerifyBadRequest { + return &AccountVerifyBadRequest{} +} + +/* +AccountVerifyBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountVerifyBadRequest struct { +} + +// IsSuccess returns true when this account verify bad request response has a 2xx status code +func (o *AccountVerifyBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account verify bad request response has a 3xx status code +func (o *AccountVerifyBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account verify bad request response has a 4xx status code +func (o *AccountVerifyBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account verify bad request response has a 5xx status code +func (o *AccountVerifyBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account verify bad request response a status code equal to that given +func (o *AccountVerifyBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account verify bad request response +func (o *AccountVerifyBadRequest) Code() int { + return 400 +} + +func (o *AccountVerifyBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyBadRequest", 400) +} + +func (o *AccountVerifyBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyBadRequest", 400) +} + +func (o *AccountVerifyBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountVerifyUnauthorized creates a AccountVerifyUnauthorized with default headers values +func NewAccountVerifyUnauthorized() *AccountVerifyUnauthorized { + return &AccountVerifyUnauthorized{} +} + +/* +AccountVerifyUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountVerifyUnauthorized struct { +} + +// IsSuccess returns true when this account verify unauthorized response has a 2xx status code +func (o *AccountVerifyUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account verify unauthorized response has a 3xx status code +func (o *AccountVerifyUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account verify unauthorized response has a 4xx status code +func (o *AccountVerifyUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account verify unauthorized response has a 5xx status code +func (o *AccountVerifyUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account verify unauthorized response a status code equal to that given +func (o *AccountVerifyUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account verify unauthorized response +func (o *AccountVerifyUnauthorized) Code() int { + return 401 +} + +func (o *AccountVerifyUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyUnauthorized", 401) +} + +func (o *AccountVerifyUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyUnauthorized", 401) +} + +func (o *AccountVerifyUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountVerifyNotFound creates a AccountVerifyNotFound with default headers values +func NewAccountVerifyNotFound() *AccountVerifyNotFound { + return &AccountVerifyNotFound{} +} + +/* +AccountVerifyNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountVerifyNotFound struct { +} + +// IsSuccess returns true when this account verify not found response has a 2xx status code +func (o *AccountVerifyNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account verify not found response has a 3xx status code +func (o *AccountVerifyNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account verify not found response has a 4xx status code +func (o *AccountVerifyNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account verify not found response has a 5xx status code +func (o *AccountVerifyNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account verify not found response a status code equal to that given +func (o *AccountVerifyNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account verify not found response +func (o *AccountVerifyNotFound) Code() int { + return 404 +} + +func (o *AccountVerifyNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyNotFound", 404) +} + +func (o *AccountVerifyNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyNotFound", 404) +} + +func (o *AccountVerifyNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountVerifyNotAcceptable creates a AccountVerifyNotAcceptable with default headers values +func NewAccountVerifyNotAcceptable() *AccountVerifyNotAcceptable { + return &AccountVerifyNotAcceptable{} +} + +/* +AccountVerifyNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountVerifyNotAcceptable struct { +} + +// IsSuccess returns true when this account verify not acceptable response has a 2xx status code +func (o *AccountVerifyNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account verify not acceptable response has a 3xx status code +func (o *AccountVerifyNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account verify not acceptable response has a 4xx status code +func (o *AccountVerifyNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account verify not acceptable response has a 5xx status code +func (o *AccountVerifyNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account verify not acceptable response a status code equal to that given +func (o *AccountVerifyNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account verify not acceptable response +func (o *AccountVerifyNotAcceptable) Code() int { + return 406 +} + +func (o *AccountVerifyNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyNotAcceptable", 406) +} + +func (o *AccountVerifyNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyNotAcceptable", 406) +} + +func (o *AccountVerifyNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountVerifyInternalServerError creates a AccountVerifyInternalServerError with default headers values +func NewAccountVerifyInternalServerError() *AccountVerifyInternalServerError { + return &AccountVerifyInternalServerError{} +} + +/* +AccountVerifyInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountVerifyInternalServerError struct { +} + +// IsSuccess returns true when this account verify internal server error response has a 2xx status code +func (o *AccountVerifyInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account verify internal server error response has a 3xx status code +func (o *AccountVerifyInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account verify internal server error response has a 4xx status code +func (o *AccountVerifyInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account verify internal server error response has a 5xx status code +func (o *AccountVerifyInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account verify internal server error response a status code equal to that given +func (o *AccountVerifyInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account verify internal server error response +func (o *AccountVerifyInternalServerError) Code() int { + return 500 +} + +func (o *AccountVerifyInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyInternalServerError", 500) +} + +func (o *AccountVerifyInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyInternalServerError", 500) +} + +func (o *AccountVerifyInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/accounts_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/accounts_client.go new file mode 100644 index 0000000..b57383b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/accounts/accounts_client.go @@ -0,0 +1,1129 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounts + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new accounts API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new accounts API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new accounts API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for accounts API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded". +func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} +} + +// WithContentTypeApplicationXML sets the Content-Type header to "application/xml". +func WithContentTypeApplicationXML(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/xml"} +} + +// WithContentTypeMultipartFormData sets the Content-Type header to "multipart/form-data". +func WithContentTypeMultipartFormData(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"multipart/form-data"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + AccountAlias(params *AccountAliasParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountAliasOK, error) + + AccountAvatarDelete(params *AccountAvatarDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountAvatarDeleteOK, error) + + AccountBlock(params *AccountBlockParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountBlockOK, error) + + AccountCreate(params *AccountCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountCreateOK, error) + + AccountDelete(params *AccountDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountDeleteAccepted, error) + + AccountFollow(params *AccountFollowParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountFollowOK, error) + + AccountFollowers(params *AccountFollowersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountFollowersOK, error) + + AccountFollowing(params *AccountFollowingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountFollowingOK, error) + + AccountGet(params *AccountGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountGetOK, error) + + AccountHeaderDelete(params *AccountHeaderDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountHeaderDeleteOK, error) + + AccountLists(params *AccountListsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountListsOK, error) + + AccountLookupGet(params *AccountLookupGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountLookupGetOK, error) + + AccountMove(params *AccountMoveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountMoveAccepted, error) + + AccountMute(params *AccountMuteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountMuteOK, error) + + AccountNote(params *AccountNoteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountNoteOK, error) + + AccountRelationships(params *AccountRelationshipsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountRelationshipsOK, error) + + AccountSearchGet(params *AccountSearchGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountSearchGetOK, error) + + AccountStatuses(params *AccountStatusesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountStatusesOK, error) + + AccountThemes(params *AccountThemesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountThemesOK, error) + + AccountUnblock(params *AccountUnblockParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountUnblockOK, error) + + AccountUnfollow(params *AccountUnfollowParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountUnfollowOK, error) + + AccountUnmute(params *AccountUnmuteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountUnmuteOK, error) + + AccountUpdate(params *AccountUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountUpdateOK, error) + + AccountVerify(params *AccountVerifyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountVerifyOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + AccountAlias aliases your account to another account by setting also known as to the given URI + + This is useful when you want to move from another account this this account. + +In such cases, you should set the alsoKnownAs of this account to the URI of +the account you want to move from. +*/ +func (a *Client) AccountAlias(params *AccountAliasParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountAliasOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountAliasParams() + } + op := &runtime.ClientOperation{ + ID: "accountAlias", + Method: "POST", + PathPattern: "/api/v1/accounts/alias", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountAliasReader{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.(*AccountAliasOK) + 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 accountAlias: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountAvatarDelete deletes the authenticated account s avatar + +If the account doesn't have an avatar, the call succeeds anyway. +*/ +func (a *Client) AccountAvatarDelete(params *AccountAvatarDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountAvatarDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountAvatarDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "accountAvatarDelete", + Method: "DELETE", + PathPattern: "/api/v1/profile/avatar", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountAvatarDeleteReader{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.(*AccountAvatarDeleteOK) + 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 accountAvatarDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountBlock blocks account with id +*/ +func (a *Client) AccountBlock(params *AccountBlockParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountBlockOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountBlockParams() + } + op := &runtime.ClientOperation{ + ID: "accountBlock", + Method: "POST", + PathPattern: "/api/v1/accounts/{id}/block", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountBlockReader{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.(*AccountBlockOK) + 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 accountBlock: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + AccountCreate creates a new account using an application token + + The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'. + +The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'. +*/ +func (a *Client) AccountCreate(params *AccountCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountCreateParams() + } + op := &runtime.ClientOperation{ + ID: "accountCreate", + Method: "POST", + PathPattern: "/api/v1/accounts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountCreateReader{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.(*AccountCreateOK) + 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 accountCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountDelete deletes your account +*/ +func (a *Client) AccountDelete(params *AccountDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountDeleteAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "accountDelete", + Method: "POST", + PathPattern: "/api/v1/accounts/delete", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountDeleteReader{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.(*AccountDeleteAccepted) + 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 accountDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + AccountFollow follows account with id + + The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'. + +The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'. + +If you already follow (request) the given account, then the follow (request) will be updated instead using the +`reblogs` and `notify` parameters. +*/ +func (a *Client) AccountFollow(params *AccountFollowParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountFollowOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountFollowParams() + } + op := &runtime.ClientOperation{ + ID: "accountFollow", + Method: "POST", + PathPattern: "/api/v1/accounts/{id}/follow", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountFollowReader{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.(*AccountFollowOK) + 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 accountFollow: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + AccountFollowers sees followers of account with given id + + The next and previous queries can be parsed from the returned Link header. + +Example: + +``` +; rel="next", ; rel="prev" +```` + +If account `hide_collections` is true, and requesting account != target account, no results will be returned. +*/ +func (a *Client) AccountFollowers(params *AccountFollowersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountFollowersOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountFollowersParams() + } + op := &runtime.ClientOperation{ + ID: "accountFollowers", + Method: "GET", + PathPattern: "/api/v1/accounts/{id}/followers", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountFollowersReader{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.(*AccountFollowersOK) + 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 accountFollowers: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + AccountFollowing sees accounts followed by given account id + + The next and previous queries can be parsed from the returned Link header. + +Example: + +``` +; rel="next", ; rel="prev" +```` + +If account `hide_collections` is true, and requesting account != target account, no results will be returned. +*/ +func (a *Client) AccountFollowing(params *AccountFollowingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountFollowingOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountFollowingParams() + } + op := &runtime.ClientOperation{ + ID: "accountFollowing", + Method: "GET", + PathPattern: "/api/v1/accounts/{id}/following", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountFollowingReader{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.(*AccountFollowingOK) + 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 accountFollowing: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountGet gets information about an account with the given ID +*/ +func (a *Client) AccountGet(params *AccountGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountGetParams() + } + op := &runtime.ClientOperation{ + ID: "accountGet", + Method: "GET", + PathPattern: "/api/v1/accounts/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountGetReader{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.(*AccountGetOK) + 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 accountGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountHeaderDelete deletes the authenticated account s header + +If the account doesn't have a header, the call succeeds anyway. +*/ +func (a *Client) AccountHeaderDelete(params *AccountHeaderDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountHeaderDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountHeaderDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "accountHeaderDelete", + Method: "DELETE", + PathPattern: "/api/v1/profile/header", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountHeaderDeleteReader{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.(*AccountHeaderDeleteOK) + 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 accountHeaderDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountLists sees all lists of yours that contain requested account +*/ +func (a *Client) AccountLists(params *AccountListsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountListsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountListsParams() + } + op := &runtime.ClientOperation{ + ID: "accountLists", + Method: "GET", + PathPattern: "/api/v1/accounts/{id}/lists", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountListsReader{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.(*AccountListsOK) + 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 accountLists: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountLookupGet quicklies lookup a username to see if it is available skipping web finger resolution +*/ +func (a *Client) AccountLookupGet(params *AccountLookupGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountLookupGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountLookupGetParams() + } + op := &runtime.ClientOperation{ + ID: "accountLookupGet", + Method: "GET", + PathPattern: "/api/v1/accounts/lookup", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountLookupGetReader{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.(*AccountLookupGetOK) + 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 accountLookupGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountMove moves your account to another account +*/ +func (a *Client) AccountMove(params *AccountMoveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountMoveAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountMoveParams() + } + op := &runtime.ClientOperation{ + ID: "accountMove", + Method: "POST", + PathPattern: "/api/v1/accounts/move", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountMoveReader{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.(*AccountMoveAccepted) + 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 accountMove: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountMute mutes account by ID + +If account was already muted, succeeds anyway. This can be used to update the details of a mute. +*/ +func (a *Client) AccountMute(params *AccountMuteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountMuteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountMuteParams() + } + op := &runtime.ClientOperation{ + ID: "accountMute", + Method: "POST", + PathPattern: "/api/v1/accounts/{id}/mute", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountMuteReader{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.(*AccountMuteOK) + 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 accountMute: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountNote sets a private note for an account with the given id +*/ +func (a *Client) AccountNote(params *AccountNoteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountNoteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountNoteParams() + } + op := &runtime.ClientOperation{ + ID: "accountNote", + Method: "POST", + PathPattern: "/api/v1/accounts/{id}/note", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountNoteReader{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.(*AccountNoteOK) + 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 accountNote: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountRelationships sees your account s relationships with the given account i ds +*/ +func (a *Client) AccountRelationships(params *AccountRelationshipsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountRelationshipsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountRelationshipsParams() + } + op := &runtime.ClientOperation{ + ID: "accountRelationships", + Method: "GET", + PathPattern: "/api/v1/accounts/relationships", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountRelationshipsReader{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.(*AccountRelationshipsOK) + 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 accountRelationships: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountSearchGet searches for accounts by username and or display name +*/ +func (a *Client) AccountSearchGet(params *AccountSearchGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountSearchGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountSearchGetParams() + } + op := &runtime.ClientOperation{ + ID: "accountSearchGet", + Method: "GET", + PathPattern: "/api/v1/accounts/search", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountSearchGetReader{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.(*AccountSearchGetOK) + 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 accountSearchGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountStatuses sees statuses posted by the requested account + +The statuses will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer). +*/ +func (a *Client) AccountStatuses(params *AccountStatusesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountStatusesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountStatusesParams() + } + op := &runtime.ClientOperation{ + ID: "accountStatuses", + Method: "GET", + PathPattern: "/api/v1/accounts/{id}/statuses", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountStatusesReader{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.(*AccountStatusesOK) + 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 accountStatuses: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountThemes sees preset CSS themes available to accounts on this instance +*/ +func (a *Client) AccountThemes(params *AccountThemesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountThemesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountThemesParams() + } + op := &runtime.ClientOperation{ + ID: "accountThemes", + Method: "GET", + PathPattern: "/api/v1/accounts/themes", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountThemesReader{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.(*AccountThemesOK) + 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 accountThemes: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountUnblock unblocks account with ID +*/ +func (a *Client) AccountUnblock(params *AccountUnblockParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountUnblockOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountUnblockParams() + } + op := &runtime.ClientOperation{ + ID: "accountUnblock", + Method: "POST", + PathPattern: "/api/v1/accounts/{id}/unblock", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountUnblockReader{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.(*AccountUnblockOK) + 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 accountUnblock: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountUnfollow unfollows account with id +*/ +func (a *Client) AccountUnfollow(params *AccountUnfollowParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountUnfollowOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountUnfollowParams() + } + op := &runtime.ClientOperation{ + ID: "accountUnfollow", + Method: "POST", + PathPattern: "/api/v1/accounts/{id}/unfollow", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountUnfollowReader{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.(*AccountUnfollowOK) + 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 accountUnfollow: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountUnmute unmutes account by ID + +If account was already unmuted (or has never been muted), succeeds anyway. +*/ +func (a *Client) AccountUnmute(params *AccountUnmuteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountUnmuteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountUnmuteParams() + } + op := &runtime.ClientOperation{ + ID: "accountUnmute", + Method: "POST", + PathPattern: "/api/v1/accounts/{id}/unmute", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountUnmuteReader{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.(*AccountUnmuteOK) + 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 accountUnmute: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountUpdate updates your account +*/ +func (a *Client) AccountUpdate(params *AccountUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "accountUpdate", + Method: "PATCH", + PathPattern: "/api/v1/accounts/update_credentials", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data", "application/x-www-form-urlencoded", "application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountUpdateReader{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.(*AccountUpdateOK) + 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 accountUpdate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountVerify verifies a token by returning account details pertaining to it +*/ +func (a *Client) AccountVerify(params *AccountVerifyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountVerifyOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountVerifyParams() + } + op := &runtime.ClientOperation{ + ID: "accountVerify", + Method: "GET", + PathPattern: "/api/v1/accounts/verify_credentials", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountVerifyReader{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.(*AccountVerifyOK) + 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 accountVerify: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_action_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_action_parameters.go new file mode 100644 index 0000000..1f0b393 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_action_parameters.go @@ -0,0 +1,209 @@ +// 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" +) + +// NewAdminAccountActionParams creates a new AdminAccountActionParams 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 NewAdminAccountActionParams() *AdminAccountActionParams { + return &AdminAccountActionParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminAccountActionParamsWithTimeout creates a new AdminAccountActionParams object +// with the ability to set a timeout on a request. +func NewAdminAccountActionParamsWithTimeout(timeout time.Duration) *AdminAccountActionParams { + return &AdminAccountActionParams{ + timeout: timeout, + } +} + +// NewAdminAccountActionParamsWithContext creates a new AdminAccountActionParams object +// with the ability to set a context for a request. +func NewAdminAccountActionParamsWithContext(ctx context.Context) *AdminAccountActionParams { + return &AdminAccountActionParams{ + Context: ctx, + } +} + +// NewAdminAccountActionParamsWithHTTPClient creates a new AdminAccountActionParams object +// with the ability to set a custom HTTPClient for a request. +func NewAdminAccountActionParamsWithHTTPClient(client *http.Client) *AdminAccountActionParams { + return &AdminAccountActionParams{ + HTTPClient: client, + } +} + +/* +AdminAccountActionParams contains all the parameters to send to the API endpoint + + for the admin account action operation. + + Typically these are written to a http.Request. +*/ +type AdminAccountActionParams struct { + + /* ID. + + ID of the account. + */ + ID string + + /* Text. + + Optional text describing why this action was taken. + */ + Text *string + + /* Type. + + Type of action to be taken, currently only supports `suspend`. + */ + Type string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admin account action params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountActionParams) WithDefaults() *AdminAccountActionParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admin account action params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountActionParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the admin account action params +func (o *AdminAccountActionParams) WithTimeout(timeout time.Duration) *AdminAccountActionParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admin account action params +func (o *AdminAccountActionParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admin account action params +func (o *AdminAccountActionParams) WithContext(ctx context.Context) *AdminAccountActionParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admin account action params +func (o *AdminAccountActionParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admin account action params +func (o *AdminAccountActionParams) WithHTTPClient(client *http.Client) *AdminAccountActionParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admin account action params +func (o *AdminAccountActionParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the admin account action params +func (o *AdminAccountActionParams) WithID(id string) *AdminAccountActionParams { + o.SetID(id) + return o +} + +// SetID adds the id to the admin account action params +func (o *AdminAccountActionParams) SetID(id string) { + o.ID = id +} + +// WithText adds the text to the admin account action params +func (o *AdminAccountActionParams) WithText(text *string) *AdminAccountActionParams { + o.SetText(text) + return o +} + +// SetText adds the text to the admin account action params +func (o *AdminAccountActionParams) SetText(text *string) { + o.Text = text +} + +// WithType adds the typeVar to the admin account action params +func (o *AdminAccountActionParams) WithType(typeVar string) *AdminAccountActionParams { + o.SetType(typeVar) + return o +} + +// SetType adds the type to the admin account action params +func (o *AdminAccountActionParams) SetType(typeVar string) { + o.Type = typeVar +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminAccountActionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Text != nil { + + // form param text + var frText string + if o.Text != nil { + frText = *o.Text + } + fText := frText + if fText != "" { + if err := r.SetFormParam("text", fText); err != nil { + return err + } + } + } + + // form param type + frType := o.Type + fType := frType + if fType != "" { + if err := r.SetFormParam("type", fType); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_action_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_action_responses.go new file mode 100644 index 0000000..5a60333 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_action_responses.go @@ -0,0 +1,522 @@ +// 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" +) + +// AdminAccountActionReader is a Reader for the AdminAccountAction structure. +type AdminAccountActionReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminAccountActionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminAccountActionOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminAccountActionBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminAccountActionUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewAdminAccountActionForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminAccountActionNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminAccountActionNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewAdminAccountActionConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminAccountActionInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/accounts/{id}/action] adminAccountAction", response, response.Code()) + } +} + +// NewAdminAccountActionOK creates a AdminAccountActionOK with default headers values +func NewAdminAccountActionOK() *AdminAccountActionOK { + return &AdminAccountActionOK{} +} + +/* +AdminAccountActionOK describes a response with status code 200, with default header values. + +OK +*/ +type AdminAccountActionOK struct { +} + +// IsSuccess returns true when this admin account action o k response has a 2xx status code +func (o *AdminAccountActionOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admin account action o k response has a 3xx status code +func (o *AdminAccountActionOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account action o k response has a 4xx status code +func (o *AdminAccountActionOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin account action o k response has a 5xx status code +func (o *AdminAccountActionOK) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account action o k response a status code equal to that given +func (o *AdminAccountActionOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admin account action o k response +func (o *AdminAccountActionOK) Code() int { + return 200 +} + +func (o *AdminAccountActionOK) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionOK", 200) +} + +func (o *AdminAccountActionOK) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionOK", 200) +} + +func (o *AdminAccountActionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountActionBadRequest creates a AdminAccountActionBadRequest with default headers values +func NewAdminAccountActionBadRequest() *AdminAccountActionBadRequest { + return &AdminAccountActionBadRequest{} +} + +/* +AdminAccountActionBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminAccountActionBadRequest struct { +} + +// IsSuccess returns true when this admin account action bad request response has a 2xx status code +func (o *AdminAccountActionBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account action bad request response has a 3xx status code +func (o *AdminAccountActionBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account action bad request response has a 4xx status code +func (o *AdminAccountActionBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account action bad request response has a 5xx status code +func (o *AdminAccountActionBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account action bad request response a status code equal to that given +func (o *AdminAccountActionBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admin account action bad request response +func (o *AdminAccountActionBadRequest) Code() int { + return 400 +} + +func (o *AdminAccountActionBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionBadRequest", 400) +} + +func (o *AdminAccountActionBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionBadRequest", 400) +} + +func (o *AdminAccountActionBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountActionUnauthorized creates a AdminAccountActionUnauthorized with default headers values +func NewAdminAccountActionUnauthorized() *AdminAccountActionUnauthorized { + return &AdminAccountActionUnauthorized{} +} + +/* +AdminAccountActionUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminAccountActionUnauthorized struct { +} + +// IsSuccess returns true when this admin account action unauthorized response has a 2xx status code +func (o *AdminAccountActionUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account action unauthorized response has a 3xx status code +func (o *AdminAccountActionUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account action unauthorized response has a 4xx status code +func (o *AdminAccountActionUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account action unauthorized response has a 5xx status code +func (o *AdminAccountActionUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account action unauthorized response a status code equal to that given +func (o *AdminAccountActionUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admin account action unauthorized response +func (o *AdminAccountActionUnauthorized) Code() int { + return 401 +} + +func (o *AdminAccountActionUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionUnauthorized", 401) +} + +func (o *AdminAccountActionUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionUnauthorized", 401) +} + +func (o *AdminAccountActionUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountActionForbidden creates a AdminAccountActionForbidden with default headers values +func NewAdminAccountActionForbidden() *AdminAccountActionForbidden { + return &AdminAccountActionForbidden{} +} + +/* +AdminAccountActionForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type AdminAccountActionForbidden struct { +} + +// IsSuccess returns true when this admin account action forbidden response has a 2xx status code +func (o *AdminAccountActionForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account action forbidden response has a 3xx status code +func (o *AdminAccountActionForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account action forbidden response has a 4xx status code +func (o *AdminAccountActionForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account action forbidden response has a 5xx status code +func (o *AdminAccountActionForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account action forbidden response a status code equal to that given +func (o *AdminAccountActionForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the admin account action forbidden response +func (o *AdminAccountActionForbidden) Code() int { + return 403 +} + +func (o *AdminAccountActionForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionForbidden", 403) +} + +func (o *AdminAccountActionForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionForbidden", 403) +} + +func (o *AdminAccountActionForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountActionNotFound creates a AdminAccountActionNotFound with default headers values +func NewAdminAccountActionNotFound() *AdminAccountActionNotFound { + return &AdminAccountActionNotFound{} +} + +/* +AdminAccountActionNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminAccountActionNotFound struct { +} + +// IsSuccess returns true when this admin account action not found response has a 2xx status code +func (o *AdminAccountActionNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account action not found response has a 3xx status code +func (o *AdminAccountActionNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account action not found response has a 4xx status code +func (o *AdminAccountActionNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account action not found response has a 5xx status code +func (o *AdminAccountActionNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account action not found response a status code equal to that given +func (o *AdminAccountActionNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admin account action not found response +func (o *AdminAccountActionNotFound) Code() int { + return 404 +} + +func (o *AdminAccountActionNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionNotFound", 404) +} + +func (o *AdminAccountActionNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionNotFound", 404) +} + +func (o *AdminAccountActionNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountActionNotAcceptable creates a AdminAccountActionNotAcceptable with default headers values +func NewAdminAccountActionNotAcceptable() *AdminAccountActionNotAcceptable { + return &AdminAccountActionNotAcceptable{} +} + +/* +AdminAccountActionNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminAccountActionNotAcceptable struct { +} + +// IsSuccess returns true when this admin account action not acceptable response has a 2xx status code +func (o *AdminAccountActionNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account action not acceptable response has a 3xx status code +func (o *AdminAccountActionNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account action not acceptable response has a 4xx status code +func (o *AdminAccountActionNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account action not acceptable response has a 5xx status code +func (o *AdminAccountActionNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account action not acceptable response a status code equal to that given +func (o *AdminAccountActionNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admin account action not acceptable response +func (o *AdminAccountActionNotAcceptable) Code() int { + return 406 +} + +func (o *AdminAccountActionNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionNotAcceptable", 406) +} + +func (o *AdminAccountActionNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionNotAcceptable", 406) +} + +func (o *AdminAccountActionNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountActionConflict creates a AdminAccountActionConflict with default headers values +func NewAdminAccountActionConflict() *AdminAccountActionConflict { + return &AdminAccountActionConflict{} +} + +/* +AdminAccountActionConflict describes a response with status code 409, with default header values. + +Conflict: There is already an admin action running that conflicts with this action. Check the error message in the response body for more information. This is a temporary error; it should be possible to process this action if you try again in a bit. +*/ +type AdminAccountActionConflict struct { +} + +// IsSuccess returns true when this admin account action conflict response has a 2xx status code +func (o *AdminAccountActionConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account action conflict response has a 3xx status code +func (o *AdminAccountActionConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account action conflict response has a 4xx status code +func (o *AdminAccountActionConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account action conflict response has a 5xx status code +func (o *AdminAccountActionConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account action conflict response a status code equal to that given +func (o *AdminAccountActionConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the admin account action conflict response +func (o *AdminAccountActionConflict) Code() int { + return 409 +} + +func (o *AdminAccountActionConflict) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionConflict", 409) +} + +func (o *AdminAccountActionConflict) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionConflict", 409) +} + +func (o *AdminAccountActionConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountActionInternalServerError creates a AdminAccountActionInternalServerError with default headers values +func NewAdminAccountActionInternalServerError() *AdminAccountActionInternalServerError { + return &AdminAccountActionInternalServerError{} +} + +/* +AdminAccountActionInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminAccountActionInternalServerError struct { +} + +// IsSuccess returns true when this admin account action internal server error response has a 2xx status code +func (o *AdminAccountActionInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account action internal server error response has a 3xx status code +func (o *AdminAccountActionInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account action internal server error response has a 4xx status code +func (o *AdminAccountActionInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin account action internal server error response has a 5xx status code +func (o *AdminAccountActionInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admin account action internal server error response a status code equal to that given +func (o *AdminAccountActionInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admin account action internal server error response +func (o *AdminAccountActionInternalServerError) Code() int { + return 500 +} + +func (o *AdminAccountActionInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionInternalServerError", 500) +} + +func (o *AdminAccountActionInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionInternalServerError", 500) +} + +func (o *AdminAccountActionInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_approve_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_approve_parameters.go new file mode 100644 index 0000000..4da97e6 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_approve_parameters.go @@ -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" +) + +// NewAdminAccountApproveParams creates a new AdminAccountApproveParams 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 NewAdminAccountApproveParams() *AdminAccountApproveParams { + return &AdminAccountApproveParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminAccountApproveParamsWithTimeout creates a new AdminAccountApproveParams object +// with the ability to set a timeout on a request. +func NewAdminAccountApproveParamsWithTimeout(timeout time.Duration) *AdminAccountApproveParams { + return &AdminAccountApproveParams{ + timeout: timeout, + } +} + +// NewAdminAccountApproveParamsWithContext creates a new AdminAccountApproveParams object +// with the ability to set a context for a request. +func NewAdminAccountApproveParamsWithContext(ctx context.Context) *AdminAccountApproveParams { + return &AdminAccountApproveParams{ + Context: ctx, + } +} + +// NewAdminAccountApproveParamsWithHTTPClient creates a new AdminAccountApproveParams object +// with the ability to set a custom HTTPClient for a request. +func NewAdminAccountApproveParamsWithHTTPClient(client *http.Client) *AdminAccountApproveParams { + return &AdminAccountApproveParams{ + HTTPClient: client, + } +} + +/* +AdminAccountApproveParams contains all the parameters to send to the API endpoint + + for the admin account approve operation. + + Typically these are written to a http.Request. +*/ +type AdminAccountApproveParams struct { + + /* ID. + + ID of the account. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admin account approve params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountApproveParams) WithDefaults() *AdminAccountApproveParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admin account approve params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountApproveParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the admin account approve params +func (o *AdminAccountApproveParams) WithTimeout(timeout time.Duration) *AdminAccountApproveParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admin account approve params +func (o *AdminAccountApproveParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admin account approve params +func (o *AdminAccountApproveParams) WithContext(ctx context.Context) *AdminAccountApproveParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admin account approve params +func (o *AdminAccountApproveParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admin account approve params +func (o *AdminAccountApproveParams) WithHTTPClient(client *http.Client) *AdminAccountApproveParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admin account approve params +func (o *AdminAccountApproveParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the admin account approve params +func (o *AdminAccountApproveParams) WithID(id string) *AdminAccountApproveParams { + o.SetID(id) + return o +} + +// SetID adds the id to the admin account approve params +func (o *AdminAccountApproveParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminAccountApproveParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_approve_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_approve_responses.go new file mode 100644 index 0000000..9b7b7af --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_approve_responses.go @@ -0,0 +1,478 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AdminAccountApproveReader is a Reader for the AdminAccountApprove structure. +type AdminAccountApproveReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminAccountApproveReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminAccountApproveOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminAccountApproveBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminAccountApproveUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewAdminAccountApproveForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminAccountApproveNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminAccountApproveNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminAccountApproveInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/accounts/{id}/approve] adminAccountApprove", response, response.Code()) + } +} + +// NewAdminAccountApproveOK creates a AdminAccountApproveOK with default headers values +func NewAdminAccountApproveOK() *AdminAccountApproveOK { + return &AdminAccountApproveOK{} +} + +/* +AdminAccountApproveOK describes a response with status code 200, with default header values. + +The now-approved account. +*/ +type AdminAccountApproveOK struct { + Payload *models.AdminAccountInfo +} + +// IsSuccess returns true when this admin account approve o k response has a 2xx status code +func (o *AdminAccountApproveOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admin account approve o k response has a 3xx status code +func (o *AdminAccountApproveOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account approve o k response has a 4xx status code +func (o *AdminAccountApproveOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin account approve o k response has a 5xx status code +func (o *AdminAccountApproveOK) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account approve o k response a status code equal to that given +func (o *AdminAccountApproveOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admin account approve o k response +func (o *AdminAccountApproveOK) Code() int { + return 200 +} + +func (o *AdminAccountApproveOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveOK %s", 200, payload) +} + +func (o *AdminAccountApproveOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveOK %s", 200, payload) +} + +func (o *AdminAccountApproveOK) GetPayload() *models.AdminAccountInfo { + return o.Payload +} + +func (o *AdminAccountApproveOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AdminAccountInfo) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAdminAccountApproveBadRequest creates a AdminAccountApproveBadRequest with default headers values +func NewAdminAccountApproveBadRequest() *AdminAccountApproveBadRequest { + return &AdminAccountApproveBadRequest{} +} + +/* +AdminAccountApproveBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminAccountApproveBadRequest struct { +} + +// IsSuccess returns true when this admin account approve bad request response has a 2xx status code +func (o *AdminAccountApproveBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account approve bad request response has a 3xx status code +func (o *AdminAccountApproveBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account approve bad request response has a 4xx status code +func (o *AdminAccountApproveBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account approve bad request response has a 5xx status code +func (o *AdminAccountApproveBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account approve bad request response a status code equal to that given +func (o *AdminAccountApproveBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admin account approve bad request response +func (o *AdminAccountApproveBadRequest) Code() int { + return 400 +} + +func (o *AdminAccountApproveBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveBadRequest", 400) +} + +func (o *AdminAccountApproveBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveBadRequest", 400) +} + +func (o *AdminAccountApproveBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountApproveUnauthorized creates a AdminAccountApproveUnauthorized with default headers values +func NewAdminAccountApproveUnauthorized() *AdminAccountApproveUnauthorized { + return &AdminAccountApproveUnauthorized{} +} + +/* +AdminAccountApproveUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminAccountApproveUnauthorized struct { +} + +// IsSuccess returns true when this admin account approve unauthorized response has a 2xx status code +func (o *AdminAccountApproveUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account approve unauthorized response has a 3xx status code +func (o *AdminAccountApproveUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account approve unauthorized response has a 4xx status code +func (o *AdminAccountApproveUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account approve unauthorized response has a 5xx status code +func (o *AdminAccountApproveUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account approve unauthorized response a status code equal to that given +func (o *AdminAccountApproveUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admin account approve unauthorized response +func (o *AdminAccountApproveUnauthorized) Code() int { + return 401 +} + +func (o *AdminAccountApproveUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveUnauthorized", 401) +} + +func (o *AdminAccountApproveUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveUnauthorized", 401) +} + +func (o *AdminAccountApproveUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountApproveForbidden creates a AdminAccountApproveForbidden with default headers values +func NewAdminAccountApproveForbidden() *AdminAccountApproveForbidden { + return &AdminAccountApproveForbidden{} +} + +/* +AdminAccountApproveForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type AdminAccountApproveForbidden struct { +} + +// IsSuccess returns true when this admin account approve forbidden response has a 2xx status code +func (o *AdminAccountApproveForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account approve forbidden response has a 3xx status code +func (o *AdminAccountApproveForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account approve forbidden response has a 4xx status code +func (o *AdminAccountApproveForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account approve forbidden response has a 5xx status code +func (o *AdminAccountApproveForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account approve forbidden response a status code equal to that given +func (o *AdminAccountApproveForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the admin account approve forbidden response +func (o *AdminAccountApproveForbidden) Code() int { + return 403 +} + +func (o *AdminAccountApproveForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveForbidden", 403) +} + +func (o *AdminAccountApproveForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveForbidden", 403) +} + +func (o *AdminAccountApproveForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountApproveNotFound creates a AdminAccountApproveNotFound with default headers values +func NewAdminAccountApproveNotFound() *AdminAccountApproveNotFound { + return &AdminAccountApproveNotFound{} +} + +/* +AdminAccountApproveNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminAccountApproveNotFound struct { +} + +// IsSuccess returns true when this admin account approve not found response has a 2xx status code +func (o *AdminAccountApproveNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account approve not found response has a 3xx status code +func (o *AdminAccountApproveNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account approve not found response has a 4xx status code +func (o *AdminAccountApproveNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account approve not found response has a 5xx status code +func (o *AdminAccountApproveNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account approve not found response a status code equal to that given +func (o *AdminAccountApproveNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admin account approve not found response +func (o *AdminAccountApproveNotFound) Code() int { + return 404 +} + +func (o *AdminAccountApproveNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveNotFound", 404) +} + +func (o *AdminAccountApproveNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveNotFound", 404) +} + +func (o *AdminAccountApproveNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountApproveNotAcceptable creates a AdminAccountApproveNotAcceptable with default headers values +func NewAdminAccountApproveNotAcceptable() *AdminAccountApproveNotAcceptable { + return &AdminAccountApproveNotAcceptable{} +} + +/* +AdminAccountApproveNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminAccountApproveNotAcceptable struct { +} + +// IsSuccess returns true when this admin account approve not acceptable response has a 2xx status code +func (o *AdminAccountApproveNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account approve not acceptable response has a 3xx status code +func (o *AdminAccountApproveNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account approve not acceptable response has a 4xx status code +func (o *AdminAccountApproveNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account approve not acceptable response has a 5xx status code +func (o *AdminAccountApproveNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account approve not acceptable response a status code equal to that given +func (o *AdminAccountApproveNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admin account approve not acceptable response +func (o *AdminAccountApproveNotAcceptable) Code() int { + return 406 +} + +func (o *AdminAccountApproveNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveNotAcceptable", 406) +} + +func (o *AdminAccountApproveNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveNotAcceptable", 406) +} + +func (o *AdminAccountApproveNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountApproveInternalServerError creates a AdminAccountApproveInternalServerError with default headers values +func NewAdminAccountApproveInternalServerError() *AdminAccountApproveInternalServerError { + return &AdminAccountApproveInternalServerError{} +} + +/* +AdminAccountApproveInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminAccountApproveInternalServerError struct { +} + +// IsSuccess returns true when this admin account approve internal server error response has a 2xx status code +func (o *AdminAccountApproveInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account approve internal server error response has a 3xx status code +func (o *AdminAccountApproveInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account approve internal server error response has a 4xx status code +func (o *AdminAccountApproveInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin account approve internal server error response has a 5xx status code +func (o *AdminAccountApproveInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admin account approve internal server error response a status code equal to that given +func (o *AdminAccountApproveInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admin account approve internal server error response +func (o *AdminAccountApproveInternalServerError) Code() int { + return 500 +} + +func (o *AdminAccountApproveInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveInternalServerError", 500) +} + +func (o *AdminAccountApproveInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveInternalServerError", 500) +} + +func (o *AdminAccountApproveInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_get_parameters.go new file mode 100644 index 0000000..6280c0f --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_get_parameters.go @@ -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" +) + +// NewAdminAccountGetParams creates a new AdminAccountGetParams 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 NewAdminAccountGetParams() *AdminAccountGetParams { + return &AdminAccountGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminAccountGetParamsWithTimeout creates a new AdminAccountGetParams object +// with the ability to set a timeout on a request. +func NewAdminAccountGetParamsWithTimeout(timeout time.Duration) *AdminAccountGetParams { + return &AdminAccountGetParams{ + timeout: timeout, + } +} + +// NewAdminAccountGetParamsWithContext creates a new AdminAccountGetParams object +// with the ability to set a context for a request. +func NewAdminAccountGetParamsWithContext(ctx context.Context) *AdminAccountGetParams { + return &AdminAccountGetParams{ + Context: ctx, + } +} + +// NewAdminAccountGetParamsWithHTTPClient creates a new AdminAccountGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewAdminAccountGetParamsWithHTTPClient(client *http.Client) *AdminAccountGetParams { + return &AdminAccountGetParams{ + HTTPClient: client, + } +} + +/* +AdminAccountGetParams contains all the parameters to send to the API endpoint + + for the admin account get operation. + + Typically these are written to a http.Request. +*/ +type AdminAccountGetParams struct { + + /* ID. + + ID of the account. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admin account get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountGetParams) WithDefaults() *AdminAccountGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admin account get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the admin account get params +func (o *AdminAccountGetParams) WithTimeout(timeout time.Duration) *AdminAccountGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admin account get params +func (o *AdminAccountGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admin account get params +func (o *AdminAccountGetParams) WithContext(ctx context.Context) *AdminAccountGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admin account get params +func (o *AdminAccountGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admin account get params +func (o *AdminAccountGetParams) WithHTTPClient(client *http.Client) *AdminAccountGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admin account get params +func (o *AdminAccountGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the admin account get params +func (o *AdminAccountGetParams) WithID(id string) *AdminAccountGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the admin account get params +func (o *AdminAccountGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminAccountGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_get_responses.go new file mode 100644 index 0000000..4d44c03 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_get_responses.go @@ -0,0 +1,478 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AdminAccountGetReader is a Reader for the AdminAccountGet structure. +type AdminAccountGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminAccountGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminAccountGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminAccountGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminAccountGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewAdminAccountGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminAccountGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminAccountGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminAccountGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/accounts/{id}] adminAccountGet", response, response.Code()) + } +} + +// NewAdminAccountGetOK creates a AdminAccountGetOK with default headers values +func NewAdminAccountGetOK() *AdminAccountGetOK { + return &AdminAccountGetOK{} +} + +/* +AdminAccountGetOK describes a response with status code 200, with default header values. + +OK +*/ +type AdminAccountGetOK struct { + Payload *models.AdminAccountInfo +} + +// IsSuccess returns true when this admin account get o k response has a 2xx status code +func (o *AdminAccountGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admin account get o k response has a 3xx status code +func (o *AdminAccountGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account get o k response has a 4xx status code +func (o *AdminAccountGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin account get o k response has a 5xx status code +func (o *AdminAccountGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account get o k response a status code equal to that given +func (o *AdminAccountGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admin account get o k response +func (o *AdminAccountGetOK) Code() int { + return 200 +} + +func (o *AdminAccountGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetOK %s", 200, payload) +} + +func (o *AdminAccountGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetOK %s", 200, payload) +} + +func (o *AdminAccountGetOK) GetPayload() *models.AdminAccountInfo { + return o.Payload +} + +func (o *AdminAccountGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AdminAccountInfo) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAdminAccountGetBadRequest creates a AdminAccountGetBadRequest with default headers values +func NewAdminAccountGetBadRequest() *AdminAccountGetBadRequest { + return &AdminAccountGetBadRequest{} +} + +/* +AdminAccountGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminAccountGetBadRequest struct { +} + +// IsSuccess returns true when this admin account get bad request response has a 2xx status code +func (o *AdminAccountGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account get bad request response has a 3xx status code +func (o *AdminAccountGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account get bad request response has a 4xx status code +func (o *AdminAccountGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account get bad request response has a 5xx status code +func (o *AdminAccountGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account get bad request response a status code equal to that given +func (o *AdminAccountGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admin account get bad request response +func (o *AdminAccountGetBadRequest) Code() int { + return 400 +} + +func (o *AdminAccountGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetBadRequest", 400) +} + +func (o *AdminAccountGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetBadRequest", 400) +} + +func (o *AdminAccountGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountGetUnauthorized creates a AdminAccountGetUnauthorized with default headers values +func NewAdminAccountGetUnauthorized() *AdminAccountGetUnauthorized { + return &AdminAccountGetUnauthorized{} +} + +/* +AdminAccountGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminAccountGetUnauthorized struct { +} + +// IsSuccess returns true when this admin account get unauthorized response has a 2xx status code +func (o *AdminAccountGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account get unauthorized response has a 3xx status code +func (o *AdminAccountGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account get unauthorized response has a 4xx status code +func (o *AdminAccountGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account get unauthorized response has a 5xx status code +func (o *AdminAccountGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account get unauthorized response a status code equal to that given +func (o *AdminAccountGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admin account get unauthorized response +func (o *AdminAccountGetUnauthorized) Code() int { + return 401 +} + +func (o *AdminAccountGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetUnauthorized", 401) +} + +func (o *AdminAccountGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetUnauthorized", 401) +} + +func (o *AdminAccountGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountGetForbidden creates a AdminAccountGetForbidden with default headers values +func NewAdminAccountGetForbidden() *AdminAccountGetForbidden { + return &AdminAccountGetForbidden{} +} + +/* +AdminAccountGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type AdminAccountGetForbidden struct { +} + +// IsSuccess returns true when this admin account get forbidden response has a 2xx status code +func (o *AdminAccountGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account get forbidden response has a 3xx status code +func (o *AdminAccountGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account get forbidden response has a 4xx status code +func (o *AdminAccountGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account get forbidden response has a 5xx status code +func (o *AdminAccountGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account get forbidden response a status code equal to that given +func (o *AdminAccountGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the admin account get forbidden response +func (o *AdminAccountGetForbidden) Code() int { + return 403 +} + +func (o *AdminAccountGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetForbidden", 403) +} + +func (o *AdminAccountGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetForbidden", 403) +} + +func (o *AdminAccountGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountGetNotFound creates a AdminAccountGetNotFound with default headers values +func NewAdminAccountGetNotFound() *AdminAccountGetNotFound { + return &AdminAccountGetNotFound{} +} + +/* +AdminAccountGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminAccountGetNotFound struct { +} + +// IsSuccess returns true when this admin account get not found response has a 2xx status code +func (o *AdminAccountGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account get not found response has a 3xx status code +func (o *AdminAccountGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account get not found response has a 4xx status code +func (o *AdminAccountGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account get not found response has a 5xx status code +func (o *AdminAccountGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account get not found response a status code equal to that given +func (o *AdminAccountGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admin account get not found response +func (o *AdminAccountGetNotFound) Code() int { + return 404 +} + +func (o *AdminAccountGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetNotFound", 404) +} + +func (o *AdminAccountGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetNotFound", 404) +} + +func (o *AdminAccountGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountGetNotAcceptable creates a AdminAccountGetNotAcceptable with default headers values +func NewAdminAccountGetNotAcceptable() *AdminAccountGetNotAcceptable { + return &AdminAccountGetNotAcceptable{} +} + +/* +AdminAccountGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminAccountGetNotAcceptable struct { +} + +// IsSuccess returns true when this admin account get not acceptable response has a 2xx status code +func (o *AdminAccountGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account get not acceptable response has a 3xx status code +func (o *AdminAccountGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account get not acceptable response has a 4xx status code +func (o *AdminAccountGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account get not acceptable response has a 5xx status code +func (o *AdminAccountGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account get not acceptable response a status code equal to that given +func (o *AdminAccountGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admin account get not acceptable response +func (o *AdminAccountGetNotAcceptable) Code() int { + return 406 +} + +func (o *AdminAccountGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetNotAcceptable", 406) +} + +func (o *AdminAccountGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetNotAcceptable", 406) +} + +func (o *AdminAccountGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountGetInternalServerError creates a AdminAccountGetInternalServerError with default headers values +func NewAdminAccountGetInternalServerError() *AdminAccountGetInternalServerError { + return &AdminAccountGetInternalServerError{} +} + +/* +AdminAccountGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminAccountGetInternalServerError struct { +} + +// IsSuccess returns true when this admin account get internal server error response has a 2xx status code +func (o *AdminAccountGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account get internal server error response has a 3xx status code +func (o *AdminAccountGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account get internal server error response has a 4xx status code +func (o *AdminAccountGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin account get internal server error response has a 5xx status code +func (o *AdminAccountGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admin account get internal server error response a status code equal to that given +func (o *AdminAccountGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admin account get internal server error response +func (o *AdminAccountGetInternalServerError) Code() int { + return 500 +} + +func (o *AdminAccountGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetInternalServerError", 500) +} + +func (o *AdminAccountGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetInternalServerError", 500) +} + +func (o *AdminAccountGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_reject_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_reject_parameters.go new file mode 100644 index 0000000..b11b362 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_reject_parameters.go @@ -0,0 +1,248 @@ +// 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" +) + +// NewAdminAccountRejectParams creates a new AdminAccountRejectParams 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 NewAdminAccountRejectParams() *AdminAccountRejectParams { + return &AdminAccountRejectParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminAccountRejectParamsWithTimeout creates a new AdminAccountRejectParams object +// with the ability to set a timeout on a request. +func NewAdminAccountRejectParamsWithTimeout(timeout time.Duration) *AdminAccountRejectParams { + return &AdminAccountRejectParams{ + timeout: timeout, + } +} + +// NewAdminAccountRejectParamsWithContext creates a new AdminAccountRejectParams object +// with the ability to set a context for a request. +func NewAdminAccountRejectParamsWithContext(ctx context.Context) *AdminAccountRejectParams { + return &AdminAccountRejectParams{ + Context: ctx, + } +} + +// NewAdminAccountRejectParamsWithHTTPClient creates a new AdminAccountRejectParams object +// with the ability to set a custom HTTPClient for a request. +func NewAdminAccountRejectParamsWithHTTPClient(client *http.Client) *AdminAccountRejectParams { + return &AdminAccountRejectParams{ + HTTPClient: client, + } +} + +/* +AdminAccountRejectParams contains all the parameters to send to the API endpoint + + for the admin account reject operation. + + Typically these are written to a http.Request. +*/ +type AdminAccountRejectParams struct { + + /* ID. + + ID of the account. + */ + ID string + + /* Message. + + Message to include in email to applicant. Will be included only if send_email is true. + */ + Message *string + + /* PrivateComment. + + Comment to leave on why the account was denied. The comment will be visible to admins only. + */ + PrivateComment *string + + /* SendEmail. + + Send an email to the applicant informing them that their sign-up has been rejected. + */ + SendEmail *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admin account reject params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountRejectParams) WithDefaults() *AdminAccountRejectParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admin account reject params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountRejectParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the admin account reject params +func (o *AdminAccountRejectParams) WithTimeout(timeout time.Duration) *AdminAccountRejectParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admin account reject params +func (o *AdminAccountRejectParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admin account reject params +func (o *AdminAccountRejectParams) WithContext(ctx context.Context) *AdminAccountRejectParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admin account reject params +func (o *AdminAccountRejectParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admin account reject params +func (o *AdminAccountRejectParams) WithHTTPClient(client *http.Client) *AdminAccountRejectParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admin account reject params +func (o *AdminAccountRejectParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the admin account reject params +func (o *AdminAccountRejectParams) WithID(id string) *AdminAccountRejectParams { + o.SetID(id) + return o +} + +// SetID adds the id to the admin account reject params +func (o *AdminAccountRejectParams) SetID(id string) { + o.ID = id +} + +// WithMessage adds the message to the admin account reject params +func (o *AdminAccountRejectParams) WithMessage(message *string) *AdminAccountRejectParams { + o.SetMessage(message) + return o +} + +// SetMessage adds the message to the admin account reject params +func (o *AdminAccountRejectParams) SetMessage(message *string) { + o.Message = message +} + +// WithPrivateComment adds the privateComment to the admin account reject params +func (o *AdminAccountRejectParams) WithPrivateComment(privateComment *string) *AdminAccountRejectParams { + o.SetPrivateComment(privateComment) + return o +} + +// SetPrivateComment adds the privateComment to the admin account reject params +func (o *AdminAccountRejectParams) SetPrivateComment(privateComment *string) { + o.PrivateComment = privateComment +} + +// WithSendEmail adds the sendEmail to the admin account reject params +func (o *AdminAccountRejectParams) WithSendEmail(sendEmail *bool) *AdminAccountRejectParams { + o.SetSendEmail(sendEmail) + return o +} + +// SetSendEmail adds the sendEmail to the admin account reject params +func (o *AdminAccountRejectParams) SetSendEmail(sendEmail *bool) { + o.SendEmail = sendEmail +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminAccountRejectParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Message != nil { + + // form param message + var frMessage string + if o.Message != nil { + frMessage = *o.Message + } + fMessage := frMessage + if fMessage != "" { + if err := r.SetFormParam("message", fMessage); err != nil { + return err + } + } + } + + if o.PrivateComment != nil { + + // form param private_comment + var frPrivateComment string + if o.PrivateComment != nil { + frPrivateComment = *o.PrivateComment + } + fPrivateComment := frPrivateComment + if fPrivateComment != "" { + if err := r.SetFormParam("private_comment", fPrivateComment); err != nil { + return err + } + } + } + + if o.SendEmail != nil { + + // form param send_email + var frSendEmail bool + if o.SendEmail != nil { + frSendEmail = *o.SendEmail + } + fSendEmail := swag.FormatBool(frSendEmail) + if fSendEmail != "" { + if err := r.SetFormParam("send_email", fSendEmail); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_reject_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_reject_responses.go new file mode 100644 index 0000000..aef9591 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_account_reject_responses.go @@ -0,0 +1,478 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AdminAccountRejectReader is a Reader for the AdminAccountReject structure. +type AdminAccountRejectReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminAccountRejectReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminAccountRejectOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminAccountRejectBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminAccountRejectUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewAdminAccountRejectForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminAccountRejectNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminAccountRejectNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminAccountRejectInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/accounts/{id}/reject] adminAccountReject", response, response.Code()) + } +} + +// NewAdminAccountRejectOK creates a AdminAccountRejectOK with default headers values +func NewAdminAccountRejectOK() *AdminAccountRejectOK { + return &AdminAccountRejectOK{} +} + +/* +AdminAccountRejectOK describes a response with status code 200, with default header values. + +The now-rejected account. +*/ +type AdminAccountRejectOK struct { + Payload *models.AdminAccountInfo +} + +// IsSuccess returns true when this admin account reject o k response has a 2xx status code +func (o *AdminAccountRejectOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admin account reject o k response has a 3xx status code +func (o *AdminAccountRejectOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account reject o k response has a 4xx status code +func (o *AdminAccountRejectOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin account reject o k response has a 5xx status code +func (o *AdminAccountRejectOK) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account reject o k response a status code equal to that given +func (o *AdminAccountRejectOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admin account reject o k response +func (o *AdminAccountRejectOK) Code() int { + return 200 +} + +func (o *AdminAccountRejectOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectOK %s", 200, payload) +} + +func (o *AdminAccountRejectOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectOK %s", 200, payload) +} + +func (o *AdminAccountRejectOK) GetPayload() *models.AdminAccountInfo { + return o.Payload +} + +func (o *AdminAccountRejectOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AdminAccountInfo) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAdminAccountRejectBadRequest creates a AdminAccountRejectBadRequest with default headers values +func NewAdminAccountRejectBadRequest() *AdminAccountRejectBadRequest { + return &AdminAccountRejectBadRequest{} +} + +/* +AdminAccountRejectBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminAccountRejectBadRequest struct { +} + +// IsSuccess returns true when this admin account reject bad request response has a 2xx status code +func (o *AdminAccountRejectBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account reject bad request response has a 3xx status code +func (o *AdminAccountRejectBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account reject bad request response has a 4xx status code +func (o *AdminAccountRejectBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account reject bad request response has a 5xx status code +func (o *AdminAccountRejectBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account reject bad request response a status code equal to that given +func (o *AdminAccountRejectBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admin account reject bad request response +func (o *AdminAccountRejectBadRequest) Code() int { + return 400 +} + +func (o *AdminAccountRejectBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectBadRequest", 400) +} + +func (o *AdminAccountRejectBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectBadRequest", 400) +} + +func (o *AdminAccountRejectBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountRejectUnauthorized creates a AdminAccountRejectUnauthorized with default headers values +func NewAdminAccountRejectUnauthorized() *AdminAccountRejectUnauthorized { + return &AdminAccountRejectUnauthorized{} +} + +/* +AdminAccountRejectUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminAccountRejectUnauthorized struct { +} + +// IsSuccess returns true when this admin account reject unauthorized response has a 2xx status code +func (o *AdminAccountRejectUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account reject unauthorized response has a 3xx status code +func (o *AdminAccountRejectUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account reject unauthorized response has a 4xx status code +func (o *AdminAccountRejectUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account reject unauthorized response has a 5xx status code +func (o *AdminAccountRejectUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account reject unauthorized response a status code equal to that given +func (o *AdminAccountRejectUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admin account reject unauthorized response +func (o *AdminAccountRejectUnauthorized) Code() int { + return 401 +} + +func (o *AdminAccountRejectUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectUnauthorized", 401) +} + +func (o *AdminAccountRejectUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectUnauthorized", 401) +} + +func (o *AdminAccountRejectUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountRejectForbidden creates a AdminAccountRejectForbidden with default headers values +func NewAdminAccountRejectForbidden() *AdminAccountRejectForbidden { + return &AdminAccountRejectForbidden{} +} + +/* +AdminAccountRejectForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type AdminAccountRejectForbidden struct { +} + +// IsSuccess returns true when this admin account reject forbidden response has a 2xx status code +func (o *AdminAccountRejectForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account reject forbidden response has a 3xx status code +func (o *AdminAccountRejectForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account reject forbidden response has a 4xx status code +func (o *AdminAccountRejectForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account reject forbidden response has a 5xx status code +func (o *AdminAccountRejectForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account reject forbidden response a status code equal to that given +func (o *AdminAccountRejectForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the admin account reject forbidden response +func (o *AdminAccountRejectForbidden) Code() int { + return 403 +} + +func (o *AdminAccountRejectForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectForbidden", 403) +} + +func (o *AdminAccountRejectForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectForbidden", 403) +} + +func (o *AdminAccountRejectForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountRejectNotFound creates a AdminAccountRejectNotFound with default headers values +func NewAdminAccountRejectNotFound() *AdminAccountRejectNotFound { + return &AdminAccountRejectNotFound{} +} + +/* +AdminAccountRejectNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminAccountRejectNotFound struct { +} + +// IsSuccess returns true when this admin account reject not found response has a 2xx status code +func (o *AdminAccountRejectNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account reject not found response has a 3xx status code +func (o *AdminAccountRejectNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account reject not found response has a 4xx status code +func (o *AdminAccountRejectNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account reject not found response has a 5xx status code +func (o *AdminAccountRejectNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account reject not found response a status code equal to that given +func (o *AdminAccountRejectNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admin account reject not found response +func (o *AdminAccountRejectNotFound) Code() int { + return 404 +} + +func (o *AdminAccountRejectNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectNotFound", 404) +} + +func (o *AdminAccountRejectNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectNotFound", 404) +} + +func (o *AdminAccountRejectNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountRejectNotAcceptable creates a AdminAccountRejectNotAcceptable with default headers values +func NewAdminAccountRejectNotAcceptable() *AdminAccountRejectNotAcceptable { + return &AdminAccountRejectNotAcceptable{} +} + +/* +AdminAccountRejectNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminAccountRejectNotAcceptable struct { +} + +// IsSuccess returns true when this admin account reject not acceptable response has a 2xx status code +func (o *AdminAccountRejectNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account reject not acceptable response has a 3xx status code +func (o *AdminAccountRejectNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account reject not acceptable response has a 4xx status code +func (o *AdminAccountRejectNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account reject not acceptable response has a 5xx status code +func (o *AdminAccountRejectNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account reject not acceptable response a status code equal to that given +func (o *AdminAccountRejectNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admin account reject not acceptable response +func (o *AdminAccountRejectNotAcceptable) Code() int { + return 406 +} + +func (o *AdminAccountRejectNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectNotAcceptable", 406) +} + +func (o *AdminAccountRejectNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectNotAcceptable", 406) +} + +func (o *AdminAccountRejectNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountRejectInternalServerError creates a AdminAccountRejectInternalServerError with default headers values +func NewAdminAccountRejectInternalServerError() *AdminAccountRejectInternalServerError { + return &AdminAccountRejectInternalServerError{} +} + +/* +AdminAccountRejectInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminAccountRejectInternalServerError struct { +} + +// IsSuccess returns true when this admin account reject internal server error response has a 2xx status code +func (o *AdminAccountRejectInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account reject internal server error response has a 3xx status code +func (o *AdminAccountRejectInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account reject internal server error response has a 4xx status code +func (o *AdminAccountRejectInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin account reject internal server error response has a 5xx status code +func (o *AdminAccountRejectInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admin account reject internal server error response a status code equal to that given +func (o *AdminAccountRejectInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admin account reject internal server error response +func (o *AdminAccountRejectInternalServerError) Code() int { + return 500 +} + +func (o *AdminAccountRejectInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectInternalServerError", 500) +} + +func (o *AdminAccountRejectInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectInternalServerError", 500) +} + +func (o *AdminAccountRejectInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_accounts_get_v1_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_accounts_get_v1_parameters.go new file mode 100644 index 0000000..6abafcf --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_accounts_get_v1_parameters.go @@ -0,0 +1,748 @@ +// 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" +) + +// NewAdminAccountsGetV1Params creates a new AdminAccountsGetV1Params 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 NewAdminAccountsGetV1Params() *AdminAccountsGetV1Params { + return &AdminAccountsGetV1Params{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminAccountsGetV1ParamsWithTimeout creates a new AdminAccountsGetV1Params object +// with the ability to set a timeout on a request. +func NewAdminAccountsGetV1ParamsWithTimeout(timeout time.Duration) *AdminAccountsGetV1Params { + return &AdminAccountsGetV1Params{ + timeout: timeout, + } +} + +// NewAdminAccountsGetV1ParamsWithContext creates a new AdminAccountsGetV1Params object +// with the ability to set a context for a request. +func NewAdminAccountsGetV1ParamsWithContext(ctx context.Context) *AdminAccountsGetV1Params { + return &AdminAccountsGetV1Params{ + Context: ctx, + } +} + +// NewAdminAccountsGetV1ParamsWithHTTPClient creates a new AdminAccountsGetV1Params object +// with the ability to set a custom HTTPClient for a request. +func NewAdminAccountsGetV1ParamsWithHTTPClient(client *http.Client) *AdminAccountsGetV1Params { + return &AdminAccountsGetV1Params{ + HTTPClient: client, + } +} + +/* +AdminAccountsGetV1Params contains all the parameters to send to the API endpoint + + for the admin accounts get v1 operation. + + Typically these are written to a http.Request. +*/ +type AdminAccountsGetV1Params struct { + + /* Active. + + Filter for currently active accounts. + */ + Active *bool + + /* ByDomain. + + Filter by the given domain. + */ + ByDomain *string + + /* Disabled. + + Filter for currently disabled accounts. + */ + Disabled *bool + + /* DisplayName. + + Search for the given display name. + */ + DisplayName *string + + /* Email. + + Lookup a user with this email. + */ + Email *string + + /* IP. + + Lookup users with this IP address. + */ + IP *string + + /* Limit. + + Maximum number of results to return. + + Default: 50 + */ + Limit *int64 + + /* Local. + + Filter for local accounts. + */ + Local *bool + + /* MaxID. + + max_id in the form `[domain]/@[username]`. All results returned will be later in the alphabet than `[domain]/@[username]`. For example, if max_id = `example.org/@someone` then returned entries might contain `example.org/@someone_else`, `later.example.org/@someone`, etc. Local account IDs in this form use an empty string for the `[domain]` part, for example local account with username `someone` would be `/@someone`. + */ + MaxID *string + + /* MinID. + + min_id in the form `[domain]/@[username]`. All results returned will be earlier in the alphabet than `[domain]/@[username]`. For example, if min_id = `example.org/@someone` then returned entries might contain `example.org/@earlier_account`, `earlier.example.org/@someone`, etc. Local account IDs in this form use an empty string for the `[domain]` part, for example local account with username `someone` would be `/@someone`. + */ + MinID *string + + /* Pending. + + Filter for currently pending accounts. + */ + Pending *bool + + /* Remote. + + Filter for remote accounts. + */ + Remote *bool + + /* Sensitized. + + Filter for accounts force-marked as sensitive. + */ + Sensitized *bool + + /* Silenced. + + Filter for currently silenced accounts. + */ + Silenced *bool + + /* Staff. + + Filter for staff accounts. + */ + Staff *bool + + /* Suspended. + + Filter for currently suspended accounts. + */ + Suspended *bool + + /* Username. + + Search for the given username. + */ + Username *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admin accounts get v1 params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountsGetV1Params) WithDefaults() *AdminAccountsGetV1Params { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admin accounts get v1 params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountsGetV1Params) SetDefaults() { + var ( + activeDefault = bool(false) + + disabledDefault = bool(false) + + limitDefault = int64(50) + + localDefault = bool(false) + + pendingDefault = bool(false) + + remoteDefault = bool(false) + + sensitizedDefault = bool(false) + + silencedDefault = bool(false) + + staffDefault = bool(false) + + suspendedDefault = bool(false) + ) + + val := AdminAccountsGetV1Params{ + Active: &activeDefault, + Disabled: &disabledDefault, + Limit: &limitDefault, + Local: &localDefault, + Pending: &pendingDefault, + Remote: &remoteDefault, + Sensitized: &sensitizedDefault, + Silenced: &silencedDefault, + Staff: &staffDefault, + Suspended: &suspendedDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithTimeout(timeout time.Duration) *AdminAccountsGetV1Params { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithContext(ctx context.Context) *AdminAccountsGetV1Params { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithHTTPClient(client *http.Client) *AdminAccountsGetV1Params { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithActive adds the active to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithActive(active *bool) *AdminAccountsGetV1Params { + o.SetActive(active) + return o +} + +// SetActive adds the active to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetActive(active *bool) { + o.Active = active +} + +// WithByDomain adds the byDomain to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithByDomain(byDomain *string) *AdminAccountsGetV1Params { + o.SetByDomain(byDomain) + return o +} + +// SetByDomain adds the byDomain to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetByDomain(byDomain *string) { + o.ByDomain = byDomain +} + +// WithDisabled adds the disabled to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithDisabled(disabled *bool) *AdminAccountsGetV1Params { + o.SetDisabled(disabled) + return o +} + +// SetDisabled adds the disabled to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetDisabled(disabled *bool) { + o.Disabled = disabled +} + +// WithDisplayName adds the displayName to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithDisplayName(displayName *string) *AdminAccountsGetV1Params { + o.SetDisplayName(displayName) + return o +} + +// SetDisplayName adds the displayName to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetDisplayName(displayName *string) { + o.DisplayName = displayName +} + +// WithEmail adds the email to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithEmail(email *string) *AdminAccountsGetV1Params { + o.SetEmail(email) + return o +} + +// SetEmail adds the email to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetEmail(email *string) { + o.Email = email +} + +// WithIP adds the ip to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithIP(ip *string) *AdminAccountsGetV1Params { + o.SetIP(ip) + return o +} + +// SetIP adds the ip to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetIP(ip *string) { + o.IP = ip +} + +// WithLimit adds the limit to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithLimit(limit *int64) *AdminAccountsGetV1Params { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithLocal adds the local to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithLocal(local *bool) *AdminAccountsGetV1Params { + o.SetLocal(local) + return o +} + +// SetLocal adds the local to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetLocal(local *bool) { + o.Local = local +} + +// WithMaxID adds the maxID to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithMaxID(maxID *string) *AdminAccountsGetV1Params { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithMinID(minID *string) *AdminAccountsGetV1Params { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetMinID(minID *string) { + o.MinID = minID +} + +// WithPending adds the pending to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithPending(pending *bool) *AdminAccountsGetV1Params { + o.SetPending(pending) + return o +} + +// SetPending adds the pending to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetPending(pending *bool) { + o.Pending = pending +} + +// WithRemote adds the remote to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithRemote(remote *bool) *AdminAccountsGetV1Params { + o.SetRemote(remote) + return o +} + +// SetRemote adds the remote to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetRemote(remote *bool) { + o.Remote = remote +} + +// WithSensitized adds the sensitized to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithSensitized(sensitized *bool) *AdminAccountsGetV1Params { + o.SetSensitized(sensitized) + return o +} + +// SetSensitized adds the sensitized to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetSensitized(sensitized *bool) { + o.Sensitized = sensitized +} + +// WithSilenced adds the silenced to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithSilenced(silenced *bool) *AdminAccountsGetV1Params { + o.SetSilenced(silenced) + return o +} + +// SetSilenced adds the silenced to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetSilenced(silenced *bool) { + o.Silenced = silenced +} + +// WithStaff adds the staff to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithStaff(staff *bool) *AdminAccountsGetV1Params { + o.SetStaff(staff) + return o +} + +// SetStaff adds the staff to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetStaff(staff *bool) { + o.Staff = staff +} + +// WithSuspended adds the suspended to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithSuspended(suspended *bool) *AdminAccountsGetV1Params { + o.SetSuspended(suspended) + return o +} + +// SetSuspended adds the suspended to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetSuspended(suspended *bool) { + o.Suspended = suspended +} + +// WithUsername adds the username to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithUsername(username *string) *AdminAccountsGetV1Params { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetUsername(username *string) { + o.Username = username +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminAccountsGetV1Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Active != nil { + + // query param active + var qrActive bool + + if o.Active != nil { + qrActive = *o.Active + } + qActive := swag.FormatBool(qrActive) + if qActive != "" { + + if err := r.SetQueryParam("active", qActive); err != nil { + return err + } + } + } + + if o.ByDomain != nil { + + // query param by_domain + var qrByDomain string + + if o.ByDomain != nil { + qrByDomain = *o.ByDomain + } + qByDomain := qrByDomain + if qByDomain != "" { + + if err := r.SetQueryParam("by_domain", qByDomain); err != nil { + return err + } + } + } + + if o.Disabled != nil { + + // query param disabled + var qrDisabled bool + + if o.Disabled != nil { + qrDisabled = *o.Disabled + } + qDisabled := swag.FormatBool(qrDisabled) + if qDisabled != "" { + + if err := r.SetQueryParam("disabled", qDisabled); err != nil { + return err + } + } + } + + if o.DisplayName != nil { + + // query param display_name + var qrDisplayName string + + if o.DisplayName != nil { + qrDisplayName = *o.DisplayName + } + qDisplayName := qrDisplayName + if qDisplayName != "" { + + if err := r.SetQueryParam("display_name", qDisplayName); err != nil { + return err + } + } + } + + if o.Email != nil { + + // query param email + var qrEmail string + + if o.Email != nil { + qrEmail = *o.Email + } + qEmail := qrEmail + if qEmail != "" { + + if err := r.SetQueryParam("email", qEmail); err != nil { + return err + } + } + } + + if o.IP != nil { + + // query param ip + var qrIP string + + if o.IP != nil { + qrIP = *o.IP + } + qIP := qrIP + if qIP != "" { + + if err := r.SetQueryParam("ip", qIP); 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.Local != nil { + + // query param local + var qrLocal bool + + if o.Local != nil { + qrLocal = *o.Local + } + qLocal := swag.FormatBool(qrLocal) + if qLocal != "" { + + if err := r.SetQueryParam("local", qLocal); err != nil { + return err + } + } + } + + if o.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if o.Pending != nil { + + // query param pending + var qrPending bool + + if o.Pending != nil { + qrPending = *o.Pending + } + qPending := swag.FormatBool(qrPending) + if qPending != "" { + + if err := r.SetQueryParam("pending", qPending); err != nil { + return err + } + } + } + + if o.Remote != nil { + + // query param remote + var qrRemote bool + + if o.Remote != nil { + qrRemote = *o.Remote + } + qRemote := swag.FormatBool(qrRemote) + if qRemote != "" { + + if err := r.SetQueryParam("remote", qRemote); err != nil { + return err + } + } + } + + if o.Sensitized != nil { + + // query param sensitized + var qrSensitized bool + + if o.Sensitized != nil { + qrSensitized = *o.Sensitized + } + qSensitized := swag.FormatBool(qrSensitized) + if qSensitized != "" { + + if err := r.SetQueryParam("sensitized", qSensitized); err != nil { + return err + } + } + } + + if o.Silenced != nil { + + // query param silenced + var qrSilenced bool + + if o.Silenced != nil { + qrSilenced = *o.Silenced + } + qSilenced := swag.FormatBool(qrSilenced) + if qSilenced != "" { + + if err := r.SetQueryParam("silenced", qSilenced); err != nil { + return err + } + } + } + + if o.Staff != nil { + + // query param staff + var qrStaff bool + + if o.Staff != nil { + qrStaff = *o.Staff + } + qStaff := swag.FormatBool(qrStaff) + if qStaff != "" { + + if err := r.SetQueryParam("staff", qStaff); err != nil { + return err + } + } + } + + if o.Suspended != nil { + + // query param suspended + var qrSuspended bool + + if o.Suspended != nil { + qrSuspended = *o.Suspended + } + qSuspended := swag.FormatBool(qrSuspended) + if qSuspended != "" { + + if err := r.SetQueryParam("suspended", qSuspended); err != nil { + return err + } + } + } + + if o.Username != nil { + + // query param username + var qrUsername string + + if o.Username != nil { + qrUsername = *o.Username + } + qUsername := qrUsername + if qUsername != "" { + + if err := r.SetQueryParam("username", qUsername); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_accounts_get_v1_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_accounts_get_v1_responses.go new file mode 100644 index 0000000..129ee70 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_accounts_get_v1_responses.go @@ -0,0 +1,488 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AdminAccountsGetV1Reader is a Reader for the AdminAccountsGetV1 structure. +type AdminAccountsGetV1Reader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminAccountsGetV1Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminAccountsGetV1OK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminAccountsGetV1BadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminAccountsGetV1Unauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewAdminAccountsGetV1Forbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminAccountsGetV1NotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminAccountsGetV1NotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminAccountsGetV1InternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/accounts] adminAccountsGetV1", response, response.Code()) + } +} + +// NewAdminAccountsGetV1OK creates a AdminAccountsGetV1OK with default headers values +func NewAdminAccountsGetV1OK() *AdminAccountsGetV1OK { + return &AdminAccountsGetV1OK{} +} + +/* +AdminAccountsGetV1OK describes a response with status code 200, with default header values. + +AdminAccountsGetV1OK admin accounts get v1 o k +*/ +type AdminAccountsGetV1OK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.AdminAccountInfo +} + +// IsSuccess returns true when this admin accounts get v1 o k response has a 2xx status code +func (o *AdminAccountsGetV1OK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admin accounts get v1 o k response has a 3xx status code +func (o *AdminAccountsGetV1OK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v1 o k response has a 4xx status code +func (o *AdminAccountsGetV1OK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin accounts get v1 o k response has a 5xx status code +func (o *AdminAccountsGetV1OK) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v1 o k response a status code equal to that given +func (o *AdminAccountsGetV1OK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admin accounts get v1 o k response +func (o *AdminAccountsGetV1OK) Code() int { + return 200 +} + +func (o *AdminAccountsGetV1OK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1OK %s", 200, payload) +} + +func (o *AdminAccountsGetV1OK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1OK %s", 200, payload) +} + +func (o *AdminAccountsGetV1OK) GetPayload() []*models.AdminAccountInfo { + return o.Payload +} + +func (o *AdminAccountsGetV1OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAdminAccountsGetV1BadRequest creates a AdminAccountsGetV1BadRequest with default headers values +func NewAdminAccountsGetV1BadRequest() *AdminAccountsGetV1BadRequest { + return &AdminAccountsGetV1BadRequest{} +} + +/* +AdminAccountsGetV1BadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminAccountsGetV1BadRequest struct { +} + +// IsSuccess returns true when this admin accounts get v1 bad request response has a 2xx status code +func (o *AdminAccountsGetV1BadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v1 bad request response has a 3xx status code +func (o *AdminAccountsGetV1BadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v1 bad request response has a 4xx status code +func (o *AdminAccountsGetV1BadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin accounts get v1 bad request response has a 5xx status code +func (o *AdminAccountsGetV1BadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v1 bad request response a status code equal to that given +func (o *AdminAccountsGetV1BadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admin accounts get v1 bad request response +func (o *AdminAccountsGetV1BadRequest) Code() int { + return 400 +} + +func (o *AdminAccountsGetV1BadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1BadRequest", 400) +} + +func (o *AdminAccountsGetV1BadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1BadRequest", 400) +} + +func (o *AdminAccountsGetV1BadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountsGetV1Unauthorized creates a AdminAccountsGetV1Unauthorized with default headers values +func NewAdminAccountsGetV1Unauthorized() *AdminAccountsGetV1Unauthorized { + return &AdminAccountsGetV1Unauthorized{} +} + +/* +AdminAccountsGetV1Unauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminAccountsGetV1Unauthorized struct { +} + +// IsSuccess returns true when this admin accounts get v1 unauthorized response has a 2xx status code +func (o *AdminAccountsGetV1Unauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v1 unauthorized response has a 3xx status code +func (o *AdminAccountsGetV1Unauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v1 unauthorized response has a 4xx status code +func (o *AdminAccountsGetV1Unauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin accounts get v1 unauthorized response has a 5xx status code +func (o *AdminAccountsGetV1Unauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v1 unauthorized response a status code equal to that given +func (o *AdminAccountsGetV1Unauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admin accounts get v1 unauthorized response +func (o *AdminAccountsGetV1Unauthorized) Code() int { + return 401 +} + +func (o *AdminAccountsGetV1Unauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1Unauthorized", 401) +} + +func (o *AdminAccountsGetV1Unauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1Unauthorized", 401) +} + +func (o *AdminAccountsGetV1Unauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountsGetV1Forbidden creates a AdminAccountsGetV1Forbidden with default headers values +func NewAdminAccountsGetV1Forbidden() *AdminAccountsGetV1Forbidden { + return &AdminAccountsGetV1Forbidden{} +} + +/* +AdminAccountsGetV1Forbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type AdminAccountsGetV1Forbidden struct { +} + +// IsSuccess returns true when this admin accounts get v1 forbidden response has a 2xx status code +func (o *AdminAccountsGetV1Forbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v1 forbidden response has a 3xx status code +func (o *AdminAccountsGetV1Forbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v1 forbidden response has a 4xx status code +func (o *AdminAccountsGetV1Forbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin accounts get v1 forbidden response has a 5xx status code +func (o *AdminAccountsGetV1Forbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v1 forbidden response a status code equal to that given +func (o *AdminAccountsGetV1Forbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the admin accounts get v1 forbidden response +func (o *AdminAccountsGetV1Forbidden) Code() int { + return 403 +} + +func (o *AdminAccountsGetV1Forbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1Forbidden", 403) +} + +func (o *AdminAccountsGetV1Forbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1Forbidden", 403) +} + +func (o *AdminAccountsGetV1Forbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountsGetV1NotFound creates a AdminAccountsGetV1NotFound with default headers values +func NewAdminAccountsGetV1NotFound() *AdminAccountsGetV1NotFound { + return &AdminAccountsGetV1NotFound{} +} + +/* +AdminAccountsGetV1NotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminAccountsGetV1NotFound struct { +} + +// IsSuccess returns true when this admin accounts get v1 not found response has a 2xx status code +func (o *AdminAccountsGetV1NotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v1 not found response has a 3xx status code +func (o *AdminAccountsGetV1NotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v1 not found response has a 4xx status code +func (o *AdminAccountsGetV1NotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin accounts get v1 not found response has a 5xx status code +func (o *AdminAccountsGetV1NotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v1 not found response a status code equal to that given +func (o *AdminAccountsGetV1NotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admin accounts get v1 not found response +func (o *AdminAccountsGetV1NotFound) Code() int { + return 404 +} + +func (o *AdminAccountsGetV1NotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1NotFound", 404) +} + +func (o *AdminAccountsGetV1NotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1NotFound", 404) +} + +func (o *AdminAccountsGetV1NotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountsGetV1NotAcceptable creates a AdminAccountsGetV1NotAcceptable with default headers values +func NewAdminAccountsGetV1NotAcceptable() *AdminAccountsGetV1NotAcceptable { + return &AdminAccountsGetV1NotAcceptable{} +} + +/* +AdminAccountsGetV1NotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminAccountsGetV1NotAcceptable struct { +} + +// IsSuccess returns true when this admin accounts get v1 not acceptable response has a 2xx status code +func (o *AdminAccountsGetV1NotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v1 not acceptable response has a 3xx status code +func (o *AdminAccountsGetV1NotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v1 not acceptable response has a 4xx status code +func (o *AdminAccountsGetV1NotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin accounts get v1 not acceptable response has a 5xx status code +func (o *AdminAccountsGetV1NotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v1 not acceptable response a status code equal to that given +func (o *AdminAccountsGetV1NotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admin accounts get v1 not acceptable response +func (o *AdminAccountsGetV1NotAcceptable) Code() int { + return 406 +} + +func (o *AdminAccountsGetV1NotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1NotAcceptable", 406) +} + +func (o *AdminAccountsGetV1NotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1NotAcceptable", 406) +} + +func (o *AdminAccountsGetV1NotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountsGetV1InternalServerError creates a AdminAccountsGetV1InternalServerError with default headers values +func NewAdminAccountsGetV1InternalServerError() *AdminAccountsGetV1InternalServerError { + return &AdminAccountsGetV1InternalServerError{} +} + +/* +AdminAccountsGetV1InternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminAccountsGetV1InternalServerError struct { +} + +// IsSuccess returns true when this admin accounts get v1 internal server error response has a 2xx status code +func (o *AdminAccountsGetV1InternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v1 internal server error response has a 3xx status code +func (o *AdminAccountsGetV1InternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v1 internal server error response has a 4xx status code +func (o *AdminAccountsGetV1InternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin accounts get v1 internal server error response has a 5xx status code +func (o *AdminAccountsGetV1InternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admin accounts get v1 internal server error response a status code equal to that given +func (o *AdminAccountsGetV1InternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admin accounts get v1 internal server error response +func (o *AdminAccountsGetV1InternalServerError) Code() int { + return 500 +} + +func (o *AdminAccountsGetV1InternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1InternalServerError", 500) +} + +func (o *AdminAccountsGetV1InternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1InternalServerError", 500) +} + +func (o *AdminAccountsGetV1InternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_accounts_get_v2_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_accounts_get_v2_parameters.go new file mode 100644 index 0000000..7b77a05 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_accounts_get_v2_parameters.go @@ -0,0 +1,596 @@ +// 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" +) + +// NewAdminAccountsGetV2Params creates a new AdminAccountsGetV2Params 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 NewAdminAccountsGetV2Params() *AdminAccountsGetV2Params { + return &AdminAccountsGetV2Params{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminAccountsGetV2ParamsWithTimeout creates a new AdminAccountsGetV2Params object +// with the ability to set a timeout on a request. +func NewAdminAccountsGetV2ParamsWithTimeout(timeout time.Duration) *AdminAccountsGetV2Params { + return &AdminAccountsGetV2Params{ + timeout: timeout, + } +} + +// NewAdminAccountsGetV2ParamsWithContext creates a new AdminAccountsGetV2Params object +// with the ability to set a context for a request. +func NewAdminAccountsGetV2ParamsWithContext(ctx context.Context) *AdminAccountsGetV2Params { + return &AdminAccountsGetV2Params{ + Context: ctx, + } +} + +// NewAdminAccountsGetV2ParamsWithHTTPClient creates a new AdminAccountsGetV2Params object +// with the ability to set a custom HTTPClient for a request. +func NewAdminAccountsGetV2ParamsWithHTTPClient(client *http.Client) *AdminAccountsGetV2Params { + return &AdminAccountsGetV2Params{ + HTTPClient: client, + } +} + +/* +AdminAccountsGetV2Params contains all the parameters to send to the API endpoint + + for the admin accounts get v2 operation. + + Typically these are written to a http.Request. +*/ +type AdminAccountsGetV2Params struct { + + /* ByDomain. + + Filter by the given domain. + */ + ByDomain *string + + /* DisplayName. + + Search for the given display name. + */ + DisplayName *string + + /* Email. + + Lookup a user with this email. + */ + Email *string + + /* InvitedBy. + + Lookup users invited by the account with this ID. + */ + InvitedBy *string + + /* IP. + + Lookup users with this IP address. + */ + IP *string + + /* Limit. + + Maximum number of results to return. + + Default: 50 + */ + Limit *int64 + + /* MaxID. + + max_id in the form `[domain]/@[username]`. All results returned will be later in the alphabet than `[domain]/@[username]`. For example, if max_id = `example.org/@someone` then returned entries might contain `example.org/@someone_else`, `later.example.org/@someone`, etc. Local account IDs in this form use an empty string for the `[domain]` part, for example local account with username `someone` would be `/@someone`. + */ + MaxID *string + + /* MinID. + + min_id in the form `[domain]/@[username]`. All results returned will be earlier in the alphabet than `[domain]/@[username]`. For example, if min_id = `example.org/@someone` then returned entries might contain `example.org/@earlier_account`, `earlier.example.org/@someone`, etc. Local account IDs in this form use an empty string for the `[domain]` part, for example local account with username `someone` would be `/@someone`. + */ + MinID *string + + /* Origin. + + Filter for `local` or `remote` accounts. + */ + Origin *string + + /* Permissions. + + Filter for accounts with staff permissions (users that can manage reports). + */ + Permissions *string + + /* RoleIds. + + Filter for users with these roles. + */ + RoleIds []string + + /* Status. + + Filter for `active`, `pending`, `disabled`, `silenced`, or `suspended` accounts. + */ + Status *string + + /* Username. + + Search for the given username. + */ + Username *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admin accounts get v2 params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountsGetV2Params) WithDefaults() *AdminAccountsGetV2Params { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admin accounts get v2 params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountsGetV2Params) SetDefaults() { + var ( + limitDefault = int64(50) + ) + + val := AdminAccountsGetV2Params{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithTimeout(timeout time.Duration) *AdminAccountsGetV2Params { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithContext(ctx context.Context) *AdminAccountsGetV2Params { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithHTTPClient(client *http.Client) *AdminAccountsGetV2Params { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithByDomain adds the byDomain to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithByDomain(byDomain *string) *AdminAccountsGetV2Params { + o.SetByDomain(byDomain) + return o +} + +// SetByDomain adds the byDomain to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetByDomain(byDomain *string) { + o.ByDomain = byDomain +} + +// WithDisplayName adds the displayName to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithDisplayName(displayName *string) *AdminAccountsGetV2Params { + o.SetDisplayName(displayName) + return o +} + +// SetDisplayName adds the displayName to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetDisplayName(displayName *string) { + o.DisplayName = displayName +} + +// WithEmail adds the email to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithEmail(email *string) *AdminAccountsGetV2Params { + o.SetEmail(email) + return o +} + +// SetEmail adds the email to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetEmail(email *string) { + o.Email = email +} + +// WithInvitedBy adds the invitedBy to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithInvitedBy(invitedBy *string) *AdminAccountsGetV2Params { + o.SetInvitedBy(invitedBy) + return o +} + +// SetInvitedBy adds the invitedBy to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetInvitedBy(invitedBy *string) { + o.InvitedBy = invitedBy +} + +// WithIP adds the ip to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithIP(ip *string) *AdminAccountsGetV2Params { + o.SetIP(ip) + return o +} + +// SetIP adds the ip to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetIP(ip *string) { + o.IP = ip +} + +// WithLimit adds the limit to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithLimit(limit *int64) *AdminAccountsGetV2Params { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithMaxID(maxID *string) *AdminAccountsGetV2Params { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithMinID(minID *string) *AdminAccountsGetV2Params { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetMinID(minID *string) { + o.MinID = minID +} + +// WithOrigin adds the origin to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithOrigin(origin *string) *AdminAccountsGetV2Params { + o.SetOrigin(origin) + return o +} + +// SetOrigin adds the origin to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetOrigin(origin *string) { + o.Origin = origin +} + +// WithPermissions adds the permissions to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithPermissions(permissions *string) *AdminAccountsGetV2Params { + o.SetPermissions(permissions) + return o +} + +// SetPermissions adds the permissions to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetPermissions(permissions *string) { + o.Permissions = permissions +} + +// WithRoleIds adds the roleIds to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithRoleIds(roleIds []string) *AdminAccountsGetV2Params { + o.SetRoleIds(roleIds) + return o +} + +// SetRoleIds adds the roleIds to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetRoleIds(roleIds []string) { + o.RoleIds = roleIds +} + +// WithStatus adds the status to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithStatus(status *string) *AdminAccountsGetV2Params { + o.SetStatus(status) + return o +} + +// SetStatus adds the status to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetStatus(status *string) { + o.Status = status +} + +// WithUsername adds the username to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithUsername(username *string) *AdminAccountsGetV2Params { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetUsername(username *string) { + o.Username = username +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminAccountsGetV2Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ByDomain != nil { + + // query param by_domain + var qrByDomain string + + if o.ByDomain != nil { + qrByDomain = *o.ByDomain + } + qByDomain := qrByDomain + if qByDomain != "" { + + if err := r.SetQueryParam("by_domain", qByDomain); err != nil { + return err + } + } + } + + if o.DisplayName != nil { + + // query param display_name + var qrDisplayName string + + if o.DisplayName != nil { + qrDisplayName = *o.DisplayName + } + qDisplayName := qrDisplayName + if qDisplayName != "" { + + if err := r.SetQueryParam("display_name", qDisplayName); err != nil { + return err + } + } + } + + if o.Email != nil { + + // query param email + var qrEmail string + + if o.Email != nil { + qrEmail = *o.Email + } + qEmail := qrEmail + if qEmail != "" { + + if err := r.SetQueryParam("email", qEmail); err != nil { + return err + } + } + } + + if o.InvitedBy != nil { + + // query param invited_by + var qrInvitedBy string + + if o.InvitedBy != nil { + qrInvitedBy = *o.InvitedBy + } + qInvitedBy := qrInvitedBy + if qInvitedBy != "" { + + if err := r.SetQueryParam("invited_by", qInvitedBy); err != nil { + return err + } + } + } + + if o.IP != nil { + + // query param ip + var qrIP string + + if o.IP != nil { + qrIP = *o.IP + } + qIP := qrIP + if qIP != "" { + + if err := r.SetQueryParam("ip", qIP); 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.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if o.Origin != nil { + + // query param origin + var qrOrigin string + + if o.Origin != nil { + qrOrigin = *o.Origin + } + qOrigin := qrOrigin + if qOrigin != "" { + + if err := r.SetQueryParam("origin", qOrigin); err != nil { + return err + } + } + } + + if o.Permissions != nil { + + // query param permissions + var qrPermissions string + + if o.Permissions != nil { + qrPermissions = *o.Permissions + } + qPermissions := qrPermissions + if qPermissions != "" { + + if err := r.SetQueryParam("permissions", qPermissions); err != nil { + return err + } + } + } + + if o.RoleIds != nil { + + // binding items for role_ids[] + joinedRoleIds := o.bindParamRoleIds(reg) + + // query array param role_ids[] + if err := r.SetQueryParam("role_ids[]", joinedRoleIds...); 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 o.Username != nil { + + // query param username + var qrUsername string + + if o.Username != nil { + qrUsername = *o.Username + } + qUsername := qrUsername + if qUsername != "" { + + if err := r.SetQueryParam("username", qUsername); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamAdminAccountsGetV2 binds the parameter role_ids[] +func (o *AdminAccountsGetV2Params) bindParamRoleIds(formats strfmt.Registry) []string { + roleIdsIR := o.RoleIds + + var roleIdsIC []string + for _, roleIdsIIR := range roleIdsIR { // explode []string + + roleIdsIIV := roleIdsIIR // string as string + roleIdsIC = append(roleIdsIC, roleIdsIIV) + } + + // items.CollectionFormat: "" + roleIdsIS := swag.JoinByFormat(roleIdsIC, "") + + return roleIdsIS +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_accounts_get_v2_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_accounts_get_v2_responses.go new file mode 100644 index 0000000..5796499 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_accounts_get_v2_responses.go @@ -0,0 +1,488 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AdminAccountsGetV2Reader is a Reader for the AdminAccountsGetV2 structure. +type AdminAccountsGetV2Reader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminAccountsGetV2Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminAccountsGetV2OK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminAccountsGetV2BadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminAccountsGetV2Unauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewAdminAccountsGetV2Forbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminAccountsGetV2NotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminAccountsGetV2NotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminAccountsGetV2InternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v2/admin/accounts] adminAccountsGetV2", response, response.Code()) + } +} + +// NewAdminAccountsGetV2OK creates a AdminAccountsGetV2OK with default headers values +func NewAdminAccountsGetV2OK() *AdminAccountsGetV2OK { + return &AdminAccountsGetV2OK{} +} + +/* +AdminAccountsGetV2OK describes a response with status code 200, with default header values. + +AdminAccountsGetV2OK admin accounts get v2 o k +*/ +type AdminAccountsGetV2OK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.AdminAccountInfo +} + +// IsSuccess returns true when this admin accounts get v2 o k response has a 2xx status code +func (o *AdminAccountsGetV2OK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admin accounts get v2 o k response has a 3xx status code +func (o *AdminAccountsGetV2OK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v2 o k response has a 4xx status code +func (o *AdminAccountsGetV2OK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin accounts get v2 o k response has a 5xx status code +func (o *AdminAccountsGetV2OK) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v2 o k response a status code equal to that given +func (o *AdminAccountsGetV2OK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admin accounts get v2 o k response +func (o *AdminAccountsGetV2OK) Code() int { + return 200 +} + +func (o *AdminAccountsGetV2OK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2OK %s", 200, payload) +} + +func (o *AdminAccountsGetV2OK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2OK %s", 200, payload) +} + +func (o *AdminAccountsGetV2OK) GetPayload() []*models.AdminAccountInfo { + return o.Payload +} + +func (o *AdminAccountsGetV2OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAdminAccountsGetV2BadRequest creates a AdminAccountsGetV2BadRequest with default headers values +func NewAdminAccountsGetV2BadRequest() *AdminAccountsGetV2BadRequest { + return &AdminAccountsGetV2BadRequest{} +} + +/* +AdminAccountsGetV2BadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminAccountsGetV2BadRequest struct { +} + +// IsSuccess returns true when this admin accounts get v2 bad request response has a 2xx status code +func (o *AdminAccountsGetV2BadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v2 bad request response has a 3xx status code +func (o *AdminAccountsGetV2BadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v2 bad request response has a 4xx status code +func (o *AdminAccountsGetV2BadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin accounts get v2 bad request response has a 5xx status code +func (o *AdminAccountsGetV2BadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v2 bad request response a status code equal to that given +func (o *AdminAccountsGetV2BadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admin accounts get v2 bad request response +func (o *AdminAccountsGetV2BadRequest) Code() int { + return 400 +} + +func (o *AdminAccountsGetV2BadRequest) Error() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2BadRequest", 400) +} + +func (o *AdminAccountsGetV2BadRequest) String() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2BadRequest", 400) +} + +func (o *AdminAccountsGetV2BadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountsGetV2Unauthorized creates a AdminAccountsGetV2Unauthorized with default headers values +func NewAdminAccountsGetV2Unauthorized() *AdminAccountsGetV2Unauthorized { + return &AdminAccountsGetV2Unauthorized{} +} + +/* +AdminAccountsGetV2Unauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminAccountsGetV2Unauthorized struct { +} + +// IsSuccess returns true when this admin accounts get v2 unauthorized response has a 2xx status code +func (o *AdminAccountsGetV2Unauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v2 unauthorized response has a 3xx status code +func (o *AdminAccountsGetV2Unauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v2 unauthorized response has a 4xx status code +func (o *AdminAccountsGetV2Unauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin accounts get v2 unauthorized response has a 5xx status code +func (o *AdminAccountsGetV2Unauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v2 unauthorized response a status code equal to that given +func (o *AdminAccountsGetV2Unauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admin accounts get v2 unauthorized response +func (o *AdminAccountsGetV2Unauthorized) Code() int { + return 401 +} + +func (o *AdminAccountsGetV2Unauthorized) Error() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2Unauthorized", 401) +} + +func (o *AdminAccountsGetV2Unauthorized) String() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2Unauthorized", 401) +} + +func (o *AdminAccountsGetV2Unauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountsGetV2Forbidden creates a AdminAccountsGetV2Forbidden with default headers values +func NewAdminAccountsGetV2Forbidden() *AdminAccountsGetV2Forbidden { + return &AdminAccountsGetV2Forbidden{} +} + +/* +AdminAccountsGetV2Forbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type AdminAccountsGetV2Forbidden struct { +} + +// IsSuccess returns true when this admin accounts get v2 forbidden response has a 2xx status code +func (o *AdminAccountsGetV2Forbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v2 forbidden response has a 3xx status code +func (o *AdminAccountsGetV2Forbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v2 forbidden response has a 4xx status code +func (o *AdminAccountsGetV2Forbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin accounts get v2 forbidden response has a 5xx status code +func (o *AdminAccountsGetV2Forbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v2 forbidden response a status code equal to that given +func (o *AdminAccountsGetV2Forbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the admin accounts get v2 forbidden response +func (o *AdminAccountsGetV2Forbidden) Code() int { + return 403 +} + +func (o *AdminAccountsGetV2Forbidden) Error() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2Forbidden", 403) +} + +func (o *AdminAccountsGetV2Forbidden) String() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2Forbidden", 403) +} + +func (o *AdminAccountsGetV2Forbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountsGetV2NotFound creates a AdminAccountsGetV2NotFound with default headers values +func NewAdminAccountsGetV2NotFound() *AdminAccountsGetV2NotFound { + return &AdminAccountsGetV2NotFound{} +} + +/* +AdminAccountsGetV2NotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminAccountsGetV2NotFound struct { +} + +// IsSuccess returns true when this admin accounts get v2 not found response has a 2xx status code +func (o *AdminAccountsGetV2NotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v2 not found response has a 3xx status code +func (o *AdminAccountsGetV2NotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v2 not found response has a 4xx status code +func (o *AdminAccountsGetV2NotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin accounts get v2 not found response has a 5xx status code +func (o *AdminAccountsGetV2NotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v2 not found response a status code equal to that given +func (o *AdminAccountsGetV2NotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admin accounts get v2 not found response +func (o *AdminAccountsGetV2NotFound) Code() int { + return 404 +} + +func (o *AdminAccountsGetV2NotFound) Error() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2NotFound", 404) +} + +func (o *AdminAccountsGetV2NotFound) String() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2NotFound", 404) +} + +func (o *AdminAccountsGetV2NotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountsGetV2NotAcceptable creates a AdminAccountsGetV2NotAcceptable with default headers values +func NewAdminAccountsGetV2NotAcceptable() *AdminAccountsGetV2NotAcceptable { + return &AdminAccountsGetV2NotAcceptable{} +} + +/* +AdminAccountsGetV2NotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminAccountsGetV2NotAcceptable struct { +} + +// IsSuccess returns true when this admin accounts get v2 not acceptable response has a 2xx status code +func (o *AdminAccountsGetV2NotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v2 not acceptable response has a 3xx status code +func (o *AdminAccountsGetV2NotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v2 not acceptable response has a 4xx status code +func (o *AdminAccountsGetV2NotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin accounts get v2 not acceptable response has a 5xx status code +func (o *AdminAccountsGetV2NotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v2 not acceptable response a status code equal to that given +func (o *AdminAccountsGetV2NotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admin accounts get v2 not acceptable response +func (o *AdminAccountsGetV2NotAcceptable) Code() int { + return 406 +} + +func (o *AdminAccountsGetV2NotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2NotAcceptable", 406) +} + +func (o *AdminAccountsGetV2NotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2NotAcceptable", 406) +} + +func (o *AdminAccountsGetV2NotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountsGetV2InternalServerError creates a AdminAccountsGetV2InternalServerError with default headers values +func NewAdminAccountsGetV2InternalServerError() *AdminAccountsGetV2InternalServerError { + return &AdminAccountsGetV2InternalServerError{} +} + +/* +AdminAccountsGetV2InternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminAccountsGetV2InternalServerError struct { +} + +// IsSuccess returns true when this admin accounts get v2 internal server error response has a 2xx status code +func (o *AdminAccountsGetV2InternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v2 internal server error response has a 3xx status code +func (o *AdminAccountsGetV2InternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v2 internal server error response has a 4xx status code +func (o *AdminAccountsGetV2InternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin accounts get v2 internal server error response has a 5xx status code +func (o *AdminAccountsGetV2InternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admin accounts get v2 internal server error response a status code equal to that given +func (o *AdminAccountsGetV2InternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admin accounts get v2 internal server error response +func (o *AdminAccountsGetV2InternalServerError) Code() int { + return 500 +} + +func (o *AdminAccountsGetV2InternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2InternalServerError", 500) +} + +func (o *AdminAccountsGetV2InternalServerError) String() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2InternalServerError", 500) +} + +func (o *AdminAccountsGetV2InternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_client.go new file mode 100644 index 0000000..baff4e2 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_client.go @@ -0,0 +1,1836 @@ +// 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" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new admin API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new admin API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new admin API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for admin API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded". +func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} +} + +// WithContentTypeApplicationXML sets the Content-Type header to "application/xml". +func WithContentTypeApplicationXML(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/xml"} +} + +// WithContentTypeMultipartFormData sets the Content-Type header to "multipart/form-data". +func WithContentTypeMultipartFormData(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"multipart/form-data"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + AdminAccountAction(params *AdminAccountActionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountActionOK, error) + + AdminAccountApprove(params *AdminAccountApproveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountApproveOK, error) + + AdminAccountGet(params *AdminAccountGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountGetOK, error) + + AdminAccountReject(params *AdminAccountRejectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountRejectOK, error) + + AdminAccountsGetV1(params *AdminAccountsGetV1Params, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountsGetV1OK, error) + + AdminAccountsGetV2(params *AdminAccountsGetV2Params, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountsGetV2OK, error) + + AdminReportGet(params *AdminReportGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminReportGetOK, error) + + AdminReportResolve(params *AdminReportResolveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminReportResolveOK, error) + + AdminReports(params *AdminReportsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminReportsOK, error) + + AdminRuleGet(params *AdminRuleGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminRuleGetOK, error) + + AdminsRuleGet(params *AdminsRuleGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminsRuleGetOK, error) + + DomainAllowCreate(params *DomainAllowCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainAllowCreateOK, error) + + DomainAllowDelete(params *DomainAllowDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainAllowDeleteOK, error) + + DomainAllowGet(params *DomainAllowGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainAllowGetOK, error) + + DomainAllowsGet(params *DomainAllowsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainAllowsGetOK, error) + + DomainBlockCreate(params *DomainBlockCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainBlockCreateOK, error) + + DomainBlockDelete(params *DomainBlockDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainBlockDeleteOK, error) + + DomainBlockGet(params *DomainBlockGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainBlockGetOK, error) + + DomainBlocksGet(params *DomainBlocksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainBlocksGetOK, error) + + DomainKeysExpire(params *DomainKeysExpireParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainKeysExpireAccepted, error) + + EmojiCategoriesGet(params *EmojiCategoriesGetParams, opts ...ClientOption) (*EmojiCategoriesGetOK, error) + + EmojiCreate(params *EmojiCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EmojiCreateOK, error) + + EmojiDelete(params *EmojiDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EmojiDeleteOK, error) + + EmojiGet(params *EmojiGetParams, opts ...ClientOption) (*EmojiGetOK, error) + + EmojiUpdate(params *EmojiUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EmojiUpdateOK, error) + + EmojisGet(params *EmojisGetParams, opts ...ClientOption) (*EmojisGetOK, error) + + HeaderFilterAllowCreate(params *HeaderFilterAllowCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterAllowCreateOK, error) + + HeaderFilterAllowDelete(params *HeaderFilterAllowDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterAllowDeleteAccepted, error) + + HeaderFilterAllowGet(params *HeaderFilterAllowGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterAllowGetOK, error) + + HeaderFilterAllowsGet(params *HeaderFilterAllowsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterAllowsGetOK, error) + + HeaderFilterBlockCreate(params *HeaderFilterBlockCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterBlockCreateOK, error) + + HeaderFilterBlockDelete(params *HeaderFilterBlockDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterBlockDeleteAccepted, error) + + HeaderFilterBlockGet(params *HeaderFilterBlockGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterBlockGetOK, error) + + HeaderFilterBlocksGet(params *HeaderFilterBlocksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterBlocksGetOK, error) + + MediaCleanup(params *MediaCleanupParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MediaCleanupOK, error) + + MediaRefetch(params *MediaRefetchParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MediaRefetchAccepted, error) + + RuleCreate(params *RuleCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RuleCreateOK, error) + + RuleDelete(params *RuleDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RuleDeleteOK, error) + + RuleUpdate(params *RuleUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RuleUpdateOK, error) + + TestEmailSend(params *TestEmailSendParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TestEmailSendAccepted, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +AdminAccountAction performs an admin action on an account +*/ +func (a *Client) AdminAccountAction(params *AdminAccountActionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountActionOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminAccountActionParams() + } + op := &runtime.ClientOperation{ + ID: "adminAccountAction", + Method: "POST", + PathPattern: "/api/v1/admin/accounts/{id}/action", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminAccountActionReader{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.(*AdminAccountActionOK) + 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 adminAccountAction: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AdminAccountApprove approves pending account +*/ +func (a *Client) AdminAccountApprove(params *AdminAccountApproveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountApproveOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminAccountApproveParams() + } + op := &runtime.ClientOperation{ + ID: "adminAccountApprove", + Method: "POST", + PathPattern: "/api/v1/admin/accounts/{id}/approve", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminAccountApproveReader{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.(*AdminAccountApproveOK) + 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 adminAccountApprove: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AdminAccountGet views one account +*/ +func (a *Client) AdminAccountGet(params *AdminAccountGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminAccountGetParams() + } + op := &runtime.ClientOperation{ + ID: "adminAccountGet", + Method: "GET", + PathPattern: "/api/v1/admin/accounts/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminAccountGetReader{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.(*AdminAccountGetOK) + 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 adminAccountGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AdminAccountReject rejects pending account +*/ +func (a *Client) AdminAccountReject(params *AdminAccountRejectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountRejectOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminAccountRejectParams() + } + op := &runtime.ClientOperation{ + ID: "adminAccountReject", + Method: "POST", + PathPattern: "/api/v1/admin/accounts/{id}/reject", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminAccountRejectReader{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.(*AdminAccountRejectOK) + 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 adminAccountReject: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + AdminAccountsGetV1 views page through known accounts according to given filters + + Returned accounts will be ordered alphabetically (a-z) by domain + username. + +The next and previous queries can be parsed from the returned Link header. +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) AdminAccountsGetV1(params *AdminAccountsGetV1Params, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountsGetV1OK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminAccountsGetV1Params() + } + op := &runtime.ClientOperation{ + ID: "adminAccountsGetV1", + Method: "GET", + PathPattern: "/api/v1/admin/accounts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminAccountsGetV1Reader{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.(*AdminAccountsGetV1OK) + 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 adminAccountsGetV1: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + AdminAccountsGetV2 views page through known accounts according to given filters + + Returned accounts will be ordered alphabetically (a-z) by domain + username. + +The next and previous queries can be parsed from the returned Link header. +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) AdminAccountsGetV2(params *AdminAccountsGetV2Params, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountsGetV2OK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminAccountsGetV2Params() + } + op := &runtime.ClientOperation{ + ID: "adminAccountsGetV2", + Method: "GET", + PathPattern: "/api/v2/admin/accounts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminAccountsGetV2Reader{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.(*AdminAccountsGetV2OK) + 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 adminAccountsGetV2: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AdminReportGet views user moderation report with the given id +*/ +func (a *Client) AdminReportGet(params *AdminReportGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminReportGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminReportGetParams() + } + op := &runtime.ClientOperation{ + ID: "adminReportGet", + Method: "GET", + PathPattern: "/api/v1/admin/reports/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminReportGetReader{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.(*AdminReportGetOK) + 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 adminReportGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AdminReportResolve marks a report as resolved +*/ +func (a *Client) AdminReportResolve(params *AdminReportResolveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminReportResolveOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminReportResolveParams() + } + op := &runtime.ClientOperation{ + ID: "adminReportResolve", + Method: "POST", + PathPattern: "/api/v1/admin/reports/{id}/resolve", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminReportResolveReader{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.(*AdminReportResolveOK) + 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 adminReportResolve: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + AdminReports views user moderation reports + + The reports will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer). + +The next and previous queries can be parsed from the returned Link header. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) AdminReports(params *AdminReportsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminReportsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminReportsParams() + } + op := &runtime.ClientOperation{ + ID: "adminReports", + Method: "GET", + PathPattern: "/api/v1/admin/reports", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminReportsReader{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.(*AdminReportsOK) + 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 adminReports: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AdminRuleGet views instance rule with the given id +*/ +func (a *Client) AdminRuleGet(params *AdminRuleGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminRuleGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminRuleGetParams() + } + op := &runtime.ClientOperation{ + ID: "adminRuleGet", + Method: "GET", + PathPattern: "/api/v1/admin/rules/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminRuleGetReader{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.(*AdminRuleGetOK) + 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 adminRuleGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AdminsRuleGet views instance rules with i ds + +The rules will be returned in order (sorted by Order ascending). +*/ +func (a *Client) AdminsRuleGet(params *AdminsRuleGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminsRuleGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminsRuleGetParams() + } + op := &runtime.ClientOperation{ + ID: "adminsRuleGet", + Method: "GET", + PathPattern: "/api/v1/admin/rules", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminsRuleGetReader{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.(*AdminsRuleGetOK) + 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 adminsRuleGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + DomainAllowCreate creates one or more domain allows from a string or a file + + You have two options when using this endpoint: either you can set `import` to `true` and + +upload a file containing multiple domain allows, JSON-formatted, or you can leave import as +`false`, and just add one domain allow. + +The format of the json file should be something like: `[{"domain":"example.org"},{"domain":"whatever.com","public_comment":"they smell"}]` +*/ +func (a *Client) DomainAllowCreate(params *DomainAllowCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainAllowCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDomainAllowCreateParams() + } + op := &runtime.ClientOperation{ + ID: "domainAllowCreate", + Method: "POST", + PathPattern: "/api/v1/admin/domain_allows", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DomainAllowCreateReader{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.(*DomainAllowCreateOK) + 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 domainAllowCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +DomainAllowDelete deletes domain allow with the given ID +*/ +func (a *Client) DomainAllowDelete(params *DomainAllowDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainAllowDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDomainAllowDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "domainAllowDelete", + Method: "DELETE", + PathPattern: "/api/v1/admin/domain_allows/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DomainAllowDeleteReader{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.(*DomainAllowDeleteOK) + 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 domainAllowDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +DomainAllowGet views domain allow with the given ID +*/ +func (a *Client) DomainAllowGet(params *DomainAllowGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainAllowGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDomainAllowGetParams() + } + op := &runtime.ClientOperation{ + ID: "domainAllowGet", + Method: "GET", + PathPattern: "/api/v1/admin/domain_allows/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DomainAllowGetReader{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.(*DomainAllowGetOK) + 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 domainAllowGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +DomainAllowsGet views all domain allows currently in place +*/ +func (a *Client) DomainAllowsGet(params *DomainAllowsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainAllowsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDomainAllowsGetParams() + } + op := &runtime.ClientOperation{ + ID: "domainAllowsGet", + Method: "GET", + PathPattern: "/api/v1/admin/domain_allows", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DomainAllowsGetReader{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.(*DomainAllowsGetOK) + 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 domainAllowsGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + DomainBlockCreate creates one or more domain blocks from a string or a file + + You have two options when using this endpoint: either you can set `import` to `true` and + +upload a file containing multiple domain blocks, JSON-formatted, or you can leave import as +`false`, and just add one domain block. + +The format of the json file should be something like: `[{"domain":"example.org"},{"domain":"whatever.com","public_comment":"they smell"}]` +*/ +func (a *Client) DomainBlockCreate(params *DomainBlockCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainBlockCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDomainBlockCreateParams() + } + op := &runtime.ClientOperation{ + ID: "domainBlockCreate", + Method: "POST", + PathPattern: "/api/v1/admin/domain_blocks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DomainBlockCreateReader{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.(*DomainBlockCreateOK) + 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 domainBlockCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +DomainBlockDelete deletes domain block with the given ID +*/ +func (a *Client) DomainBlockDelete(params *DomainBlockDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainBlockDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDomainBlockDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "domainBlockDelete", + Method: "DELETE", + PathPattern: "/api/v1/admin/domain_blocks/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DomainBlockDeleteReader{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.(*DomainBlockDeleteOK) + 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 domainBlockDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +DomainBlockGet views domain block with the given ID +*/ +func (a *Client) DomainBlockGet(params *DomainBlockGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainBlockGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDomainBlockGetParams() + } + op := &runtime.ClientOperation{ + ID: "domainBlockGet", + Method: "GET", + PathPattern: "/api/v1/admin/domain_blocks/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DomainBlockGetReader{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.(*DomainBlockGetOK) + 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 domainBlockGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +DomainBlocksGet views all domain blocks currently in place +*/ +func (a *Client) DomainBlocksGet(params *DomainBlocksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainBlocksGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDomainBlocksGetParams() + } + op := &runtime.ClientOperation{ + ID: "domainBlocksGet", + Method: "GET", + PathPattern: "/api/v1/admin/domain_blocks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DomainBlocksGetReader{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.(*DomainBlocksGetOK) + 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 domainBlocksGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + DomainKeysExpire forces expiry of cached public keys for all accounts on the given domain stored in your database + + This is useful in cases where the remote domain has had to rotate their keys for whatever + +reason (security issue, data leak, routine safety procedure, etc), and your instance can no +longer communicate with theirs properly using cached keys. A key marked as expired in this way +will be lazily refetched next time a request is made to your instance signed by the owner of that +key, so no further action should be required in order to reestablish communication with that domain. + +This endpoint is explicitly not for rotating your *own* keys, it only works for remote instances. + +Using this endpoint to expire keys for a domain that hasn't rotated all of their keys is not +harmful and won't break federation, but it is pointless and will cause unnecessary requests to +be performed. +*/ +func (a *Client) DomainKeysExpire(params *DomainKeysExpireParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainKeysExpireAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDomainKeysExpireParams() + } + op := &runtime.ClientOperation{ + ID: "domainKeysExpire", + Method: "POST", + PathPattern: "/api/v1/admin/domain_keys_expire", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DomainKeysExpireReader{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.(*DomainKeysExpireAccepted) + 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 domainKeysExpire: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +EmojiCategoriesGet gets a list of existing emoji categories +*/ +func (a *Client) EmojiCategoriesGet(params *EmojiCategoriesGetParams, opts ...ClientOption) (*EmojiCategoriesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewEmojiCategoriesGetParams() + } + op := &runtime.ClientOperation{ + ID: "emojiCategoriesGet", + Method: "GET", + PathPattern: "/api/v1/admin/custom_emojis/categories", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &EmojiCategoriesGetReader{formats: a.formats}, + 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.(*EmojiCategoriesGetOK) + 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 emojiCategoriesGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +EmojiCreate uploads and create a new instance emoji +*/ +func (a *Client) EmojiCreate(params *EmojiCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EmojiCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewEmojiCreateParams() + } + op := &runtime.ClientOperation{ + ID: "emojiCreate", + Method: "POST", + PathPattern: "/api/v1/admin/custom_emojis", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &EmojiCreateReader{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.(*EmojiCreateOK) + 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 emojiCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + EmojiDelete deletes a local emoji with the given ID from the instance + + Emoji with the given ID will no longer be available to use on the instance. + +If you just want to update the emoji image instead, use the `/api/v1/admin/custom_emojis/{id}` PATCH route. + +To disable emojis from **remote** instances, use the `/api/v1/admin/custom_emojis/{id}` PATCH route. +*/ +func (a *Client) EmojiDelete(params *EmojiDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EmojiDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewEmojiDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "emojiDelete", + Method: "DELETE", + PathPattern: "/api/v1/admin/custom_emojis/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &EmojiDeleteReader{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.(*EmojiDeleteOK) + 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 emojiDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +EmojiGet gets the admin view of a single emoji +*/ +func (a *Client) EmojiGet(params *EmojiGetParams, opts ...ClientOption) (*EmojiGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewEmojiGetParams() + } + op := &runtime.ClientOperation{ + ID: "emojiGet", + Method: "GET", + PathPattern: "/api/v1/admin/custom_emojis/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &EmojiGetReader{formats: a.formats}, + 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.(*EmojiGetOK) + 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 emojiGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + EmojiUpdate performs admin action on a local or remote emoji known to this instance + + Action performed depends upon the action `type` provided. + +`disable`: disable a REMOTE emoji from being used/displayed on this instance. Does not work for local emojis. + +`copy`: copy a REMOTE emoji to this instance. When doing this action, a shortcode MUST be provided, and it must +be unique among emojis already present on this instance. A category MAY be provided, and the copied emoji will then +be put into the provided category. + +`modify`: modify a LOCAL emoji. You can provide a new image for the emoji and/or update the category. + +Local emojis cannot be deleted using this endpoint. To delete a local emoji, check DELETE /api/v1/admin/custom_emojis/{id} instead. +*/ +func (a *Client) EmojiUpdate(params *EmojiUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EmojiUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewEmojiUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "emojiUpdate", + Method: "PATCH", + PathPattern: "/api/v1/admin/custom_emojis/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &EmojiUpdateReader{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.(*EmojiUpdateOK) + 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 emojiUpdate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + EmojisGet views local and remote emojis available to known by this instance + + The next and previous queries can be parsed from the returned Link header. + +Example: + +`; rel="next", ; rel="prev"` +*/ +func (a *Client) EmojisGet(params *EmojisGetParams, opts ...ClientOption) (*EmojisGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewEmojisGetParams() + } + op := &runtime.ClientOperation{ + ID: "emojisGet", + Method: "GET", + PathPattern: "/api/v1/admin/custom_emojis", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &EmojisGetReader{formats: a.formats}, + 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.(*EmojisGetOK) + 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 emojisGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + HeaderFilterAllowCreate creates new allow HTTP request header filter + + The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'. + +The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'. +*/ +func (a *Client) HeaderFilterAllowCreate(params *HeaderFilterAllowCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterAllowCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeaderFilterAllowCreateParams() + } + op := &runtime.ClientOperation{ + ID: "headerFilterAllowCreate", + Method: "POST", + PathPattern: "/api/v1/admin/header_allows", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &HeaderFilterAllowCreateReader{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.(*HeaderFilterAllowCreateOK) + 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 headerFilterAllowCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeaderFilterAllowDelete deletes the allow header filter with the given ID +*/ +func (a *Client) HeaderFilterAllowDelete(params *HeaderFilterAllowDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterAllowDeleteAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeaderFilterAllowDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "headerFilterAllowDelete", + Method: "DELETE", + PathPattern: "/api/v1/admin/header_allows/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &HeaderFilterAllowDeleteReader{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.(*HeaderFilterAllowDeleteAccepted) + 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 headerFilterAllowDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeaderFilterAllowGet gets allow header filter with the given ID +*/ +func (a *Client) HeaderFilterAllowGet(params *HeaderFilterAllowGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterAllowGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeaderFilterAllowGetParams() + } + op := &runtime.ClientOperation{ + ID: "headerFilterAllowGet", + Method: "GET", + PathPattern: "/api/v1/admin/header_allows/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &HeaderFilterAllowGetReader{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.(*HeaderFilterAllowGetOK) + 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 headerFilterAllowGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeaderFilterAllowsGet gets all allow header filters currently in place +*/ +func (a *Client) HeaderFilterAllowsGet(params *HeaderFilterAllowsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterAllowsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeaderFilterAllowsGetParams() + } + op := &runtime.ClientOperation{ + ID: "headerFilterAllowsGet", + Method: "GET", + PathPattern: "/api/v1/admin/header_allows", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &HeaderFilterAllowsGetReader{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.(*HeaderFilterAllowsGetOK) + 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 headerFilterAllowsGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + HeaderFilterBlockCreate creates new block HTTP request header filter + + The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'. + +The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'. +*/ +func (a *Client) HeaderFilterBlockCreate(params *HeaderFilterBlockCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterBlockCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeaderFilterBlockCreateParams() + } + op := &runtime.ClientOperation{ + ID: "headerFilterBlockCreate", + Method: "POST", + PathPattern: "/api/v1/admin/header_blocks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &HeaderFilterBlockCreateReader{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.(*HeaderFilterBlockCreateOK) + 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 headerFilterBlockCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeaderFilterBlockDelete deletes the block header filter with the given ID +*/ +func (a *Client) HeaderFilterBlockDelete(params *HeaderFilterBlockDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterBlockDeleteAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeaderFilterBlockDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "headerFilterBlockDelete", + Method: "DELETE", + PathPattern: "/api/v1/admin/header_blocks/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &HeaderFilterBlockDeleteReader{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.(*HeaderFilterBlockDeleteAccepted) + 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 headerFilterBlockDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeaderFilterBlockGet gets block header filter with the given ID +*/ +func (a *Client) HeaderFilterBlockGet(params *HeaderFilterBlockGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterBlockGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeaderFilterBlockGetParams() + } + op := &runtime.ClientOperation{ + ID: "headerFilterBlockGet", + Method: "GET", + PathPattern: "/api/v1/admin/header_blocks/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &HeaderFilterBlockGetReader{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.(*HeaderFilterBlockGetOK) + 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 headerFilterBlockGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeaderFilterBlocksGet gets all allow header filters currently in place +*/ +func (a *Client) HeaderFilterBlocksGet(params *HeaderFilterBlocksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterBlocksGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeaderFilterBlocksGetParams() + } + op := &runtime.ClientOperation{ + ID: "headerFilterBlocksGet", + Method: "GET", + PathPattern: "/api/v1/admin/header_blocks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &HeaderFilterBlocksGetReader{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.(*HeaderFilterBlocksGetOK) + 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 headerFilterBlocksGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +MediaCleanup cleans up remote media older than the specified number of days + +Also cleans up unused headers + avatars from the media cache and prunes orphaned items from storage. +*/ +func (a *Client) MediaCleanup(params *MediaCleanupParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MediaCleanupOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMediaCleanupParams() + } + op := &runtime.ClientOperation{ + ID: "mediaCleanup", + Method: "POST", + PathPattern: "/api/v1/admin/media_cleanup", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MediaCleanupReader{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.(*MediaCleanupOK) + 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 mediaCleanup: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + MediaRefetch refetches media specified in the database but missing from storage + + Currently, this only includes remote emojis. + +This endpoint is useful when data loss has occurred, and you want to try to recover to a working state. +*/ +func (a *Client) MediaRefetch(params *MediaRefetchParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MediaRefetchAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMediaRefetchParams() + } + op := &runtime.ClientOperation{ + ID: "mediaRefetch", + Method: "POST", + PathPattern: "/api/v1/admin/media_refetch", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MediaRefetchReader{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.(*MediaRefetchAccepted) + 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 mediaRefetch: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +RuleCreate creates a new instance rule +*/ +func (a *Client) RuleCreate(params *RuleCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RuleCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewRuleCreateParams() + } + op := &runtime.ClientOperation{ + ID: "ruleCreate", + Method: "POST", + PathPattern: "/api/v1/admin/instance/rules", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &RuleCreateReader{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.(*RuleCreateOK) + 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 ruleCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +RuleDelete deletes an existing instance rule +*/ +func (a *Client) RuleDelete(params *RuleDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RuleDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewRuleDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "ruleDelete", + Method: "DELETE", + PathPattern: "/api/v1/admin/instance/rules/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &RuleDeleteReader{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.(*RuleDeleteOK) + 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 ruleDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +RuleUpdate updates an existing instance rule +*/ +func (a *Client) RuleUpdate(params *RuleUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RuleUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewRuleUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "ruleUpdate", + Method: "PATCH", + PathPattern: "/api/v1/admin/instance/rules/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &RuleUpdateReader{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.(*RuleUpdateOK) + 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 ruleUpdate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + TestEmailSend sends a generic test email to a specified email address + + This can be used to validate an instance's SMTP configuration, and to debug any potential issues. + +If an error is returned by the SMTP connection, this handler will return code 422 to indicate that +the request could not be processed, and the SMTP error will be returned to the caller. +*/ +func (a *Client) TestEmailSend(params *TestEmailSendParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TestEmailSendAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewTestEmailSendParams() + } + op := &runtime.ClientOperation{ + ID: "testEmailSend", + Method: "POST", + PathPattern: "/api/v1/admin/email/test", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &TestEmailSendReader{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.(*TestEmailSendAccepted) + 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 testEmailSend: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_report_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_report_get_parameters.go new file mode 100644 index 0000000..3b9b893 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_report_get_parameters.go @@ -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" +) + +// NewAdminReportGetParams creates a new AdminReportGetParams 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 NewAdminReportGetParams() *AdminReportGetParams { + return &AdminReportGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminReportGetParamsWithTimeout creates a new AdminReportGetParams object +// with the ability to set a timeout on a request. +func NewAdminReportGetParamsWithTimeout(timeout time.Duration) *AdminReportGetParams { + return &AdminReportGetParams{ + timeout: timeout, + } +} + +// NewAdminReportGetParamsWithContext creates a new AdminReportGetParams object +// with the ability to set a context for a request. +func NewAdminReportGetParamsWithContext(ctx context.Context) *AdminReportGetParams { + return &AdminReportGetParams{ + Context: ctx, + } +} + +// NewAdminReportGetParamsWithHTTPClient creates a new AdminReportGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewAdminReportGetParamsWithHTTPClient(client *http.Client) *AdminReportGetParams { + return &AdminReportGetParams{ + HTTPClient: client, + } +} + +/* +AdminReportGetParams contains all the parameters to send to the API endpoint + + for the admin report get operation. + + Typically these are written to a http.Request. +*/ +type AdminReportGetParams struct { + + /* ID. + + The id of the report. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admin report get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminReportGetParams) WithDefaults() *AdminReportGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admin report get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminReportGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the admin report get params +func (o *AdminReportGetParams) WithTimeout(timeout time.Duration) *AdminReportGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admin report get params +func (o *AdminReportGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admin report get params +func (o *AdminReportGetParams) WithContext(ctx context.Context) *AdminReportGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admin report get params +func (o *AdminReportGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admin report get params +func (o *AdminReportGetParams) WithHTTPClient(client *http.Client) *AdminReportGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admin report get params +func (o *AdminReportGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the admin report get params +func (o *AdminReportGetParams) WithID(id string) *AdminReportGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the admin report get params +func (o *AdminReportGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminReportGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_report_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_report_get_responses.go new file mode 100644 index 0000000..4a76f86 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_report_get_responses.go @@ -0,0 +1,416 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AdminReportGetReader is a Reader for the AdminReportGet structure. +type AdminReportGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminReportGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminReportGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminReportGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminReportGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminReportGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminReportGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminReportGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/reports/{id}] adminReportGet", response, response.Code()) + } +} + +// NewAdminReportGetOK creates a AdminReportGetOK with default headers values +func NewAdminReportGetOK() *AdminReportGetOK { + return &AdminReportGetOK{} +} + +/* +AdminReportGetOK describes a response with status code 200, with default header values. + +The requested report. +*/ +type AdminReportGetOK struct { + Payload *models.AdminReport +} + +// IsSuccess returns true when this admin report get o k response has a 2xx status code +func (o *AdminReportGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admin report get o k response has a 3xx status code +func (o *AdminReportGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report get o k response has a 4xx status code +func (o *AdminReportGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin report get o k response has a 5xx status code +func (o *AdminReportGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this admin report get o k response a status code equal to that given +func (o *AdminReportGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admin report get o k response +func (o *AdminReportGetOK) Code() int { + return 200 +} + +func (o *AdminReportGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetOK %s", 200, payload) +} + +func (o *AdminReportGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetOK %s", 200, payload) +} + +func (o *AdminReportGetOK) GetPayload() *models.AdminReport { + return o.Payload +} + +func (o *AdminReportGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AdminReport) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAdminReportGetBadRequest creates a AdminReportGetBadRequest with default headers values +func NewAdminReportGetBadRequest() *AdminReportGetBadRequest { + return &AdminReportGetBadRequest{} +} + +/* +AdminReportGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminReportGetBadRequest struct { +} + +// IsSuccess returns true when this admin report get bad request response has a 2xx status code +func (o *AdminReportGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin report get bad request response has a 3xx status code +func (o *AdminReportGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report get bad request response has a 4xx status code +func (o *AdminReportGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin report get bad request response has a 5xx status code +func (o *AdminReportGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admin report get bad request response a status code equal to that given +func (o *AdminReportGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admin report get bad request response +func (o *AdminReportGetBadRequest) Code() int { + return 400 +} + +func (o *AdminReportGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetBadRequest", 400) +} + +func (o *AdminReportGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetBadRequest", 400) +} + +func (o *AdminReportGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportGetUnauthorized creates a AdminReportGetUnauthorized with default headers values +func NewAdminReportGetUnauthorized() *AdminReportGetUnauthorized { + return &AdminReportGetUnauthorized{} +} + +/* +AdminReportGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminReportGetUnauthorized struct { +} + +// IsSuccess returns true when this admin report get unauthorized response has a 2xx status code +func (o *AdminReportGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin report get unauthorized response has a 3xx status code +func (o *AdminReportGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report get unauthorized response has a 4xx status code +func (o *AdminReportGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin report get unauthorized response has a 5xx status code +func (o *AdminReportGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admin report get unauthorized response a status code equal to that given +func (o *AdminReportGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admin report get unauthorized response +func (o *AdminReportGetUnauthorized) Code() int { + return 401 +} + +func (o *AdminReportGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetUnauthorized", 401) +} + +func (o *AdminReportGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetUnauthorized", 401) +} + +func (o *AdminReportGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportGetNotFound creates a AdminReportGetNotFound with default headers values +func NewAdminReportGetNotFound() *AdminReportGetNotFound { + return &AdminReportGetNotFound{} +} + +/* +AdminReportGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminReportGetNotFound struct { +} + +// IsSuccess returns true when this admin report get not found response has a 2xx status code +func (o *AdminReportGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin report get not found response has a 3xx status code +func (o *AdminReportGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report get not found response has a 4xx status code +func (o *AdminReportGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin report get not found response has a 5xx status code +func (o *AdminReportGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admin report get not found response a status code equal to that given +func (o *AdminReportGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admin report get not found response +func (o *AdminReportGetNotFound) Code() int { + return 404 +} + +func (o *AdminReportGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetNotFound", 404) +} + +func (o *AdminReportGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetNotFound", 404) +} + +func (o *AdminReportGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportGetNotAcceptable creates a AdminReportGetNotAcceptable with default headers values +func NewAdminReportGetNotAcceptable() *AdminReportGetNotAcceptable { + return &AdminReportGetNotAcceptable{} +} + +/* +AdminReportGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminReportGetNotAcceptable struct { +} + +// IsSuccess returns true when this admin report get not acceptable response has a 2xx status code +func (o *AdminReportGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin report get not acceptable response has a 3xx status code +func (o *AdminReportGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report get not acceptable response has a 4xx status code +func (o *AdminReportGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin report get not acceptable response has a 5xx status code +func (o *AdminReportGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admin report get not acceptable response a status code equal to that given +func (o *AdminReportGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admin report get not acceptable response +func (o *AdminReportGetNotAcceptable) Code() int { + return 406 +} + +func (o *AdminReportGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetNotAcceptable", 406) +} + +func (o *AdminReportGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetNotAcceptable", 406) +} + +func (o *AdminReportGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportGetInternalServerError creates a AdminReportGetInternalServerError with default headers values +func NewAdminReportGetInternalServerError() *AdminReportGetInternalServerError { + return &AdminReportGetInternalServerError{} +} + +/* +AdminReportGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminReportGetInternalServerError struct { +} + +// IsSuccess returns true when this admin report get internal server error response has a 2xx status code +func (o *AdminReportGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin report get internal server error response has a 3xx status code +func (o *AdminReportGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report get internal server error response has a 4xx status code +func (o *AdminReportGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin report get internal server error response has a 5xx status code +func (o *AdminReportGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admin report get internal server error response a status code equal to that given +func (o *AdminReportGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admin report get internal server error response +func (o *AdminReportGetInternalServerError) Code() int { + return 500 +} + +func (o *AdminReportGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetInternalServerError", 500) +} + +func (o *AdminReportGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetInternalServerError", 500) +} + +func (o *AdminReportGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_report_resolve_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_report_resolve_parameters.go new file mode 100644 index 0000000..1648302 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_report_resolve_parameters.go @@ -0,0 +1,184 @@ +// 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" +) + +// NewAdminReportResolveParams creates a new AdminReportResolveParams 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 NewAdminReportResolveParams() *AdminReportResolveParams { + return &AdminReportResolveParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminReportResolveParamsWithTimeout creates a new AdminReportResolveParams object +// with the ability to set a timeout on a request. +func NewAdminReportResolveParamsWithTimeout(timeout time.Duration) *AdminReportResolveParams { + return &AdminReportResolveParams{ + timeout: timeout, + } +} + +// NewAdminReportResolveParamsWithContext creates a new AdminReportResolveParams object +// with the ability to set a context for a request. +func NewAdminReportResolveParamsWithContext(ctx context.Context) *AdminReportResolveParams { + return &AdminReportResolveParams{ + Context: ctx, + } +} + +// NewAdminReportResolveParamsWithHTTPClient creates a new AdminReportResolveParams object +// with the ability to set a custom HTTPClient for a request. +func NewAdminReportResolveParamsWithHTTPClient(client *http.Client) *AdminReportResolveParams { + return &AdminReportResolveParams{ + HTTPClient: client, + } +} + +/* +AdminReportResolveParams contains all the parameters to send to the API endpoint + + for the admin report resolve operation. + + Typically these are written to a http.Request. +*/ +type AdminReportResolveParams struct { + + /* ActionTakenComment. + + Optional admin comment on the action taken in response to this report. Useful for providing an explanation about what action was taken (if any) before the report was marked as resolved. This will be visible to the user that created the report! + Sample: The reported account was suspended. + */ + ActionTakenComment *string + + /* ID. + + The id of the report. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admin report resolve params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminReportResolveParams) WithDefaults() *AdminReportResolveParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admin report resolve params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminReportResolveParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the admin report resolve params +func (o *AdminReportResolveParams) WithTimeout(timeout time.Duration) *AdminReportResolveParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admin report resolve params +func (o *AdminReportResolveParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admin report resolve params +func (o *AdminReportResolveParams) WithContext(ctx context.Context) *AdminReportResolveParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admin report resolve params +func (o *AdminReportResolveParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admin report resolve params +func (o *AdminReportResolveParams) WithHTTPClient(client *http.Client) *AdminReportResolveParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admin report resolve params +func (o *AdminReportResolveParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithActionTakenComment adds the actionTakenComment to the admin report resolve params +func (o *AdminReportResolveParams) WithActionTakenComment(actionTakenComment *string) *AdminReportResolveParams { + o.SetActionTakenComment(actionTakenComment) + return o +} + +// SetActionTakenComment adds the actionTakenComment to the admin report resolve params +func (o *AdminReportResolveParams) SetActionTakenComment(actionTakenComment *string) { + o.ActionTakenComment = actionTakenComment +} + +// WithID adds the id to the admin report resolve params +func (o *AdminReportResolveParams) WithID(id string) *AdminReportResolveParams { + o.SetID(id) + return o +} + +// SetID adds the id to the admin report resolve params +func (o *AdminReportResolveParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminReportResolveParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ActionTakenComment != nil { + + // form param action_taken_comment + var frActionTakenComment string + if o.ActionTakenComment != nil { + frActionTakenComment = *o.ActionTakenComment + } + fActionTakenComment := frActionTakenComment + if fActionTakenComment != "" { + if err := r.SetFormParam("action_taken_comment", fActionTakenComment); err != nil { + return err + } + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_report_resolve_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_report_resolve_responses.go new file mode 100644 index 0000000..076e5ac --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_report_resolve_responses.go @@ -0,0 +1,416 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AdminReportResolveReader is a Reader for the AdminReportResolve structure. +type AdminReportResolveReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminReportResolveReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminReportResolveOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminReportResolveBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminReportResolveUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminReportResolveNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminReportResolveNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminReportResolveInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/reports/{id}/resolve] adminReportResolve", response, response.Code()) + } +} + +// NewAdminReportResolveOK creates a AdminReportResolveOK with default headers values +func NewAdminReportResolveOK() *AdminReportResolveOK { + return &AdminReportResolveOK{} +} + +/* +AdminReportResolveOK describes a response with status code 200, with default header values. + +The resolved report. +*/ +type AdminReportResolveOK struct { + Payload *models.AdminReport +} + +// IsSuccess returns true when this admin report resolve o k response has a 2xx status code +func (o *AdminReportResolveOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admin report resolve o k response has a 3xx status code +func (o *AdminReportResolveOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report resolve o k response has a 4xx status code +func (o *AdminReportResolveOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin report resolve o k response has a 5xx status code +func (o *AdminReportResolveOK) IsServerError() bool { + return false +} + +// IsCode returns true when this admin report resolve o k response a status code equal to that given +func (o *AdminReportResolveOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admin report resolve o k response +func (o *AdminReportResolveOK) Code() int { + return 200 +} + +func (o *AdminReportResolveOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveOK %s", 200, payload) +} + +func (o *AdminReportResolveOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveOK %s", 200, payload) +} + +func (o *AdminReportResolveOK) GetPayload() *models.AdminReport { + return o.Payload +} + +func (o *AdminReportResolveOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AdminReport) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAdminReportResolveBadRequest creates a AdminReportResolveBadRequest with default headers values +func NewAdminReportResolveBadRequest() *AdminReportResolveBadRequest { + return &AdminReportResolveBadRequest{} +} + +/* +AdminReportResolveBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminReportResolveBadRequest struct { +} + +// IsSuccess returns true when this admin report resolve bad request response has a 2xx status code +func (o *AdminReportResolveBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin report resolve bad request response has a 3xx status code +func (o *AdminReportResolveBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report resolve bad request response has a 4xx status code +func (o *AdminReportResolveBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin report resolve bad request response has a 5xx status code +func (o *AdminReportResolveBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admin report resolve bad request response a status code equal to that given +func (o *AdminReportResolveBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admin report resolve bad request response +func (o *AdminReportResolveBadRequest) Code() int { + return 400 +} + +func (o *AdminReportResolveBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveBadRequest", 400) +} + +func (o *AdminReportResolveBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveBadRequest", 400) +} + +func (o *AdminReportResolveBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportResolveUnauthorized creates a AdminReportResolveUnauthorized with default headers values +func NewAdminReportResolveUnauthorized() *AdminReportResolveUnauthorized { + return &AdminReportResolveUnauthorized{} +} + +/* +AdminReportResolveUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminReportResolveUnauthorized struct { +} + +// IsSuccess returns true when this admin report resolve unauthorized response has a 2xx status code +func (o *AdminReportResolveUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin report resolve unauthorized response has a 3xx status code +func (o *AdminReportResolveUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report resolve unauthorized response has a 4xx status code +func (o *AdminReportResolveUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin report resolve unauthorized response has a 5xx status code +func (o *AdminReportResolveUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admin report resolve unauthorized response a status code equal to that given +func (o *AdminReportResolveUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admin report resolve unauthorized response +func (o *AdminReportResolveUnauthorized) Code() int { + return 401 +} + +func (o *AdminReportResolveUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveUnauthorized", 401) +} + +func (o *AdminReportResolveUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveUnauthorized", 401) +} + +func (o *AdminReportResolveUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportResolveNotFound creates a AdminReportResolveNotFound with default headers values +func NewAdminReportResolveNotFound() *AdminReportResolveNotFound { + return &AdminReportResolveNotFound{} +} + +/* +AdminReportResolveNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminReportResolveNotFound struct { +} + +// IsSuccess returns true when this admin report resolve not found response has a 2xx status code +func (o *AdminReportResolveNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin report resolve not found response has a 3xx status code +func (o *AdminReportResolveNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report resolve not found response has a 4xx status code +func (o *AdminReportResolveNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin report resolve not found response has a 5xx status code +func (o *AdminReportResolveNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admin report resolve not found response a status code equal to that given +func (o *AdminReportResolveNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admin report resolve not found response +func (o *AdminReportResolveNotFound) Code() int { + return 404 +} + +func (o *AdminReportResolveNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveNotFound", 404) +} + +func (o *AdminReportResolveNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveNotFound", 404) +} + +func (o *AdminReportResolveNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportResolveNotAcceptable creates a AdminReportResolveNotAcceptable with default headers values +func NewAdminReportResolveNotAcceptable() *AdminReportResolveNotAcceptable { + return &AdminReportResolveNotAcceptable{} +} + +/* +AdminReportResolveNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminReportResolveNotAcceptable struct { +} + +// IsSuccess returns true when this admin report resolve not acceptable response has a 2xx status code +func (o *AdminReportResolveNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin report resolve not acceptable response has a 3xx status code +func (o *AdminReportResolveNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report resolve not acceptable response has a 4xx status code +func (o *AdminReportResolveNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin report resolve not acceptable response has a 5xx status code +func (o *AdminReportResolveNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admin report resolve not acceptable response a status code equal to that given +func (o *AdminReportResolveNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admin report resolve not acceptable response +func (o *AdminReportResolveNotAcceptable) Code() int { + return 406 +} + +func (o *AdminReportResolveNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveNotAcceptable", 406) +} + +func (o *AdminReportResolveNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveNotAcceptable", 406) +} + +func (o *AdminReportResolveNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportResolveInternalServerError creates a AdminReportResolveInternalServerError with default headers values +func NewAdminReportResolveInternalServerError() *AdminReportResolveInternalServerError { + return &AdminReportResolveInternalServerError{} +} + +/* +AdminReportResolveInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminReportResolveInternalServerError struct { +} + +// IsSuccess returns true when this admin report resolve internal server error response has a 2xx status code +func (o *AdminReportResolveInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin report resolve internal server error response has a 3xx status code +func (o *AdminReportResolveInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report resolve internal server error response has a 4xx status code +func (o *AdminReportResolveInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin report resolve internal server error response has a 5xx status code +func (o *AdminReportResolveInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admin report resolve internal server error response a status code equal to that given +func (o *AdminReportResolveInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admin report resolve internal server error response +func (o *AdminReportResolveInternalServerError) Code() int { + return 500 +} + +func (o *AdminReportResolveInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveInternalServerError", 500) +} + +func (o *AdminReportResolveInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveInternalServerError", 500) +} + +func (o *AdminReportResolveInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_reports_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_reports_parameters.go new file mode 100644 index 0000000..ec2a236 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_reports_parameters.go @@ -0,0 +1,381 @@ +// 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" +) + +// NewAdminReportsParams creates a new AdminReportsParams 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 NewAdminReportsParams() *AdminReportsParams { + return &AdminReportsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminReportsParamsWithTimeout creates a new AdminReportsParams object +// with the ability to set a timeout on a request. +func NewAdminReportsParamsWithTimeout(timeout time.Duration) *AdminReportsParams { + return &AdminReportsParams{ + timeout: timeout, + } +} + +// NewAdminReportsParamsWithContext creates a new AdminReportsParams object +// with the ability to set a context for a request. +func NewAdminReportsParamsWithContext(ctx context.Context) *AdminReportsParams { + return &AdminReportsParams{ + Context: ctx, + } +} + +// NewAdminReportsParamsWithHTTPClient creates a new AdminReportsParams object +// with the ability to set a custom HTTPClient for a request. +func NewAdminReportsParamsWithHTTPClient(client *http.Client) *AdminReportsParams { + return &AdminReportsParams{ + HTTPClient: client, + } +} + +/* +AdminReportsParams contains all the parameters to send to the API endpoint + + for the admin reports operation. + + Typically these are written to a http.Request. +*/ +type AdminReportsParams struct { + + /* AccountID. + + Return only reports created by the given account id. + */ + AccountID *string + + /* Limit. + + Number of reports to return. + + Default: 20 + */ + Limit *int64 + + /* MaxID. + + Return only reports *OLDER* than the given max ID (for paging downwards). The report with the specified ID will not be included in the response. + */ + MaxID *string + + /* MinID. + + Return only reports immediately *NEWER* than the given min ID (for paging upwards). The report with the specified ID will not be included in the response. + */ + MinID *string + + /* Resolved. + + If set to true, only resolved reports will be returned. If false, only unresolved reports will be returned. If unset, reports will not be filtered on their resolved status. + */ + Resolved *bool + + /* SinceID. + + Return only reports *NEWER* than the given since ID. The report with the specified ID will not be included in the response. + */ + SinceID *string + + /* TargetAccountID. + + Return only reports that target the given account id. + */ + TargetAccountID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admin reports params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminReportsParams) WithDefaults() *AdminReportsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admin reports params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminReportsParams) SetDefaults() { + var ( + limitDefault = int64(20) + ) + + val := AdminReportsParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the admin reports params +func (o *AdminReportsParams) WithTimeout(timeout time.Duration) *AdminReportsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admin reports params +func (o *AdminReportsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admin reports params +func (o *AdminReportsParams) WithContext(ctx context.Context) *AdminReportsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admin reports params +func (o *AdminReportsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admin reports params +func (o *AdminReportsParams) WithHTTPClient(client *http.Client) *AdminReportsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admin reports params +func (o *AdminReportsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAccountID adds the accountID to the admin reports params +func (o *AdminReportsParams) WithAccountID(accountID *string) *AdminReportsParams { + o.SetAccountID(accountID) + return o +} + +// SetAccountID adds the accountId to the admin reports params +func (o *AdminReportsParams) SetAccountID(accountID *string) { + o.AccountID = accountID +} + +// WithLimit adds the limit to the admin reports params +func (o *AdminReportsParams) WithLimit(limit *int64) *AdminReportsParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the admin reports params +func (o *AdminReportsParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the admin reports params +func (o *AdminReportsParams) WithMaxID(maxID *string) *AdminReportsParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the admin reports params +func (o *AdminReportsParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the admin reports params +func (o *AdminReportsParams) WithMinID(minID *string) *AdminReportsParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the admin reports params +func (o *AdminReportsParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithResolved adds the resolved to the admin reports params +func (o *AdminReportsParams) WithResolved(resolved *bool) *AdminReportsParams { + o.SetResolved(resolved) + return o +} + +// SetResolved adds the resolved to the admin reports params +func (o *AdminReportsParams) SetResolved(resolved *bool) { + o.Resolved = resolved +} + +// WithSinceID adds the sinceID to the admin reports params +func (o *AdminReportsParams) WithSinceID(sinceID *string) *AdminReportsParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the admin reports params +func (o *AdminReportsParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WithTargetAccountID adds the targetAccountID to the admin reports params +func (o *AdminReportsParams) WithTargetAccountID(targetAccountID *string) *AdminReportsParams { + o.SetTargetAccountID(targetAccountID) + return o +} + +// SetTargetAccountID adds the targetAccountId to the admin reports params +func (o *AdminReportsParams) SetTargetAccountID(targetAccountID *string) { + o.TargetAccountID = targetAccountID +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminReportsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.AccountID != nil { + + // query param account_id + var qrAccountID string + + if o.AccountID != nil { + qrAccountID = *o.AccountID + } + qAccountID := qrAccountID + if qAccountID != "" { + + if err := r.SetQueryParam("account_id", qAccountID); 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.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if o.Resolved != nil { + + // query param resolved + var qrResolved bool + + if o.Resolved != nil { + qrResolved = *o.Resolved + } + qResolved := swag.FormatBool(qrResolved) + if qResolved != "" { + + if err := r.SetQueryParam("resolved", qResolved); err != nil { + return err + } + } + } + + if o.SinceID != nil { + + // query param since_id + var qrSinceID string + + if o.SinceID != nil { + qrSinceID = *o.SinceID + } + qSinceID := qrSinceID + if qSinceID != "" { + + if err := r.SetQueryParam("since_id", qSinceID); err != nil { + return err + } + } + } + + if o.TargetAccountID != nil { + + // query param target_account_id + var qrTargetAccountID string + + if o.TargetAccountID != nil { + qrTargetAccountID = *o.TargetAccountID + } + qTargetAccountID := qrTargetAccountID + if qTargetAccountID != "" { + + if err := r.SetQueryParam("target_account_id", qTargetAccountID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_reports_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_reports_responses.go new file mode 100644 index 0000000..8f334de --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_reports_responses.go @@ -0,0 +1,426 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AdminReportsReader is a Reader for the AdminReports structure. +type AdminReportsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminReportsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminReportsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminReportsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminReportsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminReportsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminReportsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminReportsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/reports] adminReports", response, response.Code()) + } +} + +// NewAdminReportsOK creates a AdminReportsOK with default headers values +func NewAdminReportsOK() *AdminReportsOK { + return &AdminReportsOK{} +} + +/* +AdminReportsOK describes a response with status code 200, with default header values. + +Array of reports. +*/ +type AdminReportsOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.AdminReport +} + +// IsSuccess returns true when this admin reports o k response has a 2xx status code +func (o *AdminReportsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admin reports o k response has a 3xx status code +func (o *AdminReportsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin reports o k response has a 4xx status code +func (o *AdminReportsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin reports o k response has a 5xx status code +func (o *AdminReportsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this admin reports o k response a status code equal to that given +func (o *AdminReportsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admin reports o k response +func (o *AdminReportsOK) Code() int { + return 200 +} + +func (o *AdminReportsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsOK %s", 200, payload) +} + +func (o *AdminReportsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsOK %s", 200, payload) +} + +func (o *AdminReportsOK) GetPayload() []*models.AdminReport { + return o.Payload +} + +func (o *AdminReportsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAdminReportsBadRequest creates a AdminReportsBadRequest with default headers values +func NewAdminReportsBadRequest() *AdminReportsBadRequest { + return &AdminReportsBadRequest{} +} + +/* +AdminReportsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminReportsBadRequest struct { +} + +// IsSuccess returns true when this admin reports bad request response has a 2xx status code +func (o *AdminReportsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin reports bad request response has a 3xx status code +func (o *AdminReportsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin reports bad request response has a 4xx status code +func (o *AdminReportsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin reports bad request response has a 5xx status code +func (o *AdminReportsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admin reports bad request response a status code equal to that given +func (o *AdminReportsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admin reports bad request response +func (o *AdminReportsBadRequest) Code() int { + return 400 +} + +func (o *AdminReportsBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsBadRequest", 400) +} + +func (o *AdminReportsBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsBadRequest", 400) +} + +func (o *AdminReportsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportsUnauthorized creates a AdminReportsUnauthorized with default headers values +func NewAdminReportsUnauthorized() *AdminReportsUnauthorized { + return &AdminReportsUnauthorized{} +} + +/* +AdminReportsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminReportsUnauthorized struct { +} + +// IsSuccess returns true when this admin reports unauthorized response has a 2xx status code +func (o *AdminReportsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin reports unauthorized response has a 3xx status code +func (o *AdminReportsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin reports unauthorized response has a 4xx status code +func (o *AdminReportsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin reports unauthorized response has a 5xx status code +func (o *AdminReportsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admin reports unauthorized response a status code equal to that given +func (o *AdminReportsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admin reports unauthorized response +func (o *AdminReportsUnauthorized) Code() int { + return 401 +} + +func (o *AdminReportsUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsUnauthorized", 401) +} + +func (o *AdminReportsUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsUnauthorized", 401) +} + +func (o *AdminReportsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportsNotFound creates a AdminReportsNotFound with default headers values +func NewAdminReportsNotFound() *AdminReportsNotFound { + return &AdminReportsNotFound{} +} + +/* +AdminReportsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminReportsNotFound struct { +} + +// IsSuccess returns true when this admin reports not found response has a 2xx status code +func (o *AdminReportsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin reports not found response has a 3xx status code +func (o *AdminReportsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin reports not found response has a 4xx status code +func (o *AdminReportsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin reports not found response has a 5xx status code +func (o *AdminReportsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admin reports not found response a status code equal to that given +func (o *AdminReportsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admin reports not found response +func (o *AdminReportsNotFound) Code() int { + return 404 +} + +func (o *AdminReportsNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsNotFound", 404) +} + +func (o *AdminReportsNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsNotFound", 404) +} + +func (o *AdminReportsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportsNotAcceptable creates a AdminReportsNotAcceptable with default headers values +func NewAdminReportsNotAcceptable() *AdminReportsNotAcceptable { + return &AdminReportsNotAcceptable{} +} + +/* +AdminReportsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminReportsNotAcceptable struct { +} + +// IsSuccess returns true when this admin reports not acceptable response has a 2xx status code +func (o *AdminReportsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin reports not acceptable response has a 3xx status code +func (o *AdminReportsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin reports not acceptable response has a 4xx status code +func (o *AdminReportsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin reports not acceptable response has a 5xx status code +func (o *AdminReportsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admin reports not acceptable response a status code equal to that given +func (o *AdminReportsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admin reports not acceptable response +func (o *AdminReportsNotAcceptable) Code() int { + return 406 +} + +func (o *AdminReportsNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsNotAcceptable", 406) +} + +func (o *AdminReportsNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsNotAcceptable", 406) +} + +func (o *AdminReportsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportsInternalServerError creates a AdminReportsInternalServerError with default headers values +func NewAdminReportsInternalServerError() *AdminReportsInternalServerError { + return &AdminReportsInternalServerError{} +} + +/* +AdminReportsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminReportsInternalServerError struct { +} + +// IsSuccess returns true when this admin reports internal server error response has a 2xx status code +func (o *AdminReportsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin reports internal server error response has a 3xx status code +func (o *AdminReportsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin reports internal server error response has a 4xx status code +func (o *AdminReportsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin reports internal server error response has a 5xx status code +func (o *AdminReportsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admin reports internal server error response a status code equal to that given +func (o *AdminReportsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admin reports internal server error response +func (o *AdminReportsInternalServerError) Code() int { + return 500 +} + +func (o *AdminReportsInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsInternalServerError", 500) +} + +func (o *AdminReportsInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsInternalServerError", 500) +} + +func (o *AdminReportsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_rule_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_rule_get_parameters.go new file mode 100644 index 0000000..a99972c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_rule_get_parameters.go @@ -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" +) + +// NewAdminRuleGetParams creates a new AdminRuleGetParams 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 NewAdminRuleGetParams() *AdminRuleGetParams { + return &AdminRuleGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminRuleGetParamsWithTimeout creates a new AdminRuleGetParams object +// with the ability to set a timeout on a request. +func NewAdminRuleGetParamsWithTimeout(timeout time.Duration) *AdminRuleGetParams { + return &AdminRuleGetParams{ + timeout: timeout, + } +} + +// NewAdminRuleGetParamsWithContext creates a new AdminRuleGetParams object +// with the ability to set a context for a request. +func NewAdminRuleGetParamsWithContext(ctx context.Context) *AdminRuleGetParams { + return &AdminRuleGetParams{ + Context: ctx, + } +} + +// NewAdminRuleGetParamsWithHTTPClient creates a new AdminRuleGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewAdminRuleGetParamsWithHTTPClient(client *http.Client) *AdminRuleGetParams { + return &AdminRuleGetParams{ + HTTPClient: client, + } +} + +/* +AdminRuleGetParams contains all the parameters to send to the API endpoint + + for the admin rule get operation. + + Typically these are written to a http.Request. +*/ +type AdminRuleGetParams struct { + + /* ID. + + The id of the rule. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admin rule get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminRuleGetParams) WithDefaults() *AdminRuleGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admin rule get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminRuleGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the admin rule get params +func (o *AdminRuleGetParams) WithTimeout(timeout time.Duration) *AdminRuleGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admin rule get params +func (o *AdminRuleGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admin rule get params +func (o *AdminRuleGetParams) WithContext(ctx context.Context) *AdminRuleGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admin rule get params +func (o *AdminRuleGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admin rule get params +func (o *AdminRuleGetParams) WithHTTPClient(client *http.Client) *AdminRuleGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admin rule get params +func (o *AdminRuleGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the admin rule get params +func (o *AdminRuleGetParams) WithID(id string) *AdminRuleGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the admin rule get params +func (o *AdminRuleGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminRuleGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_rule_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_rule_get_responses.go new file mode 100644 index 0000000..65a17b4 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admin_rule_get_responses.go @@ -0,0 +1,416 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AdminRuleGetReader is a Reader for the AdminRuleGet structure. +type AdminRuleGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminRuleGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminRuleGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminRuleGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminRuleGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminRuleGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminRuleGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminRuleGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/rules/{id}] adminRuleGet", response, response.Code()) + } +} + +// NewAdminRuleGetOK creates a AdminRuleGetOK with default headers values +func NewAdminRuleGetOK() *AdminRuleGetOK { + return &AdminRuleGetOK{} +} + +/* +AdminRuleGetOK describes a response with status code 200, with default header values. + +The requested rule. +*/ +type AdminRuleGetOK struct { + Payload *models.InstanceRule +} + +// IsSuccess returns true when this admin rule get o k response has a 2xx status code +func (o *AdminRuleGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admin rule get o k response has a 3xx status code +func (o *AdminRuleGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin rule get o k response has a 4xx status code +func (o *AdminRuleGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin rule get o k response has a 5xx status code +func (o *AdminRuleGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this admin rule get o k response a status code equal to that given +func (o *AdminRuleGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admin rule get o k response +func (o *AdminRuleGetOK) Code() int { + return 200 +} + +func (o *AdminRuleGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetOK %s", 200, payload) +} + +func (o *AdminRuleGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetOK %s", 200, payload) +} + +func (o *AdminRuleGetOK) GetPayload() *models.InstanceRule { + return o.Payload +} + +func (o *AdminRuleGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.InstanceRule) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAdminRuleGetBadRequest creates a AdminRuleGetBadRequest with default headers values +func NewAdminRuleGetBadRequest() *AdminRuleGetBadRequest { + return &AdminRuleGetBadRequest{} +} + +/* +AdminRuleGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminRuleGetBadRequest struct { +} + +// IsSuccess returns true when this admin rule get bad request response has a 2xx status code +func (o *AdminRuleGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin rule get bad request response has a 3xx status code +func (o *AdminRuleGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin rule get bad request response has a 4xx status code +func (o *AdminRuleGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin rule get bad request response has a 5xx status code +func (o *AdminRuleGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admin rule get bad request response a status code equal to that given +func (o *AdminRuleGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admin rule get bad request response +func (o *AdminRuleGetBadRequest) Code() int { + return 400 +} + +func (o *AdminRuleGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetBadRequest", 400) +} + +func (o *AdminRuleGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetBadRequest", 400) +} + +func (o *AdminRuleGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminRuleGetUnauthorized creates a AdminRuleGetUnauthorized with default headers values +func NewAdminRuleGetUnauthorized() *AdminRuleGetUnauthorized { + return &AdminRuleGetUnauthorized{} +} + +/* +AdminRuleGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminRuleGetUnauthorized struct { +} + +// IsSuccess returns true when this admin rule get unauthorized response has a 2xx status code +func (o *AdminRuleGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin rule get unauthorized response has a 3xx status code +func (o *AdminRuleGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin rule get unauthorized response has a 4xx status code +func (o *AdminRuleGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin rule get unauthorized response has a 5xx status code +func (o *AdminRuleGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admin rule get unauthorized response a status code equal to that given +func (o *AdminRuleGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admin rule get unauthorized response +func (o *AdminRuleGetUnauthorized) Code() int { + return 401 +} + +func (o *AdminRuleGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetUnauthorized", 401) +} + +func (o *AdminRuleGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetUnauthorized", 401) +} + +func (o *AdminRuleGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminRuleGetNotFound creates a AdminRuleGetNotFound with default headers values +func NewAdminRuleGetNotFound() *AdminRuleGetNotFound { + return &AdminRuleGetNotFound{} +} + +/* +AdminRuleGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminRuleGetNotFound struct { +} + +// IsSuccess returns true when this admin rule get not found response has a 2xx status code +func (o *AdminRuleGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin rule get not found response has a 3xx status code +func (o *AdminRuleGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin rule get not found response has a 4xx status code +func (o *AdminRuleGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin rule get not found response has a 5xx status code +func (o *AdminRuleGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admin rule get not found response a status code equal to that given +func (o *AdminRuleGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admin rule get not found response +func (o *AdminRuleGetNotFound) Code() int { + return 404 +} + +func (o *AdminRuleGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetNotFound", 404) +} + +func (o *AdminRuleGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetNotFound", 404) +} + +func (o *AdminRuleGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminRuleGetNotAcceptable creates a AdminRuleGetNotAcceptable with default headers values +func NewAdminRuleGetNotAcceptable() *AdminRuleGetNotAcceptable { + return &AdminRuleGetNotAcceptable{} +} + +/* +AdminRuleGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminRuleGetNotAcceptable struct { +} + +// IsSuccess returns true when this admin rule get not acceptable response has a 2xx status code +func (o *AdminRuleGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin rule get not acceptable response has a 3xx status code +func (o *AdminRuleGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin rule get not acceptable response has a 4xx status code +func (o *AdminRuleGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin rule get not acceptable response has a 5xx status code +func (o *AdminRuleGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admin rule get not acceptable response a status code equal to that given +func (o *AdminRuleGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admin rule get not acceptable response +func (o *AdminRuleGetNotAcceptable) Code() int { + return 406 +} + +func (o *AdminRuleGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetNotAcceptable", 406) +} + +func (o *AdminRuleGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetNotAcceptable", 406) +} + +func (o *AdminRuleGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminRuleGetInternalServerError creates a AdminRuleGetInternalServerError with default headers values +func NewAdminRuleGetInternalServerError() *AdminRuleGetInternalServerError { + return &AdminRuleGetInternalServerError{} +} + +/* +AdminRuleGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminRuleGetInternalServerError struct { +} + +// IsSuccess returns true when this admin rule get internal server error response has a 2xx status code +func (o *AdminRuleGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin rule get internal server error response has a 3xx status code +func (o *AdminRuleGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin rule get internal server error response has a 4xx status code +func (o *AdminRuleGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin rule get internal server error response has a 5xx status code +func (o *AdminRuleGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admin rule get internal server error response a status code equal to that given +func (o *AdminRuleGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admin rule get internal server error response +func (o *AdminRuleGetInternalServerError) Code() int { + return 500 +} + +func (o *AdminRuleGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetInternalServerError", 500) +} + +func (o *AdminRuleGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetInternalServerError", 500) +} + +func (o *AdminRuleGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admins_rule_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admins_rule_get_parameters.go new file mode 100644 index 0000000..28ad865 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admins_rule_get_parameters.go @@ -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" +) + +// NewAdminsRuleGetParams creates a new AdminsRuleGetParams 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 NewAdminsRuleGetParams() *AdminsRuleGetParams { + return &AdminsRuleGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminsRuleGetParamsWithTimeout creates a new AdminsRuleGetParams object +// with the ability to set a timeout on a request. +func NewAdminsRuleGetParamsWithTimeout(timeout time.Duration) *AdminsRuleGetParams { + return &AdminsRuleGetParams{ + timeout: timeout, + } +} + +// NewAdminsRuleGetParamsWithContext creates a new AdminsRuleGetParams object +// with the ability to set a context for a request. +func NewAdminsRuleGetParamsWithContext(ctx context.Context) *AdminsRuleGetParams { + return &AdminsRuleGetParams{ + Context: ctx, + } +} + +// NewAdminsRuleGetParamsWithHTTPClient creates a new AdminsRuleGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewAdminsRuleGetParamsWithHTTPClient(client *http.Client) *AdminsRuleGetParams { + return &AdminsRuleGetParams{ + HTTPClient: client, + } +} + +/* +AdminsRuleGetParams contains all the parameters to send to the API endpoint + + for the admins rule get operation. + + Typically these are written to a http.Request. +*/ +type AdminsRuleGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admins rule get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminsRuleGetParams) WithDefaults() *AdminsRuleGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admins rule get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminsRuleGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the admins rule get params +func (o *AdminsRuleGetParams) WithTimeout(timeout time.Duration) *AdminsRuleGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admins rule get params +func (o *AdminsRuleGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admins rule get params +func (o *AdminsRuleGetParams) WithContext(ctx context.Context) *AdminsRuleGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admins rule get params +func (o *AdminsRuleGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admins rule get params +func (o *AdminsRuleGetParams) WithHTTPClient(client *http.Client) *AdminsRuleGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admins rule get params +func (o *AdminsRuleGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminsRuleGetParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admins_rule_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admins_rule_get_responses.go new file mode 100644 index 0000000..11e4f15 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/admins_rule_get_responses.go @@ -0,0 +1,414 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AdminsRuleGetReader is a Reader for the AdminsRuleGet structure. +type AdminsRuleGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminsRuleGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminsRuleGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminsRuleGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminsRuleGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminsRuleGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminsRuleGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminsRuleGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/rules] adminsRuleGet", response, response.Code()) + } +} + +// NewAdminsRuleGetOK creates a AdminsRuleGetOK with default headers values +func NewAdminsRuleGetOK() *AdminsRuleGetOK { + return &AdminsRuleGetOK{} +} + +/* +AdminsRuleGetOK describes a response with status code 200, with default header values. + +An array with all the rules for the local instance. +*/ +type AdminsRuleGetOK struct { + Payload []*models.InstanceRule +} + +// IsSuccess returns true when this admins rule get o k response has a 2xx status code +func (o *AdminsRuleGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admins rule get o k response has a 3xx status code +func (o *AdminsRuleGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admins rule get o k response has a 4xx status code +func (o *AdminsRuleGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admins rule get o k response has a 5xx status code +func (o *AdminsRuleGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this admins rule get o k response a status code equal to that given +func (o *AdminsRuleGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admins rule get o k response +func (o *AdminsRuleGetOK) Code() int { + return 200 +} + +func (o *AdminsRuleGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetOK %s", 200, payload) +} + +func (o *AdminsRuleGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetOK %s", 200, payload) +} + +func (o *AdminsRuleGetOK) GetPayload() []*models.InstanceRule { + return o.Payload +} + +func (o *AdminsRuleGetOK) 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 +} + +// NewAdminsRuleGetBadRequest creates a AdminsRuleGetBadRequest with default headers values +func NewAdminsRuleGetBadRequest() *AdminsRuleGetBadRequest { + return &AdminsRuleGetBadRequest{} +} + +/* +AdminsRuleGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminsRuleGetBadRequest struct { +} + +// IsSuccess returns true when this admins rule get bad request response has a 2xx status code +func (o *AdminsRuleGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admins rule get bad request response has a 3xx status code +func (o *AdminsRuleGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admins rule get bad request response has a 4xx status code +func (o *AdminsRuleGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admins rule get bad request response has a 5xx status code +func (o *AdminsRuleGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admins rule get bad request response a status code equal to that given +func (o *AdminsRuleGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admins rule get bad request response +func (o *AdminsRuleGetBadRequest) Code() int { + return 400 +} + +func (o *AdminsRuleGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetBadRequest", 400) +} + +func (o *AdminsRuleGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetBadRequest", 400) +} + +func (o *AdminsRuleGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminsRuleGetUnauthorized creates a AdminsRuleGetUnauthorized with default headers values +func NewAdminsRuleGetUnauthorized() *AdminsRuleGetUnauthorized { + return &AdminsRuleGetUnauthorized{} +} + +/* +AdminsRuleGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminsRuleGetUnauthorized struct { +} + +// IsSuccess returns true when this admins rule get unauthorized response has a 2xx status code +func (o *AdminsRuleGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admins rule get unauthorized response has a 3xx status code +func (o *AdminsRuleGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admins rule get unauthorized response has a 4xx status code +func (o *AdminsRuleGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admins rule get unauthorized response has a 5xx status code +func (o *AdminsRuleGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admins rule get unauthorized response a status code equal to that given +func (o *AdminsRuleGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admins rule get unauthorized response +func (o *AdminsRuleGetUnauthorized) Code() int { + return 401 +} + +func (o *AdminsRuleGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetUnauthorized", 401) +} + +func (o *AdminsRuleGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetUnauthorized", 401) +} + +func (o *AdminsRuleGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminsRuleGetNotFound creates a AdminsRuleGetNotFound with default headers values +func NewAdminsRuleGetNotFound() *AdminsRuleGetNotFound { + return &AdminsRuleGetNotFound{} +} + +/* +AdminsRuleGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminsRuleGetNotFound struct { +} + +// IsSuccess returns true when this admins rule get not found response has a 2xx status code +func (o *AdminsRuleGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admins rule get not found response has a 3xx status code +func (o *AdminsRuleGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admins rule get not found response has a 4xx status code +func (o *AdminsRuleGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admins rule get not found response has a 5xx status code +func (o *AdminsRuleGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admins rule get not found response a status code equal to that given +func (o *AdminsRuleGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admins rule get not found response +func (o *AdminsRuleGetNotFound) Code() int { + return 404 +} + +func (o *AdminsRuleGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetNotFound", 404) +} + +func (o *AdminsRuleGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetNotFound", 404) +} + +func (o *AdminsRuleGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminsRuleGetNotAcceptable creates a AdminsRuleGetNotAcceptable with default headers values +func NewAdminsRuleGetNotAcceptable() *AdminsRuleGetNotAcceptable { + return &AdminsRuleGetNotAcceptable{} +} + +/* +AdminsRuleGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminsRuleGetNotAcceptable struct { +} + +// IsSuccess returns true when this admins rule get not acceptable response has a 2xx status code +func (o *AdminsRuleGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admins rule get not acceptable response has a 3xx status code +func (o *AdminsRuleGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admins rule get not acceptable response has a 4xx status code +func (o *AdminsRuleGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admins rule get not acceptable response has a 5xx status code +func (o *AdminsRuleGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admins rule get not acceptable response a status code equal to that given +func (o *AdminsRuleGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admins rule get not acceptable response +func (o *AdminsRuleGetNotAcceptable) Code() int { + return 406 +} + +func (o *AdminsRuleGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetNotAcceptable", 406) +} + +func (o *AdminsRuleGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetNotAcceptable", 406) +} + +func (o *AdminsRuleGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminsRuleGetInternalServerError creates a AdminsRuleGetInternalServerError with default headers values +func NewAdminsRuleGetInternalServerError() *AdminsRuleGetInternalServerError { + return &AdminsRuleGetInternalServerError{} +} + +/* +AdminsRuleGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminsRuleGetInternalServerError struct { +} + +// IsSuccess returns true when this admins rule get internal server error response has a 2xx status code +func (o *AdminsRuleGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admins rule get internal server error response has a 3xx status code +func (o *AdminsRuleGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admins rule get internal server error response has a 4xx status code +func (o *AdminsRuleGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admins rule get internal server error response has a 5xx status code +func (o *AdminsRuleGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admins rule get internal server error response a status code equal to that given +func (o *AdminsRuleGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admins rule get internal server error response +func (o *AdminsRuleGetInternalServerError) Code() int { + return 500 +} + +func (o *AdminsRuleGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetInternalServerError", 500) +} + +func (o *AdminsRuleGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetInternalServerError", 500) +} + +func (o *AdminsRuleGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allow_create_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allow_create_parameters.go new file mode 100644 index 0000000..2f182be --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allow_create_parameters.go @@ -0,0 +1,330 @@ +// 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" +) + +// NewDomainAllowCreateParams creates a new DomainAllowCreateParams 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 NewDomainAllowCreateParams() *DomainAllowCreateParams { + return &DomainAllowCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDomainAllowCreateParamsWithTimeout creates a new DomainAllowCreateParams object +// with the ability to set a timeout on a request. +func NewDomainAllowCreateParamsWithTimeout(timeout time.Duration) *DomainAllowCreateParams { + return &DomainAllowCreateParams{ + timeout: timeout, + } +} + +// NewDomainAllowCreateParamsWithContext creates a new DomainAllowCreateParams object +// with the ability to set a context for a request. +func NewDomainAllowCreateParamsWithContext(ctx context.Context) *DomainAllowCreateParams { + return &DomainAllowCreateParams{ + Context: ctx, + } +} + +// NewDomainAllowCreateParamsWithHTTPClient creates a new DomainAllowCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewDomainAllowCreateParamsWithHTTPClient(client *http.Client) *DomainAllowCreateParams { + return &DomainAllowCreateParams{ + HTTPClient: client, + } +} + +/* +DomainAllowCreateParams contains all the parameters to send to the API endpoint + + for the domain allow create operation. + + Typically these are written to a http.Request. +*/ +type DomainAllowCreateParams struct { + + /* Domain. + + Single domain to allow. Used only if `import` is not `true`. + */ + Domain *string + + /* Domains. + + JSON-formatted list of domain allows to import. This is only used if `import` is set to `true`. + */ + Domains runtime.NamedReadCloser + + /* Import. + + Signal that a list of domain allows is being imported as a file. If set to `true`, then 'domains' must be present as a JSON-formatted file. If set to `false`, then `domains` will be ignored, and `domain` must be present. + */ + Import *bool + + /* Obfuscate. + + Obfuscate the name of the domain when serving it publicly. Eg., `example.org` becomes something like `ex***e.org`. Used only if `import` is not `true`. + */ + Obfuscate *bool + + /* PrivateComment. + + Private comment about this domain allow. Will only be shown to other admins, so this is a useful way of internally keeping track of why a certain domain ended up allowed. Used only if `import` is not `true`. + */ + PrivateComment *string + + /* PublicComment. + + Public comment about this domain allow. This will be displayed alongside the domain allow if you choose to share allows. Used only if `import` is not `true`. + */ + PublicComment *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the domain allow create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainAllowCreateParams) WithDefaults() *DomainAllowCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the domain allow create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainAllowCreateParams) SetDefaults() { + var ( + importVarDefault = bool(false) + ) + + val := DomainAllowCreateParams{ + Import: &importVarDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the domain allow create params +func (o *DomainAllowCreateParams) WithTimeout(timeout time.Duration) *DomainAllowCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the domain allow create params +func (o *DomainAllowCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the domain allow create params +func (o *DomainAllowCreateParams) WithContext(ctx context.Context) *DomainAllowCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the domain allow create params +func (o *DomainAllowCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the domain allow create params +func (o *DomainAllowCreateParams) WithHTTPClient(client *http.Client) *DomainAllowCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the domain allow create params +func (o *DomainAllowCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDomain adds the domain to the domain allow create params +func (o *DomainAllowCreateParams) WithDomain(domain *string) *DomainAllowCreateParams { + o.SetDomain(domain) + return o +} + +// SetDomain adds the domain to the domain allow create params +func (o *DomainAllowCreateParams) SetDomain(domain *string) { + o.Domain = domain +} + +// WithDomains adds the domains to the domain allow create params +func (o *DomainAllowCreateParams) WithDomains(domains runtime.NamedReadCloser) *DomainAllowCreateParams { + o.SetDomains(domains) + return o +} + +// SetDomains adds the domains to the domain allow create params +func (o *DomainAllowCreateParams) SetDomains(domains runtime.NamedReadCloser) { + o.Domains = domains +} + +// WithImport adds the importVar to the domain allow create params +func (o *DomainAllowCreateParams) WithImport(importVar *bool) *DomainAllowCreateParams { + o.SetImport(importVar) + return o +} + +// SetImport adds the import to the domain allow create params +func (o *DomainAllowCreateParams) SetImport(importVar *bool) { + o.Import = importVar +} + +// WithObfuscate adds the obfuscate to the domain allow create params +func (o *DomainAllowCreateParams) WithObfuscate(obfuscate *bool) *DomainAllowCreateParams { + o.SetObfuscate(obfuscate) + return o +} + +// SetObfuscate adds the obfuscate to the domain allow create params +func (o *DomainAllowCreateParams) SetObfuscate(obfuscate *bool) { + o.Obfuscate = obfuscate +} + +// WithPrivateComment adds the privateComment to the domain allow create params +func (o *DomainAllowCreateParams) WithPrivateComment(privateComment *string) *DomainAllowCreateParams { + o.SetPrivateComment(privateComment) + return o +} + +// SetPrivateComment adds the privateComment to the domain allow create params +func (o *DomainAllowCreateParams) SetPrivateComment(privateComment *string) { + o.PrivateComment = privateComment +} + +// WithPublicComment adds the publicComment to the domain allow create params +func (o *DomainAllowCreateParams) WithPublicComment(publicComment *string) *DomainAllowCreateParams { + o.SetPublicComment(publicComment) + return o +} + +// SetPublicComment adds the publicComment to the domain allow create params +func (o *DomainAllowCreateParams) SetPublicComment(publicComment *string) { + o.PublicComment = publicComment +} + +// WriteToRequest writes these params to a swagger request +func (o *DomainAllowCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Domain != nil { + + // form param domain + var frDomain string + if o.Domain != nil { + frDomain = *o.Domain + } + fDomain := frDomain + if fDomain != "" { + if err := r.SetFormParam("domain", fDomain); err != nil { + return err + } + } + } + + if o.Domains != nil { + + if o.Domains != nil { + // form file param domains + if err := r.SetFileParam("domains", o.Domains); err != nil { + return err + } + } + } + + if o.Import != nil { + + // query param import + var qrImport bool + + if o.Import != nil { + qrImport = *o.Import + } + qImport := swag.FormatBool(qrImport) + if qImport != "" { + + if err := r.SetQueryParam("import", qImport); err != nil { + return err + } + } + } + + if o.Obfuscate != nil { + + // form param obfuscate + var frObfuscate bool + if o.Obfuscate != nil { + frObfuscate = *o.Obfuscate + } + fObfuscate := swag.FormatBool(frObfuscate) + if fObfuscate != "" { + if err := r.SetFormParam("obfuscate", fObfuscate); err != nil { + return err + } + } + } + + if o.PrivateComment != nil { + + // form param private_comment + var frPrivateComment string + if o.PrivateComment != nil { + frPrivateComment = *o.PrivateComment + } + fPrivateComment := frPrivateComment + if fPrivateComment != "" { + if err := r.SetFormParam("private_comment", fPrivateComment); err != nil { + return err + } + } + } + + if o.PublicComment != nil { + + // form param public_comment + var frPublicComment string + if o.PublicComment != nil { + frPublicComment = *o.PublicComment + } + fPublicComment := frPublicComment + if fPublicComment != "" { + if err := r.SetFormParam("public_comment", fPublicComment); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allow_create_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allow_create_responses.go new file mode 100644 index 0000000..16f8a81 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allow_create_responses.go @@ -0,0 +1,540 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// DomainAllowCreateReader is a Reader for the DomainAllowCreate structure. +type DomainAllowCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DomainAllowCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDomainAllowCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDomainAllowCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDomainAllowCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewDomainAllowCreateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDomainAllowCreateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDomainAllowCreateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewDomainAllowCreateConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDomainAllowCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/domain_allows] domainAllowCreate", response, response.Code()) + } +} + +// NewDomainAllowCreateOK creates a DomainAllowCreateOK with default headers values +func NewDomainAllowCreateOK() *DomainAllowCreateOK { + return &DomainAllowCreateOK{} +} + +/* +DomainAllowCreateOK describes a response with status code 200, with default header values. + +The newly created domain allow, if `import` != `true`. If a list has been imported, then an `array` of newly created domain allows will be returned instead. +*/ +type DomainAllowCreateOK struct { + Payload *models.DomainPermission +} + +// IsSuccess returns true when this domain allow create o k response has a 2xx status code +func (o *DomainAllowCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this domain allow create o k response has a 3xx status code +func (o *DomainAllowCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow create o k response has a 4xx status code +func (o *DomainAllowCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain allow create o k response has a 5xx status code +func (o *DomainAllowCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow create o k response a status code equal to that given +func (o *DomainAllowCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the domain allow create o k response +func (o *DomainAllowCreateOK) Code() int { + return 200 +} + +func (o *DomainAllowCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateOK %s", 200, payload) +} + +func (o *DomainAllowCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateOK %s", 200, payload) +} + +func (o *DomainAllowCreateOK) GetPayload() *models.DomainPermission { + return o.Payload +} + +func (o *DomainAllowCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DomainPermission) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDomainAllowCreateBadRequest creates a DomainAllowCreateBadRequest with default headers values +func NewDomainAllowCreateBadRequest() *DomainAllowCreateBadRequest { + return &DomainAllowCreateBadRequest{} +} + +/* +DomainAllowCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DomainAllowCreateBadRequest struct { +} + +// IsSuccess returns true when this domain allow create bad request response has a 2xx status code +func (o *DomainAllowCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow create bad request response has a 3xx status code +func (o *DomainAllowCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow create bad request response has a 4xx status code +func (o *DomainAllowCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow create bad request response has a 5xx status code +func (o *DomainAllowCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow create bad request response a status code equal to that given +func (o *DomainAllowCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the domain allow create bad request response +func (o *DomainAllowCreateBadRequest) Code() int { + return 400 +} + +func (o *DomainAllowCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateBadRequest", 400) +} + +func (o *DomainAllowCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateBadRequest", 400) +} + +func (o *DomainAllowCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowCreateUnauthorized creates a DomainAllowCreateUnauthorized with default headers values +func NewDomainAllowCreateUnauthorized() *DomainAllowCreateUnauthorized { + return &DomainAllowCreateUnauthorized{} +} + +/* +DomainAllowCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DomainAllowCreateUnauthorized struct { +} + +// IsSuccess returns true when this domain allow create unauthorized response has a 2xx status code +func (o *DomainAllowCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow create unauthorized response has a 3xx status code +func (o *DomainAllowCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow create unauthorized response has a 4xx status code +func (o *DomainAllowCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow create unauthorized response has a 5xx status code +func (o *DomainAllowCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow create unauthorized response a status code equal to that given +func (o *DomainAllowCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the domain allow create unauthorized response +func (o *DomainAllowCreateUnauthorized) Code() int { + return 401 +} + +func (o *DomainAllowCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateUnauthorized", 401) +} + +func (o *DomainAllowCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateUnauthorized", 401) +} + +func (o *DomainAllowCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowCreateForbidden creates a DomainAllowCreateForbidden with default headers values +func NewDomainAllowCreateForbidden() *DomainAllowCreateForbidden { + return &DomainAllowCreateForbidden{} +} + +/* +DomainAllowCreateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type DomainAllowCreateForbidden struct { +} + +// IsSuccess returns true when this domain allow create forbidden response has a 2xx status code +func (o *DomainAllowCreateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow create forbidden response has a 3xx status code +func (o *DomainAllowCreateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow create forbidden response has a 4xx status code +func (o *DomainAllowCreateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow create forbidden response has a 5xx status code +func (o *DomainAllowCreateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow create forbidden response a status code equal to that given +func (o *DomainAllowCreateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the domain allow create forbidden response +func (o *DomainAllowCreateForbidden) Code() int { + return 403 +} + +func (o *DomainAllowCreateForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateForbidden", 403) +} + +func (o *DomainAllowCreateForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateForbidden", 403) +} + +func (o *DomainAllowCreateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowCreateNotFound creates a DomainAllowCreateNotFound with default headers values +func NewDomainAllowCreateNotFound() *DomainAllowCreateNotFound { + return &DomainAllowCreateNotFound{} +} + +/* +DomainAllowCreateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DomainAllowCreateNotFound struct { +} + +// IsSuccess returns true when this domain allow create not found response has a 2xx status code +func (o *DomainAllowCreateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow create not found response has a 3xx status code +func (o *DomainAllowCreateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow create not found response has a 4xx status code +func (o *DomainAllowCreateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow create not found response has a 5xx status code +func (o *DomainAllowCreateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow create not found response a status code equal to that given +func (o *DomainAllowCreateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the domain allow create not found response +func (o *DomainAllowCreateNotFound) Code() int { + return 404 +} + +func (o *DomainAllowCreateNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateNotFound", 404) +} + +func (o *DomainAllowCreateNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateNotFound", 404) +} + +func (o *DomainAllowCreateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowCreateNotAcceptable creates a DomainAllowCreateNotAcceptable with default headers values +func NewDomainAllowCreateNotAcceptable() *DomainAllowCreateNotAcceptable { + return &DomainAllowCreateNotAcceptable{} +} + +/* +DomainAllowCreateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DomainAllowCreateNotAcceptable struct { +} + +// IsSuccess returns true when this domain allow create not acceptable response has a 2xx status code +func (o *DomainAllowCreateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow create not acceptable response has a 3xx status code +func (o *DomainAllowCreateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow create not acceptable response has a 4xx status code +func (o *DomainAllowCreateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow create not acceptable response has a 5xx status code +func (o *DomainAllowCreateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow create not acceptable response a status code equal to that given +func (o *DomainAllowCreateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the domain allow create not acceptable response +func (o *DomainAllowCreateNotAcceptable) Code() int { + return 406 +} + +func (o *DomainAllowCreateNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateNotAcceptable", 406) +} + +func (o *DomainAllowCreateNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateNotAcceptable", 406) +} + +func (o *DomainAllowCreateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowCreateConflict creates a DomainAllowCreateConflict with default headers values +func NewDomainAllowCreateConflict() *DomainAllowCreateConflict { + return &DomainAllowCreateConflict{} +} + +/* +DomainAllowCreateConflict describes a response with status code 409, with default header values. + +Conflict: There is already an admin action running that conflicts with this action. Check the error message in the response body for more information. This is a temporary error; it should be possible to process this action if you try again in a bit. +*/ +type DomainAllowCreateConflict struct { +} + +// IsSuccess returns true when this domain allow create conflict response has a 2xx status code +func (o *DomainAllowCreateConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow create conflict response has a 3xx status code +func (o *DomainAllowCreateConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow create conflict response has a 4xx status code +func (o *DomainAllowCreateConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow create conflict response has a 5xx status code +func (o *DomainAllowCreateConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow create conflict response a status code equal to that given +func (o *DomainAllowCreateConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the domain allow create conflict response +func (o *DomainAllowCreateConflict) Code() int { + return 409 +} + +func (o *DomainAllowCreateConflict) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateConflict", 409) +} + +func (o *DomainAllowCreateConflict) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateConflict", 409) +} + +func (o *DomainAllowCreateConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowCreateInternalServerError creates a DomainAllowCreateInternalServerError with default headers values +func NewDomainAllowCreateInternalServerError() *DomainAllowCreateInternalServerError { + return &DomainAllowCreateInternalServerError{} +} + +/* +DomainAllowCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DomainAllowCreateInternalServerError struct { +} + +// IsSuccess returns true when this domain allow create internal server error response has a 2xx status code +func (o *DomainAllowCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow create internal server error response has a 3xx status code +func (o *DomainAllowCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow create internal server error response has a 4xx status code +func (o *DomainAllowCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain allow create internal server error response has a 5xx status code +func (o *DomainAllowCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this domain allow create internal server error response a status code equal to that given +func (o *DomainAllowCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the domain allow create internal server error response +func (o *DomainAllowCreateInternalServerError) Code() int { + return 500 +} + +func (o *DomainAllowCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateInternalServerError", 500) +} + +func (o *DomainAllowCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateInternalServerError", 500) +} + +func (o *DomainAllowCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allow_delete_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allow_delete_parameters.go new file mode 100644 index 0000000..9e6003e --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allow_delete_parameters.go @@ -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" +) + +// NewDomainAllowDeleteParams creates a new DomainAllowDeleteParams 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 NewDomainAllowDeleteParams() *DomainAllowDeleteParams { + return &DomainAllowDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDomainAllowDeleteParamsWithTimeout creates a new DomainAllowDeleteParams object +// with the ability to set a timeout on a request. +func NewDomainAllowDeleteParamsWithTimeout(timeout time.Duration) *DomainAllowDeleteParams { + return &DomainAllowDeleteParams{ + timeout: timeout, + } +} + +// NewDomainAllowDeleteParamsWithContext creates a new DomainAllowDeleteParams object +// with the ability to set a context for a request. +func NewDomainAllowDeleteParamsWithContext(ctx context.Context) *DomainAllowDeleteParams { + return &DomainAllowDeleteParams{ + Context: ctx, + } +} + +// NewDomainAllowDeleteParamsWithHTTPClient creates a new DomainAllowDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewDomainAllowDeleteParamsWithHTTPClient(client *http.Client) *DomainAllowDeleteParams { + return &DomainAllowDeleteParams{ + HTTPClient: client, + } +} + +/* +DomainAllowDeleteParams contains all the parameters to send to the API endpoint + + for the domain allow delete operation. + + Typically these are written to a http.Request. +*/ +type DomainAllowDeleteParams struct { + + /* ID. + + The id of the domain allow. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the domain allow delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainAllowDeleteParams) WithDefaults() *DomainAllowDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the domain allow delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainAllowDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the domain allow delete params +func (o *DomainAllowDeleteParams) WithTimeout(timeout time.Duration) *DomainAllowDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the domain allow delete params +func (o *DomainAllowDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the domain allow delete params +func (o *DomainAllowDeleteParams) WithContext(ctx context.Context) *DomainAllowDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the domain allow delete params +func (o *DomainAllowDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the domain allow delete params +func (o *DomainAllowDeleteParams) WithHTTPClient(client *http.Client) *DomainAllowDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the domain allow delete params +func (o *DomainAllowDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the domain allow delete params +func (o *DomainAllowDeleteParams) WithID(id string) *DomainAllowDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the domain allow delete params +func (o *DomainAllowDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DomainAllowDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allow_delete_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allow_delete_responses.go new file mode 100644 index 0000000..5a0e83c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allow_delete_responses.go @@ -0,0 +1,540 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// DomainAllowDeleteReader is a Reader for the DomainAllowDelete structure. +type DomainAllowDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DomainAllowDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDomainAllowDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDomainAllowDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDomainAllowDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewDomainAllowDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDomainAllowDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDomainAllowDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewDomainAllowDeleteConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDomainAllowDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/admin/domain_allows/{id}] domainAllowDelete", response, response.Code()) + } +} + +// NewDomainAllowDeleteOK creates a DomainAllowDeleteOK with default headers values +func NewDomainAllowDeleteOK() *DomainAllowDeleteOK { + return &DomainAllowDeleteOK{} +} + +/* +DomainAllowDeleteOK describes a response with status code 200, with default header values. + +The domain allow that was just deleted. +*/ +type DomainAllowDeleteOK struct { + Payload *models.DomainPermission +} + +// IsSuccess returns true when this domain allow delete o k response has a 2xx status code +func (o *DomainAllowDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this domain allow delete o k response has a 3xx status code +func (o *DomainAllowDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow delete o k response has a 4xx status code +func (o *DomainAllowDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain allow delete o k response has a 5xx status code +func (o *DomainAllowDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow delete o k response a status code equal to that given +func (o *DomainAllowDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the domain allow delete o k response +func (o *DomainAllowDeleteOK) Code() int { + return 200 +} + +func (o *DomainAllowDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteOK %s", 200, payload) +} + +func (o *DomainAllowDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteOK %s", 200, payload) +} + +func (o *DomainAllowDeleteOK) GetPayload() *models.DomainPermission { + return o.Payload +} + +func (o *DomainAllowDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DomainPermission) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDomainAllowDeleteBadRequest creates a DomainAllowDeleteBadRequest with default headers values +func NewDomainAllowDeleteBadRequest() *DomainAllowDeleteBadRequest { + return &DomainAllowDeleteBadRequest{} +} + +/* +DomainAllowDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DomainAllowDeleteBadRequest struct { +} + +// IsSuccess returns true when this domain allow delete bad request response has a 2xx status code +func (o *DomainAllowDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow delete bad request response has a 3xx status code +func (o *DomainAllowDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow delete bad request response has a 4xx status code +func (o *DomainAllowDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow delete bad request response has a 5xx status code +func (o *DomainAllowDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow delete bad request response a status code equal to that given +func (o *DomainAllowDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the domain allow delete bad request response +func (o *DomainAllowDeleteBadRequest) Code() int { + return 400 +} + +func (o *DomainAllowDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteBadRequest", 400) +} + +func (o *DomainAllowDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteBadRequest", 400) +} + +func (o *DomainAllowDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowDeleteUnauthorized creates a DomainAllowDeleteUnauthorized with default headers values +func NewDomainAllowDeleteUnauthorized() *DomainAllowDeleteUnauthorized { + return &DomainAllowDeleteUnauthorized{} +} + +/* +DomainAllowDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DomainAllowDeleteUnauthorized struct { +} + +// IsSuccess returns true when this domain allow delete unauthorized response has a 2xx status code +func (o *DomainAllowDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow delete unauthorized response has a 3xx status code +func (o *DomainAllowDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow delete unauthorized response has a 4xx status code +func (o *DomainAllowDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow delete unauthorized response has a 5xx status code +func (o *DomainAllowDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow delete unauthorized response a status code equal to that given +func (o *DomainAllowDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the domain allow delete unauthorized response +func (o *DomainAllowDeleteUnauthorized) Code() int { + return 401 +} + +func (o *DomainAllowDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteUnauthorized", 401) +} + +func (o *DomainAllowDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteUnauthorized", 401) +} + +func (o *DomainAllowDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowDeleteForbidden creates a DomainAllowDeleteForbidden with default headers values +func NewDomainAllowDeleteForbidden() *DomainAllowDeleteForbidden { + return &DomainAllowDeleteForbidden{} +} + +/* +DomainAllowDeleteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type DomainAllowDeleteForbidden struct { +} + +// IsSuccess returns true when this domain allow delete forbidden response has a 2xx status code +func (o *DomainAllowDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow delete forbidden response has a 3xx status code +func (o *DomainAllowDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow delete forbidden response has a 4xx status code +func (o *DomainAllowDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow delete forbidden response has a 5xx status code +func (o *DomainAllowDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow delete forbidden response a status code equal to that given +func (o *DomainAllowDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the domain allow delete forbidden response +func (o *DomainAllowDeleteForbidden) Code() int { + return 403 +} + +func (o *DomainAllowDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteForbidden", 403) +} + +func (o *DomainAllowDeleteForbidden) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteForbidden", 403) +} + +func (o *DomainAllowDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowDeleteNotFound creates a DomainAllowDeleteNotFound with default headers values +func NewDomainAllowDeleteNotFound() *DomainAllowDeleteNotFound { + return &DomainAllowDeleteNotFound{} +} + +/* +DomainAllowDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DomainAllowDeleteNotFound struct { +} + +// IsSuccess returns true when this domain allow delete not found response has a 2xx status code +func (o *DomainAllowDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow delete not found response has a 3xx status code +func (o *DomainAllowDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow delete not found response has a 4xx status code +func (o *DomainAllowDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow delete not found response has a 5xx status code +func (o *DomainAllowDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow delete not found response a status code equal to that given +func (o *DomainAllowDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the domain allow delete not found response +func (o *DomainAllowDeleteNotFound) Code() int { + return 404 +} + +func (o *DomainAllowDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteNotFound", 404) +} + +func (o *DomainAllowDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteNotFound", 404) +} + +func (o *DomainAllowDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowDeleteNotAcceptable creates a DomainAllowDeleteNotAcceptable with default headers values +func NewDomainAllowDeleteNotAcceptable() *DomainAllowDeleteNotAcceptable { + return &DomainAllowDeleteNotAcceptable{} +} + +/* +DomainAllowDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DomainAllowDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this domain allow delete not acceptable response has a 2xx status code +func (o *DomainAllowDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow delete not acceptable response has a 3xx status code +func (o *DomainAllowDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow delete not acceptable response has a 4xx status code +func (o *DomainAllowDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow delete not acceptable response has a 5xx status code +func (o *DomainAllowDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow delete not acceptable response a status code equal to that given +func (o *DomainAllowDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the domain allow delete not acceptable response +func (o *DomainAllowDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *DomainAllowDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteNotAcceptable", 406) +} + +func (o *DomainAllowDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteNotAcceptable", 406) +} + +func (o *DomainAllowDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowDeleteConflict creates a DomainAllowDeleteConflict with default headers values +func NewDomainAllowDeleteConflict() *DomainAllowDeleteConflict { + return &DomainAllowDeleteConflict{} +} + +/* +DomainAllowDeleteConflict describes a response with status code 409, with default header values. + +Conflict: There is already an admin action running that conflicts with this action. Check the error message in the response body for more information. This is a temporary error; it should be possible to process this action if you try again in a bit. +*/ +type DomainAllowDeleteConflict struct { +} + +// IsSuccess returns true when this domain allow delete conflict response has a 2xx status code +func (o *DomainAllowDeleteConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow delete conflict response has a 3xx status code +func (o *DomainAllowDeleteConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow delete conflict response has a 4xx status code +func (o *DomainAllowDeleteConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow delete conflict response has a 5xx status code +func (o *DomainAllowDeleteConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow delete conflict response a status code equal to that given +func (o *DomainAllowDeleteConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the domain allow delete conflict response +func (o *DomainAllowDeleteConflict) Code() int { + return 409 +} + +func (o *DomainAllowDeleteConflict) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteConflict", 409) +} + +func (o *DomainAllowDeleteConflict) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteConflict", 409) +} + +func (o *DomainAllowDeleteConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowDeleteInternalServerError creates a DomainAllowDeleteInternalServerError with default headers values +func NewDomainAllowDeleteInternalServerError() *DomainAllowDeleteInternalServerError { + return &DomainAllowDeleteInternalServerError{} +} + +/* +DomainAllowDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DomainAllowDeleteInternalServerError struct { +} + +// IsSuccess returns true when this domain allow delete internal server error response has a 2xx status code +func (o *DomainAllowDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow delete internal server error response has a 3xx status code +func (o *DomainAllowDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow delete internal server error response has a 4xx status code +func (o *DomainAllowDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain allow delete internal server error response has a 5xx status code +func (o *DomainAllowDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this domain allow delete internal server error response a status code equal to that given +func (o *DomainAllowDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the domain allow delete internal server error response +func (o *DomainAllowDeleteInternalServerError) Code() int { + return 500 +} + +func (o *DomainAllowDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteInternalServerError", 500) +} + +func (o *DomainAllowDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteInternalServerError", 500) +} + +func (o *DomainAllowDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allow_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allow_get_parameters.go new file mode 100644 index 0000000..cd3a7b2 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allow_get_parameters.go @@ -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" +) + +// NewDomainAllowGetParams creates a new DomainAllowGetParams 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 NewDomainAllowGetParams() *DomainAllowGetParams { + return &DomainAllowGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDomainAllowGetParamsWithTimeout creates a new DomainAllowGetParams object +// with the ability to set a timeout on a request. +func NewDomainAllowGetParamsWithTimeout(timeout time.Duration) *DomainAllowGetParams { + return &DomainAllowGetParams{ + timeout: timeout, + } +} + +// NewDomainAllowGetParamsWithContext creates a new DomainAllowGetParams object +// with the ability to set a context for a request. +func NewDomainAllowGetParamsWithContext(ctx context.Context) *DomainAllowGetParams { + return &DomainAllowGetParams{ + Context: ctx, + } +} + +// NewDomainAllowGetParamsWithHTTPClient creates a new DomainAllowGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewDomainAllowGetParamsWithHTTPClient(client *http.Client) *DomainAllowGetParams { + return &DomainAllowGetParams{ + HTTPClient: client, + } +} + +/* +DomainAllowGetParams contains all the parameters to send to the API endpoint + + for the domain allow get operation. + + Typically these are written to a http.Request. +*/ +type DomainAllowGetParams struct { + + /* ID. + + The id of the domain allow. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the domain allow get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainAllowGetParams) WithDefaults() *DomainAllowGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the domain allow get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainAllowGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the domain allow get params +func (o *DomainAllowGetParams) WithTimeout(timeout time.Duration) *DomainAllowGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the domain allow get params +func (o *DomainAllowGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the domain allow get params +func (o *DomainAllowGetParams) WithContext(ctx context.Context) *DomainAllowGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the domain allow get params +func (o *DomainAllowGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the domain allow get params +func (o *DomainAllowGetParams) WithHTTPClient(client *http.Client) *DomainAllowGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the domain allow get params +func (o *DomainAllowGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the domain allow get params +func (o *DomainAllowGetParams) WithID(id string) *DomainAllowGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the domain allow get params +func (o *DomainAllowGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DomainAllowGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allow_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allow_get_responses.go new file mode 100644 index 0000000..74b5c89 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allow_get_responses.go @@ -0,0 +1,478 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// DomainAllowGetReader is a Reader for the DomainAllowGet structure. +type DomainAllowGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DomainAllowGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDomainAllowGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDomainAllowGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDomainAllowGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewDomainAllowGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDomainAllowGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDomainAllowGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDomainAllowGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/domain_allows/{id}] domainAllowGet", response, response.Code()) + } +} + +// NewDomainAllowGetOK creates a DomainAllowGetOK with default headers values +func NewDomainAllowGetOK() *DomainAllowGetOK { + return &DomainAllowGetOK{} +} + +/* +DomainAllowGetOK describes a response with status code 200, with default header values. + +The requested domain allow. +*/ +type DomainAllowGetOK struct { + Payload *models.DomainPermission +} + +// IsSuccess returns true when this domain allow get o k response has a 2xx status code +func (o *DomainAllowGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this domain allow get o k response has a 3xx status code +func (o *DomainAllowGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow get o k response has a 4xx status code +func (o *DomainAllowGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain allow get o k response has a 5xx status code +func (o *DomainAllowGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow get o k response a status code equal to that given +func (o *DomainAllowGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the domain allow get o k response +func (o *DomainAllowGetOK) Code() int { + return 200 +} + +func (o *DomainAllowGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetOK %s", 200, payload) +} + +func (o *DomainAllowGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetOK %s", 200, payload) +} + +func (o *DomainAllowGetOK) GetPayload() *models.DomainPermission { + return o.Payload +} + +func (o *DomainAllowGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DomainPermission) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDomainAllowGetBadRequest creates a DomainAllowGetBadRequest with default headers values +func NewDomainAllowGetBadRequest() *DomainAllowGetBadRequest { + return &DomainAllowGetBadRequest{} +} + +/* +DomainAllowGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DomainAllowGetBadRequest struct { +} + +// IsSuccess returns true when this domain allow get bad request response has a 2xx status code +func (o *DomainAllowGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow get bad request response has a 3xx status code +func (o *DomainAllowGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow get bad request response has a 4xx status code +func (o *DomainAllowGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow get bad request response has a 5xx status code +func (o *DomainAllowGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow get bad request response a status code equal to that given +func (o *DomainAllowGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the domain allow get bad request response +func (o *DomainAllowGetBadRequest) Code() int { + return 400 +} + +func (o *DomainAllowGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetBadRequest", 400) +} + +func (o *DomainAllowGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetBadRequest", 400) +} + +func (o *DomainAllowGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowGetUnauthorized creates a DomainAllowGetUnauthorized with default headers values +func NewDomainAllowGetUnauthorized() *DomainAllowGetUnauthorized { + return &DomainAllowGetUnauthorized{} +} + +/* +DomainAllowGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DomainAllowGetUnauthorized struct { +} + +// IsSuccess returns true when this domain allow get unauthorized response has a 2xx status code +func (o *DomainAllowGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow get unauthorized response has a 3xx status code +func (o *DomainAllowGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow get unauthorized response has a 4xx status code +func (o *DomainAllowGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow get unauthorized response has a 5xx status code +func (o *DomainAllowGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow get unauthorized response a status code equal to that given +func (o *DomainAllowGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the domain allow get unauthorized response +func (o *DomainAllowGetUnauthorized) Code() int { + return 401 +} + +func (o *DomainAllowGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetUnauthorized", 401) +} + +func (o *DomainAllowGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetUnauthorized", 401) +} + +func (o *DomainAllowGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowGetForbidden creates a DomainAllowGetForbidden with default headers values +func NewDomainAllowGetForbidden() *DomainAllowGetForbidden { + return &DomainAllowGetForbidden{} +} + +/* +DomainAllowGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type DomainAllowGetForbidden struct { +} + +// IsSuccess returns true when this domain allow get forbidden response has a 2xx status code +func (o *DomainAllowGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow get forbidden response has a 3xx status code +func (o *DomainAllowGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow get forbidden response has a 4xx status code +func (o *DomainAllowGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow get forbidden response has a 5xx status code +func (o *DomainAllowGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow get forbidden response a status code equal to that given +func (o *DomainAllowGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the domain allow get forbidden response +func (o *DomainAllowGetForbidden) Code() int { + return 403 +} + +func (o *DomainAllowGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetForbidden", 403) +} + +func (o *DomainAllowGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetForbidden", 403) +} + +func (o *DomainAllowGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowGetNotFound creates a DomainAllowGetNotFound with default headers values +func NewDomainAllowGetNotFound() *DomainAllowGetNotFound { + return &DomainAllowGetNotFound{} +} + +/* +DomainAllowGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DomainAllowGetNotFound struct { +} + +// IsSuccess returns true when this domain allow get not found response has a 2xx status code +func (o *DomainAllowGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow get not found response has a 3xx status code +func (o *DomainAllowGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow get not found response has a 4xx status code +func (o *DomainAllowGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow get not found response has a 5xx status code +func (o *DomainAllowGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow get not found response a status code equal to that given +func (o *DomainAllowGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the domain allow get not found response +func (o *DomainAllowGetNotFound) Code() int { + return 404 +} + +func (o *DomainAllowGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetNotFound", 404) +} + +func (o *DomainAllowGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetNotFound", 404) +} + +func (o *DomainAllowGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowGetNotAcceptable creates a DomainAllowGetNotAcceptable with default headers values +func NewDomainAllowGetNotAcceptable() *DomainAllowGetNotAcceptable { + return &DomainAllowGetNotAcceptable{} +} + +/* +DomainAllowGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DomainAllowGetNotAcceptable struct { +} + +// IsSuccess returns true when this domain allow get not acceptable response has a 2xx status code +func (o *DomainAllowGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow get not acceptable response has a 3xx status code +func (o *DomainAllowGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow get not acceptable response has a 4xx status code +func (o *DomainAllowGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow get not acceptable response has a 5xx status code +func (o *DomainAllowGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow get not acceptable response a status code equal to that given +func (o *DomainAllowGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the domain allow get not acceptable response +func (o *DomainAllowGetNotAcceptable) Code() int { + return 406 +} + +func (o *DomainAllowGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetNotAcceptable", 406) +} + +func (o *DomainAllowGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetNotAcceptable", 406) +} + +func (o *DomainAllowGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowGetInternalServerError creates a DomainAllowGetInternalServerError with default headers values +func NewDomainAllowGetInternalServerError() *DomainAllowGetInternalServerError { + return &DomainAllowGetInternalServerError{} +} + +/* +DomainAllowGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DomainAllowGetInternalServerError struct { +} + +// IsSuccess returns true when this domain allow get internal server error response has a 2xx status code +func (o *DomainAllowGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow get internal server error response has a 3xx status code +func (o *DomainAllowGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow get internal server error response has a 4xx status code +func (o *DomainAllowGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain allow get internal server error response has a 5xx status code +func (o *DomainAllowGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this domain allow get internal server error response a status code equal to that given +func (o *DomainAllowGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the domain allow get internal server error response +func (o *DomainAllowGetInternalServerError) Code() int { + return 500 +} + +func (o *DomainAllowGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetInternalServerError", 500) +} + +func (o *DomainAllowGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetInternalServerError", 500) +} + +func (o *DomainAllowGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allows_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allows_get_parameters.go new file mode 100644 index 0000000..9b78461 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allows_get_parameters.go @@ -0,0 +1,164 @@ +// 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" +) + +// NewDomainAllowsGetParams creates a new DomainAllowsGetParams 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 NewDomainAllowsGetParams() *DomainAllowsGetParams { + return &DomainAllowsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDomainAllowsGetParamsWithTimeout creates a new DomainAllowsGetParams object +// with the ability to set a timeout on a request. +func NewDomainAllowsGetParamsWithTimeout(timeout time.Duration) *DomainAllowsGetParams { + return &DomainAllowsGetParams{ + timeout: timeout, + } +} + +// NewDomainAllowsGetParamsWithContext creates a new DomainAllowsGetParams object +// with the ability to set a context for a request. +func NewDomainAllowsGetParamsWithContext(ctx context.Context) *DomainAllowsGetParams { + return &DomainAllowsGetParams{ + Context: ctx, + } +} + +// NewDomainAllowsGetParamsWithHTTPClient creates a new DomainAllowsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewDomainAllowsGetParamsWithHTTPClient(client *http.Client) *DomainAllowsGetParams { + return &DomainAllowsGetParams{ + HTTPClient: client, + } +} + +/* +DomainAllowsGetParams contains all the parameters to send to the API endpoint + + for the domain allows get operation. + + Typically these are written to a http.Request. +*/ +type DomainAllowsGetParams struct { + + /* Export. + + If set to `true`, then each entry in the returned list of domain allows will only consist of the fields `domain` and `public_comment`. This is perfect for when you want to save and share a list of all the domains you have allowed on your instance, so that someone else can easily import them, but you don't want them to see the database IDs of your allows, or private comments etc. + */ + Export *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the domain allows get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainAllowsGetParams) WithDefaults() *DomainAllowsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the domain allows get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainAllowsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the domain allows get params +func (o *DomainAllowsGetParams) WithTimeout(timeout time.Duration) *DomainAllowsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the domain allows get params +func (o *DomainAllowsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the domain allows get params +func (o *DomainAllowsGetParams) WithContext(ctx context.Context) *DomainAllowsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the domain allows get params +func (o *DomainAllowsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the domain allows get params +func (o *DomainAllowsGetParams) WithHTTPClient(client *http.Client) *DomainAllowsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the domain allows get params +func (o *DomainAllowsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExport adds the export to the domain allows get params +func (o *DomainAllowsGetParams) WithExport(export *bool) *DomainAllowsGetParams { + o.SetExport(export) + return o +} + +// SetExport adds the export to the domain allows get params +func (o *DomainAllowsGetParams) SetExport(export *bool) { + o.Export = export +} + +// WriteToRequest writes these params to a swagger request +func (o *DomainAllowsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Export != nil { + + // query param export + var qrExport bool + + if o.Export != nil { + qrExport = *o.Export + } + qExport := swag.FormatBool(qrExport) + if qExport != "" { + + if err := r.SetQueryParam("export", qExport); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allows_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allows_get_responses.go new file mode 100644 index 0000000..a4512c1 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_allows_get_responses.go @@ -0,0 +1,476 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// DomainAllowsGetReader is a Reader for the DomainAllowsGet structure. +type DomainAllowsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DomainAllowsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDomainAllowsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDomainAllowsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDomainAllowsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewDomainAllowsGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDomainAllowsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDomainAllowsGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDomainAllowsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/domain_allows] domainAllowsGet", response, response.Code()) + } +} + +// NewDomainAllowsGetOK creates a DomainAllowsGetOK with default headers values +func NewDomainAllowsGetOK() *DomainAllowsGetOK { + return &DomainAllowsGetOK{} +} + +/* +DomainAllowsGetOK describes a response with status code 200, with default header values. + +All domain allows currently in place. +*/ +type DomainAllowsGetOK struct { + Payload []*models.DomainPermission +} + +// IsSuccess returns true when this domain allows get o k response has a 2xx status code +func (o *DomainAllowsGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this domain allows get o k response has a 3xx status code +func (o *DomainAllowsGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allows get o k response has a 4xx status code +func (o *DomainAllowsGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain allows get o k response has a 5xx status code +func (o *DomainAllowsGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allows get o k response a status code equal to that given +func (o *DomainAllowsGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the domain allows get o k response +func (o *DomainAllowsGetOK) Code() int { + return 200 +} + +func (o *DomainAllowsGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetOK %s", 200, payload) +} + +func (o *DomainAllowsGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetOK %s", 200, payload) +} + +func (o *DomainAllowsGetOK) GetPayload() []*models.DomainPermission { + return o.Payload +} + +func (o *DomainAllowsGetOK) 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 +} + +// NewDomainAllowsGetBadRequest creates a DomainAllowsGetBadRequest with default headers values +func NewDomainAllowsGetBadRequest() *DomainAllowsGetBadRequest { + return &DomainAllowsGetBadRequest{} +} + +/* +DomainAllowsGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DomainAllowsGetBadRequest struct { +} + +// IsSuccess returns true when this domain allows get bad request response has a 2xx status code +func (o *DomainAllowsGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allows get bad request response has a 3xx status code +func (o *DomainAllowsGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allows get bad request response has a 4xx status code +func (o *DomainAllowsGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allows get bad request response has a 5xx status code +func (o *DomainAllowsGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allows get bad request response a status code equal to that given +func (o *DomainAllowsGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the domain allows get bad request response +func (o *DomainAllowsGetBadRequest) Code() int { + return 400 +} + +func (o *DomainAllowsGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetBadRequest", 400) +} + +func (o *DomainAllowsGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetBadRequest", 400) +} + +func (o *DomainAllowsGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowsGetUnauthorized creates a DomainAllowsGetUnauthorized with default headers values +func NewDomainAllowsGetUnauthorized() *DomainAllowsGetUnauthorized { + return &DomainAllowsGetUnauthorized{} +} + +/* +DomainAllowsGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DomainAllowsGetUnauthorized struct { +} + +// IsSuccess returns true when this domain allows get unauthorized response has a 2xx status code +func (o *DomainAllowsGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allows get unauthorized response has a 3xx status code +func (o *DomainAllowsGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allows get unauthorized response has a 4xx status code +func (o *DomainAllowsGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allows get unauthorized response has a 5xx status code +func (o *DomainAllowsGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allows get unauthorized response a status code equal to that given +func (o *DomainAllowsGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the domain allows get unauthorized response +func (o *DomainAllowsGetUnauthorized) Code() int { + return 401 +} + +func (o *DomainAllowsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetUnauthorized", 401) +} + +func (o *DomainAllowsGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetUnauthorized", 401) +} + +func (o *DomainAllowsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowsGetForbidden creates a DomainAllowsGetForbidden with default headers values +func NewDomainAllowsGetForbidden() *DomainAllowsGetForbidden { + return &DomainAllowsGetForbidden{} +} + +/* +DomainAllowsGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type DomainAllowsGetForbidden struct { +} + +// IsSuccess returns true when this domain allows get forbidden response has a 2xx status code +func (o *DomainAllowsGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allows get forbidden response has a 3xx status code +func (o *DomainAllowsGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allows get forbidden response has a 4xx status code +func (o *DomainAllowsGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allows get forbidden response has a 5xx status code +func (o *DomainAllowsGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allows get forbidden response a status code equal to that given +func (o *DomainAllowsGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the domain allows get forbidden response +func (o *DomainAllowsGetForbidden) Code() int { + return 403 +} + +func (o *DomainAllowsGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetForbidden", 403) +} + +func (o *DomainAllowsGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetForbidden", 403) +} + +func (o *DomainAllowsGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowsGetNotFound creates a DomainAllowsGetNotFound with default headers values +func NewDomainAllowsGetNotFound() *DomainAllowsGetNotFound { + return &DomainAllowsGetNotFound{} +} + +/* +DomainAllowsGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DomainAllowsGetNotFound struct { +} + +// IsSuccess returns true when this domain allows get not found response has a 2xx status code +func (o *DomainAllowsGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allows get not found response has a 3xx status code +func (o *DomainAllowsGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allows get not found response has a 4xx status code +func (o *DomainAllowsGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allows get not found response has a 5xx status code +func (o *DomainAllowsGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allows get not found response a status code equal to that given +func (o *DomainAllowsGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the domain allows get not found response +func (o *DomainAllowsGetNotFound) Code() int { + return 404 +} + +func (o *DomainAllowsGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetNotFound", 404) +} + +func (o *DomainAllowsGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetNotFound", 404) +} + +func (o *DomainAllowsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowsGetNotAcceptable creates a DomainAllowsGetNotAcceptable with default headers values +func NewDomainAllowsGetNotAcceptable() *DomainAllowsGetNotAcceptable { + return &DomainAllowsGetNotAcceptable{} +} + +/* +DomainAllowsGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DomainAllowsGetNotAcceptable struct { +} + +// IsSuccess returns true when this domain allows get not acceptable response has a 2xx status code +func (o *DomainAllowsGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allows get not acceptable response has a 3xx status code +func (o *DomainAllowsGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allows get not acceptable response has a 4xx status code +func (o *DomainAllowsGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allows get not acceptable response has a 5xx status code +func (o *DomainAllowsGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allows get not acceptable response a status code equal to that given +func (o *DomainAllowsGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the domain allows get not acceptable response +func (o *DomainAllowsGetNotAcceptable) Code() int { + return 406 +} + +func (o *DomainAllowsGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetNotAcceptable", 406) +} + +func (o *DomainAllowsGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetNotAcceptable", 406) +} + +func (o *DomainAllowsGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowsGetInternalServerError creates a DomainAllowsGetInternalServerError with default headers values +func NewDomainAllowsGetInternalServerError() *DomainAllowsGetInternalServerError { + return &DomainAllowsGetInternalServerError{} +} + +/* +DomainAllowsGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DomainAllowsGetInternalServerError struct { +} + +// IsSuccess returns true when this domain allows get internal server error response has a 2xx status code +func (o *DomainAllowsGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allows get internal server error response has a 3xx status code +func (o *DomainAllowsGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allows get internal server error response has a 4xx status code +func (o *DomainAllowsGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain allows get internal server error response has a 5xx status code +func (o *DomainAllowsGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this domain allows get internal server error response a status code equal to that given +func (o *DomainAllowsGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the domain allows get internal server error response +func (o *DomainAllowsGetInternalServerError) Code() int { + return 500 +} + +func (o *DomainAllowsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetInternalServerError", 500) +} + +func (o *DomainAllowsGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetInternalServerError", 500) +} + +func (o *DomainAllowsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_block_create_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_block_create_parameters.go new file mode 100644 index 0000000..383a247 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_block_create_parameters.go @@ -0,0 +1,330 @@ +// 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" +) + +// NewDomainBlockCreateParams creates a new DomainBlockCreateParams 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 NewDomainBlockCreateParams() *DomainBlockCreateParams { + return &DomainBlockCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDomainBlockCreateParamsWithTimeout creates a new DomainBlockCreateParams object +// with the ability to set a timeout on a request. +func NewDomainBlockCreateParamsWithTimeout(timeout time.Duration) *DomainBlockCreateParams { + return &DomainBlockCreateParams{ + timeout: timeout, + } +} + +// NewDomainBlockCreateParamsWithContext creates a new DomainBlockCreateParams object +// with the ability to set a context for a request. +func NewDomainBlockCreateParamsWithContext(ctx context.Context) *DomainBlockCreateParams { + return &DomainBlockCreateParams{ + Context: ctx, + } +} + +// NewDomainBlockCreateParamsWithHTTPClient creates a new DomainBlockCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewDomainBlockCreateParamsWithHTTPClient(client *http.Client) *DomainBlockCreateParams { + return &DomainBlockCreateParams{ + HTTPClient: client, + } +} + +/* +DomainBlockCreateParams contains all the parameters to send to the API endpoint + + for the domain block create operation. + + Typically these are written to a http.Request. +*/ +type DomainBlockCreateParams struct { + + /* Domain. + + Single domain to block. Used only if `import` is not `true`. + */ + Domain *string + + /* Domains. + + JSON-formatted list of domain blocks to import. This is only used if `import` is set to `true`. + */ + Domains runtime.NamedReadCloser + + /* Import. + + Signal that a list of domain blocks is being imported as a file. If set to `true`, then 'domains' must be present as a JSON-formatted file. If set to `false`, then `domains` will be ignored, and `domain` must be present. + */ + Import *bool + + /* Obfuscate. + + Obfuscate the name of the domain when serving it publicly. Eg., `example.org` becomes something like `ex***e.org`. Used only if `import` is not `true`. + */ + Obfuscate *bool + + /* PrivateComment. + + Private comment about this domain block. Will only be shown to other admins, so this is a useful way of internally keeping track of why a certain domain ended up blocked. Used only if `import` is not `true`. + */ + PrivateComment *string + + /* PublicComment. + + Public comment about this domain block. This will be displayed alongside the domain block if you choose to share blocks. Used only if `import` is not `true`. + */ + PublicComment *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the domain block create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainBlockCreateParams) WithDefaults() *DomainBlockCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the domain block create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainBlockCreateParams) SetDefaults() { + var ( + importVarDefault = bool(false) + ) + + val := DomainBlockCreateParams{ + Import: &importVarDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the domain block create params +func (o *DomainBlockCreateParams) WithTimeout(timeout time.Duration) *DomainBlockCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the domain block create params +func (o *DomainBlockCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the domain block create params +func (o *DomainBlockCreateParams) WithContext(ctx context.Context) *DomainBlockCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the domain block create params +func (o *DomainBlockCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the domain block create params +func (o *DomainBlockCreateParams) WithHTTPClient(client *http.Client) *DomainBlockCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the domain block create params +func (o *DomainBlockCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDomain adds the domain to the domain block create params +func (o *DomainBlockCreateParams) WithDomain(domain *string) *DomainBlockCreateParams { + o.SetDomain(domain) + return o +} + +// SetDomain adds the domain to the domain block create params +func (o *DomainBlockCreateParams) SetDomain(domain *string) { + o.Domain = domain +} + +// WithDomains adds the domains to the domain block create params +func (o *DomainBlockCreateParams) WithDomains(domains runtime.NamedReadCloser) *DomainBlockCreateParams { + o.SetDomains(domains) + return o +} + +// SetDomains adds the domains to the domain block create params +func (o *DomainBlockCreateParams) SetDomains(domains runtime.NamedReadCloser) { + o.Domains = domains +} + +// WithImport adds the importVar to the domain block create params +func (o *DomainBlockCreateParams) WithImport(importVar *bool) *DomainBlockCreateParams { + o.SetImport(importVar) + return o +} + +// SetImport adds the import to the domain block create params +func (o *DomainBlockCreateParams) SetImport(importVar *bool) { + o.Import = importVar +} + +// WithObfuscate adds the obfuscate to the domain block create params +func (o *DomainBlockCreateParams) WithObfuscate(obfuscate *bool) *DomainBlockCreateParams { + o.SetObfuscate(obfuscate) + return o +} + +// SetObfuscate adds the obfuscate to the domain block create params +func (o *DomainBlockCreateParams) SetObfuscate(obfuscate *bool) { + o.Obfuscate = obfuscate +} + +// WithPrivateComment adds the privateComment to the domain block create params +func (o *DomainBlockCreateParams) WithPrivateComment(privateComment *string) *DomainBlockCreateParams { + o.SetPrivateComment(privateComment) + return o +} + +// SetPrivateComment adds the privateComment to the domain block create params +func (o *DomainBlockCreateParams) SetPrivateComment(privateComment *string) { + o.PrivateComment = privateComment +} + +// WithPublicComment adds the publicComment to the domain block create params +func (o *DomainBlockCreateParams) WithPublicComment(publicComment *string) *DomainBlockCreateParams { + o.SetPublicComment(publicComment) + return o +} + +// SetPublicComment adds the publicComment to the domain block create params +func (o *DomainBlockCreateParams) SetPublicComment(publicComment *string) { + o.PublicComment = publicComment +} + +// WriteToRequest writes these params to a swagger request +func (o *DomainBlockCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Domain != nil { + + // form param domain + var frDomain string + if o.Domain != nil { + frDomain = *o.Domain + } + fDomain := frDomain + if fDomain != "" { + if err := r.SetFormParam("domain", fDomain); err != nil { + return err + } + } + } + + if o.Domains != nil { + + if o.Domains != nil { + // form file param domains + if err := r.SetFileParam("domains", o.Domains); err != nil { + return err + } + } + } + + if o.Import != nil { + + // query param import + var qrImport bool + + if o.Import != nil { + qrImport = *o.Import + } + qImport := swag.FormatBool(qrImport) + if qImport != "" { + + if err := r.SetQueryParam("import", qImport); err != nil { + return err + } + } + } + + if o.Obfuscate != nil { + + // form param obfuscate + var frObfuscate bool + if o.Obfuscate != nil { + frObfuscate = *o.Obfuscate + } + fObfuscate := swag.FormatBool(frObfuscate) + if fObfuscate != "" { + if err := r.SetFormParam("obfuscate", fObfuscate); err != nil { + return err + } + } + } + + if o.PrivateComment != nil { + + // form param private_comment + var frPrivateComment string + if o.PrivateComment != nil { + frPrivateComment = *o.PrivateComment + } + fPrivateComment := frPrivateComment + if fPrivateComment != "" { + if err := r.SetFormParam("private_comment", fPrivateComment); err != nil { + return err + } + } + } + + if o.PublicComment != nil { + + // form param public_comment + var frPublicComment string + if o.PublicComment != nil { + frPublicComment = *o.PublicComment + } + fPublicComment := frPublicComment + if fPublicComment != "" { + if err := r.SetFormParam("public_comment", fPublicComment); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_block_create_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_block_create_responses.go new file mode 100644 index 0000000..9e5d370 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_block_create_responses.go @@ -0,0 +1,540 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// DomainBlockCreateReader is a Reader for the DomainBlockCreate structure. +type DomainBlockCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DomainBlockCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDomainBlockCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDomainBlockCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDomainBlockCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewDomainBlockCreateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDomainBlockCreateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDomainBlockCreateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewDomainBlockCreateConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDomainBlockCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/domain_blocks] domainBlockCreate", response, response.Code()) + } +} + +// NewDomainBlockCreateOK creates a DomainBlockCreateOK with default headers values +func NewDomainBlockCreateOK() *DomainBlockCreateOK { + return &DomainBlockCreateOK{} +} + +/* +DomainBlockCreateOK describes a response with status code 200, with default header values. + +The newly created domain block, if `import` != `true`. If a list has been imported, then an `array` of newly created domain blocks will be returned instead. +*/ +type DomainBlockCreateOK struct { + Payload *models.DomainPermission +} + +// IsSuccess returns true when this domain block create o k response has a 2xx status code +func (o *DomainBlockCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this domain block create o k response has a 3xx status code +func (o *DomainBlockCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block create o k response has a 4xx status code +func (o *DomainBlockCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain block create o k response has a 5xx status code +func (o *DomainBlockCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block create o k response a status code equal to that given +func (o *DomainBlockCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the domain block create o k response +func (o *DomainBlockCreateOK) Code() int { + return 200 +} + +func (o *DomainBlockCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateOK %s", 200, payload) +} + +func (o *DomainBlockCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateOK %s", 200, payload) +} + +func (o *DomainBlockCreateOK) GetPayload() *models.DomainPermission { + return o.Payload +} + +func (o *DomainBlockCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DomainPermission) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDomainBlockCreateBadRequest creates a DomainBlockCreateBadRequest with default headers values +func NewDomainBlockCreateBadRequest() *DomainBlockCreateBadRequest { + return &DomainBlockCreateBadRequest{} +} + +/* +DomainBlockCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DomainBlockCreateBadRequest struct { +} + +// IsSuccess returns true when this domain block create bad request response has a 2xx status code +func (o *DomainBlockCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block create bad request response has a 3xx status code +func (o *DomainBlockCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block create bad request response has a 4xx status code +func (o *DomainBlockCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block create bad request response has a 5xx status code +func (o *DomainBlockCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block create bad request response a status code equal to that given +func (o *DomainBlockCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the domain block create bad request response +func (o *DomainBlockCreateBadRequest) Code() int { + return 400 +} + +func (o *DomainBlockCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateBadRequest", 400) +} + +func (o *DomainBlockCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateBadRequest", 400) +} + +func (o *DomainBlockCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockCreateUnauthorized creates a DomainBlockCreateUnauthorized with default headers values +func NewDomainBlockCreateUnauthorized() *DomainBlockCreateUnauthorized { + return &DomainBlockCreateUnauthorized{} +} + +/* +DomainBlockCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DomainBlockCreateUnauthorized struct { +} + +// IsSuccess returns true when this domain block create unauthorized response has a 2xx status code +func (o *DomainBlockCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block create unauthorized response has a 3xx status code +func (o *DomainBlockCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block create unauthorized response has a 4xx status code +func (o *DomainBlockCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block create unauthorized response has a 5xx status code +func (o *DomainBlockCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block create unauthorized response a status code equal to that given +func (o *DomainBlockCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the domain block create unauthorized response +func (o *DomainBlockCreateUnauthorized) Code() int { + return 401 +} + +func (o *DomainBlockCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateUnauthorized", 401) +} + +func (o *DomainBlockCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateUnauthorized", 401) +} + +func (o *DomainBlockCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockCreateForbidden creates a DomainBlockCreateForbidden with default headers values +func NewDomainBlockCreateForbidden() *DomainBlockCreateForbidden { + return &DomainBlockCreateForbidden{} +} + +/* +DomainBlockCreateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type DomainBlockCreateForbidden struct { +} + +// IsSuccess returns true when this domain block create forbidden response has a 2xx status code +func (o *DomainBlockCreateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block create forbidden response has a 3xx status code +func (o *DomainBlockCreateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block create forbidden response has a 4xx status code +func (o *DomainBlockCreateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block create forbidden response has a 5xx status code +func (o *DomainBlockCreateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block create forbidden response a status code equal to that given +func (o *DomainBlockCreateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the domain block create forbidden response +func (o *DomainBlockCreateForbidden) Code() int { + return 403 +} + +func (o *DomainBlockCreateForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateForbidden", 403) +} + +func (o *DomainBlockCreateForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateForbidden", 403) +} + +func (o *DomainBlockCreateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockCreateNotFound creates a DomainBlockCreateNotFound with default headers values +func NewDomainBlockCreateNotFound() *DomainBlockCreateNotFound { + return &DomainBlockCreateNotFound{} +} + +/* +DomainBlockCreateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DomainBlockCreateNotFound struct { +} + +// IsSuccess returns true when this domain block create not found response has a 2xx status code +func (o *DomainBlockCreateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block create not found response has a 3xx status code +func (o *DomainBlockCreateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block create not found response has a 4xx status code +func (o *DomainBlockCreateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block create not found response has a 5xx status code +func (o *DomainBlockCreateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block create not found response a status code equal to that given +func (o *DomainBlockCreateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the domain block create not found response +func (o *DomainBlockCreateNotFound) Code() int { + return 404 +} + +func (o *DomainBlockCreateNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateNotFound", 404) +} + +func (o *DomainBlockCreateNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateNotFound", 404) +} + +func (o *DomainBlockCreateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockCreateNotAcceptable creates a DomainBlockCreateNotAcceptable with default headers values +func NewDomainBlockCreateNotAcceptable() *DomainBlockCreateNotAcceptable { + return &DomainBlockCreateNotAcceptable{} +} + +/* +DomainBlockCreateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DomainBlockCreateNotAcceptable struct { +} + +// IsSuccess returns true when this domain block create not acceptable response has a 2xx status code +func (o *DomainBlockCreateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block create not acceptable response has a 3xx status code +func (o *DomainBlockCreateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block create not acceptable response has a 4xx status code +func (o *DomainBlockCreateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block create not acceptable response has a 5xx status code +func (o *DomainBlockCreateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block create not acceptable response a status code equal to that given +func (o *DomainBlockCreateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the domain block create not acceptable response +func (o *DomainBlockCreateNotAcceptable) Code() int { + return 406 +} + +func (o *DomainBlockCreateNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateNotAcceptable", 406) +} + +func (o *DomainBlockCreateNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateNotAcceptable", 406) +} + +func (o *DomainBlockCreateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockCreateConflict creates a DomainBlockCreateConflict with default headers values +func NewDomainBlockCreateConflict() *DomainBlockCreateConflict { + return &DomainBlockCreateConflict{} +} + +/* +DomainBlockCreateConflict describes a response with status code 409, with default header values. + +Conflict: There is already an admin action running that conflicts with this action. Check the error message in the response body for more information. This is a temporary error; it should be possible to process this action if you try again in a bit. +*/ +type DomainBlockCreateConflict struct { +} + +// IsSuccess returns true when this domain block create conflict response has a 2xx status code +func (o *DomainBlockCreateConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block create conflict response has a 3xx status code +func (o *DomainBlockCreateConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block create conflict response has a 4xx status code +func (o *DomainBlockCreateConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block create conflict response has a 5xx status code +func (o *DomainBlockCreateConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block create conflict response a status code equal to that given +func (o *DomainBlockCreateConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the domain block create conflict response +func (o *DomainBlockCreateConflict) Code() int { + return 409 +} + +func (o *DomainBlockCreateConflict) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateConflict", 409) +} + +func (o *DomainBlockCreateConflict) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateConflict", 409) +} + +func (o *DomainBlockCreateConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockCreateInternalServerError creates a DomainBlockCreateInternalServerError with default headers values +func NewDomainBlockCreateInternalServerError() *DomainBlockCreateInternalServerError { + return &DomainBlockCreateInternalServerError{} +} + +/* +DomainBlockCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DomainBlockCreateInternalServerError struct { +} + +// IsSuccess returns true when this domain block create internal server error response has a 2xx status code +func (o *DomainBlockCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block create internal server error response has a 3xx status code +func (o *DomainBlockCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block create internal server error response has a 4xx status code +func (o *DomainBlockCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain block create internal server error response has a 5xx status code +func (o *DomainBlockCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this domain block create internal server error response a status code equal to that given +func (o *DomainBlockCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the domain block create internal server error response +func (o *DomainBlockCreateInternalServerError) Code() int { + return 500 +} + +func (o *DomainBlockCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateInternalServerError", 500) +} + +func (o *DomainBlockCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateInternalServerError", 500) +} + +func (o *DomainBlockCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_block_delete_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_block_delete_parameters.go new file mode 100644 index 0000000..6af133b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_block_delete_parameters.go @@ -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" +) + +// NewDomainBlockDeleteParams creates a new DomainBlockDeleteParams 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 NewDomainBlockDeleteParams() *DomainBlockDeleteParams { + return &DomainBlockDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDomainBlockDeleteParamsWithTimeout creates a new DomainBlockDeleteParams object +// with the ability to set a timeout on a request. +func NewDomainBlockDeleteParamsWithTimeout(timeout time.Duration) *DomainBlockDeleteParams { + return &DomainBlockDeleteParams{ + timeout: timeout, + } +} + +// NewDomainBlockDeleteParamsWithContext creates a new DomainBlockDeleteParams object +// with the ability to set a context for a request. +func NewDomainBlockDeleteParamsWithContext(ctx context.Context) *DomainBlockDeleteParams { + return &DomainBlockDeleteParams{ + Context: ctx, + } +} + +// NewDomainBlockDeleteParamsWithHTTPClient creates a new DomainBlockDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewDomainBlockDeleteParamsWithHTTPClient(client *http.Client) *DomainBlockDeleteParams { + return &DomainBlockDeleteParams{ + HTTPClient: client, + } +} + +/* +DomainBlockDeleteParams contains all the parameters to send to the API endpoint + + for the domain block delete operation. + + Typically these are written to a http.Request. +*/ +type DomainBlockDeleteParams struct { + + /* ID. + + The id of the domain block. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the domain block delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainBlockDeleteParams) WithDefaults() *DomainBlockDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the domain block delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainBlockDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the domain block delete params +func (o *DomainBlockDeleteParams) WithTimeout(timeout time.Duration) *DomainBlockDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the domain block delete params +func (o *DomainBlockDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the domain block delete params +func (o *DomainBlockDeleteParams) WithContext(ctx context.Context) *DomainBlockDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the domain block delete params +func (o *DomainBlockDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the domain block delete params +func (o *DomainBlockDeleteParams) WithHTTPClient(client *http.Client) *DomainBlockDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the domain block delete params +func (o *DomainBlockDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the domain block delete params +func (o *DomainBlockDeleteParams) WithID(id string) *DomainBlockDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the domain block delete params +func (o *DomainBlockDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DomainBlockDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_block_delete_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_block_delete_responses.go new file mode 100644 index 0000000..4a34c8d --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_block_delete_responses.go @@ -0,0 +1,540 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// DomainBlockDeleteReader is a Reader for the DomainBlockDelete structure. +type DomainBlockDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DomainBlockDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDomainBlockDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDomainBlockDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDomainBlockDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewDomainBlockDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDomainBlockDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDomainBlockDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewDomainBlockDeleteConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDomainBlockDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/admin/domain_blocks/{id}] domainBlockDelete", response, response.Code()) + } +} + +// NewDomainBlockDeleteOK creates a DomainBlockDeleteOK with default headers values +func NewDomainBlockDeleteOK() *DomainBlockDeleteOK { + return &DomainBlockDeleteOK{} +} + +/* +DomainBlockDeleteOK describes a response with status code 200, with default header values. + +The domain block that was just deleted. +*/ +type DomainBlockDeleteOK struct { + Payload *models.DomainPermission +} + +// IsSuccess returns true when this domain block delete o k response has a 2xx status code +func (o *DomainBlockDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this domain block delete o k response has a 3xx status code +func (o *DomainBlockDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block delete o k response has a 4xx status code +func (o *DomainBlockDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain block delete o k response has a 5xx status code +func (o *DomainBlockDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block delete o k response a status code equal to that given +func (o *DomainBlockDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the domain block delete o k response +func (o *DomainBlockDeleteOK) Code() int { + return 200 +} + +func (o *DomainBlockDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteOK %s", 200, payload) +} + +func (o *DomainBlockDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteOK %s", 200, payload) +} + +func (o *DomainBlockDeleteOK) GetPayload() *models.DomainPermission { + return o.Payload +} + +func (o *DomainBlockDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DomainPermission) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDomainBlockDeleteBadRequest creates a DomainBlockDeleteBadRequest with default headers values +func NewDomainBlockDeleteBadRequest() *DomainBlockDeleteBadRequest { + return &DomainBlockDeleteBadRequest{} +} + +/* +DomainBlockDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DomainBlockDeleteBadRequest struct { +} + +// IsSuccess returns true when this domain block delete bad request response has a 2xx status code +func (o *DomainBlockDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block delete bad request response has a 3xx status code +func (o *DomainBlockDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block delete bad request response has a 4xx status code +func (o *DomainBlockDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block delete bad request response has a 5xx status code +func (o *DomainBlockDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block delete bad request response a status code equal to that given +func (o *DomainBlockDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the domain block delete bad request response +func (o *DomainBlockDeleteBadRequest) Code() int { + return 400 +} + +func (o *DomainBlockDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteBadRequest", 400) +} + +func (o *DomainBlockDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteBadRequest", 400) +} + +func (o *DomainBlockDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockDeleteUnauthorized creates a DomainBlockDeleteUnauthorized with default headers values +func NewDomainBlockDeleteUnauthorized() *DomainBlockDeleteUnauthorized { + return &DomainBlockDeleteUnauthorized{} +} + +/* +DomainBlockDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DomainBlockDeleteUnauthorized struct { +} + +// IsSuccess returns true when this domain block delete unauthorized response has a 2xx status code +func (o *DomainBlockDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block delete unauthorized response has a 3xx status code +func (o *DomainBlockDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block delete unauthorized response has a 4xx status code +func (o *DomainBlockDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block delete unauthorized response has a 5xx status code +func (o *DomainBlockDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block delete unauthorized response a status code equal to that given +func (o *DomainBlockDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the domain block delete unauthorized response +func (o *DomainBlockDeleteUnauthorized) Code() int { + return 401 +} + +func (o *DomainBlockDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteUnauthorized", 401) +} + +func (o *DomainBlockDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteUnauthorized", 401) +} + +func (o *DomainBlockDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockDeleteForbidden creates a DomainBlockDeleteForbidden with default headers values +func NewDomainBlockDeleteForbidden() *DomainBlockDeleteForbidden { + return &DomainBlockDeleteForbidden{} +} + +/* +DomainBlockDeleteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type DomainBlockDeleteForbidden struct { +} + +// IsSuccess returns true when this domain block delete forbidden response has a 2xx status code +func (o *DomainBlockDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block delete forbidden response has a 3xx status code +func (o *DomainBlockDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block delete forbidden response has a 4xx status code +func (o *DomainBlockDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block delete forbidden response has a 5xx status code +func (o *DomainBlockDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block delete forbidden response a status code equal to that given +func (o *DomainBlockDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the domain block delete forbidden response +func (o *DomainBlockDeleteForbidden) Code() int { + return 403 +} + +func (o *DomainBlockDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteForbidden", 403) +} + +func (o *DomainBlockDeleteForbidden) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteForbidden", 403) +} + +func (o *DomainBlockDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockDeleteNotFound creates a DomainBlockDeleteNotFound with default headers values +func NewDomainBlockDeleteNotFound() *DomainBlockDeleteNotFound { + return &DomainBlockDeleteNotFound{} +} + +/* +DomainBlockDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DomainBlockDeleteNotFound struct { +} + +// IsSuccess returns true when this domain block delete not found response has a 2xx status code +func (o *DomainBlockDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block delete not found response has a 3xx status code +func (o *DomainBlockDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block delete not found response has a 4xx status code +func (o *DomainBlockDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block delete not found response has a 5xx status code +func (o *DomainBlockDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block delete not found response a status code equal to that given +func (o *DomainBlockDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the domain block delete not found response +func (o *DomainBlockDeleteNotFound) Code() int { + return 404 +} + +func (o *DomainBlockDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteNotFound", 404) +} + +func (o *DomainBlockDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteNotFound", 404) +} + +func (o *DomainBlockDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockDeleteNotAcceptable creates a DomainBlockDeleteNotAcceptable with default headers values +func NewDomainBlockDeleteNotAcceptable() *DomainBlockDeleteNotAcceptable { + return &DomainBlockDeleteNotAcceptable{} +} + +/* +DomainBlockDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DomainBlockDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this domain block delete not acceptable response has a 2xx status code +func (o *DomainBlockDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block delete not acceptable response has a 3xx status code +func (o *DomainBlockDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block delete not acceptable response has a 4xx status code +func (o *DomainBlockDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block delete not acceptable response has a 5xx status code +func (o *DomainBlockDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block delete not acceptable response a status code equal to that given +func (o *DomainBlockDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the domain block delete not acceptable response +func (o *DomainBlockDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *DomainBlockDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteNotAcceptable", 406) +} + +func (o *DomainBlockDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteNotAcceptable", 406) +} + +func (o *DomainBlockDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockDeleteConflict creates a DomainBlockDeleteConflict with default headers values +func NewDomainBlockDeleteConflict() *DomainBlockDeleteConflict { + return &DomainBlockDeleteConflict{} +} + +/* +DomainBlockDeleteConflict describes a response with status code 409, with default header values. + +Conflict: There is already an admin action running that conflicts with this action. Check the error message in the response body for more information. This is a temporary error; it should be possible to process this action if you try again in a bit. +*/ +type DomainBlockDeleteConflict struct { +} + +// IsSuccess returns true when this domain block delete conflict response has a 2xx status code +func (o *DomainBlockDeleteConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block delete conflict response has a 3xx status code +func (o *DomainBlockDeleteConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block delete conflict response has a 4xx status code +func (o *DomainBlockDeleteConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block delete conflict response has a 5xx status code +func (o *DomainBlockDeleteConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block delete conflict response a status code equal to that given +func (o *DomainBlockDeleteConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the domain block delete conflict response +func (o *DomainBlockDeleteConflict) Code() int { + return 409 +} + +func (o *DomainBlockDeleteConflict) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteConflict", 409) +} + +func (o *DomainBlockDeleteConflict) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteConflict", 409) +} + +func (o *DomainBlockDeleteConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockDeleteInternalServerError creates a DomainBlockDeleteInternalServerError with default headers values +func NewDomainBlockDeleteInternalServerError() *DomainBlockDeleteInternalServerError { + return &DomainBlockDeleteInternalServerError{} +} + +/* +DomainBlockDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DomainBlockDeleteInternalServerError struct { +} + +// IsSuccess returns true when this domain block delete internal server error response has a 2xx status code +func (o *DomainBlockDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block delete internal server error response has a 3xx status code +func (o *DomainBlockDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block delete internal server error response has a 4xx status code +func (o *DomainBlockDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain block delete internal server error response has a 5xx status code +func (o *DomainBlockDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this domain block delete internal server error response a status code equal to that given +func (o *DomainBlockDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the domain block delete internal server error response +func (o *DomainBlockDeleteInternalServerError) Code() int { + return 500 +} + +func (o *DomainBlockDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteInternalServerError", 500) +} + +func (o *DomainBlockDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteInternalServerError", 500) +} + +func (o *DomainBlockDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_block_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_block_get_parameters.go new file mode 100644 index 0000000..016fa47 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_block_get_parameters.go @@ -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" +) + +// NewDomainBlockGetParams creates a new DomainBlockGetParams 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 NewDomainBlockGetParams() *DomainBlockGetParams { + return &DomainBlockGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDomainBlockGetParamsWithTimeout creates a new DomainBlockGetParams object +// with the ability to set a timeout on a request. +func NewDomainBlockGetParamsWithTimeout(timeout time.Duration) *DomainBlockGetParams { + return &DomainBlockGetParams{ + timeout: timeout, + } +} + +// NewDomainBlockGetParamsWithContext creates a new DomainBlockGetParams object +// with the ability to set a context for a request. +func NewDomainBlockGetParamsWithContext(ctx context.Context) *DomainBlockGetParams { + return &DomainBlockGetParams{ + Context: ctx, + } +} + +// NewDomainBlockGetParamsWithHTTPClient creates a new DomainBlockGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewDomainBlockGetParamsWithHTTPClient(client *http.Client) *DomainBlockGetParams { + return &DomainBlockGetParams{ + HTTPClient: client, + } +} + +/* +DomainBlockGetParams contains all the parameters to send to the API endpoint + + for the domain block get operation. + + Typically these are written to a http.Request. +*/ +type DomainBlockGetParams struct { + + /* ID. + + The id of the domain block. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the domain block get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainBlockGetParams) WithDefaults() *DomainBlockGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the domain block get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainBlockGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the domain block get params +func (o *DomainBlockGetParams) WithTimeout(timeout time.Duration) *DomainBlockGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the domain block get params +func (o *DomainBlockGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the domain block get params +func (o *DomainBlockGetParams) WithContext(ctx context.Context) *DomainBlockGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the domain block get params +func (o *DomainBlockGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the domain block get params +func (o *DomainBlockGetParams) WithHTTPClient(client *http.Client) *DomainBlockGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the domain block get params +func (o *DomainBlockGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the domain block get params +func (o *DomainBlockGetParams) WithID(id string) *DomainBlockGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the domain block get params +func (o *DomainBlockGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DomainBlockGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_block_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_block_get_responses.go new file mode 100644 index 0000000..1a221e1 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_block_get_responses.go @@ -0,0 +1,478 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// DomainBlockGetReader is a Reader for the DomainBlockGet structure. +type DomainBlockGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DomainBlockGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDomainBlockGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDomainBlockGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDomainBlockGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewDomainBlockGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDomainBlockGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDomainBlockGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDomainBlockGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/domain_blocks/{id}] domainBlockGet", response, response.Code()) + } +} + +// NewDomainBlockGetOK creates a DomainBlockGetOK with default headers values +func NewDomainBlockGetOK() *DomainBlockGetOK { + return &DomainBlockGetOK{} +} + +/* +DomainBlockGetOK describes a response with status code 200, with default header values. + +The requested domain block. +*/ +type DomainBlockGetOK struct { + Payload *models.DomainPermission +} + +// IsSuccess returns true when this domain block get o k response has a 2xx status code +func (o *DomainBlockGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this domain block get o k response has a 3xx status code +func (o *DomainBlockGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block get o k response has a 4xx status code +func (o *DomainBlockGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain block get o k response has a 5xx status code +func (o *DomainBlockGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block get o k response a status code equal to that given +func (o *DomainBlockGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the domain block get o k response +func (o *DomainBlockGetOK) Code() int { + return 200 +} + +func (o *DomainBlockGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetOK %s", 200, payload) +} + +func (o *DomainBlockGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetOK %s", 200, payload) +} + +func (o *DomainBlockGetOK) GetPayload() *models.DomainPermission { + return o.Payload +} + +func (o *DomainBlockGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DomainPermission) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDomainBlockGetBadRequest creates a DomainBlockGetBadRequest with default headers values +func NewDomainBlockGetBadRequest() *DomainBlockGetBadRequest { + return &DomainBlockGetBadRequest{} +} + +/* +DomainBlockGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DomainBlockGetBadRequest struct { +} + +// IsSuccess returns true when this domain block get bad request response has a 2xx status code +func (o *DomainBlockGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block get bad request response has a 3xx status code +func (o *DomainBlockGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block get bad request response has a 4xx status code +func (o *DomainBlockGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block get bad request response has a 5xx status code +func (o *DomainBlockGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block get bad request response a status code equal to that given +func (o *DomainBlockGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the domain block get bad request response +func (o *DomainBlockGetBadRequest) Code() int { + return 400 +} + +func (o *DomainBlockGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetBadRequest", 400) +} + +func (o *DomainBlockGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetBadRequest", 400) +} + +func (o *DomainBlockGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockGetUnauthorized creates a DomainBlockGetUnauthorized with default headers values +func NewDomainBlockGetUnauthorized() *DomainBlockGetUnauthorized { + return &DomainBlockGetUnauthorized{} +} + +/* +DomainBlockGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DomainBlockGetUnauthorized struct { +} + +// IsSuccess returns true when this domain block get unauthorized response has a 2xx status code +func (o *DomainBlockGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block get unauthorized response has a 3xx status code +func (o *DomainBlockGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block get unauthorized response has a 4xx status code +func (o *DomainBlockGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block get unauthorized response has a 5xx status code +func (o *DomainBlockGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block get unauthorized response a status code equal to that given +func (o *DomainBlockGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the domain block get unauthorized response +func (o *DomainBlockGetUnauthorized) Code() int { + return 401 +} + +func (o *DomainBlockGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetUnauthorized", 401) +} + +func (o *DomainBlockGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetUnauthorized", 401) +} + +func (o *DomainBlockGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockGetForbidden creates a DomainBlockGetForbidden with default headers values +func NewDomainBlockGetForbidden() *DomainBlockGetForbidden { + return &DomainBlockGetForbidden{} +} + +/* +DomainBlockGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type DomainBlockGetForbidden struct { +} + +// IsSuccess returns true when this domain block get forbidden response has a 2xx status code +func (o *DomainBlockGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block get forbidden response has a 3xx status code +func (o *DomainBlockGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block get forbidden response has a 4xx status code +func (o *DomainBlockGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block get forbidden response has a 5xx status code +func (o *DomainBlockGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block get forbidden response a status code equal to that given +func (o *DomainBlockGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the domain block get forbidden response +func (o *DomainBlockGetForbidden) Code() int { + return 403 +} + +func (o *DomainBlockGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetForbidden", 403) +} + +func (o *DomainBlockGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetForbidden", 403) +} + +func (o *DomainBlockGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockGetNotFound creates a DomainBlockGetNotFound with default headers values +func NewDomainBlockGetNotFound() *DomainBlockGetNotFound { + return &DomainBlockGetNotFound{} +} + +/* +DomainBlockGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DomainBlockGetNotFound struct { +} + +// IsSuccess returns true when this domain block get not found response has a 2xx status code +func (o *DomainBlockGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block get not found response has a 3xx status code +func (o *DomainBlockGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block get not found response has a 4xx status code +func (o *DomainBlockGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block get not found response has a 5xx status code +func (o *DomainBlockGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block get not found response a status code equal to that given +func (o *DomainBlockGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the domain block get not found response +func (o *DomainBlockGetNotFound) Code() int { + return 404 +} + +func (o *DomainBlockGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetNotFound", 404) +} + +func (o *DomainBlockGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetNotFound", 404) +} + +func (o *DomainBlockGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockGetNotAcceptable creates a DomainBlockGetNotAcceptable with default headers values +func NewDomainBlockGetNotAcceptable() *DomainBlockGetNotAcceptable { + return &DomainBlockGetNotAcceptable{} +} + +/* +DomainBlockGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DomainBlockGetNotAcceptable struct { +} + +// IsSuccess returns true when this domain block get not acceptable response has a 2xx status code +func (o *DomainBlockGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block get not acceptable response has a 3xx status code +func (o *DomainBlockGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block get not acceptable response has a 4xx status code +func (o *DomainBlockGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block get not acceptable response has a 5xx status code +func (o *DomainBlockGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block get not acceptable response a status code equal to that given +func (o *DomainBlockGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the domain block get not acceptable response +func (o *DomainBlockGetNotAcceptable) Code() int { + return 406 +} + +func (o *DomainBlockGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetNotAcceptable", 406) +} + +func (o *DomainBlockGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetNotAcceptable", 406) +} + +func (o *DomainBlockGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockGetInternalServerError creates a DomainBlockGetInternalServerError with default headers values +func NewDomainBlockGetInternalServerError() *DomainBlockGetInternalServerError { + return &DomainBlockGetInternalServerError{} +} + +/* +DomainBlockGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DomainBlockGetInternalServerError struct { +} + +// IsSuccess returns true when this domain block get internal server error response has a 2xx status code +func (o *DomainBlockGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block get internal server error response has a 3xx status code +func (o *DomainBlockGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block get internal server error response has a 4xx status code +func (o *DomainBlockGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain block get internal server error response has a 5xx status code +func (o *DomainBlockGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this domain block get internal server error response a status code equal to that given +func (o *DomainBlockGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the domain block get internal server error response +func (o *DomainBlockGetInternalServerError) Code() int { + return 500 +} + +func (o *DomainBlockGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetInternalServerError", 500) +} + +func (o *DomainBlockGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetInternalServerError", 500) +} + +func (o *DomainBlockGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_blocks_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_blocks_get_parameters.go new file mode 100644 index 0000000..648003d --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_blocks_get_parameters.go @@ -0,0 +1,164 @@ +// 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" +) + +// NewDomainBlocksGetParams creates a new DomainBlocksGetParams 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 NewDomainBlocksGetParams() *DomainBlocksGetParams { + return &DomainBlocksGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDomainBlocksGetParamsWithTimeout creates a new DomainBlocksGetParams object +// with the ability to set a timeout on a request. +func NewDomainBlocksGetParamsWithTimeout(timeout time.Duration) *DomainBlocksGetParams { + return &DomainBlocksGetParams{ + timeout: timeout, + } +} + +// NewDomainBlocksGetParamsWithContext creates a new DomainBlocksGetParams object +// with the ability to set a context for a request. +func NewDomainBlocksGetParamsWithContext(ctx context.Context) *DomainBlocksGetParams { + return &DomainBlocksGetParams{ + Context: ctx, + } +} + +// NewDomainBlocksGetParamsWithHTTPClient creates a new DomainBlocksGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewDomainBlocksGetParamsWithHTTPClient(client *http.Client) *DomainBlocksGetParams { + return &DomainBlocksGetParams{ + HTTPClient: client, + } +} + +/* +DomainBlocksGetParams contains all the parameters to send to the API endpoint + + for the domain blocks get operation. + + Typically these are written to a http.Request. +*/ +type DomainBlocksGetParams struct { + + /* Export. + + If set to `true`, then each entry in the returned list of domain blocks will only consist of the fields `domain` and `public_comment`. This is perfect for when you want to save and share a list of all the domains you have blocked on your instance, so that someone else can easily import them, but you don't want them to see the database IDs of your blocks, or private comments etc. + */ + Export *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the domain blocks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainBlocksGetParams) WithDefaults() *DomainBlocksGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the domain blocks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainBlocksGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the domain blocks get params +func (o *DomainBlocksGetParams) WithTimeout(timeout time.Duration) *DomainBlocksGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the domain blocks get params +func (o *DomainBlocksGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the domain blocks get params +func (o *DomainBlocksGetParams) WithContext(ctx context.Context) *DomainBlocksGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the domain blocks get params +func (o *DomainBlocksGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the domain blocks get params +func (o *DomainBlocksGetParams) WithHTTPClient(client *http.Client) *DomainBlocksGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the domain blocks get params +func (o *DomainBlocksGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExport adds the export to the domain blocks get params +func (o *DomainBlocksGetParams) WithExport(export *bool) *DomainBlocksGetParams { + o.SetExport(export) + return o +} + +// SetExport adds the export to the domain blocks get params +func (o *DomainBlocksGetParams) SetExport(export *bool) { + o.Export = export +} + +// WriteToRequest writes these params to a swagger request +func (o *DomainBlocksGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Export != nil { + + // query param export + var qrExport bool + + if o.Export != nil { + qrExport = *o.Export + } + qExport := swag.FormatBool(qrExport) + if qExport != "" { + + if err := r.SetQueryParam("export", qExport); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_blocks_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_blocks_get_responses.go new file mode 100644 index 0000000..4423cdf --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_blocks_get_responses.go @@ -0,0 +1,476 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// DomainBlocksGetReader is a Reader for the DomainBlocksGet structure. +type DomainBlocksGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DomainBlocksGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDomainBlocksGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDomainBlocksGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDomainBlocksGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewDomainBlocksGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDomainBlocksGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDomainBlocksGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDomainBlocksGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/domain_blocks] domainBlocksGet", response, response.Code()) + } +} + +// NewDomainBlocksGetOK creates a DomainBlocksGetOK with default headers values +func NewDomainBlocksGetOK() *DomainBlocksGetOK { + return &DomainBlocksGetOK{} +} + +/* +DomainBlocksGetOK describes a response with status code 200, with default header values. + +All domain blocks currently in place. +*/ +type DomainBlocksGetOK struct { + Payload []*models.DomainPermission +} + +// IsSuccess returns true when this domain blocks get o k response has a 2xx status code +func (o *DomainBlocksGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this domain blocks get o k response has a 3xx status code +func (o *DomainBlocksGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain blocks get o k response has a 4xx status code +func (o *DomainBlocksGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain blocks get o k response has a 5xx status code +func (o *DomainBlocksGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this domain blocks get o k response a status code equal to that given +func (o *DomainBlocksGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the domain blocks get o k response +func (o *DomainBlocksGetOK) Code() int { + return 200 +} + +func (o *DomainBlocksGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetOK %s", 200, payload) +} + +func (o *DomainBlocksGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetOK %s", 200, payload) +} + +func (o *DomainBlocksGetOK) GetPayload() []*models.DomainPermission { + return o.Payload +} + +func (o *DomainBlocksGetOK) 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 +} + +// NewDomainBlocksGetBadRequest creates a DomainBlocksGetBadRequest with default headers values +func NewDomainBlocksGetBadRequest() *DomainBlocksGetBadRequest { + return &DomainBlocksGetBadRequest{} +} + +/* +DomainBlocksGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DomainBlocksGetBadRequest struct { +} + +// IsSuccess returns true when this domain blocks get bad request response has a 2xx status code +func (o *DomainBlocksGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain blocks get bad request response has a 3xx status code +func (o *DomainBlocksGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain blocks get bad request response has a 4xx status code +func (o *DomainBlocksGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain blocks get bad request response has a 5xx status code +func (o *DomainBlocksGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this domain blocks get bad request response a status code equal to that given +func (o *DomainBlocksGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the domain blocks get bad request response +func (o *DomainBlocksGetBadRequest) Code() int { + return 400 +} + +func (o *DomainBlocksGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetBadRequest", 400) +} + +func (o *DomainBlocksGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetBadRequest", 400) +} + +func (o *DomainBlocksGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlocksGetUnauthorized creates a DomainBlocksGetUnauthorized with default headers values +func NewDomainBlocksGetUnauthorized() *DomainBlocksGetUnauthorized { + return &DomainBlocksGetUnauthorized{} +} + +/* +DomainBlocksGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DomainBlocksGetUnauthorized struct { +} + +// IsSuccess returns true when this domain blocks get unauthorized response has a 2xx status code +func (o *DomainBlocksGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain blocks get unauthorized response has a 3xx status code +func (o *DomainBlocksGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain blocks get unauthorized response has a 4xx status code +func (o *DomainBlocksGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain blocks get unauthorized response has a 5xx status code +func (o *DomainBlocksGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this domain blocks get unauthorized response a status code equal to that given +func (o *DomainBlocksGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the domain blocks get unauthorized response +func (o *DomainBlocksGetUnauthorized) Code() int { + return 401 +} + +func (o *DomainBlocksGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetUnauthorized", 401) +} + +func (o *DomainBlocksGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetUnauthorized", 401) +} + +func (o *DomainBlocksGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlocksGetForbidden creates a DomainBlocksGetForbidden with default headers values +func NewDomainBlocksGetForbidden() *DomainBlocksGetForbidden { + return &DomainBlocksGetForbidden{} +} + +/* +DomainBlocksGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type DomainBlocksGetForbidden struct { +} + +// IsSuccess returns true when this domain blocks get forbidden response has a 2xx status code +func (o *DomainBlocksGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain blocks get forbidden response has a 3xx status code +func (o *DomainBlocksGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain blocks get forbidden response has a 4xx status code +func (o *DomainBlocksGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain blocks get forbidden response has a 5xx status code +func (o *DomainBlocksGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this domain blocks get forbidden response a status code equal to that given +func (o *DomainBlocksGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the domain blocks get forbidden response +func (o *DomainBlocksGetForbidden) Code() int { + return 403 +} + +func (o *DomainBlocksGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetForbidden", 403) +} + +func (o *DomainBlocksGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetForbidden", 403) +} + +func (o *DomainBlocksGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlocksGetNotFound creates a DomainBlocksGetNotFound with default headers values +func NewDomainBlocksGetNotFound() *DomainBlocksGetNotFound { + return &DomainBlocksGetNotFound{} +} + +/* +DomainBlocksGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DomainBlocksGetNotFound struct { +} + +// IsSuccess returns true when this domain blocks get not found response has a 2xx status code +func (o *DomainBlocksGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain blocks get not found response has a 3xx status code +func (o *DomainBlocksGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain blocks get not found response has a 4xx status code +func (o *DomainBlocksGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain blocks get not found response has a 5xx status code +func (o *DomainBlocksGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this domain blocks get not found response a status code equal to that given +func (o *DomainBlocksGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the domain blocks get not found response +func (o *DomainBlocksGetNotFound) Code() int { + return 404 +} + +func (o *DomainBlocksGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetNotFound", 404) +} + +func (o *DomainBlocksGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetNotFound", 404) +} + +func (o *DomainBlocksGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlocksGetNotAcceptable creates a DomainBlocksGetNotAcceptable with default headers values +func NewDomainBlocksGetNotAcceptable() *DomainBlocksGetNotAcceptable { + return &DomainBlocksGetNotAcceptable{} +} + +/* +DomainBlocksGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DomainBlocksGetNotAcceptable struct { +} + +// IsSuccess returns true when this domain blocks get not acceptable response has a 2xx status code +func (o *DomainBlocksGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain blocks get not acceptable response has a 3xx status code +func (o *DomainBlocksGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain blocks get not acceptable response has a 4xx status code +func (o *DomainBlocksGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain blocks get not acceptable response has a 5xx status code +func (o *DomainBlocksGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this domain blocks get not acceptable response a status code equal to that given +func (o *DomainBlocksGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the domain blocks get not acceptable response +func (o *DomainBlocksGetNotAcceptable) Code() int { + return 406 +} + +func (o *DomainBlocksGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetNotAcceptable", 406) +} + +func (o *DomainBlocksGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetNotAcceptable", 406) +} + +func (o *DomainBlocksGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlocksGetInternalServerError creates a DomainBlocksGetInternalServerError with default headers values +func NewDomainBlocksGetInternalServerError() *DomainBlocksGetInternalServerError { + return &DomainBlocksGetInternalServerError{} +} + +/* +DomainBlocksGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DomainBlocksGetInternalServerError struct { +} + +// IsSuccess returns true when this domain blocks get internal server error response has a 2xx status code +func (o *DomainBlocksGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain blocks get internal server error response has a 3xx status code +func (o *DomainBlocksGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain blocks get internal server error response has a 4xx status code +func (o *DomainBlocksGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain blocks get internal server error response has a 5xx status code +func (o *DomainBlocksGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this domain blocks get internal server error response a status code equal to that given +func (o *DomainBlocksGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the domain blocks get internal server error response +func (o *DomainBlocksGetInternalServerError) Code() int { + return 500 +} + +func (o *DomainBlocksGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetInternalServerError", 500) +} + +func (o *DomainBlocksGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetInternalServerError", 500) +} + +func (o *DomainBlocksGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_keys_expire_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_keys_expire_parameters.go new file mode 100644 index 0000000..e19e4a7 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_keys_expire_parameters.go @@ -0,0 +1,162 @@ +// 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" +) + +// NewDomainKeysExpireParams creates a new DomainKeysExpireParams 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 NewDomainKeysExpireParams() *DomainKeysExpireParams { + return &DomainKeysExpireParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDomainKeysExpireParamsWithTimeout creates a new DomainKeysExpireParams object +// with the ability to set a timeout on a request. +func NewDomainKeysExpireParamsWithTimeout(timeout time.Duration) *DomainKeysExpireParams { + return &DomainKeysExpireParams{ + timeout: timeout, + } +} + +// NewDomainKeysExpireParamsWithContext creates a new DomainKeysExpireParams object +// with the ability to set a context for a request. +func NewDomainKeysExpireParamsWithContext(ctx context.Context) *DomainKeysExpireParams { + return &DomainKeysExpireParams{ + Context: ctx, + } +} + +// NewDomainKeysExpireParamsWithHTTPClient creates a new DomainKeysExpireParams object +// with the ability to set a custom HTTPClient for a request. +func NewDomainKeysExpireParamsWithHTTPClient(client *http.Client) *DomainKeysExpireParams { + return &DomainKeysExpireParams{ + HTTPClient: client, + } +} + +/* +DomainKeysExpireParams contains all the parameters to send to the API endpoint + + for the domain keys expire operation. + + Typically these are written to a http.Request. +*/ +type DomainKeysExpireParams struct { + + /* Domain. + + Domain to expire keys for. + Sample: example.org + */ + Domain *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the domain keys expire params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainKeysExpireParams) WithDefaults() *DomainKeysExpireParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the domain keys expire params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainKeysExpireParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the domain keys expire params +func (o *DomainKeysExpireParams) WithTimeout(timeout time.Duration) *DomainKeysExpireParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the domain keys expire params +func (o *DomainKeysExpireParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the domain keys expire params +func (o *DomainKeysExpireParams) WithContext(ctx context.Context) *DomainKeysExpireParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the domain keys expire params +func (o *DomainKeysExpireParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the domain keys expire params +func (o *DomainKeysExpireParams) WithHTTPClient(client *http.Client) *DomainKeysExpireParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the domain keys expire params +func (o *DomainKeysExpireParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDomain adds the domain to the domain keys expire params +func (o *DomainKeysExpireParams) WithDomain(domain *string) *DomainKeysExpireParams { + o.SetDomain(domain) + return o +} + +// SetDomain adds the domain to the domain keys expire params +func (o *DomainKeysExpireParams) SetDomain(domain *string) { + o.Domain = domain +} + +// WriteToRequest writes these params to a swagger request +func (o *DomainKeysExpireParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Domain != nil { + + // form param domain + var frDomain string + if o.Domain != nil { + frDomain = *o.Domain + } + fDomain := frDomain + if fDomain != "" { + if err := r.SetFormParam("domain", fDomain); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_keys_expire_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_keys_expire_responses.go new file mode 100644 index 0000000..edd6953 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/domain_keys_expire_responses.go @@ -0,0 +1,540 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// DomainKeysExpireReader is a Reader for the DomainKeysExpire structure. +type DomainKeysExpireReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DomainKeysExpireReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewDomainKeysExpireAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDomainKeysExpireBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDomainKeysExpireUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewDomainKeysExpireForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDomainKeysExpireNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDomainKeysExpireNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewDomainKeysExpireConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDomainKeysExpireInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/domain_keys_expire] domainKeysExpire", response, response.Code()) + } +} + +// NewDomainKeysExpireAccepted creates a DomainKeysExpireAccepted with default headers values +func NewDomainKeysExpireAccepted() *DomainKeysExpireAccepted { + return &DomainKeysExpireAccepted{} +} + +/* +DomainKeysExpireAccepted describes a response with status code 202, with default header values. + +Request accepted and will be processed. Check the logs for progress / errors. +*/ +type DomainKeysExpireAccepted struct { + Payload *models.AdminActionResponse +} + +// IsSuccess returns true when this domain keys expire accepted response has a 2xx status code +func (o *DomainKeysExpireAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this domain keys expire accepted response has a 3xx status code +func (o *DomainKeysExpireAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain keys expire accepted response has a 4xx status code +func (o *DomainKeysExpireAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain keys expire accepted response has a 5xx status code +func (o *DomainKeysExpireAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this domain keys expire accepted response a status code equal to that given +func (o *DomainKeysExpireAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the domain keys expire accepted response +func (o *DomainKeysExpireAccepted) Code() int { + return 202 +} + +func (o *DomainKeysExpireAccepted) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireAccepted %s", 202, payload) +} + +func (o *DomainKeysExpireAccepted) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireAccepted %s", 202, payload) +} + +func (o *DomainKeysExpireAccepted) GetPayload() *models.AdminActionResponse { + return o.Payload +} + +func (o *DomainKeysExpireAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AdminActionResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDomainKeysExpireBadRequest creates a DomainKeysExpireBadRequest with default headers values +func NewDomainKeysExpireBadRequest() *DomainKeysExpireBadRequest { + return &DomainKeysExpireBadRequest{} +} + +/* +DomainKeysExpireBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DomainKeysExpireBadRequest struct { +} + +// IsSuccess returns true when this domain keys expire bad request response has a 2xx status code +func (o *DomainKeysExpireBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain keys expire bad request response has a 3xx status code +func (o *DomainKeysExpireBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain keys expire bad request response has a 4xx status code +func (o *DomainKeysExpireBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain keys expire bad request response has a 5xx status code +func (o *DomainKeysExpireBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this domain keys expire bad request response a status code equal to that given +func (o *DomainKeysExpireBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the domain keys expire bad request response +func (o *DomainKeysExpireBadRequest) Code() int { + return 400 +} + +func (o *DomainKeysExpireBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireBadRequest", 400) +} + +func (o *DomainKeysExpireBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireBadRequest", 400) +} + +func (o *DomainKeysExpireBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainKeysExpireUnauthorized creates a DomainKeysExpireUnauthorized with default headers values +func NewDomainKeysExpireUnauthorized() *DomainKeysExpireUnauthorized { + return &DomainKeysExpireUnauthorized{} +} + +/* +DomainKeysExpireUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DomainKeysExpireUnauthorized struct { +} + +// IsSuccess returns true when this domain keys expire unauthorized response has a 2xx status code +func (o *DomainKeysExpireUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain keys expire unauthorized response has a 3xx status code +func (o *DomainKeysExpireUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain keys expire unauthorized response has a 4xx status code +func (o *DomainKeysExpireUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain keys expire unauthorized response has a 5xx status code +func (o *DomainKeysExpireUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this domain keys expire unauthorized response a status code equal to that given +func (o *DomainKeysExpireUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the domain keys expire unauthorized response +func (o *DomainKeysExpireUnauthorized) Code() int { + return 401 +} + +func (o *DomainKeysExpireUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireUnauthorized", 401) +} + +func (o *DomainKeysExpireUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireUnauthorized", 401) +} + +func (o *DomainKeysExpireUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainKeysExpireForbidden creates a DomainKeysExpireForbidden with default headers values +func NewDomainKeysExpireForbidden() *DomainKeysExpireForbidden { + return &DomainKeysExpireForbidden{} +} + +/* +DomainKeysExpireForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type DomainKeysExpireForbidden struct { +} + +// IsSuccess returns true when this domain keys expire forbidden response has a 2xx status code +func (o *DomainKeysExpireForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain keys expire forbidden response has a 3xx status code +func (o *DomainKeysExpireForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain keys expire forbidden response has a 4xx status code +func (o *DomainKeysExpireForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain keys expire forbidden response has a 5xx status code +func (o *DomainKeysExpireForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this domain keys expire forbidden response a status code equal to that given +func (o *DomainKeysExpireForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the domain keys expire forbidden response +func (o *DomainKeysExpireForbidden) Code() int { + return 403 +} + +func (o *DomainKeysExpireForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireForbidden", 403) +} + +func (o *DomainKeysExpireForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireForbidden", 403) +} + +func (o *DomainKeysExpireForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainKeysExpireNotFound creates a DomainKeysExpireNotFound with default headers values +func NewDomainKeysExpireNotFound() *DomainKeysExpireNotFound { + return &DomainKeysExpireNotFound{} +} + +/* +DomainKeysExpireNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DomainKeysExpireNotFound struct { +} + +// IsSuccess returns true when this domain keys expire not found response has a 2xx status code +func (o *DomainKeysExpireNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain keys expire not found response has a 3xx status code +func (o *DomainKeysExpireNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain keys expire not found response has a 4xx status code +func (o *DomainKeysExpireNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain keys expire not found response has a 5xx status code +func (o *DomainKeysExpireNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this domain keys expire not found response a status code equal to that given +func (o *DomainKeysExpireNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the domain keys expire not found response +func (o *DomainKeysExpireNotFound) Code() int { + return 404 +} + +func (o *DomainKeysExpireNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireNotFound", 404) +} + +func (o *DomainKeysExpireNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireNotFound", 404) +} + +func (o *DomainKeysExpireNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainKeysExpireNotAcceptable creates a DomainKeysExpireNotAcceptable with default headers values +func NewDomainKeysExpireNotAcceptable() *DomainKeysExpireNotAcceptable { + return &DomainKeysExpireNotAcceptable{} +} + +/* +DomainKeysExpireNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DomainKeysExpireNotAcceptable struct { +} + +// IsSuccess returns true when this domain keys expire not acceptable response has a 2xx status code +func (o *DomainKeysExpireNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain keys expire not acceptable response has a 3xx status code +func (o *DomainKeysExpireNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain keys expire not acceptable response has a 4xx status code +func (o *DomainKeysExpireNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain keys expire not acceptable response has a 5xx status code +func (o *DomainKeysExpireNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this domain keys expire not acceptable response a status code equal to that given +func (o *DomainKeysExpireNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the domain keys expire not acceptable response +func (o *DomainKeysExpireNotAcceptable) Code() int { + return 406 +} + +func (o *DomainKeysExpireNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireNotAcceptable", 406) +} + +func (o *DomainKeysExpireNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireNotAcceptable", 406) +} + +func (o *DomainKeysExpireNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainKeysExpireConflict creates a DomainKeysExpireConflict with default headers values +func NewDomainKeysExpireConflict() *DomainKeysExpireConflict { + return &DomainKeysExpireConflict{} +} + +/* +DomainKeysExpireConflict describes a response with status code 409, with default header values. + +Conflict: There is already an admin action running that conflicts with this action. Check the error message in the response body for more information. This is a temporary error; it should be possible to process this action if you try again in a bit. +*/ +type DomainKeysExpireConflict struct { +} + +// IsSuccess returns true when this domain keys expire conflict response has a 2xx status code +func (o *DomainKeysExpireConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain keys expire conflict response has a 3xx status code +func (o *DomainKeysExpireConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain keys expire conflict response has a 4xx status code +func (o *DomainKeysExpireConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain keys expire conflict response has a 5xx status code +func (o *DomainKeysExpireConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this domain keys expire conflict response a status code equal to that given +func (o *DomainKeysExpireConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the domain keys expire conflict response +func (o *DomainKeysExpireConflict) Code() int { + return 409 +} + +func (o *DomainKeysExpireConflict) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireConflict", 409) +} + +func (o *DomainKeysExpireConflict) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireConflict", 409) +} + +func (o *DomainKeysExpireConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainKeysExpireInternalServerError creates a DomainKeysExpireInternalServerError with default headers values +func NewDomainKeysExpireInternalServerError() *DomainKeysExpireInternalServerError { + return &DomainKeysExpireInternalServerError{} +} + +/* +DomainKeysExpireInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DomainKeysExpireInternalServerError struct { +} + +// IsSuccess returns true when this domain keys expire internal server error response has a 2xx status code +func (o *DomainKeysExpireInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain keys expire internal server error response has a 3xx status code +func (o *DomainKeysExpireInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain keys expire internal server error response has a 4xx status code +func (o *DomainKeysExpireInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain keys expire internal server error response has a 5xx status code +func (o *DomainKeysExpireInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this domain keys expire internal server error response a status code equal to that given +func (o *DomainKeysExpireInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the domain keys expire internal server error response +func (o *DomainKeysExpireInternalServerError) Code() int { + return 500 +} + +func (o *DomainKeysExpireInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireInternalServerError", 500) +} + +func (o *DomainKeysExpireInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireInternalServerError", 500) +} + +func (o *DomainKeysExpireInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_categories_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_categories_get_parameters.go new file mode 100644 index 0000000..55ce218 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_categories_get_parameters.go @@ -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" +) + +// NewEmojiCategoriesGetParams creates a new EmojiCategoriesGetParams 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 NewEmojiCategoriesGetParams() *EmojiCategoriesGetParams { + return &EmojiCategoriesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewEmojiCategoriesGetParamsWithTimeout creates a new EmojiCategoriesGetParams object +// with the ability to set a timeout on a request. +func NewEmojiCategoriesGetParamsWithTimeout(timeout time.Duration) *EmojiCategoriesGetParams { + return &EmojiCategoriesGetParams{ + timeout: timeout, + } +} + +// NewEmojiCategoriesGetParamsWithContext creates a new EmojiCategoriesGetParams object +// with the ability to set a context for a request. +func NewEmojiCategoriesGetParamsWithContext(ctx context.Context) *EmojiCategoriesGetParams { + return &EmojiCategoriesGetParams{ + Context: ctx, + } +} + +// NewEmojiCategoriesGetParamsWithHTTPClient creates a new EmojiCategoriesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewEmojiCategoriesGetParamsWithHTTPClient(client *http.Client) *EmojiCategoriesGetParams { + return &EmojiCategoriesGetParams{ + HTTPClient: client, + } +} + +/* +EmojiCategoriesGetParams contains all the parameters to send to the API endpoint + + for the emoji categories get operation. + + Typically these are written to a http.Request. +*/ +type EmojiCategoriesGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the emoji categories get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojiCategoriesGetParams) WithDefaults() *EmojiCategoriesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the emoji categories get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojiCategoriesGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the emoji categories get params +func (o *EmojiCategoriesGetParams) WithTimeout(timeout time.Duration) *EmojiCategoriesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the emoji categories get params +func (o *EmojiCategoriesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the emoji categories get params +func (o *EmojiCategoriesGetParams) WithContext(ctx context.Context) *EmojiCategoriesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the emoji categories get params +func (o *EmojiCategoriesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the emoji categories get params +func (o *EmojiCategoriesGetParams) WithHTTPClient(client *http.Client) *EmojiCategoriesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the emoji categories get params +func (o *EmojiCategoriesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *EmojiCategoriesGetParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_categories_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_categories_get_responses.go new file mode 100644 index 0000000..55fde8e --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_categories_get_responses.go @@ -0,0 +1,476 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// EmojiCategoriesGetReader is a Reader for the EmojiCategoriesGet structure. +type EmojiCategoriesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *EmojiCategoriesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewEmojiCategoriesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewEmojiCategoriesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewEmojiCategoriesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewEmojiCategoriesGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewEmojiCategoriesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewEmojiCategoriesGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewEmojiCategoriesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/custom_emojis/categories] emojiCategoriesGet", response, response.Code()) + } +} + +// NewEmojiCategoriesGetOK creates a EmojiCategoriesGetOK with default headers values +func NewEmojiCategoriesGetOK() *EmojiCategoriesGetOK { + return &EmojiCategoriesGetOK{} +} + +/* +EmojiCategoriesGetOK describes a response with status code 200, with default header values. + +Array of existing emoji categories. +*/ +type EmojiCategoriesGetOK struct { + Payload []*models.EmojiCategory +} + +// IsSuccess returns true when this emoji categories get o k response has a 2xx status code +func (o *EmojiCategoriesGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this emoji categories get o k response has a 3xx status code +func (o *EmojiCategoriesGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji categories get o k response has a 4xx status code +func (o *EmojiCategoriesGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this emoji categories get o k response has a 5xx status code +func (o *EmojiCategoriesGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji categories get o k response a status code equal to that given +func (o *EmojiCategoriesGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the emoji categories get o k response +func (o *EmojiCategoriesGetOK) Code() int { + return 200 +} + +func (o *EmojiCategoriesGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetOK %s", 200, payload) +} + +func (o *EmojiCategoriesGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetOK %s", 200, payload) +} + +func (o *EmojiCategoriesGetOK) GetPayload() []*models.EmojiCategory { + return o.Payload +} + +func (o *EmojiCategoriesGetOK) 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 +} + +// NewEmojiCategoriesGetBadRequest creates a EmojiCategoriesGetBadRequest with default headers values +func NewEmojiCategoriesGetBadRequest() *EmojiCategoriesGetBadRequest { + return &EmojiCategoriesGetBadRequest{} +} + +/* +EmojiCategoriesGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type EmojiCategoriesGetBadRequest struct { +} + +// IsSuccess returns true when this emoji categories get bad request response has a 2xx status code +func (o *EmojiCategoriesGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji categories get bad request response has a 3xx status code +func (o *EmojiCategoriesGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji categories get bad request response has a 4xx status code +func (o *EmojiCategoriesGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji categories get bad request response has a 5xx status code +func (o *EmojiCategoriesGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji categories get bad request response a status code equal to that given +func (o *EmojiCategoriesGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the emoji categories get bad request response +func (o *EmojiCategoriesGetBadRequest) Code() int { + return 400 +} + +func (o *EmojiCategoriesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetBadRequest", 400) +} + +func (o *EmojiCategoriesGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetBadRequest", 400) +} + +func (o *EmojiCategoriesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCategoriesGetUnauthorized creates a EmojiCategoriesGetUnauthorized with default headers values +func NewEmojiCategoriesGetUnauthorized() *EmojiCategoriesGetUnauthorized { + return &EmojiCategoriesGetUnauthorized{} +} + +/* +EmojiCategoriesGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type EmojiCategoriesGetUnauthorized struct { +} + +// IsSuccess returns true when this emoji categories get unauthorized response has a 2xx status code +func (o *EmojiCategoriesGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji categories get unauthorized response has a 3xx status code +func (o *EmojiCategoriesGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji categories get unauthorized response has a 4xx status code +func (o *EmojiCategoriesGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji categories get unauthorized response has a 5xx status code +func (o *EmojiCategoriesGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji categories get unauthorized response a status code equal to that given +func (o *EmojiCategoriesGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the emoji categories get unauthorized response +func (o *EmojiCategoriesGetUnauthorized) Code() int { + return 401 +} + +func (o *EmojiCategoriesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetUnauthorized", 401) +} + +func (o *EmojiCategoriesGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetUnauthorized", 401) +} + +func (o *EmojiCategoriesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCategoriesGetForbidden creates a EmojiCategoriesGetForbidden with default headers values +func NewEmojiCategoriesGetForbidden() *EmojiCategoriesGetForbidden { + return &EmojiCategoriesGetForbidden{} +} + +/* +EmojiCategoriesGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type EmojiCategoriesGetForbidden struct { +} + +// IsSuccess returns true when this emoji categories get forbidden response has a 2xx status code +func (o *EmojiCategoriesGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji categories get forbidden response has a 3xx status code +func (o *EmojiCategoriesGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji categories get forbidden response has a 4xx status code +func (o *EmojiCategoriesGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji categories get forbidden response has a 5xx status code +func (o *EmojiCategoriesGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji categories get forbidden response a status code equal to that given +func (o *EmojiCategoriesGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the emoji categories get forbidden response +func (o *EmojiCategoriesGetForbidden) Code() int { + return 403 +} + +func (o *EmojiCategoriesGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetForbidden", 403) +} + +func (o *EmojiCategoriesGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetForbidden", 403) +} + +func (o *EmojiCategoriesGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCategoriesGetNotFound creates a EmojiCategoriesGetNotFound with default headers values +func NewEmojiCategoriesGetNotFound() *EmojiCategoriesGetNotFound { + return &EmojiCategoriesGetNotFound{} +} + +/* +EmojiCategoriesGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type EmojiCategoriesGetNotFound struct { +} + +// IsSuccess returns true when this emoji categories get not found response has a 2xx status code +func (o *EmojiCategoriesGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji categories get not found response has a 3xx status code +func (o *EmojiCategoriesGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji categories get not found response has a 4xx status code +func (o *EmojiCategoriesGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji categories get not found response has a 5xx status code +func (o *EmojiCategoriesGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji categories get not found response a status code equal to that given +func (o *EmojiCategoriesGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the emoji categories get not found response +func (o *EmojiCategoriesGetNotFound) Code() int { + return 404 +} + +func (o *EmojiCategoriesGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetNotFound", 404) +} + +func (o *EmojiCategoriesGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetNotFound", 404) +} + +func (o *EmojiCategoriesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCategoriesGetNotAcceptable creates a EmojiCategoriesGetNotAcceptable with default headers values +func NewEmojiCategoriesGetNotAcceptable() *EmojiCategoriesGetNotAcceptable { + return &EmojiCategoriesGetNotAcceptable{} +} + +/* +EmojiCategoriesGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type EmojiCategoriesGetNotAcceptable struct { +} + +// IsSuccess returns true when this emoji categories get not acceptable response has a 2xx status code +func (o *EmojiCategoriesGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji categories get not acceptable response has a 3xx status code +func (o *EmojiCategoriesGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji categories get not acceptable response has a 4xx status code +func (o *EmojiCategoriesGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji categories get not acceptable response has a 5xx status code +func (o *EmojiCategoriesGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji categories get not acceptable response a status code equal to that given +func (o *EmojiCategoriesGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the emoji categories get not acceptable response +func (o *EmojiCategoriesGetNotAcceptable) Code() int { + return 406 +} + +func (o *EmojiCategoriesGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetNotAcceptable", 406) +} + +func (o *EmojiCategoriesGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetNotAcceptable", 406) +} + +func (o *EmojiCategoriesGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCategoriesGetInternalServerError creates a EmojiCategoriesGetInternalServerError with default headers values +func NewEmojiCategoriesGetInternalServerError() *EmojiCategoriesGetInternalServerError { + return &EmojiCategoriesGetInternalServerError{} +} + +/* +EmojiCategoriesGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type EmojiCategoriesGetInternalServerError struct { +} + +// IsSuccess returns true when this emoji categories get internal server error response has a 2xx status code +func (o *EmojiCategoriesGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji categories get internal server error response has a 3xx status code +func (o *EmojiCategoriesGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji categories get internal server error response has a 4xx status code +func (o *EmojiCategoriesGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this emoji categories get internal server error response has a 5xx status code +func (o *EmojiCategoriesGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this emoji categories get internal server error response a status code equal to that given +func (o *EmojiCategoriesGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the emoji categories get internal server error response +func (o *EmojiCategoriesGetInternalServerError) Code() int { + return 500 +} + +func (o *EmojiCategoriesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetInternalServerError", 500) +} + +func (o *EmojiCategoriesGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetInternalServerError", 500) +} + +func (o *EmojiCategoriesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_create_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_create_parameters.go new file mode 100644 index 0000000..4cd0fc1 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_create_parameters.go @@ -0,0 +1,208 @@ +// 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" +) + +// NewEmojiCreateParams creates a new EmojiCreateParams 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 NewEmojiCreateParams() *EmojiCreateParams { + return &EmojiCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewEmojiCreateParamsWithTimeout creates a new EmojiCreateParams object +// with the ability to set a timeout on a request. +func NewEmojiCreateParamsWithTimeout(timeout time.Duration) *EmojiCreateParams { + return &EmojiCreateParams{ + timeout: timeout, + } +} + +// NewEmojiCreateParamsWithContext creates a new EmojiCreateParams object +// with the ability to set a context for a request. +func NewEmojiCreateParamsWithContext(ctx context.Context) *EmojiCreateParams { + return &EmojiCreateParams{ + Context: ctx, + } +} + +// NewEmojiCreateParamsWithHTTPClient creates a new EmojiCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewEmojiCreateParamsWithHTTPClient(client *http.Client) *EmojiCreateParams { + return &EmojiCreateParams{ + HTTPClient: client, + } +} + +/* +EmojiCreateParams contains all the parameters to send to the API endpoint + + for the emoji create operation. + + Typically these are written to a http.Request. +*/ +type EmojiCreateParams struct { + + /* Category. + + Category in which to place the new emoji. If left blank, emoji will be uncategorized. If a category with the given name doesn't exist yet, it will be created. + */ + Category *string + + /* Image. + + A png or gif image of the emoji. Animated pngs work too! To ensure compatibility with other fedi implementations, emoji size limit is 50kb by default. + */ + Image runtime.NamedReadCloser + + /* Shortcode. + + The code to use for the emoji, which will be used by instance denizens to select it. This must be unique on the instance. + */ + Shortcode string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the emoji create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojiCreateParams) WithDefaults() *EmojiCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the emoji create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojiCreateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the emoji create params +func (o *EmojiCreateParams) WithTimeout(timeout time.Duration) *EmojiCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the emoji create params +func (o *EmojiCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the emoji create params +func (o *EmojiCreateParams) WithContext(ctx context.Context) *EmojiCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the emoji create params +func (o *EmojiCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the emoji create params +func (o *EmojiCreateParams) WithHTTPClient(client *http.Client) *EmojiCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the emoji create params +func (o *EmojiCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCategory adds the category to the emoji create params +func (o *EmojiCreateParams) WithCategory(category *string) *EmojiCreateParams { + o.SetCategory(category) + return o +} + +// SetCategory adds the category to the emoji create params +func (o *EmojiCreateParams) SetCategory(category *string) { + o.Category = category +} + +// WithImage adds the image to the emoji create params +func (o *EmojiCreateParams) WithImage(image runtime.NamedReadCloser) *EmojiCreateParams { + o.SetImage(image) + return o +} + +// SetImage adds the image to the emoji create params +func (o *EmojiCreateParams) SetImage(image runtime.NamedReadCloser) { + o.Image = image +} + +// WithShortcode adds the shortcode to the emoji create params +func (o *EmojiCreateParams) WithShortcode(shortcode string) *EmojiCreateParams { + o.SetShortcode(shortcode) + return o +} + +// SetShortcode adds the shortcode to the emoji create params +func (o *EmojiCreateParams) SetShortcode(shortcode string) { + o.Shortcode = shortcode +} + +// WriteToRequest writes these params to a swagger request +func (o *EmojiCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Category != nil { + + // form param category + var frCategory string + if o.Category != nil { + frCategory = *o.Category + } + fCategory := frCategory + if fCategory != "" { + if err := r.SetFormParam("category", fCategory); err != nil { + return err + } + } + } + // form file param image + if err := r.SetFileParam("image", o.Image); err != nil { + return err + } + + // form param shortcode + frShortcode := o.Shortcode + fShortcode := frShortcode + if fShortcode != "" { + if err := r.SetFormParam("shortcode", fShortcode); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_create_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_create_responses.go new file mode 100644 index 0000000..e9336a1 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_create_responses.go @@ -0,0 +1,540 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// EmojiCreateReader is a Reader for the EmojiCreate structure. +type EmojiCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *EmojiCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewEmojiCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewEmojiCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewEmojiCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewEmojiCreateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewEmojiCreateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewEmojiCreateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewEmojiCreateConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewEmojiCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/custom_emojis] emojiCreate", response, response.Code()) + } +} + +// NewEmojiCreateOK creates a EmojiCreateOK with default headers values +func NewEmojiCreateOK() *EmojiCreateOK { + return &EmojiCreateOK{} +} + +/* +EmojiCreateOK describes a response with status code 200, with default header values. + +The newly-created emoji. +*/ +type EmojiCreateOK struct { + Payload *models.Emoji +} + +// IsSuccess returns true when this emoji create o k response has a 2xx status code +func (o *EmojiCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this emoji create o k response has a 3xx status code +func (o *EmojiCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji create o k response has a 4xx status code +func (o *EmojiCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this emoji create o k response has a 5xx status code +func (o *EmojiCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji create o k response a status code equal to that given +func (o *EmojiCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the emoji create o k response +func (o *EmojiCreateOK) Code() int { + return 200 +} + +func (o *EmojiCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateOK %s", 200, payload) +} + +func (o *EmojiCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateOK %s", 200, payload) +} + +func (o *EmojiCreateOK) GetPayload() *models.Emoji { + return o.Payload +} + +func (o *EmojiCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Emoji) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewEmojiCreateBadRequest creates a EmojiCreateBadRequest with default headers values +func NewEmojiCreateBadRequest() *EmojiCreateBadRequest { + return &EmojiCreateBadRequest{} +} + +/* +EmojiCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type EmojiCreateBadRequest struct { +} + +// IsSuccess returns true when this emoji create bad request response has a 2xx status code +func (o *EmojiCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji create bad request response has a 3xx status code +func (o *EmojiCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji create bad request response has a 4xx status code +func (o *EmojiCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji create bad request response has a 5xx status code +func (o *EmojiCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji create bad request response a status code equal to that given +func (o *EmojiCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the emoji create bad request response +func (o *EmojiCreateBadRequest) Code() int { + return 400 +} + +func (o *EmojiCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateBadRequest", 400) +} + +func (o *EmojiCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateBadRequest", 400) +} + +func (o *EmojiCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCreateUnauthorized creates a EmojiCreateUnauthorized with default headers values +func NewEmojiCreateUnauthorized() *EmojiCreateUnauthorized { + return &EmojiCreateUnauthorized{} +} + +/* +EmojiCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type EmojiCreateUnauthorized struct { +} + +// IsSuccess returns true when this emoji create unauthorized response has a 2xx status code +func (o *EmojiCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji create unauthorized response has a 3xx status code +func (o *EmojiCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji create unauthorized response has a 4xx status code +func (o *EmojiCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji create unauthorized response has a 5xx status code +func (o *EmojiCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji create unauthorized response a status code equal to that given +func (o *EmojiCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the emoji create unauthorized response +func (o *EmojiCreateUnauthorized) Code() int { + return 401 +} + +func (o *EmojiCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateUnauthorized", 401) +} + +func (o *EmojiCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateUnauthorized", 401) +} + +func (o *EmojiCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCreateForbidden creates a EmojiCreateForbidden with default headers values +func NewEmojiCreateForbidden() *EmojiCreateForbidden { + return &EmojiCreateForbidden{} +} + +/* +EmojiCreateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type EmojiCreateForbidden struct { +} + +// IsSuccess returns true when this emoji create forbidden response has a 2xx status code +func (o *EmojiCreateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji create forbidden response has a 3xx status code +func (o *EmojiCreateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji create forbidden response has a 4xx status code +func (o *EmojiCreateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji create forbidden response has a 5xx status code +func (o *EmojiCreateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji create forbidden response a status code equal to that given +func (o *EmojiCreateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the emoji create forbidden response +func (o *EmojiCreateForbidden) Code() int { + return 403 +} + +func (o *EmojiCreateForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateForbidden", 403) +} + +func (o *EmojiCreateForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateForbidden", 403) +} + +func (o *EmojiCreateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCreateNotFound creates a EmojiCreateNotFound with default headers values +func NewEmojiCreateNotFound() *EmojiCreateNotFound { + return &EmojiCreateNotFound{} +} + +/* +EmojiCreateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type EmojiCreateNotFound struct { +} + +// IsSuccess returns true when this emoji create not found response has a 2xx status code +func (o *EmojiCreateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji create not found response has a 3xx status code +func (o *EmojiCreateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji create not found response has a 4xx status code +func (o *EmojiCreateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji create not found response has a 5xx status code +func (o *EmojiCreateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji create not found response a status code equal to that given +func (o *EmojiCreateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the emoji create not found response +func (o *EmojiCreateNotFound) Code() int { + return 404 +} + +func (o *EmojiCreateNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateNotFound", 404) +} + +func (o *EmojiCreateNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateNotFound", 404) +} + +func (o *EmojiCreateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCreateNotAcceptable creates a EmojiCreateNotAcceptable with default headers values +func NewEmojiCreateNotAcceptable() *EmojiCreateNotAcceptable { + return &EmojiCreateNotAcceptable{} +} + +/* +EmojiCreateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type EmojiCreateNotAcceptable struct { +} + +// IsSuccess returns true when this emoji create not acceptable response has a 2xx status code +func (o *EmojiCreateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji create not acceptable response has a 3xx status code +func (o *EmojiCreateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji create not acceptable response has a 4xx status code +func (o *EmojiCreateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji create not acceptable response has a 5xx status code +func (o *EmojiCreateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji create not acceptable response a status code equal to that given +func (o *EmojiCreateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the emoji create not acceptable response +func (o *EmojiCreateNotAcceptable) Code() int { + return 406 +} + +func (o *EmojiCreateNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateNotAcceptable", 406) +} + +func (o *EmojiCreateNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateNotAcceptable", 406) +} + +func (o *EmojiCreateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCreateConflict creates a EmojiCreateConflict with default headers values +func NewEmojiCreateConflict() *EmojiCreateConflict { + return &EmojiCreateConflict{} +} + +/* +EmojiCreateConflict describes a response with status code 409, with default header values. + +conflict -- shortcode for this emoji is already in use +*/ +type EmojiCreateConflict struct { +} + +// IsSuccess returns true when this emoji create conflict response has a 2xx status code +func (o *EmojiCreateConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji create conflict response has a 3xx status code +func (o *EmojiCreateConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji create conflict response has a 4xx status code +func (o *EmojiCreateConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji create conflict response has a 5xx status code +func (o *EmojiCreateConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji create conflict response a status code equal to that given +func (o *EmojiCreateConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the emoji create conflict response +func (o *EmojiCreateConflict) Code() int { + return 409 +} + +func (o *EmojiCreateConflict) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateConflict", 409) +} + +func (o *EmojiCreateConflict) String() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateConflict", 409) +} + +func (o *EmojiCreateConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCreateInternalServerError creates a EmojiCreateInternalServerError with default headers values +func NewEmojiCreateInternalServerError() *EmojiCreateInternalServerError { + return &EmojiCreateInternalServerError{} +} + +/* +EmojiCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type EmojiCreateInternalServerError struct { +} + +// IsSuccess returns true when this emoji create internal server error response has a 2xx status code +func (o *EmojiCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji create internal server error response has a 3xx status code +func (o *EmojiCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji create internal server error response has a 4xx status code +func (o *EmojiCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this emoji create internal server error response has a 5xx status code +func (o *EmojiCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this emoji create internal server error response a status code equal to that given +func (o *EmojiCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the emoji create internal server error response +func (o *EmojiCreateInternalServerError) Code() int { + return 500 +} + +func (o *EmojiCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateInternalServerError", 500) +} + +func (o *EmojiCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateInternalServerError", 500) +} + +func (o *EmojiCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_delete_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_delete_parameters.go new file mode 100644 index 0000000..70c7c69 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_delete_parameters.go @@ -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" +) + +// NewEmojiDeleteParams creates a new EmojiDeleteParams 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 NewEmojiDeleteParams() *EmojiDeleteParams { + return &EmojiDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewEmojiDeleteParamsWithTimeout creates a new EmojiDeleteParams object +// with the ability to set a timeout on a request. +func NewEmojiDeleteParamsWithTimeout(timeout time.Duration) *EmojiDeleteParams { + return &EmojiDeleteParams{ + timeout: timeout, + } +} + +// NewEmojiDeleteParamsWithContext creates a new EmojiDeleteParams object +// with the ability to set a context for a request. +func NewEmojiDeleteParamsWithContext(ctx context.Context) *EmojiDeleteParams { + return &EmojiDeleteParams{ + Context: ctx, + } +} + +// NewEmojiDeleteParamsWithHTTPClient creates a new EmojiDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewEmojiDeleteParamsWithHTTPClient(client *http.Client) *EmojiDeleteParams { + return &EmojiDeleteParams{ + HTTPClient: client, + } +} + +/* +EmojiDeleteParams contains all the parameters to send to the API endpoint + + for the emoji delete operation. + + Typically these are written to a http.Request. +*/ +type EmojiDeleteParams struct { + + /* ID. + + The id of the emoji. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the emoji delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojiDeleteParams) WithDefaults() *EmojiDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the emoji delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojiDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the emoji delete params +func (o *EmojiDeleteParams) WithTimeout(timeout time.Duration) *EmojiDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the emoji delete params +func (o *EmojiDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the emoji delete params +func (o *EmojiDeleteParams) WithContext(ctx context.Context) *EmojiDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the emoji delete params +func (o *EmojiDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the emoji delete params +func (o *EmojiDeleteParams) WithHTTPClient(client *http.Client) *EmojiDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the emoji delete params +func (o *EmojiDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the emoji delete params +func (o *EmojiDeleteParams) WithID(id string) *EmojiDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the emoji delete params +func (o *EmojiDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *EmojiDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_delete_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_delete_responses.go new file mode 100644 index 0000000..52eb4bc --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_delete_responses.go @@ -0,0 +1,478 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// EmojiDeleteReader is a Reader for the EmojiDelete structure. +type EmojiDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *EmojiDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewEmojiDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewEmojiDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewEmojiDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewEmojiDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewEmojiDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewEmojiDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewEmojiDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/admin/custom_emojis/{id}] emojiDelete", response, response.Code()) + } +} + +// NewEmojiDeleteOK creates a EmojiDeleteOK with default headers values +func NewEmojiDeleteOK() *EmojiDeleteOK { + return &EmojiDeleteOK{} +} + +/* +EmojiDeleteOK describes a response with status code 200, with default header values. + +The deleted emoji will be returned to the caller in case further processing is necessary. +*/ +type EmojiDeleteOK struct { + Payload *models.AdminEmoji +} + +// IsSuccess returns true when this emoji delete o k response has a 2xx status code +func (o *EmojiDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this emoji delete o k response has a 3xx status code +func (o *EmojiDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji delete o k response has a 4xx status code +func (o *EmojiDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this emoji delete o k response has a 5xx status code +func (o *EmojiDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji delete o k response a status code equal to that given +func (o *EmojiDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the emoji delete o k response +func (o *EmojiDeleteOK) Code() int { + return 200 +} + +func (o *EmojiDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteOK %s", 200, payload) +} + +func (o *EmojiDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteOK %s", 200, payload) +} + +func (o *EmojiDeleteOK) GetPayload() *models.AdminEmoji { + return o.Payload +} + +func (o *EmojiDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AdminEmoji) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewEmojiDeleteBadRequest creates a EmojiDeleteBadRequest with default headers values +func NewEmojiDeleteBadRequest() *EmojiDeleteBadRequest { + return &EmojiDeleteBadRequest{} +} + +/* +EmojiDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type EmojiDeleteBadRequest struct { +} + +// IsSuccess returns true when this emoji delete bad request response has a 2xx status code +func (o *EmojiDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji delete bad request response has a 3xx status code +func (o *EmojiDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji delete bad request response has a 4xx status code +func (o *EmojiDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji delete bad request response has a 5xx status code +func (o *EmojiDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji delete bad request response a status code equal to that given +func (o *EmojiDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the emoji delete bad request response +func (o *EmojiDeleteBadRequest) Code() int { + return 400 +} + +func (o *EmojiDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteBadRequest", 400) +} + +func (o *EmojiDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteBadRequest", 400) +} + +func (o *EmojiDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiDeleteUnauthorized creates a EmojiDeleteUnauthorized with default headers values +func NewEmojiDeleteUnauthorized() *EmojiDeleteUnauthorized { + return &EmojiDeleteUnauthorized{} +} + +/* +EmojiDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type EmojiDeleteUnauthorized struct { +} + +// IsSuccess returns true when this emoji delete unauthorized response has a 2xx status code +func (o *EmojiDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji delete unauthorized response has a 3xx status code +func (o *EmojiDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji delete unauthorized response has a 4xx status code +func (o *EmojiDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji delete unauthorized response has a 5xx status code +func (o *EmojiDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji delete unauthorized response a status code equal to that given +func (o *EmojiDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the emoji delete unauthorized response +func (o *EmojiDeleteUnauthorized) Code() int { + return 401 +} + +func (o *EmojiDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteUnauthorized", 401) +} + +func (o *EmojiDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteUnauthorized", 401) +} + +func (o *EmojiDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiDeleteForbidden creates a EmojiDeleteForbidden with default headers values +func NewEmojiDeleteForbidden() *EmojiDeleteForbidden { + return &EmojiDeleteForbidden{} +} + +/* +EmojiDeleteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type EmojiDeleteForbidden struct { +} + +// IsSuccess returns true when this emoji delete forbidden response has a 2xx status code +func (o *EmojiDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji delete forbidden response has a 3xx status code +func (o *EmojiDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji delete forbidden response has a 4xx status code +func (o *EmojiDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji delete forbidden response has a 5xx status code +func (o *EmojiDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji delete forbidden response a status code equal to that given +func (o *EmojiDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the emoji delete forbidden response +func (o *EmojiDeleteForbidden) Code() int { + return 403 +} + +func (o *EmojiDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteForbidden", 403) +} + +func (o *EmojiDeleteForbidden) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteForbidden", 403) +} + +func (o *EmojiDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiDeleteNotFound creates a EmojiDeleteNotFound with default headers values +func NewEmojiDeleteNotFound() *EmojiDeleteNotFound { + return &EmojiDeleteNotFound{} +} + +/* +EmojiDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type EmojiDeleteNotFound struct { +} + +// IsSuccess returns true when this emoji delete not found response has a 2xx status code +func (o *EmojiDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji delete not found response has a 3xx status code +func (o *EmojiDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji delete not found response has a 4xx status code +func (o *EmojiDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji delete not found response has a 5xx status code +func (o *EmojiDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji delete not found response a status code equal to that given +func (o *EmojiDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the emoji delete not found response +func (o *EmojiDeleteNotFound) Code() int { + return 404 +} + +func (o *EmojiDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteNotFound", 404) +} + +func (o *EmojiDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteNotFound", 404) +} + +func (o *EmojiDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiDeleteNotAcceptable creates a EmojiDeleteNotAcceptable with default headers values +func NewEmojiDeleteNotAcceptable() *EmojiDeleteNotAcceptable { + return &EmojiDeleteNotAcceptable{} +} + +/* +EmojiDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type EmojiDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this emoji delete not acceptable response has a 2xx status code +func (o *EmojiDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji delete not acceptable response has a 3xx status code +func (o *EmojiDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji delete not acceptable response has a 4xx status code +func (o *EmojiDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji delete not acceptable response has a 5xx status code +func (o *EmojiDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji delete not acceptable response a status code equal to that given +func (o *EmojiDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the emoji delete not acceptable response +func (o *EmojiDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *EmojiDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteNotAcceptable", 406) +} + +func (o *EmojiDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteNotAcceptable", 406) +} + +func (o *EmojiDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiDeleteInternalServerError creates a EmojiDeleteInternalServerError with default headers values +func NewEmojiDeleteInternalServerError() *EmojiDeleteInternalServerError { + return &EmojiDeleteInternalServerError{} +} + +/* +EmojiDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type EmojiDeleteInternalServerError struct { +} + +// IsSuccess returns true when this emoji delete internal server error response has a 2xx status code +func (o *EmojiDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji delete internal server error response has a 3xx status code +func (o *EmojiDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji delete internal server error response has a 4xx status code +func (o *EmojiDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this emoji delete internal server error response has a 5xx status code +func (o *EmojiDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this emoji delete internal server error response a status code equal to that given +func (o *EmojiDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the emoji delete internal server error response +func (o *EmojiDeleteInternalServerError) Code() int { + return 500 +} + +func (o *EmojiDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteInternalServerError", 500) +} + +func (o *EmojiDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteInternalServerError", 500) +} + +func (o *EmojiDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_get_parameters.go new file mode 100644 index 0000000..033573a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_get_parameters.go @@ -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" +) + +// NewEmojiGetParams creates a new EmojiGetParams 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 NewEmojiGetParams() *EmojiGetParams { + return &EmojiGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewEmojiGetParamsWithTimeout creates a new EmojiGetParams object +// with the ability to set a timeout on a request. +func NewEmojiGetParamsWithTimeout(timeout time.Duration) *EmojiGetParams { + return &EmojiGetParams{ + timeout: timeout, + } +} + +// NewEmojiGetParamsWithContext creates a new EmojiGetParams object +// with the ability to set a context for a request. +func NewEmojiGetParamsWithContext(ctx context.Context) *EmojiGetParams { + return &EmojiGetParams{ + Context: ctx, + } +} + +// NewEmojiGetParamsWithHTTPClient creates a new EmojiGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewEmojiGetParamsWithHTTPClient(client *http.Client) *EmojiGetParams { + return &EmojiGetParams{ + HTTPClient: client, + } +} + +/* +EmojiGetParams contains all the parameters to send to the API endpoint + + for the emoji get operation. + + Typically these are written to a http.Request. +*/ +type EmojiGetParams struct { + + /* ID. + + The id of the emoji. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the emoji get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojiGetParams) WithDefaults() *EmojiGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the emoji get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojiGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the emoji get params +func (o *EmojiGetParams) WithTimeout(timeout time.Duration) *EmojiGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the emoji get params +func (o *EmojiGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the emoji get params +func (o *EmojiGetParams) WithContext(ctx context.Context) *EmojiGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the emoji get params +func (o *EmojiGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the emoji get params +func (o *EmojiGetParams) WithHTTPClient(client *http.Client) *EmojiGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the emoji get params +func (o *EmojiGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the emoji get params +func (o *EmojiGetParams) WithID(id string) *EmojiGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the emoji get params +func (o *EmojiGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *EmojiGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_get_responses.go new file mode 100644 index 0000000..3f0693c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_get_responses.go @@ -0,0 +1,478 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// EmojiGetReader is a Reader for the EmojiGet structure. +type EmojiGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *EmojiGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewEmojiGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewEmojiGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewEmojiGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewEmojiGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewEmojiGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewEmojiGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewEmojiGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/custom_emojis/{id}] emojiGet", response, response.Code()) + } +} + +// NewEmojiGetOK creates a EmojiGetOK with default headers values +func NewEmojiGetOK() *EmojiGetOK { + return &EmojiGetOK{} +} + +/* +EmojiGetOK describes a response with status code 200, with default header values. + +A single emoji. +*/ +type EmojiGetOK struct { + Payload *models.AdminEmoji +} + +// IsSuccess returns true when this emoji get o k response has a 2xx status code +func (o *EmojiGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this emoji get o k response has a 3xx status code +func (o *EmojiGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji get o k response has a 4xx status code +func (o *EmojiGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this emoji get o k response has a 5xx status code +func (o *EmojiGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji get o k response a status code equal to that given +func (o *EmojiGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the emoji get o k response +func (o *EmojiGetOK) Code() int { + return 200 +} + +func (o *EmojiGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetOK %s", 200, payload) +} + +func (o *EmojiGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetOK %s", 200, payload) +} + +func (o *EmojiGetOK) GetPayload() *models.AdminEmoji { + return o.Payload +} + +func (o *EmojiGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AdminEmoji) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewEmojiGetBadRequest creates a EmojiGetBadRequest with default headers values +func NewEmojiGetBadRequest() *EmojiGetBadRequest { + return &EmojiGetBadRequest{} +} + +/* +EmojiGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type EmojiGetBadRequest struct { +} + +// IsSuccess returns true when this emoji get bad request response has a 2xx status code +func (o *EmojiGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji get bad request response has a 3xx status code +func (o *EmojiGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji get bad request response has a 4xx status code +func (o *EmojiGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji get bad request response has a 5xx status code +func (o *EmojiGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji get bad request response a status code equal to that given +func (o *EmojiGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the emoji get bad request response +func (o *EmojiGetBadRequest) Code() int { + return 400 +} + +func (o *EmojiGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetBadRequest", 400) +} + +func (o *EmojiGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetBadRequest", 400) +} + +func (o *EmojiGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiGetUnauthorized creates a EmojiGetUnauthorized with default headers values +func NewEmojiGetUnauthorized() *EmojiGetUnauthorized { + return &EmojiGetUnauthorized{} +} + +/* +EmojiGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type EmojiGetUnauthorized struct { +} + +// IsSuccess returns true when this emoji get unauthorized response has a 2xx status code +func (o *EmojiGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji get unauthorized response has a 3xx status code +func (o *EmojiGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji get unauthorized response has a 4xx status code +func (o *EmojiGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji get unauthorized response has a 5xx status code +func (o *EmojiGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji get unauthorized response a status code equal to that given +func (o *EmojiGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the emoji get unauthorized response +func (o *EmojiGetUnauthorized) Code() int { + return 401 +} + +func (o *EmojiGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetUnauthorized", 401) +} + +func (o *EmojiGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetUnauthorized", 401) +} + +func (o *EmojiGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiGetForbidden creates a EmojiGetForbidden with default headers values +func NewEmojiGetForbidden() *EmojiGetForbidden { + return &EmojiGetForbidden{} +} + +/* +EmojiGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type EmojiGetForbidden struct { +} + +// IsSuccess returns true when this emoji get forbidden response has a 2xx status code +func (o *EmojiGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji get forbidden response has a 3xx status code +func (o *EmojiGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji get forbidden response has a 4xx status code +func (o *EmojiGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji get forbidden response has a 5xx status code +func (o *EmojiGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji get forbidden response a status code equal to that given +func (o *EmojiGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the emoji get forbidden response +func (o *EmojiGetForbidden) Code() int { + return 403 +} + +func (o *EmojiGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetForbidden", 403) +} + +func (o *EmojiGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetForbidden", 403) +} + +func (o *EmojiGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiGetNotFound creates a EmojiGetNotFound with default headers values +func NewEmojiGetNotFound() *EmojiGetNotFound { + return &EmojiGetNotFound{} +} + +/* +EmojiGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type EmojiGetNotFound struct { +} + +// IsSuccess returns true when this emoji get not found response has a 2xx status code +func (o *EmojiGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji get not found response has a 3xx status code +func (o *EmojiGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji get not found response has a 4xx status code +func (o *EmojiGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji get not found response has a 5xx status code +func (o *EmojiGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji get not found response a status code equal to that given +func (o *EmojiGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the emoji get not found response +func (o *EmojiGetNotFound) Code() int { + return 404 +} + +func (o *EmojiGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetNotFound", 404) +} + +func (o *EmojiGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetNotFound", 404) +} + +func (o *EmojiGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiGetNotAcceptable creates a EmojiGetNotAcceptable with default headers values +func NewEmojiGetNotAcceptable() *EmojiGetNotAcceptable { + return &EmojiGetNotAcceptable{} +} + +/* +EmojiGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type EmojiGetNotAcceptable struct { +} + +// IsSuccess returns true when this emoji get not acceptable response has a 2xx status code +func (o *EmojiGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji get not acceptable response has a 3xx status code +func (o *EmojiGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji get not acceptable response has a 4xx status code +func (o *EmojiGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji get not acceptable response has a 5xx status code +func (o *EmojiGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji get not acceptable response a status code equal to that given +func (o *EmojiGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the emoji get not acceptable response +func (o *EmojiGetNotAcceptable) Code() int { + return 406 +} + +func (o *EmojiGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetNotAcceptable", 406) +} + +func (o *EmojiGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetNotAcceptable", 406) +} + +func (o *EmojiGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiGetInternalServerError creates a EmojiGetInternalServerError with default headers values +func NewEmojiGetInternalServerError() *EmojiGetInternalServerError { + return &EmojiGetInternalServerError{} +} + +/* +EmojiGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type EmojiGetInternalServerError struct { +} + +// IsSuccess returns true when this emoji get internal server error response has a 2xx status code +func (o *EmojiGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji get internal server error response has a 3xx status code +func (o *EmojiGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji get internal server error response has a 4xx status code +func (o *EmojiGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this emoji get internal server error response has a 5xx status code +func (o *EmojiGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this emoji get internal server error response a status code equal to that given +func (o *EmojiGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the emoji get internal server error response +func (o *EmojiGetInternalServerError) Code() int { + return 500 +} + +func (o *EmojiGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetInternalServerError", 500) +} + +func (o *EmojiGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetInternalServerError", 500) +} + +func (o *EmojiGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_update_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_update_parameters.go new file mode 100644 index 0000000..2bf0bd3 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_update_parameters.go @@ -0,0 +1,270 @@ +// 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" +) + +// NewEmojiUpdateParams creates a new EmojiUpdateParams 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 NewEmojiUpdateParams() *EmojiUpdateParams { + return &EmojiUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewEmojiUpdateParamsWithTimeout creates a new EmojiUpdateParams object +// with the ability to set a timeout on a request. +func NewEmojiUpdateParamsWithTimeout(timeout time.Duration) *EmojiUpdateParams { + return &EmojiUpdateParams{ + timeout: timeout, + } +} + +// NewEmojiUpdateParamsWithContext creates a new EmojiUpdateParams object +// with the ability to set a context for a request. +func NewEmojiUpdateParamsWithContext(ctx context.Context) *EmojiUpdateParams { + return &EmojiUpdateParams{ + Context: ctx, + } +} + +// NewEmojiUpdateParamsWithHTTPClient creates a new EmojiUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewEmojiUpdateParamsWithHTTPClient(client *http.Client) *EmojiUpdateParams { + return &EmojiUpdateParams{ + HTTPClient: client, + } +} + +/* +EmojiUpdateParams contains all the parameters to send to the API endpoint + + for the emoji update operation. + + Typically these are written to a http.Request. +*/ +type EmojiUpdateParams struct { + + /* Category. + + Category in which to place the emoji. If a category with the given name doesn't exist yet, it will be created. + */ + Category *string + + /* ID. + + The id of the emoji. + */ + ID string + + /* Image. + + A new png or gif image to use for the emoji. Animated pngs work too! To ensure compatibility with other fedi implementations, emoji size limit is 50kb by default. Works for LOCAL emojis only. + */ + Image runtime.NamedReadCloser + + /* Shortcode. + + The code to use for the emoji, which will be used by instance denizens to select it. This must be unique on the instance. Works for the `copy` action type only. + */ + Shortcode *string + + /* Type. + + Type of action to be taken. One of: (`disable`, `copy`, `modify`). + For REMOTE emojis, `copy` or `disable` are supported. + For LOCAL emojis, only `modify` is supported. + */ + Type string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the emoji update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojiUpdateParams) WithDefaults() *EmojiUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the emoji update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojiUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the emoji update params +func (o *EmojiUpdateParams) WithTimeout(timeout time.Duration) *EmojiUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the emoji update params +func (o *EmojiUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the emoji update params +func (o *EmojiUpdateParams) WithContext(ctx context.Context) *EmojiUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the emoji update params +func (o *EmojiUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the emoji update params +func (o *EmojiUpdateParams) WithHTTPClient(client *http.Client) *EmojiUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the emoji update params +func (o *EmojiUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCategory adds the category to the emoji update params +func (o *EmojiUpdateParams) WithCategory(category *string) *EmojiUpdateParams { + o.SetCategory(category) + return o +} + +// SetCategory adds the category to the emoji update params +func (o *EmojiUpdateParams) SetCategory(category *string) { + o.Category = category +} + +// WithID adds the id to the emoji update params +func (o *EmojiUpdateParams) WithID(id string) *EmojiUpdateParams { + o.SetID(id) + return o +} + +// SetID adds the id to the emoji update params +func (o *EmojiUpdateParams) SetID(id string) { + o.ID = id +} + +// WithImage adds the image to the emoji update params +func (o *EmojiUpdateParams) WithImage(image runtime.NamedReadCloser) *EmojiUpdateParams { + o.SetImage(image) + return o +} + +// SetImage adds the image to the emoji update params +func (o *EmojiUpdateParams) SetImage(image runtime.NamedReadCloser) { + o.Image = image +} + +// WithShortcode adds the shortcode to the emoji update params +func (o *EmojiUpdateParams) WithShortcode(shortcode *string) *EmojiUpdateParams { + o.SetShortcode(shortcode) + return o +} + +// SetShortcode adds the shortcode to the emoji update params +func (o *EmojiUpdateParams) SetShortcode(shortcode *string) { + o.Shortcode = shortcode +} + +// WithType adds the typeVar to the emoji update params +func (o *EmojiUpdateParams) WithType(typeVar string) *EmojiUpdateParams { + o.SetType(typeVar) + return o +} + +// SetType adds the type to the emoji update params +func (o *EmojiUpdateParams) SetType(typeVar string) { + o.Type = typeVar +} + +// WriteToRequest writes these params to a swagger request +func (o *EmojiUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Category != nil { + + // form param category + var frCategory string + if o.Category != nil { + frCategory = *o.Category + } + fCategory := frCategory + if fCategory != "" { + if err := r.SetFormParam("category", fCategory); err != nil { + return err + } + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Image != nil { + + if o.Image != nil { + // form file param image + if err := r.SetFileParam("image", o.Image); err != nil { + return err + } + } + } + + if o.Shortcode != nil { + + // form param shortcode + var frShortcode string + if o.Shortcode != nil { + frShortcode = *o.Shortcode + } + fShortcode := frShortcode + if fShortcode != "" { + if err := r.SetFormParam("shortcode", fShortcode); err != nil { + return err + } + } + } + + // form param type + frType := o.Type + fType := frType + if fType != "" { + if err := r.SetFormParam("type", fType); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_update_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_update_responses.go new file mode 100644 index 0000000..e41639f --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emoji_update_responses.go @@ -0,0 +1,478 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// EmojiUpdateReader is a Reader for the EmojiUpdate structure. +type EmojiUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *EmojiUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewEmojiUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewEmojiUpdateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewEmojiUpdateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewEmojiUpdateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewEmojiUpdateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewEmojiUpdateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewEmojiUpdateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PATCH /api/v1/admin/custom_emojis/{id}] emojiUpdate", response, response.Code()) + } +} + +// NewEmojiUpdateOK creates a EmojiUpdateOK with default headers values +func NewEmojiUpdateOK() *EmojiUpdateOK { + return &EmojiUpdateOK{} +} + +/* +EmojiUpdateOK describes a response with status code 200, with default header values. + +The updated emoji. +*/ +type EmojiUpdateOK struct { + Payload *models.AdminEmoji +} + +// IsSuccess returns true when this emoji update o k response has a 2xx status code +func (o *EmojiUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this emoji update o k response has a 3xx status code +func (o *EmojiUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji update o k response has a 4xx status code +func (o *EmojiUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this emoji update o k response has a 5xx status code +func (o *EmojiUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji update o k response a status code equal to that given +func (o *EmojiUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the emoji update o k response +func (o *EmojiUpdateOK) Code() int { + return 200 +} + +func (o *EmojiUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateOK %s", 200, payload) +} + +func (o *EmojiUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateOK %s", 200, payload) +} + +func (o *EmojiUpdateOK) GetPayload() *models.AdminEmoji { + return o.Payload +} + +func (o *EmojiUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AdminEmoji) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewEmojiUpdateBadRequest creates a EmojiUpdateBadRequest with default headers values +func NewEmojiUpdateBadRequest() *EmojiUpdateBadRequest { + return &EmojiUpdateBadRequest{} +} + +/* +EmojiUpdateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type EmojiUpdateBadRequest struct { +} + +// IsSuccess returns true when this emoji update bad request response has a 2xx status code +func (o *EmojiUpdateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji update bad request response has a 3xx status code +func (o *EmojiUpdateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji update bad request response has a 4xx status code +func (o *EmojiUpdateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji update bad request response has a 5xx status code +func (o *EmojiUpdateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji update bad request response a status code equal to that given +func (o *EmojiUpdateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the emoji update bad request response +func (o *EmojiUpdateBadRequest) Code() int { + return 400 +} + +func (o *EmojiUpdateBadRequest) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateBadRequest", 400) +} + +func (o *EmojiUpdateBadRequest) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateBadRequest", 400) +} + +func (o *EmojiUpdateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiUpdateUnauthorized creates a EmojiUpdateUnauthorized with default headers values +func NewEmojiUpdateUnauthorized() *EmojiUpdateUnauthorized { + return &EmojiUpdateUnauthorized{} +} + +/* +EmojiUpdateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type EmojiUpdateUnauthorized struct { +} + +// IsSuccess returns true when this emoji update unauthorized response has a 2xx status code +func (o *EmojiUpdateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji update unauthorized response has a 3xx status code +func (o *EmojiUpdateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji update unauthorized response has a 4xx status code +func (o *EmojiUpdateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji update unauthorized response has a 5xx status code +func (o *EmojiUpdateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji update unauthorized response a status code equal to that given +func (o *EmojiUpdateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the emoji update unauthorized response +func (o *EmojiUpdateUnauthorized) Code() int { + return 401 +} + +func (o *EmojiUpdateUnauthorized) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateUnauthorized", 401) +} + +func (o *EmojiUpdateUnauthorized) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateUnauthorized", 401) +} + +func (o *EmojiUpdateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiUpdateForbidden creates a EmojiUpdateForbidden with default headers values +func NewEmojiUpdateForbidden() *EmojiUpdateForbidden { + return &EmojiUpdateForbidden{} +} + +/* +EmojiUpdateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type EmojiUpdateForbidden struct { +} + +// IsSuccess returns true when this emoji update forbidden response has a 2xx status code +func (o *EmojiUpdateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji update forbidden response has a 3xx status code +func (o *EmojiUpdateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji update forbidden response has a 4xx status code +func (o *EmojiUpdateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji update forbidden response has a 5xx status code +func (o *EmojiUpdateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji update forbidden response a status code equal to that given +func (o *EmojiUpdateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the emoji update forbidden response +func (o *EmojiUpdateForbidden) Code() int { + return 403 +} + +func (o *EmojiUpdateForbidden) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateForbidden", 403) +} + +func (o *EmojiUpdateForbidden) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateForbidden", 403) +} + +func (o *EmojiUpdateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiUpdateNotFound creates a EmojiUpdateNotFound with default headers values +func NewEmojiUpdateNotFound() *EmojiUpdateNotFound { + return &EmojiUpdateNotFound{} +} + +/* +EmojiUpdateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type EmojiUpdateNotFound struct { +} + +// IsSuccess returns true when this emoji update not found response has a 2xx status code +func (o *EmojiUpdateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji update not found response has a 3xx status code +func (o *EmojiUpdateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji update not found response has a 4xx status code +func (o *EmojiUpdateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji update not found response has a 5xx status code +func (o *EmojiUpdateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji update not found response a status code equal to that given +func (o *EmojiUpdateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the emoji update not found response +func (o *EmojiUpdateNotFound) Code() int { + return 404 +} + +func (o *EmojiUpdateNotFound) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateNotFound", 404) +} + +func (o *EmojiUpdateNotFound) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateNotFound", 404) +} + +func (o *EmojiUpdateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiUpdateNotAcceptable creates a EmojiUpdateNotAcceptable with default headers values +func NewEmojiUpdateNotAcceptable() *EmojiUpdateNotAcceptable { + return &EmojiUpdateNotAcceptable{} +} + +/* +EmojiUpdateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type EmojiUpdateNotAcceptable struct { +} + +// IsSuccess returns true when this emoji update not acceptable response has a 2xx status code +func (o *EmojiUpdateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji update not acceptable response has a 3xx status code +func (o *EmojiUpdateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji update not acceptable response has a 4xx status code +func (o *EmojiUpdateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji update not acceptable response has a 5xx status code +func (o *EmojiUpdateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji update not acceptable response a status code equal to that given +func (o *EmojiUpdateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the emoji update not acceptable response +func (o *EmojiUpdateNotAcceptable) Code() int { + return 406 +} + +func (o *EmojiUpdateNotAcceptable) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateNotAcceptable", 406) +} + +func (o *EmojiUpdateNotAcceptable) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateNotAcceptable", 406) +} + +func (o *EmojiUpdateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiUpdateInternalServerError creates a EmojiUpdateInternalServerError with default headers values +func NewEmojiUpdateInternalServerError() *EmojiUpdateInternalServerError { + return &EmojiUpdateInternalServerError{} +} + +/* +EmojiUpdateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type EmojiUpdateInternalServerError struct { +} + +// IsSuccess returns true when this emoji update internal server error response has a 2xx status code +func (o *EmojiUpdateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji update internal server error response has a 3xx status code +func (o *EmojiUpdateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji update internal server error response has a 4xx status code +func (o *EmojiUpdateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this emoji update internal server error response has a 5xx status code +func (o *EmojiUpdateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this emoji update internal server error response a status code equal to that given +func (o *EmojiUpdateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the emoji update internal server error response +func (o *EmojiUpdateInternalServerError) Code() int { + return 500 +} + +func (o *EmojiUpdateInternalServerError) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateInternalServerError", 500) +} + +func (o *EmojiUpdateInternalServerError) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateInternalServerError", 500) +} + +func (o *EmojiUpdateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emojis_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emojis_get_parameters.go new file mode 100644 index 0000000..f383367 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emojis_get_parameters.go @@ -0,0 +1,301 @@ +// 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" +) + +// NewEmojisGetParams creates a new EmojisGetParams 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 NewEmojisGetParams() *EmojisGetParams { + return &EmojisGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewEmojisGetParamsWithTimeout creates a new EmojisGetParams object +// with the ability to set a timeout on a request. +func NewEmojisGetParamsWithTimeout(timeout time.Duration) *EmojisGetParams { + return &EmojisGetParams{ + timeout: timeout, + } +} + +// NewEmojisGetParamsWithContext creates a new EmojisGetParams object +// with the ability to set a context for a request. +func NewEmojisGetParamsWithContext(ctx context.Context) *EmojisGetParams { + return &EmojisGetParams{ + Context: ctx, + } +} + +// NewEmojisGetParamsWithHTTPClient creates a new EmojisGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewEmojisGetParamsWithHTTPClient(client *http.Client) *EmojisGetParams { + return &EmojisGetParams{ + HTTPClient: client, + } +} + +/* +EmojisGetParams contains all the parameters to send to the API endpoint + + for the emojis get operation. + + Typically these are written to a http.Request. +*/ +type EmojisGetParams struct { + + /* Filter. + + Comma-separated list of filters to apply to results. Recognized filters are: + + `domain:[domain]` -- show emojis from the given domain, eg `?filter=domain:example.org` will show emojis from `example.org` only. + Instead of giving a specific domain, you can also give either one of the key words `local` or `all` to show either local emojis only (`domain:local`) or show all emojis from all domains (`domain:all`). + Note: `domain:*` is equivalent to `domain:all` (including local). + If no domain filter is provided, `domain:all` will be assumed. + + `disabled` -- include emojis that have been disabled. + + `enabled` -- include emojis that are enabled. + + `shortcode:[shortcode]` -- show only emojis with the given shortcode, eg `?filter=shortcode:blob_cat_uwu` will show only emojis with the shortcode `blob_cat_uwu` (case sensitive). + + If neither `disabled` or `enabled` are provided, both disabled and enabled emojis will be shown. + + If no filter query string is provided, the default `domain:all` will be used, which will show all emojis from all domains. + + Default: "domain:all" + */ + Filter *string + + /* Limit. + + Number of emojis to return. Less than 1, or not set, means unlimited (all emojis). + + Default: 50 + */ + Limit *int64 + + /* MaxShortcodeDomain. + + Return only emojis with `[shortcode]@[domain]` *LOWER* (alphabetically) than given `[shortcode]@[domain]`. For example, if `max_shortcode_domain=beep@example.org`, then returned values might include emojis with `[shortcode]@[domain]`s like `car@example.org`, `debian@aaa.com`, `test@` (local emoji), etc. + Emoji with the given `[shortcode]@[domain]` will not be included in the result set. + */ + MaxShortcodeDomain *string + + /* MinShortcodeDomain. + + Return only emojis with `[shortcode]@[domain]` *HIGHER* (alphabetically) than given `[shortcode]@[domain]`. For example, if `max_shortcode_domain=beep@example.org`, then returned values might include emojis with `[shortcode]@[domain]`s like `arse@test.com`, `0101_binary@hackers.net`, `bee@` (local emoji), etc. + Emoji with the given `[shortcode]@[domain]` will not be included in the result set. + */ + MinShortcodeDomain *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the emojis get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojisGetParams) WithDefaults() *EmojisGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the emojis get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojisGetParams) SetDefaults() { + var ( + filterDefault = string("domain:all") + + limitDefault = int64(50) + ) + + val := EmojisGetParams{ + Filter: &filterDefault, + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the emojis get params +func (o *EmojisGetParams) WithTimeout(timeout time.Duration) *EmojisGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the emojis get params +func (o *EmojisGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the emojis get params +func (o *EmojisGetParams) WithContext(ctx context.Context) *EmojisGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the emojis get params +func (o *EmojisGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the emojis get params +func (o *EmojisGetParams) WithHTTPClient(client *http.Client) *EmojisGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the emojis get params +func (o *EmojisGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithFilter adds the filter to the emojis get params +func (o *EmojisGetParams) WithFilter(filter *string) *EmojisGetParams { + o.SetFilter(filter) + return o +} + +// SetFilter adds the filter to the emojis get params +func (o *EmojisGetParams) SetFilter(filter *string) { + o.Filter = filter +} + +// WithLimit adds the limit to the emojis get params +func (o *EmojisGetParams) WithLimit(limit *int64) *EmojisGetParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the emojis get params +func (o *EmojisGetParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxShortcodeDomain adds the maxShortcodeDomain to the emojis get params +func (o *EmojisGetParams) WithMaxShortcodeDomain(maxShortcodeDomain *string) *EmojisGetParams { + o.SetMaxShortcodeDomain(maxShortcodeDomain) + return o +} + +// SetMaxShortcodeDomain adds the maxShortcodeDomain to the emojis get params +func (o *EmojisGetParams) SetMaxShortcodeDomain(maxShortcodeDomain *string) { + o.MaxShortcodeDomain = maxShortcodeDomain +} + +// WithMinShortcodeDomain adds the minShortcodeDomain to the emojis get params +func (o *EmojisGetParams) WithMinShortcodeDomain(minShortcodeDomain *string) *EmojisGetParams { + o.SetMinShortcodeDomain(minShortcodeDomain) + return o +} + +// SetMinShortcodeDomain adds the minShortcodeDomain to the emojis get params +func (o *EmojisGetParams) SetMinShortcodeDomain(minShortcodeDomain *string) { + o.MinShortcodeDomain = minShortcodeDomain +} + +// WriteToRequest writes these params to a swagger request +func (o *EmojisGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Filter != nil { + + // query param filter + var qrFilter string + + if o.Filter != nil { + qrFilter = *o.Filter + } + qFilter := qrFilter + if qFilter != "" { + + if err := r.SetQueryParam("filter", qFilter); 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.MaxShortcodeDomain != nil { + + // query param max_shortcode_domain + var qrMaxShortcodeDomain string + + if o.MaxShortcodeDomain != nil { + qrMaxShortcodeDomain = *o.MaxShortcodeDomain + } + qMaxShortcodeDomain := qrMaxShortcodeDomain + if qMaxShortcodeDomain != "" { + + if err := r.SetQueryParam("max_shortcode_domain", qMaxShortcodeDomain); err != nil { + return err + } + } + } + + if o.MinShortcodeDomain != nil { + + // query param min_shortcode_domain + var qrMinShortcodeDomain string + + if o.MinShortcodeDomain != nil { + qrMinShortcodeDomain = *o.MinShortcodeDomain + } + qMinShortcodeDomain := qrMinShortcodeDomain + if qMinShortcodeDomain != "" { + + if err := r.SetQueryParam("min_shortcode_domain", qMinShortcodeDomain); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emojis_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emojis_get_responses.go new file mode 100644 index 0000000..795706d --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/emojis_get_responses.go @@ -0,0 +1,488 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// EmojisGetReader is a Reader for the EmojisGet structure. +type EmojisGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *EmojisGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewEmojisGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewEmojisGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewEmojisGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewEmojisGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewEmojisGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewEmojisGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewEmojisGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/custom_emojis] emojisGet", response, response.Code()) + } +} + +// NewEmojisGetOK creates a EmojisGetOK with default headers values +func NewEmojisGetOK() *EmojisGetOK { + return &EmojisGetOK{} +} + +/* +EmojisGetOK describes a response with status code 200, with default header values. + +An array of emojis, arranged alphabetically by shortcode and domain. +*/ +type EmojisGetOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.AdminEmoji +} + +// IsSuccess returns true when this emojis get o k response has a 2xx status code +func (o *EmojisGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this emojis get o k response has a 3xx status code +func (o *EmojisGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emojis get o k response has a 4xx status code +func (o *EmojisGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this emojis get o k response has a 5xx status code +func (o *EmojisGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this emojis get o k response a status code equal to that given +func (o *EmojisGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the emojis get o k response +func (o *EmojisGetOK) Code() int { + return 200 +} + +func (o *EmojisGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetOK %s", 200, payload) +} + +func (o *EmojisGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetOK %s", 200, payload) +} + +func (o *EmojisGetOK) GetPayload() []*models.AdminEmoji { + return o.Payload +} + +func (o *EmojisGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewEmojisGetBadRequest creates a EmojisGetBadRequest with default headers values +func NewEmojisGetBadRequest() *EmojisGetBadRequest { + return &EmojisGetBadRequest{} +} + +/* +EmojisGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type EmojisGetBadRequest struct { +} + +// IsSuccess returns true when this emojis get bad request response has a 2xx status code +func (o *EmojisGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emojis get bad request response has a 3xx status code +func (o *EmojisGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emojis get bad request response has a 4xx status code +func (o *EmojisGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this emojis get bad request response has a 5xx status code +func (o *EmojisGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this emojis get bad request response a status code equal to that given +func (o *EmojisGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the emojis get bad request response +func (o *EmojisGetBadRequest) Code() int { + return 400 +} + +func (o *EmojisGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetBadRequest", 400) +} + +func (o *EmojisGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetBadRequest", 400) +} + +func (o *EmojisGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojisGetUnauthorized creates a EmojisGetUnauthorized with default headers values +func NewEmojisGetUnauthorized() *EmojisGetUnauthorized { + return &EmojisGetUnauthorized{} +} + +/* +EmojisGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type EmojisGetUnauthorized struct { +} + +// IsSuccess returns true when this emojis get unauthorized response has a 2xx status code +func (o *EmojisGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emojis get unauthorized response has a 3xx status code +func (o *EmojisGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emojis get unauthorized response has a 4xx status code +func (o *EmojisGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this emojis get unauthorized response has a 5xx status code +func (o *EmojisGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this emojis get unauthorized response a status code equal to that given +func (o *EmojisGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the emojis get unauthorized response +func (o *EmojisGetUnauthorized) Code() int { + return 401 +} + +func (o *EmojisGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetUnauthorized", 401) +} + +func (o *EmojisGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetUnauthorized", 401) +} + +func (o *EmojisGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojisGetForbidden creates a EmojisGetForbidden with default headers values +func NewEmojisGetForbidden() *EmojisGetForbidden { + return &EmojisGetForbidden{} +} + +/* +EmojisGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type EmojisGetForbidden struct { +} + +// IsSuccess returns true when this emojis get forbidden response has a 2xx status code +func (o *EmojisGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emojis get forbidden response has a 3xx status code +func (o *EmojisGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emojis get forbidden response has a 4xx status code +func (o *EmojisGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this emojis get forbidden response has a 5xx status code +func (o *EmojisGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this emojis get forbidden response a status code equal to that given +func (o *EmojisGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the emojis get forbidden response +func (o *EmojisGetForbidden) Code() int { + return 403 +} + +func (o *EmojisGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetForbidden", 403) +} + +func (o *EmojisGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetForbidden", 403) +} + +func (o *EmojisGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojisGetNotFound creates a EmojisGetNotFound with default headers values +func NewEmojisGetNotFound() *EmojisGetNotFound { + return &EmojisGetNotFound{} +} + +/* +EmojisGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type EmojisGetNotFound struct { +} + +// IsSuccess returns true when this emojis get not found response has a 2xx status code +func (o *EmojisGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emojis get not found response has a 3xx status code +func (o *EmojisGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emojis get not found response has a 4xx status code +func (o *EmojisGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this emojis get not found response has a 5xx status code +func (o *EmojisGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this emojis get not found response a status code equal to that given +func (o *EmojisGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the emojis get not found response +func (o *EmojisGetNotFound) Code() int { + return 404 +} + +func (o *EmojisGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetNotFound", 404) +} + +func (o *EmojisGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetNotFound", 404) +} + +func (o *EmojisGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojisGetNotAcceptable creates a EmojisGetNotAcceptable with default headers values +func NewEmojisGetNotAcceptable() *EmojisGetNotAcceptable { + return &EmojisGetNotAcceptable{} +} + +/* +EmojisGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type EmojisGetNotAcceptable struct { +} + +// IsSuccess returns true when this emojis get not acceptable response has a 2xx status code +func (o *EmojisGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emojis get not acceptable response has a 3xx status code +func (o *EmojisGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emojis get not acceptable response has a 4xx status code +func (o *EmojisGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this emojis get not acceptable response has a 5xx status code +func (o *EmojisGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this emojis get not acceptable response a status code equal to that given +func (o *EmojisGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the emojis get not acceptable response +func (o *EmojisGetNotAcceptable) Code() int { + return 406 +} + +func (o *EmojisGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetNotAcceptable", 406) +} + +func (o *EmojisGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetNotAcceptable", 406) +} + +func (o *EmojisGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojisGetInternalServerError creates a EmojisGetInternalServerError with default headers values +func NewEmojisGetInternalServerError() *EmojisGetInternalServerError { + return &EmojisGetInternalServerError{} +} + +/* +EmojisGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type EmojisGetInternalServerError struct { +} + +// IsSuccess returns true when this emojis get internal server error response has a 2xx status code +func (o *EmojisGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emojis get internal server error response has a 3xx status code +func (o *EmojisGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emojis get internal server error response has a 4xx status code +func (o *EmojisGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this emojis get internal server error response has a 5xx status code +func (o *EmojisGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this emojis get internal server error response a status code equal to that given +func (o *EmojisGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the emojis get internal server error response +func (o *EmojisGetInternalServerError) Code() int { + return 500 +} + +func (o *EmojisGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetInternalServerError", 500) +} + +func (o *EmojisGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetInternalServerError", 500) +} + +func (o *EmojisGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allow_create_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allow_create_parameters.go new file mode 100644 index 0000000..5dc5507 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allow_create_parameters.go @@ -0,0 +1,181 @@ +// 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" +) + +// NewHeaderFilterAllowCreateParams creates a new HeaderFilterAllowCreateParams 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 NewHeaderFilterAllowCreateParams() *HeaderFilterAllowCreateParams { + return &HeaderFilterAllowCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeaderFilterAllowCreateParamsWithTimeout creates a new HeaderFilterAllowCreateParams object +// with the ability to set a timeout on a request. +func NewHeaderFilterAllowCreateParamsWithTimeout(timeout time.Duration) *HeaderFilterAllowCreateParams { + return &HeaderFilterAllowCreateParams{ + timeout: timeout, + } +} + +// NewHeaderFilterAllowCreateParamsWithContext creates a new HeaderFilterAllowCreateParams object +// with the ability to set a context for a request. +func NewHeaderFilterAllowCreateParamsWithContext(ctx context.Context) *HeaderFilterAllowCreateParams { + return &HeaderFilterAllowCreateParams{ + Context: ctx, + } +} + +// NewHeaderFilterAllowCreateParamsWithHTTPClient creates a new HeaderFilterAllowCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeaderFilterAllowCreateParamsWithHTTPClient(client *http.Client) *HeaderFilterAllowCreateParams { + return &HeaderFilterAllowCreateParams{ + HTTPClient: client, + } +} + +/* +HeaderFilterAllowCreateParams contains all the parameters to send to the API endpoint + + for the header filter allow create operation. + + Typically these are written to a http.Request. +*/ +type HeaderFilterAllowCreateParams struct { + + /* Header. + + The HTTP header to match against (e.g. User-Agent). + */ + Header string + + /* Regex. + + The header value matching regular expression. + */ + Regex string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the header filter allow create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterAllowCreateParams) WithDefaults() *HeaderFilterAllowCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the header filter allow create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterAllowCreateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the header filter allow create params +func (o *HeaderFilterAllowCreateParams) WithTimeout(timeout time.Duration) *HeaderFilterAllowCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the header filter allow create params +func (o *HeaderFilterAllowCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the header filter allow create params +func (o *HeaderFilterAllowCreateParams) WithContext(ctx context.Context) *HeaderFilterAllowCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the header filter allow create params +func (o *HeaderFilterAllowCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the header filter allow create params +func (o *HeaderFilterAllowCreateParams) WithHTTPClient(client *http.Client) *HeaderFilterAllowCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the header filter allow create params +func (o *HeaderFilterAllowCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithHeader adds the header to the header filter allow create params +func (o *HeaderFilterAllowCreateParams) WithHeader(header string) *HeaderFilterAllowCreateParams { + o.SetHeader(header) + return o +} + +// SetHeader adds the header to the header filter allow create params +func (o *HeaderFilterAllowCreateParams) SetHeader(header string) { + o.Header = header +} + +// WithRegex adds the regex to the header filter allow create params +func (o *HeaderFilterAllowCreateParams) WithRegex(regex string) *HeaderFilterAllowCreateParams { + o.SetRegex(regex) + return o +} + +// SetRegex adds the regex to the header filter allow create params +func (o *HeaderFilterAllowCreateParams) SetRegex(regex string) { + o.Regex = regex +} + +// WriteToRequest writes these params to a swagger request +func (o *HeaderFilterAllowCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param header + frHeader := o.Header + fHeader := frHeader + if fHeader != "" { + if err := r.SetFormParam("header", fHeader); err != nil { + return err + } + } + + // form param regex + frRegex := o.Regex + fRegex := frRegex + if fRegex != "" { + if err := r.SetFormParam("regex", fRegex); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allow_create_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allow_create_responses.go new file mode 100644 index 0000000..2800a6b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allow_create_responses.go @@ -0,0 +1,354 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// HeaderFilterAllowCreateReader is a Reader for the HeaderFilterAllowCreate structure. +type HeaderFilterAllowCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeaderFilterAllowCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeaderFilterAllowCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewHeaderFilterAllowCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewHeaderFilterAllowCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewHeaderFilterAllowCreateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewHeaderFilterAllowCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/header_allows] headerFilterAllowCreate", response, response.Code()) + } +} + +// NewHeaderFilterAllowCreateOK creates a HeaderFilterAllowCreateOK with default headers values +func NewHeaderFilterAllowCreateOK() *HeaderFilterAllowCreateOK { + return &HeaderFilterAllowCreateOK{} +} + +/* +HeaderFilterAllowCreateOK describes a response with status code 200, with default header values. + +The newly created "allow" header filter. +*/ +type HeaderFilterAllowCreateOK struct { + Payload *models.HeaderFilter +} + +// IsSuccess returns true when this header filter allow create o k response has a 2xx status code +func (o *HeaderFilterAllowCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this header filter allow create o k response has a 3xx status code +func (o *HeaderFilterAllowCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow create o k response has a 4xx status code +func (o *HeaderFilterAllowCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter allow create o k response has a 5xx status code +func (o *HeaderFilterAllowCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow create o k response a status code equal to that given +func (o *HeaderFilterAllowCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the header filter allow create o k response +func (o *HeaderFilterAllowCreateOK) Code() int { + return 200 +} + +func (o *HeaderFilterAllowCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/header_allows][%d] headerFilterAllowCreateOK %s", 200, payload) +} + +func (o *HeaderFilterAllowCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/header_allows][%d] headerFilterAllowCreateOK %s", 200, payload) +} + +func (o *HeaderFilterAllowCreateOK) GetPayload() *models.HeaderFilter { + return o.Payload +} + +func (o *HeaderFilterAllowCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HeaderFilter) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewHeaderFilterAllowCreateBadRequest creates a HeaderFilterAllowCreateBadRequest with default headers values +func NewHeaderFilterAllowCreateBadRequest() *HeaderFilterAllowCreateBadRequest { + return &HeaderFilterAllowCreateBadRequest{} +} + +/* +HeaderFilterAllowCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type HeaderFilterAllowCreateBadRequest struct { +} + +// IsSuccess returns true when this header filter allow create bad request response has a 2xx status code +func (o *HeaderFilterAllowCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow create bad request response has a 3xx status code +func (o *HeaderFilterAllowCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow create bad request response has a 4xx status code +func (o *HeaderFilterAllowCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow create bad request response has a 5xx status code +func (o *HeaderFilterAllowCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow create bad request response a status code equal to that given +func (o *HeaderFilterAllowCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the header filter allow create bad request response +func (o *HeaderFilterAllowCreateBadRequest) Code() int { + return 400 +} + +func (o *HeaderFilterAllowCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/header_allows][%d] headerFilterAllowCreateBadRequest", 400) +} + +func (o *HeaderFilterAllowCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/header_allows][%d] headerFilterAllowCreateBadRequest", 400) +} + +func (o *HeaderFilterAllowCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowCreateUnauthorized creates a HeaderFilterAllowCreateUnauthorized with default headers values +func NewHeaderFilterAllowCreateUnauthorized() *HeaderFilterAllowCreateUnauthorized { + return &HeaderFilterAllowCreateUnauthorized{} +} + +/* +HeaderFilterAllowCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type HeaderFilterAllowCreateUnauthorized struct { +} + +// IsSuccess returns true when this header filter allow create unauthorized response has a 2xx status code +func (o *HeaderFilterAllowCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow create unauthorized response has a 3xx status code +func (o *HeaderFilterAllowCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow create unauthorized response has a 4xx status code +func (o *HeaderFilterAllowCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow create unauthorized response has a 5xx status code +func (o *HeaderFilterAllowCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow create unauthorized response a status code equal to that given +func (o *HeaderFilterAllowCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the header filter allow create unauthorized response +func (o *HeaderFilterAllowCreateUnauthorized) Code() int { + return 401 +} + +func (o *HeaderFilterAllowCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/header_allows][%d] headerFilterAllowCreateUnauthorized", 401) +} + +func (o *HeaderFilterAllowCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/header_allows][%d] headerFilterAllowCreateUnauthorized", 401) +} + +func (o *HeaderFilterAllowCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowCreateForbidden creates a HeaderFilterAllowCreateForbidden with default headers values +func NewHeaderFilterAllowCreateForbidden() *HeaderFilterAllowCreateForbidden { + return &HeaderFilterAllowCreateForbidden{} +} + +/* +HeaderFilterAllowCreateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type HeaderFilterAllowCreateForbidden struct { +} + +// IsSuccess returns true when this header filter allow create forbidden response has a 2xx status code +func (o *HeaderFilterAllowCreateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow create forbidden response has a 3xx status code +func (o *HeaderFilterAllowCreateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow create forbidden response has a 4xx status code +func (o *HeaderFilterAllowCreateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow create forbidden response has a 5xx status code +func (o *HeaderFilterAllowCreateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow create forbidden response a status code equal to that given +func (o *HeaderFilterAllowCreateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the header filter allow create forbidden response +func (o *HeaderFilterAllowCreateForbidden) Code() int { + return 403 +} + +func (o *HeaderFilterAllowCreateForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/header_allows][%d] headerFilterAllowCreateForbidden", 403) +} + +func (o *HeaderFilterAllowCreateForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/header_allows][%d] headerFilterAllowCreateForbidden", 403) +} + +func (o *HeaderFilterAllowCreateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowCreateInternalServerError creates a HeaderFilterAllowCreateInternalServerError with default headers values +func NewHeaderFilterAllowCreateInternalServerError() *HeaderFilterAllowCreateInternalServerError { + return &HeaderFilterAllowCreateInternalServerError{} +} + +/* +HeaderFilterAllowCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type HeaderFilterAllowCreateInternalServerError struct { +} + +// IsSuccess returns true when this header filter allow create internal server error response has a 2xx status code +func (o *HeaderFilterAllowCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow create internal server error response has a 3xx status code +func (o *HeaderFilterAllowCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow create internal server error response has a 4xx status code +func (o *HeaderFilterAllowCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter allow create internal server error response has a 5xx status code +func (o *HeaderFilterAllowCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this header filter allow create internal server error response a status code equal to that given +func (o *HeaderFilterAllowCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the header filter allow create internal server error response +func (o *HeaderFilterAllowCreateInternalServerError) Code() int { + return 500 +} + +func (o *HeaderFilterAllowCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/header_allows][%d] headerFilterAllowCreateInternalServerError", 500) +} + +func (o *HeaderFilterAllowCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/header_allows][%d] headerFilterAllowCreateInternalServerError", 500) +} + +func (o *HeaderFilterAllowCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allow_delete_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allow_delete_parameters.go new file mode 100644 index 0000000..64437e8 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allow_delete_parameters.go @@ -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" +) + +// NewHeaderFilterAllowDeleteParams creates a new HeaderFilterAllowDeleteParams 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 NewHeaderFilterAllowDeleteParams() *HeaderFilterAllowDeleteParams { + return &HeaderFilterAllowDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeaderFilterAllowDeleteParamsWithTimeout creates a new HeaderFilterAllowDeleteParams object +// with the ability to set a timeout on a request. +func NewHeaderFilterAllowDeleteParamsWithTimeout(timeout time.Duration) *HeaderFilterAllowDeleteParams { + return &HeaderFilterAllowDeleteParams{ + timeout: timeout, + } +} + +// NewHeaderFilterAllowDeleteParamsWithContext creates a new HeaderFilterAllowDeleteParams object +// with the ability to set a context for a request. +func NewHeaderFilterAllowDeleteParamsWithContext(ctx context.Context) *HeaderFilterAllowDeleteParams { + return &HeaderFilterAllowDeleteParams{ + Context: ctx, + } +} + +// NewHeaderFilterAllowDeleteParamsWithHTTPClient creates a new HeaderFilterAllowDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeaderFilterAllowDeleteParamsWithHTTPClient(client *http.Client) *HeaderFilterAllowDeleteParams { + return &HeaderFilterAllowDeleteParams{ + HTTPClient: client, + } +} + +/* +HeaderFilterAllowDeleteParams contains all the parameters to send to the API endpoint + + for the header filter allow delete operation. + + Typically these are written to a http.Request. +*/ +type HeaderFilterAllowDeleteParams struct { + + /* ID. + + Target header filter ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the header filter allow delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterAllowDeleteParams) WithDefaults() *HeaderFilterAllowDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the header filter allow delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterAllowDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the header filter allow delete params +func (o *HeaderFilterAllowDeleteParams) WithTimeout(timeout time.Duration) *HeaderFilterAllowDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the header filter allow delete params +func (o *HeaderFilterAllowDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the header filter allow delete params +func (o *HeaderFilterAllowDeleteParams) WithContext(ctx context.Context) *HeaderFilterAllowDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the header filter allow delete params +func (o *HeaderFilterAllowDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the header filter allow delete params +func (o *HeaderFilterAllowDeleteParams) WithHTTPClient(client *http.Client) *HeaderFilterAllowDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the header filter allow delete params +func (o *HeaderFilterAllowDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the header filter allow delete params +func (o *HeaderFilterAllowDeleteParams) WithID(id string) *HeaderFilterAllowDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the header filter allow delete params +func (o *HeaderFilterAllowDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *HeaderFilterAllowDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allow_delete_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allow_delete_responses.go new file mode 100644 index 0000000..bc1d27c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allow_delete_responses.go @@ -0,0 +1,398 @@ +// 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" +) + +// HeaderFilterAllowDeleteReader is a Reader for the HeaderFilterAllowDelete structure. +type HeaderFilterAllowDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeaderFilterAllowDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewHeaderFilterAllowDeleteAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewHeaderFilterAllowDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewHeaderFilterAllowDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewHeaderFilterAllowDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewHeaderFilterAllowDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewHeaderFilterAllowDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/admin/header_allows/{id}] headerFilterAllowDelete", response, response.Code()) + } +} + +// NewHeaderFilterAllowDeleteAccepted creates a HeaderFilterAllowDeleteAccepted with default headers values +func NewHeaderFilterAllowDeleteAccepted() *HeaderFilterAllowDeleteAccepted { + return &HeaderFilterAllowDeleteAccepted{} +} + +/* +HeaderFilterAllowDeleteAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type HeaderFilterAllowDeleteAccepted struct { +} + +// IsSuccess returns true when this header filter allow delete accepted response has a 2xx status code +func (o *HeaderFilterAllowDeleteAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this header filter allow delete accepted response has a 3xx status code +func (o *HeaderFilterAllowDeleteAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow delete accepted response has a 4xx status code +func (o *HeaderFilterAllowDeleteAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter allow delete accepted response has a 5xx status code +func (o *HeaderFilterAllowDeleteAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow delete accepted response a status code equal to that given +func (o *HeaderFilterAllowDeleteAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the header filter allow delete accepted response +func (o *HeaderFilterAllowDeleteAccepted) Code() int { + return 202 +} + +func (o *HeaderFilterAllowDeleteAccepted) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteAccepted", 202) +} + +func (o *HeaderFilterAllowDeleteAccepted) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteAccepted", 202) +} + +func (o *HeaderFilterAllowDeleteAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowDeleteBadRequest creates a HeaderFilterAllowDeleteBadRequest with default headers values +func NewHeaderFilterAllowDeleteBadRequest() *HeaderFilterAllowDeleteBadRequest { + return &HeaderFilterAllowDeleteBadRequest{} +} + +/* +HeaderFilterAllowDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type HeaderFilterAllowDeleteBadRequest struct { +} + +// IsSuccess returns true when this header filter allow delete bad request response has a 2xx status code +func (o *HeaderFilterAllowDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow delete bad request response has a 3xx status code +func (o *HeaderFilterAllowDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow delete bad request response has a 4xx status code +func (o *HeaderFilterAllowDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow delete bad request response has a 5xx status code +func (o *HeaderFilterAllowDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow delete bad request response a status code equal to that given +func (o *HeaderFilterAllowDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the header filter allow delete bad request response +func (o *HeaderFilterAllowDeleteBadRequest) Code() int { + return 400 +} + +func (o *HeaderFilterAllowDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteBadRequest", 400) +} + +func (o *HeaderFilterAllowDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteBadRequest", 400) +} + +func (o *HeaderFilterAllowDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowDeleteUnauthorized creates a HeaderFilterAllowDeleteUnauthorized with default headers values +func NewHeaderFilterAllowDeleteUnauthorized() *HeaderFilterAllowDeleteUnauthorized { + return &HeaderFilterAllowDeleteUnauthorized{} +} + +/* +HeaderFilterAllowDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type HeaderFilterAllowDeleteUnauthorized struct { +} + +// IsSuccess returns true when this header filter allow delete unauthorized response has a 2xx status code +func (o *HeaderFilterAllowDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow delete unauthorized response has a 3xx status code +func (o *HeaderFilterAllowDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow delete unauthorized response has a 4xx status code +func (o *HeaderFilterAllowDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow delete unauthorized response has a 5xx status code +func (o *HeaderFilterAllowDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow delete unauthorized response a status code equal to that given +func (o *HeaderFilterAllowDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the header filter allow delete unauthorized response +func (o *HeaderFilterAllowDeleteUnauthorized) Code() int { + return 401 +} + +func (o *HeaderFilterAllowDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteUnauthorized", 401) +} + +func (o *HeaderFilterAllowDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteUnauthorized", 401) +} + +func (o *HeaderFilterAllowDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowDeleteForbidden creates a HeaderFilterAllowDeleteForbidden with default headers values +func NewHeaderFilterAllowDeleteForbidden() *HeaderFilterAllowDeleteForbidden { + return &HeaderFilterAllowDeleteForbidden{} +} + +/* +HeaderFilterAllowDeleteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type HeaderFilterAllowDeleteForbidden struct { +} + +// IsSuccess returns true when this header filter allow delete forbidden response has a 2xx status code +func (o *HeaderFilterAllowDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow delete forbidden response has a 3xx status code +func (o *HeaderFilterAllowDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow delete forbidden response has a 4xx status code +func (o *HeaderFilterAllowDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow delete forbidden response has a 5xx status code +func (o *HeaderFilterAllowDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow delete forbidden response a status code equal to that given +func (o *HeaderFilterAllowDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the header filter allow delete forbidden response +func (o *HeaderFilterAllowDeleteForbidden) Code() int { + return 403 +} + +func (o *HeaderFilterAllowDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteForbidden", 403) +} + +func (o *HeaderFilterAllowDeleteForbidden) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteForbidden", 403) +} + +func (o *HeaderFilterAllowDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowDeleteNotFound creates a HeaderFilterAllowDeleteNotFound with default headers values +func NewHeaderFilterAllowDeleteNotFound() *HeaderFilterAllowDeleteNotFound { + return &HeaderFilterAllowDeleteNotFound{} +} + +/* +HeaderFilterAllowDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type HeaderFilterAllowDeleteNotFound struct { +} + +// IsSuccess returns true when this header filter allow delete not found response has a 2xx status code +func (o *HeaderFilterAllowDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow delete not found response has a 3xx status code +func (o *HeaderFilterAllowDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow delete not found response has a 4xx status code +func (o *HeaderFilterAllowDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow delete not found response has a 5xx status code +func (o *HeaderFilterAllowDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow delete not found response a status code equal to that given +func (o *HeaderFilterAllowDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the header filter allow delete not found response +func (o *HeaderFilterAllowDeleteNotFound) Code() int { + return 404 +} + +func (o *HeaderFilterAllowDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteNotFound", 404) +} + +func (o *HeaderFilterAllowDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteNotFound", 404) +} + +func (o *HeaderFilterAllowDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowDeleteInternalServerError creates a HeaderFilterAllowDeleteInternalServerError with default headers values +func NewHeaderFilterAllowDeleteInternalServerError() *HeaderFilterAllowDeleteInternalServerError { + return &HeaderFilterAllowDeleteInternalServerError{} +} + +/* +HeaderFilterAllowDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type HeaderFilterAllowDeleteInternalServerError struct { +} + +// IsSuccess returns true when this header filter allow delete internal server error response has a 2xx status code +func (o *HeaderFilterAllowDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow delete internal server error response has a 3xx status code +func (o *HeaderFilterAllowDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow delete internal server error response has a 4xx status code +func (o *HeaderFilterAllowDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter allow delete internal server error response has a 5xx status code +func (o *HeaderFilterAllowDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this header filter allow delete internal server error response a status code equal to that given +func (o *HeaderFilterAllowDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the header filter allow delete internal server error response +func (o *HeaderFilterAllowDeleteInternalServerError) Code() int { + return 500 +} + +func (o *HeaderFilterAllowDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteInternalServerError", 500) +} + +func (o *HeaderFilterAllowDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteInternalServerError", 500) +} + +func (o *HeaderFilterAllowDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allow_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allow_get_parameters.go new file mode 100644 index 0000000..ad4f975 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allow_get_parameters.go @@ -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" +) + +// NewHeaderFilterAllowGetParams creates a new HeaderFilterAllowGetParams 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 NewHeaderFilterAllowGetParams() *HeaderFilterAllowGetParams { + return &HeaderFilterAllowGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeaderFilterAllowGetParamsWithTimeout creates a new HeaderFilterAllowGetParams object +// with the ability to set a timeout on a request. +func NewHeaderFilterAllowGetParamsWithTimeout(timeout time.Duration) *HeaderFilterAllowGetParams { + return &HeaderFilterAllowGetParams{ + timeout: timeout, + } +} + +// NewHeaderFilterAllowGetParamsWithContext creates a new HeaderFilterAllowGetParams object +// with the ability to set a context for a request. +func NewHeaderFilterAllowGetParamsWithContext(ctx context.Context) *HeaderFilterAllowGetParams { + return &HeaderFilterAllowGetParams{ + Context: ctx, + } +} + +// NewHeaderFilterAllowGetParamsWithHTTPClient creates a new HeaderFilterAllowGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeaderFilterAllowGetParamsWithHTTPClient(client *http.Client) *HeaderFilterAllowGetParams { + return &HeaderFilterAllowGetParams{ + HTTPClient: client, + } +} + +/* +HeaderFilterAllowGetParams contains all the parameters to send to the API endpoint + + for the header filter allow get operation. + + Typically these are written to a http.Request. +*/ +type HeaderFilterAllowGetParams struct { + + /* ID. + + Target header filter ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the header filter allow get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterAllowGetParams) WithDefaults() *HeaderFilterAllowGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the header filter allow get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterAllowGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the header filter allow get params +func (o *HeaderFilterAllowGetParams) WithTimeout(timeout time.Duration) *HeaderFilterAllowGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the header filter allow get params +func (o *HeaderFilterAllowGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the header filter allow get params +func (o *HeaderFilterAllowGetParams) WithContext(ctx context.Context) *HeaderFilterAllowGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the header filter allow get params +func (o *HeaderFilterAllowGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the header filter allow get params +func (o *HeaderFilterAllowGetParams) WithHTTPClient(client *http.Client) *HeaderFilterAllowGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the header filter allow get params +func (o *HeaderFilterAllowGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the header filter allow get params +func (o *HeaderFilterAllowGetParams) WithID(id string) *HeaderFilterAllowGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the header filter allow get params +func (o *HeaderFilterAllowGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *HeaderFilterAllowGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allow_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allow_get_responses.go new file mode 100644 index 0000000..1372012 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allow_get_responses.go @@ -0,0 +1,416 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// HeaderFilterAllowGetReader is a Reader for the HeaderFilterAllowGet structure. +type HeaderFilterAllowGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeaderFilterAllowGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeaderFilterAllowGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewHeaderFilterAllowGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewHeaderFilterAllowGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewHeaderFilterAllowGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewHeaderFilterAllowGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewHeaderFilterAllowGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/header_allows/{id}] headerFilterAllowGet", response, response.Code()) + } +} + +// NewHeaderFilterAllowGetOK creates a HeaderFilterAllowGetOK with default headers values +func NewHeaderFilterAllowGetOK() *HeaderFilterAllowGetOK { + return &HeaderFilterAllowGetOK{} +} + +/* +HeaderFilterAllowGetOK describes a response with status code 200, with default header values. + +The requested "allow" header filter. +*/ +type HeaderFilterAllowGetOK struct { + Payload *models.HeaderFilter +} + +// IsSuccess returns true when this header filter allow get o k response has a 2xx status code +func (o *HeaderFilterAllowGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this header filter allow get o k response has a 3xx status code +func (o *HeaderFilterAllowGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow get o k response has a 4xx status code +func (o *HeaderFilterAllowGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter allow get o k response has a 5xx status code +func (o *HeaderFilterAllowGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow get o k response a status code equal to that given +func (o *HeaderFilterAllowGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the header filter allow get o k response +func (o *HeaderFilterAllowGetOK) Code() int { + return 200 +} + +func (o *HeaderFilterAllowGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetOK %s", 200, payload) +} + +func (o *HeaderFilterAllowGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetOK %s", 200, payload) +} + +func (o *HeaderFilterAllowGetOK) GetPayload() *models.HeaderFilter { + return o.Payload +} + +func (o *HeaderFilterAllowGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HeaderFilter) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewHeaderFilterAllowGetBadRequest creates a HeaderFilterAllowGetBadRequest with default headers values +func NewHeaderFilterAllowGetBadRequest() *HeaderFilterAllowGetBadRequest { + return &HeaderFilterAllowGetBadRequest{} +} + +/* +HeaderFilterAllowGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type HeaderFilterAllowGetBadRequest struct { +} + +// IsSuccess returns true when this header filter allow get bad request response has a 2xx status code +func (o *HeaderFilterAllowGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow get bad request response has a 3xx status code +func (o *HeaderFilterAllowGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow get bad request response has a 4xx status code +func (o *HeaderFilterAllowGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow get bad request response has a 5xx status code +func (o *HeaderFilterAllowGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow get bad request response a status code equal to that given +func (o *HeaderFilterAllowGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the header filter allow get bad request response +func (o *HeaderFilterAllowGetBadRequest) Code() int { + return 400 +} + +func (o *HeaderFilterAllowGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetBadRequest", 400) +} + +func (o *HeaderFilterAllowGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetBadRequest", 400) +} + +func (o *HeaderFilterAllowGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowGetUnauthorized creates a HeaderFilterAllowGetUnauthorized with default headers values +func NewHeaderFilterAllowGetUnauthorized() *HeaderFilterAllowGetUnauthorized { + return &HeaderFilterAllowGetUnauthorized{} +} + +/* +HeaderFilterAllowGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type HeaderFilterAllowGetUnauthorized struct { +} + +// IsSuccess returns true when this header filter allow get unauthorized response has a 2xx status code +func (o *HeaderFilterAllowGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow get unauthorized response has a 3xx status code +func (o *HeaderFilterAllowGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow get unauthorized response has a 4xx status code +func (o *HeaderFilterAllowGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow get unauthorized response has a 5xx status code +func (o *HeaderFilterAllowGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow get unauthorized response a status code equal to that given +func (o *HeaderFilterAllowGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the header filter allow get unauthorized response +func (o *HeaderFilterAllowGetUnauthorized) Code() int { + return 401 +} + +func (o *HeaderFilterAllowGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetUnauthorized", 401) +} + +func (o *HeaderFilterAllowGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetUnauthorized", 401) +} + +func (o *HeaderFilterAllowGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowGetForbidden creates a HeaderFilterAllowGetForbidden with default headers values +func NewHeaderFilterAllowGetForbidden() *HeaderFilterAllowGetForbidden { + return &HeaderFilterAllowGetForbidden{} +} + +/* +HeaderFilterAllowGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type HeaderFilterAllowGetForbidden struct { +} + +// IsSuccess returns true when this header filter allow get forbidden response has a 2xx status code +func (o *HeaderFilterAllowGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow get forbidden response has a 3xx status code +func (o *HeaderFilterAllowGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow get forbidden response has a 4xx status code +func (o *HeaderFilterAllowGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow get forbidden response has a 5xx status code +func (o *HeaderFilterAllowGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow get forbidden response a status code equal to that given +func (o *HeaderFilterAllowGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the header filter allow get forbidden response +func (o *HeaderFilterAllowGetForbidden) Code() int { + return 403 +} + +func (o *HeaderFilterAllowGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetForbidden", 403) +} + +func (o *HeaderFilterAllowGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetForbidden", 403) +} + +func (o *HeaderFilterAllowGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowGetNotFound creates a HeaderFilterAllowGetNotFound with default headers values +func NewHeaderFilterAllowGetNotFound() *HeaderFilterAllowGetNotFound { + return &HeaderFilterAllowGetNotFound{} +} + +/* +HeaderFilterAllowGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type HeaderFilterAllowGetNotFound struct { +} + +// IsSuccess returns true when this header filter allow get not found response has a 2xx status code +func (o *HeaderFilterAllowGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow get not found response has a 3xx status code +func (o *HeaderFilterAllowGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow get not found response has a 4xx status code +func (o *HeaderFilterAllowGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow get not found response has a 5xx status code +func (o *HeaderFilterAllowGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow get not found response a status code equal to that given +func (o *HeaderFilterAllowGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the header filter allow get not found response +func (o *HeaderFilterAllowGetNotFound) Code() int { + return 404 +} + +func (o *HeaderFilterAllowGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetNotFound", 404) +} + +func (o *HeaderFilterAllowGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetNotFound", 404) +} + +func (o *HeaderFilterAllowGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowGetInternalServerError creates a HeaderFilterAllowGetInternalServerError with default headers values +func NewHeaderFilterAllowGetInternalServerError() *HeaderFilterAllowGetInternalServerError { + return &HeaderFilterAllowGetInternalServerError{} +} + +/* +HeaderFilterAllowGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type HeaderFilterAllowGetInternalServerError struct { +} + +// IsSuccess returns true when this header filter allow get internal server error response has a 2xx status code +func (o *HeaderFilterAllowGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow get internal server error response has a 3xx status code +func (o *HeaderFilterAllowGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow get internal server error response has a 4xx status code +func (o *HeaderFilterAllowGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter allow get internal server error response has a 5xx status code +func (o *HeaderFilterAllowGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this header filter allow get internal server error response a status code equal to that given +func (o *HeaderFilterAllowGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the header filter allow get internal server error response +func (o *HeaderFilterAllowGetInternalServerError) Code() int { + return 500 +} + +func (o *HeaderFilterAllowGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetInternalServerError", 500) +} + +func (o *HeaderFilterAllowGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetInternalServerError", 500) +} + +func (o *HeaderFilterAllowGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allows_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allows_get_parameters.go new file mode 100644 index 0000000..d7f55be --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allows_get_parameters.go @@ -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" +) + +// NewHeaderFilterAllowsGetParams creates a new HeaderFilterAllowsGetParams 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 NewHeaderFilterAllowsGetParams() *HeaderFilterAllowsGetParams { + return &HeaderFilterAllowsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeaderFilterAllowsGetParamsWithTimeout creates a new HeaderFilterAllowsGetParams object +// with the ability to set a timeout on a request. +func NewHeaderFilterAllowsGetParamsWithTimeout(timeout time.Duration) *HeaderFilterAllowsGetParams { + return &HeaderFilterAllowsGetParams{ + timeout: timeout, + } +} + +// NewHeaderFilterAllowsGetParamsWithContext creates a new HeaderFilterAllowsGetParams object +// with the ability to set a context for a request. +func NewHeaderFilterAllowsGetParamsWithContext(ctx context.Context) *HeaderFilterAllowsGetParams { + return &HeaderFilterAllowsGetParams{ + Context: ctx, + } +} + +// NewHeaderFilterAllowsGetParamsWithHTTPClient creates a new HeaderFilterAllowsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeaderFilterAllowsGetParamsWithHTTPClient(client *http.Client) *HeaderFilterAllowsGetParams { + return &HeaderFilterAllowsGetParams{ + HTTPClient: client, + } +} + +/* +HeaderFilterAllowsGetParams contains all the parameters to send to the API endpoint + + for the header filter allows get operation. + + Typically these are written to a http.Request. +*/ +type HeaderFilterAllowsGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the header filter allows get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterAllowsGetParams) WithDefaults() *HeaderFilterAllowsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the header filter allows get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterAllowsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the header filter allows get params +func (o *HeaderFilterAllowsGetParams) WithTimeout(timeout time.Duration) *HeaderFilterAllowsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the header filter allows get params +func (o *HeaderFilterAllowsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the header filter allows get params +func (o *HeaderFilterAllowsGetParams) WithContext(ctx context.Context) *HeaderFilterAllowsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the header filter allows get params +func (o *HeaderFilterAllowsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the header filter allows get params +func (o *HeaderFilterAllowsGetParams) WithHTTPClient(client *http.Client) *HeaderFilterAllowsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the header filter allows get params +func (o *HeaderFilterAllowsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *HeaderFilterAllowsGetParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allows_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allows_get_responses.go new file mode 100644 index 0000000..425213c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_allows_get_responses.go @@ -0,0 +1,414 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// HeaderFilterAllowsGetReader is a Reader for the HeaderFilterAllowsGet structure. +type HeaderFilterAllowsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeaderFilterAllowsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeaderFilterAllowsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewHeaderFilterAllowsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewHeaderFilterAllowsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewHeaderFilterAllowsGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewHeaderFilterAllowsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewHeaderFilterAllowsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/header_allows] headerFilterAllowsGet", response, response.Code()) + } +} + +// NewHeaderFilterAllowsGetOK creates a HeaderFilterAllowsGetOK with default headers values +func NewHeaderFilterAllowsGetOK() *HeaderFilterAllowsGetOK { + return &HeaderFilterAllowsGetOK{} +} + +/* +HeaderFilterAllowsGetOK describes a response with status code 200, with default header values. + +All "allow" header filters currently in place. +*/ +type HeaderFilterAllowsGetOK struct { + Payload []*models.HeaderFilter +} + +// IsSuccess returns true when this header filter allows get o k response has a 2xx status code +func (o *HeaderFilterAllowsGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this header filter allows get o k response has a 3xx status code +func (o *HeaderFilterAllowsGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allows get o k response has a 4xx status code +func (o *HeaderFilterAllowsGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter allows get o k response has a 5xx status code +func (o *HeaderFilterAllowsGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allows get o k response a status code equal to that given +func (o *HeaderFilterAllowsGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the header filter allows get o k response +func (o *HeaderFilterAllowsGetOK) Code() int { + return 200 +} + +func (o *HeaderFilterAllowsGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetOK %s", 200, payload) +} + +func (o *HeaderFilterAllowsGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetOK %s", 200, payload) +} + +func (o *HeaderFilterAllowsGetOK) GetPayload() []*models.HeaderFilter { + return o.Payload +} + +func (o *HeaderFilterAllowsGetOK) 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 +} + +// NewHeaderFilterAllowsGetBadRequest creates a HeaderFilterAllowsGetBadRequest with default headers values +func NewHeaderFilterAllowsGetBadRequest() *HeaderFilterAllowsGetBadRequest { + return &HeaderFilterAllowsGetBadRequest{} +} + +/* +HeaderFilterAllowsGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type HeaderFilterAllowsGetBadRequest struct { +} + +// IsSuccess returns true when this header filter allows get bad request response has a 2xx status code +func (o *HeaderFilterAllowsGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allows get bad request response has a 3xx status code +func (o *HeaderFilterAllowsGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allows get bad request response has a 4xx status code +func (o *HeaderFilterAllowsGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allows get bad request response has a 5xx status code +func (o *HeaderFilterAllowsGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allows get bad request response a status code equal to that given +func (o *HeaderFilterAllowsGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the header filter allows get bad request response +func (o *HeaderFilterAllowsGetBadRequest) Code() int { + return 400 +} + +func (o *HeaderFilterAllowsGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetBadRequest", 400) +} + +func (o *HeaderFilterAllowsGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetBadRequest", 400) +} + +func (o *HeaderFilterAllowsGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowsGetUnauthorized creates a HeaderFilterAllowsGetUnauthorized with default headers values +func NewHeaderFilterAllowsGetUnauthorized() *HeaderFilterAllowsGetUnauthorized { + return &HeaderFilterAllowsGetUnauthorized{} +} + +/* +HeaderFilterAllowsGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type HeaderFilterAllowsGetUnauthorized struct { +} + +// IsSuccess returns true when this header filter allows get unauthorized response has a 2xx status code +func (o *HeaderFilterAllowsGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allows get unauthorized response has a 3xx status code +func (o *HeaderFilterAllowsGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allows get unauthorized response has a 4xx status code +func (o *HeaderFilterAllowsGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allows get unauthorized response has a 5xx status code +func (o *HeaderFilterAllowsGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allows get unauthorized response a status code equal to that given +func (o *HeaderFilterAllowsGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the header filter allows get unauthorized response +func (o *HeaderFilterAllowsGetUnauthorized) Code() int { + return 401 +} + +func (o *HeaderFilterAllowsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetUnauthorized", 401) +} + +func (o *HeaderFilterAllowsGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetUnauthorized", 401) +} + +func (o *HeaderFilterAllowsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowsGetForbidden creates a HeaderFilterAllowsGetForbidden with default headers values +func NewHeaderFilterAllowsGetForbidden() *HeaderFilterAllowsGetForbidden { + return &HeaderFilterAllowsGetForbidden{} +} + +/* +HeaderFilterAllowsGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type HeaderFilterAllowsGetForbidden struct { +} + +// IsSuccess returns true when this header filter allows get forbidden response has a 2xx status code +func (o *HeaderFilterAllowsGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allows get forbidden response has a 3xx status code +func (o *HeaderFilterAllowsGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allows get forbidden response has a 4xx status code +func (o *HeaderFilterAllowsGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allows get forbidden response has a 5xx status code +func (o *HeaderFilterAllowsGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allows get forbidden response a status code equal to that given +func (o *HeaderFilterAllowsGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the header filter allows get forbidden response +func (o *HeaderFilterAllowsGetForbidden) Code() int { + return 403 +} + +func (o *HeaderFilterAllowsGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetForbidden", 403) +} + +func (o *HeaderFilterAllowsGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetForbidden", 403) +} + +func (o *HeaderFilterAllowsGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowsGetNotFound creates a HeaderFilterAllowsGetNotFound with default headers values +func NewHeaderFilterAllowsGetNotFound() *HeaderFilterAllowsGetNotFound { + return &HeaderFilterAllowsGetNotFound{} +} + +/* +HeaderFilterAllowsGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type HeaderFilterAllowsGetNotFound struct { +} + +// IsSuccess returns true when this header filter allows get not found response has a 2xx status code +func (o *HeaderFilterAllowsGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allows get not found response has a 3xx status code +func (o *HeaderFilterAllowsGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allows get not found response has a 4xx status code +func (o *HeaderFilterAllowsGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allows get not found response has a 5xx status code +func (o *HeaderFilterAllowsGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allows get not found response a status code equal to that given +func (o *HeaderFilterAllowsGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the header filter allows get not found response +func (o *HeaderFilterAllowsGetNotFound) Code() int { + return 404 +} + +func (o *HeaderFilterAllowsGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetNotFound", 404) +} + +func (o *HeaderFilterAllowsGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetNotFound", 404) +} + +func (o *HeaderFilterAllowsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowsGetInternalServerError creates a HeaderFilterAllowsGetInternalServerError with default headers values +func NewHeaderFilterAllowsGetInternalServerError() *HeaderFilterAllowsGetInternalServerError { + return &HeaderFilterAllowsGetInternalServerError{} +} + +/* +HeaderFilterAllowsGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type HeaderFilterAllowsGetInternalServerError struct { +} + +// IsSuccess returns true when this header filter allows get internal server error response has a 2xx status code +func (o *HeaderFilterAllowsGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allows get internal server error response has a 3xx status code +func (o *HeaderFilterAllowsGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allows get internal server error response has a 4xx status code +func (o *HeaderFilterAllowsGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter allows get internal server error response has a 5xx status code +func (o *HeaderFilterAllowsGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this header filter allows get internal server error response a status code equal to that given +func (o *HeaderFilterAllowsGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the header filter allows get internal server error response +func (o *HeaderFilterAllowsGetInternalServerError) Code() int { + return 500 +} + +func (o *HeaderFilterAllowsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetInternalServerError", 500) +} + +func (o *HeaderFilterAllowsGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetInternalServerError", 500) +} + +func (o *HeaderFilterAllowsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_block_create_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_block_create_parameters.go new file mode 100644 index 0000000..50f2edc --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_block_create_parameters.go @@ -0,0 +1,181 @@ +// 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" +) + +// NewHeaderFilterBlockCreateParams creates a new HeaderFilterBlockCreateParams 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 NewHeaderFilterBlockCreateParams() *HeaderFilterBlockCreateParams { + return &HeaderFilterBlockCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeaderFilterBlockCreateParamsWithTimeout creates a new HeaderFilterBlockCreateParams object +// with the ability to set a timeout on a request. +func NewHeaderFilterBlockCreateParamsWithTimeout(timeout time.Duration) *HeaderFilterBlockCreateParams { + return &HeaderFilterBlockCreateParams{ + timeout: timeout, + } +} + +// NewHeaderFilterBlockCreateParamsWithContext creates a new HeaderFilterBlockCreateParams object +// with the ability to set a context for a request. +func NewHeaderFilterBlockCreateParamsWithContext(ctx context.Context) *HeaderFilterBlockCreateParams { + return &HeaderFilterBlockCreateParams{ + Context: ctx, + } +} + +// NewHeaderFilterBlockCreateParamsWithHTTPClient creates a new HeaderFilterBlockCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeaderFilterBlockCreateParamsWithHTTPClient(client *http.Client) *HeaderFilterBlockCreateParams { + return &HeaderFilterBlockCreateParams{ + HTTPClient: client, + } +} + +/* +HeaderFilterBlockCreateParams contains all the parameters to send to the API endpoint + + for the header filter block create operation. + + Typically these are written to a http.Request. +*/ +type HeaderFilterBlockCreateParams struct { + + /* Header. + + The HTTP header to match against (e.g. User-Agent). + */ + Header string + + /* Regex. + + The header value matching regular expression. + */ + Regex string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the header filter block create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterBlockCreateParams) WithDefaults() *HeaderFilterBlockCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the header filter block create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterBlockCreateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the header filter block create params +func (o *HeaderFilterBlockCreateParams) WithTimeout(timeout time.Duration) *HeaderFilterBlockCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the header filter block create params +func (o *HeaderFilterBlockCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the header filter block create params +func (o *HeaderFilterBlockCreateParams) WithContext(ctx context.Context) *HeaderFilterBlockCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the header filter block create params +func (o *HeaderFilterBlockCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the header filter block create params +func (o *HeaderFilterBlockCreateParams) WithHTTPClient(client *http.Client) *HeaderFilterBlockCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the header filter block create params +func (o *HeaderFilterBlockCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithHeader adds the header to the header filter block create params +func (o *HeaderFilterBlockCreateParams) WithHeader(header string) *HeaderFilterBlockCreateParams { + o.SetHeader(header) + return o +} + +// SetHeader adds the header to the header filter block create params +func (o *HeaderFilterBlockCreateParams) SetHeader(header string) { + o.Header = header +} + +// WithRegex adds the regex to the header filter block create params +func (o *HeaderFilterBlockCreateParams) WithRegex(regex string) *HeaderFilterBlockCreateParams { + o.SetRegex(regex) + return o +} + +// SetRegex adds the regex to the header filter block create params +func (o *HeaderFilterBlockCreateParams) SetRegex(regex string) { + o.Regex = regex +} + +// WriteToRequest writes these params to a swagger request +func (o *HeaderFilterBlockCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param header + frHeader := o.Header + fHeader := frHeader + if fHeader != "" { + if err := r.SetFormParam("header", fHeader); err != nil { + return err + } + } + + // form param regex + frRegex := o.Regex + fRegex := frRegex + if fRegex != "" { + if err := r.SetFormParam("regex", fRegex); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_block_create_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_block_create_responses.go new file mode 100644 index 0000000..670f230 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_block_create_responses.go @@ -0,0 +1,354 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// HeaderFilterBlockCreateReader is a Reader for the HeaderFilterBlockCreate structure. +type HeaderFilterBlockCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeaderFilterBlockCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeaderFilterBlockCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewHeaderFilterBlockCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewHeaderFilterBlockCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewHeaderFilterBlockCreateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewHeaderFilterBlockCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/header_blocks] headerFilterBlockCreate", response, response.Code()) + } +} + +// NewHeaderFilterBlockCreateOK creates a HeaderFilterBlockCreateOK with default headers values +func NewHeaderFilterBlockCreateOK() *HeaderFilterBlockCreateOK { + return &HeaderFilterBlockCreateOK{} +} + +/* +HeaderFilterBlockCreateOK describes a response with status code 200, with default header values. + +The newly created "block" header filter. +*/ +type HeaderFilterBlockCreateOK struct { + Payload *models.HeaderFilter +} + +// IsSuccess returns true when this header filter block create o k response has a 2xx status code +func (o *HeaderFilterBlockCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this header filter block create o k response has a 3xx status code +func (o *HeaderFilterBlockCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block create o k response has a 4xx status code +func (o *HeaderFilterBlockCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter block create o k response has a 5xx status code +func (o *HeaderFilterBlockCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block create o k response a status code equal to that given +func (o *HeaderFilterBlockCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the header filter block create o k response +func (o *HeaderFilterBlockCreateOK) Code() int { + return 200 +} + +func (o *HeaderFilterBlockCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/header_blocks][%d] headerFilterBlockCreateOK %s", 200, payload) +} + +func (o *HeaderFilterBlockCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/header_blocks][%d] headerFilterBlockCreateOK %s", 200, payload) +} + +func (o *HeaderFilterBlockCreateOK) GetPayload() *models.HeaderFilter { + return o.Payload +} + +func (o *HeaderFilterBlockCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HeaderFilter) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewHeaderFilterBlockCreateBadRequest creates a HeaderFilterBlockCreateBadRequest with default headers values +func NewHeaderFilterBlockCreateBadRequest() *HeaderFilterBlockCreateBadRequest { + return &HeaderFilterBlockCreateBadRequest{} +} + +/* +HeaderFilterBlockCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type HeaderFilterBlockCreateBadRequest struct { +} + +// IsSuccess returns true when this header filter block create bad request response has a 2xx status code +func (o *HeaderFilterBlockCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block create bad request response has a 3xx status code +func (o *HeaderFilterBlockCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block create bad request response has a 4xx status code +func (o *HeaderFilterBlockCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block create bad request response has a 5xx status code +func (o *HeaderFilterBlockCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block create bad request response a status code equal to that given +func (o *HeaderFilterBlockCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the header filter block create bad request response +func (o *HeaderFilterBlockCreateBadRequest) Code() int { + return 400 +} + +func (o *HeaderFilterBlockCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/header_blocks][%d] headerFilterBlockCreateBadRequest", 400) +} + +func (o *HeaderFilterBlockCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/header_blocks][%d] headerFilterBlockCreateBadRequest", 400) +} + +func (o *HeaderFilterBlockCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockCreateUnauthorized creates a HeaderFilterBlockCreateUnauthorized with default headers values +func NewHeaderFilterBlockCreateUnauthorized() *HeaderFilterBlockCreateUnauthorized { + return &HeaderFilterBlockCreateUnauthorized{} +} + +/* +HeaderFilterBlockCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type HeaderFilterBlockCreateUnauthorized struct { +} + +// IsSuccess returns true when this header filter block create unauthorized response has a 2xx status code +func (o *HeaderFilterBlockCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block create unauthorized response has a 3xx status code +func (o *HeaderFilterBlockCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block create unauthorized response has a 4xx status code +func (o *HeaderFilterBlockCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block create unauthorized response has a 5xx status code +func (o *HeaderFilterBlockCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block create unauthorized response a status code equal to that given +func (o *HeaderFilterBlockCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the header filter block create unauthorized response +func (o *HeaderFilterBlockCreateUnauthorized) Code() int { + return 401 +} + +func (o *HeaderFilterBlockCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/header_blocks][%d] headerFilterBlockCreateUnauthorized", 401) +} + +func (o *HeaderFilterBlockCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/header_blocks][%d] headerFilterBlockCreateUnauthorized", 401) +} + +func (o *HeaderFilterBlockCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockCreateForbidden creates a HeaderFilterBlockCreateForbidden with default headers values +func NewHeaderFilterBlockCreateForbidden() *HeaderFilterBlockCreateForbidden { + return &HeaderFilterBlockCreateForbidden{} +} + +/* +HeaderFilterBlockCreateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type HeaderFilterBlockCreateForbidden struct { +} + +// IsSuccess returns true when this header filter block create forbidden response has a 2xx status code +func (o *HeaderFilterBlockCreateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block create forbidden response has a 3xx status code +func (o *HeaderFilterBlockCreateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block create forbidden response has a 4xx status code +func (o *HeaderFilterBlockCreateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block create forbidden response has a 5xx status code +func (o *HeaderFilterBlockCreateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block create forbidden response a status code equal to that given +func (o *HeaderFilterBlockCreateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the header filter block create forbidden response +func (o *HeaderFilterBlockCreateForbidden) Code() int { + return 403 +} + +func (o *HeaderFilterBlockCreateForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/header_blocks][%d] headerFilterBlockCreateForbidden", 403) +} + +func (o *HeaderFilterBlockCreateForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/header_blocks][%d] headerFilterBlockCreateForbidden", 403) +} + +func (o *HeaderFilterBlockCreateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockCreateInternalServerError creates a HeaderFilterBlockCreateInternalServerError with default headers values +func NewHeaderFilterBlockCreateInternalServerError() *HeaderFilterBlockCreateInternalServerError { + return &HeaderFilterBlockCreateInternalServerError{} +} + +/* +HeaderFilterBlockCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type HeaderFilterBlockCreateInternalServerError struct { +} + +// IsSuccess returns true when this header filter block create internal server error response has a 2xx status code +func (o *HeaderFilterBlockCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block create internal server error response has a 3xx status code +func (o *HeaderFilterBlockCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block create internal server error response has a 4xx status code +func (o *HeaderFilterBlockCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter block create internal server error response has a 5xx status code +func (o *HeaderFilterBlockCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this header filter block create internal server error response a status code equal to that given +func (o *HeaderFilterBlockCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the header filter block create internal server error response +func (o *HeaderFilterBlockCreateInternalServerError) Code() int { + return 500 +} + +func (o *HeaderFilterBlockCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/header_blocks][%d] headerFilterBlockCreateInternalServerError", 500) +} + +func (o *HeaderFilterBlockCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/header_blocks][%d] headerFilterBlockCreateInternalServerError", 500) +} + +func (o *HeaderFilterBlockCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_block_delete_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_block_delete_parameters.go new file mode 100644 index 0000000..7b22913 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_block_delete_parameters.go @@ -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" +) + +// NewHeaderFilterBlockDeleteParams creates a new HeaderFilterBlockDeleteParams 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 NewHeaderFilterBlockDeleteParams() *HeaderFilterBlockDeleteParams { + return &HeaderFilterBlockDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeaderFilterBlockDeleteParamsWithTimeout creates a new HeaderFilterBlockDeleteParams object +// with the ability to set a timeout on a request. +func NewHeaderFilterBlockDeleteParamsWithTimeout(timeout time.Duration) *HeaderFilterBlockDeleteParams { + return &HeaderFilterBlockDeleteParams{ + timeout: timeout, + } +} + +// NewHeaderFilterBlockDeleteParamsWithContext creates a new HeaderFilterBlockDeleteParams object +// with the ability to set a context for a request. +func NewHeaderFilterBlockDeleteParamsWithContext(ctx context.Context) *HeaderFilterBlockDeleteParams { + return &HeaderFilterBlockDeleteParams{ + Context: ctx, + } +} + +// NewHeaderFilterBlockDeleteParamsWithHTTPClient creates a new HeaderFilterBlockDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeaderFilterBlockDeleteParamsWithHTTPClient(client *http.Client) *HeaderFilterBlockDeleteParams { + return &HeaderFilterBlockDeleteParams{ + HTTPClient: client, + } +} + +/* +HeaderFilterBlockDeleteParams contains all the parameters to send to the API endpoint + + for the header filter block delete operation. + + Typically these are written to a http.Request. +*/ +type HeaderFilterBlockDeleteParams struct { + + /* ID. + + Target header filter ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the header filter block delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterBlockDeleteParams) WithDefaults() *HeaderFilterBlockDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the header filter block delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterBlockDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the header filter block delete params +func (o *HeaderFilterBlockDeleteParams) WithTimeout(timeout time.Duration) *HeaderFilterBlockDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the header filter block delete params +func (o *HeaderFilterBlockDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the header filter block delete params +func (o *HeaderFilterBlockDeleteParams) WithContext(ctx context.Context) *HeaderFilterBlockDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the header filter block delete params +func (o *HeaderFilterBlockDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the header filter block delete params +func (o *HeaderFilterBlockDeleteParams) WithHTTPClient(client *http.Client) *HeaderFilterBlockDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the header filter block delete params +func (o *HeaderFilterBlockDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the header filter block delete params +func (o *HeaderFilterBlockDeleteParams) WithID(id string) *HeaderFilterBlockDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the header filter block delete params +func (o *HeaderFilterBlockDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *HeaderFilterBlockDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_block_delete_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_block_delete_responses.go new file mode 100644 index 0000000..fe533f9 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_block_delete_responses.go @@ -0,0 +1,398 @@ +// 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" +) + +// HeaderFilterBlockDeleteReader is a Reader for the HeaderFilterBlockDelete structure. +type HeaderFilterBlockDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeaderFilterBlockDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewHeaderFilterBlockDeleteAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewHeaderFilterBlockDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewHeaderFilterBlockDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewHeaderFilterBlockDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewHeaderFilterBlockDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewHeaderFilterBlockDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/admin/header_blocks/{id}] headerFilterBlockDelete", response, response.Code()) + } +} + +// NewHeaderFilterBlockDeleteAccepted creates a HeaderFilterBlockDeleteAccepted with default headers values +func NewHeaderFilterBlockDeleteAccepted() *HeaderFilterBlockDeleteAccepted { + return &HeaderFilterBlockDeleteAccepted{} +} + +/* +HeaderFilterBlockDeleteAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type HeaderFilterBlockDeleteAccepted struct { +} + +// IsSuccess returns true when this header filter block delete accepted response has a 2xx status code +func (o *HeaderFilterBlockDeleteAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this header filter block delete accepted response has a 3xx status code +func (o *HeaderFilterBlockDeleteAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block delete accepted response has a 4xx status code +func (o *HeaderFilterBlockDeleteAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter block delete accepted response has a 5xx status code +func (o *HeaderFilterBlockDeleteAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block delete accepted response a status code equal to that given +func (o *HeaderFilterBlockDeleteAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the header filter block delete accepted response +func (o *HeaderFilterBlockDeleteAccepted) Code() int { + return 202 +} + +func (o *HeaderFilterBlockDeleteAccepted) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteAccepted", 202) +} + +func (o *HeaderFilterBlockDeleteAccepted) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteAccepted", 202) +} + +func (o *HeaderFilterBlockDeleteAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockDeleteBadRequest creates a HeaderFilterBlockDeleteBadRequest with default headers values +func NewHeaderFilterBlockDeleteBadRequest() *HeaderFilterBlockDeleteBadRequest { + return &HeaderFilterBlockDeleteBadRequest{} +} + +/* +HeaderFilterBlockDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type HeaderFilterBlockDeleteBadRequest struct { +} + +// IsSuccess returns true when this header filter block delete bad request response has a 2xx status code +func (o *HeaderFilterBlockDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block delete bad request response has a 3xx status code +func (o *HeaderFilterBlockDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block delete bad request response has a 4xx status code +func (o *HeaderFilterBlockDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block delete bad request response has a 5xx status code +func (o *HeaderFilterBlockDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block delete bad request response a status code equal to that given +func (o *HeaderFilterBlockDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the header filter block delete bad request response +func (o *HeaderFilterBlockDeleteBadRequest) Code() int { + return 400 +} + +func (o *HeaderFilterBlockDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteBadRequest", 400) +} + +func (o *HeaderFilterBlockDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteBadRequest", 400) +} + +func (o *HeaderFilterBlockDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockDeleteUnauthorized creates a HeaderFilterBlockDeleteUnauthorized with default headers values +func NewHeaderFilterBlockDeleteUnauthorized() *HeaderFilterBlockDeleteUnauthorized { + return &HeaderFilterBlockDeleteUnauthorized{} +} + +/* +HeaderFilterBlockDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type HeaderFilterBlockDeleteUnauthorized struct { +} + +// IsSuccess returns true when this header filter block delete unauthorized response has a 2xx status code +func (o *HeaderFilterBlockDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block delete unauthorized response has a 3xx status code +func (o *HeaderFilterBlockDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block delete unauthorized response has a 4xx status code +func (o *HeaderFilterBlockDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block delete unauthorized response has a 5xx status code +func (o *HeaderFilterBlockDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block delete unauthorized response a status code equal to that given +func (o *HeaderFilterBlockDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the header filter block delete unauthorized response +func (o *HeaderFilterBlockDeleteUnauthorized) Code() int { + return 401 +} + +func (o *HeaderFilterBlockDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteUnauthorized", 401) +} + +func (o *HeaderFilterBlockDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteUnauthorized", 401) +} + +func (o *HeaderFilterBlockDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockDeleteForbidden creates a HeaderFilterBlockDeleteForbidden with default headers values +func NewHeaderFilterBlockDeleteForbidden() *HeaderFilterBlockDeleteForbidden { + return &HeaderFilterBlockDeleteForbidden{} +} + +/* +HeaderFilterBlockDeleteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type HeaderFilterBlockDeleteForbidden struct { +} + +// IsSuccess returns true when this header filter block delete forbidden response has a 2xx status code +func (o *HeaderFilterBlockDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block delete forbidden response has a 3xx status code +func (o *HeaderFilterBlockDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block delete forbidden response has a 4xx status code +func (o *HeaderFilterBlockDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block delete forbidden response has a 5xx status code +func (o *HeaderFilterBlockDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block delete forbidden response a status code equal to that given +func (o *HeaderFilterBlockDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the header filter block delete forbidden response +func (o *HeaderFilterBlockDeleteForbidden) Code() int { + return 403 +} + +func (o *HeaderFilterBlockDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteForbidden", 403) +} + +func (o *HeaderFilterBlockDeleteForbidden) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteForbidden", 403) +} + +func (o *HeaderFilterBlockDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockDeleteNotFound creates a HeaderFilterBlockDeleteNotFound with default headers values +func NewHeaderFilterBlockDeleteNotFound() *HeaderFilterBlockDeleteNotFound { + return &HeaderFilterBlockDeleteNotFound{} +} + +/* +HeaderFilterBlockDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type HeaderFilterBlockDeleteNotFound struct { +} + +// IsSuccess returns true when this header filter block delete not found response has a 2xx status code +func (o *HeaderFilterBlockDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block delete not found response has a 3xx status code +func (o *HeaderFilterBlockDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block delete not found response has a 4xx status code +func (o *HeaderFilterBlockDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block delete not found response has a 5xx status code +func (o *HeaderFilterBlockDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block delete not found response a status code equal to that given +func (o *HeaderFilterBlockDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the header filter block delete not found response +func (o *HeaderFilterBlockDeleteNotFound) Code() int { + return 404 +} + +func (o *HeaderFilterBlockDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteNotFound", 404) +} + +func (o *HeaderFilterBlockDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteNotFound", 404) +} + +func (o *HeaderFilterBlockDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockDeleteInternalServerError creates a HeaderFilterBlockDeleteInternalServerError with default headers values +func NewHeaderFilterBlockDeleteInternalServerError() *HeaderFilterBlockDeleteInternalServerError { + return &HeaderFilterBlockDeleteInternalServerError{} +} + +/* +HeaderFilterBlockDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type HeaderFilterBlockDeleteInternalServerError struct { +} + +// IsSuccess returns true when this header filter block delete internal server error response has a 2xx status code +func (o *HeaderFilterBlockDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block delete internal server error response has a 3xx status code +func (o *HeaderFilterBlockDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block delete internal server error response has a 4xx status code +func (o *HeaderFilterBlockDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter block delete internal server error response has a 5xx status code +func (o *HeaderFilterBlockDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this header filter block delete internal server error response a status code equal to that given +func (o *HeaderFilterBlockDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the header filter block delete internal server error response +func (o *HeaderFilterBlockDeleteInternalServerError) Code() int { + return 500 +} + +func (o *HeaderFilterBlockDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteInternalServerError", 500) +} + +func (o *HeaderFilterBlockDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteInternalServerError", 500) +} + +func (o *HeaderFilterBlockDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_block_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_block_get_parameters.go new file mode 100644 index 0000000..45a0b37 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_block_get_parameters.go @@ -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" +) + +// NewHeaderFilterBlockGetParams creates a new HeaderFilterBlockGetParams 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 NewHeaderFilterBlockGetParams() *HeaderFilterBlockGetParams { + return &HeaderFilterBlockGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeaderFilterBlockGetParamsWithTimeout creates a new HeaderFilterBlockGetParams object +// with the ability to set a timeout on a request. +func NewHeaderFilterBlockGetParamsWithTimeout(timeout time.Duration) *HeaderFilterBlockGetParams { + return &HeaderFilterBlockGetParams{ + timeout: timeout, + } +} + +// NewHeaderFilterBlockGetParamsWithContext creates a new HeaderFilterBlockGetParams object +// with the ability to set a context for a request. +func NewHeaderFilterBlockGetParamsWithContext(ctx context.Context) *HeaderFilterBlockGetParams { + return &HeaderFilterBlockGetParams{ + Context: ctx, + } +} + +// NewHeaderFilterBlockGetParamsWithHTTPClient creates a new HeaderFilterBlockGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeaderFilterBlockGetParamsWithHTTPClient(client *http.Client) *HeaderFilterBlockGetParams { + return &HeaderFilterBlockGetParams{ + HTTPClient: client, + } +} + +/* +HeaderFilterBlockGetParams contains all the parameters to send to the API endpoint + + for the header filter block get operation. + + Typically these are written to a http.Request. +*/ +type HeaderFilterBlockGetParams struct { + + /* ID. + + Target header filter ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the header filter block get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterBlockGetParams) WithDefaults() *HeaderFilterBlockGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the header filter block get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterBlockGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the header filter block get params +func (o *HeaderFilterBlockGetParams) WithTimeout(timeout time.Duration) *HeaderFilterBlockGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the header filter block get params +func (o *HeaderFilterBlockGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the header filter block get params +func (o *HeaderFilterBlockGetParams) WithContext(ctx context.Context) *HeaderFilterBlockGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the header filter block get params +func (o *HeaderFilterBlockGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the header filter block get params +func (o *HeaderFilterBlockGetParams) WithHTTPClient(client *http.Client) *HeaderFilterBlockGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the header filter block get params +func (o *HeaderFilterBlockGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the header filter block get params +func (o *HeaderFilterBlockGetParams) WithID(id string) *HeaderFilterBlockGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the header filter block get params +func (o *HeaderFilterBlockGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *HeaderFilterBlockGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_block_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_block_get_responses.go new file mode 100644 index 0000000..d4ecc7d --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_block_get_responses.go @@ -0,0 +1,416 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// HeaderFilterBlockGetReader is a Reader for the HeaderFilterBlockGet structure. +type HeaderFilterBlockGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeaderFilterBlockGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeaderFilterBlockGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewHeaderFilterBlockGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewHeaderFilterBlockGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewHeaderFilterBlockGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewHeaderFilterBlockGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewHeaderFilterBlockGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/header_blocks/{id}] headerFilterBlockGet", response, response.Code()) + } +} + +// NewHeaderFilterBlockGetOK creates a HeaderFilterBlockGetOK with default headers values +func NewHeaderFilterBlockGetOK() *HeaderFilterBlockGetOK { + return &HeaderFilterBlockGetOK{} +} + +/* +HeaderFilterBlockGetOK describes a response with status code 200, with default header values. + +The requested "block" header filter. +*/ +type HeaderFilterBlockGetOK struct { + Payload *models.HeaderFilter +} + +// IsSuccess returns true when this header filter block get o k response has a 2xx status code +func (o *HeaderFilterBlockGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this header filter block get o k response has a 3xx status code +func (o *HeaderFilterBlockGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block get o k response has a 4xx status code +func (o *HeaderFilterBlockGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter block get o k response has a 5xx status code +func (o *HeaderFilterBlockGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block get o k response a status code equal to that given +func (o *HeaderFilterBlockGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the header filter block get o k response +func (o *HeaderFilterBlockGetOK) Code() int { + return 200 +} + +func (o *HeaderFilterBlockGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetOK %s", 200, payload) +} + +func (o *HeaderFilterBlockGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetOK %s", 200, payload) +} + +func (o *HeaderFilterBlockGetOK) GetPayload() *models.HeaderFilter { + return o.Payload +} + +func (o *HeaderFilterBlockGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HeaderFilter) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewHeaderFilterBlockGetBadRequest creates a HeaderFilterBlockGetBadRequest with default headers values +func NewHeaderFilterBlockGetBadRequest() *HeaderFilterBlockGetBadRequest { + return &HeaderFilterBlockGetBadRequest{} +} + +/* +HeaderFilterBlockGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type HeaderFilterBlockGetBadRequest struct { +} + +// IsSuccess returns true when this header filter block get bad request response has a 2xx status code +func (o *HeaderFilterBlockGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block get bad request response has a 3xx status code +func (o *HeaderFilterBlockGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block get bad request response has a 4xx status code +func (o *HeaderFilterBlockGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block get bad request response has a 5xx status code +func (o *HeaderFilterBlockGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block get bad request response a status code equal to that given +func (o *HeaderFilterBlockGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the header filter block get bad request response +func (o *HeaderFilterBlockGetBadRequest) Code() int { + return 400 +} + +func (o *HeaderFilterBlockGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetBadRequest", 400) +} + +func (o *HeaderFilterBlockGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetBadRequest", 400) +} + +func (o *HeaderFilterBlockGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockGetUnauthorized creates a HeaderFilterBlockGetUnauthorized with default headers values +func NewHeaderFilterBlockGetUnauthorized() *HeaderFilterBlockGetUnauthorized { + return &HeaderFilterBlockGetUnauthorized{} +} + +/* +HeaderFilterBlockGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type HeaderFilterBlockGetUnauthorized struct { +} + +// IsSuccess returns true when this header filter block get unauthorized response has a 2xx status code +func (o *HeaderFilterBlockGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block get unauthorized response has a 3xx status code +func (o *HeaderFilterBlockGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block get unauthorized response has a 4xx status code +func (o *HeaderFilterBlockGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block get unauthorized response has a 5xx status code +func (o *HeaderFilterBlockGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block get unauthorized response a status code equal to that given +func (o *HeaderFilterBlockGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the header filter block get unauthorized response +func (o *HeaderFilterBlockGetUnauthorized) Code() int { + return 401 +} + +func (o *HeaderFilterBlockGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetUnauthorized", 401) +} + +func (o *HeaderFilterBlockGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetUnauthorized", 401) +} + +func (o *HeaderFilterBlockGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockGetForbidden creates a HeaderFilterBlockGetForbidden with default headers values +func NewHeaderFilterBlockGetForbidden() *HeaderFilterBlockGetForbidden { + return &HeaderFilterBlockGetForbidden{} +} + +/* +HeaderFilterBlockGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type HeaderFilterBlockGetForbidden struct { +} + +// IsSuccess returns true when this header filter block get forbidden response has a 2xx status code +func (o *HeaderFilterBlockGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block get forbidden response has a 3xx status code +func (o *HeaderFilterBlockGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block get forbidden response has a 4xx status code +func (o *HeaderFilterBlockGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block get forbidden response has a 5xx status code +func (o *HeaderFilterBlockGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block get forbidden response a status code equal to that given +func (o *HeaderFilterBlockGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the header filter block get forbidden response +func (o *HeaderFilterBlockGetForbidden) Code() int { + return 403 +} + +func (o *HeaderFilterBlockGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetForbidden", 403) +} + +func (o *HeaderFilterBlockGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetForbidden", 403) +} + +func (o *HeaderFilterBlockGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockGetNotFound creates a HeaderFilterBlockGetNotFound with default headers values +func NewHeaderFilterBlockGetNotFound() *HeaderFilterBlockGetNotFound { + return &HeaderFilterBlockGetNotFound{} +} + +/* +HeaderFilterBlockGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type HeaderFilterBlockGetNotFound struct { +} + +// IsSuccess returns true when this header filter block get not found response has a 2xx status code +func (o *HeaderFilterBlockGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block get not found response has a 3xx status code +func (o *HeaderFilterBlockGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block get not found response has a 4xx status code +func (o *HeaderFilterBlockGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block get not found response has a 5xx status code +func (o *HeaderFilterBlockGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block get not found response a status code equal to that given +func (o *HeaderFilterBlockGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the header filter block get not found response +func (o *HeaderFilterBlockGetNotFound) Code() int { + return 404 +} + +func (o *HeaderFilterBlockGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetNotFound", 404) +} + +func (o *HeaderFilterBlockGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetNotFound", 404) +} + +func (o *HeaderFilterBlockGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockGetInternalServerError creates a HeaderFilterBlockGetInternalServerError with default headers values +func NewHeaderFilterBlockGetInternalServerError() *HeaderFilterBlockGetInternalServerError { + return &HeaderFilterBlockGetInternalServerError{} +} + +/* +HeaderFilterBlockGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type HeaderFilterBlockGetInternalServerError struct { +} + +// IsSuccess returns true when this header filter block get internal server error response has a 2xx status code +func (o *HeaderFilterBlockGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block get internal server error response has a 3xx status code +func (o *HeaderFilterBlockGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block get internal server error response has a 4xx status code +func (o *HeaderFilterBlockGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter block get internal server error response has a 5xx status code +func (o *HeaderFilterBlockGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this header filter block get internal server error response a status code equal to that given +func (o *HeaderFilterBlockGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the header filter block get internal server error response +func (o *HeaderFilterBlockGetInternalServerError) Code() int { + return 500 +} + +func (o *HeaderFilterBlockGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetInternalServerError", 500) +} + +func (o *HeaderFilterBlockGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetInternalServerError", 500) +} + +func (o *HeaderFilterBlockGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_blocks_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_blocks_get_parameters.go new file mode 100644 index 0000000..989801b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_blocks_get_parameters.go @@ -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" +) + +// NewHeaderFilterBlocksGetParams creates a new HeaderFilterBlocksGetParams 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 NewHeaderFilterBlocksGetParams() *HeaderFilterBlocksGetParams { + return &HeaderFilterBlocksGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeaderFilterBlocksGetParamsWithTimeout creates a new HeaderFilterBlocksGetParams object +// with the ability to set a timeout on a request. +func NewHeaderFilterBlocksGetParamsWithTimeout(timeout time.Duration) *HeaderFilterBlocksGetParams { + return &HeaderFilterBlocksGetParams{ + timeout: timeout, + } +} + +// NewHeaderFilterBlocksGetParamsWithContext creates a new HeaderFilterBlocksGetParams object +// with the ability to set a context for a request. +func NewHeaderFilterBlocksGetParamsWithContext(ctx context.Context) *HeaderFilterBlocksGetParams { + return &HeaderFilterBlocksGetParams{ + Context: ctx, + } +} + +// NewHeaderFilterBlocksGetParamsWithHTTPClient creates a new HeaderFilterBlocksGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeaderFilterBlocksGetParamsWithHTTPClient(client *http.Client) *HeaderFilterBlocksGetParams { + return &HeaderFilterBlocksGetParams{ + HTTPClient: client, + } +} + +/* +HeaderFilterBlocksGetParams contains all the parameters to send to the API endpoint + + for the header filter blocks get operation. + + Typically these are written to a http.Request. +*/ +type HeaderFilterBlocksGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the header filter blocks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterBlocksGetParams) WithDefaults() *HeaderFilterBlocksGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the header filter blocks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterBlocksGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the header filter blocks get params +func (o *HeaderFilterBlocksGetParams) WithTimeout(timeout time.Duration) *HeaderFilterBlocksGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the header filter blocks get params +func (o *HeaderFilterBlocksGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the header filter blocks get params +func (o *HeaderFilterBlocksGetParams) WithContext(ctx context.Context) *HeaderFilterBlocksGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the header filter blocks get params +func (o *HeaderFilterBlocksGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the header filter blocks get params +func (o *HeaderFilterBlocksGetParams) WithHTTPClient(client *http.Client) *HeaderFilterBlocksGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the header filter blocks get params +func (o *HeaderFilterBlocksGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *HeaderFilterBlocksGetParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_blocks_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_blocks_get_responses.go new file mode 100644 index 0000000..5d63ccc --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/header_filter_blocks_get_responses.go @@ -0,0 +1,414 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// HeaderFilterBlocksGetReader is a Reader for the HeaderFilterBlocksGet structure. +type HeaderFilterBlocksGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeaderFilterBlocksGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeaderFilterBlocksGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewHeaderFilterBlocksGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewHeaderFilterBlocksGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewHeaderFilterBlocksGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewHeaderFilterBlocksGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewHeaderFilterBlocksGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/header_blocks] headerFilterBlocksGet", response, response.Code()) + } +} + +// NewHeaderFilterBlocksGetOK creates a HeaderFilterBlocksGetOK with default headers values +func NewHeaderFilterBlocksGetOK() *HeaderFilterBlocksGetOK { + return &HeaderFilterBlocksGetOK{} +} + +/* +HeaderFilterBlocksGetOK describes a response with status code 200, with default header values. + +All "block" header filters currently in place. +*/ +type HeaderFilterBlocksGetOK struct { + Payload []*models.HeaderFilter +} + +// IsSuccess returns true when this header filter blocks get o k response has a 2xx status code +func (o *HeaderFilterBlocksGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this header filter blocks get o k response has a 3xx status code +func (o *HeaderFilterBlocksGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter blocks get o k response has a 4xx status code +func (o *HeaderFilterBlocksGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter blocks get o k response has a 5xx status code +func (o *HeaderFilterBlocksGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter blocks get o k response a status code equal to that given +func (o *HeaderFilterBlocksGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the header filter blocks get o k response +func (o *HeaderFilterBlocksGetOK) Code() int { + return 200 +} + +func (o *HeaderFilterBlocksGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetOK %s", 200, payload) +} + +func (o *HeaderFilterBlocksGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetOK %s", 200, payload) +} + +func (o *HeaderFilterBlocksGetOK) GetPayload() []*models.HeaderFilter { + return o.Payload +} + +func (o *HeaderFilterBlocksGetOK) 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 +} + +// NewHeaderFilterBlocksGetBadRequest creates a HeaderFilterBlocksGetBadRequest with default headers values +func NewHeaderFilterBlocksGetBadRequest() *HeaderFilterBlocksGetBadRequest { + return &HeaderFilterBlocksGetBadRequest{} +} + +/* +HeaderFilterBlocksGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type HeaderFilterBlocksGetBadRequest struct { +} + +// IsSuccess returns true when this header filter blocks get bad request response has a 2xx status code +func (o *HeaderFilterBlocksGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter blocks get bad request response has a 3xx status code +func (o *HeaderFilterBlocksGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter blocks get bad request response has a 4xx status code +func (o *HeaderFilterBlocksGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter blocks get bad request response has a 5xx status code +func (o *HeaderFilterBlocksGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter blocks get bad request response a status code equal to that given +func (o *HeaderFilterBlocksGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the header filter blocks get bad request response +func (o *HeaderFilterBlocksGetBadRequest) Code() int { + return 400 +} + +func (o *HeaderFilterBlocksGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetBadRequest", 400) +} + +func (o *HeaderFilterBlocksGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetBadRequest", 400) +} + +func (o *HeaderFilterBlocksGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlocksGetUnauthorized creates a HeaderFilterBlocksGetUnauthorized with default headers values +func NewHeaderFilterBlocksGetUnauthorized() *HeaderFilterBlocksGetUnauthorized { + return &HeaderFilterBlocksGetUnauthorized{} +} + +/* +HeaderFilterBlocksGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type HeaderFilterBlocksGetUnauthorized struct { +} + +// IsSuccess returns true when this header filter blocks get unauthorized response has a 2xx status code +func (o *HeaderFilterBlocksGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter blocks get unauthorized response has a 3xx status code +func (o *HeaderFilterBlocksGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter blocks get unauthorized response has a 4xx status code +func (o *HeaderFilterBlocksGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter blocks get unauthorized response has a 5xx status code +func (o *HeaderFilterBlocksGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter blocks get unauthorized response a status code equal to that given +func (o *HeaderFilterBlocksGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the header filter blocks get unauthorized response +func (o *HeaderFilterBlocksGetUnauthorized) Code() int { + return 401 +} + +func (o *HeaderFilterBlocksGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetUnauthorized", 401) +} + +func (o *HeaderFilterBlocksGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetUnauthorized", 401) +} + +func (o *HeaderFilterBlocksGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlocksGetForbidden creates a HeaderFilterBlocksGetForbidden with default headers values +func NewHeaderFilterBlocksGetForbidden() *HeaderFilterBlocksGetForbidden { + return &HeaderFilterBlocksGetForbidden{} +} + +/* +HeaderFilterBlocksGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type HeaderFilterBlocksGetForbidden struct { +} + +// IsSuccess returns true when this header filter blocks get forbidden response has a 2xx status code +func (o *HeaderFilterBlocksGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter blocks get forbidden response has a 3xx status code +func (o *HeaderFilterBlocksGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter blocks get forbidden response has a 4xx status code +func (o *HeaderFilterBlocksGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter blocks get forbidden response has a 5xx status code +func (o *HeaderFilterBlocksGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter blocks get forbidden response a status code equal to that given +func (o *HeaderFilterBlocksGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the header filter blocks get forbidden response +func (o *HeaderFilterBlocksGetForbidden) Code() int { + return 403 +} + +func (o *HeaderFilterBlocksGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetForbidden", 403) +} + +func (o *HeaderFilterBlocksGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetForbidden", 403) +} + +func (o *HeaderFilterBlocksGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlocksGetNotFound creates a HeaderFilterBlocksGetNotFound with default headers values +func NewHeaderFilterBlocksGetNotFound() *HeaderFilterBlocksGetNotFound { + return &HeaderFilterBlocksGetNotFound{} +} + +/* +HeaderFilterBlocksGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type HeaderFilterBlocksGetNotFound struct { +} + +// IsSuccess returns true when this header filter blocks get not found response has a 2xx status code +func (o *HeaderFilterBlocksGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter blocks get not found response has a 3xx status code +func (o *HeaderFilterBlocksGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter blocks get not found response has a 4xx status code +func (o *HeaderFilterBlocksGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter blocks get not found response has a 5xx status code +func (o *HeaderFilterBlocksGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter blocks get not found response a status code equal to that given +func (o *HeaderFilterBlocksGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the header filter blocks get not found response +func (o *HeaderFilterBlocksGetNotFound) Code() int { + return 404 +} + +func (o *HeaderFilterBlocksGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetNotFound", 404) +} + +func (o *HeaderFilterBlocksGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetNotFound", 404) +} + +func (o *HeaderFilterBlocksGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlocksGetInternalServerError creates a HeaderFilterBlocksGetInternalServerError with default headers values +func NewHeaderFilterBlocksGetInternalServerError() *HeaderFilterBlocksGetInternalServerError { + return &HeaderFilterBlocksGetInternalServerError{} +} + +/* +HeaderFilterBlocksGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type HeaderFilterBlocksGetInternalServerError struct { +} + +// IsSuccess returns true when this header filter blocks get internal server error response has a 2xx status code +func (o *HeaderFilterBlocksGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter blocks get internal server error response has a 3xx status code +func (o *HeaderFilterBlocksGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter blocks get internal server error response has a 4xx status code +func (o *HeaderFilterBlocksGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter blocks get internal server error response has a 5xx status code +func (o *HeaderFilterBlocksGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this header filter blocks get internal server error response a status code equal to that given +func (o *HeaderFilterBlocksGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the header filter blocks get internal server error response +func (o *HeaderFilterBlocksGetInternalServerError) Code() int { + return 500 +} + +func (o *HeaderFilterBlocksGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetInternalServerError", 500) +} + +func (o *HeaderFilterBlocksGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetInternalServerError", 500) +} + +func (o *HeaderFilterBlocksGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/media_cleanup_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/media_cleanup_parameters.go new file mode 100644 index 0000000..16b6b72 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/media_cleanup_parameters.go @@ -0,0 +1,167 @@ +// 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" +) + +// NewMediaCleanupParams creates a new MediaCleanupParams 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 NewMediaCleanupParams() *MediaCleanupParams { + return &MediaCleanupParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMediaCleanupParamsWithTimeout creates a new MediaCleanupParams object +// with the ability to set a timeout on a request. +func NewMediaCleanupParamsWithTimeout(timeout time.Duration) *MediaCleanupParams { + return &MediaCleanupParams{ + timeout: timeout, + } +} + +// NewMediaCleanupParamsWithContext creates a new MediaCleanupParams object +// with the ability to set a context for a request. +func NewMediaCleanupParamsWithContext(ctx context.Context) *MediaCleanupParams { + return &MediaCleanupParams{ + Context: ctx, + } +} + +// NewMediaCleanupParamsWithHTTPClient creates a new MediaCleanupParams object +// with the ability to set a custom HTTPClient for a request. +func NewMediaCleanupParamsWithHTTPClient(client *http.Client) *MediaCleanupParams { + return &MediaCleanupParams{ + HTTPClient: client, + } +} + +/* +MediaCleanupParams contains all the parameters to send to the API endpoint + + for the media cleanup operation. + + Typically these are written to a http.Request. +*/ +type MediaCleanupParams struct { + + /* RemoteCacheDays. + + Number of days of remote media to keep. Native values will be treated as 0. + If value is not specified, the value of media-remote-cache-days in the server config will be used. + + Format: int64 + */ + RemoteCacheDays *int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the media cleanup params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MediaCleanupParams) WithDefaults() *MediaCleanupParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the media cleanup params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MediaCleanupParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the media cleanup params +func (o *MediaCleanupParams) WithTimeout(timeout time.Duration) *MediaCleanupParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the media cleanup params +func (o *MediaCleanupParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the media cleanup params +func (o *MediaCleanupParams) WithContext(ctx context.Context) *MediaCleanupParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the media cleanup params +func (o *MediaCleanupParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the media cleanup params +func (o *MediaCleanupParams) WithHTTPClient(client *http.Client) *MediaCleanupParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the media cleanup params +func (o *MediaCleanupParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithRemoteCacheDays adds the remoteCacheDays to the media cleanup params +func (o *MediaCleanupParams) WithRemoteCacheDays(remoteCacheDays *int64) *MediaCleanupParams { + o.SetRemoteCacheDays(remoteCacheDays) + return o +} + +// SetRemoteCacheDays adds the remoteCacheDays to the media cleanup params +func (o *MediaCleanupParams) SetRemoteCacheDays(remoteCacheDays *int64) { + o.RemoteCacheDays = remoteCacheDays +} + +// WriteToRequest writes these params to a swagger request +func (o *MediaCleanupParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.RemoteCacheDays != nil { + + // query param remote_cache_days + var qrRemoteCacheDays int64 + + if o.RemoteCacheDays != nil { + qrRemoteCacheDays = *o.RemoteCacheDays + } + qRemoteCacheDays := swag.FormatInt64(qrRemoteCacheDays) + if qRemoteCacheDays != "" { + + if err := r.SetQueryParam("remote_cache_days", qRemoteCacheDays); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/media_cleanup_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/media_cleanup_responses.go new file mode 100644 index 0000000..d2b0a24 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/media_cleanup_responses.go @@ -0,0 +1,460 @@ +// 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" +) + +// MediaCleanupReader is a Reader for the MediaCleanup structure. +type MediaCleanupReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MediaCleanupReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMediaCleanupOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewMediaCleanupBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewMediaCleanupUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewMediaCleanupForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewMediaCleanupNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewMediaCleanupNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewMediaCleanupInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/media_cleanup] mediaCleanup", response, response.Code()) + } +} + +// NewMediaCleanupOK creates a MediaCleanupOK with default headers values +func NewMediaCleanupOK() *MediaCleanupOK { + return &MediaCleanupOK{} +} + +/* +MediaCleanupOK describes a response with status code 200, with default header values. + +Echos the number of days requested. The cleanup is performed asynchronously after the request completes. +*/ +type MediaCleanupOK struct { +} + +// IsSuccess returns true when this media cleanup o k response has a 2xx status code +func (o *MediaCleanupOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this media cleanup o k response has a 3xx status code +func (o *MediaCleanupOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media cleanup o k response has a 4xx status code +func (o *MediaCleanupOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this media cleanup o k response has a 5xx status code +func (o *MediaCleanupOK) IsServerError() bool { + return false +} + +// IsCode returns true when this media cleanup o k response a status code equal to that given +func (o *MediaCleanupOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the media cleanup o k response +func (o *MediaCleanupOK) Code() int { + return 200 +} + +func (o *MediaCleanupOK) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupOK", 200) +} + +func (o *MediaCleanupOK) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupOK", 200) +} + +func (o *MediaCleanupOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaCleanupBadRequest creates a MediaCleanupBadRequest with default headers values +func NewMediaCleanupBadRequest() *MediaCleanupBadRequest { + return &MediaCleanupBadRequest{} +} + +/* +MediaCleanupBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type MediaCleanupBadRequest struct { +} + +// IsSuccess returns true when this media cleanup bad request response has a 2xx status code +func (o *MediaCleanupBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media cleanup bad request response has a 3xx status code +func (o *MediaCleanupBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media cleanup bad request response has a 4xx status code +func (o *MediaCleanupBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this media cleanup bad request response has a 5xx status code +func (o *MediaCleanupBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this media cleanup bad request response a status code equal to that given +func (o *MediaCleanupBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the media cleanup bad request response +func (o *MediaCleanupBadRequest) Code() int { + return 400 +} + +func (o *MediaCleanupBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupBadRequest", 400) +} + +func (o *MediaCleanupBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupBadRequest", 400) +} + +func (o *MediaCleanupBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaCleanupUnauthorized creates a MediaCleanupUnauthorized with default headers values +func NewMediaCleanupUnauthorized() *MediaCleanupUnauthorized { + return &MediaCleanupUnauthorized{} +} + +/* +MediaCleanupUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type MediaCleanupUnauthorized struct { +} + +// IsSuccess returns true when this media cleanup unauthorized response has a 2xx status code +func (o *MediaCleanupUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media cleanup unauthorized response has a 3xx status code +func (o *MediaCleanupUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media cleanup unauthorized response has a 4xx status code +func (o *MediaCleanupUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this media cleanup unauthorized response has a 5xx status code +func (o *MediaCleanupUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this media cleanup unauthorized response a status code equal to that given +func (o *MediaCleanupUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the media cleanup unauthorized response +func (o *MediaCleanupUnauthorized) Code() int { + return 401 +} + +func (o *MediaCleanupUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupUnauthorized", 401) +} + +func (o *MediaCleanupUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupUnauthorized", 401) +} + +func (o *MediaCleanupUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaCleanupForbidden creates a MediaCleanupForbidden with default headers values +func NewMediaCleanupForbidden() *MediaCleanupForbidden { + return &MediaCleanupForbidden{} +} + +/* +MediaCleanupForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type MediaCleanupForbidden struct { +} + +// IsSuccess returns true when this media cleanup forbidden response has a 2xx status code +func (o *MediaCleanupForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media cleanup forbidden response has a 3xx status code +func (o *MediaCleanupForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media cleanup forbidden response has a 4xx status code +func (o *MediaCleanupForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this media cleanup forbidden response has a 5xx status code +func (o *MediaCleanupForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this media cleanup forbidden response a status code equal to that given +func (o *MediaCleanupForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the media cleanup forbidden response +func (o *MediaCleanupForbidden) Code() int { + return 403 +} + +func (o *MediaCleanupForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupForbidden", 403) +} + +func (o *MediaCleanupForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupForbidden", 403) +} + +func (o *MediaCleanupForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaCleanupNotFound creates a MediaCleanupNotFound with default headers values +func NewMediaCleanupNotFound() *MediaCleanupNotFound { + return &MediaCleanupNotFound{} +} + +/* +MediaCleanupNotFound describes a response with status code 404, with default header values. + +not found +*/ +type MediaCleanupNotFound struct { +} + +// IsSuccess returns true when this media cleanup not found response has a 2xx status code +func (o *MediaCleanupNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media cleanup not found response has a 3xx status code +func (o *MediaCleanupNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media cleanup not found response has a 4xx status code +func (o *MediaCleanupNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this media cleanup not found response has a 5xx status code +func (o *MediaCleanupNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this media cleanup not found response a status code equal to that given +func (o *MediaCleanupNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the media cleanup not found response +func (o *MediaCleanupNotFound) Code() int { + return 404 +} + +func (o *MediaCleanupNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupNotFound", 404) +} + +func (o *MediaCleanupNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupNotFound", 404) +} + +func (o *MediaCleanupNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaCleanupNotAcceptable creates a MediaCleanupNotAcceptable with default headers values +func NewMediaCleanupNotAcceptable() *MediaCleanupNotAcceptable { + return &MediaCleanupNotAcceptable{} +} + +/* +MediaCleanupNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type MediaCleanupNotAcceptable struct { +} + +// IsSuccess returns true when this media cleanup not acceptable response has a 2xx status code +func (o *MediaCleanupNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media cleanup not acceptable response has a 3xx status code +func (o *MediaCleanupNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media cleanup not acceptable response has a 4xx status code +func (o *MediaCleanupNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this media cleanup not acceptable response has a 5xx status code +func (o *MediaCleanupNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this media cleanup not acceptable response a status code equal to that given +func (o *MediaCleanupNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the media cleanup not acceptable response +func (o *MediaCleanupNotAcceptable) Code() int { + return 406 +} + +func (o *MediaCleanupNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupNotAcceptable", 406) +} + +func (o *MediaCleanupNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupNotAcceptable", 406) +} + +func (o *MediaCleanupNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaCleanupInternalServerError creates a MediaCleanupInternalServerError with default headers values +func NewMediaCleanupInternalServerError() *MediaCleanupInternalServerError { + return &MediaCleanupInternalServerError{} +} + +/* +MediaCleanupInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type MediaCleanupInternalServerError struct { +} + +// IsSuccess returns true when this media cleanup internal server error response has a 2xx status code +func (o *MediaCleanupInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media cleanup internal server error response has a 3xx status code +func (o *MediaCleanupInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media cleanup internal server error response has a 4xx status code +func (o *MediaCleanupInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this media cleanup internal server error response has a 5xx status code +func (o *MediaCleanupInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this media cleanup internal server error response a status code equal to that given +func (o *MediaCleanupInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the media cleanup internal server error response +func (o *MediaCleanupInternalServerError) Code() int { + return 500 +} + +func (o *MediaCleanupInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupInternalServerError", 500) +} + +func (o *MediaCleanupInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupInternalServerError", 500) +} + +func (o *MediaCleanupInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/media_refetch_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/media_refetch_parameters.go new file mode 100644 index 0000000..e706909 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/media_refetch_parameters.go @@ -0,0 +1,163 @@ +// 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" +) + +// NewMediaRefetchParams creates a new MediaRefetchParams 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 NewMediaRefetchParams() *MediaRefetchParams { + return &MediaRefetchParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMediaRefetchParamsWithTimeout creates a new MediaRefetchParams object +// with the ability to set a timeout on a request. +func NewMediaRefetchParamsWithTimeout(timeout time.Duration) *MediaRefetchParams { + return &MediaRefetchParams{ + timeout: timeout, + } +} + +// NewMediaRefetchParamsWithContext creates a new MediaRefetchParams object +// with the ability to set a context for a request. +func NewMediaRefetchParamsWithContext(ctx context.Context) *MediaRefetchParams { + return &MediaRefetchParams{ + Context: ctx, + } +} + +// NewMediaRefetchParamsWithHTTPClient creates a new MediaRefetchParams object +// with the ability to set a custom HTTPClient for a request. +func NewMediaRefetchParamsWithHTTPClient(client *http.Client) *MediaRefetchParams { + return &MediaRefetchParams{ + HTTPClient: client, + } +} + +/* +MediaRefetchParams contains all the parameters to send to the API endpoint + + for the media refetch operation. + + Typically these are written to a http.Request. +*/ +type MediaRefetchParams struct { + + /* Domain. + + Domain to refetch media from. If empty, all domains will be refetched. + */ + Domain *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the media refetch params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MediaRefetchParams) WithDefaults() *MediaRefetchParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the media refetch params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MediaRefetchParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the media refetch params +func (o *MediaRefetchParams) WithTimeout(timeout time.Duration) *MediaRefetchParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the media refetch params +func (o *MediaRefetchParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the media refetch params +func (o *MediaRefetchParams) WithContext(ctx context.Context) *MediaRefetchParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the media refetch params +func (o *MediaRefetchParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the media refetch params +func (o *MediaRefetchParams) WithHTTPClient(client *http.Client) *MediaRefetchParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the media refetch params +func (o *MediaRefetchParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDomain adds the domain to the media refetch params +func (o *MediaRefetchParams) WithDomain(domain *string) *MediaRefetchParams { + o.SetDomain(domain) + return o +} + +// SetDomain adds the domain to the media refetch params +func (o *MediaRefetchParams) SetDomain(domain *string) { + o.Domain = domain +} + +// WriteToRequest writes these params to a swagger request +func (o *MediaRefetchParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Domain != nil { + + // query param domain + var qrDomain string + + if o.Domain != nil { + qrDomain = *o.Domain + } + qDomain := qrDomain + if qDomain != "" { + + if err := r.SetQueryParam("domain", qDomain); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/media_refetch_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/media_refetch_responses.go new file mode 100644 index 0000000..993ffd2 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/media_refetch_responses.go @@ -0,0 +1,460 @@ +// 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" +) + +// MediaRefetchReader is a Reader for the MediaRefetch structure. +type MediaRefetchReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MediaRefetchReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewMediaRefetchAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewMediaRefetchBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewMediaRefetchUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewMediaRefetchForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewMediaRefetchNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewMediaRefetchNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewMediaRefetchInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/media_refetch] mediaRefetch", response, response.Code()) + } +} + +// NewMediaRefetchAccepted creates a MediaRefetchAccepted with default headers values +func NewMediaRefetchAccepted() *MediaRefetchAccepted { + return &MediaRefetchAccepted{} +} + +/* +MediaRefetchAccepted describes a response with status code 202, with default header values. + +Request accepted and will be processed. Check the logs for progress / errors. +*/ +type MediaRefetchAccepted struct { +} + +// IsSuccess returns true when this media refetch accepted response has a 2xx status code +func (o *MediaRefetchAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this media refetch accepted response has a 3xx status code +func (o *MediaRefetchAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media refetch accepted response has a 4xx status code +func (o *MediaRefetchAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this media refetch accepted response has a 5xx status code +func (o *MediaRefetchAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this media refetch accepted response a status code equal to that given +func (o *MediaRefetchAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the media refetch accepted response +func (o *MediaRefetchAccepted) Code() int { + return 202 +} + +func (o *MediaRefetchAccepted) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchAccepted", 202) +} + +func (o *MediaRefetchAccepted) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchAccepted", 202) +} + +func (o *MediaRefetchAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaRefetchBadRequest creates a MediaRefetchBadRequest with default headers values +func NewMediaRefetchBadRequest() *MediaRefetchBadRequest { + return &MediaRefetchBadRequest{} +} + +/* +MediaRefetchBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type MediaRefetchBadRequest struct { +} + +// IsSuccess returns true when this media refetch bad request response has a 2xx status code +func (o *MediaRefetchBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media refetch bad request response has a 3xx status code +func (o *MediaRefetchBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media refetch bad request response has a 4xx status code +func (o *MediaRefetchBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this media refetch bad request response has a 5xx status code +func (o *MediaRefetchBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this media refetch bad request response a status code equal to that given +func (o *MediaRefetchBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the media refetch bad request response +func (o *MediaRefetchBadRequest) Code() int { + return 400 +} + +func (o *MediaRefetchBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchBadRequest", 400) +} + +func (o *MediaRefetchBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchBadRequest", 400) +} + +func (o *MediaRefetchBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaRefetchUnauthorized creates a MediaRefetchUnauthorized with default headers values +func NewMediaRefetchUnauthorized() *MediaRefetchUnauthorized { + return &MediaRefetchUnauthorized{} +} + +/* +MediaRefetchUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type MediaRefetchUnauthorized struct { +} + +// IsSuccess returns true when this media refetch unauthorized response has a 2xx status code +func (o *MediaRefetchUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media refetch unauthorized response has a 3xx status code +func (o *MediaRefetchUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media refetch unauthorized response has a 4xx status code +func (o *MediaRefetchUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this media refetch unauthorized response has a 5xx status code +func (o *MediaRefetchUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this media refetch unauthorized response a status code equal to that given +func (o *MediaRefetchUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the media refetch unauthorized response +func (o *MediaRefetchUnauthorized) Code() int { + return 401 +} + +func (o *MediaRefetchUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchUnauthorized", 401) +} + +func (o *MediaRefetchUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchUnauthorized", 401) +} + +func (o *MediaRefetchUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaRefetchForbidden creates a MediaRefetchForbidden with default headers values +func NewMediaRefetchForbidden() *MediaRefetchForbidden { + return &MediaRefetchForbidden{} +} + +/* +MediaRefetchForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type MediaRefetchForbidden struct { +} + +// IsSuccess returns true when this media refetch forbidden response has a 2xx status code +func (o *MediaRefetchForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media refetch forbidden response has a 3xx status code +func (o *MediaRefetchForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media refetch forbidden response has a 4xx status code +func (o *MediaRefetchForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this media refetch forbidden response has a 5xx status code +func (o *MediaRefetchForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this media refetch forbidden response a status code equal to that given +func (o *MediaRefetchForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the media refetch forbidden response +func (o *MediaRefetchForbidden) Code() int { + return 403 +} + +func (o *MediaRefetchForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchForbidden", 403) +} + +func (o *MediaRefetchForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchForbidden", 403) +} + +func (o *MediaRefetchForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaRefetchNotFound creates a MediaRefetchNotFound with default headers values +func NewMediaRefetchNotFound() *MediaRefetchNotFound { + return &MediaRefetchNotFound{} +} + +/* +MediaRefetchNotFound describes a response with status code 404, with default header values. + +not found +*/ +type MediaRefetchNotFound struct { +} + +// IsSuccess returns true when this media refetch not found response has a 2xx status code +func (o *MediaRefetchNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media refetch not found response has a 3xx status code +func (o *MediaRefetchNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media refetch not found response has a 4xx status code +func (o *MediaRefetchNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this media refetch not found response has a 5xx status code +func (o *MediaRefetchNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this media refetch not found response a status code equal to that given +func (o *MediaRefetchNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the media refetch not found response +func (o *MediaRefetchNotFound) Code() int { + return 404 +} + +func (o *MediaRefetchNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchNotFound", 404) +} + +func (o *MediaRefetchNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchNotFound", 404) +} + +func (o *MediaRefetchNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaRefetchNotAcceptable creates a MediaRefetchNotAcceptable with default headers values +func NewMediaRefetchNotAcceptable() *MediaRefetchNotAcceptable { + return &MediaRefetchNotAcceptable{} +} + +/* +MediaRefetchNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type MediaRefetchNotAcceptable struct { +} + +// IsSuccess returns true when this media refetch not acceptable response has a 2xx status code +func (o *MediaRefetchNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media refetch not acceptable response has a 3xx status code +func (o *MediaRefetchNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media refetch not acceptable response has a 4xx status code +func (o *MediaRefetchNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this media refetch not acceptable response has a 5xx status code +func (o *MediaRefetchNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this media refetch not acceptable response a status code equal to that given +func (o *MediaRefetchNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the media refetch not acceptable response +func (o *MediaRefetchNotAcceptable) Code() int { + return 406 +} + +func (o *MediaRefetchNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchNotAcceptable", 406) +} + +func (o *MediaRefetchNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchNotAcceptable", 406) +} + +func (o *MediaRefetchNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaRefetchInternalServerError creates a MediaRefetchInternalServerError with default headers values +func NewMediaRefetchInternalServerError() *MediaRefetchInternalServerError { + return &MediaRefetchInternalServerError{} +} + +/* +MediaRefetchInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type MediaRefetchInternalServerError struct { +} + +// IsSuccess returns true when this media refetch internal server error response has a 2xx status code +func (o *MediaRefetchInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media refetch internal server error response has a 3xx status code +func (o *MediaRefetchInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media refetch internal server error response has a 4xx status code +func (o *MediaRefetchInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this media refetch internal server error response has a 5xx status code +func (o *MediaRefetchInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this media refetch internal server error response a status code equal to that given +func (o *MediaRefetchInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the media refetch internal server error response +func (o *MediaRefetchInternalServerError) Code() int { + return 500 +} + +func (o *MediaRefetchInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchInternalServerError", 500) +} + +func (o *MediaRefetchInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchInternalServerError", 500) +} + +func (o *MediaRefetchInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/rule_create_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/rule_create_parameters.go new file mode 100644 index 0000000..6f729da --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/rule_create_parameters.go @@ -0,0 +1,155 @@ +// 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" +) + +// NewRuleCreateParams creates a new RuleCreateParams 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 NewRuleCreateParams() *RuleCreateParams { + return &RuleCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewRuleCreateParamsWithTimeout creates a new RuleCreateParams object +// with the ability to set a timeout on a request. +func NewRuleCreateParamsWithTimeout(timeout time.Duration) *RuleCreateParams { + return &RuleCreateParams{ + timeout: timeout, + } +} + +// NewRuleCreateParamsWithContext creates a new RuleCreateParams object +// with the ability to set a context for a request. +func NewRuleCreateParamsWithContext(ctx context.Context) *RuleCreateParams { + return &RuleCreateParams{ + Context: ctx, + } +} + +// NewRuleCreateParamsWithHTTPClient creates a new RuleCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewRuleCreateParamsWithHTTPClient(client *http.Client) *RuleCreateParams { + return &RuleCreateParams{ + HTTPClient: client, + } +} + +/* +RuleCreateParams contains all the parameters to send to the API endpoint + + for the rule create operation. + + Typically these are written to a http.Request. +*/ +type RuleCreateParams struct { + + /* Text. + + Text body for the instance rule, plaintext. + */ + Text string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the rule create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RuleCreateParams) WithDefaults() *RuleCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the rule create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RuleCreateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the rule create params +func (o *RuleCreateParams) WithTimeout(timeout time.Duration) *RuleCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the rule create params +func (o *RuleCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the rule create params +func (o *RuleCreateParams) WithContext(ctx context.Context) *RuleCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the rule create params +func (o *RuleCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the rule create params +func (o *RuleCreateParams) WithHTTPClient(client *http.Client) *RuleCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the rule create params +func (o *RuleCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithText adds the text to the rule create params +func (o *RuleCreateParams) WithText(text string) *RuleCreateParams { + o.SetText(text) + return o +} + +// SetText adds the text to the rule create params +func (o *RuleCreateParams) SetText(text string) { + o.Text = text +} + +// WriteToRequest writes these params to a swagger request +func (o *RuleCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param text + frText := o.Text + fText := frText + if fText != "" { + if err := r.SetFormParam("text", fText); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/rule_create_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/rule_create_responses.go new file mode 100644 index 0000000..b300512 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/rule_create_responses.go @@ -0,0 +1,478 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// RuleCreateReader is a Reader for the RuleCreate structure. +type RuleCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *RuleCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewRuleCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewRuleCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewRuleCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewRuleCreateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewRuleCreateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewRuleCreateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewRuleCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/instance/rules] ruleCreate", response, response.Code()) + } +} + +// NewRuleCreateOK creates a RuleCreateOK with default headers values +func NewRuleCreateOK() *RuleCreateOK { + return &RuleCreateOK{} +} + +/* +RuleCreateOK describes a response with status code 200, with default header values. + +The newly-created instance rule. +*/ +type RuleCreateOK struct { + Payload *models.InstanceRule +} + +// IsSuccess returns true when this rule create o k response has a 2xx status code +func (o *RuleCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this rule create o k response has a 3xx status code +func (o *RuleCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule create o k response has a 4xx status code +func (o *RuleCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this rule create o k response has a 5xx status code +func (o *RuleCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this rule create o k response a status code equal to that given +func (o *RuleCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the rule create o k response +func (o *RuleCreateOK) Code() int { + return 200 +} + +func (o *RuleCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateOK %s", 200, payload) +} + +func (o *RuleCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateOK %s", 200, payload) +} + +func (o *RuleCreateOK) GetPayload() *models.InstanceRule { + return o.Payload +} + +func (o *RuleCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.InstanceRule) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRuleCreateBadRequest creates a RuleCreateBadRequest with default headers values +func NewRuleCreateBadRequest() *RuleCreateBadRequest { + return &RuleCreateBadRequest{} +} + +/* +RuleCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type RuleCreateBadRequest struct { +} + +// IsSuccess returns true when this rule create bad request response has a 2xx status code +func (o *RuleCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule create bad request response has a 3xx status code +func (o *RuleCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule create bad request response has a 4xx status code +func (o *RuleCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule create bad request response has a 5xx status code +func (o *RuleCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this rule create bad request response a status code equal to that given +func (o *RuleCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the rule create bad request response +func (o *RuleCreateBadRequest) Code() int { + return 400 +} + +func (o *RuleCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateBadRequest", 400) +} + +func (o *RuleCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateBadRequest", 400) +} + +func (o *RuleCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleCreateUnauthorized creates a RuleCreateUnauthorized with default headers values +func NewRuleCreateUnauthorized() *RuleCreateUnauthorized { + return &RuleCreateUnauthorized{} +} + +/* +RuleCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type RuleCreateUnauthorized struct { +} + +// IsSuccess returns true when this rule create unauthorized response has a 2xx status code +func (o *RuleCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule create unauthorized response has a 3xx status code +func (o *RuleCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule create unauthorized response has a 4xx status code +func (o *RuleCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule create unauthorized response has a 5xx status code +func (o *RuleCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this rule create unauthorized response a status code equal to that given +func (o *RuleCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the rule create unauthorized response +func (o *RuleCreateUnauthorized) Code() int { + return 401 +} + +func (o *RuleCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateUnauthorized", 401) +} + +func (o *RuleCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateUnauthorized", 401) +} + +func (o *RuleCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleCreateForbidden creates a RuleCreateForbidden with default headers values +func NewRuleCreateForbidden() *RuleCreateForbidden { + return &RuleCreateForbidden{} +} + +/* +RuleCreateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type RuleCreateForbidden struct { +} + +// IsSuccess returns true when this rule create forbidden response has a 2xx status code +func (o *RuleCreateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule create forbidden response has a 3xx status code +func (o *RuleCreateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule create forbidden response has a 4xx status code +func (o *RuleCreateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule create forbidden response has a 5xx status code +func (o *RuleCreateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this rule create forbidden response a status code equal to that given +func (o *RuleCreateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the rule create forbidden response +func (o *RuleCreateForbidden) Code() int { + return 403 +} + +func (o *RuleCreateForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateForbidden", 403) +} + +func (o *RuleCreateForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateForbidden", 403) +} + +func (o *RuleCreateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleCreateNotFound creates a RuleCreateNotFound with default headers values +func NewRuleCreateNotFound() *RuleCreateNotFound { + return &RuleCreateNotFound{} +} + +/* +RuleCreateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type RuleCreateNotFound struct { +} + +// IsSuccess returns true when this rule create not found response has a 2xx status code +func (o *RuleCreateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule create not found response has a 3xx status code +func (o *RuleCreateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule create not found response has a 4xx status code +func (o *RuleCreateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule create not found response has a 5xx status code +func (o *RuleCreateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this rule create not found response a status code equal to that given +func (o *RuleCreateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the rule create not found response +func (o *RuleCreateNotFound) Code() int { + return 404 +} + +func (o *RuleCreateNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateNotFound", 404) +} + +func (o *RuleCreateNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateNotFound", 404) +} + +func (o *RuleCreateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleCreateNotAcceptable creates a RuleCreateNotAcceptable with default headers values +func NewRuleCreateNotAcceptable() *RuleCreateNotAcceptable { + return &RuleCreateNotAcceptable{} +} + +/* +RuleCreateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type RuleCreateNotAcceptable struct { +} + +// IsSuccess returns true when this rule create not acceptable response has a 2xx status code +func (o *RuleCreateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule create not acceptable response has a 3xx status code +func (o *RuleCreateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule create not acceptable response has a 4xx status code +func (o *RuleCreateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule create not acceptable response has a 5xx status code +func (o *RuleCreateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this rule create not acceptable response a status code equal to that given +func (o *RuleCreateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the rule create not acceptable response +func (o *RuleCreateNotAcceptable) Code() int { + return 406 +} + +func (o *RuleCreateNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateNotAcceptable", 406) +} + +func (o *RuleCreateNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateNotAcceptable", 406) +} + +func (o *RuleCreateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleCreateInternalServerError creates a RuleCreateInternalServerError with default headers values +func NewRuleCreateInternalServerError() *RuleCreateInternalServerError { + return &RuleCreateInternalServerError{} +} + +/* +RuleCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type RuleCreateInternalServerError struct { +} + +// IsSuccess returns true when this rule create internal server error response has a 2xx status code +func (o *RuleCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule create internal server error response has a 3xx status code +func (o *RuleCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule create internal server error response has a 4xx status code +func (o *RuleCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this rule create internal server error response has a 5xx status code +func (o *RuleCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this rule create internal server error response a status code equal to that given +func (o *RuleCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the rule create internal server error response +func (o *RuleCreateInternalServerError) Code() int { + return 500 +} + +func (o *RuleCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateInternalServerError", 500) +} + +func (o *RuleCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateInternalServerError", 500) +} + +func (o *RuleCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/rule_delete_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/rule_delete_parameters.go new file mode 100644 index 0000000..6e9bc8d --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/rule_delete_parameters.go @@ -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" +) + +// NewRuleDeleteParams creates a new RuleDeleteParams 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 NewRuleDeleteParams() *RuleDeleteParams { + return &RuleDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewRuleDeleteParamsWithTimeout creates a new RuleDeleteParams object +// with the ability to set a timeout on a request. +func NewRuleDeleteParamsWithTimeout(timeout time.Duration) *RuleDeleteParams { + return &RuleDeleteParams{ + timeout: timeout, + } +} + +// NewRuleDeleteParamsWithContext creates a new RuleDeleteParams object +// with the ability to set a context for a request. +func NewRuleDeleteParamsWithContext(ctx context.Context) *RuleDeleteParams { + return &RuleDeleteParams{ + Context: ctx, + } +} + +// NewRuleDeleteParamsWithHTTPClient creates a new RuleDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewRuleDeleteParamsWithHTTPClient(client *http.Client) *RuleDeleteParams { + return &RuleDeleteParams{ + HTTPClient: client, + } +} + +/* +RuleDeleteParams contains all the parameters to send to the API endpoint + + for the rule delete operation. + + Typically these are written to a http.Request. +*/ +type RuleDeleteParams struct { + + /* ID. + + The id of the rule to delete. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the rule delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RuleDeleteParams) WithDefaults() *RuleDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the rule delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RuleDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the rule delete params +func (o *RuleDeleteParams) WithTimeout(timeout time.Duration) *RuleDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the rule delete params +func (o *RuleDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the rule delete params +func (o *RuleDeleteParams) WithContext(ctx context.Context) *RuleDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the rule delete params +func (o *RuleDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the rule delete params +func (o *RuleDeleteParams) WithHTTPClient(client *http.Client) *RuleDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the rule delete params +func (o *RuleDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the rule delete params +func (o *RuleDeleteParams) WithID(id string) *RuleDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the rule delete params +func (o *RuleDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *RuleDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/rule_delete_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/rule_delete_responses.go new file mode 100644 index 0000000..1a5d9a7 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/rule_delete_responses.go @@ -0,0 +1,478 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// RuleDeleteReader is a Reader for the RuleDelete structure. +type RuleDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *RuleDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewRuleDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewRuleDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewRuleDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewRuleDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewRuleDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewRuleDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewRuleDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/admin/instance/rules/{id}] ruleDelete", response, response.Code()) + } +} + +// NewRuleDeleteOK creates a RuleDeleteOK with default headers values +func NewRuleDeleteOK() *RuleDeleteOK { + return &RuleDeleteOK{} +} + +/* +RuleDeleteOK describes a response with status code 200, with default header values. + +The deleted instance rule. +*/ +type RuleDeleteOK struct { + Payload *models.InstanceRule +} + +// IsSuccess returns true when this rule delete o k response has a 2xx status code +func (o *RuleDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this rule delete o k response has a 3xx status code +func (o *RuleDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule delete o k response has a 4xx status code +func (o *RuleDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this rule delete o k response has a 5xx status code +func (o *RuleDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this rule delete o k response a status code equal to that given +func (o *RuleDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the rule delete o k response +func (o *RuleDeleteOK) Code() int { + return 200 +} + +func (o *RuleDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteOK %s", 200, payload) +} + +func (o *RuleDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteOK %s", 200, payload) +} + +func (o *RuleDeleteOK) GetPayload() *models.InstanceRule { + return o.Payload +} + +func (o *RuleDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.InstanceRule) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRuleDeleteBadRequest creates a RuleDeleteBadRequest with default headers values +func NewRuleDeleteBadRequest() *RuleDeleteBadRequest { + return &RuleDeleteBadRequest{} +} + +/* +RuleDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type RuleDeleteBadRequest struct { +} + +// IsSuccess returns true when this rule delete bad request response has a 2xx status code +func (o *RuleDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule delete bad request response has a 3xx status code +func (o *RuleDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule delete bad request response has a 4xx status code +func (o *RuleDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule delete bad request response has a 5xx status code +func (o *RuleDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this rule delete bad request response a status code equal to that given +func (o *RuleDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the rule delete bad request response +func (o *RuleDeleteBadRequest) Code() int { + return 400 +} + +func (o *RuleDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteBadRequest", 400) +} + +func (o *RuleDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteBadRequest", 400) +} + +func (o *RuleDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleDeleteUnauthorized creates a RuleDeleteUnauthorized with default headers values +func NewRuleDeleteUnauthorized() *RuleDeleteUnauthorized { + return &RuleDeleteUnauthorized{} +} + +/* +RuleDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type RuleDeleteUnauthorized struct { +} + +// IsSuccess returns true when this rule delete unauthorized response has a 2xx status code +func (o *RuleDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule delete unauthorized response has a 3xx status code +func (o *RuleDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule delete unauthorized response has a 4xx status code +func (o *RuleDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule delete unauthorized response has a 5xx status code +func (o *RuleDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this rule delete unauthorized response a status code equal to that given +func (o *RuleDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the rule delete unauthorized response +func (o *RuleDeleteUnauthorized) Code() int { + return 401 +} + +func (o *RuleDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteUnauthorized", 401) +} + +func (o *RuleDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteUnauthorized", 401) +} + +func (o *RuleDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleDeleteForbidden creates a RuleDeleteForbidden with default headers values +func NewRuleDeleteForbidden() *RuleDeleteForbidden { + return &RuleDeleteForbidden{} +} + +/* +RuleDeleteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type RuleDeleteForbidden struct { +} + +// IsSuccess returns true when this rule delete forbidden response has a 2xx status code +func (o *RuleDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule delete forbidden response has a 3xx status code +func (o *RuleDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule delete forbidden response has a 4xx status code +func (o *RuleDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule delete forbidden response has a 5xx status code +func (o *RuleDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this rule delete forbidden response a status code equal to that given +func (o *RuleDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the rule delete forbidden response +func (o *RuleDeleteForbidden) Code() int { + return 403 +} + +func (o *RuleDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteForbidden", 403) +} + +func (o *RuleDeleteForbidden) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteForbidden", 403) +} + +func (o *RuleDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleDeleteNotFound creates a RuleDeleteNotFound with default headers values +func NewRuleDeleteNotFound() *RuleDeleteNotFound { + return &RuleDeleteNotFound{} +} + +/* +RuleDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type RuleDeleteNotFound struct { +} + +// IsSuccess returns true when this rule delete not found response has a 2xx status code +func (o *RuleDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule delete not found response has a 3xx status code +func (o *RuleDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule delete not found response has a 4xx status code +func (o *RuleDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule delete not found response has a 5xx status code +func (o *RuleDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this rule delete not found response a status code equal to that given +func (o *RuleDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the rule delete not found response +func (o *RuleDeleteNotFound) Code() int { + return 404 +} + +func (o *RuleDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteNotFound", 404) +} + +func (o *RuleDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteNotFound", 404) +} + +func (o *RuleDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleDeleteNotAcceptable creates a RuleDeleteNotAcceptable with default headers values +func NewRuleDeleteNotAcceptable() *RuleDeleteNotAcceptable { + return &RuleDeleteNotAcceptable{} +} + +/* +RuleDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type RuleDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this rule delete not acceptable response has a 2xx status code +func (o *RuleDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule delete not acceptable response has a 3xx status code +func (o *RuleDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule delete not acceptable response has a 4xx status code +func (o *RuleDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule delete not acceptable response has a 5xx status code +func (o *RuleDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this rule delete not acceptable response a status code equal to that given +func (o *RuleDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the rule delete not acceptable response +func (o *RuleDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *RuleDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteNotAcceptable", 406) +} + +func (o *RuleDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteNotAcceptable", 406) +} + +func (o *RuleDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleDeleteInternalServerError creates a RuleDeleteInternalServerError with default headers values +func NewRuleDeleteInternalServerError() *RuleDeleteInternalServerError { + return &RuleDeleteInternalServerError{} +} + +/* +RuleDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type RuleDeleteInternalServerError struct { +} + +// IsSuccess returns true when this rule delete internal server error response has a 2xx status code +func (o *RuleDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule delete internal server error response has a 3xx status code +func (o *RuleDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule delete internal server error response has a 4xx status code +func (o *RuleDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this rule delete internal server error response has a 5xx status code +func (o *RuleDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this rule delete internal server error response a status code equal to that given +func (o *RuleDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the rule delete internal server error response +func (o *RuleDeleteInternalServerError) Code() int { + return 500 +} + +func (o *RuleDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteInternalServerError", 500) +} + +func (o *RuleDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteInternalServerError", 500) +} + +func (o *RuleDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/rule_update_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/rule_update_parameters.go new file mode 100644 index 0000000..94fcdb5 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/rule_update_parameters.go @@ -0,0 +1,177 @@ +// 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" +) + +// NewRuleUpdateParams creates a new RuleUpdateParams 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 NewRuleUpdateParams() *RuleUpdateParams { + return &RuleUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewRuleUpdateParamsWithTimeout creates a new RuleUpdateParams object +// with the ability to set a timeout on a request. +func NewRuleUpdateParamsWithTimeout(timeout time.Duration) *RuleUpdateParams { + return &RuleUpdateParams{ + timeout: timeout, + } +} + +// NewRuleUpdateParamsWithContext creates a new RuleUpdateParams object +// with the ability to set a context for a request. +func NewRuleUpdateParamsWithContext(ctx context.Context) *RuleUpdateParams { + return &RuleUpdateParams{ + Context: ctx, + } +} + +// NewRuleUpdateParamsWithHTTPClient creates a new RuleUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewRuleUpdateParamsWithHTTPClient(client *http.Client) *RuleUpdateParams { + return &RuleUpdateParams{ + HTTPClient: client, + } +} + +/* +RuleUpdateParams contains all the parameters to send to the API endpoint + + for the rule update operation. + + Typically these are written to a http.Request. +*/ +type RuleUpdateParams struct { + + /* ID. + + The id of the rule to update. + */ + ID string + + /* Text. + + Text body for the updated instance rule, plaintext. + */ + Text string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the rule update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RuleUpdateParams) WithDefaults() *RuleUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the rule update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RuleUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the rule update params +func (o *RuleUpdateParams) WithTimeout(timeout time.Duration) *RuleUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the rule update params +func (o *RuleUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the rule update params +func (o *RuleUpdateParams) WithContext(ctx context.Context) *RuleUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the rule update params +func (o *RuleUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the rule update params +func (o *RuleUpdateParams) WithHTTPClient(client *http.Client) *RuleUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the rule update params +func (o *RuleUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the rule update params +func (o *RuleUpdateParams) WithID(id string) *RuleUpdateParams { + o.SetID(id) + return o +} + +// SetID adds the id to the rule update params +func (o *RuleUpdateParams) SetID(id string) { + o.ID = id +} + +// WithText adds the text to the rule update params +func (o *RuleUpdateParams) WithText(text string) *RuleUpdateParams { + o.SetText(text) + return o +} + +// SetText adds the text to the rule update params +func (o *RuleUpdateParams) SetText(text string) { + o.Text = text +} + +// WriteToRequest writes these params to a swagger request +func (o *RuleUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // form param text + frText := o.Text + fText := frText + if fText != "" { + if err := r.SetFormParam("text", fText); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/rule_update_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/rule_update_responses.go new file mode 100644 index 0000000..d56f500 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/rule_update_responses.go @@ -0,0 +1,478 @@ +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// RuleUpdateReader is a Reader for the RuleUpdate structure. +type RuleUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *RuleUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewRuleUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewRuleUpdateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewRuleUpdateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewRuleUpdateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewRuleUpdateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewRuleUpdateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewRuleUpdateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PATCH /api/v1/admin/instance/rules/{id}] ruleUpdate", response, response.Code()) + } +} + +// NewRuleUpdateOK creates a RuleUpdateOK with default headers values +func NewRuleUpdateOK() *RuleUpdateOK { + return &RuleUpdateOK{} +} + +/* +RuleUpdateOK describes a response with status code 200, with default header values. + +The updated instance rule. +*/ +type RuleUpdateOK struct { + Payload *models.InstanceRule +} + +// IsSuccess returns true when this rule update o k response has a 2xx status code +func (o *RuleUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this rule update o k response has a 3xx status code +func (o *RuleUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule update o k response has a 4xx status code +func (o *RuleUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this rule update o k response has a 5xx status code +func (o *RuleUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this rule update o k response a status code equal to that given +func (o *RuleUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the rule update o k response +func (o *RuleUpdateOK) Code() int { + return 200 +} + +func (o *RuleUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateOK %s", 200, payload) +} + +func (o *RuleUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateOK %s", 200, payload) +} + +func (o *RuleUpdateOK) GetPayload() *models.InstanceRule { + return o.Payload +} + +func (o *RuleUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.InstanceRule) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRuleUpdateBadRequest creates a RuleUpdateBadRequest with default headers values +func NewRuleUpdateBadRequest() *RuleUpdateBadRequest { + return &RuleUpdateBadRequest{} +} + +/* +RuleUpdateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type RuleUpdateBadRequest struct { +} + +// IsSuccess returns true when this rule update bad request response has a 2xx status code +func (o *RuleUpdateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule update bad request response has a 3xx status code +func (o *RuleUpdateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule update bad request response has a 4xx status code +func (o *RuleUpdateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule update bad request response has a 5xx status code +func (o *RuleUpdateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this rule update bad request response a status code equal to that given +func (o *RuleUpdateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the rule update bad request response +func (o *RuleUpdateBadRequest) Code() int { + return 400 +} + +func (o *RuleUpdateBadRequest) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateBadRequest", 400) +} + +func (o *RuleUpdateBadRequest) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateBadRequest", 400) +} + +func (o *RuleUpdateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleUpdateUnauthorized creates a RuleUpdateUnauthorized with default headers values +func NewRuleUpdateUnauthorized() *RuleUpdateUnauthorized { + return &RuleUpdateUnauthorized{} +} + +/* +RuleUpdateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type RuleUpdateUnauthorized struct { +} + +// IsSuccess returns true when this rule update unauthorized response has a 2xx status code +func (o *RuleUpdateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule update unauthorized response has a 3xx status code +func (o *RuleUpdateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule update unauthorized response has a 4xx status code +func (o *RuleUpdateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule update unauthorized response has a 5xx status code +func (o *RuleUpdateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this rule update unauthorized response a status code equal to that given +func (o *RuleUpdateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the rule update unauthorized response +func (o *RuleUpdateUnauthorized) Code() int { + return 401 +} + +func (o *RuleUpdateUnauthorized) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateUnauthorized", 401) +} + +func (o *RuleUpdateUnauthorized) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateUnauthorized", 401) +} + +func (o *RuleUpdateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleUpdateForbidden creates a RuleUpdateForbidden with default headers values +func NewRuleUpdateForbidden() *RuleUpdateForbidden { + return &RuleUpdateForbidden{} +} + +/* +RuleUpdateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type RuleUpdateForbidden struct { +} + +// IsSuccess returns true when this rule update forbidden response has a 2xx status code +func (o *RuleUpdateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule update forbidden response has a 3xx status code +func (o *RuleUpdateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule update forbidden response has a 4xx status code +func (o *RuleUpdateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule update forbidden response has a 5xx status code +func (o *RuleUpdateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this rule update forbidden response a status code equal to that given +func (o *RuleUpdateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the rule update forbidden response +func (o *RuleUpdateForbidden) Code() int { + return 403 +} + +func (o *RuleUpdateForbidden) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateForbidden", 403) +} + +func (o *RuleUpdateForbidden) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateForbidden", 403) +} + +func (o *RuleUpdateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleUpdateNotFound creates a RuleUpdateNotFound with default headers values +func NewRuleUpdateNotFound() *RuleUpdateNotFound { + return &RuleUpdateNotFound{} +} + +/* +RuleUpdateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type RuleUpdateNotFound struct { +} + +// IsSuccess returns true when this rule update not found response has a 2xx status code +func (o *RuleUpdateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule update not found response has a 3xx status code +func (o *RuleUpdateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule update not found response has a 4xx status code +func (o *RuleUpdateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule update not found response has a 5xx status code +func (o *RuleUpdateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this rule update not found response a status code equal to that given +func (o *RuleUpdateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the rule update not found response +func (o *RuleUpdateNotFound) Code() int { + return 404 +} + +func (o *RuleUpdateNotFound) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateNotFound", 404) +} + +func (o *RuleUpdateNotFound) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateNotFound", 404) +} + +func (o *RuleUpdateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleUpdateNotAcceptable creates a RuleUpdateNotAcceptable with default headers values +func NewRuleUpdateNotAcceptable() *RuleUpdateNotAcceptable { + return &RuleUpdateNotAcceptable{} +} + +/* +RuleUpdateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type RuleUpdateNotAcceptable struct { +} + +// IsSuccess returns true when this rule update not acceptable response has a 2xx status code +func (o *RuleUpdateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule update not acceptable response has a 3xx status code +func (o *RuleUpdateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule update not acceptable response has a 4xx status code +func (o *RuleUpdateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule update not acceptable response has a 5xx status code +func (o *RuleUpdateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this rule update not acceptable response a status code equal to that given +func (o *RuleUpdateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the rule update not acceptable response +func (o *RuleUpdateNotAcceptable) Code() int { + return 406 +} + +func (o *RuleUpdateNotAcceptable) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateNotAcceptable", 406) +} + +func (o *RuleUpdateNotAcceptable) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateNotAcceptable", 406) +} + +func (o *RuleUpdateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleUpdateInternalServerError creates a RuleUpdateInternalServerError with default headers values +func NewRuleUpdateInternalServerError() *RuleUpdateInternalServerError { + return &RuleUpdateInternalServerError{} +} + +/* +RuleUpdateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type RuleUpdateInternalServerError struct { +} + +// IsSuccess returns true when this rule update internal server error response has a 2xx status code +func (o *RuleUpdateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule update internal server error response has a 3xx status code +func (o *RuleUpdateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule update internal server error response has a 4xx status code +func (o *RuleUpdateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this rule update internal server error response has a 5xx status code +func (o *RuleUpdateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this rule update internal server error response a status code equal to that given +func (o *RuleUpdateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the rule update internal server error response +func (o *RuleUpdateInternalServerError) Code() int { + return 500 +} + +func (o *RuleUpdateInternalServerError) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateInternalServerError", 500) +} + +func (o *RuleUpdateInternalServerError) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateInternalServerError", 500) +} + +func (o *RuleUpdateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/test_email_send_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/test_email_send_parameters.go new file mode 100644 index 0000000..72f4973 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/test_email_send_parameters.go @@ -0,0 +1,187 @@ +// 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" +) + +// NewTestEmailSendParams creates a new TestEmailSendParams 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 NewTestEmailSendParams() *TestEmailSendParams { + return &TestEmailSendParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewTestEmailSendParamsWithTimeout creates a new TestEmailSendParams object +// with the ability to set a timeout on a request. +func NewTestEmailSendParamsWithTimeout(timeout time.Duration) *TestEmailSendParams { + return &TestEmailSendParams{ + timeout: timeout, + } +} + +// NewTestEmailSendParamsWithContext creates a new TestEmailSendParams object +// with the ability to set a context for a request. +func NewTestEmailSendParamsWithContext(ctx context.Context) *TestEmailSendParams { + return &TestEmailSendParams{ + Context: ctx, + } +} + +// NewTestEmailSendParamsWithHTTPClient creates a new TestEmailSendParams object +// with the ability to set a custom HTTPClient for a request. +func NewTestEmailSendParamsWithHTTPClient(client *http.Client) *TestEmailSendParams { + return &TestEmailSendParams{ + HTTPClient: client, + } +} + +/* +TestEmailSendParams contains all the parameters to send to the API endpoint + + for the test email send operation. + + Typically these are written to a http.Request. +*/ +type TestEmailSendParams struct { + + /* Email. + + The email address that the test email should be sent to. + */ + Email string + + /* Message. + + Optional message to include in the email. + */ + Message *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the test email send params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TestEmailSendParams) WithDefaults() *TestEmailSendParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the test email send params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TestEmailSendParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the test email send params +func (o *TestEmailSendParams) WithTimeout(timeout time.Duration) *TestEmailSendParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the test email send params +func (o *TestEmailSendParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the test email send params +func (o *TestEmailSendParams) WithContext(ctx context.Context) *TestEmailSendParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the test email send params +func (o *TestEmailSendParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the test email send params +func (o *TestEmailSendParams) WithHTTPClient(client *http.Client) *TestEmailSendParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the test email send params +func (o *TestEmailSendParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithEmail adds the email to the test email send params +func (o *TestEmailSendParams) WithEmail(email string) *TestEmailSendParams { + o.SetEmail(email) + return o +} + +// SetEmail adds the email to the test email send params +func (o *TestEmailSendParams) SetEmail(email string) { + o.Email = email +} + +// WithMessage adds the message to the test email send params +func (o *TestEmailSendParams) WithMessage(message *string) *TestEmailSendParams { + o.SetMessage(message) + return o +} + +// SetMessage adds the message to the test email send params +func (o *TestEmailSendParams) SetMessage(message *string) { + o.Message = message +} + +// WriteToRequest writes these params to a swagger request +func (o *TestEmailSendParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param email + frEmail := o.Email + fEmail := frEmail + if fEmail != "" { + if err := r.SetFormParam("email", fEmail); err != nil { + return err + } + } + + if o.Message != nil { + + // form param message + var frMessage string + if o.Message != nil { + frMessage = *o.Message + } + fMessage := frMessage + if fMessage != "" { + if err := r.SetFormParam("message", fMessage); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/test_email_send_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/test_email_send_responses.go new file mode 100644 index 0000000..bad0b40 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/admin/test_email_send_responses.go @@ -0,0 +1,522 @@ +// 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" +) + +// TestEmailSendReader is a Reader for the TestEmailSend structure. +type TestEmailSendReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *TestEmailSendReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewTestEmailSendAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewTestEmailSendBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewTestEmailSendUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewTestEmailSendForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewTestEmailSendNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewTestEmailSendNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewTestEmailSendUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewTestEmailSendInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/email/test] testEmailSend", response, response.Code()) + } +} + +// NewTestEmailSendAccepted creates a TestEmailSendAccepted with default headers values +func NewTestEmailSendAccepted() *TestEmailSendAccepted { + return &TestEmailSendAccepted{} +} + +/* +TestEmailSendAccepted describes a response with status code 202, with default header values. + +Test email was sent. +*/ +type TestEmailSendAccepted struct { +} + +// IsSuccess returns true when this test email send accepted response has a 2xx status code +func (o *TestEmailSendAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this test email send accepted response has a 3xx status code +func (o *TestEmailSendAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this test email send accepted response has a 4xx status code +func (o *TestEmailSendAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this test email send accepted response has a 5xx status code +func (o *TestEmailSendAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this test email send accepted response a status code equal to that given +func (o *TestEmailSendAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the test email send accepted response +func (o *TestEmailSendAccepted) Code() int { + return 202 +} + +func (o *TestEmailSendAccepted) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendAccepted", 202) +} + +func (o *TestEmailSendAccepted) String() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendAccepted", 202) +} + +func (o *TestEmailSendAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTestEmailSendBadRequest creates a TestEmailSendBadRequest with default headers values +func NewTestEmailSendBadRequest() *TestEmailSendBadRequest { + return &TestEmailSendBadRequest{} +} + +/* +TestEmailSendBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type TestEmailSendBadRequest struct { +} + +// IsSuccess returns true when this test email send bad request response has a 2xx status code +func (o *TestEmailSendBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this test email send bad request response has a 3xx status code +func (o *TestEmailSendBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this test email send bad request response has a 4xx status code +func (o *TestEmailSendBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this test email send bad request response has a 5xx status code +func (o *TestEmailSendBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this test email send bad request response a status code equal to that given +func (o *TestEmailSendBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the test email send bad request response +func (o *TestEmailSendBadRequest) Code() int { + return 400 +} + +func (o *TestEmailSendBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendBadRequest", 400) +} + +func (o *TestEmailSendBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendBadRequest", 400) +} + +func (o *TestEmailSendBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTestEmailSendUnauthorized creates a TestEmailSendUnauthorized with default headers values +func NewTestEmailSendUnauthorized() *TestEmailSendUnauthorized { + return &TestEmailSendUnauthorized{} +} + +/* +TestEmailSendUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type TestEmailSendUnauthorized struct { +} + +// IsSuccess returns true when this test email send unauthorized response has a 2xx status code +func (o *TestEmailSendUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this test email send unauthorized response has a 3xx status code +func (o *TestEmailSendUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this test email send unauthorized response has a 4xx status code +func (o *TestEmailSendUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this test email send unauthorized response has a 5xx status code +func (o *TestEmailSendUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this test email send unauthorized response a status code equal to that given +func (o *TestEmailSendUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the test email send unauthorized response +func (o *TestEmailSendUnauthorized) Code() int { + return 401 +} + +func (o *TestEmailSendUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendUnauthorized", 401) +} + +func (o *TestEmailSendUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendUnauthorized", 401) +} + +func (o *TestEmailSendUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTestEmailSendForbidden creates a TestEmailSendForbidden with default headers values +func NewTestEmailSendForbidden() *TestEmailSendForbidden { + return &TestEmailSendForbidden{} +} + +/* +TestEmailSendForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type TestEmailSendForbidden struct { +} + +// IsSuccess returns true when this test email send forbidden response has a 2xx status code +func (o *TestEmailSendForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this test email send forbidden response has a 3xx status code +func (o *TestEmailSendForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this test email send forbidden response has a 4xx status code +func (o *TestEmailSendForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this test email send forbidden response has a 5xx status code +func (o *TestEmailSendForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this test email send forbidden response a status code equal to that given +func (o *TestEmailSendForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the test email send forbidden response +func (o *TestEmailSendForbidden) Code() int { + return 403 +} + +func (o *TestEmailSendForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendForbidden", 403) +} + +func (o *TestEmailSendForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendForbidden", 403) +} + +func (o *TestEmailSendForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTestEmailSendNotFound creates a TestEmailSendNotFound with default headers values +func NewTestEmailSendNotFound() *TestEmailSendNotFound { + return &TestEmailSendNotFound{} +} + +/* +TestEmailSendNotFound describes a response with status code 404, with default header values. + +not found +*/ +type TestEmailSendNotFound struct { +} + +// IsSuccess returns true when this test email send not found response has a 2xx status code +func (o *TestEmailSendNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this test email send not found response has a 3xx status code +func (o *TestEmailSendNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this test email send not found response has a 4xx status code +func (o *TestEmailSendNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this test email send not found response has a 5xx status code +func (o *TestEmailSendNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this test email send not found response a status code equal to that given +func (o *TestEmailSendNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the test email send not found response +func (o *TestEmailSendNotFound) Code() int { + return 404 +} + +func (o *TestEmailSendNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendNotFound", 404) +} + +func (o *TestEmailSendNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendNotFound", 404) +} + +func (o *TestEmailSendNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTestEmailSendNotAcceptable creates a TestEmailSendNotAcceptable with default headers values +func NewTestEmailSendNotAcceptable() *TestEmailSendNotAcceptable { + return &TestEmailSendNotAcceptable{} +} + +/* +TestEmailSendNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type TestEmailSendNotAcceptable struct { +} + +// IsSuccess returns true when this test email send not acceptable response has a 2xx status code +func (o *TestEmailSendNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this test email send not acceptable response has a 3xx status code +func (o *TestEmailSendNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this test email send not acceptable response has a 4xx status code +func (o *TestEmailSendNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this test email send not acceptable response has a 5xx status code +func (o *TestEmailSendNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this test email send not acceptable response a status code equal to that given +func (o *TestEmailSendNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the test email send not acceptable response +func (o *TestEmailSendNotAcceptable) Code() int { + return 406 +} + +func (o *TestEmailSendNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendNotAcceptable", 406) +} + +func (o *TestEmailSendNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendNotAcceptable", 406) +} + +func (o *TestEmailSendNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTestEmailSendUnprocessableEntity creates a TestEmailSendUnprocessableEntity with default headers values +func NewTestEmailSendUnprocessableEntity() *TestEmailSendUnprocessableEntity { + return &TestEmailSendUnprocessableEntity{} +} + +/* +TestEmailSendUnprocessableEntity describes a response with status code 422, with default header values. + +An smtp occurred while the email attempt was in progress. Check the returned json for more information. The smtp error will be included, to help you debug communication with the smtp server. +*/ +type TestEmailSendUnprocessableEntity struct { +} + +// IsSuccess returns true when this test email send unprocessable entity response has a 2xx status code +func (o *TestEmailSendUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this test email send unprocessable entity response has a 3xx status code +func (o *TestEmailSendUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this test email send unprocessable entity response has a 4xx status code +func (o *TestEmailSendUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this test email send unprocessable entity response has a 5xx status code +func (o *TestEmailSendUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this test email send unprocessable entity response a status code equal to that given +func (o *TestEmailSendUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the test email send unprocessable entity response +func (o *TestEmailSendUnprocessableEntity) Code() int { + return 422 +} + +func (o *TestEmailSendUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendUnprocessableEntity", 422) +} + +func (o *TestEmailSendUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendUnprocessableEntity", 422) +} + +func (o *TestEmailSendUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTestEmailSendInternalServerError creates a TestEmailSendInternalServerError with default headers values +func NewTestEmailSendInternalServerError() *TestEmailSendInternalServerError { + return &TestEmailSendInternalServerError{} +} + +/* +TestEmailSendInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type TestEmailSendInternalServerError struct { +} + +// IsSuccess returns true when this test email send internal server error response has a 2xx status code +func (o *TestEmailSendInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this test email send internal server error response has a 3xx status code +func (o *TestEmailSendInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this test email send internal server error response has a 4xx status code +func (o *TestEmailSendInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this test email send internal server error response has a 5xx status code +func (o *TestEmailSendInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this test email send internal server error response a status code equal to that given +func (o *TestEmailSendInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the test email send internal server error response +func (o *TestEmailSendInternalServerError) Code() int { + return 500 +} + +func (o *TestEmailSendInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendInternalServerError", 500) +} + +func (o *TestEmailSendInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendInternalServerError", 500) +} + +func (o *TestEmailSendInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/apps/app_create_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/apps/app_create_parameters.go new file mode 100644 index 0000000..54e5805 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/apps/app_create_parameters.go @@ -0,0 +1,249 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package apps + +// 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" +) + +// NewAppCreateParams creates a new AppCreateParams 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 NewAppCreateParams() *AppCreateParams { + return &AppCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAppCreateParamsWithTimeout creates a new AppCreateParams object +// with the ability to set a timeout on a request. +func NewAppCreateParamsWithTimeout(timeout time.Duration) *AppCreateParams { + return &AppCreateParams{ + timeout: timeout, + } +} + +// NewAppCreateParamsWithContext creates a new AppCreateParams object +// with the ability to set a context for a request. +func NewAppCreateParamsWithContext(ctx context.Context) *AppCreateParams { + return &AppCreateParams{ + Context: ctx, + } +} + +// NewAppCreateParamsWithHTTPClient creates a new AppCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewAppCreateParamsWithHTTPClient(client *http.Client) *AppCreateParams { + return &AppCreateParams{ + HTTPClient: client, + } +} + +/* +AppCreateParams contains all the parameters to send to the API endpoint + + for the app create operation. + + Typically these are written to a http.Request. +*/ +type AppCreateParams struct { + + /* ClientName. + + The name of the application. + */ + ClientName string + + /* RedirectUris. + + Where the user should be redirected after authorization. + + To display the authorization code to the user instead of redirecting to a web page, use `urn:ietf:wg:oauth:2.0:oob` in this parameter. + */ + RedirectURIs string + + /* Scopes. + + Space separated list of scopes. + + If no scopes are provided, defaults to `read`. + */ + Scopes *string + + /* Website. + + A URL to the web page of the app (optional). + */ + Website *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the app create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AppCreateParams) WithDefaults() *AppCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the app create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AppCreateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the app create params +func (o *AppCreateParams) WithTimeout(timeout time.Duration) *AppCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the app create params +func (o *AppCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the app create params +func (o *AppCreateParams) WithContext(ctx context.Context) *AppCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the app create params +func (o *AppCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the app create params +func (o *AppCreateParams) WithHTTPClient(client *http.Client) *AppCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the app create params +func (o *AppCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithClientName adds the clientName to the app create params +func (o *AppCreateParams) WithClientName(clientName string) *AppCreateParams { + o.SetClientName(clientName) + return o +} + +// SetClientName adds the clientName to the app create params +func (o *AppCreateParams) SetClientName(clientName string) { + o.ClientName = clientName +} + +// WithRedirectURIs adds the redirectUris to the app create params +func (o *AppCreateParams) WithRedirectURIs(redirectUris string) *AppCreateParams { + o.SetRedirectURIs(redirectUris) + return o +} + +// SetRedirectURIs adds the redirectUris to the app create params +func (o *AppCreateParams) SetRedirectURIs(redirectUris string) { + o.RedirectURIs = redirectUris +} + +// WithScopes adds the scopes to the app create params +func (o *AppCreateParams) WithScopes(scopes *string) *AppCreateParams { + o.SetScopes(scopes) + return o +} + +// SetScopes adds the scopes to the app create params +func (o *AppCreateParams) SetScopes(scopes *string) { + o.Scopes = scopes +} + +// WithWebsite adds the website to the app create params +func (o *AppCreateParams) WithWebsite(website *string) *AppCreateParams { + o.SetWebsite(website) + return o +} + +// SetWebsite adds the website to the app create params +func (o *AppCreateParams) SetWebsite(website *string) { + o.Website = website +} + +// WriteToRequest writes these params to a swagger request +func (o *AppCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param client_name + frClientName := o.ClientName + fClientName := frClientName + if fClientName != "" { + if err := r.SetFormParam("client_name", fClientName); err != nil { + return err + } + } + + // form param redirect_uris + frRedirectUris := o.RedirectURIs + fRedirectUris := frRedirectUris + if fRedirectUris != "" { + if err := r.SetFormParam("redirect_uris", fRedirectUris); err != nil { + return err + } + } + + if o.Scopes != nil { + + // form param scopes + var frScopes string + if o.Scopes != nil { + frScopes = *o.Scopes + } + fScopes := frScopes + if fScopes != "" { + if err := r.SetFormParam("scopes", fScopes); err != nil { + return err + } + } + } + + if o.Website != nil { + + // form param website + var frWebsite string + if o.Website != nil { + frWebsite = *o.Website + } + fWebsite := frWebsite + if fWebsite != "" { + if err := r.SetFormParam("website", fWebsite); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/apps/app_create_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/apps/app_create_responses.go new file mode 100644 index 0000000..9ab5190 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/apps/app_create_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package apps + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AppCreateReader is a Reader for the AppCreate structure. +type AppCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AppCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAppCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAppCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAppCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewAppCreateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAppCreateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAppCreateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAppCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/apps] appCreate", response, response.Code()) + } +} + +// NewAppCreateOK creates a AppCreateOK with default headers values +func NewAppCreateOK() *AppCreateOK { + return &AppCreateOK{} +} + +/* +AppCreateOK describes a response with status code 200, with default header values. + +The newly-created application. +*/ +type AppCreateOK struct { + Payload *models.Application +} + +// IsSuccess returns true when this app create o k response has a 2xx status code +func (o *AppCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this app create o k response has a 3xx status code +func (o *AppCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this app create o k response has a 4xx status code +func (o *AppCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this app create o k response has a 5xx status code +func (o *AppCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this app create o k response a status code equal to that given +func (o *AppCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the app create o k response +func (o *AppCreateOK) Code() int { + return 200 +} + +func (o *AppCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateOK %s", 200, payload) +} + +func (o *AppCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateOK %s", 200, payload) +} + +func (o *AppCreateOK) GetPayload() *models.Application { + return o.Payload +} + +func (o *AppCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Application) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAppCreateBadRequest creates a AppCreateBadRequest with default headers values +func NewAppCreateBadRequest() *AppCreateBadRequest { + return &AppCreateBadRequest{} +} + +/* +AppCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AppCreateBadRequest struct { +} + +// IsSuccess returns true when this app create bad request response has a 2xx status code +func (o *AppCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this app create bad request response has a 3xx status code +func (o *AppCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this app create bad request response has a 4xx status code +func (o *AppCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this app create bad request response has a 5xx status code +func (o *AppCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this app create bad request response a status code equal to that given +func (o *AppCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the app create bad request response +func (o *AppCreateBadRequest) Code() int { + return 400 +} + +func (o *AppCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateBadRequest", 400) +} + +func (o *AppCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateBadRequest", 400) +} + +func (o *AppCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAppCreateUnauthorized creates a AppCreateUnauthorized with default headers values +func NewAppCreateUnauthorized() *AppCreateUnauthorized { + return &AppCreateUnauthorized{} +} + +/* +AppCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AppCreateUnauthorized struct { +} + +// IsSuccess returns true when this app create unauthorized response has a 2xx status code +func (o *AppCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this app create unauthorized response has a 3xx status code +func (o *AppCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this app create unauthorized response has a 4xx status code +func (o *AppCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this app create unauthorized response has a 5xx status code +func (o *AppCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this app create unauthorized response a status code equal to that given +func (o *AppCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the app create unauthorized response +func (o *AppCreateUnauthorized) Code() int { + return 401 +} + +func (o *AppCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateUnauthorized", 401) +} + +func (o *AppCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateUnauthorized", 401) +} + +func (o *AppCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAppCreateForbidden creates a AppCreateForbidden with default headers values +func NewAppCreateForbidden() *AppCreateForbidden { + return &AppCreateForbidden{} +} + +/* +AppCreateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type AppCreateForbidden struct { +} + +// IsSuccess returns true when this app create forbidden response has a 2xx status code +func (o *AppCreateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this app create forbidden response has a 3xx status code +func (o *AppCreateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this app create forbidden response has a 4xx status code +func (o *AppCreateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this app create forbidden response has a 5xx status code +func (o *AppCreateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this app create forbidden response a status code equal to that given +func (o *AppCreateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the app create forbidden response +func (o *AppCreateForbidden) Code() int { + return 403 +} + +func (o *AppCreateForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateForbidden", 403) +} + +func (o *AppCreateForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateForbidden", 403) +} + +func (o *AppCreateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAppCreateNotFound creates a AppCreateNotFound with default headers values +func NewAppCreateNotFound() *AppCreateNotFound { + return &AppCreateNotFound{} +} + +/* +AppCreateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AppCreateNotFound struct { +} + +// IsSuccess returns true when this app create not found response has a 2xx status code +func (o *AppCreateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this app create not found response has a 3xx status code +func (o *AppCreateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this app create not found response has a 4xx status code +func (o *AppCreateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this app create not found response has a 5xx status code +func (o *AppCreateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this app create not found response a status code equal to that given +func (o *AppCreateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the app create not found response +func (o *AppCreateNotFound) Code() int { + return 404 +} + +func (o *AppCreateNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateNotFound", 404) +} + +func (o *AppCreateNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateNotFound", 404) +} + +func (o *AppCreateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAppCreateNotAcceptable creates a AppCreateNotAcceptable with default headers values +func NewAppCreateNotAcceptable() *AppCreateNotAcceptable { + return &AppCreateNotAcceptable{} +} + +/* +AppCreateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AppCreateNotAcceptable struct { +} + +// IsSuccess returns true when this app create not acceptable response has a 2xx status code +func (o *AppCreateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this app create not acceptable response has a 3xx status code +func (o *AppCreateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this app create not acceptable response has a 4xx status code +func (o *AppCreateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this app create not acceptable response has a 5xx status code +func (o *AppCreateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this app create not acceptable response a status code equal to that given +func (o *AppCreateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the app create not acceptable response +func (o *AppCreateNotAcceptable) Code() int { + return 406 +} + +func (o *AppCreateNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateNotAcceptable", 406) +} + +func (o *AppCreateNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateNotAcceptable", 406) +} + +func (o *AppCreateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAppCreateInternalServerError creates a AppCreateInternalServerError with default headers values +func NewAppCreateInternalServerError() *AppCreateInternalServerError { + return &AppCreateInternalServerError{} +} + +/* +AppCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AppCreateInternalServerError struct { +} + +// IsSuccess returns true when this app create internal server error response has a 2xx status code +func (o *AppCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this app create internal server error response has a 3xx status code +func (o *AppCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this app create internal server error response has a 4xx status code +func (o *AppCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this app create internal server error response has a 5xx status code +func (o *AppCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this app create internal server error response a status code equal to that given +func (o *AppCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the app create internal server error response +func (o *AppCreateInternalServerError) Code() int { + return 500 +} + +func (o *AppCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateInternalServerError", 500) +} + +func (o *AppCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateInternalServerError", 500) +} + +func (o *AppCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/apps/apps_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/apps/apps_client.go new file mode 100644 index 0000000..c8c79de --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/apps/apps_client.go @@ -0,0 +1,141 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package apps + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new apps API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new apps API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new apps API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for apps API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded". +func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} +} + +// WithContentTypeApplicationXML sets the Content-Type header to "application/xml". +func WithContentTypeApplicationXML(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/xml"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + AppCreate(params *AppCreateParams, opts ...ClientOption) (*AppCreateOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + AppCreate registers a new application on this instance + + The registered application can be used to obtain an application token. + +This can then be used to register a new account, or (through user auth) obtain an access token. + +The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'. +The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'. +*/ +func (a *Client) AppCreate(params *AppCreateParams, opts ...ClientOption) (*AppCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAppCreateParams() + } + op := &runtime.ClientOperation{ + ID: "appCreate", + Method: "POST", + PathPattern: "/api/v1/apps", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AppCreateReader{formats: a.formats}, + 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.(*AppCreateOK) + 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 appCreate: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/blocks/blocks_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/blocks/blocks_client.go new file mode 100644 index 0000000..0d16cf1 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/blocks/blocks_client.go @@ -0,0 +1,114 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package blocks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new blocks API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new blocks API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new blocks API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for blocks API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + BlocksGet(params *BlocksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*BlocksGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + BlocksGet gets an array of accounts that requesting account has blocked + + The next and previous queries can be parsed from the returned Link header. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) BlocksGet(params *BlocksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*BlocksGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewBlocksGetParams() + } + op := &runtime.ClientOperation{ + ID: "blocksGet", + Method: "GET", + PathPattern: "/api/v1/blocks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &BlocksGetReader{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.(*BlocksGetOK) + 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 blocksGet: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/blocks/blocks_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/blocks/blocks_get_parameters.go new file mode 100644 index 0000000..611fc61 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/blocks/blocks_get_parameters.go @@ -0,0 +1,279 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package blocks + +// 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" +) + +// NewBlocksGetParams creates a new BlocksGetParams 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 NewBlocksGetParams() *BlocksGetParams { + return &BlocksGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewBlocksGetParamsWithTimeout creates a new BlocksGetParams object +// with the ability to set a timeout on a request. +func NewBlocksGetParamsWithTimeout(timeout time.Duration) *BlocksGetParams { + return &BlocksGetParams{ + timeout: timeout, + } +} + +// NewBlocksGetParamsWithContext creates a new BlocksGetParams object +// with the ability to set a context for a request. +func NewBlocksGetParamsWithContext(ctx context.Context) *BlocksGetParams { + return &BlocksGetParams{ + Context: ctx, + } +} + +// NewBlocksGetParamsWithHTTPClient creates a new BlocksGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewBlocksGetParamsWithHTTPClient(client *http.Client) *BlocksGetParams { + return &BlocksGetParams{ + HTTPClient: client, + } +} + +/* +BlocksGetParams contains all the parameters to send to the API endpoint + + for the blocks get operation. + + Typically these are written to a http.Request. +*/ +type BlocksGetParams struct { + + /* Limit. + + Number of blocked accounts to return. + + Default: 40 + */ + Limit *int64 + + /* MaxID. + + Return only blocked accounts *OLDER* than the given max ID. The blocked account with the specified ID will not be included in the response. NOTE: the ID is of the internal block, NOT any of the returned accounts. + */ + MaxID *string + + /* MinID. + + Return only blocked accounts *IMMEDIATELY NEWER* than the given min ID. The blocked account with the specified ID will not be included in the response. NOTE: the ID is of the internal block, NOT any of the returned accounts. + */ + MinID *string + + /* SinceID. + + Return only blocked accounts *NEWER* than the given since ID. The blocked account with the specified ID will not be included in the response. NOTE: the ID is of the internal block, NOT any of the returned accounts. + */ + SinceID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the blocks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *BlocksGetParams) WithDefaults() *BlocksGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the blocks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *BlocksGetParams) SetDefaults() { + var ( + limitDefault = int64(40) + ) + + val := BlocksGetParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the blocks get params +func (o *BlocksGetParams) WithTimeout(timeout time.Duration) *BlocksGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the blocks get params +func (o *BlocksGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the blocks get params +func (o *BlocksGetParams) WithContext(ctx context.Context) *BlocksGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the blocks get params +func (o *BlocksGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the blocks get params +func (o *BlocksGetParams) WithHTTPClient(client *http.Client) *BlocksGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the blocks get params +func (o *BlocksGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the blocks get params +func (o *BlocksGetParams) WithLimit(limit *int64) *BlocksGetParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the blocks get params +func (o *BlocksGetParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the blocks get params +func (o *BlocksGetParams) WithMaxID(maxID *string) *BlocksGetParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the blocks get params +func (o *BlocksGetParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the blocks get params +func (o *BlocksGetParams) WithMinID(minID *string) *BlocksGetParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the blocks get params +func (o *BlocksGetParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the blocks get params +func (o *BlocksGetParams) WithSinceID(sinceID *string) *BlocksGetParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the blocks get params +func (o *BlocksGetParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WriteToRequest writes these params to a swagger request +func (o *BlocksGetParams) 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.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if o.SinceID != nil { + + // query param since_id + var qrSinceID string + + if o.SinceID != nil { + qrSinceID = *o.SinceID + } + qSinceID := qrSinceID + if qSinceID != "" { + + if err := r.SetQueryParam("since_id", qSinceID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/blocks/blocks_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/blocks/blocks_get_responses.go new file mode 100644 index 0000000..03c5221 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/blocks/blocks_get_responses.go @@ -0,0 +1,426 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package blocks + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// BlocksGetReader is a Reader for the BlocksGet structure. +type BlocksGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *BlocksGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewBlocksGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewBlocksGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewBlocksGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewBlocksGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewBlocksGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewBlocksGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/blocks] blocksGet", response, response.Code()) + } +} + +// NewBlocksGetOK creates a BlocksGetOK with default headers values +func NewBlocksGetOK() *BlocksGetOK { + return &BlocksGetOK{} +} + +/* +BlocksGetOK describes a response with status code 200, with default header values. + +BlocksGetOK blocks get o k +*/ +type BlocksGetOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Account +} + +// IsSuccess returns true when this blocks get o k response has a 2xx status code +func (o *BlocksGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this blocks get o k response has a 3xx status code +func (o *BlocksGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this blocks get o k response has a 4xx status code +func (o *BlocksGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this blocks get o k response has a 5xx status code +func (o *BlocksGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this blocks get o k response a status code equal to that given +func (o *BlocksGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the blocks get o k response +func (o *BlocksGetOK) Code() int { + return 200 +} + +func (o *BlocksGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetOK %s", 200, payload) +} + +func (o *BlocksGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetOK %s", 200, payload) +} + +func (o *BlocksGetOK) GetPayload() []*models.Account { + return o.Payload +} + +func (o *BlocksGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewBlocksGetBadRequest creates a BlocksGetBadRequest with default headers values +func NewBlocksGetBadRequest() *BlocksGetBadRequest { + return &BlocksGetBadRequest{} +} + +/* +BlocksGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type BlocksGetBadRequest struct { +} + +// IsSuccess returns true when this blocks get bad request response has a 2xx status code +func (o *BlocksGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this blocks get bad request response has a 3xx status code +func (o *BlocksGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this blocks get bad request response has a 4xx status code +func (o *BlocksGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this blocks get bad request response has a 5xx status code +func (o *BlocksGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this blocks get bad request response a status code equal to that given +func (o *BlocksGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the blocks get bad request response +func (o *BlocksGetBadRequest) Code() int { + return 400 +} + +func (o *BlocksGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetBadRequest", 400) +} + +func (o *BlocksGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetBadRequest", 400) +} + +func (o *BlocksGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewBlocksGetUnauthorized creates a BlocksGetUnauthorized with default headers values +func NewBlocksGetUnauthorized() *BlocksGetUnauthorized { + return &BlocksGetUnauthorized{} +} + +/* +BlocksGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type BlocksGetUnauthorized struct { +} + +// IsSuccess returns true when this blocks get unauthorized response has a 2xx status code +func (o *BlocksGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this blocks get unauthorized response has a 3xx status code +func (o *BlocksGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this blocks get unauthorized response has a 4xx status code +func (o *BlocksGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this blocks get unauthorized response has a 5xx status code +func (o *BlocksGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this blocks get unauthorized response a status code equal to that given +func (o *BlocksGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the blocks get unauthorized response +func (o *BlocksGetUnauthorized) Code() int { + return 401 +} + +func (o *BlocksGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetUnauthorized", 401) +} + +func (o *BlocksGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetUnauthorized", 401) +} + +func (o *BlocksGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewBlocksGetNotFound creates a BlocksGetNotFound with default headers values +func NewBlocksGetNotFound() *BlocksGetNotFound { + return &BlocksGetNotFound{} +} + +/* +BlocksGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type BlocksGetNotFound struct { +} + +// IsSuccess returns true when this blocks get not found response has a 2xx status code +func (o *BlocksGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this blocks get not found response has a 3xx status code +func (o *BlocksGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this blocks get not found response has a 4xx status code +func (o *BlocksGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this blocks get not found response has a 5xx status code +func (o *BlocksGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this blocks get not found response a status code equal to that given +func (o *BlocksGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the blocks get not found response +func (o *BlocksGetNotFound) Code() int { + return 404 +} + +func (o *BlocksGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetNotFound", 404) +} + +func (o *BlocksGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetNotFound", 404) +} + +func (o *BlocksGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewBlocksGetNotAcceptable creates a BlocksGetNotAcceptable with default headers values +func NewBlocksGetNotAcceptable() *BlocksGetNotAcceptable { + return &BlocksGetNotAcceptable{} +} + +/* +BlocksGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type BlocksGetNotAcceptable struct { +} + +// IsSuccess returns true when this blocks get not acceptable response has a 2xx status code +func (o *BlocksGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this blocks get not acceptable response has a 3xx status code +func (o *BlocksGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this blocks get not acceptable response has a 4xx status code +func (o *BlocksGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this blocks get not acceptable response has a 5xx status code +func (o *BlocksGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this blocks get not acceptable response a status code equal to that given +func (o *BlocksGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the blocks get not acceptable response +func (o *BlocksGetNotAcceptable) Code() int { + return 406 +} + +func (o *BlocksGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetNotAcceptable", 406) +} + +func (o *BlocksGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetNotAcceptable", 406) +} + +func (o *BlocksGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewBlocksGetInternalServerError creates a BlocksGetInternalServerError with default headers values +func NewBlocksGetInternalServerError() *BlocksGetInternalServerError { + return &BlocksGetInternalServerError{} +} + +/* +BlocksGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type BlocksGetInternalServerError struct { +} + +// IsSuccess returns true when this blocks get internal server error response has a 2xx status code +func (o *BlocksGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this blocks get internal server error response has a 3xx status code +func (o *BlocksGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this blocks get internal server error response has a 4xx status code +func (o *BlocksGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this blocks get internal server error response has a 5xx status code +func (o *BlocksGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this blocks get internal server error response a status code equal to that given +func (o *BlocksGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the blocks get internal server error response +func (o *BlocksGetInternalServerError) Code() int { + return 500 +} + +func (o *BlocksGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetInternalServerError", 500) +} + +func (o *BlocksGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetInternalServerError", 500) +} + +func (o *BlocksGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/bookmarks/bookmarks_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/bookmarks/bookmarks_client.go new file mode 100644 index 0000000..e6535d8 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/bookmarks/bookmarks_client.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package bookmarks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new bookmarks API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new bookmarks API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new bookmarks API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for bookmarks API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + BookmarksGet(params *BookmarksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*BookmarksGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +BookmarksGet Get an array of statuses bookmarked in the instance +*/ +func (a *Client) BookmarksGet(params *BookmarksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*BookmarksGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewBookmarksGetParams() + } + op := &runtime.ClientOperation{ + ID: "bookmarksGet", + Method: "GET", + PathPattern: "/api/v1/bookmarks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &BookmarksGetReader{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.(*BookmarksGetOK) + 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 bookmarksGet: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/bookmarks/bookmarks_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/bookmarks/bookmarks_get_parameters.go new file mode 100644 index 0000000..5d83307 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/bookmarks/bookmarks_get_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package bookmarks + +// 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" +) + +// NewBookmarksGetParams creates a new BookmarksGetParams 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 NewBookmarksGetParams() *BookmarksGetParams { + return &BookmarksGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewBookmarksGetParamsWithTimeout creates a new BookmarksGetParams object +// with the ability to set a timeout on a request. +func NewBookmarksGetParamsWithTimeout(timeout time.Duration) *BookmarksGetParams { + return &BookmarksGetParams{ + timeout: timeout, + } +} + +// NewBookmarksGetParamsWithContext creates a new BookmarksGetParams object +// with the ability to set a context for a request. +func NewBookmarksGetParamsWithContext(ctx context.Context) *BookmarksGetParams { + return &BookmarksGetParams{ + Context: ctx, + } +} + +// NewBookmarksGetParamsWithHTTPClient creates a new BookmarksGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewBookmarksGetParamsWithHTTPClient(client *http.Client) *BookmarksGetParams { + return &BookmarksGetParams{ + HTTPClient: client, + } +} + +/* +BookmarksGetParams contains all the parameters to send to the API endpoint + + for the bookmarks get operation. + + Typically these are written to a http.Request. +*/ +type BookmarksGetParams struct { + + /* Limit. + + Number of statuses to return. + + Default: 30 + */ + Limit *int64 + + /* MaxID. + + Return only bookmarked statuses *OLDER* than the given bookmark ID. The status with the corresponding bookmark ID will not be included in the response. + */ + MaxID *string + + /* MinID. + + Return only bookmarked statuses *NEWER* than the given bookmark ID. The status with the corresponding bookmark ID will not be included in the response. + */ + MinID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the bookmarks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *BookmarksGetParams) WithDefaults() *BookmarksGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the bookmarks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *BookmarksGetParams) SetDefaults() { + var ( + limitDefault = int64(30) + ) + + val := BookmarksGetParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the bookmarks get params +func (o *BookmarksGetParams) WithTimeout(timeout time.Duration) *BookmarksGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the bookmarks get params +func (o *BookmarksGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the bookmarks get params +func (o *BookmarksGetParams) WithContext(ctx context.Context) *BookmarksGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the bookmarks get params +func (o *BookmarksGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the bookmarks get params +func (o *BookmarksGetParams) WithHTTPClient(client *http.Client) *BookmarksGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the bookmarks get params +func (o *BookmarksGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the bookmarks get params +func (o *BookmarksGetParams) WithLimit(limit *int64) *BookmarksGetParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the bookmarks get params +func (o *BookmarksGetParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the bookmarks get params +func (o *BookmarksGetParams) WithMaxID(maxID *string) *BookmarksGetParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the bookmarks get params +func (o *BookmarksGetParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the bookmarks get params +func (o *BookmarksGetParams) WithMinID(minID *string) *BookmarksGetParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the bookmarks get params +func (o *BookmarksGetParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WriteToRequest writes these params to a swagger request +func (o *BookmarksGetParams) 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.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/bookmarks/bookmarks_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/bookmarks/bookmarks_get_responses.go new file mode 100644 index 0000000..312db02 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/bookmarks/bookmarks_get_responses.go @@ -0,0 +1,302 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package bookmarks + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// BookmarksGetReader is a Reader for the BookmarksGet structure. +type BookmarksGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *BookmarksGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewBookmarksGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewBookmarksGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewBookmarksGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewBookmarksGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/bookmarks] bookmarksGet", response, response.Code()) + } +} + +// NewBookmarksGetOK creates a BookmarksGetOK with default headers values +func NewBookmarksGetOK() *BookmarksGetOK { + return &BookmarksGetOK{} +} + +/* +BookmarksGetOK describes a response with status code 200, with default header values. + +Array of bookmarked statuses +*/ +type BookmarksGetOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Status +} + +// IsSuccess returns true when this bookmarks get o k response has a 2xx status code +func (o *BookmarksGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this bookmarks get o k response has a 3xx status code +func (o *BookmarksGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this bookmarks get o k response has a 4xx status code +func (o *BookmarksGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this bookmarks get o k response has a 5xx status code +func (o *BookmarksGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this bookmarks get o k response a status code equal to that given +func (o *BookmarksGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the bookmarks get o k response +func (o *BookmarksGetOK) Code() int { + return 200 +} + +func (o *BookmarksGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/bookmarks][%d] bookmarksGetOK %s", 200, payload) +} + +func (o *BookmarksGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/bookmarks][%d] bookmarksGetOK %s", 200, payload) +} + +func (o *BookmarksGetOK) GetPayload() []*models.Status { + return o.Payload +} + +func (o *BookmarksGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewBookmarksGetUnauthorized creates a BookmarksGetUnauthorized with default headers values +func NewBookmarksGetUnauthorized() *BookmarksGetUnauthorized { + return &BookmarksGetUnauthorized{} +} + +/* +BookmarksGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type BookmarksGetUnauthorized struct { +} + +// IsSuccess returns true when this bookmarks get unauthorized response has a 2xx status code +func (o *BookmarksGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this bookmarks get unauthorized response has a 3xx status code +func (o *BookmarksGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this bookmarks get unauthorized response has a 4xx status code +func (o *BookmarksGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this bookmarks get unauthorized response has a 5xx status code +func (o *BookmarksGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this bookmarks get unauthorized response a status code equal to that given +func (o *BookmarksGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the bookmarks get unauthorized response +func (o *BookmarksGetUnauthorized) Code() int { + return 401 +} + +func (o *BookmarksGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/bookmarks][%d] bookmarksGetUnauthorized", 401) +} + +func (o *BookmarksGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/bookmarks][%d] bookmarksGetUnauthorized", 401) +} + +func (o *BookmarksGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewBookmarksGetNotAcceptable creates a BookmarksGetNotAcceptable with default headers values +func NewBookmarksGetNotAcceptable() *BookmarksGetNotAcceptable { + return &BookmarksGetNotAcceptable{} +} + +/* +BookmarksGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type BookmarksGetNotAcceptable struct { +} + +// IsSuccess returns true when this bookmarks get not acceptable response has a 2xx status code +func (o *BookmarksGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this bookmarks get not acceptable response has a 3xx status code +func (o *BookmarksGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this bookmarks get not acceptable response has a 4xx status code +func (o *BookmarksGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this bookmarks get not acceptable response has a 5xx status code +func (o *BookmarksGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this bookmarks get not acceptable response a status code equal to that given +func (o *BookmarksGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the bookmarks get not acceptable response +func (o *BookmarksGetNotAcceptable) Code() int { + return 406 +} + +func (o *BookmarksGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/bookmarks][%d] bookmarksGetNotAcceptable", 406) +} + +func (o *BookmarksGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/bookmarks][%d] bookmarksGetNotAcceptable", 406) +} + +func (o *BookmarksGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewBookmarksGetInternalServerError creates a BookmarksGetInternalServerError with default headers values +func NewBookmarksGetInternalServerError() *BookmarksGetInternalServerError { + return &BookmarksGetInternalServerError{} +} + +/* +BookmarksGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type BookmarksGetInternalServerError struct { +} + +// IsSuccess returns true when this bookmarks get internal server error response has a 2xx status code +func (o *BookmarksGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this bookmarks get internal server error response has a 3xx status code +func (o *BookmarksGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this bookmarks get internal server error response has a 4xx status code +func (o *BookmarksGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this bookmarks get internal server error response has a 5xx status code +func (o *BookmarksGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this bookmarks get internal server error response a status code equal to that given +func (o *BookmarksGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the bookmarks get internal server error response +func (o *BookmarksGetInternalServerError) Code() int { + return 500 +} + +func (o *BookmarksGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/bookmarks][%d] bookmarksGetInternalServerError", 500) +} + +func (o *BookmarksGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/bookmarks][%d] bookmarksGetInternalServerError", 500) +} + +func (o *BookmarksGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversation_delete_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversation_delete_parameters.go new file mode 100644 index 0000000..7b8c85f --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversation_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package conversations + +// 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" +) + +// NewConversationDeleteParams creates a new ConversationDeleteParams 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 NewConversationDeleteParams() *ConversationDeleteParams { + return &ConversationDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewConversationDeleteParamsWithTimeout creates a new ConversationDeleteParams object +// with the ability to set a timeout on a request. +func NewConversationDeleteParamsWithTimeout(timeout time.Duration) *ConversationDeleteParams { + return &ConversationDeleteParams{ + timeout: timeout, + } +} + +// NewConversationDeleteParamsWithContext creates a new ConversationDeleteParams object +// with the ability to set a context for a request. +func NewConversationDeleteParamsWithContext(ctx context.Context) *ConversationDeleteParams { + return &ConversationDeleteParams{ + Context: ctx, + } +} + +// NewConversationDeleteParamsWithHTTPClient creates a new ConversationDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewConversationDeleteParamsWithHTTPClient(client *http.Client) *ConversationDeleteParams { + return &ConversationDeleteParams{ + HTTPClient: client, + } +} + +/* +ConversationDeleteParams contains all the parameters to send to the API endpoint + + for the conversation delete operation. + + Typically these are written to a http.Request. +*/ +type ConversationDeleteParams struct { + + /* ID. + + ID of the conversation + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the conversation delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ConversationDeleteParams) WithDefaults() *ConversationDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the conversation delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ConversationDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the conversation delete params +func (o *ConversationDeleteParams) WithTimeout(timeout time.Duration) *ConversationDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the conversation delete params +func (o *ConversationDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the conversation delete params +func (o *ConversationDeleteParams) WithContext(ctx context.Context) *ConversationDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the conversation delete params +func (o *ConversationDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the conversation delete params +func (o *ConversationDeleteParams) WithHTTPClient(client *http.Client) *ConversationDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the conversation delete params +func (o *ConversationDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the conversation delete params +func (o *ConversationDeleteParams) WithID(id string) *ConversationDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the conversation delete params +func (o *ConversationDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *ConversationDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversation_delete_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversation_delete_responses.go new file mode 100644 index 0000000..091123b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversation_delete_responses.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package conversations + +// 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" +) + +// ConversationDeleteReader is a Reader for the ConversationDelete structure. +type ConversationDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConversationDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConversationDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewConversationDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewConversationDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewConversationDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewConversationDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewConversationDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/conversations/{id}] conversationDelete", response, response.Code()) + } +} + +// NewConversationDeleteOK creates a ConversationDeleteOK with default headers values +func NewConversationDeleteOK() *ConversationDeleteOK { + return &ConversationDeleteOK{} +} + +/* +ConversationDeleteOK describes a response with status code 200, with default header values. + +conversation deleted +*/ +type ConversationDeleteOK struct { +} + +// IsSuccess returns true when this conversation delete o k response has a 2xx status code +func (o *ConversationDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this conversation delete o k response has a 3xx status code +func (o *ConversationDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation delete o k response has a 4xx status code +func (o *ConversationDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this conversation delete o k response has a 5xx status code +func (o *ConversationDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation delete o k response a status code equal to that given +func (o *ConversationDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the conversation delete o k response +func (o *ConversationDeleteOK) Code() int { + return 200 +} + +func (o *ConversationDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteOK", 200) +} + +func (o *ConversationDeleteOK) String() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteOK", 200) +} + +func (o *ConversationDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationDeleteBadRequest creates a ConversationDeleteBadRequest with default headers values +func NewConversationDeleteBadRequest() *ConversationDeleteBadRequest { + return &ConversationDeleteBadRequest{} +} + +/* +ConversationDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ConversationDeleteBadRequest struct { +} + +// IsSuccess returns true when this conversation delete bad request response has a 2xx status code +func (o *ConversationDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation delete bad request response has a 3xx status code +func (o *ConversationDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation delete bad request response has a 4xx status code +func (o *ConversationDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversation delete bad request response has a 5xx status code +func (o *ConversationDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation delete bad request response a status code equal to that given +func (o *ConversationDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the conversation delete bad request response +func (o *ConversationDeleteBadRequest) Code() int { + return 400 +} + +func (o *ConversationDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteBadRequest", 400) +} + +func (o *ConversationDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteBadRequest", 400) +} + +func (o *ConversationDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationDeleteUnauthorized creates a ConversationDeleteUnauthorized with default headers values +func NewConversationDeleteUnauthorized() *ConversationDeleteUnauthorized { + return &ConversationDeleteUnauthorized{} +} + +/* +ConversationDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ConversationDeleteUnauthorized struct { +} + +// IsSuccess returns true when this conversation delete unauthorized response has a 2xx status code +func (o *ConversationDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation delete unauthorized response has a 3xx status code +func (o *ConversationDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation delete unauthorized response has a 4xx status code +func (o *ConversationDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversation delete unauthorized response has a 5xx status code +func (o *ConversationDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation delete unauthorized response a status code equal to that given +func (o *ConversationDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the conversation delete unauthorized response +func (o *ConversationDeleteUnauthorized) Code() int { + return 401 +} + +func (o *ConversationDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteUnauthorized", 401) +} + +func (o *ConversationDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteUnauthorized", 401) +} + +func (o *ConversationDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationDeleteNotFound creates a ConversationDeleteNotFound with default headers values +func NewConversationDeleteNotFound() *ConversationDeleteNotFound { + return &ConversationDeleteNotFound{} +} + +/* +ConversationDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ConversationDeleteNotFound struct { +} + +// IsSuccess returns true when this conversation delete not found response has a 2xx status code +func (o *ConversationDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation delete not found response has a 3xx status code +func (o *ConversationDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation delete not found response has a 4xx status code +func (o *ConversationDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversation delete not found response has a 5xx status code +func (o *ConversationDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation delete not found response a status code equal to that given +func (o *ConversationDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the conversation delete not found response +func (o *ConversationDeleteNotFound) Code() int { + return 404 +} + +func (o *ConversationDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteNotFound", 404) +} + +func (o *ConversationDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteNotFound", 404) +} + +func (o *ConversationDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationDeleteNotAcceptable creates a ConversationDeleteNotAcceptable with default headers values +func NewConversationDeleteNotAcceptable() *ConversationDeleteNotAcceptable { + return &ConversationDeleteNotAcceptable{} +} + +/* +ConversationDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ConversationDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this conversation delete not acceptable response has a 2xx status code +func (o *ConversationDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation delete not acceptable response has a 3xx status code +func (o *ConversationDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation delete not acceptable response has a 4xx status code +func (o *ConversationDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversation delete not acceptable response has a 5xx status code +func (o *ConversationDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation delete not acceptable response a status code equal to that given +func (o *ConversationDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the conversation delete not acceptable response +func (o *ConversationDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *ConversationDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteNotAcceptable", 406) +} + +func (o *ConversationDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteNotAcceptable", 406) +} + +func (o *ConversationDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationDeleteInternalServerError creates a ConversationDeleteInternalServerError with default headers values +func NewConversationDeleteInternalServerError() *ConversationDeleteInternalServerError { + return &ConversationDeleteInternalServerError{} +} + +/* +ConversationDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ConversationDeleteInternalServerError struct { +} + +// IsSuccess returns true when this conversation delete internal server error response has a 2xx status code +func (o *ConversationDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation delete internal server error response has a 3xx status code +func (o *ConversationDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation delete internal server error response has a 4xx status code +func (o *ConversationDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this conversation delete internal server error response has a 5xx status code +func (o *ConversationDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this conversation delete internal server error response a status code equal to that given +func (o *ConversationDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the conversation delete internal server error response +func (o *ConversationDeleteInternalServerError) Code() int { + return 500 +} + +func (o *ConversationDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteInternalServerError", 500) +} + +func (o *ConversationDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteInternalServerError", 500) +} + +func (o *ConversationDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversation_read_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversation_read_parameters.go new file mode 100644 index 0000000..15611a5 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversation_read_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package conversations + +// 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" +) + +// NewConversationReadParams creates a new ConversationReadParams 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 NewConversationReadParams() *ConversationReadParams { + return &ConversationReadParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewConversationReadParamsWithTimeout creates a new ConversationReadParams object +// with the ability to set a timeout on a request. +func NewConversationReadParamsWithTimeout(timeout time.Duration) *ConversationReadParams { + return &ConversationReadParams{ + timeout: timeout, + } +} + +// NewConversationReadParamsWithContext creates a new ConversationReadParams object +// with the ability to set a context for a request. +func NewConversationReadParamsWithContext(ctx context.Context) *ConversationReadParams { + return &ConversationReadParams{ + Context: ctx, + } +} + +// NewConversationReadParamsWithHTTPClient creates a new ConversationReadParams object +// with the ability to set a custom HTTPClient for a request. +func NewConversationReadParamsWithHTTPClient(client *http.Client) *ConversationReadParams { + return &ConversationReadParams{ + HTTPClient: client, + } +} + +/* +ConversationReadParams contains all the parameters to send to the API endpoint + + for the conversation read operation. + + Typically these are written to a http.Request. +*/ +type ConversationReadParams struct { + + /* ID. + + ID of the conversation. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the conversation read params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ConversationReadParams) WithDefaults() *ConversationReadParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the conversation read params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ConversationReadParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the conversation read params +func (o *ConversationReadParams) WithTimeout(timeout time.Duration) *ConversationReadParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the conversation read params +func (o *ConversationReadParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the conversation read params +func (o *ConversationReadParams) WithContext(ctx context.Context) *ConversationReadParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the conversation read params +func (o *ConversationReadParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the conversation read params +func (o *ConversationReadParams) WithHTTPClient(client *http.Client) *ConversationReadParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the conversation read params +func (o *ConversationReadParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the conversation read params +func (o *ConversationReadParams) WithID(id string) *ConversationReadParams { + o.SetID(id) + return o +} + +// SetID adds the id to the conversation read params +func (o *ConversationReadParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *ConversationReadParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversation_read_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversation_read_responses.go new file mode 100644 index 0000000..b6a7607 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversation_read_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package conversations + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ConversationReadReader is a Reader for the ConversationRead structure. +type ConversationReadReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConversationReadReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConversationReadOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewConversationReadBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewConversationReadUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewConversationReadNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewConversationReadNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewConversationReadUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewConversationReadInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/conversation/{id}/read] conversationRead", response, response.Code()) + } +} + +// NewConversationReadOK creates a ConversationReadOK with default headers values +func NewConversationReadOK() *ConversationReadOK { + return &ConversationReadOK{} +} + +/* +ConversationReadOK describes a response with status code 200, with default header values. + +Updated conversation. +*/ +type ConversationReadOK struct { + Payload *models.Conversation +} + +// IsSuccess returns true when this conversation read o k response has a 2xx status code +func (o *ConversationReadOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this conversation read o k response has a 3xx status code +func (o *ConversationReadOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation read o k response has a 4xx status code +func (o *ConversationReadOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this conversation read o k response has a 5xx status code +func (o *ConversationReadOK) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation read o k response a status code equal to that given +func (o *ConversationReadOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the conversation read o k response +func (o *ConversationReadOK) Code() int { + return 200 +} + +func (o *ConversationReadOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadOK %s", 200, payload) +} + +func (o *ConversationReadOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadOK %s", 200, payload) +} + +func (o *ConversationReadOK) GetPayload() *models.Conversation { + return o.Payload +} + +func (o *ConversationReadOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Conversation) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewConversationReadBadRequest creates a ConversationReadBadRequest with default headers values +func NewConversationReadBadRequest() *ConversationReadBadRequest { + return &ConversationReadBadRequest{} +} + +/* +ConversationReadBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ConversationReadBadRequest struct { +} + +// IsSuccess returns true when this conversation read bad request response has a 2xx status code +func (o *ConversationReadBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation read bad request response has a 3xx status code +func (o *ConversationReadBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation read bad request response has a 4xx status code +func (o *ConversationReadBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversation read bad request response has a 5xx status code +func (o *ConversationReadBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation read bad request response a status code equal to that given +func (o *ConversationReadBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the conversation read bad request response +func (o *ConversationReadBadRequest) Code() int { + return 400 +} + +func (o *ConversationReadBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadBadRequest", 400) +} + +func (o *ConversationReadBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadBadRequest", 400) +} + +func (o *ConversationReadBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationReadUnauthorized creates a ConversationReadUnauthorized with default headers values +func NewConversationReadUnauthorized() *ConversationReadUnauthorized { + return &ConversationReadUnauthorized{} +} + +/* +ConversationReadUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ConversationReadUnauthorized struct { +} + +// IsSuccess returns true when this conversation read unauthorized response has a 2xx status code +func (o *ConversationReadUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation read unauthorized response has a 3xx status code +func (o *ConversationReadUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation read unauthorized response has a 4xx status code +func (o *ConversationReadUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversation read unauthorized response has a 5xx status code +func (o *ConversationReadUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation read unauthorized response a status code equal to that given +func (o *ConversationReadUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the conversation read unauthorized response +func (o *ConversationReadUnauthorized) Code() int { + return 401 +} + +func (o *ConversationReadUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadUnauthorized", 401) +} + +func (o *ConversationReadUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadUnauthorized", 401) +} + +func (o *ConversationReadUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationReadNotFound creates a ConversationReadNotFound with default headers values +func NewConversationReadNotFound() *ConversationReadNotFound { + return &ConversationReadNotFound{} +} + +/* +ConversationReadNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ConversationReadNotFound struct { +} + +// IsSuccess returns true when this conversation read not found response has a 2xx status code +func (o *ConversationReadNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation read not found response has a 3xx status code +func (o *ConversationReadNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation read not found response has a 4xx status code +func (o *ConversationReadNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversation read not found response has a 5xx status code +func (o *ConversationReadNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation read not found response a status code equal to that given +func (o *ConversationReadNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the conversation read not found response +func (o *ConversationReadNotFound) Code() int { + return 404 +} + +func (o *ConversationReadNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadNotFound", 404) +} + +func (o *ConversationReadNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadNotFound", 404) +} + +func (o *ConversationReadNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationReadNotAcceptable creates a ConversationReadNotAcceptable with default headers values +func NewConversationReadNotAcceptable() *ConversationReadNotAcceptable { + return &ConversationReadNotAcceptable{} +} + +/* +ConversationReadNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ConversationReadNotAcceptable struct { +} + +// IsSuccess returns true when this conversation read not acceptable response has a 2xx status code +func (o *ConversationReadNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation read not acceptable response has a 3xx status code +func (o *ConversationReadNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation read not acceptable response has a 4xx status code +func (o *ConversationReadNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversation read not acceptable response has a 5xx status code +func (o *ConversationReadNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation read not acceptable response a status code equal to that given +func (o *ConversationReadNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the conversation read not acceptable response +func (o *ConversationReadNotAcceptable) Code() int { + return 406 +} + +func (o *ConversationReadNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadNotAcceptable", 406) +} + +func (o *ConversationReadNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadNotAcceptable", 406) +} + +func (o *ConversationReadNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationReadUnprocessableEntity creates a ConversationReadUnprocessableEntity with default headers values +func NewConversationReadUnprocessableEntity() *ConversationReadUnprocessableEntity { + return &ConversationReadUnprocessableEntity{} +} + +/* +ConversationReadUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable content +*/ +type ConversationReadUnprocessableEntity struct { +} + +// IsSuccess returns true when this conversation read unprocessable entity response has a 2xx status code +func (o *ConversationReadUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation read unprocessable entity response has a 3xx status code +func (o *ConversationReadUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation read unprocessable entity response has a 4xx status code +func (o *ConversationReadUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversation read unprocessable entity response has a 5xx status code +func (o *ConversationReadUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation read unprocessable entity response a status code equal to that given +func (o *ConversationReadUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the conversation read unprocessable entity response +func (o *ConversationReadUnprocessableEntity) Code() int { + return 422 +} + +func (o *ConversationReadUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadUnprocessableEntity", 422) +} + +func (o *ConversationReadUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadUnprocessableEntity", 422) +} + +func (o *ConversationReadUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationReadInternalServerError creates a ConversationReadInternalServerError with default headers values +func NewConversationReadInternalServerError() *ConversationReadInternalServerError { + return &ConversationReadInternalServerError{} +} + +/* +ConversationReadInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ConversationReadInternalServerError struct { +} + +// IsSuccess returns true when this conversation read internal server error response has a 2xx status code +func (o *ConversationReadInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation read internal server error response has a 3xx status code +func (o *ConversationReadInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation read internal server error response has a 4xx status code +func (o *ConversationReadInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this conversation read internal server error response has a 5xx status code +func (o *ConversationReadInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this conversation read internal server error response a status code equal to that given +func (o *ConversationReadInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the conversation read internal server error response +func (o *ConversationReadInternalServerError) Code() int { + return 500 +} + +func (o *ConversationReadInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadInternalServerError", 500) +} + +func (o *ConversationReadInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadInternalServerError", 500) +} + +func (o *ConversationReadInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversations_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversations_client.go new file mode 100644 index 0000000..03b2945 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversations_client.go @@ -0,0 +1,200 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package conversations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new conversations API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new conversations API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new conversations API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for conversations API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ConversationDelete(params *ConversationDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ConversationDeleteOK, error) + + ConversationRead(params *ConversationReadParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ConversationReadOK, error) + + ConversationsGet(params *ConversationsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ConversationsGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + ConversationDelete deletes a single conversation with the given ID + + This doesn't delete the actual statuses in the conversation, + +nor does it prevent a new conversation from being created later from the same thread and participants. +*/ +func (a *Client) ConversationDelete(params *ConversationDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ConversationDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewConversationDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "conversationDelete", + Method: "DELETE", + PathPattern: "/api/v1/conversations/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ConversationDeleteReader{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.(*ConversationDeleteOK) + 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 conversationDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +ConversationRead marks a conversation with the given ID as read +*/ +func (a *Client) ConversationRead(params *ConversationReadParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ConversationReadOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewConversationReadParams() + } + op := &runtime.ClientOperation{ + ID: "conversationRead", + Method: "POST", + PathPattern: "/api/v1/conversation/{id}/read", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ConversationReadReader{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.(*ConversationReadOK) + 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 conversationRead: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ConversationsGet gets an array of direct message conversations that requesting account is involved in + + The next and previous queries can be parsed from the returned Link header. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) ConversationsGet(params *ConversationsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ConversationsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewConversationsGetParams() + } + op := &runtime.ClientOperation{ + ID: "conversationsGet", + Method: "GET", + PathPattern: "/api/v1/conversations", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ConversationsGetReader{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.(*ConversationsGetOK) + 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 conversationsGet: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversations_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversations_get_parameters.go new file mode 100644 index 0000000..06ad6a2 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversations_get_parameters.go @@ -0,0 +1,279 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package conversations + +// 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" +) + +// NewConversationsGetParams creates a new ConversationsGetParams 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 NewConversationsGetParams() *ConversationsGetParams { + return &ConversationsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewConversationsGetParamsWithTimeout creates a new ConversationsGetParams object +// with the ability to set a timeout on a request. +func NewConversationsGetParamsWithTimeout(timeout time.Duration) *ConversationsGetParams { + return &ConversationsGetParams{ + timeout: timeout, + } +} + +// NewConversationsGetParamsWithContext creates a new ConversationsGetParams object +// with the ability to set a context for a request. +func NewConversationsGetParamsWithContext(ctx context.Context) *ConversationsGetParams { + return &ConversationsGetParams{ + Context: ctx, + } +} + +// NewConversationsGetParamsWithHTTPClient creates a new ConversationsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewConversationsGetParamsWithHTTPClient(client *http.Client) *ConversationsGetParams { + return &ConversationsGetParams{ + HTTPClient: client, + } +} + +/* +ConversationsGetParams contains all the parameters to send to the API endpoint + + for the conversations get operation. + + Typically these are written to a http.Request. +*/ +type ConversationsGetParams struct { + + /* Limit. + + Number of conversations to return. + + Default: 40 + */ + Limit *int64 + + /* MaxID. + + Return only conversations with last statuses *OLDER* than the given max ID. The conversation with the specified ID will not be included in the response. NOTE: The ID is a status ID. Use the Link header for pagination. + */ + MaxID *string + + /* MinID. + + Return only conversations with last statuses *IMMEDIATELY NEWER* than the given min ID. The conversation with the specified ID will not be included in the response. NOTE: The ID is a status ID. Use the Link header for pagination. + */ + MinID *string + + /* SinceID. + + Return only conversations with last statuses *NEWER* than the given since ID. The conversation with the specified ID will not be included in the response. NOTE: The ID is a status ID. Use the Link header for pagination. + */ + SinceID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the conversations get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ConversationsGetParams) WithDefaults() *ConversationsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the conversations get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ConversationsGetParams) SetDefaults() { + var ( + limitDefault = int64(40) + ) + + val := ConversationsGetParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the conversations get params +func (o *ConversationsGetParams) WithTimeout(timeout time.Duration) *ConversationsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the conversations get params +func (o *ConversationsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the conversations get params +func (o *ConversationsGetParams) WithContext(ctx context.Context) *ConversationsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the conversations get params +func (o *ConversationsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the conversations get params +func (o *ConversationsGetParams) WithHTTPClient(client *http.Client) *ConversationsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the conversations get params +func (o *ConversationsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the conversations get params +func (o *ConversationsGetParams) WithLimit(limit *int64) *ConversationsGetParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the conversations get params +func (o *ConversationsGetParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the conversations get params +func (o *ConversationsGetParams) WithMaxID(maxID *string) *ConversationsGetParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the conversations get params +func (o *ConversationsGetParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the conversations get params +func (o *ConversationsGetParams) WithMinID(minID *string) *ConversationsGetParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the conversations get params +func (o *ConversationsGetParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the conversations get params +func (o *ConversationsGetParams) WithSinceID(sinceID *string) *ConversationsGetParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the conversations get params +func (o *ConversationsGetParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WriteToRequest writes these params to a swagger request +func (o *ConversationsGetParams) 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.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if o.SinceID != nil { + + // query param since_id + var qrSinceID string + + if o.SinceID != nil { + qrSinceID = *o.SinceID + } + qSinceID := qrSinceID + if qSinceID != "" { + + if err := r.SetQueryParam("since_id", qSinceID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversations_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversations_get_responses.go new file mode 100644 index 0000000..cfbb1fe --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/conversations/conversations_get_responses.go @@ -0,0 +1,426 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package conversations + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ConversationsGetReader is a Reader for the ConversationsGet structure. +type ConversationsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConversationsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConversationsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewConversationsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewConversationsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewConversationsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewConversationsGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewConversationsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/conversations] conversationsGet", response, response.Code()) + } +} + +// NewConversationsGetOK creates a ConversationsGetOK with default headers values +func NewConversationsGetOK() *ConversationsGetOK { + return &ConversationsGetOK{} +} + +/* +ConversationsGetOK describes a response with status code 200, with default header values. + +ConversationsGetOK conversations get o k +*/ +type ConversationsGetOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Conversation +} + +// IsSuccess returns true when this conversations get o k response has a 2xx status code +func (o *ConversationsGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this conversations get o k response has a 3xx status code +func (o *ConversationsGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversations get o k response has a 4xx status code +func (o *ConversationsGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this conversations get o k response has a 5xx status code +func (o *ConversationsGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this conversations get o k response a status code equal to that given +func (o *ConversationsGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the conversations get o k response +func (o *ConversationsGetOK) Code() int { + return 200 +} + +func (o *ConversationsGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetOK %s", 200, payload) +} + +func (o *ConversationsGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetOK %s", 200, payload) +} + +func (o *ConversationsGetOK) GetPayload() []*models.Conversation { + return o.Payload +} + +func (o *ConversationsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewConversationsGetBadRequest creates a ConversationsGetBadRequest with default headers values +func NewConversationsGetBadRequest() *ConversationsGetBadRequest { + return &ConversationsGetBadRequest{} +} + +/* +ConversationsGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ConversationsGetBadRequest struct { +} + +// IsSuccess returns true when this conversations get bad request response has a 2xx status code +func (o *ConversationsGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversations get bad request response has a 3xx status code +func (o *ConversationsGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversations get bad request response has a 4xx status code +func (o *ConversationsGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversations get bad request response has a 5xx status code +func (o *ConversationsGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this conversations get bad request response a status code equal to that given +func (o *ConversationsGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the conversations get bad request response +func (o *ConversationsGetBadRequest) Code() int { + return 400 +} + +func (o *ConversationsGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetBadRequest", 400) +} + +func (o *ConversationsGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetBadRequest", 400) +} + +func (o *ConversationsGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationsGetUnauthorized creates a ConversationsGetUnauthorized with default headers values +func NewConversationsGetUnauthorized() *ConversationsGetUnauthorized { + return &ConversationsGetUnauthorized{} +} + +/* +ConversationsGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ConversationsGetUnauthorized struct { +} + +// IsSuccess returns true when this conversations get unauthorized response has a 2xx status code +func (o *ConversationsGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversations get unauthorized response has a 3xx status code +func (o *ConversationsGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversations get unauthorized response has a 4xx status code +func (o *ConversationsGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversations get unauthorized response has a 5xx status code +func (o *ConversationsGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this conversations get unauthorized response a status code equal to that given +func (o *ConversationsGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the conversations get unauthorized response +func (o *ConversationsGetUnauthorized) Code() int { + return 401 +} + +func (o *ConversationsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetUnauthorized", 401) +} + +func (o *ConversationsGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetUnauthorized", 401) +} + +func (o *ConversationsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationsGetNotFound creates a ConversationsGetNotFound with default headers values +func NewConversationsGetNotFound() *ConversationsGetNotFound { + return &ConversationsGetNotFound{} +} + +/* +ConversationsGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ConversationsGetNotFound struct { +} + +// IsSuccess returns true when this conversations get not found response has a 2xx status code +func (o *ConversationsGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversations get not found response has a 3xx status code +func (o *ConversationsGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversations get not found response has a 4xx status code +func (o *ConversationsGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversations get not found response has a 5xx status code +func (o *ConversationsGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this conversations get not found response a status code equal to that given +func (o *ConversationsGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the conversations get not found response +func (o *ConversationsGetNotFound) Code() int { + return 404 +} + +func (o *ConversationsGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetNotFound", 404) +} + +func (o *ConversationsGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetNotFound", 404) +} + +func (o *ConversationsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationsGetNotAcceptable creates a ConversationsGetNotAcceptable with default headers values +func NewConversationsGetNotAcceptable() *ConversationsGetNotAcceptable { + return &ConversationsGetNotAcceptable{} +} + +/* +ConversationsGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ConversationsGetNotAcceptable struct { +} + +// IsSuccess returns true when this conversations get not acceptable response has a 2xx status code +func (o *ConversationsGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversations get not acceptable response has a 3xx status code +func (o *ConversationsGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversations get not acceptable response has a 4xx status code +func (o *ConversationsGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversations get not acceptable response has a 5xx status code +func (o *ConversationsGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this conversations get not acceptable response a status code equal to that given +func (o *ConversationsGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the conversations get not acceptable response +func (o *ConversationsGetNotAcceptable) Code() int { + return 406 +} + +func (o *ConversationsGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetNotAcceptable", 406) +} + +func (o *ConversationsGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetNotAcceptable", 406) +} + +func (o *ConversationsGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationsGetInternalServerError creates a ConversationsGetInternalServerError with default headers values +func NewConversationsGetInternalServerError() *ConversationsGetInternalServerError { + return &ConversationsGetInternalServerError{} +} + +/* +ConversationsGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ConversationsGetInternalServerError struct { +} + +// IsSuccess returns true when this conversations get internal server error response has a 2xx status code +func (o *ConversationsGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversations get internal server error response has a 3xx status code +func (o *ConversationsGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversations get internal server error response has a 4xx status code +func (o *ConversationsGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this conversations get internal server error response has a 5xx status code +func (o *ConversationsGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this conversations get internal server error response a status code equal to that given +func (o *ConversationsGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the conversations get internal server error response +func (o *ConversationsGetInternalServerError) Code() int { + return 500 +} + +func (o *ConversationsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetInternalServerError", 500) +} + +func (o *ConversationsGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetInternalServerError", 500) +} + +func (o *ConversationsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/custom_emojis/custom_emojis_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/custom_emojis/custom_emojis_client.go new file mode 100644 index 0000000..a9a8ce7 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/custom_emojis/custom_emojis_client.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package custom_emojis + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new custom emojis API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new custom emojis API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new custom emojis API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for custom emojis API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + CustomEmojisGet(params *CustomEmojisGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CustomEmojisGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +CustomEmojisGet gets an array of custom emojis available on the instance +*/ +func (a *Client) CustomEmojisGet(params *CustomEmojisGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CustomEmojisGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCustomEmojisGetParams() + } + op := &runtime.ClientOperation{ + ID: "customEmojisGet", + Method: "GET", + PathPattern: "/api/v1/custom_emojis", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &CustomEmojisGetReader{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.(*CustomEmojisGetOK) + 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 customEmojisGet: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/custom_emojis/custom_emojis_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/custom_emojis/custom_emojis_get_parameters.go new file mode 100644 index 0000000..105025f --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/custom_emojis/custom_emojis_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package custom_emojis + +// 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" +) + +// NewCustomEmojisGetParams creates a new CustomEmojisGetParams 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 NewCustomEmojisGetParams() *CustomEmojisGetParams { + return &CustomEmojisGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewCustomEmojisGetParamsWithTimeout creates a new CustomEmojisGetParams object +// with the ability to set a timeout on a request. +func NewCustomEmojisGetParamsWithTimeout(timeout time.Duration) *CustomEmojisGetParams { + return &CustomEmojisGetParams{ + timeout: timeout, + } +} + +// NewCustomEmojisGetParamsWithContext creates a new CustomEmojisGetParams object +// with the ability to set a context for a request. +func NewCustomEmojisGetParamsWithContext(ctx context.Context) *CustomEmojisGetParams { + return &CustomEmojisGetParams{ + Context: ctx, + } +} + +// NewCustomEmojisGetParamsWithHTTPClient creates a new CustomEmojisGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewCustomEmojisGetParamsWithHTTPClient(client *http.Client) *CustomEmojisGetParams { + return &CustomEmojisGetParams{ + HTTPClient: client, + } +} + +/* +CustomEmojisGetParams contains all the parameters to send to the API endpoint + + for the custom emojis get operation. + + Typically these are written to a http.Request. +*/ +type CustomEmojisGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the custom emojis get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CustomEmojisGetParams) WithDefaults() *CustomEmojisGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the custom emojis get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CustomEmojisGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the custom emojis get params +func (o *CustomEmojisGetParams) WithTimeout(timeout time.Duration) *CustomEmojisGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the custom emojis get params +func (o *CustomEmojisGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the custom emojis get params +func (o *CustomEmojisGetParams) WithContext(ctx context.Context) *CustomEmojisGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the custom emojis get params +func (o *CustomEmojisGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the custom emojis get params +func (o *CustomEmojisGetParams) WithHTTPClient(client *http.Client) *CustomEmojisGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the custom emojis get params +func (o *CustomEmojisGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *CustomEmojisGetParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/custom_emojis/custom_emojis_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/custom_emojis/custom_emojis_get_responses.go new file mode 100644 index 0000000..6ec6e81 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/custom_emojis/custom_emojis_get_responses.go @@ -0,0 +1,290 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package custom_emojis + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// CustomEmojisGetReader is a Reader for the CustomEmojisGet structure. +type CustomEmojisGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CustomEmojisGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCustomEmojisGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewCustomEmojisGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewCustomEmojisGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewCustomEmojisGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/custom_emojis] customEmojisGet", response, response.Code()) + } +} + +// NewCustomEmojisGetOK creates a CustomEmojisGetOK with default headers values +func NewCustomEmojisGetOK() *CustomEmojisGetOK { + return &CustomEmojisGetOK{} +} + +/* +CustomEmojisGetOK describes a response with status code 200, with default header values. + +Array of custom emojis. +*/ +type CustomEmojisGetOK struct { + Payload []*models.Emoji +} + +// IsSuccess returns true when this custom emojis get o k response has a 2xx status code +func (o *CustomEmojisGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this custom emojis get o k response has a 3xx status code +func (o *CustomEmojisGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this custom emojis get o k response has a 4xx status code +func (o *CustomEmojisGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this custom emojis get o k response has a 5xx status code +func (o *CustomEmojisGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this custom emojis get o k response a status code equal to that given +func (o *CustomEmojisGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the custom emojis get o k response +func (o *CustomEmojisGetOK) Code() int { + return 200 +} + +func (o *CustomEmojisGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/custom_emojis][%d] customEmojisGetOK %s", 200, payload) +} + +func (o *CustomEmojisGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/custom_emojis][%d] customEmojisGetOK %s", 200, payload) +} + +func (o *CustomEmojisGetOK) GetPayload() []*models.Emoji { + return o.Payload +} + +func (o *CustomEmojisGetOK) 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 +} + +// NewCustomEmojisGetUnauthorized creates a CustomEmojisGetUnauthorized with default headers values +func NewCustomEmojisGetUnauthorized() *CustomEmojisGetUnauthorized { + return &CustomEmojisGetUnauthorized{} +} + +/* +CustomEmojisGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type CustomEmojisGetUnauthorized struct { +} + +// IsSuccess returns true when this custom emojis get unauthorized response has a 2xx status code +func (o *CustomEmojisGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this custom emojis get unauthorized response has a 3xx status code +func (o *CustomEmojisGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this custom emojis get unauthorized response has a 4xx status code +func (o *CustomEmojisGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this custom emojis get unauthorized response has a 5xx status code +func (o *CustomEmojisGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this custom emojis get unauthorized response a status code equal to that given +func (o *CustomEmojisGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the custom emojis get unauthorized response +func (o *CustomEmojisGetUnauthorized) Code() int { + return 401 +} + +func (o *CustomEmojisGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/custom_emojis][%d] customEmojisGetUnauthorized", 401) +} + +func (o *CustomEmojisGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/custom_emojis][%d] customEmojisGetUnauthorized", 401) +} + +func (o *CustomEmojisGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewCustomEmojisGetNotAcceptable creates a CustomEmojisGetNotAcceptable with default headers values +func NewCustomEmojisGetNotAcceptable() *CustomEmojisGetNotAcceptable { + return &CustomEmojisGetNotAcceptable{} +} + +/* +CustomEmojisGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type CustomEmojisGetNotAcceptable struct { +} + +// IsSuccess returns true when this custom emojis get not acceptable response has a 2xx status code +func (o *CustomEmojisGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this custom emojis get not acceptable response has a 3xx status code +func (o *CustomEmojisGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this custom emojis get not acceptable response has a 4xx status code +func (o *CustomEmojisGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this custom emojis get not acceptable response has a 5xx status code +func (o *CustomEmojisGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this custom emojis get not acceptable response a status code equal to that given +func (o *CustomEmojisGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the custom emojis get not acceptable response +func (o *CustomEmojisGetNotAcceptable) Code() int { + return 406 +} + +func (o *CustomEmojisGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/custom_emojis][%d] customEmojisGetNotAcceptable", 406) +} + +func (o *CustomEmojisGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/custom_emojis][%d] customEmojisGetNotAcceptable", 406) +} + +func (o *CustomEmojisGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewCustomEmojisGetInternalServerError creates a CustomEmojisGetInternalServerError with default headers values +func NewCustomEmojisGetInternalServerError() *CustomEmojisGetInternalServerError { + return &CustomEmojisGetInternalServerError{} +} + +/* +CustomEmojisGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type CustomEmojisGetInternalServerError struct { +} + +// IsSuccess returns true when this custom emojis get internal server error response has a 2xx status code +func (o *CustomEmojisGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this custom emojis get internal server error response has a 3xx status code +func (o *CustomEmojisGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this custom emojis get internal server error response has a 4xx status code +func (o *CustomEmojisGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this custom emojis get internal server error response has a 5xx status code +func (o *CustomEmojisGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this custom emojis get internal server error response a status code equal to that given +func (o *CustomEmojisGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the custom emojis get internal server error response +func (o *CustomEmojisGetInternalServerError) Code() int { + return 500 +} + +func (o *CustomEmojisGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/custom_emojis][%d] customEmojisGetInternalServerError", 500) +} + +func (o *CustomEmojisGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/custom_emojis][%d] customEmojisGetInternalServerError", 500) +} + +func (o *CustomEmojisGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/debug/debug_a_p_url_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/debug/debug_a_p_url_parameters.go new file mode 100644 index 0000000..d381a8e --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/debug/debug_a_p_url_parameters.go @@ -0,0 +1,156 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package debug + +// 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" +) + +// NewDebugAPURLParams creates a new DebugAPURLParams 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 NewDebugAPURLParams() *DebugAPURLParams { + return &DebugAPURLParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDebugAPURLParamsWithTimeout creates a new DebugAPURLParams object +// with the ability to set a timeout on a request. +func NewDebugAPURLParamsWithTimeout(timeout time.Duration) *DebugAPURLParams { + return &DebugAPURLParams{ + timeout: timeout, + } +} + +// NewDebugAPURLParamsWithContext creates a new DebugAPURLParams object +// with the ability to set a context for a request. +func NewDebugAPURLParamsWithContext(ctx context.Context) *DebugAPURLParams { + return &DebugAPURLParams{ + Context: ctx, + } +} + +// NewDebugAPURLParamsWithHTTPClient creates a new DebugAPURLParams object +// with the ability to set a custom HTTPClient for a request. +func NewDebugAPURLParamsWithHTTPClient(client *http.Client) *DebugAPURLParams { + return &DebugAPURLParams{ + HTTPClient: client, + } +} + +/* +DebugAPURLParams contains all the parameters to send to the API endpoint + + for the debug a p Url operation. + + Typically these are written to a http.Request. +*/ +type DebugAPURLParams struct { + + /* URL. + + The URL / ActivityPub ID to dereference. This should be a full URL, including protocol. Eg., `https://example.org/users/someone` + */ + URL string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the debug a p Url params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DebugAPURLParams) WithDefaults() *DebugAPURLParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the debug a p Url params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DebugAPURLParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the debug a p Url params +func (o *DebugAPURLParams) WithTimeout(timeout time.Duration) *DebugAPURLParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the debug a p Url params +func (o *DebugAPURLParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the debug a p Url params +func (o *DebugAPURLParams) WithContext(ctx context.Context) *DebugAPURLParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the debug a p Url params +func (o *DebugAPURLParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the debug a p Url params +func (o *DebugAPURLParams) WithHTTPClient(client *http.Client) *DebugAPURLParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the debug a p Url params +func (o *DebugAPURLParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithURL adds the url to the debug a p Url params +func (o *DebugAPURLParams) WithURL(url string) *DebugAPURLParams { + o.SetURL(url) + return o +} + +// SetURL adds the url to the debug a p Url params +func (o *DebugAPURLParams) SetURL(url string) { + o.URL = url +} + +// WriteToRequest writes these params to a swagger request +func (o *DebugAPURLParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param url + qrURL := o.URL + qURL := qrURL + if qURL != "" { + + if err := r.SetQueryParam("url", qURL); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/debug/debug_a_p_url_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/debug/debug_a_p_url_responses.go new file mode 100644 index 0000000..a7b8dea --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/debug/debug_a_p_url_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package debug + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// DebugAPURLReader is a Reader for the DebugAPURL structure. +type DebugAPURLReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DebugAPURLReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDebugAPURLOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDebugAPURLBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDebugAPURLUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDebugAPURLNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDebugAPURLNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDebugAPURLInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/debug/apurl] debugAPUrl", response, response.Code()) + } +} + +// NewDebugAPURLOK creates a DebugAPURLOK with default headers values +func NewDebugAPURLOK() *DebugAPURLOK { + return &DebugAPURLOK{} +} + +/* +DebugAPURLOK describes a response with status code 200, with default header values. + +DebugAPURLOK debug a p Url o k +*/ +type DebugAPURLOK struct { + Payload *models.DebugAPURLResponse +} + +// IsSuccess returns true when this debug a p Url o k response has a 2xx status code +func (o *DebugAPURLOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this debug a p Url o k response has a 3xx status code +func (o *DebugAPURLOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug a p Url o k response has a 4xx status code +func (o *DebugAPURLOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this debug a p Url o k response has a 5xx status code +func (o *DebugAPURLOK) IsServerError() bool { + return false +} + +// IsCode returns true when this debug a p Url o k response a status code equal to that given +func (o *DebugAPURLOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the debug a p Url o k response +func (o *DebugAPURLOK) Code() int { + return 200 +} + +func (o *DebugAPURLOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlOK %s", 200, payload) +} + +func (o *DebugAPURLOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlOK %s", 200, payload) +} + +func (o *DebugAPURLOK) GetPayload() *models.DebugAPURLResponse { + return o.Payload +} + +func (o *DebugAPURLOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DebugAPURLResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDebugAPURLBadRequest creates a DebugAPURLBadRequest with default headers values +func NewDebugAPURLBadRequest() *DebugAPURLBadRequest { + return &DebugAPURLBadRequest{} +} + +/* +DebugAPURLBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DebugAPURLBadRequest struct { +} + +// IsSuccess returns true when this debug a p Url bad request response has a 2xx status code +func (o *DebugAPURLBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this debug a p Url bad request response has a 3xx status code +func (o *DebugAPURLBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug a p Url bad request response has a 4xx status code +func (o *DebugAPURLBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this debug a p Url bad request response has a 5xx status code +func (o *DebugAPURLBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this debug a p Url bad request response a status code equal to that given +func (o *DebugAPURLBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the debug a p Url bad request response +func (o *DebugAPURLBadRequest) Code() int { + return 400 +} + +func (o *DebugAPURLBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlBadRequest", 400) +} + +func (o *DebugAPURLBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlBadRequest", 400) +} + +func (o *DebugAPURLBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDebugAPURLUnauthorized creates a DebugAPURLUnauthorized with default headers values +func NewDebugAPURLUnauthorized() *DebugAPURLUnauthorized { + return &DebugAPURLUnauthorized{} +} + +/* +DebugAPURLUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DebugAPURLUnauthorized struct { +} + +// IsSuccess returns true when this debug a p Url unauthorized response has a 2xx status code +func (o *DebugAPURLUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this debug a p Url unauthorized response has a 3xx status code +func (o *DebugAPURLUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug a p Url unauthorized response has a 4xx status code +func (o *DebugAPURLUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this debug a p Url unauthorized response has a 5xx status code +func (o *DebugAPURLUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this debug a p Url unauthorized response a status code equal to that given +func (o *DebugAPURLUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the debug a p Url unauthorized response +func (o *DebugAPURLUnauthorized) Code() int { + return 401 +} + +func (o *DebugAPURLUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlUnauthorized", 401) +} + +func (o *DebugAPURLUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlUnauthorized", 401) +} + +func (o *DebugAPURLUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDebugAPURLNotFound creates a DebugAPURLNotFound with default headers values +func NewDebugAPURLNotFound() *DebugAPURLNotFound { + return &DebugAPURLNotFound{} +} + +/* +DebugAPURLNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DebugAPURLNotFound struct { +} + +// IsSuccess returns true when this debug a p Url not found response has a 2xx status code +func (o *DebugAPURLNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this debug a p Url not found response has a 3xx status code +func (o *DebugAPURLNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug a p Url not found response has a 4xx status code +func (o *DebugAPURLNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this debug a p Url not found response has a 5xx status code +func (o *DebugAPURLNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this debug a p Url not found response a status code equal to that given +func (o *DebugAPURLNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the debug a p Url not found response +func (o *DebugAPURLNotFound) Code() int { + return 404 +} + +func (o *DebugAPURLNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlNotFound", 404) +} + +func (o *DebugAPURLNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlNotFound", 404) +} + +func (o *DebugAPURLNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDebugAPURLNotAcceptable creates a DebugAPURLNotAcceptable with default headers values +func NewDebugAPURLNotAcceptable() *DebugAPURLNotAcceptable { + return &DebugAPURLNotAcceptable{} +} + +/* +DebugAPURLNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DebugAPURLNotAcceptable struct { +} + +// IsSuccess returns true when this debug a p Url not acceptable response has a 2xx status code +func (o *DebugAPURLNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this debug a p Url not acceptable response has a 3xx status code +func (o *DebugAPURLNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug a p Url not acceptable response has a 4xx status code +func (o *DebugAPURLNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this debug a p Url not acceptable response has a 5xx status code +func (o *DebugAPURLNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this debug a p Url not acceptable response a status code equal to that given +func (o *DebugAPURLNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the debug a p Url not acceptable response +func (o *DebugAPURLNotAcceptable) Code() int { + return 406 +} + +func (o *DebugAPURLNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlNotAcceptable", 406) +} + +func (o *DebugAPURLNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlNotAcceptable", 406) +} + +func (o *DebugAPURLNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDebugAPURLInternalServerError creates a DebugAPURLInternalServerError with default headers values +func NewDebugAPURLInternalServerError() *DebugAPURLInternalServerError { + return &DebugAPURLInternalServerError{} +} + +/* +DebugAPURLInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DebugAPURLInternalServerError struct { +} + +// IsSuccess returns true when this debug a p Url internal server error response has a 2xx status code +func (o *DebugAPURLInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this debug a p Url internal server error response has a 3xx status code +func (o *DebugAPURLInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug a p Url internal server error response has a 4xx status code +func (o *DebugAPURLInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this debug a p Url internal server error response has a 5xx status code +func (o *DebugAPURLInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this debug a p Url internal server error response a status code equal to that given +func (o *DebugAPURLInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the debug a p Url internal server error response +func (o *DebugAPURLInternalServerError) Code() int { + return 500 +} + +func (o *DebugAPURLInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlInternalServerError", 500) +} + +func (o *DebugAPURLInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlInternalServerError", 500) +} + +func (o *DebugAPURLInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/debug/debug_clear_caches_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/debug/debug_clear_caches_parameters.go new file mode 100644 index 0000000..a8a717e --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/debug/debug_clear_caches_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package debug + +// 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" +) + +// NewDebugClearCachesParams creates a new DebugClearCachesParams 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 NewDebugClearCachesParams() *DebugClearCachesParams { + return &DebugClearCachesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDebugClearCachesParamsWithTimeout creates a new DebugClearCachesParams object +// with the ability to set a timeout on a request. +func NewDebugClearCachesParamsWithTimeout(timeout time.Duration) *DebugClearCachesParams { + return &DebugClearCachesParams{ + timeout: timeout, + } +} + +// NewDebugClearCachesParamsWithContext creates a new DebugClearCachesParams object +// with the ability to set a context for a request. +func NewDebugClearCachesParamsWithContext(ctx context.Context) *DebugClearCachesParams { + return &DebugClearCachesParams{ + Context: ctx, + } +} + +// NewDebugClearCachesParamsWithHTTPClient creates a new DebugClearCachesParams object +// with the ability to set a custom HTTPClient for a request. +func NewDebugClearCachesParamsWithHTTPClient(client *http.Client) *DebugClearCachesParams { + return &DebugClearCachesParams{ + HTTPClient: client, + } +} + +/* +DebugClearCachesParams contains all the parameters to send to the API endpoint + + for the debug clear caches operation. + + Typically these are written to a http.Request. +*/ +type DebugClearCachesParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the debug clear caches params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DebugClearCachesParams) WithDefaults() *DebugClearCachesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the debug clear caches params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DebugClearCachesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the debug clear caches params +func (o *DebugClearCachesParams) WithTimeout(timeout time.Duration) *DebugClearCachesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the debug clear caches params +func (o *DebugClearCachesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the debug clear caches params +func (o *DebugClearCachesParams) WithContext(ctx context.Context) *DebugClearCachesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the debug clear caches params +func (o *DebugClearCachesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the debug clear caches params +func (o *DebugClearCachesParams) WithHTTPClient(client *http.Client) *DebugClearCachesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the debug clear caches params +func (o *DebugClearCachesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *DebugClearCachesParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/debug/debug_clear_caches_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/debug/debug_clear_caches_responses.go new file mode 100644 index 0000000..344c966 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/debug/debug_clear_caches_responses.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package debug + +// 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" +) + +// DebugClearCachesReader is a Reader for the DebugClearCaches structure. +type DebugClearCachesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DebugClearCachesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDebugClearCachesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDebugClearCachesBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDebugClearCachesUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDebugClearCachesNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDebugClearCachesNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDebugClearCachesInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/debug/caches/clear] debugClearCaches", response, response.Code()) + } +} + +// NewDebugClearCachesOK creates a DebugClearCachesOK with default headers values +func NewDebugClearCachesOK() *DebugClearCachesOK { + return &DebugClearCachesOK{} +} + +/* +DebugClearCachesOK describes a response with status code 200, with default header values. + +All good baby! +*/ +type DebugClearCachesOK struct { +} + +// IsSuccess returns true when this debug clear caches o k response has a 2xx status code +func (o *DebugClearCachesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this debug clear caches o k response has a 3xx status code +func (o *DebugClearCachesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug clear caches o k response has a 4xx status code +func (o *DebugClearCachesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this debug clear caches o k response has a 5xx status code +func (o *DebugClearCachesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this debug clear caches o k response a status code equal to that given +func (o *DebugClearCachesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the debug clear caches o k response +func (o *DebugClearCachesOK) Code() int { + return 200 +} + +func (o *DebugClearCachesOK) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesOK", 200) +} + +func (o *DebugClearCachesOK) String() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesOK", 200) +} + +func (o *DebugClearCachesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDebugClearCachesBadRequest creates a DebugClearCachesBadRequest with default headers values +func NewDebugClearCachesBadRequest() *DebugClearCachesBadRequest { + return &DebugClearCachesBadRequest{} +} + +/* +DebugClearCachesBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DebugClearCachesBadRequest struct { +} + +// IsSuccess returns true when this debug clear caches bad request response has a 2xx status code +func (o *DebugClearCachesBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this debug clear caches bad request response has a 3xx status code +func (o *DebugClearCachesBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug clear caches bad request response has a 4xx status code +func (o *DebugClearCachesBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this debug clear caches bad request response has a 5xx status code +func (o *DebugClearCachesBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this debug clear caches bad request response a status code equal to that given +func (o *DebugClearCachesBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the debug clear caches bad request response +func (o *DebugClearCachesBadRequest) Code() int { + return 400 +} + +func (o *DebugClearCachesBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesBadRequest", 400) +} + +func (o *DebugClearCachesBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesBadRequest", 400) +} + +func (o *DebugClearCachesBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDebugClearCachesUnauthorized creates a DebugClearCachesUnauthorized with default headers values +func NewDebugClearCachesUnauthorized() *DebugClearCachesUnauthorized { + return &DebugClearCachesUnauthorized{} +} + +/* +DebugClearCachesUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DebugClearCachesUnauthorized struct { +} + +// IsSuccess returns true when this debug clear caches unauthorized response has a 2xx status code +func (o *DebugClearCachesUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this debug clear caches unauthorized response has a 3xx status code +func (o *DebugClearCachesUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug clear caches unauthorized response has a 4xx status code +func (o *DebugClearCachesUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this debug clear caches unauthorized response has a 5xx status code +func (o *DebugClearCachesUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this debug clear caches unauthorized response a status code equal to that given +func (o *DebugClearCachesUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the debug clear caches unauthorized response +func (o *DebugClearCachesUnauthorized) Code() int { + return 401 +} + +func (o *DebugClearCachesUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesUnauthorized", 401) +} + +func (o *DebugClearCachesUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesUnauthorized", 401) +} + +func (o *DebugClearCachesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDebugClearCachesNotFound creates a DebugClearCachesNotFound with default headers values +func NewDebugClearCachesNotFound() *DebugClearCachesNotFound { + return &DebugClearCachesNotFound{} +} + +/* +DebugClearCachesNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DebugClearCachesNotFound struct { +} + +// IsSuccess returns true when this debug clear caches not found response has a 2xx status code +func (o *DebugClearCachesNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this debug clear caches not found response has a 3xx status code +func (o *DebugClearCachesNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug clear caches not found response has a 4xx status code +func (o *DebugClearCachesNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this debug clear caches not found response has a 5xx status code +func (o *DebugClearCachesNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this debug clear caches not found response a status code equal to that given +func (o *DebugClearCachesNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the debug clear caches not found response +func (o *DebugClearCachesNotFound) Code() int { + return 404 +} + +func (o *DebugClearCachesNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesNotFound", 404) +} + +func (o *DebugClearCachesNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesNotFound", 404) +} + +func (o *DebugClearCachesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDebugClearCachesNotAcceptable creates a DebugClearCachesNotAcceptable with default headers values +func NewDebugClearCachesNotAcceptable() *DebugClearCachesNotAcceptable { + return &DebugClearCachesNotAcceptable{} +} + +/* +DebugClearCachesNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DebugClearCachesNotAcceptable struct { +} + +// IsSuccess returns true when this debug clear caches not acceptable response has a 2xx status code +func (o *DebugClearCachesNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this debug clear caches not acceptable response has a 3xx status code +func (o *DebugClearCachesNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug clear caches not acceptable response has a 4xx status code +func (o *DebugClearCachesNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this debug clear caches not acceptable response has a 5xx status code +func (o *DebugClearCachesNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this debug clear caches not acceptable response a status code equal to that given +func (o *DebugClearCachesNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the debug clear caches not acceptable response +func (o *DebugClearCachesNotAcceptable) Code() int { + return 406 +} + +func (o *DebugClearCachesNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesNotAcceptable", 406) +} + +func (o *DebugClearCachesNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesNotAcceptable", 406) +} + +func (o *DebugClearCachesNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDebugClearCachesInternalServerError creates a DebugClearCachesInternalServerError with default headers values +func NewDebugClearCachesInternalServerError() *DebugClearCachesInternalServerError { + return &DebugClearCachesInternalServerError{} +} + +/* +DebugClearCachesInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DebugClearCachesInternalServerError struct { +} + +// IsSuccess returns true when this debug clear caches internal server error response has a 2xx status code +func (o *DebugClearCachesInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this debug clear caches internal server error response has a 3xx status code +func (o *DebugClearCachesInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug clear caches internal server error response has a 4xx status code +func (o *DebugClearCachesInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this debug clear caches internal server error response has a 5xx status code +func (o *DebugClearCachesInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this debug clear caches internal server error response a status code equal to that given +func (o *DebugClearCachesInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the debug clear caches internal server error response +func (o *DebugClearCachesInternalServerError) Code() int { + return 500 +} + +func (o *DebugClearCachesInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesInternalServerError", 500) +} + +func (o *DebugClearCachesInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesInternalServerError", 500) +} + +func (o *DebugClearCachesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/debug/debug_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/debug/debug_client.go new file mode 100644 index 0000000..2ce78f0 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/debug/debug_client.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package debug + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new debug API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new debug API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new debug API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for debug API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DebugAPURL(params *DebugAPURLParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DebugAPURLOK, error) + + DebugClearCaches(params *DebugClearCachesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DebugClearCachesOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DebugAPURL performs a g e t to the specified activity pub URL and return detailed debugging information + +Only enabled / exposed if GoToSocial was built and is running with flag DEBUG=1. +*/ +func (a *Client) DebugAPURL(params *DebugAPURLParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DebugAPURLOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDebugAPURLParams() + } + op := &runtime.ClientOperation{ + ID: "debugAPUrl", + Method: "GET", + PathPattern: "/api/v1/admin/debug/apurl", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DebugAPURLReader{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.(*DebugAPURLOK) + 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 debugAPUrl: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +DebugClearCaches sweeps clear all in memory caches + +Only enabled / exposed if GoToSocial was built and is running with flag DEBUG=1. +*/ +func (a *Client) DebugClearCaches(params *DebugClearCachesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DebugClearCachesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDebugClearCachesParams() + } + op := &runtime.ClientOperation{ + ID: "debugClearCaches", + Method: "POST", + PathPattern: "/api/v1/admin/debug/caches/clear", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DebugClearCachesReader{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.(*DebugClearCachesOK) + 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 debugClearCaches: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/favourites/favourites_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/favourites/favourites_client.go new file mode 100644 index 0000000..e72599b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/favourites/favourites_client.go @@ -0,0 +1,114 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package favourites + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new favourites API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new favourites API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new favourites API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for favourites API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + FavouritesGet(params *FavouritesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FavouritesGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + FavouritesGet gets an array of statuses that the requesting account has favourited + + The next and previous queries can be parsed from the returned Link header. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) FavouritesGet(params *FavouritesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FavouritesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFavouritesGetParams() + } + op := &runtime.ClientOperation{ + ID: "favouritesGet", + Method: "GET", + PathPattern: "/api/v1/favourites", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FavouritesGetReader{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.(*FavouritesGetOK) + 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 favouritesGet: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/favourites/favourites_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/favourites/favourites_get_parameters.go new file mode 100644 index 0000000..a00545e --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/favourites/favourites_get_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package favourites + +// 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" +) + +// NewFavouritesGetParams creates a new FavouritesGetParams 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 NewFavouritesGetParams() *FavouritesGetParams { + return &FavouritesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFavouritesGetParamsWithTimeout creates a new FavouritesGetParams object +// with the ability to set a timeout on a request. +func NewFavouritesGetParamsWithTimeout(timeout time.Duration) *FavouritesGetParams { + return &FavouritesGetParams{ + timeout: timeout, + } +} + +// NewFavouritesGetParamsWithContext creates a new FavouritesGetParams object +// with the ability to set a context for a request. +func NewFavouritesGetParamsWithContext(ctx context.Context) *FavouritesGetParams { + return &FavouritesGetParams{ + Context: ctx, + } +} + +// NewFavouritesGetParamsWithHTTPClient creates a new FavouritesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewFavouritesGetParamsWithHTTPClient(client *http.Client) *FavouritesGetParams { + return &FavouritesGetParams{ + HTTPClient: client, + } +} + +/* +FavouritesGetParams contains all the parameters to send to the API endpoint + + for the favourites get operation. + + Typically these are written to a http.Request. +*/ +type FavouritesGetParams struct { + + /* Limit. + + Number of statuses to return. + + Default: 20 + */ + Limit *int64 + + /* MaxID. + + Return only favourited statuses *OLDER* than the given favourite ID. The status with the corresponding fave ID will not be included in the response. + */ + MaxID *string + + /* MinID. + + Return only favourited statuses *NEWER* than the given favourite ID. The status with the corresponding fave ID will not be included in the response. + */ + MinID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the favourites get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FavouritesGetParams) WithDefaults() *FavouritesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the favourites get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FavouritesGetParams) SetDefaults() { + var ( + limitDefault = int64(20) + ) + + val := FavouritesGetParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the favourites get params +func (o *FavouritesGetParams) WithTimeout(timeout time.Duration) *FavouritesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the favourites get params +func (o *FavouritesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the favourites get params +func (o *FavouritesGetParams) WithContext(ctx context.Context) *FavouritesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the favourites get params +func (o *FavouritesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the favourites get params +func (o *FavouritesGetParams) WithHTTPClient(client *http.Client) *FavouritesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the favourites get params +func (o *FavouritesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the favourites get params +func (o *FavouritesGetParams) WithLimit(limit *int64) *FavouritesGetParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the favourites get params +func (o *FavouritesGetParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the favourites get params +func (o *FavouritesGetParams) WithMaxID(maxID *string) *FavouritesGetParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the favourites get params +func (o *FavouritesGetParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the favourites get params +func (o *FavouritesGetParams) WithMinID(minID *string) *FavouritesGetParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the favourites get params +func (o *FavouritesGetParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WriteToRequest writes these params to a swagger request +func (o *FavouritesGetParams) 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.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/favourites/favourites_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/favourites/favourites_get_responses.go new file mode 100644 index 0000000..239333d --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/favourites/favourites_get_responses.go @@ -0,0 +1,426 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package favourites + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FavouritesGetReader is a Reader for the FavouritesGet structure. +type FavouritesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FavouritesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFavouritesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFavouritesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFavouritesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFavouritesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFavouritesGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFavouritesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/favourites] favouritesGet", response, response.Code()) + } +} + +// NewFavouritesGetOK creates a FavouritesGetOK with default headers values +func NewFavouritesGetOK() *FavouritesGetOK { + return &FavouritesGetOK{} +} + +/* +FavouritesGetOK describes a response with status code 200, with default header values. + +FavouritesGetOK favourites get o k +*/ +type FavouritesGetOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Status +} + +// IsSuccess returns true when this favourites get o k response has a 2xx status code +func (o *FavouritesGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this favourites get o k response has a 3xx status code +func (o *FavouritesGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this favourites get o k response has a 4xx status code +func (o *FavouritesGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this favourites get o k response has a 5xx status code +func (o *FavouritesGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this favourites get o k response a status code equal to that given +func (o *FavouritesGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the favourites get o k response +func (o *FavouritesGetOK) Code() int { + return 200 +} + +func (o *FavouritesGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetOK %s", 200, payload) +} + +func (o *FavouritesGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetOK %s", 200, payload) +} + +func (o *FavouritesGetOK) GetPayload() []*models.Status { + return o.Payload +} + +func (o *FavouritesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFavouritesGetBadRequest creates a FavouritesGetBadRequest with default headers values +func NewFavouritesGetBadRequest() *FavouritesGetBadRequest { + return &FavouritesGetBadRequest{} +} + +/* +FavouritesGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FavouritesGetBadRequest struct { +} + +// IsSuccess returns true when this favourites get bad request response has a 2xx status code +func (o *FavouritesGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this favourites get bad request response has a 3xx status code +func (o *FavouritesGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this favourites get bad request response has a 4xx status code +func (o *FavouritesGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this favourites get bad request response has a 5xx status code +func (o *FavouritesGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this favourites get bad request response a status code equal to that given +func (o *FavouritesGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the favourites get bad request response +func (o *FavouritesGetBadRequest) Code() int { + return 400 +} + +func (o *FavouritesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetBadRequest", 400) +} + +func (o *FavouritesGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetBadRequest", 400) +} + +func (o *FavouritesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFavouritesGetUnauthorized creates a FavouritesGetUnauthorized with default headers values +func NewFavouritesGetUnauthorized() *FavouritesGetUnauthorized { + return &FavouritesGetUnauthorized{} +} + +/* +FavouritesGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FavouritesGetUnauthorized struct { +} + +// IsSuccess returns true when this favourites get unauthorized response has a 2xx status code +func (o *FavouritesGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this favourites get unauthorized response has a 3xx status code +func (o *FavouritesGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this favourites get unauthorized response has a 4xx status code +func (o *FavouritesGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this favourites get unauthorized response has a 5xx status code +func (o *FavouritesGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this favourites get unauthorized response a status code equal to that given +func (o *FavouritesGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the favourites get unauthorized response +func (o *FavouritesGetUnauthorized) Code() int { + return 401 +} + +func (o *FavouritesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetUnauthorized", 401) +} + +func (o *FavouritesGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetUnauthorized", 401) +} + +func (o *FavouritesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFavouritesGetNotFound creates a FavouritesGetNotFound with default headers values +func NewFavouritesGetNotFound() *FavouritesGetNotFound { + return &FavouritesGetNotFound{} +} + +/* +FavouritesGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FavouritesGetNotFound struct { +} + +// IsSuccess returns true when this favourites get not found response has a 2xx status code +func (o *FavouritesGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this favourites get not found response has a 3xx status code +func (o *FavouritesGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this favourites get not found response has a 4xx status code +func (o *FavouritesGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this favourites get not found response has a 5xx status code +func (o *FavouritesGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this favourites get not found response a status code equal to that given +func (o *FavouritesGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the favourites get not found response +func (o *FavouritesGetNotFound) Code() int { + return 404 +} + +func (o *FavouritesGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetNotFound", 404) +} + +func (o *FavouritesGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetNotFound", 404) +} + +func (o *FavouritesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFavouritesGetNotAcceptable creates a FavouritesGetNotAcceptable with default headers values +func NewFavouritesGetNotAcceptable() *FavouritesGetNotAcceptable { + return &FavouritesGetNotAcceptable{} +} + +/* +FavouritesGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FavouritesGetNotAcceptable struct { +} + +// IsSuccess returns true when this favourites get not acceptable response has a 2xx status code +func (o *FavouritesGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this favourites get not acceptable response has a 3xx status code +func (o *FavouritesGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this favourites get not acceptable response has a 4xx status code +func (o *FavouritesGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this favourites get not acceptable response has a 5xx status code +func (o *FavouritesGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this favourites get not acceptable response a status code equal to that given +func (o *FavouritesGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the favourites get not acceptable response +func (o *FavouritesGetNotAcceptable) Code() int { + return 406 +} + +func (o *FavouritesGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetNotAcceptable", 406) +} + +func (o *FavouritesGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetNotAcceptable", 406) +} + +func (o *FavouritesGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFavouritesGetInternalServerError creates a FavouritesGetInternalServerError with default headers values +func NewFavouritesGetInternalServerError() *FavouritesGetInternalServerError { + return &FavouritesGetInternalServerError{} +} + +/* +FavouritesGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FavouritesGetInternalServerError struct { +} + +// IsSuccess returns true when this favourites get internal server error response has a 2xx status code +func (o *FavouritesGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this favourites get internal server error response has a 3xx status code +func (o *FavouritesGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this favourites get internal server error response has a 4xx status code +func (o *FavouritesGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this favourites get internal server error response has a 5xx status code +func (o *FavouritesGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this favourites get internal server error response a status code equal to that given +func (o *FavouritesGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the favourites get internal server error response +func (o *FavouritesGetInternalServerError) Code() int { + return 500 +} + +func (o *FavouritesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetInternalServerError", 500) +} + +func (o *FavouritesGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetInternalServerError", 500) +} + +func (o *FavouritesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/featured_tags/featured_tags_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/featured_tags/featured_tags_client.go new file mode 100644 index 0000000..b198d59 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/featured_tags/featured_tags_client.go @@ -0,0 +1,108 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package featured_tags + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new featured tags API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new featured tags API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new featured tags API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for featured tags API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + GetFeaturedTags(params *GetFeaturedTagsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFeaturedTagsOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +GetFeaturedTags gets an array of all hashtags that you currently have featured on your profile + +THIS ENDPOINT IS CURRENTLY NOT FULLY IMPLEMENTED: it will always return an empty array. +*/ +func (a *Client) GetFeaturedTags(params *GetFeaturedTagsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFeaturedTagsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetFeaturedTagsParams() + } + op := &runtime.ClientOperation{ + ID: "getFeaturedTags", + Method: "GET", + PathPattern: "/api/v1/featured_tags", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetFeaturedTagsReader{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.(*GetFeaturedTagsOK) + 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 getFeaturedTags: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/featured_tags/get_featured_tags_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/featured_tags/get_featured_tags_parameters.go new file mode 100644 index 0000000..4a59710 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/featured_tags/get_featured_tags_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package featured_tags + +// 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" +) + +// NewGetFeaturedTagsParams creates a new GetFeaturedTagsParams 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 NewGetFeaturedTagsParams() *GetFeaturedTagsParams { + return &GetFeaturedTagsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetFeaturedTagsParamsWithTimeout creates a new GetFeaturedTagsParams object +// with the ability to set a timeout on a request. +func NewGetFeaturedTagsParamsWithTimeout(timeout time.Duration) *GetFeaturedTagsParams { + return &GetFeaturedTagsParams{ + timeout: timeout, + } +} + +// NewGetFeaturedTagsParamsWithContext creates a new GetFeaturedTagsParams object +// with the ability to set a context for a request. +func NewGetFeaturedTagsParamsWithContext(ctx context.Context) *GetFeaturedTagsParams { + return &GetFeaturedTagsParams{ + Context: ctx, + } +} + +// NewGetFeaturedTagsParamsWithHTTPClient creates a new GetFeaturedTagsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetFeaturedTagsParamsWithHTTPClient(client *http.Client) *GetFeaturedTagsParams { + return &GetFeaturedTagsParams{ + HTTPClient: client, + } +} + +/* +GetFeaturedTagsParams contains all the parameters to send to the API endpoint + + for the get featured tags operation. + + Typically these are written to a http.Request. +*/ +type GetFeaturedTagsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get featured tags params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetFeaturedTagsParams) WithDefaults() *GetFeaturedTagsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get featured tags params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetFeaturedTagsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get featured tags params +func (o *GetFeaturedTagsParams) WithTimeout(timeout time.Duration) *GetFeaturedTagsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get featured tags params +func (o *GetFeaturedTagsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get featured tags params +func (o *GetFeaturedTagsParams) WithContext(ctx context.Context) *GetFeaturedTagsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get featured tags params +func (o *GetFeaturedTagsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get featured tags params +func (o *GetFeaturedTagsParams) WithHTTPClient(client *http.Client) *GetFeaturedTagsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get featured tags params +func (o *GetFeaturedTagsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetFeaturedTagsParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/featured_tags/get_featured_tags_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/featured_tags/get_featured_tags_responses.go new file mode 100644 index 0000000..e95efdb --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/featured_tags/get_featured_tags_responses.go @@ -0,0 +1,412 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package featured_tags + +// 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" +) + +// GetFeaturedTagsReader is a Reader for the GetFeaturedTags structure. +type GetFeaturedTagsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetFeaturedTagsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetFeaturedTagsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewGetFeaturedTagsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewGetFeaturedTagsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewGetFeaturedTagsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewGetFeaturedTagsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewGetFeaturedTagsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/featured_tags] getFeaturedTags", response, response.Code()) + } +} + +// NewGetFeaturedTagsOK creates a GetFeaturedTagsOK with default headers values +func NewGetFeaturedTagsOK() *GetFeaturedTagsOK { + return &GetFeaturedTagsOK{} +} + +/* +GetFeaturedTagsOK describes a response with status code 200, with default header values. + +GetFeaturedTagsOK get featured tags o k +*/ +type GetFeaturedTagsOK struct { + Payload []interface{} +} + +// IsSuccess returns true when this get featured tags o k response has a 2xx status code +func (o *GetFeaturedTagsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get featured tags o k response has a 3xx status code +func (o *GetFeaturedTagsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get featured tags o k response has a 4xx status code +func (o *GetFeaturedTagsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get featured tags o k response has a 5xx status code +func (o *GetFeaturedTagsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get featured tags o k response a status code equal to that given +func (o *GetFeaturedTagsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get featured tags o k response +func (o *GetFeaturedTagsOK) Code() int { + return 200 +} + +func (o *GetFeaturedTagsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsOK %s", 200, payload) +} + +func (o *GetFeaturedTagsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsOK %s", 200, payload) +} + +func (o *GetFeaturedTagsOK) GetPayload() []interface{} { + return o.Payload +} + +func (o *GetFeaturedTagsOK) 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 +} + +// NewGetFeaturedTagsBadRequest creates a GetFeaturedTagsBadRequest with default headers values +func NewGetFeaturedTagsBadRequest() *GetFeaturedTagsBadRequest { + return &GetFeaturedTagsBadRequest{} +} + +/* +GetFeaturedTagsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type GetFeaturedTagsBadRequest struct { +} + +// IsSuccess returns true when this get featured tags bad request response has a 2xx status code +func (o *GetFeaturedTagsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get featured tags bad request response has a 3xx status code +func (o *GetFeaturedTagsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get featured tags bad request response has a 4xx status code +func (o *GetFeaturedTagsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this get featured tags bad request response has a 5xx status code +func (o *GetFeaturedTagsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this get featured tags bad request response a status code equal to that given +func (o *GetFeaturedTagsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the get featured tags bad request response +func (o *GetFeaturedTagsBadRequest) Code() int { + return 400 +} + +func (o *GetFeaturedTagsBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsBadRequest", 400) +} + +func (o *GetFeaturedTagsBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsBadRequest", 400) +} + +func (o *GetFeaturedTagsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetFeaturedTagsUnauthorized creates a GetFeaturedTagsUnauthorized with default headers values +func NewGetFeaturedTagsUnauthorized() *GetFeaturedTagsUnauthorized { + return &GetFeaturedTagsUnauthorized{} +} + +/* +GetFeaturedTagsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type GetFeaturedTagsUnauthorized struct { +} + +// IsSuccess returns true when this get featured tags unauthorized response has a 2xx status code +func (o *GetFeaturedTagsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get featured tags unauthorized response has a 3xx status code +func (o *GetFeaturedTagsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get featured tags unauthorized response has a 4xx status code +func (o *GetFeaturedTagsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this get featured tags unauthorized response has a 5xx status code +func (o *GetFeaturedTagsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this get featured tags unauthorized response a status code equal to that given +func (o *GetFeaturedTagsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the get featured tags unauthorized response +func (o *GetFeaturedTagsUnauthorized) Code() int { + return 401 +} + +func (o *GetFeaturedTagsUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsUnauthorized", 401) +} + +func (o *GetFeaturedTagsUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsUnauthorized", 401) +} + +func (o *GetFeaturedTagsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetFeaturedTagsNotFound creates a GetFeaturedTagsNotFound with default headers values +func NewGetFeaturedTagsNotFound() *GetFeaturedTagsNotFound { + return &GetFeaturedTagsNotFound{} +} + +/* +GetFeaturedTagsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type GetFeaturedTagsNotFound struct { +} + +// IsSuccess returns true when this get featured tags not found response has a 2xx status code +func (o *GetFeaturedTagsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get featured tags not found response has a 3xx status code +func (o *GetFeaturedTagsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get featured tags not found response has a 4xx status code +func (o *GetFeaturedTagsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this get featured tags not found response has a 5xx status code +func (o *GetFeaturedTagsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this get featured tags not found response a status code equal to that given +func (o *GetFeaturedTagsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the get featured tags not found response +func (o *GetFeaturedTagsNotFound) Code() int { + return 404 +} + +func (o *GetFeaturedTagsNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsNotFound", 404) +} + +func (o *GetFeaturedTagsNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsNotFound", 404) +} + +func (o *GetFeaturedTagsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetFeaturedTagsNotAcceptable creates a GetFeaturedTagsNotAcceptable with default headers values +func NewGetFeaturedTagsNotAcceptable() *GetFeaturedTagsNotAcceptable { + return &GetFeaturedTagsNotAcceptable{} +} + +/* +GetFeaturedTagsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type GetFeaturedTagsNotAcceptable struct { +} + +// IsSuccess returns true when this get featured tags not acceptable response has a 2xx status code +func (o *GetFeaturedTagsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get featured tags not acceptable response has a 3xx status code +func (o *GetFeaturedTagsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get featured tags not acceptable response has a 4xx status code +func (o *GetFeaturedTagsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this get featured tags not acceptable response has a 5xx status code +func (o *GetFeaturedTagsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this get featured tags not acceptable response a status code equal to that given +func (o *GetFeaturedTagsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the get featured tags not acceptable response +func (o *GetFeaturedTagsNotAcceptable) Code() int { + return 406 +} + +func (o *GetFeaturedTagsNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsNotAcceptable", 406) +} + +func (o *GetFeaturedTagsNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsNotAcceptable", 406) +} + +func (o *GetFeaturedTagsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetFeaturedTagsInternalServerError creates a GetFeaturedTagsInternalServerError with default headers values +func NewGetFeaturedTagsInternalServerError() *GetFeaturedTagsInternalServerError { + return &GetFeaturedTagsInternalServerError{} +} + +/* +GetFeaturedTagsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type GetFeaturedTagsInternalServerError struct { +} + +// IsSuccess returns true when this get featured tags internal server error response has a 2xx status code +func (o *GetFeaturedTagsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get featured tags internal server error response has a 3xx status code +func (o *GetFeaturedTagsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get featured tags internal server error response has a 4xx status code +func (o *GetFeaturedTagsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this get featured tags internal server error response has a 5xx status code +func (o *GetFeaturedTagsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this get featured tags internal server error response a status code equal to that given +func (o *GetFeaturedTagsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the get featured tags internal server error response +func (o *GetFeaturedTagsInternalServerError) Code() int { + return 500 +} + +func (o *GetFeaturedTagsInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsInternalServerError", 500) +} + +func (o *GetFeaturedTagsInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsInternalServerError", 500) +} + +func (o *GetFeaturedTagsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/federation_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/federation_client.go new file mode 100644 index 0000000..676204b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/federation_client.go @@ -0,0 +1,227 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package federation + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new federation API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new federation API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new federation API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for federation API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithAccept allows the client to force the Accept header +// to negotiate a specific Producer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithAccept(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{mime} + } +} + +// WithAcceptApplicationActivityJSON sets the Accept header to "application/activity+json". +func WithAcceptApplicationActivityJSON(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{"application/activity+json"} +} + +// WithAcceptApplicationJSON sets the Accept header to "application/json". +func WithAcceptApplicationJSON(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{"application/json"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + S2sFeaturedCollectionGet(params *S2sFeaturedCollectionGetParams, opts ...ClientOption) (*S2sFeaturedCollectionGetOK, error) + + S2sOutboxGet(params *S2sOutboxGetParams, opts ...ClientOption) (*S2sOutboxGetOK, error) + + S2sRepliesGet(params *S2sRepliesGetParams, opts ...ClientOption) (*S2sRepliesGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + S2sFeaturedCollectionGet gets the featured collection pinned posts for a user + + The response will contain an ordered collection of Note URIs in the `items` property. + +It is up to the caller to dereference the provided Note URIs (or not, if they already have them cached). + +HTTP signature is required on the request. +*/ +func (a *Client) S2sFeaturedCollectionGet(params *S2sFeaturedCollectionGetParams, opts ...ClientOption) (*S2sFeaturedCollectionGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewS2sFeaturedCollectionGetParams() + } + op := &runtime.ClientOperation{ + ID: "s2sFeaturedCollectionGet", + Method: "GET", + PathPattern: "/users/{username}/collections/featured", + ProducesMediaTypes: []string{"application/activity+json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &S2sFeaturedCollectionGetReader{formats: a.formats}, + 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.(*S2sFeaturedCollectionGetOK) + 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 s2sFeaturedCollectionGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + S2sOutboxGet gets the public outbox collection for an actor + + Note that the response will be a Collection with a page as `first`, as shown below, if `page` is `false`. + +If `page` is `true`, then the response will be a single `CollectionPage` without the wrapping `Collection`. + +HTTP signature is required on the request. +*/ +func (a *Client) S2sOutboxGet(params *S2sOutboxGetParams, opts ...ClientOption) (*S2sOutboxGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewS2sOutboxGetParams() + } + op := &runtime.ClientOperation{ + ID: "s2sOutboxGet", + Method: "GET", + PathPattern: "/users/{username}/outbox", + ProducesMediaTypes: []string{"application/activity+json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &S2sOutboxGetReader{formats: a.formats}, + 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.(*S2sOutboxGetOK) + 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 s2sOutboxGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + S2sRepliesGet gets the replies collection for a status + + Note that the response will be a Collection with a page as `first`, as shown below, if `page` is `false`. + +If `page` is `true`, then the response will be a single `CollectionPage` without the wrapping `Collection`. + +HTTP signature is required on the request. +*/ +func (a *Client) S2sRepliesGet(params *S2sRepliesGetParams, opts ...ClientOption) (*S2sRepliesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewS2sRepliesGetParams() + } + op := &runtime.ClientOperation{ + ID: "s2sRepliesGet", + Method: "GET", + PathPattern: "/users/{username}/statuses/{status}/replies", + ProducesMediaTypes: []string{"application/activity+json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &S2sRepliesGetReader{formats: a.formats}, + 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.(*S2sRepliesGetOK) + 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 s2sRepliesGet: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/s2s_featured_collection_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/s2s_featured_collection_get_parameters.go new file mode 100644 index 0000000..2e8b939 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/s2s_featured_collection_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package federation + +// 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" +) + +// NewS2sFeaturedCollectionGetParams creates a new S2sFeaturedCollectionGetParams 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 NewS2sFeaturedCollectionGetParams() *S2sFeaturedCollectionGetParams { + return &S2sFeaturedCollectionGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewS2sFeaturedCollectionGetParamsWithTimeout creates a new S2sFeaturedCollectionGetParams object +// with the ability to set a timeout on a request. +func NewS2sFeaturedCollectionGetParamsWithTimeout(timeout time.Duration) *S2sFeaturedCollectionGetParams { + return &S2sFeaturedCollectionGetParams{ + timeout: timeout, + } +} + +// NewS2sFeaturedCollectionGetParamsWithContext creates a new S2sFeaturedCollectionGetParams object +// with the ability to set a context for a request. +func NewS2sFeaturedCollectionGetParamsWithContext(ctx context.Context) *S2sFeaturedCollectionGetParams { + return &S2sFeaturedCollectionGetParams{ + Context: ctx, + } +} + +// NewS2sFeaturedCollectionGetParamsWithHTTPClient creates a new S2sFeaturedCollectionGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewS2sFeaturedCollectionGetParamsWithHTTPClient(client *http.Client) *S2sFeaturedCollectionGetParams { + return &S2sFeaturedCollectionGetParams{ + HTTPClient: client, + } +} + +/* +S2sFeaturedCollectionGetParams contains all the parameters to send to the API endpoint + + for the s2s featured collection get operation. + + Typically these are written to a http.Request. +*/ +type S2sFeaturedCollectionGetParams struct { + + /* Username. + + Account name of the user + */ + Username string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the s2s featured collection get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *S2sFeaturedCollectionGetParams) WithDefaults() *S2sFeaturedCollectionGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the s2s featured collection get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *S2sFeaturedCollectionGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the s2s featured collection get params +func (o *S2sFeaturedCollectionGetParams) WithTimeout(timeout time.Duration) *S2sFeaturedCollectionGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the s2s featured collection get params +func (o *S2sFeaturedCollectionGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the s2s featured collection get params +func (o *S2sFeaturedCollectionGetParams) WithContext(ctx context.Context) *S2sFeaturedCollectionGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the s2s featured collection get params +func (o *S2sFeaturedCollectionGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the s2s featured collection get params +func (o *S2sFeaturedCollectionGetParams) WithHTTPClient(client *http.Client) *S2sFeaturedCollectionGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the s2s featured collection get params +func (o *S2sFeaturedCollectionGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithUsername adds the username to the s2s featured collection get params +func (o *S2sFeaturedCollectionGetParams) WithUsername(username string) *S2sFeaturedCollectionGetParams { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the s2s featured collection get params +func (o *S2sFeaturedCollectionGetParams) SetUsername(username string) { + o.Username = username +} + +// WriteToRequest writes these params to a swagger request +func (o *S2sFeaturedCollectionGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param username + if err := r.SetPathParam("username", o.Username); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/s2s_featured_collection_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/s2s_featured_collection_get_responses.go new file mode 100644 index 0000000..a8f0eba --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/s2s_featured_collection_get_responses.go @@ -0,0 +1,354 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package federation + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// S2sFeaturedCollectionGetReader is a Reader for the S2sFeaturedCollectionGet structure. +type S2sFeaturedCollectionGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *S2sFeaturedCollectionGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewS2sFeaturedCollectionGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewS2sFeaturedCollectionGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewS2sFeaturedCollectionGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewS2sFeaturedCollectionGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewS2sFeaturedCollectionGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /users/{username}/collections/featured] s2sFeaturedCollectionGet", response, response.Code()) + } +} + +// NewS2sFeaturedCollectionGetOK creates a S2sFeaturedCollectionGetOK with default headers values +func NewS2sFeaturedCollectionGetOK() *S2sFeaturedCollectionGetOK { + return &S2sFeaturedCollectionGetOK{} +} + +/* +S2sFeaturedCollectionGetOK describes a response with status code 200, with default header values. + +S2sFeaturedCollectionGetOK s2s featured collection get o k +*/ +type S2sFeaturedCollectionGetOK struct { + Payload *models.SwaggerFeaturedCollection +} + +// IsSuccess returns true when this s2s featured collection get o k response has a 2xx status code +func (o *S2sFeaturedCollectionGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this s2s featured collection get o k response has a 3xx status code +func (o *S2sFeaturedCollectionGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s featured collection get o k response has a 4xx status code +func (o *S2sFeaturedCollectionGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this s2s featured collection get o k response has a 5xx status code +func (o *S2sFeaturedCollectionGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s featured collection get o k response a status code equal to that given +func (o *S2sFeaturedCollectionGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the s2s featured collection get o k response +func (o *S2sFeaturedCollectionGetOK) Code() int { + return 200 +} + +func (o *S2sFeaturedCollectionGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /users/{username}/collections/featured][%d] s2sFeaturedCollectionGetOK %s", 200, payload) +} + +func (o *S2sFeaturedCollectionGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /users/{username}/collections/featured][%d] s2sFeaturedCollectionGetOK %s", 200, payload) +} + +func (o *S2sFeaturedCollectionGetOK) GetPayload() *models.SwaggerFeaturedCollection { + return o.Payload +} + +func (o *S2sFeaturedCollectionGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SwaggerFeaturedCollection) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewS2sFeaturedCollectionGetBadRequest creates a S2sFeaturedCollectionGetBadRequest with default headers values +func NewS2sFeaturedCollectionGetBadRequest() *S2sFeaturedCollectionGetBadRequest { + return &S2sFeaturedCollectionGetBadRequest{} +} + +/* +S2sFeaturedCollectionGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type S2sFeaturedCollectionGetBadRequest struct { +} + +// IsSuccess returns true when this s2s featured collection get bad request response has a 2xx status code +func (o *S2sFeaturedCollectionGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s featured collection get bad request response has a 3xx status code +func (o *S2sFeaturedCollectionGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s featured collection get bad request response has a 4xx status code +func (o *S2sFeaturedCollectionGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s featured collection get bad request response has a 5xx status code +func (o *S2sFeaturedCollectionGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s featured collection get bad request response a status code equal to that given +func (o *S2sFeaturedCollectionGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the s2s featured collection get bad request response +func (o *S2sFeaturedCollectionGetBadRequest) Code() int { + return 400 +} + +func (o *S2sFeaturedCollectionGetBadRequest) Error() string { + return fmt.Sprintf("[GET /users/{username}/collections/featured][%d] s2sFeaturedCollectionGetBadRequest", 400) +} + +func (o *S2sFeaturedCollectionGetBadRequest) String() string { + return fmt.Sprintf("[GET /users/{username}/collections/featured][%d] s2sFeaturedCollectionGetBadRequest", 400) +} + +func (o *S2sFeaturedCollectionGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewS2sFeaturedCollectionGetUnauthorized creates a S2sFeaturedCollectionGetUnauthorized with default headers values +func NewS2sFeaturedCollectionGetUnauthorized() *S2sFeaturedCollectionGetUnauthorized { + return &S2sFeaturedCollectionGetUnauthorized{} +} + +/* +S2sFeaturedCollectionGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type S2sFeaturedCollectionGetUnauthorized struct { +} + +// IsSuccess returns true when this s2s featured collection get unauthorized response has a 2xx status code +func (o *S2sFeaturedCollectionGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s featured collection get unauthorized response has a 3xx status code +func (o *S2sFeaturedCollectionGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s featured collection get unauthorized response has a 4xx status code +func (o *S2sFeaturedCollectionGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s featured collection get unauthorized response has a 5xx status code +func (o *S2sFeaturedCollectionGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s featured collection get unauthorized response a status code equal to that given +func (o *S2sFeaturedCollectionGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the s2s featured collection get unauthorized response +func (o *S2sFeaturedCollectionGetUnauthorized) Code() int { + return 401 +} + +func (o *S2sFeaturedCollectionGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /users/{username}/collections/featured][%d] s2sFeaturedCollectionGetUnauthorized", 401) +} + +func (o *S2sFeaturedCollectionGetUnauthorized) String() string { + return fmt.Sprintf("[GET /users/{username}/collections/featured][%d] s2sFeaturedCollectionGetUnauthorized", 401) +} + +func (o *S2sFeaturedCollectionGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewS2sFeaturedCollectionGetForbidden creates a S2sFeaturedCollectionGetForbidden with default headers values +func NewS2sFeaturedCollectionGetForbidden() *S2sFeaturedCollectionGetForbidden { + return &S2sFeaturedCollectionGetForbidden{} +} + +/* +S2sFeaturedCollectionGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type S2sFeaturedCollectionGetForbidden struct { +} + +// IsSuccess returns true when this s2s featured collection get forbidden response has a 2xx status code +func (o *S2sFeaturedCollectionGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s featured collection get forbidden response has a 3xx status code +func (o *S2sFeaturedCollectionGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s featured collection get forbidden response has a 4xx status code +func (o *S2sFeaturedCollectionGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s featured collection get forbidden response has a 5xx status code +func (o *S2sFeaturedCollectionGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s featured collection get forbidden response a status code equal to that given +func (o *S2sFeaturedCollectionGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the s2s featured collection get forbidden response +func (o *S2sFeaturedCollectionGetForbidden) Code() int { + return 403 +} + +func (o *S2sFeaturedCollectionGetForbidden) Error() string { + return fmt.Sprintf("[GET /users/{username}/collections/featured][%d] s2sFeaturedCollectionGetForbidden", 403) +} + +func (o *S2sFeaturedCollectionGetForbidden) String() string { + return fmt.Sprintf("[GET /users/{username}/collections/featured][%d] s2sFeaturedCollectionGetForbidden", 403) +} + +func (o *S2sFeaturedCollectionGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewS2sFeaturedCollectionGetNotFound creates a S2sFeaturedCollectionGetNotFound with default headers values +func NewS2sFeaturedCollectionGetNotFound() *S2sFeaturedCollectionGetNotFound { + return &S2sFeaturedCollectionGetNotFound{} +} + +/* +S2sFeaturedCollectionGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type S2sFeaturedCollectionGetNotFound struct { +} + +// IsSuccess returns true when this s2s featured collection get not found response has a 2xx status code +func (o *S2sFeaturedCollectionGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s featured collection get not found response has a 3xx status code +func (o *S2sFeaturedCollectionGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s featured collection get not found response has a 4xx status code +func (o *S2sFeaturedCollectionGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s featured collection get not found response has a 5xx status code +func (o *S2sFeaturedCollectionGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s featured collection get not found response a status code equal to that given +func (o *S2sFeaturedCollectionGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the s2s featured collection get not found response +func (o *S2sFeaturedCollectionGetNotFound) Code() int { + return 404 +} + +func (o *S2sFeaturedCollectionGetNotFound) Error() string { + return fmt.Sprintf("[GET /users/{username}/collections/featured][%d] s2sFeaturedCollectionGetNotFound", 404) +} + +func (o *S2sFeaturedCollectionGetNotFound) String() string { + return fmt.Sprintf("[GET /users/{username}/collections/featured][%d] s2sFeaturedCollectionGetNotFound", 404) +} + +func (o *S2sFeaturedCollectionGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/s2s_outbox_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/s2s_outbox_get_parameters.go new file mode 100644 index 0000000..ae4262e --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/s2s_outbox_get_parameters.go @@ -0,0 +1,265 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package federation + +// 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" +) + +// NewS2sOutboxGetParams creates a new S2sOutboxGetParams 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 NewS2sOutboxGetParams() *S2sOutboxGetParams { + return &S2sOutboxGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewS2sOutboxGetParamsWithTimeout creates a new S2sOutboxGetParams object +// with the ability to set a timeout on a request. +func NewS2sOutboxGetParamsWithTimeout(timeout time.Duration) *S2sOutboxGetParams { + return &S2sOutboxGetParams{ + timeout: timeout, + } +} + +// NewS2sOutboxGetParamsWithContext creates a new S2sOutboxGetParams object +// with the ability to set a context for a request. +func NewS2sOutboxGetParamsWithContext(ctx context.Context) *S2sOutboxGetParams { + return &S2sOutboxGetParams{ + Context: ctx, + } +} + +// NewS2sOutboxGetParamsWithHTTPClient creates a new S2sOutboxGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewS2sOutboxGetParamsWithHTTPClient(client *http.Client) *S2sOutboxGetParams { + return &S2sOutboxGetParams{ + HTTPClient: client, + } +} + +/* +S2sOutboxGetParams contains all the parameters to send to the API endpoint + + for the s2s outbox get operation. + + Typically these are written to a http.Request. +*/ +type S2sOutboxGetParams struct { + + /* MaxID. + + Maximum ID of the next status, used for paging. + */ + MaxID *string + + /* MinID. + + Minimum ID of the next status, used for paging. + */ + MinID *string + + /* Page. + + Return response as a CollectionPage. + */ + Page *bool + + /* Username. + + Username of the account. + */ + Username string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the s2s outbox get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *S2sOutboxGetParams) WithDefaults() *S2sOutboxGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the s2s outbox get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *S2sOutboxGetParams) SetDefaults() { + var ( + pageDefault = bool(false) + ) + + val := S2sOutboxGetParams{ + Page: &pageDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the s2s outbox get params +func (o *S2sOutboxGetParams) WithTimeout(timeout time.Duration) *S2sOutboxGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the s2s outbox get params +func (o *S2sOutboxGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the s2s outbox get params +func (o *S2sOutboxGetParams) WithContext(ctx context.Context) *S2sOutboxGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the s2s outbox get params +func (o *S2sOutboxGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the s2s outbox get params +func (o *S2sOutboxGetParams) WithHTTPClient(client *http.Client) *S2sOutboxGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the s2s outbox get params +func (o *S2sOutboxGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithMaxID adds the maxID to the s2s outbox get params +func (o *S2sOutboxGetParams) WithMaxID(maxID *string) *S2sOutboxGetParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the s2s outbox get params +func (o *S2sOutboxGetParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the s2s outbox get params +func (o *S2sOutboxGetParams) WithMinID(minID *string) *S2sOutboxGetParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the s2s outbox get params +func (o *S2sOutboxGetParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithPage adds the page to the s2s outbox get params +func (o *S2sOutboxGetParams) WithPage(page *bool) *S2sOutboxGetParams { + o.SetPage(page) + return o +} + +// SetPage adds the page to the s2s outbox get params +func (o *S2sOutboxGetParams) SetPage(page *bool) { + o.Page = page +} + +// WithUsername adds the username to the s2s outbox get params +func (o *S2sOutboxGetParams) WithUsername(username string) *S2sOutboxGetParams { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the s2s outbox get params +func (o *S2sOutboxGetParams) SetUsername(username string) { + o.Username = username +} + +// WriteToRequest writes these params to a swagger request +func (o *S2sOutboxGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if o.Page != nil { + + // query param page + var qrPage bool + + if o.Page != nil { + qrPage = *o.Page + } + qPage := swag.FormatBool(qrPage) + if qPage != "" { + + if err := r.SetQueryParam("page", qPage); err != nil { + return err + } + } + } + + // path param username + if err := r.SetPathParam("username", o.Username); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/s2s_outbox_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/s2s_outbox_get_responses.go new file mode 100644 index 0000000..b100a79 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/s2s_outbox_get_responses.go @@ -0,0 +1,354 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package federation + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// S2sOutboxGetReader is a Reader for the S2sOutboxGet structure. +type S2sOutboxGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *S2sOutboxGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewS2sOutboxGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewS2sOutboxGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewS2sOutboxGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewS2sOutboxGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewS2sOutboxGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /users/{username}/outbox] s2sOutboxGet", response, response.Code()) + } +} + +// NewS2sOutboxGetOK creates a S2sOutboxGetOK with default headers values +func NewS2sOutboxGetOK() *S2sOutboxGetOK { + return &S2sOutboxGetOK{} +} + +/* +S2sOutboxGetOK describes a response with status code 200, with default header values. + +S2sOutboxGetOK s2s outbox get o k +*/ +type S2sOutboxGetOK struct { + Payload *models.SwaggerCollection +} + +// IsSuccess returns true when this s2s outbox get o k response has a 2xx status code +func (o *S2sOutboxGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this s2s outbox get o k response has a 3xx status code +func (o *S2sOutboxGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s outbox get o k response has a 4xx status code +func (o *S2sOutboxGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this s2s outbox get o k response has a 5xx status code +func (o *S2sOutboxGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s outbox get o k response a status code equal to that given +func (o *S2sOutboxGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the s2s outbox get o k response +func (o *S2sOutboxGetOK) Code() int { + return 200 +} + +func (o *S2sOutboxGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /users/{username}/outbox][%d] s2sOutboxGetOK %s", 200, payload) +} + +func (o *S2sOutboxGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /users/{username}/outbox][%d] s2sOutboxGetOK %s", 200, payload) +} + +func (o *S2sOutboxGetOK) GetPayload() *models.SwaggerCollection { + return o.Payload +} + +func (o *S2sOutboxGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SwaggerCollection) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewS2sOutboxGetBadRequest creates a S2sOutboxGetBadRequest with default headers values +func NewS2sOutboxGetBadRequest() *S2sOutboxGetBadRequest { + return &S2sOutboxGetBadRequest{} +} + +/* +S2sOutboxGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type S2sOutboxGetBadRequest struct { +} + +// IsSuccess returns true when this s2s outbox get bad request response has a 2xx status code +func (o *S2sOutboxGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s outbox get bad request response has a 3xx status code +func (o *S2sOutboxGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s outbox get bad request response has a 4xx status code +func (o *S2sOutboxGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s outbox get bad request response has a 5xx status code +func (o *S2sOutboxGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s outbox get bad request response a status code equal to that given +func (o *S2sOutboxGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the s2s outbox get bad request response +func (o *S2sOutboxGetBadRequest) Code() int { + return 400 +} + +func (o *S2sOutboxGetBadRequest) Error() string { + return fmt.Sprintf("[GET /users/{username}/outbox][%d] s2sOutboxGetBadRequest", 400) +} + +func (o *S2sOutboxGetBadRequest) String() string { + return fmt.Sprintf("[GET /users/{username}/outbox][%d] s2sOutboxGetBadRequest", 400) +} + +func (o *S2sOutboxGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewS2sOutboxGetUnauthorized creates a S2sOutboxGetUnauthorized with default headers values +func NewS2sOutboxGetUnauthorized() *S2sOutboxGetUnauthorized { + return &S2sOutboxGetUnauthorized{} +} + +/* +S2sOutboxGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type S2sOutboxGetUnauthorized struct { +} + +// IsSuccess returns true when this s2s outbox get unauthorized response has a 2xx status code +func (o *S2sOutboxGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s outbox get unauthorized response has a 3xx status code +func (o *S2sOutboxGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s outbox get unauthorized response has a 4xx status code +func (o *S2sOutboxGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s outbox get unauthorized response has a 5xx status code +func (o *S2sOutboxGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s outbox get unauthorized response a status code equal to that given +func (o *S2sOutboxGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the s2s outbox get unauthorized response +func (o *S2sOutboxGetUnauthorized) Code() int { + return 401 +} + +func (o *S2sOutboxGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /users/{username}/outbox][%d] s2sOutboxGetUnauthorized", 401) +} + +func (o *S2sOutboxGetUnauthorized) String() string { + return fmt.Sprintf("[GET /users/{username}/outbox][%d] s2sOutboxGetUnauthorized", 401) +} + +func (o *S2sOutboxGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewS2sOutboxGetForbidden creates a S2sOutboxGetForbidden with default headers values +func NewS2sOutboxGetForbidden() *S2sOutboxGetForbidden { + return &S2sOutboxGetForbidden{} +} + +/* +S2sOutboxGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type S2sOutboxGetForbidden struct { +} + +// IsSuccess returns true when this s2s outbox get forbidden response has a 2xx status code +func (o *S2sOutboxGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s outbox get forbidden response has a 3xx status code +func (o *S2sOutboxGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s outbox get forbidden response has a 4xx status code +func (o *S2sOutboxGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s outbox get forbidden response has a 5xx status code +func (o *S2sOutboxGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s outbox get forbidden response a status code equal to that given +func (o *S2sOutboxGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the s2s outbox get forbidden response +func (o *S2sOutboxGetForbidden) Code() int { + return 403 +} + +func (o *S2sOutboxGetForbidden) Error() string { + return fmt.Sprintf("[GET /users/{username}/outbox][%d] s2sOutboxGetForbidden", 403) +} + +func (o *S2sOutboxGetForbidden) String() string { + return fmt.Sprintf("[GET /users/{username}/outbox][%d] s2sOutboxGetForbidden", 403) +} + +func (o *S2sOutboxGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewS2sOutboxGetNotFound creates a S2sOutboxGetNotFound with default headers values +func NewS2sOutboxGetNotFound() *S2sOutboxGetNotFound { + return &S2sOutboxGetNotFound{} +} + +/* +S2sOutboxGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type S2sOutboxGetNotFound struct { +} + +// IsSuccess returns true when this s2s outbox get not found response has a 2xx status code +func (o *S2sOutboxGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s outbox get not found response has a 3xx status code +func (o *S2sOutboxGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s outbox get not found response has a 4xx status code +func (o *S2sOutboxGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s outbox get not found response has a 5xx status code +func (o *S2sOutboxGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s outbox get not found response a status code equal to that given +func (o *S2sOutboxGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the s2s outbox get not found response +func (o *S2sOutboxGetNotFound) Code() int { + return 404 +} + +func (o *S2sOutboxGetNotFound) Error() string { + return fmt.Sprintf("[GET /users/{username}/outbox][%d] s2sOutboxGetNotFound", 404) +} + +func (o *S2sOutboxGetNotFound) String() string { + return fmt.Sprintf("[GET /users/{username}/outbox][%d] s2sOutboxGetNotFound", 404) +} + +func (o *S2sOutboxGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/s2s_replies_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/s2s_replies_get_parameters.go new file mode 100644 index 0000000..ab9f52f --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/s2s_replies_get_parameters.go @@ -0,0 +1,290 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package federation + +// 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" +) + +// NewS2sRepliesGetParams creates a new S2sRepliesGetParams 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 NewS2sRepliesGetParams() *S2sRepliesGetParams { + return &S2sRepliesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewS2sRepliesGetParamsWithTimeout creates a new S2sRepliesGetParams object +// with the ability to set a timeout on a request. +func NewS2sRepliesGetParamsWithTimeout(timeout time.Duration) *S2sRepliesGetParams { + return &S2sRepliesGetParams{ + timeout: timeout, + } +} + +// NewS2sRepliesGetParamsWithContext creates a new S2sRepliesGetParams object +// with the ability to set a context for a request. +func NewS2sRepliesGetParamsWithContext(ctx context.Context) *S2sRepliesGetParams { + return &S2sRepliesGetParams{ + Context: ctx, + } +} + +// NewS2sRepliesGetParamsWithHTTPClient creates a new S2sRepliesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewS2sRepliesGetParamsWithHTTPClient(client *http.Client) *S2sRepliesGetParams { + return &S2sRepliesGetParams{ + HTTPClient: client, + } +} + +/* +S2sRepliesGetParams contains all the parameters to send to the API endpoint + + for the s2s replies get operation. + + Typically these are written to a http.Request. +*/ +type S2sRepliesGetParams struct { + + /* MinID. + + Minimum ID of the next status, used for paging. + */ + MinID *string + + /* OnlyOtherAccounts. + + Return replies only from accounts other than the status owner. + */ + OnlyOtherAccounts *bool + + /* Page. + + Return response as a CollectionPage. + */ + Page *bool + + /* Status. + + ID of the status. + */ + Status string + + /* Username. + + Username of the account. + */ + Username string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the s2s replies get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *S2sRepliesGetParams) WithDefaults() *S2sRepliesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the s2s replies get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *S2sRepliesGetParams) SetDefaults() { + var ( + onlyOtherAccountsDefault = bool(false) + + pageDefault = bool(false) + ) + + val := S2sRepliesGetParams{ + OnlyOtherAccounts: &onlyOtherAccountsDefault, + Page: &pageDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the s2s replies get params +func (o *S2sRepliesGetParams) WithTimeout(timeout time.Duration) *S2sRepliesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the s2s replies get params +func (o *S2sRepliesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the s2s replies get params +func (o *S2sRepliesGetParams) WithContext(ctx context.Context) *S2sRepliesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the s2s replies get params +func (o *S2sRepliesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the s2s replies get params +func (o *S2sRepliesGetParams) WithHTTPClient(client *http.Client) *S2sRepliesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the s2s replies get params +func (o *S2sRepliesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithMinID adds the minID to the s2s replies get params +func (o *S2sRepliesGetParams) WithMinID(minID *string) *S2sRepliesGetParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the s2s replies get params +func (o *S2sRepliesGetParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithOnlyOtherAccounts adds the onlyOtherAccounts to the s2s replies get params +func (o *S2sRepliesGetParams) WithOnlyOtherAccounts(onlyOtherAccounts *bool) *S2sRepliesGetParams { + o.SetOnlyOtherAccounts(onlyOtherAccounts) + return o +} + +// SetOnlyOtherAccounts adds the onlyOtherAccounts to the s2s replies get params +func (o *S2sRepliesGetParams) SetOnlyOtherAccounts(onlyOtherAccounts *bool) { + o.OnlyOtherAccounts = onlyOtherAccounts +} + +// WithPage adds the page to the s2s replies get params +func (o *S2sRepliesGetParams) WithPage(page *bool) *S2sRepliesGetParams { + o.SetPage(page) + return o +} + +// SetPage adds the page to the s2s replies get params +func (o *S2sRepliesGetParams) SetPage(page *bool) { + o.Page = page +} + +// WithStatus adds the status to the s2s replies get params +func (o *S2sRepliesGetParams) WithStatus(status string) *S2sRepliesGetParams { + o.SetStatus(status) + return o +} + +// SetStatus adds the status to the s2s replies get params +func (o *S2sRepliesGetParams) SetStatus(status string) { + o.Status = status +} + +// WithUsername adds the username to the s2s replies get params +func (o *S2sRepliesGetParams) WithUsername(username string) *S2sRepliesGetParams { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the s2s replies get params +func (o *S2sRepliesGetParams) SetUsername(username string) { + o.Username = username +} + +// WriteToRequest writes these params to a swagger request +func (o *S2sRepliesGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if o.OnlyOtherAccounts != nil { + + // query param only_other_accounts + var qrOnlyOtherAccounts bool + + if o.OnlyOtherAccounts != nil { + qrOnlyOtherAccounts = *o.OnlyOtherAccounts + } + qOnlyOtherAccounts := swag.FormatBool(qrOnlyOtherAccounts) + if qOnlyOtherAccounts != "" { + + if err := r.SetQueryParam("only_other_accounts", qOnlyOtherAccounts); err != nil { + return err + } + } + } + + if o.Page != nil { + + // query param page + var qrPage bool + + if o.Page != nil { + qrPage = *o.Page + } + qPage := swag.FormatBool(qrPage) + if qPage != "" { + + if err := r.SetQueryParam("page", qPage); err != nil { + return err + } + } + } + + // path param status + if err := r.SetPathParam("status", o.Status); err != nil { + return err + } + + // path param username + if err := r.SetPathParam("username", o.Username); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/s2s_replies_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/s2s_replies_get_responses.go new file mode 100644 index 0000000..7b6ac36 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/federation/s2s_replies_get_responses.go @@ -0,0 +1,354 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package federation + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// S2sRepliesGetReader is a Reader for the S2sRepliesGet structure. +type S2sRepliesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *S2sRepliesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewS2sRepliesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewS2sRepliesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewS2sRepliesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewS2sRepliesGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewS2sRepliesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /users/{username}/statuses/{status}/replies] s2sRepliesGet", response, response.Code()) + } +} + +// NewS2sRepliesGetOK creates a S2sRepliesGetOK with default headers values +func NewS2sRepliesGetOK() *S2sRepliesGetOK { + return &S2sRepliesGetOK{} +} + +/* +S2sRepliesGetOK describes a response with status code 200, with default header values. + +S2sRepliesGetOK s2s replies get o k +*/ +type S2sRepliesGetOK struct { + Payload *models.SwaggerCollection +} + +// IsSuccess returns true when this s2s replies get o k response has a 2xx status code +func (o *S2sRepliesGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this s2s replies get o k response has a 3xx status code +func (o *S2sRepliesGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s replies get o k response has a 4xx status code +func (o *S2sRepliesGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this s2s replies get o k response has a 5xx status code +func (o *S2sRepliesGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s replies get o k response a status code equal to that given +func (o *S2sRepliesGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the s2s replies get o k response +func (o *S2sRepliesGetOK) Code() int { + return 200 +} + +func (o *S2sRepliesGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /users/{username}/statuses/{status}/replies][%d] s2sRepliesGetOK %s", 200, payload) +} + +func (o *S2sRepliesGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /users/{username}/statuses/{status}/replies][%d] s2sRepliesGetOK %s", 200, payload) +} + +func (o *S2sRepliesGetOK) GetPayload() *models.SwaggerCollection { + return o.Payload +} + +func (o *S2sRepliesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SwaggerCollection) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewS2sRepliesGetBadRequest creates a S2sRepliesGetBadRequest with default headers values +func NewS2sRepliesGetBadRequest() *S2sRepliesGetBadRequest { + return &S2sRepliesGetBadRequest{} +} + +/* +S2sRepliesGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type S2sRepliesGetBadRequest struct { +} + +// IsSuccess returns true when this s2s replies get bad request response has a 2xx status code +func (o *S2sRepliesGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s replies get bad request response has a 3xx status code +func (o *S2sRepliesGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s replies get bad request response has a 4xx status code +func (o *S2sRepliesGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s replies get bad request response has a 5xx status code +func (o *S2sRepliesGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s replies get bad request response a status code equal to that given +func (o *S2sRepliesGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the s2s replies get bad request response +func (o *S2sRepliesGetBadRequest) Code() int { + return 400 +} + +func (o *S2sRepliesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /users/{username}/statuses/{status}/replies][%d] s2sRepliesGetBadRequest", 400) +} + +func (o *S2sRepliesGetBadRequest) String() string { + return fmt.Sprintf("[GET /users/{username}/statuses/{status}/replies][%d] s2sRepliesGetBadRequest", 400) +} + +func (o *S2sRepliesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewS2sRepliesGetUnauthorized creates a S2sRepliesGetUnauthorized with default headers values +func NewS2sRepliesGetUnauthorized() *S2sRepliesGetUnauthorized { + return &S2sRepliesGetUnauthorized{} +} + +/* +S2sRepliesGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type S2sRepliesGetUnauthorized struct { +} + +// IsSuccess returns true when this s2s replies get unauthorized response has a 2xx status code +func (o *S2sRepliesGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s replies get unauthorized response has a 3xx status code +func (o *S2sRepliesGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s replies get unauthorized response has a 4xx status code +func (o *S2sRepliesGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s replies get unauthorized response has a 5xx status code +func (o *S2sRepliesGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s replies get unauthorized response a status code equal to that given +func (o *S2sRepliesGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the s2s replies get unauthorized response +func (o *S2sRepliesGetUnauthorized) Code() int { + return 401 +} + +func (o *S2sRepliesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /users/{username}/statuses/{status}/replies][%d] s2sRepliesGetUnauthorized", 401) +} + +func (o *S2sRepliesGetUnauthorized) String() string { + return fmt.Sprintf("[GET /users/{username}/statuses/{status}/replies][%d] s2sRepliesGetUnauthorized", 401) +} + +func (o *S2sRepliesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewS2sRepliesGetForbidden creates a S2sRepliesGetForbidden with default headers values +func NewS2sRepliesGetForbidden() *S2sRepliesGetForbidden { + return &S2sRepliesGetForbidden{} +} + +/* +S2sRepliesGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type S2sRepliesGetForbidden struct { +} + +// IsSuccess returns true when this s2s replies get forbidden response has a 2xx status code +func (o *S2sRepliesGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s replies get forbidden response has a 3xx status code +func (o *S2sRepliesGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s replies get forbidden response has a 4xx status code +func (o *S2sRepliesGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s replies get forbidden response has a 5xx status code +func (o *S2sRepliesGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s replies get forbidden response a status code equal to that given +func (o *S2sRepliesGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the s2s replies get forbidden response +func (o *S2sRepliesGetForbidden) Code() int { + return 403 +} + +func (o *S2sRepliesGetForbidden) Error() string { + return fmt.Sprintf("[GET /users/{username}/statuses/{status}/replies][%d] s2sRepliesGetForbidden", 403) +} + +func (o *S2sRepliesGetForbidden) String() string { + return fmt.Sprintf("[GET /users/{username}/statuses/{status}/replies][%d] s2sRepliesGetForbidden", 403) +} + +func (o *S2sRepliesGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewS2sRepliesGetNotFound creates a S2sRepliesGetNotFound with default headers values +func NewS2sRepliesGetNotFound() *S2sRepliesGetNotFound { + return &S2sRepliesGetNotFound{} +} + +/* +S2sRepliesGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type S2sRepliesGetNotFound struct { +} + +// IsSuccess returns true when this s2s replies get not found response has a 2xx status code +func (o *S2sRepliesGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s replies get not found response has a 3xx status code +func (o *S2sRepliesGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s replies get not found response has a 4xx status code +func (o *S2sRepliesGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s replies get not found response has a 5xx status code +func (o *S2sRepliesGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s replies get not found response a status code equal to that given +func (o *S2sRepliesGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the s2s replies get not found response +func (o *S2sRepliesGetNotFound) Code() int { + return 404 +} + +func (o *S2sRepliesGetNotFound) Error() string { + return fmt.Sprintf("[GET /users/{username}/statuses/{status}/replies][%d] s2sRepliesGetNotFound", 404) +} + +func (o *S2sRepliesGetNotFound) String() string { + return fmt.Sprintf("[GET /users/{username}/statuses/{status}/replies][%d] s2sRepliesGetNotFound", 404) +} + +func (o *S2sRepliesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_delete_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_delete_parameters.go new file mode 100644 index 0000000..e4e93f6 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterKeywordDeleteParams creates a new FilterKeywordDeleteParams 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 NewFilterKeywordDeleteParams() *FilterKeywordDeleteParams { + return &FilterKeywordDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterKeywordDeleteParamsWithTimeout creates a new FilterKeywordDeleteParams object +// with the ability to set a timeout on a request. +func NewFilterKeywordDeleteParamsWithTimeout(timeout time.Duration) *FilterKeywordDeleteParams { + return &FilterKeywordDeleteParams{ + timeout: timeout, + } +} + +// NewFilterKeywordDeleteParamsWithContext creates a new FilterKeywordDeleteParams object +// with the ability to set a context for a request. +func NewFilterKeywordDeleteParamsWithContext(ctx context.Context) *FilterKeywordDeleteParams { + return &FilterKeywordDeleteParams{ + Context: ctx, + } +} + +// NewFilterKeywordDeleteParamsWithHTTPClient creates a new FilterKeywordDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterKeywordDeleteParamsWithHTTPClient(client *http.Client) *FilterKeywordDeleteParams { + return &FilterKeywordDeleteParams{ + HTTPClient: client, + } +} + +/* +FilterKeywordDeleteParams contains all the parameters to send to the API endpoint + + for the filter keyword delete operation. + + Typically these are written to a http.Request. +*/ +type FilterKeywordDeleteParams struct { + + /* ID. + + ID of the filter keyword + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter keyword delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterKeywordDeleteParams) WithDefaults() *FilterKeywordDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter keyword delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterKeywordDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter keyword delete params +func (o *FilterKeywordDeleteParams) WithTimeout(timeout time.Duration) *FilterKeywordDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter keyword delete params +func (o *FilterKeywordDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter keyword delete params +func (o *FilterKeywordDeleteParams) WithContext(ctx context.Context) *FilterKeywordDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter keyword delete params +func (o *FilterKeywordDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter keyword delete params +func (o *FilterKeywordDeleteParams) WithHTTPClient(client *http.Client) *FilterKeywordDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter keyword delete params +func (o *FilterKeywordDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter keyword delete params +func (o *FilterKeywordDeleteParams) WithID(id string) *FilterKeywordDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter keyword delete params +func (o *FilterKeywordDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterKeywordDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_delete_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_delete_responses.go new file mode 100644 index 0000000..963d7e0 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_delete_responses.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// FilterKeywordDeleteReader is a Reader for the FilterKeywordDelete structure. +type FilterKeywordDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterKeywordDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterKeywordDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterKeywordDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterKeywordDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterKeywordDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterKeywordDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterKeywordDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v2/filters/keywords/{id}] filterKeywordDelete", response, response.Code()) + } +} + +// NewFilterKeywordDeleteOK creates a FilterKeywordDeleteOK with default headers values +func NewFilterKeywordDeleteOK() *FilterKeywordDeleteOK { + return &FilterKeywordDeleteOK{} +} + +/* +FilterKeywordDeleteOK describes a response with status code 200, with default header values. + +filter keyword deleted +*/ +type FilterKeywordDeleteOK struct { +} + +// IsSuccess returns true when this filter keyword delete o k response has a 2xx status code +func (o *FilterKeywordDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter keyword delete o k response has a 3xx status code +func (o *FilterKeywordDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword delete o k response has a 4xx status code +func (o *FilterKeywordDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter keyword delete o k response has a 5xx status code +func (o *FilterKeywordDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword delete o k response a status code equal to that given +func (o *FilterKeywordDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter keyword delete o k response +func (o *FilterKeywordDeleteOK) Code() int { + return 200 +} + +func (o *FilterKeywordDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteOK", 200) +} + +func (o *FilterKeywordDeleteOK) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteOK", 200) +} + +func (o *FilterKeywordDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordDeleteBadRequest creates a FilterKeywordDeleteBadRequest with default headers values +func NewFilterKeywordDeleteBadRequest() *FilterKeywordDeleteBadRequest { + return &FilterKeywordDeleteBadRequest{} +} + +/* +FilterKeywordDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterKeywordDeleteBadRequest struct { +} + +// IsSuccess returns true when this filter keyword delete bad request response has a 2xx status code +func (o *FilterKeywordDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword delete bad request response has a 3xx status code +func (o *FilterKeywordDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword delete bad request response has a 4xx status code +func (o *FilterKeywordDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword delete bad request response has a 5xx status code +func (o *FilterKeywordDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword delete bad request response a status code equal to that given +func (o *FilterKeywordDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter keyword delete bad request response +func (o *FilterKeywordDeleteBadRequest) Code() int { + return 400 +} + +func (o *FilterKeywordDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteBadRequest", 400) +} + +func (o *FilterKeywordDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteBadRequest", 400) +} + +func (o *FilterKeywordDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordDeleteUnauthorized creates a FilterKeywordDeleteUnauthorized with default headers values +func NewFilterKeywordDeleteUnauthorized() *FilterKeywordDeleteUnauthorized { + return &FilterKeywordDeleteUnauthorized{} +} + +/* +FilterKeywordDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterKeywordDeleteUnauthorized struct { +} + +// IsSuccess returns true when this filter keyword delete unauthorized response has a 2xx status code +func (o *FilterKeywordDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword delete unauthorized response has a 3xx status code +func (o *FilterKeywordDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword delete unauthorized response has a 4xx status code +func (o *FilterKeywordDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword delete unauthorized response has a 5xx status code +func (o *FilterKeywordDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword delete unauthorized response a status code equal to that given +func (o *FilterKeywordDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter keyword delete unauthorized response +func (o *FilterKeywordDeleteUnauthorized) Code() int { + return 401 +} + +func (o *FilterKeywordDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteUnauthorized", 401) +} + +func (o *FilterKeywordDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteUnauthorized", 401) +} + +func (o *FilterKeywordDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordDeleteNotFound creates a FilterKeywordDeleteNotFound with default headers values +func NewFilterKeywordDeleteNotFound() *FilterKeywordDeleteNotFound { + return &FilterKeywordDeleteNotFound{} +} + +/* +FilterKeywordDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterKeywordDeleteNotFound struct { +} + +// IsSuccess returns true when this filter keyword delete not found response has a 2xx status code +func (o *FilterKeywordDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword delete not found response has a 3xx status code +func (o *FilterKeywordDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword delete not found response has a 4xx status code +func (o *FilterKeywordDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword delete not found response has a 5xx status code +func (o *FilterKeywordDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword delete not found response a status code equal to that given +func (o *FilterKeywordDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter keyword delete not found response +func (o *FilterKeywordDeleteNotFound) Code() int { + return 404 +} + +func (o *FilterKeywordDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteNotFound", 404) +} + +func (o *FilterKeywordDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteNotFound", 404) +} + +func (o *FilterKeywordDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordDeleteNotAcceptable creates a FilterKeywordDeleteNotAcceptable with default headers values +func NewFilterKeywordDeleteNotAcceptable() *FilterKeywordDeleteNotAcceptable { + return &FilterKeywordDeleteNotAcceptable{} +} + +/* +FilterKeywordDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterKeywordDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this filter keyword delete not acceptable response has a 2xx status code +func (o *FilterKeywordDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword delete not acceptable response has a 3xx status code +func (o *FilterKeywordDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword delete not acceptable response has a 4xx status code +func (o *FilterKeywordDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword delete not acceptable response has a 5xx status code +func (o *FilterKeywordDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword delete not acceptable response a status code equal to that given +func (o *FilterKeywordDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter keyword delete not acceptable response +func (o *FilterKeywordDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *FilterKeywordDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteNotAcceptable", 406) +} + +func (o *FilterKeywordDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteNotAcceptable", 406) +} + +func (o *FilterKeywordDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordDeleteInternalServerError creates a FilterKeywordDeleteInternalServerError with default headers values +func NewFilterKeywordDeleteInternalServerError() *FilterKeywordDeleteInternalServerError { + return &FilterKeywordDeleteInternalServerError{} +} + +/* +FilterKeywordDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterKeywordDeleteInternalServerError struct { +} + +// IsSuccess returns true when this filter keyword delete internal server error response has a 2xx status code +func (o *FilterKeywordDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword delete internal server error response has a 3xx status code +func (o *FilterKeywordDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword delete internal server error response has a 4xx status code +func (o *FilterKeywordDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter keyword delete internal server error response has a 5xx status code +func (o *FilterKeywordDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter keyword delete internal server error response a status code equal to that given +func (o *FilterKeywordDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter keyword delete internal server error response +func (o *FilterKeywordDeleteInternalServerError) Code() int { + return 500 +} + +func (o *FilterKeywordDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteInternalServerError", 500) +} + +func (o *FilterKeywordDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteInternalServerError", 500) +} + +func (o *FilterKeywordDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_get_parameters.go new file mode 100644 index 0000000..acaeefc --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterKeywordGetParams creates a new FilterKeywordGetParams 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 NewFilterKeywordGetParams() *FilterKeywordGetParams { + return &FilterKeywordGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterKeywordGetParamsWithTimeout creates a new FilterKeywordGetParams object +// with the ability to set a timeout on a request. +func NewFilterKeywordGetParamsWithTimeout(timeout time.Duration) *FilterKeywordGetParams { + return &FilterKeywordGetParams{ + timeout: timeout, + } +} + +// NewFilterKeywordGetParamsWithContext creates a new FilterKeywordGetParams object +// with the ability to set a context for a request. +func NewFilterKeywordGetParamsWithContext(ctx context.Context) *FilterKeywordGetParams { + return &FilterKeywordGetParams{ + Context: ctx, + } +} + +// NewFilterKeywordGetParamsWithHTTPClient creates a new FilterKeywordGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterKeywordGetParamsWithHTTPClient(client *http.Client) *FilterKeywordGetParams { + return &FilterKeywordGetParams{ + HTTPClient: client, + } +} + +/* +FilterKeywordGetParams contains all the parameters to send to the API endpoint + + for the filter keyword get operation. + + Typically these are written to a http.Request. +*/ +type FilterKeywordGetParams struct { + + /* ID. + + ID of the filter keyword + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter keyword get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterKeywordGetParams) WithDefaults() *FilterKeywordGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter keyword get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterKeywordGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter keyword get params +func (o *FilterKeywordGetParams) WithTimeout(timeout time.Duration) *FilterKeywordGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter keyword get params +func (o *FilterKeywordGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter keyword get params +func (o *FilterKeywordGetParams) WithContext(ctx context.Context) *FilterKeywordGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter keyword get params +func (o *FilterKeywordGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter keyword get params +func (o *FilterKeywordGetParams) WithHTTPClient(client *http.Client) *FilterKeywordGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter keyword get params +func (o *FilterKeywordGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter keyword get params +func (o *FilterKeywordGetParams) WithID(id string) *FilterKeywordGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter keyword get params +func (o *FilterKeywordGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterKeywordGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_get_responses.go new file mode 100644 index 0000000..e9c91b3 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_get_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterKeywordGetReader is a Reader for the FilterKeywordGet structure. +type FilterKeywordGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterKeywordGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterKeywordGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterKeywordGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterKeywordGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterKeywordGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterKeywordGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterKeywordGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v2/filters/keywords/{id}] filterKeywordGet", response, response.Code()) + } +} + +// NewFilterKeywordGetOK creates a FilterKeywordGetOK with default headers values +func NewFilterKeywordGetOK() *FilterKeywordGetOK { + return &FilterKeywordGetOK{} +} + +/* +FilterKeywordGetOK describes a response with status code 200, with default header values. + +Requested filter keyword. +*/ +type FilterKeywordGetOK struct { + Payload *models.FilterKeyword +} + +// IsSuccess returns true when this filter keyword get o k response has a 2xx status code +func (o *FilterKeywordGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter keyword get o k response has a 3xx status code +func (o *FilterKeywordGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword get o k response has a 4xx status code +func (o *FilterKeywordGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter keyword get o k response has a 5xx status code +func (o *FilterKeywordGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword get o k response a status code equal to that given +func (o *FilterKeywordGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter keyword get o k response +func (o *FilterKeywordGetOK) Code() int { + return 200 +} + +func (o *FilterKeywordGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetOK %s", 200, payload) +} + +func (o *FilterKeywordGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetOK %s", 200, payload) +} + +func (o *FilterKeywordGetOK) GetPayload() *models.FilterKeyword { + return o.Payload +} + +func (o *FilterKeywordGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterKeyword) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterKeywordGetBadRequest creates a FilterKeywordGetBadRequest with default headers values +func NewFilterKeywordGetBadRequest() *FilterKeywordGetBadRequest { + return &FilterKeywordGetBadRequest{} +} + +/* +FilterKeywordGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterKeywordGetBadRequest struct { +} + +// IsSuccess returns true when this filter keyword get bad request response has a 2xx status code +func (o *FilterKeywordGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword get bad request response has a 3xx status code +func (o *FilterKeywordGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword get bad request response has a 4xx status code +func (o *FilterKeywordGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword get bad request response has a 5xx status code +func (o *FilterKeywordGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword get bad request response a status code equal to that given +func (o *FilterKeywordGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter keyword get bad request response +func (o *FilterKeywordGetBadRequest) Code() int { + return 400 +} + +func (o *FilterKeywordGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetBadRequest", 400) +} + +func (o *FilterKeywordGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetBadRequest", 400) +} + +func (o *FilterKeywordGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordGetUnauthorized creates a FilterKeywordGetUnauthorized with default headers values +func NewFilterKeywordGetUnauthorized() *FilterKeywordGetUnauthorized { + return &FilterKeywordGetUnauthorized{} +} + +/* +FilterKeywordGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterKeywordGetUnauthorized struct { +} + +// IsSuccess returns true when this filter keyword get unauthorized response has a 2xx status code +func (o *FilterKeywordGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword get unauthorized response has a 3xx status code +func (o *FilterKeywordGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword get unauthorized response has a 4xx status code +func (o *FilterKeywordGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword get unauthorized response has a 5xx status code +func (o *FilterKeywordGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword get unauthorized response a status code equal to that given +func (o *FilterKeywordGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter keyword get unauthorized response +func (o *FilterKeywordGetUnauthorized) Code() int { + return 401 +} + +func (o *FilterKeywordGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetUnauthorized", 401) +} + +func (o *FilterKeywordGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetUnauthorized", 401) +} + +func (o *FilterKeywordGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordGetNotFound creates a FilterKeywordGetNotFound with default headers values +func NewFilterKeywordGetNotFound() *FilterKeywordGetNotFound { + return &FilterKeywordGetNotFound{} +} + +/* +FilterKeywordGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterKeywordGetNotFound struct { +} + +// IsSuccess returns true when this filter keyword get not found response has a 2xx status code +func (o *FilterKeywordGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword get not found response has a 3xx status code +func (o *FilterKeywordGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword get not found response has a 4xx status code +func (o *FilterKeywordGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword get not found response has a 5xx status code +func (o *FilterKeywordGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword get not found response a status code equal to that given +func (o *FilterKeywordGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter keyword get not found response +func (o *FilterKeywordGetNotFound) Code() int { + return 404 +} + +func (o *FilterKeywordGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetNotFound", 404) +} + +func (o *FilterKeywordGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetNotFound", 404) +} + +func (o *FilterKeywordGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordGetNotAcceptable creates a FilterKeywordGetNotAcceptable with default headers values +func NewFilterKeywordGetNotAcceptable() *FilterKeywordGetNotAcceptable { + return &FilterKeywordGetNotAcceptable{} +} + +/* +FilterKeywordGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterKeywordGetNotAcceptable struct { +} + +// IsSuccess returns true when this filter keyword get not acceptable response has a 2xx status code +func (o *FilterKeywordGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword get not acceptable response has a 3xx status code +func (o *FilterKeywordGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword get not acceptable response has a 4xx status code +func (o *FilterKeywordGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword get not acceptable response has a 5xx status code +func (o *FilterKeywordGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword get not acceptable response a status code equal to that given +func (o *FilterKeywordGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter keyword get not acceptable response +func (o *FilterKeywordGetNotAcceptable) Code() int { + return 406 +} + +func (o *FilterKeywordGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetNotAcceptable", 406) +} + +func (o *FilterKeywordGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetNotAcceptable", 406) +} + +func (o *FilterKeywordGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordGetInternalServerError creates a FilterKeywordGetInternalServerError with default headers values +func NewFilterKeywordGetInternalServerError() *FilterKeywordGetInternalServerError { + return &FilterKeywordGetInternalServerError{} +} + +/* +FilterKeywordGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterKeywordGetInternalServerError struct { +} + +// IsSuccess returns true when this filter keyword get internal server error response has a 2xx status code +func (o *FilterKeywordGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword get internal server error response has a 3xx status code +func (o *FilterKeywordGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword get internal server error response has a 4xx status code +func (o *FilterKeywordGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter keyword get internal server error response has a 5xx status code +func (o *FilterKeywordGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter keyword get internal server error response a status code equal to that given +func (o *FilterKeywordGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter keyword get internal server error response +func (o *FilterKeywordGetInternalServerError) Code() int { + return 500 +} + +func (o *FilterKeywordGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetInternalServerError", 500) +} + +func (o *FilterKeywordGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetInternalServerError", 500) +} + +func (o *FilterKeywordGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_post_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_post_parameters.go new file mode 100644 index 0000000..3f30666 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_post_parameters.go @@ -0,0 +1,225 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterKeywordPostParams creates a new FilterKeywordPostParams 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 NewFilterKeywordPostParams() *FilterKeywordPostParams { + return &FilterKeywordPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterKeywordPostParamsWithTimeout creates a new FilterKeywordPostParams object +// with the ability to set a timeout on a request. +func NewFilterKeywordPostParamsWithTimeout(timeout time.Duration) *FilterKeywordPostParams { + return &FilterKeywordPostParams{ + timeout: timeout, + } +} + +// NewFilterKeywordPostParamsWithContext creates a new FilterKeywordPostParams object +// with the ability to set a context for a request. +func NewFilterKeywordPostParamsWithContext(ctx context.Context) *FilterKeywordPostParams { + return &FilterKeywordPostParams{ + Context: ctx, + } +} + +// NewFilterKeywordPostParamsWithHTTPClient creates a new FilterKeywordPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterKeywordPostParamsWithHTTPClient(client *http.Client) *FilterKeywordPostParams { + return &FilterKeywordPostParams{ + HTTPClient: client, + } +} + +/* +FilterKeywordPostParams contains all the parameters to send to the API endpoint + + for the filter keyword post operation. + + Typically these are written to a http.Request. +*/ +type FilterKeywordPostParams struct { + + /* ID. + + ID of the filter to add the filtered status to. + */ + ID string + + /* Keyword. + + The text to be filtered + + Sample: fnord + */ + Keyword string + + /* WholeWord. + + Should the filter consider word boundaries? + + Sample: true + */ + WholeWord *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter keyword post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterKeywordPostParams) WithDefaults() *FilterKeywordPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter keyword post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterKeywordPostParams) SetDefaults() { + var ( + wholeWordDefault = bool(false) + ) + + val := FilterKeywordPostParams{ + WholeWord: &wholeWordDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the filter keyword post params +func (o *FilterKeywordPostParams) WithTimeout(timeout time.Duration) *FilterKeywordPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter keyword post params +func (o *FilterKeywordPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter keyword post params +func (o *FilterKeywordPostParams) WithContext(ctx context.Context) *FilterKeywordPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter keyword post params +func (o *FilterKeywordPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter keyword post params +func (o *FilterKeywordPostParams) WithHTTPClient(client *http.Client) *FilterKeywordPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter keyword post params +func (o *FilterKeywordPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter keyword post params +func (o *FilterKeywordPostParams) WithID(id string) *FilterKeywordPostParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter keyword post params +func (o *FilterKeywordPostParams) SetID(id string) { + o.ID = id +} + +// WithKeyword adds the keyword to the filter keyword post params +func (o *FilterKeywordPostParams) WithKeyword(keyword string) *FilterKeywordPostParams { + o.SetKeyword(keyword) + return o +} + +// SetKeyword adds the keyword to the filter keyword post params +func (o *FilterKeywordPostParams) SetKeyword(keyword string) { + o.Keyword = keyword +} + +// WithWholeWord adds the wholeWord to the filter keyword post params +func (o *FilterKeywordPostParams) WithWholeWord(wholeWord *bool) *FilterKeywordPostParams { + o.SetWholeWord(wholeWord) + return o +} + +// SetWholeWord adds the wholeWord to the filter keyword post params +func (o *FilterKeywordPostParams) SetWholeWord(wholeWord *bool) { + o.WholeWord = wholeWord +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterKeywordPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // form param keyword + frKeyword := o.Keyword + fKeyword := frKeyword + if fKeyword != "" { + if err := r.SetFormParam("keyword", fKeyword); err != nil { + return err + } + } + + if o.WholeWord != nil { + + // form param whole_word + var frWholeWord bool + if o.WholeWord != nil { + frWholeWord = *o.WholeWord + } + fWholeWord := swag.FormatBool(frWholeWord) + if fWholeWord != "" { + if err := r.SetFormParam("whole_word", fWholeWord); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_post_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_post_responses.go new file mode 100644 index 0000000..7218efd --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_post_responses.go @@ -0,0 +1,602 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterKeywordPostReader is a Reader for the FilterKeywordPost structure. +type FilterKeywordPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterKeywordPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterKeywordPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterKeywordPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterKeywordPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewFilterKeywordPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterKeywordPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterKeywordPostNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewFilterKeywordPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewFilterKeywordPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterKeywordPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v2/filters/{id}/keywords] filterKeywordPost", response, response.Code()) + } +} + +// NewFilterKeywordPostOK creates a FilterKeywordPostOK with default headers values +func NewFilterKeywordPostOK() *FilterKeywordPostOK { + return &FilterKeywordPostOK{} +} + +/* +FilterKeywordPostOK describes a response with status code 200, with default header values. + +New filter keyword. +*/ +type FilterKeywordPostOK struct { + Payload *models.FilterKeyword +} + +// IsSuccess returns true when this filter keyword post o k response has a 2xx status code +func (o *FilterKeywordPostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter keyword post o k response has a 3xx status code +func (o *FilterKeywordPostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword post o k response has a 4xx status code +func (o *FilterKeywordPostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter keyword post o k response has a 5xx status code +func (o *FilterKeywordPostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword post o k response a status code equal to that given +func (o *FilterKeywordPostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter keyword post o k response +func (o *FilterKeywordPostOK) Code() int { + return 200 +} + +func (o *FilterKeywordPostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostOK %s", 200, payload) +} + +func (o *FilterKeywordPostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostOK %s", 200, payload) +} + +func (o *FilterKeywordPostOK) GetPayload() *models.FilterKeyword { + return o.Payload +} + +func (o *FilterKeywordPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterKeyword) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterKeywordPostBadRequest creates a FilterKeywordPostBadRequest with default headers values +func NewFilterKeywordPostBadRequest() *FilterKeywordPostBadRequest { + return &FilterKeywordPostBadRequest{} +} + +/* +FilterKeywordPostBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterKeywordPostBadRequest struct { +} + +// IsSuccess returns true when this filter keyword post bad request response has a 2xx status code +func (o *FilterKeywordPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword post bad request response has a 3xx status code +func (o *FilterKeywordPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword post bad request response has a 4xx status code +func (o *FilterKeywordPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword post bad request response has a 5xx status code +func (o *FilterKeywordPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword post bad request response a status code equal to that given +func (o *FilterKeywordPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter keyword post bad request response +func (o *FilterKeywordPostBadRequest) Code() int { + return 400 +} + +func (o *FilterKeywordPostBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostBadRequest", 400) +} + +func (o *FilterKeywordPostBadRequest) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostBadRequest", 400) +} + +func (o *FilterKeywordPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPostUnauthorized creates a FilterKeywordPostUnauthorized with default headers values +func NewFilterKeywordPostUnauthorized() *FilterKeywordPostUnauthorized { + return &FilterKeywordPostUnauthorized{} +} + +/* +FilterKeywordPostUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterKeywordPostUnauthorized struct { +} + +// IsSuccess returns true when this filter keyword post unauthorized response has a 2xx status code +func (o *FilterKeywordPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword post unauthorized response has a 3xx status code +func (o *FilterKeywordPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword post unauthorized response has a 4xx status code +func (o *FilterKeywordPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword post unauthorized response has a 5xx status code +func (o *FilterKeywordPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword post unauthorized response a status code equal to that given +func (o *FilterKeywordPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter keyword post unauthorized response +func (o *FilterKeywordPostUnauthorized) Code() int { + return 401 +} + +func (o *FilterKeywordPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostUnauthorized", 401) +} + +func (o *FilterKeywordPostUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostUnauthorized", 401) +} + +func (o *FilterKeywordPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPostForbidden creates a FilterKeywordPostForbidden with default headers values +func NewFilterKeywordPostForbidden() *FilterKeywordPostForbidden { + return &FilterKeywordPostForbidden{} +} + +/* +FilterKeywordPostForbidden describes a response with status code 403, with default header values. + +forbidden to moved accounts +*/ +type FilterKeywordPostForbidden struct { +} + +// IsSuccess returns true when this filter keyword post forbidden response has a 2xx status code +func (o *FilterKeywordPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword post forbidden response has a 3xx status code +func (o *FilterKeywordPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword post forbidden response has a 4xx status code +func (o *FilterKeywordPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword post forbidden response has a 5xx status code +func (o *FilterKeywordPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword post forbidden response a status code equal to that given +func (o *FilterKeywordPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the filter keyword post forbidden response +func (o *FilterKeywordPostForbidden) Code() int { + return 403 +} + +func (o *FilterKeywordPostForbidden) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostForbidden", 403) +} + +func (o *FilterKeywordPostForbidden) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostForbidden", 403) +} + +func (o *FilterKeywordPostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPostNotFound creates a FilterKeywordPostNotFound with default headers values +func NewFilterKeywordPostNotFound() *FilterKeywordPostNotFound { + return &FilterKeywordPostNotFound{} +} + +/* +FilterKeywordPostNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterKeywordPostNotFound struct { +} + +// IsSuccess returns true when this filter keyword post not found response has a 2xx status code +func (o *FilterKeywordPostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword post not found response has a 3xx status code +func (o *FilterKeywordPostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword post not found response has a 4xx status code +func (o *FilterKeywordPostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword post not found response has a 5xx status code +func (o *FilterKeywordPostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword post not found response a status code equal to that given +func (o *FilterKeywordPostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter keyword post not found response +func (o *FilterKeywordPostNotFound) Code() int { + return 404 +} + +func (o *FilterKeywordPostNotFound) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostNotFound", 404) +} + +func (o *FilterKeywordPostNotFound) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostNotFound", 404) +} + +func (o *FilterKeywordPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPostNotAcceptable creates a FilterKeywordPostNotAcceptable with default headers values +func NewFilterKeywordPostNotAcceptable() *FilterKeywordPostNotAcceptable { + return &FilterKeywordPostNotAcceptable{} +} + +/* +FilterKeywordPostNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterKeywordPostNotAcceptable struct { +} + +// IsSuccess returns true when this filter keyword post not acceptable response has a 2xx status code +func (o *FilterKeywordPostNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword post not acceptable response has a 3xx status code +func (o *FilterKeywordPostNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword post not acceptable response has a 4xx status code +func (o *FilterKeywordPostNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword post not acceptable response has a 5xx status code +func (o *FilterKeywordPostNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword post not acceptable response a status code equal to that given +func (o *FilterKeywordPostNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter keyword post not acceptable response +func (o *FilterKeywordPostNotAcceptable) Code() int { + return 406 +} + +func (o *FilterKeywordPostNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostNotAcceptable", 406) +} + +func (o *FilterKeywordPostNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostNotAcceptable", 406) +} + +func (o *FilterKeywordPostNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPostConflict creates a FilterKeywordPostConflict with default headers values +func NewFilterKeywordPostConflict() *FilterKeywordPostConflict { + return &FilterKeywordPostConflict{} +} + +/* +FilterKeywordPostConflict describes a response with status code 409, with default header values. + +conflict (duplicate keyword) +*/ +type FilterKeywordPostConflict struct { +} + +// IsSuccess returns true when this filter keyword post conflict response has a 2xx status code +func (o *FilterKeywordPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword post conflict response has a 3xx status code +func (o *FilterKeywordPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword post conflict response has a 4xx status code +func (o *FilterKeywordPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword post conflict response has a 5xx status code +func (o *FilterKeywordPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword post conflict response a status code equal to that given +func (o *FilterKeywordPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the filter keyword post conflict response +func (o *FilterKeywordPostConflict) Code() int { + return 409 +} + +func (o *FilterKeywordPostConflict) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostConflict", 409) +} + +func (o *FilterKeywordPostConflict) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostConflict", 409) +} + +func (o *FilterKeywordPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPostUnprocessableEntity creates a FilterKeywordPostUnprocessableEntity with default headers values +func NewFilterKeywordPostUnprocessableEntity() *FilterKeywordPostUnprocessableEntity { + return &FilterKeywordPostUnprocessableEntity{} +} + +/* +FilterKeywordPostUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable content +*/ +type FilterKeywordPostUnprocessableEntity struct { +} + +// IsSuccess returns true when this filter keyword post unprocessable entity response has a 2xx status code +func (o *FilterKeywordPostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword post unprocessable entity response has a 3xx status code +func (o *FilterKeywordPostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword post unprocessable entity response has a 4xx status code +func (o *FilterKeywordPostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword post unprocessable entity response has a 5xx status code +func (o *FilterKeywordPostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword post unprocessable entity response a status code equal to that given +func (o *FilterKeywordPostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the filter keyword post unprocessable entity response +func (o *FilterKeywordPostUnprocessableEntity) Code() int { + return 422 +} + +func (o *FilterKeywordPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostUnprocessableEntity", 422) +} + +func (o *FilterKeywordPostUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostUnprocessableEntity", 422) +} + +func (o *FilterKeywordPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPostInternalServerError creates a FilterKeywordPostInternalServerError with default headers values +func NewFilterKeywordPostInternalServerError() *FilterKeywordPostInternalServerError { + return &FilterKeywordPostInternalServerError{} +} + +/* +FilterKeywordPostInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterKeywordPostInternalServerError struct { +} + +// IsSuccess returns true when this filter keyword post internal server error response has a 2xx status code +func (o *FilterKeywordPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword post internal server error response has a 3xx status code +func (o *FilterKeywordPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword post internal server error response has a 4xx status code +func (o *FilterKeywordPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter keyword post internal server error response has a 5xx status code +func (o *FilterKeywordPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter keyword post internal server error response a status code equal to that given +func (o *FilterKeywordPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter keyword post internal server error response +func (o *FilterKeywordPostInternalServerError) Code() int { + return 500 +} + +func (o *FilterKeywordPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostInternalServerError", 500) +} + +func (o *FilterKeywordPostInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostInternalServerError", 500) +} + +func (o *FilterKeywordPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_put_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_put_parameters.go new file mode 100644 index 0000000..a3fddbf --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_put_parameters.go @@ -0,0 +1,214 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterKeywordPutParams creates a new FilterKeywordPutParams 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 NewFilterKeywordPutParams() *FilterKeywordPutParams { + return &FilterKeywordPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterKeywordPutParamsWithTimeout creates a new FilterKeywordPutParams object +// with the ability to set a timeout on a request. +func NewFilterKeywordPutParamsWithTimeout(timeout time.Duration) *FilterKeywordPutParams { + return &FilterKeywordPutParams{ + timeout: timeout, + } +} + +// NewFilterKeywordPutParamsWithContext creates a new FilterKeywordPutParams object +// with the ability to set a context for a request. +func NewFilterKeywordPutParamsWithContext(ctx context.Context) *FilterKeywordPutParams { + return &FilterKeywordPutParams{ + Context: ctx, + } +} + +// NewFilterKeywordPutParamsWithHTTPClient creates a new FilterKeywordPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterKeywordPutParamsWithHTTPClient(client *http.Client) *FilterKeywordPutParams { + return &FilterKeywordPutParams{ + HTTPClient: client, + } +} + +/* +FilterKeywordPutParams contains all the parameters to send to the API endpoint + + for the filter keyword put operation. + + Typically these are written to a http.Request. +*/ +type FilterKeywordPutParams struct { + + /* ID. + + ID of the filter keyword to update. + */ + ID string + + /* Keyword. + + The text to be filtered + + Sample: fnord + */ + Keyword string + + /* WholeWord. + + Should the filter consider word boundaries? + + Sample: true + */ + WholeWord *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter keyword put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterKeywordPutParams) WithDefaults() *FilterKeywordPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter keyword put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterKeywordPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter keyword put params +func (o *FilterKeywordPutParams) WithTimeout(timeout time.Duration) *FilterKeywordPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter keyword put params +func (o *FilterKeywordPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter keyword put params +func (o *FilterKeywordPutParams) WithContext(ctx context.Context) *FilterKeywordPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter keyword put params +func (o *FilterKeywordPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter keyword put params +func (o *FilterKeywordPutParams) WithHTTPClient(client *http.Client) *FilterKeywordPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter keyword put params +func (o *FilterKeywordPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter keyword put params +func (o *FilterKeywordPutParams) WithID(id string) *FilterKeywordPutParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter keyword put params +func (o *FilterKeywordPutParams) SetID(id string) { + o.ID = id +} + +// WithKeyword adds the keyword to the filter keyword put params +func (o *FilterKeywordPutParams) WithKeyword(keyword string) *FilterKeywordPutParams { + o.SetKeyword(keyword) + return o +} + +// SetKeyword adds the keyword to the filter keyword put params +func (o *FilterKeywordPutParams) SetKeyword(keyword string) { + o.Keyword = keyword +} + +// WithWholeWord adds the wholeWord to the filter keyword put params +func (o *FilterKeywordPutParams) WithWholeWord(wholeWord *bool) *FilterKeywordPutParams { + o.SetWholeWord(wholeWord) + return o +} + +// SetWholeWord adds the wholeWord to the filter keyword put params +func (o *FilterKeywordPutParams) SetWholeWord(wholeWord *bool) { + o.WholeWord = wholeWord +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterKeywordPutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // form param keyword + frKeyword := o.Keyword + fKeyword := frKeyword + if fKeyword != "" { + if err := r.SetFormParam("keyword", fKeyword); err != nil { + return err + } + } + + if o.WholeWord != nil { + + // form param whole_word + var frWholeWord bool + if o.WholeWord != nil { + frWholeWord = *o.WholeWord + } + fWholeWord := swag.FormatBool(frWholeWord) + if fWholeWord != "" { + if err := r.SetFormParam("whole_word", fWholeWord); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_put_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_put_responses.go new file mode 100644 index 0000000..3d843c7 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keyword_put_responses.go @@ -0,0 +1,602 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterKeywordPutReader is a Reader for the FilterKeywordPut structure. +type FilterKeywordPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterKeywordPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterKeywordPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterKeywordPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterKeywordPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewFilterKeywordPutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterKeywordPutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterKeywordPutNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewFilterKeywordPutConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewFilterKeywordPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterKeywordPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /api/v2/filters/keywords{id}] filterKeywordPut", response, response.Code()) + } +} + +// NewFilterKeywordPutOK creates a FilterKeywordPutOK with default headers values +func NewFilterKeywordPutOK() *FilterKeywordPutOK { + return &FilterKeywordPutOK{} +} + +/* +FilterKeywordPutOK describes a response with status code 200, with default header values. + +Updated filter keyword. +*/ +type FilterKeywordPutOK struct { + Payload *models.FilterKeyword +} + +// IsSuccess returns true when this filter keyword put o k response has a 2xx status code +func (o *FilterKeywordPutOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter keyword put o k response has a 3xx status code +func (o *FilterKeywordPutOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword put o k response has a 4xx status code +func (o *FilterKeywordPutOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter keyword put o k response has a 5xx status code +func (o *FilterKeywordPutOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword put o k response a status code equal to that given +func (o *FilterKeywordPutOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter keyword put o k response +func (o *FilterKeywordPutOK) Code() int { + return 200 +} + +func (o *FilterKeywordPutOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutOK %s", 200, payload) +} + +func (o *FilterKeywordPutOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutOK %s", 200, payload) +} + +func (o *FilterKeywordPutOK) GetPayload() *models.FilterKeyword { + return o.Payload +} + +func (o *FilterKeywordPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterKeyword) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterKeywordPutBadRequest creates a FilterKeywordPutBadRequest with default headers values +func NewFilterKeywordPutBadRequest() *FilterKeywordPutBadRequest { + return &FilterKeywordPutBadRequest{} +} + +/* +FilterKeywordPutBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterKeywordPutBadRequest struct { +} + +// IsSuccess returns true when this filter keyword put bad request response has a 2xx status code +func (o *FilterKeywordPutBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword put bad request response has a 3xx status code +func (o *FilterKeywordPutBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword put bad request response has a 4xx status code +func (o *FilterKeywordPutBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword put bad request response has a 5xx status code +func (o *FilterKeywordPutBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword put bad request response a status code equal to that given +func (o *FilterKeywordPutBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter keyword put bad request response +func (o *FilterKeywordPutBadRequest) Code() int { + return 400 +} + +func (o *FilterKeywordPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutBadRequest", 400) +} + +func (o *FilterKeywordPutBadRequest) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutBadRequest", 400) +} + +func (o *FilterKeywordPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPutUnauthorized creates a FilterKeywordPutUnauthorized with default headers values +func NewFilterKeywordPutUnauthorized() *FilterKeywordPutUnauthorized { + return &FilterKeywordPutUnauthorized{} +} + +/* +FilterKeywordPutUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterKeywordPutUnauthorized struct { +} + +// IsSuccess returns true when this filter keyword put unauthorized response has a 2xx status code +func (o *FilterKeywordPutUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword put unauthorized response has a 3xx status code +func (o *FilterKeywordPutUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword put unauthorized response has a 4xx status code +func (o *FilterKeywordPutUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword put unauthorized response has a 5xx status code +func (o *FilterKeywordPutUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword put unauthorized response a status code equal to that given +func (o *FilterKeywordPutUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter keyword put unauthorized response +func (o *FilterKeywordPutUnauthorized) Code() int { + return 401 +} + +func (o *FilterKeywordPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutUnauthorized", 401) +} + +func (o *FilterKeywordPutUnauthorized) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutUnauthorized", 401) +} + +func (o *FilterKeywordPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPutForbidden creates a FilterKeywordPutForbidden with default headers values +func NewFilterKeywordPutForbidden() *FilterKeywordPutForbidden { + return &FilterKeywordPutForbidden{} +} + +/* +FilterKeywordPutForbidden describes a response with status code 403, with default header values. + +forbidden to moved accounts +*/ +type FilterKeywordPutForbidden struct { +} + +// IsSuccess returns true when this filter keyword put forbidden response has a 2xx status code +func (o *FilterKeywordPutForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword put forbidden response has a 3xx status code +func (o *FilterKeywordPutForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword put forbidden response has a 4xx status code +func (o *FilterKeywordPutForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword put forbidden response has a 5xx status code +func (o *FilterKeywordPutForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword put forbidden response a status code equal to that given +func (o *FilterKeywordPutForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the filter keyword put forbidden response +func (o *FilterKeywordPutForbidden) Code() int { + return 403 +} + +func (o *FilterKeywordPutForbidden) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutForbidden", 403) +} + +func (o *FilterKeywordPutForbidden) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutForbidden", 403) +} + +func (o *FilterKeywordPutForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPutNotFound creates a FilterKeywordPutNotFound with default headers values +func NewFilterKeywordPutNotFound() *FilterKeywordPutNotFound { + return &FilterKeywordPutNotFound{} +} + +/* +FilterKeywordPutNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterKeywordPutNotFound struct { +} + +// IsSuccess returns true when this filter keyword put not found response has a 2xx status code +func (o *FilterKeywordPutNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword put not found response has a 3xx status code +func (o *FilterKeywordPutNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword put not found response has a 4xx status code +func (o *FilterKeywordPutNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword put not found response has a 5xx status code +func (o *FilterKeywordPutNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword put not found response a status code equal to that given +func (o *FilterKeywordPutNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter keyword put not found response +func (o *FilterKeywordPutNotFound) Code() int { + return 404 +} + +func (o *FilterKeywordPutNotFound) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutNotFound", 404) +} + +func (o *FilterKeywordPutNotFound) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutNotFound", 404) +} + +func (o *FilterKeywordPutNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPutNotAcceptable creates a FilterKeywordPutNotAcceptable with default headers values +func NewFilterKeywordPutNotAcceptable() *FilterKeywordPutNotAcceptable { + return &FilterKeywordPutNotAcceptable{} +} + +/* +FilterKeywordPutNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterKeywordPutNotAcceptable struct { +} + +// IsSuccess returns true when this filter keyword put not acceptable response has a 2xx status code +func (o *FilterKeywordPutNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword put not acceptable response has a 3xx status code +func (o *FilterKeywordPutNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword put not acceptable response has a 4xx status code +func (o *FilterKeywordPutNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword put not acceptable response has a 5xx status code +func (o *FilterKeywordPutNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword put not acceptable response a status code equal to that given +func (o *FilterKeywordPutNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter keyword put not acceptable response +func (o *FilterKeywordPutNotAcceptable) Code() int { + return 406 +} + +func (o *FilterKeywordPutNotAcceptable) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutNotAcceptable", 406) +} + +func (o *FilterKeywordPutNotAcceptable) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutNotAcceptable", 406) +} + +func (o *FilterKeywordPutNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPutConflict creates a FilterKeywordPutConflict with default headers values +func NewFilterKeywordPutConflict() *FilterKeywordPutConflict { + return &FilterKeywordPutConflict{} +} + +/* +FilterKeywordPutConflict describes a response with status code 409, with default header values. + +conflict (duplicate keyword) +*/ +type FilterKeywordPutConflict struct { +} + +// IsSuccess returns true when this filter keyword put conflict response has a 2xx status code +func (o *FilterKeywordPutConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword put conflict response has a 3xx status code +func (o *FilterKeywordPutConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword put conflict response has a 4xx status code +func (o *FilterKeywordPutConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword put conflict response has a 5xx status code +func (o *FilterKeywordPutConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword put conflict response a status code equal to that given +func (o *FilterKeywordPutConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the filter keyword put conflict response +func (o *FilterKeywordPutConflict) Code() int { + return 409 +} + +func (o *FilterKeywordPutConflict) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutConflict", 409) +} + +func (o *FilterKeywordPutConflict) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutConflict", 409) +} + +func (o *FilterKeywordPutConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPutUnprocessableEntity creates a FilterKeywordPutUnprocessableEntity with default headers values +func NewFilterKeywordPutUnprocessableEntity() *FilterKeywordPutUnprocessableEntity { + return &FilterKeywordPutUnprocessableEntity{} +} + +/* +FilterKeywordPutUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable content +*/ +type FilterKeywordPutUnprocessableEntity struct { +} + +// IsSuccess returns true when this filter keyword put unprocessable entity response has a 2xx status code +func (o *FilterKeywordPutUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword put unprocessable entity response has a 3xx status code +func (o *FilterKeywordPutUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword put unprocessable entity response has a 4xx status code +func (o *FilterKeywordPutUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword put unprocessable entity response has a 5xx status code +func (o *FilterKeywordPutUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword put unprocessable entity response a status code equal to that given +func (o *FilterKeywordPutUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the filter keyword put unprocessable entity response +func (o *FilterKeywordPutUnprocessableEntity) Code() int { + return 422 +} + +func (o *FilterKeywordPutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutUnprocessableEntity", 422) +} + +func (o *FilterKeywordPutUnprocessableEntity) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutUnprocessableEntity", 422) +} + +func (o *FilterKeywordPutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPutInternalServerError creates a FilterKeywordPutInternalServerError with default headers values +func NewFilterKeywordPutInternalServerError() *FilterKeywordPutInternalServerError { + return &FilterKeywordPutInternalServerError{} +} + +/* +FilterKeywordPutInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterKeywordPutInternalServerError struct { +} + +// IsSuccess returns true when this filter keyword put internal server error response has a 2xx status code +func (o *FilterKeywordPutInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword put internal server error response has a 3xx status code +func (o *FilterKeywordPutInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword put internal server error response has a 4xx status code +func (o *FilterKeywordPutInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter keyword put internal server error response has a 5xx status code +func (o *FilterKeywordPutInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter keyword put internal server error response a status code equal to that given +func (o *FilterKeywordPutInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter keyword put internal server error response +func (o *FilterKeywordPutInternalServerError) Code() int { + return 500 +} + +func (o *FilterKeywordPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutInternalServerError", 500) +} + +func (o *FilterKeywordPutInternalServerError) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutInternalServerError", 500) +} + +func (o *FilterKeywordPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keywords_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keywords_get_parameters.go new file mode 100644 index 0000000..3f65331 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keywords_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterKeywordsGetParams creates a new FilterKeywordsGetParams 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 NewFilterKeywordsGetParams() *FilterKeywordsGetParams { + return &FilterKeywordsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterKeywordsGetParamsWithTimeout creates a new FilterKeywordsGetParams object +// with the ability to set a timeout on a request. +func NewFilterKeywordsGetParamsWithTimeout(timeout time.Duration) *FilterKeywordsGetParams { + return &FilterKeywordsGetParams{ + timeout: timeout, + } +} + +// NewFilterKeywordsGetParamsWithContext creates a new FilterKeywordsGetParams object +// with the ability to set a context for a request. +func NewFilterKeywordsGetParamsWithContext(ctx context.Context) *FilterKeywordsGetParams { + return &FilterKeywordsGetParams{ + Context: ctx, + } +} + +// NewFilterKeywordsGetParamsWithHTTPClient creates a new FilterKeywordsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterKeywordsGetParamsWithHTTPClient(client *http.Client) *FilterKeywordsGetParams { + return &FilterKeywordsGetParams{ + HTTPClient: client, + } +} + +/* +FilterKeywordsGetParams contains all the parameters to send to the API endpoint + + for the filter keywords get operation. + + Typically these are written to a http.Request. +*/ +type FilterKeywordsGetParams struct { + + /* ID. + + ID of the filter + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter keywords get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterKeywordsGetParams) WithDefaults() *FilterKeywordsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter keywords get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterKeywordsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter keywords get params +func (o *FilterKeywordsGetParams) WithTimeout(timeout time.Duration) *FilterKeywordsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter keywords get params +func (o *FilterKeywordsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter keywords get params +func (o *FilterKeywordsGetParams) WithContext(ctx context.Context) *FilterKeywordsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter keywords get params +func (o *FilterKeywordsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter keywords get params +func (o *FilterKeywordsGetParams) WithHTTPClient(client *http.Client) *FilterKeywordsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter keywords get params +func (o *FilterKeywordsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter keywords get params +func (o *FilterKeywordsGetParams) WithID(id string) *FilterKeywordsGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter keywords get params +func (o *FilterKeywordsGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterKeywordsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keywords_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keywords_get_responses.go new file mode 100644 index 0000000..db47d4c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_keywords_get_responses.go @@ -0,0 +1,414 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterKeywordsGetReader is a Reader for the FilterKeywordsGet structure. +type FilterKeywordsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterKeywordsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterKeywordsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterKeywordsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterKeywordsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterKeywordsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterKeywordsGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterKeywordsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v2/filters/{id}/keywords] filterKeywordsGet", response, response.Code()) + } +} + +// NewFilterKeywordsGetOK creates a FilterKeywordsGetOK with default headers values +func NewFilterKeywordsGetOK() *FilterKeywordsGetOK { + return &FilterKeywordsGetOK{} +} + +/* +FilterKeywordsGetOK describes a response with status code 200, with default header values. + +Requested filter keywords. +*/ +type FilterKeywordsGetOK struct { + Payload []*models.FilterKeyword +} + +// IsSuccess returns true when this filter keywords get o k response has a 2xx status code +func (o *FilterKeywordsGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter keywords get o k response has a 3xx status code +func (o *FilterKeywordsGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keywords get o k response has a 4xx status code +func (o *FilterKeywordsGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter keywords get o k response has a 5xx status code +func (o *FilterKeywordsGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keywords get o k response a status code equal to that given +func (o *FilterKeywordsGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter keywords get o k response +func (o *FilterKeywordsGetOK) Code() int { + return 200 +} + +func (o *FilterKeywordsGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetOK %s", 200, payload) +} + +func (o *FilterKeywordsGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetOK %s", 200, payload) +} + +func (o *FilterKeywordsGetOK) GetPayload() []*models.FilterKeyword { + return o.Payload +} + +func (o *FilterKeywordsGetOK) 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 +} + +// NewFilterKeywordsGetBadRequest creates a FilterKeywordsGetBadRequest with default headers values +func NewFilterKeywordsGetBadRequest() *FilterKeywordsGetBadRequest { + return &FilterKeywordsGetBadRequest{} +} + +/* +FilterKeywordsGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterKeywordsGetBadRequest struct { +} + +// IsSuccess returns true when this filter keywords get bad request response has a 2xx status code +func (o *FilterKeywordsGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keywords get bad request response has a 3xx status code +func (o *FilterKeywordsGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keywords get bad request response has a 4xx status code +func (o *FilterKeywordsGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keywords get bad request response has a 5xx status code +func (o *FilterKeywordsGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keywords get bad request response a status code equal to that given +func (o *FilterKeywordsGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter keywords get bad request response +func (o *FilterKeywordsGetBadRequest) Code() int { + return 400 +} + +func (o *FilterKeywordsGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetBadRequest", 400) +} + +func (o *FilterKeywordsGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetBadRequest", 400) +} + +func (o *FilterKeywordsGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordsGetUnauthorized creates a FilterKeywordsGetUnauthorized with default headers values +func NewFilterKeywordsGetUnauthorized() *FilterKeywordsGetUnauthorized { + return &FilterKeywordsGetUnauthorized{} +} + +/* +FilterKeywordsGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterKeywordsGetUnauthorized struct { +} + +// IsSuccess returns true when this filter keywords get unauthorized response has a 2xx status code +func (o *FilterKeywordsGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keywords get unauthorized response has a 3xx status code +func (o *FilterKeywordsGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keywords get unauthorized response has a 4xx status code +func (o *FilterKeywordsGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keywords get unauthorized response has a 5xx status code +func (o *FilterKeywordsGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keywords get unauthorized response a status code equal to that given +func (o *FilterKeywordsGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter keywords get unauthorized response +func (o *FilterKeywordsGetUnauthorized) Code() int { + return 401 +} + +func (o *FilterKeywordsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetUnauthorized", 401) +} + +func (o *FilterKeywordsGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetUnauthorized", 401) +} + +func (o *FilterKeywordsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordsGetNotFound creates a FilterKeywordsGetNotFound with default headers values +func NewFilterKeywordsGetNotFound() *FilterKeywordsGetNotFound { + return &FilterKeywordsGetNotFound{} +} + +/* +FilterKeywordsGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterKeywordsGetNotFound struct { +} + +// IsSuccess returns true when this filter keywords get not found response has a 2xx status code +func (o *FilterKeywordsGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keywords get not found response has a 3xx status code +func (o *FilterKeywordsGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keywords get not found response has a 4xx status code +func (o *FilterKeywordsGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keywords get not found response has a 5xx status code +func (o *FilterKeywordsGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keywords get not found response a status code equal to that given +func (o *FilterKeywordsGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter keywords get not found response +func (o *FilterKeywordsGetNotFound) Code() int { + return 404 +} + +func (o *FilterKeywordsGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetNotFound", 404) +} + +func (o *FilterKeywordsGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetNotFound", 404) +} + +func (o *FilterKeywordsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordsGetNotAcceptable creates a FilterKeywordsGetNotAcceptable with default headers values +func NewFilterKeywordsGetNotAcceptable() *FilterKeywordsGetNotAcceptable { + return &FilterKeywordsGetNotAcceptable{} +} + +/* +FilterKeywordsGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterKeywordsGetNotAcceptable struct { +} + +// IsSuccess returns true when this filter keywords get not acceptable response has a 2xx status code +func (o *FilterKeywordsGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keywords get not acceptable response has a 3xx status code +func (o *FilterKeywordsGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keywords get not acceptable response has a 4xx status code +func (o *FilterKeywordsGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keywords get not acceptable response has a 5xx status code +func (o *FilterKeywordsGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keywords get not acceptable response a status code equal to that given +func (o *FilterKeywordsGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter keywords get not acceptable response +func (o *FilterKeywordsGetNotAcceptable) Code() int { + return 406 +} + +func (o *FilterKeywordsGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetNotAcceptable", 406) +} + +func (o *FilterKeywordsGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetNotAcceptable", 406) +} + +func (o *FilterKeywordsGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordsGetInternalServerError creates a FilterKeywordsGetInternalServerError with default headers values +func NewFilterKeywordsGetInternalServerError() *FilterKeywordsGetInternalServerError { + return &FilterKeywordsGetInternalServerError{} +} + +/* +FilterKeywordsGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterKeywordsGetInternalServerError struct { +} + +// IsSuccess returns true when this filter keywords get internal server error response has a 2xx status code +func (o *FilterKeywordsGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keywords get internal server error response has a 3xx status code +func (o *FilterKeywordsGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keywords get internal server error response has a 4xx status code +func (o *FilterKeywordsGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter keywords get internal server error response has a 5xx status code +func (o *FilterKeywordsGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter keywords get internal server error response a status code equal to that given +func (o *FilterKeywordsGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter keywords get internal server error response +func (o *FilterKeywordsGetInternalServerError) Code() int { + return 500 +} + +func (o *FilterKeywordsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetInternalServerError", 500) +} + +func (o *FilterKeywordsGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetInternalServerError", 500) +} + +func (o *FilterKeywordsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_status_delete_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_status_delete_parameters.go new file mode 100644 index 0000000..713b7ea --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_status_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterStatusDeleteParams creates a new FilterStatusDeleteParams 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 NewFilterStatusDeleteParams() *FilterStatusDeleteParams { + return &FilterStatusDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterStatusDeleteParamsWithTimeout creates a new FilterStatusDeleteParams object +// with the ability to set a timeout on a request. +func NewFilterStatusDeleteParamsWithTimeout(timeout time.Duration) *FilterStatusDeleteParams { + return &FilterStatusDeleteParams{ + timeout: timeout, + } +} + +// NewFilterStatusDeleteParamsWithContext creates a new FilterStatusDeleteParams object +// with the ability to set a context for a request. +func NewFilterStatusDeleteParamsWithContext(ctx context.Context) *FilterStatusDeleteParams { + return &FilterStatusDeleteParams{ + Context: ctx, + } +} + +// NewFilterStatusDeleteParamsWithHTTPClient creates a new FilterStatusDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterStatusDeleteParamsWithHTTPClient(client *http.Client) *FilterStatusDeleteParams { + return &FilterStatusDeleteParams{ + HTTPClient: client, + } +} + +/* +FilterStatusDeleteParams contains all the parameters to send to the API endpoint + + for the filter status delete operation. + + Typically these are written to a http.Request. +*/ +type FilterStatusDeleteParams struct { + + /* ID. + + ID of the filter status + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter status delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterStatusDeleteParams) WithDefaults() *FilterStatusDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter status delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterStatusDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter status delete params +func (o *FilterStatusDeleteParams) WithTimeout(timeout time.Duration) *FilterStatusDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter status delete params +func (o *FilterStatusDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter status delete params +func (o *FilterStatusDeleteParams) WithContext(ctx context.Context) *FilterStatusDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter status delete params +func (o *FilterStatusDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter status delete params +func (o *FilterStatusDeleteParams) WithHTTPClient(client *http.Client) *FilterStatusDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter status delete params +func (o *FilterStatusDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter status delete params +func (o *FilterStatusDeleteParams) WithID(id string) *FilterStatusDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter status delete params +func (o *FilterStatusDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterStatusDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_status_delete_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_status_delete_responses.go new file mode 100644 index 0000000..d3cd40a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_status_delete_responses.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// FilterStatusDeleteReader is a Reader for the FilterStatusDelete structure. +type FilterStatusDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterStatusDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterStatusDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterStatusDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterStatusDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterStatusDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterStatusDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterStatusDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v2/filters/statuses/{id}] filterStatusDelete", response, response.Code()) + } +} + +// NewFilterStatusDeleteOK creates a FilterStatusDeleteOK with default headers values +func NewFilterStatusDeleteOK() *FilterStatusDeleteOK { + return &FilterStatusDeleteOK{} +} + +/* +FilterStatusDeleteOK describes a response with status code 200, with default header values. + +filter status deleted +*/ +type FilterStatusDeleteOK struct { +} + +// IsSuccess returns true when this filter status delete o k response has a 2xx status code +func (o *FilterStatusDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter status delete o k response has a 3xx status code +func (o *FilterStatusDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status delete o k response has a 4xx status code +func (o *FilterStatusDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter status delete o k response has a 5xx status code +func (o *FilterStatusDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status delete o k response a status code equal to that given +func (o *FilterStatusDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter status delete o k response +func (o *FilterStatusDeleteOK) Code() int { + return 200 +} + +func (o *FilterStatusDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteOK", 200) +} + +func (o *FilterStatusDeleteOK) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteOK", 200) +} + +func (o *FilterStatusDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusDeleteBadRequest creates a FilterStatusDeleteBadRequest with default headers values +func NewFilterStatusDeleteBadRequest() *FilterStatusDeleteBadRequest { + return &FilterStatusDeleteBadRequest{} +} + +/* +FilterStatusDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterStatusDeleteBadRequest struct { +} + +// IsSuccess returns true when this filter status delete bad request response has a 2xx status code +func (o *FilterStatusDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status delete bad request response has a 3xx status code +func (o *FilterStatusDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status delete bad request response has a 4xx status code +func (o *FilterStatusDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status delete bad request response has a 5xx status code +func (o *FilterStatusDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status delete bad request response a status code equal to that given +func (o *FilterStatusDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter status delete bad request response +func (o *FilterStatusDeleteBadRequest) Code() int { + return 400 +} + +func (o *FilterStatusDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteBadRequest", 400) +} + +func (o *FilterStatusDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteBadRequest", 400) +} + +func (o *FilterStatusDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusDeleteUnauthorized creates a FilterStatusDeleteUnauthorized with default headers values +func NewFilterStatusDeleteUnauthorized() *FilterStatusDeleteUnauthorized { + return &FilterStatusDeleteUnauthorized{} +} + +/* +FilterStatusDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterStatusDeleteUnauthorized struct { +} + +// IsSuccess returns true when this filter status delete unauthorized response has a 2xx status code +func (o *FilterStatusDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status delete unauthorized response has a 3xx status code +func (o *FilterStatusDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status delete unauthorized response has a 4xx status code +func (o *FilterStatusDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status delete unauthorized response has a 5xx status code +func (o *FilterStatusDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status delete unauthorized response a status code equal to that given +func (o *FilterStatusDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter status delete unauthorized response +func (o *FilterStatusDeleteUnauthorized) Code() int { + return 401 +} + +func (o *FilterStatusDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteUnauthorized", 401) +} + +func (o *FilterStatusDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteUnauthorized", 401) +} + +func (o *FilterStatusDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusDeleteNotFound creates a FilterStatusDeleteNotFound with default headers values +func NewFilterStatusDeleteNotFound() *FilterStatusDeleteNotFound { + return &FilterStatusDeleteNotFound{} +} + +/* +FilterStatusDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterStatusDeleteNotFound struct { +} + +// IsSuccess returns true when this filter status delete not found response has a 2xx status code +func (o *FilterStatusDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status delete not found response has a 3xx status code +func (o *FilterStatusDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status delete not found response has a 4xx status code +func (o *FilterStatusDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status delete not found response has a 5xx status code +func (o *FilterStatusDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status delete not found response a status code equal to that given +func (o *FilterStatusDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter status delete not found response +func (o *FilterStatusDeleteNotFound) Code() int { + return 404 +} + +func (o *FilterStatusDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteNotFound", 404) +} + +func (o *FilterStatusDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteNotFound", 404) +} + +func (o *FilterStatusDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusDeleteNotAcceptable creates a FilterStatusDeleteNotAcceptable with default headers values +func NewFilterStatusDeleteNotAcceptable() *FilterStatusDeleteNotAcceptable { + return &FilterStatusDeleteNotAcceptable{} +} + +/* +FilterStatusDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterStatusDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this filter status delete not acceptable response has a 2xx status code +func (o *FilterStatusDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status delete not acceptable response has a 3xx status code +func (o *FilterStatusDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status delete not acceptable response has a 4xx status code +func (o *FilterStatusDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status delete not acceptable response has a 5xx status code +func (o *FilterStatusDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status delete not acceptable response a status code equal to that given +func (o *FilterStatusDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter status delete not acceptable response +func (o *FilterStatusDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *FilterStatusDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteNotAcceptable", 406) +} + +func (o *FilterStatusDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteNotAcceptable", 406) +} + +func (o *FilterStatusDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusDeleteInternalServerError creates a FilterStatusDeleteInternalServerError with default headers values +func NewFilterStatusDeleteInternalServerError() *FilterStatusDeleteInternalServerError { + return &FilterStatusDeleteInternalServerError{} +} + +/* +FilterStatusDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterStatusDeleteInternalServerError struct { +} + +// IsSuccess returns true when this filter status delete internal server error response has a 2xx status code +func (o *FilterStatusDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status delete internal server error response has a 3xx status code +func (o *FilterStatusDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status delete internal server error response has a 4xx status code +func (o *FilterStatusDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter status delete internal server error response has a 5xx status code +func (o *FilterStatusDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter status delete internal server error response a status code equal to that given +func (o *FilterStatusDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter status delete internal server error response +func (o *FilterStatusDeleteInternalServerError) Code() int { + return 500 +} + +func (o *FilterStatusDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteInternalServerError", 500) +} + +func (o *FilterStatusDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteInternalServerError", 500) +} + +func (o *FilterStatusDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_status_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_status_get_parameters.go new file mode 100644 index 0000000..819cc12 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_status_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterStatusGetParams creates a new FilterStatusGetParams 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 NewFilterStatusGetParams() *FilterStatusGetParams { + return &FilterStatusGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterStatusGetParamsWithTimeout creates a new FilterStatusGetParams object +// with the ability to set a timeout on a request. +func NewFilterStatusGetParamsWithTimeout(timeout time.Duration) *FilterStatusGetParams { + return &FilterStatusGetParams{ + timeout: timeout, + } +} + +// NewFilterStatusGetParamsWithContext creates a new FilterStatusGetParams object +// with the ability to set a context for a request. +func NewFilterStatusGetParamsWithContext(ctx context.Context) *FilterStatusGetParams { + return &FilterStatusGetParams{ + Context: ctx, + } +} + +// NewFilterStatusGetParamsWithHTTPClient creates a new FilterStatusGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterStatusGetParamsWithHTTPClient(client *http.Client) *FilterStatusGetParams { + return &FilterStatusGetParams{ + HTTPClient: client, + } +} + +/* +FilterStatusGetParams contains all the parameters to send to the API endpoint + + for the filter status get operation. + + Typically these are written to a http.Request. +*/ +type FilterStatusGetParams struct { + + /* ID. + + ID of the filter status + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter status get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterStatusGetParams) WithDefaults() *FilterStatusGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter status get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterStatusGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter status get params +func (o *FilterStatusGetParams) WithTimeout(timeout time.Duration) *FilterStatusGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter status get params +func (o *FilterStatusGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter status get params +func (o *FilterStatusGetParams) WithContext(ctx context.Context) *FilterStatusGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter status get params +func (o *FilterStatusGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter status get params +func (o *FilterStatusGetParams) WithHTTPClient(client *http.Client) *FilterStatusGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter status get params +func (o *FilterStatusGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter status get params +func (o *FilterStatusGetParams) WithID(id string) *FilterStatusGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter status get params +func (o *FilterStatusGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterStatusGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_status_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_status_get_responses.go new file mode 100644 index 0000000..c8e6b5c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_status_get_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterStatusGetReader is a Reader for the FilterStatusGet structure. +type FilterStatusGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterStatusGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterStatusGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterStatusGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterStatusGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterStatusGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterStatusGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterStatusGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v2/filters/statuses/{id}] filterStatusGet", response, response.Code()) + } +} + +// NewFilterStatusGetOK creates a FilterStatusGetOK with default headers values +func NewFilterStatusGetOK() *FilterStatusGetOK { + return &FilterStatusGetOK{} +} + +/* +FilterStatusGetOK describes a response with status code 200, with default header values. + +Requested filter status. +*/ +type FilterStatusGetOK struct { + Payload *models.FilterStatus +} + +// IsSuccess returns true when this filter status get o k response has a 2xx status code +func (o *FilterStatusGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter status get o k response has a 3xx status code +func (o *FilterStatusGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status get o k response has a 4xx status code +func (o *FilterStatusGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter status get o k response has a 5xx status code +func (o *FilterStatusGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status get o k response a status code equal to that given +func (o *FilterStatusGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter status get o k response +func (o *FilterStatusGetOK) Code() int { + return 200 +} + +func (o *FilterStatusGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetOK %s", 200, payload) +} + +func (o *FilterStatusGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetOK %s", 200, payload) +} + +func (o *FilterStatusGetOK) GetPayload() *models.FilterStatus { + return o.Payload +} + +func (o *FilterStatusGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterStatusGetBadRequest creates a FilterStatusGetBadRequest with default headers values +func NewFilterStatusGetBadRequest() *FilterStatusGetBadRequest { + return &FilterStatusGetBadRequest{} +} + +/* +FilterStatusGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterStatusGetBadRequest struct { +} + +// IsSuccess returns true when this filter status get bad request response has a 2xx status code +func (o *FilterStatusGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status get bad request response has a 3xx status code +func (o *FilterStatusGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status get bad request response has a 4xx status code +func (o *FilterStatusGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status get bad request response has a 5xx status code +func (o *FilterStatusGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status get bad request response a status code equal to that given +func (o *FilterStatusGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter status get bad request response +func (o *FilterStatusGetBadRequest) Code() int { + return 400 +} + +func (o *FilterStatusGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetBadRequest", 400) +} + +func (o *FilterStatusGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetBadRequest", 400) +} + +func (o *FilterStatusGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusGetUnauthorized creates a FilterStatusGetUnauthorized with default headers values +func NewFilterStatusGetUnauthorized() *FilterStatusGetUnauthorized { + return &FilterStatusGetUnauthorized{} +} + +/* +FilterStatusGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterStatusGetUnauthorized struct { +} + +// IsSuccess returns true when this filter status get unauthorized response has a 2xx status code +func (o *FilterStatusGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status get unauthorized response has a 3xx status code +func (o *FilterStatusGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status get unauthorized response has a 4xx status code +func (o *FilterStatusGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status get unauthorized response has a 5xx status code +func (o *FilterStatusGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status get unauthorized response a status code equal to that given +func (o *FilterStatusGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter status get unauthorized response +func (o *FilterStatusGetUnauthorized) Code() int { + return 401 +} + +func (o *FilterStatusGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetUnauthorized", 401) +} + +func (o *FilterStatusGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetUnauthorized", 401) +} + +func (o *FilterStatusGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusGetNotFound creates a FilterStatusGetNotFound with default headers values +func NewFilterStatusGetNotFound() *FilterStatusGetNotFound { + return &FilterStatusGetNotFound{} +} + +/* +FilterStatusGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterStatusGetNotFound struct { +} + +// IsSuccess returns true when this filter status get not found response has a 2xx status code +func (o *FilterStatusGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status get not found response has a 3xx status code +func (o *FilterStatusGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status get not found response has a 4xx status code +func (o *FilterStatusGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status get not found response has a 5xx status code +func (o *FilterStatusGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status get not found response a status code equal to that given +func (o *FilterStatusGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter status get not found response +func (o *FilterStatusGetNotFound) Code() int { + return 404 +} + +func (o *FilterStatusGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetNotFound", 404) +} + +func (o *FilterStatusGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetNotFound", 404) +} + +func (o *FilterStatusGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusGetNotAcceptable creates a FilterStatusGetNotAcceptable with default headers values +func NewFilterStatusGetNotAcceptable() *FilterStatusGetNotAcceptable { + return &FilterStatusGetNotAcceptable{} +} + +/* +FilterStatusGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterStatusGetNotAcceptable struct { +} + +// IsSuccess returns true when this filter status get not acceptable response has a 2xx status code +func (o *FilterStatusGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status get not acceptable response has a 3xx status code +func (o *FilterStatusGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status get not acceptable response has a 4xx status code +func (o *FilterStatusGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status get not acceptable response has a 5xx status code +func (o *FilterStatusGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status get not acceptable response a status code equal to that given +func (o *FilterStatusGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter status get not acceptable response +func (o *FilterStatusGetNotAcceptable) Code() int { + return 406 +} + +func (o *FilterStatusGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetNotAcceptable", 406) +} + +func (o *FilterStatusGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetNotAcceptable", 406) +} + +func (o *FilterStatusGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusGetInternalServerError creates a FilterStatusGetInternalServerError with default headers values +func NewFilterStatusGetInternalServerError() *FilterStatusGetInternalServerError { + return &FilterStatusGetInternalServerError{} +} + +/* +FilterStatusGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterStatusGetInternalServerError struct { +} + +// IsSuccess returns true when this filter status get internal server error response has a 2xx status code +func (o *FilterStatusGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status get internal server error response has a 3xx status code +func (o *FilterStatusGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status get internal server error response has a 4xx status code +func (o *FilterStatusGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter status get internal server error response has a 5xx status code +func (o *FilterStatusGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter status get internal server error response a status code equal to that given +func (o *FilterStatusGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter status get internal server error response +func (o *FilterStatusGetInternalServerError) Code() int { + return 500 +} + +func (o *FilterStatusGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetInternalServerError", 500) +} + +func (o *FilterStatusGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetInternalServerError", 500) +} + +func (o *FilterStatusGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_status_post_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_status_post_parameters.go new file mode 100644 index 0000000..3017f07 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_status_post_parameters.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterStatusPostParams creates a new FilterStatusPostParams 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 NewFilterStatusPostParams() *FilterStatusPostParams { + return &FilterStatusPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterStatusPostParamsWithTimeout creates a new FilterStatusPostParams object +// with the ability to set a timeout on a request. +func NewFilterStatusPostParamsWithTimeout(timeout time.Duration) *FilterStatusPostParams { + return &FilterStatusPostParams{ + timeout: timeout, + } +} + +// NewFilterStatusPostParamsWithContext creates a new FilterStatusPostParams object +// with the ability to set a context for a request. +func NewFilterStatusPostParamsWithContext(ctx context.Context) *FilterStatusPostParams { + return &FilterStatusPostParams{ + Context: ctx, + } +} + +// NewFilterStatusPostParamsWithHTTPClient creates a new FilterStatusPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterStatusPostParamsWithHTTPClient(client *http.Client) *FilterStatusPostParams { + return &FilterStatusPostParams{ + HTTPClient: client, + } +} + +/* +FilterStatusPostParams contains all the parameters to send to the API endpoint + + for the filter status post operation. + + Typically these are written to a http.Request. +*/ +type FilterStatusPostParams struct { + + /* ID. + + ID of the filter to add the filtered status to. + */ + ID string + + /* StatusID. + + The ID of the status to filter. + + Sample: 01HXA2NE0K8T1C70K90E74GYD0 + */ + StatusID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter status post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterStatusPostParams) WithDefaults() *FilterStatusPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter status post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterStatusPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter status post params +func (o *FilterStatusPostParams) WithTimeout(timeout time.Duration) *FilterStatusPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter status post params +func (o *FilterStatusPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter status post params +func (o *FilterStatusPostParams) WithContext(ctx context.Context) *FilterStatusPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter status post params +func (o *FilterStatusPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter status post params +func (o *FilterStatusPostParams) WithHTTPClient(client *http.Client) *FilterStatusPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter status post params +func (o *FilterStatusPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter status post params +func (o *FilterStatusPostParams) WithID(id string) *FilterStatusPostParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter status post params +func (o *FilterStatusPostParams) SetID(id string) { + o.ID = id +} + +// WithStatusID adds the statusID to the filter status post params +func (o *FilterStatusPostParams) WithStatusID(statusID string) *FilterStatusPostParams { + o.SetStatusID(statusID) + return o +} + +// SetStatusID adds the statusId to the filter status post params +func (o *FilterStatusPostParams) SetStatusID(statusID string) { + o.StatusID = statusID +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterStatusPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // form param status_id + frStatusID := o.StatusID + fStatusID := frStatusID + if fStatusID != "" { + if err := r.SetFormParam("status_id", fStatusID); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_status_post_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_status_post_responses.go new file mode 100644 index 0000000..b4b289b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_status_post_responses.go @@ -0,0 +1,602 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterStatusPostReader is a Reader for the FilterStatusPost structure. +type FilterStatusPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterStatusPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterStatusPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterStatusPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterStatusPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewFilterStatusPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterStatusPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterStatusPostNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewFilterStatusPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewFilterStatusPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterStatusPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v2/filters/{id}/statuses] filterStatusPost", response, response.Code()) + } +} + +// NewFilterStatusPostOK creates a FilterStatusPostOK with default headers values +func NewFilterStatusPostOK() *FilterStatusPostOK { + return &FilterStatusPostOK{} +} + +/* +FilterStatusPostOK describes a response with status code 200, with default header values. + +New filter status. +*/ +type FilterStatusPostOK struct { + Payload *models.FilterStatus +} + +// IsSuccess returns true when this filter status post o k response has a 2xx status code +func (o *FilterStatusPostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter status post o k response has a 3xx status code +func (o *FilterStatusPostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status post o k response has a 4xx status code +func (o *FilterStatusPostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter status post o k response has a 5xx status code +func (o *FilterStatusPostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status post o k response a status code equal to that given +func (o *FilterStatusPostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter status post o k response +func (o *FilterStatusPostOK) Code() int { + return 200 +} + +func (o *FilterStatusPostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostOK %s", 200, payload) +} + +func (o *FilterStatusPostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostOK %s", 200, payload) +} + +func (o *FilterStatusPostOK) GetPayload() *models.FilterStatus { + return o.Payload +} + +func (o *FilterStatusPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterStatusPostBadRequest creates a FilterStatusPostBadRequest with default headers values +func NewFilterStatusPostBadRequest() *FilterStatusPostBadRequest { + return &FilterStatusPostBadRequest{} +} + +/* +FilterStatusPostBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterStatusPostBadRequest struct { +} + +// IsSuccess returns true when this filter status post bad request response has a 2xx status code +func (o *FilterStatusPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status post bad request response has a 3xx status code +func (o *FilterStatusPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status post bad request response has a 4xx status code +func (o *FilterStatusPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status post bad request response has a 5xx status code +func (o *FilterStatusPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status post bad request response a status code equal to that given +func (o *FilterStatusPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter status post bad request response +func (o *FilterStatusPostBadRequest) Code() int { + return 400 +} + +func (o *FilterStatusPostBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostBadRequest", 400) +} + +func (o *FilterStatusPostBadRequest) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostBadRequest", 400) +} + +func (o *FilterStatusPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusPostUnauthorized creates a FilterStatusPostUnauthorized with default headers values +func NewFilterStatusPostUnauthorized() *FilterStatusPostUnauthorized { + return &FilterStatusPostUnauthorized{} +} + +/* +FilterStatusPostUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterStatusPostUnauthorized struct { +} + +// IsSuccess returns true when this filter status post unauthorized response has a 2xx status code +func (o *FilterStatusPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status post unauthorized response has a 3xx status code +func (o *FilterStatusPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status post unauthorized response has a 4xx status code +func (o *FilterStatusPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status post unauthorized response has a 5xx status code +func (o *FilterStatusPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status post unauthorized response a status code equal to that given +func (o *FilterStatusPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter status post unauthorized response +func (o *FilterStatusPostUnauthorized) Code() int { + return 401 +} + +func (o *FilterStatusPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostUnauthorized", 401) +} + +func (o *FilterStatusPostUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostUnauthorized", 401) +} + +func (o *FilterStatusPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusPostForbidden creates a FilterStatusPostForbidden with default headers values +func NewFilterStatusPostForbidden() *FilterStatusPostForbidden { + return &FilterStatusPostForbidden{} +} + +/* +FilterStatusPostForbidden describes a response with status code 403, with default header values. + +forbidden to moved accounts +*/ +type FilterStatusPostForbidden struct { +} + +// IsSuccess returns true when this filter status post forbidden response has a 2xx status code +func (o *FilterStatusPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status post forbidden response has a 3xx status code +func (o *FilterStatusPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status post forbidden response has a 4xx status code +func (o *FilterStatusPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status post forbidden response has a 5xx status code +func (o *FilterStatusPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status post forbidden response a status code equal to that given +func (o *FilterStatusPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the filter status post forbidden response +func (o *FilterStatusPostForbidden) Code() int { + return 403 +} + +func (o *FilterStatusPostForbidden) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostForbidden", 403) +} + +func (o *FilterStatusPostForbidden) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostForbidden", 403) +} + +func (o *FilterStatusPostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusPostNotFound creates a FilterStatusPostNotFound with default headers values +func NewFilterStatusPostNotFound() *FilterStatusPostNotFound { + return &FilterStatusPostNotFound{} +} + +/* +FilterStatusPostNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterStatusPostNotFound struct { +} + +// IsSuccess returns true when this filter status post not found response has a 2xx status code +func (o *FilterStatusPostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status post not found response has a 3xx status code +func (o *FilterStatusPostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status post not found response has a 4xx status code +func (o *FilterStatusPostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status post not found response has a 5xx status code +func (o *FilterStatusPostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status post not found response a status code equal to that given +func (o *FilterStatusPostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter status post not found response +func (o *FilterStatusPostNotFound) Code() int { + return 404 +} + +func (o *FilterStatusPostNotFound) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostNotFound", 404) +} + +func (o *FilterStatusPostNotFound) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostNotFound", 404) +} + +func (o *FilterStatusPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusPostNotAcceptable creates a FilterStatusPostNotAcceptable with default headers values +func NewFilterStatusPostNotAcceptable() *FilterStatusPostNotAcceptable { + return &FilterStatusPostNotAcceptable{} +} + +/* +FilterStatusPostNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterStatusPostNotAcceptable struct { +} + +// IsSuccess returns true when this filter status post not acceptable response has a 2xx status code +func (o *FilterStatusPostNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status post not acceptable response has a 3xx status code +func (o *FilterStatusPostNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status post not acceptable response has a 4xx status code +func (o *FilterStatusPostNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status post not acceptable response has a 5xx status code +func (o *FilterStatusPostNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status post not acceptable response a status code equal to that given +func (o *FilterStatusPostNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter status post not acceptable response +func (o *FilterStatusPostNotAcceptable) Code() int { + return 406 +} + +func (o *FilterStatusPostNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostNotAcceptable", 406) +} + +func (o *FilterStatusPostNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostNotAcceptable", 406) +} + +func (o *FilterStatusPostNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusPostConflict creates a FilterStatusPostConflict with default headers values +func NewFilterStatusPostConflict() *FilterStatusPostConflict { + return &FilterStatusPostConflict{} +} + +/* +FilterStatusPostConflict describes a response with status code 409, with default header values. + +conflict (duplicate status) +*/ +type FilterStatusPostConflict struct { +} + +// IsSuccess returns true when this filter status post conflict response has a 2xx status code +func (o *FilterStatusPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status post conflict response has a 3xx status code +func (o *FilterStatusPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status post conflict response has a 4xx status code +func (o *FilterStatusPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status post conflict response has a 5xx status code +func (o *FilterStatusPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status post conflict response a status code equal to that given +func (o *FilterStatusPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the filter status post conflict response +func (o *FilterStatusPostConflict) Code() int { + return 409 +} + +func (o *FilterStatusPostConflict) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostConflict", 409) +} + +func (o *FilterStatusPostConflict) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostConflict", 409) +} + +func (o *FilterStatusPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusPostUnprocessableEntity creates a FilterStatusPostUnprocessableEntity with default headers values +func NewFilterStatusPostUnprocessableEntity() *FilterStatusPostUnprocessableEntity { + return &FilterStatusPostUnprocessableEntity{} +} + +/* +FilterStatusPostUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable content +*/ +type FilterStatusPostUnprocessableEntity struct { +} + +// IsSuccess returns true when this filter status post unprocessable entity response has a 2xx status code +func (o *FilterStatusPostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status post unprocessable entity response has a 3xx status code +func (o *FilterStatusPostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status post unprocessable entity response has a 4xx status code +func (o *FilterStatusPostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status post unprocessable entity response has a 5xx status code +func (o *FilterStatusPostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status post unprocessable entity response a status code equal to that given +func (o *FilterStatusPostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the filter status post unprocessable entity response +func (o *FilterStatusPostUnprocessableEntity) Code() int { + return 422 +} + +func (o *FilterStatusPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostUnprocessableEntity", 422) +} + +func (o *FilterStatusPostUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostUnprocessableEntity", 422) +} + +func (o *FilterStatusPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusPostInternalServerError creates a FilterStatusPostInternalServerError with default headers values +func NewFilterStatusPostInternalServerError() *FilterStatusPostInternalServerError { + return &FilterStatusPostInternalServerError{} +} + +/* +FilterStatusPostInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterStatusPostInternalServerError struct { +} + +// IsSuccess returns true when this filter status post internal server error response has a 2xx status code +func (o *FilterStatusPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status post internal server error response has a 3xx status code +func (o *FilterStatusPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status post internal server error response has a 4xx status code +func (o *FilterStatusPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter status post internal server error response has a 5xx status code +func (o *FilterStatusPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter status post internal server error response a status code equal to that given +func (o *FilterStatusPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter status post internal server error response +func (o *FilterStatusPostInternalServerError) Code() int { + return 500 +} + +func (o *FilterStatusPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostInternalServerError", 500) +} + +func (o *FilterStatusPostInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostInternalServerError", 500) +} + +func (o *FilterStatusPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_statuses_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_statuses_get_parameters.go new file mode 100644 index 0000000..e653304 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_statuses_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterStatusesGetParams creates a new FilterStatusesGetParams 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 NewFilterStatusesGetParams() *FilterStatusesGetParams { + return &FilterStatusesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterStatusesGetParamsWithTimeout creates a new FilterStatusesGetParams object +// with the ability to set a timeout on a request. +func NewFilterStatusesGetParamsWithTimeout(timeout time.Duration) *FilterStatusesGetParams { + return &FilterStatusesGetParams{ + timeout: timeout, + } +} + +// NewFilterStatusesGetParamsWithContext creates a new FilterStatusesGetParams object +// with the ability to set a context for a request. +func NewFilterStatusesGetParamsWithContext(ctx context.Context) *FilterStatusesGetParams { + return &FilterStatusesGetParams{ + Context: ctx, + } +} + +// NewFilterStatusesGetParamsWithHTTPClient creates a new FilterStatusesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterStatusesGetParamsWithHTTPClient(client *http.Client) *FilterStatusesGetParams { + return &FilterStatusesGetParams{ + HTTPClient: client, + } +} + +/* +FilterStatusesGetParams contains all the parameters to send to the API endpoint + + for the filter statuses get operation. + + Typically these are written to a http.Request. +*/ +type FilterStatusesGetParams struct { + + /* ID. + + ID of the filter + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter statuses get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterStatusesGetParams) WithDefaults() *FilterStatusesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter statuses get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterStatusesGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter statuses get params +func (o *FilterStatusesGetParams) WithTimeout(timeout time.Duration) *FilterStatusesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter statuses get params +func (o *FilterStatusesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter statuses get params +func (o *FilterStatusesGetParams) WithContext(ctx context.Context) *FilterStatusesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter statuses get params +func (o *FilterStatusesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter statuses get params +func (o *FilterStatusesGetParams) WithHTTPClient(client *http.Client) *FilterStatusesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter statuses get params +func (o *FilterStatusesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter statuses get params +func (o *FilterStatusesGetParams) WithID(id string) *FilterStatusesGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter statuses get params +func (o *FilterStatusesGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterStatusesGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_statuses_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_statuses_get_responses.go new file mode 100644 index 0000000..e21dc97 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_statuses_get_responses.go @@ -0,0 +1,414 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterStatusesGetReader is a Reader for the FilterStatusesGet structure. +type FilterStatusesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterStatusesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterStatusesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterStatusesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterStatusesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterStatusesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterStatusesGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterStatusesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v2/filters/{id}/statuses] filterStatusesGet", response, response.Code()) + } +} + +// NewFilterStatusesGetOK creates a FilterStatusesGetOK with default headers values +func NewFilterStatusesGetOK() *FilterStatusesGetOK { + return &FilterStatusesGetOK{} +} + +/* +FilterStatusesGetOK describes a response with status code 200, with default header values. + +Requested filter statuses. +*/ +type FilterStatusesGetOK struct { + Payload []*models.FilterStatus +} + +// IsSuccess returns true when this filter statuses get o k response has a 2xx status code +func (o *FilterStatusesGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter statuses get o k response has a 3xx status code +func (o *FilterStatusesGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter statuses get o k response has a 4xx status code +func (o *FilterStatusesGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter statuses get o k response has a 5xx status code +func (o *FilterStatusesGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter statuses get o k response a status code equal to that given +func (o *FilterStatusesGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter statuses get o k response +func (o *FilterStatusesGetOK) Code() int { + return 200 +} + +func (o *FilterStatusesGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetOK %s", 200, payload) +} + +func (o *FilterStatusesGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetOK %s", 200, payload) +} + +func (o *FilterStatusesGetOK) GetPayload() []*models.FilterStatus { + return o.Payload +} + +func (o *FilterStatusesGetOK) 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 +} + +// NewFilterStatusesGetBadRequest creates a FilterStatusesGetBadRequest with default headers values +func NewFilterStatusesGetBadRequest() *FilterStatusesGetBadRequest { + return &FilterStatusesGetBadRequest{} +} + +/* +FilterStatusesGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterStatusesGetBadRequest struct { +} + +// IsSuccess returns true when this filter statuses get bad request response has a 2xx status code +func (o *FilterStatusesGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter statuses get bad request response has a 3xx status code +func (o *FilterStatusesGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter statuses get bad request response has a 4xx status code +func (o *FilterStatusesGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter statuses get bad request response has a 5xx status code +func (o *FilterStatusesGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter statuses get bad request response a status code equal to that given +func (o *FilterStatusesGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter statuses get bad request response +func (o *FilterStatusesGetBadRequest) Code() int { + return 400 +} + +func (o *FilterStatusesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetBadRequest", 400) +} + +func (o *FilterStatusesGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetBadRequest", 400) +} + +func (o *FilterStatusesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusesGetUnauthorized creates a FilterStatusesGetUnauthorized with default headers values +func NewFilterStatusesGetUnauthorized() *FilterStatusesGetUnauthorized { + return &FilterStatusesGetUnauthorized{} +} + +/* +FilterStatusesGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterStatusesGetUnauthorized struct { +} + +// IsSuccess returns true when this filter statuses get unauthorized response has a 2xx status code +func (o *FilterStatusesGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter statuses get unauthorized response has a 3xx status code +func (o *FilterStatusesGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter statuses get unauthorized response has a 4xx status code +func (o *FilterStatusesGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter statuses get unauthorized response has a 5xx status code +func (o *FilterStatusesGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter statuses get unauthorized response a status code equal to that given +func (o *FilterStatusesGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter statuses get unauthorized response +func (o *FilterStatusesGetUnauthorized) Code() int { + return 401 +} + +func (o *FilterStatusesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetUnauthorized", 401) +} + +func (o *FilterStatusesGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetUnauthorized", 401) +} + +func (o *FilterStatusesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusesGetNotFound creates a FilterStatusesGetNotFound with default headers values +func NewFilterStatusesGetNotFound() *FilterStatusesGetNotFound { + return &FilterStatusesGetNotFound{} +} + +/* +FilterStatusesGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterStatusesGetNotFound struct { +} + +// IsSuccess returns true when this filter statuses get not found response has a 2xx status code +func (o *FilterStatusesGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter statuses get not found response has a 3xx status code +func (o *FilterStatusesGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter statuses get not found response has a 4xx status code +func (o *FilterStatusesGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter statuses get not found response has a 5xx status code +func (o *FilterStatusesGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter statuses get not found response a status code equal to that given +func (o *FilterStatusesGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter statuses get not found response +func (o *FilterStatusesGetNotFound) Code() int { + return 404 +} + +func (o *FilterStatusesGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetNotFound", 404) +} + +func (o *FilterStatusesGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetNotFound", 404) +} + +func (o *FilterStatusesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusesGetNotAcceptable creates a FilterStatusesGetNotAcceptable with default headers values +func NewFilterStatusesGetNotAcceptable() *FilterStatusesGetNotAcceptable { + return &FilterStatusesGetNotAcceptable{} +} + +/* +FilterStatusesGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterStatusesGetNotAcceptable struct { +} + +// IsSuccess returns true when this filter statuses get not acceptable response has a 2xx status code +func (o *FilterStatusesGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter statuses get not acceptable response has a 3xx status code +func (o *FilterStatusesGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter statuses get not acceptable response has a 4xx status code +func (o *FilterStatusesGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter statuses get not acceptable response has a 5xx status code +func (o *FilterStatusesGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter statuses get not acceptable response a status code equal to that given +func (o *FilterStatusesGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter statuses get not acceptable response +func (o *FilterStatusesGetNotAcceptable) Code() int { + return 406 +} + +func (o *FilterStatusesGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetNotAcceptable", 406) +} + +func (o *FilterStatusesGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetNotAcceptable", 406) +} + +func (o *FilterStatusesGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusesGetInternalServerError creates a FilterStatusesGetInternalServerError with default headers values +func NewFilterStatusesGetInternalServerError() *FilterStatusesGetInternalServerError { + return &FilterStatusesGetInternalServerError{} +} + +/* +FilterStatusesGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterStatusesGetInternalServerError struct { +} + +// IsSuccess returns true when this filter statuses get internal server error response has a 2xx status code +func (o *FilterStatusesGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter statuses get internal server error response has a 3xx status code +func (o *FilterStatusesGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter statuses get internal server error response has a 4xx status code +func (o *FilterStatusesGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter statuses get internal server error response has a 5xx status code +func (o *FilterStatusesGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter statuses get internal server error response a status code equal to that given +func (o *FilterStatusesGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter statuses get internal server error response +func (o *FilterStatusesGetInternalServerError) Code() int { + return 500 +} + +func (o *FilterStatusesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetInternalServerError", 500) +} + +func (o *FilterStatusesGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetInternalServerError", 500) +} + +func (o *FilterStatusesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_delete_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_delete_parameters.go new file mode 100644 index 0000000..07cb3b0 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterV1DeleteParams creates a new FilterV1DeleteParams 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 NewFilterV1DeleteParams() *FilterV1DeleteParams { + return &FilterV1DeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterV1DeleteParamsWithTimeout creates a new FilterV1DeleteParams object +// with the ability to set a timeout on a request. +func NewFilterV1DeleteParamsWithTimeout(timeout time.Duration) *FilterV1DeleteParams { + return &FilterV1DeleteParams{ + timeout: timeout, + } +} + +// NewFilterV1DeleteParamsWithContext creates a new FilterV1DeleteParams object +// with the ability to set a context for a request. +func NewFilterV1DeleteParamsWithContext(ctx context.Context) *FilterV1DeleteParams { + return &FilterV1DeleteParams{ + Context: ctx, + } +} + +// NewFilterV1DeleteParamsWithHTTPClient creates a new FilterV1DeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterV1DeleteParamsWithHTTPClient(client *http.Client) *FilterV1DeleteParams { + return &FilterV1DeleteParams{ + HTTPClient: client, + } +} + +/* +FilterV1DeleteParams contains all the parameters to send to the API endpoint + + for the filter v1 delete operation. + + Typically these are written to a http.Request. +*/ +type FilterV1DeleteParams struct { + + /* ID. + + ID of the filter + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter v1 delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV1DeleteParams) WithDefaults() *FilterV1DeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter v1 delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV1DeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter v1 delete params +func (o *FilterV1DeleteParams) WithTimeout(timeout time.Duration) *FilterV1DeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter v1 delete params +func (o *FilterV1DeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter v1 delete params +func (o *FilterV1DeleteParams) WithContext(ctx context.Context) *FilterV1DeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter v1 delete params +func (o *FilterV1DeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter v1 delete params +func (o *FilterV1DeleteParams) WithHTTPClient(client *http.Client) *FilterV1DeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter v1 delete params +func (o *FilterV1DeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter v1 delete params +func (o *FilterV1DeleteParams) WithID(id string) *FilterV1DeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter v1 delete params +func (o *FilterV1DeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterV1DeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_delete_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_delete_responses.go new file mode 100644 index 0000000..5d4cd60 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_delete_responses.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// FilterV1DeleteReader is a Reader for the FilterV1Delete structure. +type FilterV1DeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterV1DeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterV1DeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterV1DeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterV1DeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterV1DeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterV1DeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterV1DeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/filters/{id}] filterV1Delete", response, response.Code()) + } +} + +// NewFilterV1DeleteOK creates a FilterV1DeleteOK with default headers values +func NewFilterV1DeleteOK() *FilterV1DeleteOK { + return &FilterV1DeleteOK{} +} + +/* +FilterV1DeleteOK describes a response with status code 200, with default header values. + +filter deleted +*/ +type FilterV1DeleteOK struct { +} + +// IsSuccess returns true when this filter v1 delete o k response has a 2xx status code +func (o *FilterV1DeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter v1 delete o k response has a 3xx status code +func (o *FilterV1DeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 delete o k response has a 4xx status code +func (o *FilterV1DeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v1 delete o k response has a 5xx status code +func (o *FilterV1DeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 delete o k response a status code equal to that given +func (o *FilterV1DeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter v1 delete o k response +func (o *FilterV1DeleteOK) Code() int { + return 200 +} + +func (o *FilterV1DeleteOK) Error() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteOK", 200) +} + +func (o *FilterV1DeleteOK) String() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteOK", 200) +} + +func (o *FilterV1DeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1DeleteBadRequest creates a FilterV1DeleteBadRequest with default headers values +func NewFilterV1DeleteBadRequest() *FilterV1DeleteBadRequest { + return &FilterV1DeleteBadRequest{} +} + +/* +FilterV1DeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterV1DeleteBadRequest struct { +} + +// IsSuccess returns true when this filter v1 delete bad request response has a 2xx status code +func (o *FilterV1DeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 delete bad request response has a 3xx status code +func (o *FilterV1DeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 delete bad request response has a 4xx status code +func (o *FilterV1DeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 delete bad request response has a 5xx status code +func (o *FilterV1DeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 delete bad request response a status code equal to that given +func (o *FilterV1DeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter v1 delete bad request response +func (o *FilterV1DeleteBadRequest) Code() int { + return 400 +} + +func (o *FilterV1DeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteBadRequest", 400) +} + +func (o *FilterV1DeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteBadRequest", 400) +} + +func (o *FilterV1DeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1DeleteUnauthorized creates a FilterV1DeleteUnauthorized with default headers values +func NewFilterV1DeleteUnauthorized() *FilterV1DeleteUnauthorized { + return &FilterV1DeleteUnauthorized{} +} + +/* +FilterV1DeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterV1DeleteUnauthorized struct { +} + +// IsSuccess returns true when this filter v1 delete unauthorized response has a 2xx status code +func (o *FilterV1DeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 delete unauthorized response has a 3xx status code +func (o *FilterV1DeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 delete unauthorized response has a 4xx status code +func (o *FilterV1DeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 delete unauthorized response has a 5xx status code +func (o *FilterV1DeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 delete unauthorized response a status code equal to that given +func (o *FilterV1DeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter v1 delete unauthorized response +func (o *FilterV1DeleteUnauthorized) Code() int { + return 401 +} + +func (o *FilterV1DeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteUnauthorized", 401) +} + +func (o *FilterV1DeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteUnauthorized", 401) +} + +func (o *FilterV1DeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1DeleteNotFound creates a FilterV1DeleteNotFound with default headers values +func NewFilterV1DeleteNotFound() *FilterV1DeleteNotFound { + return &FilterV1DeleteNotFound{} +} + +/* +FilterV1DeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterV1DeleteNotFound struct { +} + +// IsSuccess returns true when this filter v1 delete not found response has a 2xx status code +func (o *FilterV1DeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 delete not found response has a 3xx status code +func (o *FilterV1DeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 delete not found response has a 4xx status code +func (o *FilterV1DeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 delete not found response has a 5xx status code +func (o *FilterV1DeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 delete not found response a status code equal to that given +func (o *FilterV1DeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter v1 delete not found response +func (o *FilterV1DeleteNotFound) Code() int { + return 404 +} + +func (o *FilterV1DeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteNotFound", 404) +} + +func (o *FilterV1DeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteNotFound", 404) +} + +func (o *FilterV1DeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1DeleteNotAcceptable creates a FilterV1DeleteNotAcceptable with default headers values +func NewFilterV1DeleteNotAcceptable() *FilterV1DeleteNotAcceptable { + return &FilterV1DeleteNotAcceptable{} +} + +/* +FilterV1DeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterV1DeleteNotAcceptable struct { +} + +// IsSuccess returns true when this filter v1 delete not acceptable response has a 2xx status code +func (o *FilterV1DeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 delete not acceptable response has a 3xx status code +func (o *FilterV1DeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 delete not acceptable response has a 4xx status code +func (o *FilterV1DeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 delete not acceptable response has a 5xx status code +func (o *FilterV1DeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 delete not acceptable response a status code equal to that given +func (o *FilterV1DeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter v1 delete not acceptable response +func (o *FilterV1DeleteNotAcceptable) Code() int { + return 406 +} + +func (o *FilterV1DeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteNotAcceptable", 406) +} + +func (o *FilterV1DeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteNotAcceptable", 406) +} + +func (o *FilterV1DeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1DeleteInternalServerError creates a FilterV1DeleteInternalServerError with default headers values +func NewFilterV1DeleteInternalServerError() *FilterV1DeleteInternalServerError { + return &FilterV1DeleteInternalServerError{} +} + +/* +FilterV1DeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterV1DeleteInternalServerError struct { +} + +// IsSuccess returns true when this filter v1 delete internal server error response has a 2xx status code +func (o *FilterV1DeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 delete internal server error response has a 3xx status code +func (o *FilterV1DeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 delete internal server error response has a 4xx status code +func (o *FilterV1DeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v1 delete internal server error response has a 5xx status code +func (o *FilterV1DeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter v1 delete internal server error response a status code equal to that given +func (o *FilterV1DeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter v1 delete internal server error response +func (o *FilterV1DeleteInternalServerError) Code() int { + return 500 +} + +func (o *FilterV1DeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteInternalServerError", 500) +} + +func (o *FilterV1DeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteInternalServerError", 500) +} + +func (o *FilterV1DeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_get_parameters.go new file mode 100644 index 0000000..c2063c6 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterV1GetParams creates a new FilterV1GetParams 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 NewFilterV1GetParams() *FilterV1GetParams { + return &FilterV1GetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterV1GetParamsWithTimeout creates a new FilterV1GetParams object +// with the ability to set a timeout on a request. +func NewFilterV1GetParamsWithTimeout(timeout time.Duration) *FilterV1GetParams { + return &FilterV1GetParams{ + timeout: timeout, + } +} + +// NewFilterV1GetParamsWithContext creates a new FilterV1GetParams object +// with the ability to set a context for a request. +func NewFilterV1GetParamsWithContext(ctx context.Context) *FilterV1GetParams { + return &FilterV1GetParams{ + Context: ctx, + } +} + +// NewFilterV1GetParamsWithHTTPClient creates a new FilterV1GetParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterV1GetParamsWithHTTPClient(client *http.Client) *FilterV1GetParams { + return &FilterV1GetParams{ + HTTPClient: client, + } +} + +/* +FilterV1GetParams contains all the parameters to send to the API endpoint + + for the filter v1 get operation. + + Typically these are written to a http.Request. +*/ +type FilterV1GetParams struct { + + /* ID. + + ID of the filter + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter v1 get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV1GetParams) WithDefaults() *FilterV1GetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter v1 get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV1GetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter v1 get params +func (o *FilterV1GetParams) WithTimeout(timeout time.Duration) *FilterV1GetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter v1 get params +func (o *FilterV1GetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter v1 get params +func (o *FilterV1GetParams) WithContext(ctx context.Context) *FilterV1GetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter v1 get params +func (o *FilterV1GetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter v1 get params +func (o *FilterV1GetParams) WithHTTPClient(client *http.Client) *FilterV1GetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter v1 get params +func (o *FilterV1GetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter v1 get params +func (o *FilterV1GetParams) WithID(id string) *FilterV1GetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter v1 get params +func (o *FilterV1GetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterV1GetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_get_responses.go new file mode 100644 index 0000000..499e86f --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_get_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterV1GetReader is a Reader for the FilterV1Get structure. +type FilterV1GetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterV1GetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterV1GetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterV1GetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterV1GetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterV1GetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterV1GetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterV1GetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/filters/{id}] filterV1Get", response, response.Code()) + } +} + +// NewFilterV1GetOK creates a FilterV1GetOK with default headers values +func NewFilterV1GetOK() *FilterV1GetOK { + return &FilterV1GetOK{} +} + +/* +FilterV1GetOK describes a response with status code 200, with default header values. + +Requested filter. +*/ +type FilterV1GetOK struct { + Payload *models.FilterV1 +} + +// IsSuccess returns true when this filter v1 get o k response has a 2xx status code +func (o *FilterV1GetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter v1 get o k response has a 3xx status code +func (o *FilterV1GetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 get o k response has a 4xx status code +func (o *FilterV1GetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v1 get o k response has a 5xx status code +func (o *FilterV1GetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 get o k response a status code equal to that given +func (o *FilterV1GetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter v1 get o k response +func (o *FilterV1GetOK) Code() int { + return 200 +} + +func (o *FilterV1GetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetOK %s", 200, payload) +} + +func (o *FilterV1GetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetOK %s", 200, payload) +} + +func (o *FilterV1GetOK) GetPayload() *models.FilterV1 { + return o.Payload +} + +func (o *FilterV1GetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterV1) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterV1GetBadRequest creates a FilterV1GetBadRequest with default headers values +func NewFilterV1GetBadRequest() *FilterV1GetBadRequest { + return &FilterV1GetBadRequest{} +} + +/* +FilterV1GetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterV1GetBadRequest struct { +} + +// IsSuccess returns true when this filter v1 get bad request response has a 2xx status code +func (o *FilterV1GetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 get bad request response has a 3xx status code +func (o *FilterV1GetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 get bad request response has a 4xx status code +func (o *FilterV1GetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 get bad request response has a 5xx status code +func (o *FilterV1GetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 get bad request response a status code equal to that given +func (o *FilterV1GetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter v1 get bad request response +func (o *FilterV1GetBadRequest) Code() int { + return 400 +} + +func (o *FilterV1GetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetBadRequest", 400) +} + +func (o *FilterV1GetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetBadRequest", 400) +} + +func (o *FilterV1GetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1GetUnauthorized creates a FilterV1GetUnauthorized with default headers values +func NewFilterV1GetUnauthorized() *FilterV1GetUnauthorized { + return &FilterV1GetUnauthorized{} +} + +/* +FilterV1GetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterV1GetUnauthorized struct { +} + +// IsSuccess returns true when this filter v1 get unauthorized response has a 2xx status code +func (o *FilterV1GetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 get unauthorized response has a 3xx status code +func (o *FilterV1GetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 get unauthorized response has a 4xx status code +func (o *FilterV1GetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 get unauthorized response has a 5xx status code +func (o *FilterV1GetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 get unauthorized response a status code equal to that given +func (o *FilterV1GetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter v1 get unauthorized response +func (o *FilterV1GetUnauthorized) Code() int { + return 401 +} + +func (o *FilterV1GetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetUnauthorized", 401) +} + +func (o *FilterV1GetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetUnauthorized", 401) +} + +func (o *FilterV1GetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1GetNotFound creates a FilterV1GetNotFound with default headers values +func NewFilterV1GetNotFound() *FilterV1GetNotFound { + return &FilterV1GetNotFound{} +} + +/* +FilterV1GetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterV1GetNotFound struct { +} + +// IsSuccess returns true when this filter v1 get not found response has a 2xx status code +func (o *FilterV1GetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 get not found response has a 3xx status code +func (o *FilterV1GetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 get not found response has a 4xx status code +func (o *FilterV1GetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 get not found response has a 5xx status code +func (o *FilterV1GetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 get not found response a status code equal to that given +func (o *FilterV1GetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter v1 get not found response +func (o *FilterV1GetNotFound) Code() int { + return 404 +} + +func (o *FilterV1GetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetNotFound", 404) +} + +func (o *FilterV1GetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetNotFound", 404) +} + +func (o *FilterV1GetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1GetNotAcceptable creates a FilterV1GetNotAcceptable with default headers values +func NewFilterV1GetNotAcceptable() *FilterV1GetNotAcceptable { + return &FilterV1GetNotAcceptable{} +} + +/* +FilterV1GetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterV1GetNotAcceptable struct { +} + +// IsSuccess returns true when this filter v1 get not acceptable response has a 2xx status code +func (o *FilterV1GetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 get not acceptable response has a 3xx status code +func (o *FilterV1GetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 get not acceptable response has a 4xx status code +func (o *FilterV1GetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 get not acceptable response has a 5xx status code +func (o *FilterV1GetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 get not acceptable response a status code equal to that given +func (o *FilterV1GetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter v1 get not acceptable response +func (o *FilterV1GetNotAcceptable) Code() int { + return 406 +} + +func (o *FilterV1GetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetNotAcceptable", 406) +} + +func (o *FilterV1GetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetNotAcceptable", 406) +} + +func (o *FilterV1GetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1GetInternalServerError creates a FilterV1GetInternalServerError with default headers values +func NewFilterV1GetInternalServerError() *FilterV1GetInternalServerError { + return &FilterV1GetInternalServerError{} +} + +/* +FilterV1GetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterV1GetInternalServerError struct { +} + +// IsSuccess returns true when this filter v1 get internal server error response has a 2xx status code +func (o *FilterV1GetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 get internal server error response has a 3xx status code +func (o *FilterV1GetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 get internal server error response has a 4xx status code +func (o *FilterV1GetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v1 get internal server error response has a 5xx status code +func (o *FilterV1GetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter v1 get internal server error response a status code equal to that given +func (o *FilterV1GetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter v1 get internal server error response +func (o *FilterV1GetInternalServerError) Code() int { + return 500 +} + +func (o *FilterV1GetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetInternalServerError", 500) +} + +func (o *FilterV1GetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetInternalServerError", 500) +} + +func (o *FilterV1GetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_post_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_post_parameters.go new file mode 100644 index 0000000..bb93786 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_post_parameters.go @@ -0,0 +1,321 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterV1PostParams creates a new FilterV1PostParams 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 NewFilterV1PostParams() *FilterV1PostParams { + return &FilterV1PostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterV1PostParamsWithTimeout creates a new FilterV1PostParams object +// with the ability to set a timeout on a request. +func NewFilterV1PostParamsWithTimeout(timeout time.Duration) *FilterV1PostParams { + return &FilterV1PostParams{ + timeout: timeout, + } +} + +// NewFilterV1PostParamsWithContext creates a new FilterV1PostParams object +// with the ability to set a context for a request. +func NewFilterV1PostParamsWithContext(ctx context.Context) *FilterV1PostParams { + return &FilterV1PostParams{ + Context: ctx, + } +} + +// NewFilterV1PostParamsWithHTTPClient creates a new FilterV1PostParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterV1PostParamsWithHTTPClient(client *http.Client) *FilterV1PostParams { + return &FilterV1PostParams{ + HTTPClient: client, + } +} + +/* +FilterV1PostParams contains all the parameters to send to the API endpoint + + for the filter v1 post operation. + + Typically these are written to a http.Request. +*/ +type FilterV1PostParams struct { + + /* FilterContext. + + The contexts in which the filter should be applied. + + Sample: home, public + */ + FilterContext []string + + /* ExpiresIn. + + Number of seconds from now that the filter should expire. If omitted, filter never expires. + + Sample: 86400 + */ + ExpiresIn *float64 + + /* Irreversible. + + Should matching entities be removed from the user's timelines/views, instead of hidden? Not supported yet. + + Sample: false + */ + Irreversible *bool + + /* Phrase. + + The text to be filtered. + + Sample: fnord + */ + Phrase string + + /* WholeWord. + + Should the filter consider word boundaries? + + Sample: true + */ + WholeWord *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter v1 post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV1PostParams) WithDefaults() *FilterV1PostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter v1 post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV1PostParams) SetDefaults() { + var ( + irreversibleDefault = bool(false) + + wholeWordDefault = bool(false) + ) + + val := FilterV1PostParams{ + Irreversible: &irreversibleDefault, + WholeWord: &wholeWordDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the filter v1 post params +func (o *FilterV1PostParams) WithTimeout(timeout time.Duration) *FilterV1PostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter v1 post params +func (o *FilterV1PostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter v1 post params +func (o *FilterV1PostParams) WithContext(ctx context.Context) *FilterV1PostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter v1 post params +func (o *FilterV1PostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter v1 post params +func (o *FilterV1PostParams) WithHTTPClient(client *http.Client) *FilterV1PostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter v1 post params +func (o *FilterV1PostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithFilterContext adds the filter context to the filter v1 post params +func (o *FilterV1PostParams) WithFilterContext(context []string) *FilterV1PostParams { + o.SetFilterContext(context) + return o +} + +// SetFilterContext adds the filter context to the filter v1 post params +func (o *FilterV1PostParams) SetFilterContext(context []string) { + o.FilterContext = context +} + +// WithExpiresIn adds the expiresIn to the filter v1 post params +func (o *FilterV1PostParams) WithExpiresIn(expiresIn *float64) *FilterV1PostParams { + o.SetExpiresIn(expiresIn) + return o +} + +// SetExpiresIn adds the expiresIn to the filter v1 post params +func (o *FilterV1PostParams) SetExpiresIn(expiresIn *float64) { + o.ExpiresIn = expiresIn +} + +// WithIrreversible adds the irreversible to the filter v1 post params +func (o *FilterV1PostParams) WithIrreversible(irreversible *bool) *FilterV1PostParams { + o.SetIrreversible(irreversible) + return o +} + +// SetIrreversible adds the irreversible to the filter v1 post params +func (o *FilterV1PostParams) SetIrreversible(irreversible *bool) { + o.Irreversible = irreversible +} + +// WithPhrase adds the phrase to the filter v1 post params +func (o *FilterV1PostParams) WithPhrase(phrase string) *FilterV1PostParams { + o.SetPhrase(phrase) + return o +} + +// SetPhrase adds the phrase to the filter v1 post params +func (o *FilterV1PostParams) SetPhrase(phrase string) { + o.Phrase = phrase +} + +// WithWholeWord adds the wholeWord to the filter v1 post params +func (o *FilterV1PostParams) WithWholeWord(wholeWord *bool) *FilterV1PostParams { + o.SetWholeWord(wholeWord) + return o +} + +// SetWholeWord adds the wholeWord to the filter v1 post params +func (o *FilterV1PostParams) SetWholeWord(wholeWord *bool) { + o.WholeWord = wholeWord +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterV1PostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Context != nil { + + // binding items for context[] + joinedContext := o.bindParamContext(reg) + + // form array param context[] + if err := r.SetFormParam("context[]", joinedContext...); err != nil { + return err + } + } + + if o.ExpiresIn != nil { + + // form param expires_in + var frExpiresIn float64 + if o.ExpiresIn != nil { + frExpiresIn = *o.ExpiresIn + } + fExpiresIn := swag.FormatFloat64(frExpiresIn) + if fExpiresIn != "" { + if err := r.SetFormParam("expires_in", fExpiresIn); err != nil { + return err + } + } + } + + if o.Irreversible != nil { + + // form param irreversible + var frIrreversible bool + if o.Irreversible != nil { + frIrreversible = *o.Irreversible + } + fIrreversible := swag.FormatBool(frIrreversible) + if fIrreversible != "" { + if err := r.SetFormParam("irreversible", fIrreversible); err != nil { + return err + } + } + } + + // form param phrase + frPhrase := o.Phrase + fPhrase := frPhrase + if fPhrase != "" { + if err := r.SetFormParam("phrase", fPhrase); err != nil { + return err + } + } + + if o.WholeWord != nil { + + // form param whole_word + var frWholeWord bool + if o.WholeWord != nil { + frWholeWord = *o.WholeWord + } + fWholeWord := swag.FormatBool(frWholeWord) + if fWholeWord != "" { + if err := r.SetFormParam("whole_word", fWholeWord); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamFilterV1Post binds the parameter context[] +func (o *FilterV1PostParams) bindParamContext(formats strfmt.Registry) []string { + contextIR := o.FilterContext + + var contextIC []string + for _, contextIIR := range contextIR { // explode []string + + contextIIV := contextIIR // string as string + contextIC = append(contextIC, contextIIV) + } + + // items.CollectionFormat: "multi" + contextIS := swag.JoinByFormat(contextIC, "multi") + + return contextIS +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_post_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_post_responses.go new file mode 100644 index 0000000..e860cc8 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_post_responses.go @@ -0,0 +1,602 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterV1PostReader is a Reader for the FilterV1Post structure. +type FilterV1PostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterV1PostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterV1PostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterV1PostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterV1PostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewFilterV1PostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterV1PostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterV1PostNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewFilterV1PostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewFilterV1PostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterV1PostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/filters] filterV1Post", response, response.Code()) + } +} + +// NewFilterV1PostOK creates a FilterV1PostOK with default headers values +func NewFilterV1PostOK() *FilterV1PostOK { + return &FilterV1PostOK{} +} + +/* +FilterV1PostOK describes a response with status code 200, with default header values. + +New filter. +*/ +type FilterV1PostOK struct { + Payload *models.FilterV1 +} + +// IsSuccess returns true when this filter v1 post o k response has a 2xx status code +func (o *FilterV1PostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter v1 post o k response has a 3xx status code +func (o *FilterV1PostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 post o k response has a 4xx status code +func (o *FilterV1PostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v1 post o k response has a 5xx status code +func (o *FilterV1PostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 post o k response a status code equal to that given +func (o *FilterV1PostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter v1 post o k response +func (o *FilterV1PostOK) Code() int { + return 200 +} + +func (o *FilterV1PostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostOK %s", 200, payload) +} + +func (o *FilterV1PostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostOK %s", 200, payload) +} + +func (o *FilterV1PostOK) GetPayload() *models.FilterV1 { + return o.Payload +} + +func (o *FilterV1PostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterV1) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterV1PostBadRequest creates a FilterV1PostBadRequest with default headers values +func NewFilterV1PostBadRequest() *FilterV1PostBadRequest { + return &FilterV1PostBadRequest{} +} + +/* +FilterV1PostBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterV1PostBadRequest struct { +} + +// IsSuccess returns true when this filter v1 post bad request response has a 2xx status code +func (o *FilterV1PostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 post bad request response has a 3xx status code +func (o *FilterV1PostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 post bad request response has a 4xx status code +func (o *FilterV1PostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 post bad request response has a 5xx status code +func (o *FilterV1PostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 post bad request response a status code equal to that given +func (o *FilterV1PostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter v1 post bad request response +func (o *FilterV1PostBadRequest) Code() int { + return 400 +} + +func (o *FilterV1PostBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostBadRequest", 400) +} + +func (o *FilterV1PostBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostBadRequest", 400) +} + +func (o *FilterV1PostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PostUnauthorized creates a FilterV1PostUnauthorized with default headers values +func NewFilterV1PostUnauthorized() *FilterV1PostUnauthorized { + return &FilterV1PostUnauthorized{} +} + +/* +FilterV1PostUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterV1PostUnauthorized struct { +} + +// IsSuccess returns true when this filter v1 post unauthorized response has a 2xx status code +func (o *FilterV1PostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 post unauthorized response has a 3xx status code +func (o *FilterV1PostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 post unauthorized response has a 4xx status code +func (o *FilterV1PostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 post unauthorized response has a 5xx status code +func (o *FilterV1PostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 post unauthorized response a status code equal to that given +func (o *FilterV1PostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter v1 post unauthorized response +func (o *FilterV1PostUnauthorized) Code() int { + return 401 +} + +func (o *FilterV1PostUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostUnauthorized", 401) +} + +func (o *FilterV1PostUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostUnauthorized", 401) +} + +func (o *FilterV1PostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PostForbidden creates a FilterV1PostForbidden with default headers values +func NewFilterV1PostForbidden() *FilterV1PostForbidden { + return &FilterV1PostForbidden{} +} + +/* +FilterV1PostForbidden describes a response with status code 403, with default header values. + +forbidden to moved accounts +*/ +type FilterV1PostForbidden struct { +} + +// IsSuccess returns true when this filter v1 post forbidden response has a 2xx status code +func (o *FilterV1PostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 post forbidden response has a 3xx status code +func (o *FilterV1PostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 post forbidden response has a 4xx status code +func (o *FilterV1PostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 post forbidden response has a 5xx status code +func (o *FilterV1PostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 post forbidden response a status code equal to that given +func (o *FilterV1PostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the filter v1 post forbidden response +func (o *FilterV1PostForbidden) Code() int { + return 403 +} + +func (o *FilterV1PostForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostForbidden", 403) +} + +func (o *FilterV1PostForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostForbidden", 403) +} + +func (o *FilterV1PostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PostNotFound creates a FilterV1PostNotFound with default headers values +func NewFilterV1PostNotFound() *FilterV1PostNotFound { + return &FilterV1PostNotFound{} +} + +/* +FilterV1PostNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterV1PostNotFound struct { +} + +// IsSuccess returns true when this filter v1 post not found response has a 2xx status code +func (o *FilterV1PostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 post not found response has a 3xx status code +func (o *FilterV1PostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 post not found response has a 4xx status code +func (o *FilterV1PostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 post not found response has a 5xx status code +func (o *FilterV1PostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 post not found response a status code equal to that given +func (o *FilterV1PostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter v1 post not found response +func (o *FilterV1PostNotFound) Code() int { + return 404 +} + +func (o *FilterV1PostNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostNotFound", 404) +} + +func (o *FilterV1PostNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostNotFound", 404) +} + +func (o *FilterV1PostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PostNotAcceptable creates a FilterV1PostNotAcceptable with default headers values +func NewFilterV1PostNotAcceptable() *FilterV1PostNotAcceptable { + return &FilterV1PostNotAcceptable{} +} + +/* +FilterV1PostNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterV1PostNotAcceptable struct { +} + +// IsSuccess returns true when this filter v1 post not acceptable response has a 2xx status code +func (o *FilterV1PostNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 post not acceptable response has a 3xx status code +func (o *FilterV1PostNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 post not acceptable response has a 4xx status code +func (o *FilterV1PostNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 post not acceptable response has a 5xx status code +func (o *FilterV1PostNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 post not acceptable response a status code equal to that given +func (o *FilterV1PostNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter v1 post not acceptable response +func (o *FilterV1PostNotAcceptable) Code() int { + return 406 +} + +func (o *FilterV1PostNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostNotAcceptable", 406) +} + +func (o *FilterV1PostNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostNotAcceptable", 406) +} + +func (o *FilterV1PostNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PostConflict creates a FilterV1PostConflict with default headers values +func NewFilterV1PostConflict() *FilterV1PostConflict { + return &FilterV1PostConflict{} +} + +/* +FilterV1PostConflict describes a response with status code 409, with default header values. + +conflict (duplicate keyword) +*/ +type FilterV1PostConflict struct { +} + +// IsSuccess returns true when this filter v1 post conflict response has a 2xx status code +func (o *FilterV1PostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 post conflict response has a 3xx status code +func (o *FilterV1PostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 post conflict response has a 4xx status code +func (o *FilterV1PostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 post conflict response has a 5xx status code +func (o *FilterV1PostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 post conflict response a status code equal to that given +func (o *FilterV1PostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the filter v1 post conflict response +func (o *FilterV1PostConflict) Code() int { + return 409 +} + +func (o *FilterV1PostConflict) Error() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostConflict", 409) +} + +func (o *FilterV1PostConflict) String() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostConflict", 409) +} + +func (o *FilterV1PostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PostUnprocessableEntity creates a FilterV1PostUnprocessableEntity with default headers values +func NewFilterV1PostUnprocessableEntity() *FilterV1PostUnprocessableEntity { + return &FilterV1PostUnprocessableEntity{} +} + +/* +FilterV1PostUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable content +*/ +type FilterV1PostUnprocessableEntity struct { +} + +// IsSuccess returns true when this filter v1 post unprocessable entity response has a 2xx status code +func (o *FilterV1PostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 post unprocessable entity response has a 3xx status code +func (o *FilterV1PostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 post unprocessable entity response has a 4xx status code +func (o *FilterV1PostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 post unprocessable entity response has a 5xx status code +func (o *FilterV1PostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 post unprocessable entity response a status code equal to that given +func (o *FilterV1PostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the filter v1 post unprocessable entity response +func (o *FilterV1PostUnprocessableEntity) Code() int { + return 422 +} + +func (o *FilterV1PostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostUnprocessableEntity", 422) +} + +func (o *FilterV1PostUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostUnprocessableEntity", 422) +} + +func (o *FilterV1PostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PostInternalServerError creates a FilterV1PostInternalServerError with default headers values +func NewFilterV1PostInternalServerError() *FilterV1PostInternalServerError { + return &FilterV1PostInternalServerError{} +} + +/* +FilterV1PostInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterV1PostInternalServerError struct { +} + +// IsSuccess returns true when this filter v1 post internal server error response has a 2xx status code +func (o *FilterV1PostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 post internal server error response has a 3xx status code +func (o *FilterV1PostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 post internal server error response has a 4xx status code +func (o *FilterV1PostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v1 post internal server error response has a 5xx status code +func (o *FilterV1PostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter v1 post internal server error response a status code equal to that given +func (o *FilterV1PostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter v1 post internal server error response +func (o *FilterV1PostInternalServerError) Code() int { + return 500 +} + +func (o *FilterV1PostInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostInternalServerError", 500) +} + +func (o *FilterV1PostInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostInternalServerError", 500) +} + +func (o *FilterV1PostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_put_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_put_parameters.go new file mode 100644 index 0000000..5e03a61 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_put_parameters.go @@ -0,0 +1,343 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterV1PutParams creates a new FilterV1PutParams 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 NewFilterV1PutParams() *FilterV1PutParams { + return &FilterV1PutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterV1PutParamsWithTimeout creates a new FilterV1PutParams object +// with the ability to set a timeout on a request. +func NewFilterV1PutParamsWithTimeout(timeout time.Duration) *FilterV1PutParams { + return &FilterV1PutParams{ + timeout: timeout, + } +} + +// NewFilterV1PutParamsWithContext creates a new FilterV1PutParams object +// with the ability to set a context for a request. +func NewFilterV1PutParamsWithContext(ctx context.Context) *FilterV1PutParams { + return &FilterV1PutParams{ + Context: ctx, + } +} + +// NewFilterV1PutParamsWithHTTPClient creates a new FilterV1PutParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterV1PutParamsWithHTTPClient(client *http.Client) *FilterV1PutParams { + return &FilterV1PutParams{ + HTTPClient: client, + } +} + +/* +FilterV1PutParams contains all the parameters to send to the API endpoint + + for the filter v1 put operation. + + Typically these are written to a http.Request. +*/ +type FilterV1PutParams struct { + + /* FilterContext. + + The contexts in which the filter should be applied. + + Sample: home, public + */ + FilterContext []string + + /* ExpiresIn. + + Number of seconds from now that the filter should expire. If omitted, filter never expires. + + Sample: 86400 + */ + ExpiresIn *float64 + + /* ID. + + ID of the filter. + */ + ID string + + /* Irreversible. + + Should matching entities be removed from the user's timelines/views, instead of hidden? Not supported yet. + + Sample: false + */ + Irreversible *bool + + /* Phrase. + + The text to be filtered. + + Sample: fnord + */ + Phrase string + + /* WholeWord. + + Should the filter consider word boundaries? + + Sample: true + */ + WholeWord *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter v1 put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV1PutParams) WithDefaults() *FilterV1PutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter v1 put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV1PutParams) SetDefaults() { + var ( + irreversibleDefault = bool(false) + + wholeWordDefault = bool(false) + ) + + val := FilterV1PutParams{ + Irreversible: &irreversibleDefault, + WholeWord: &wholeWordDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the filter v1 put params +func (o *FilterV1PutParams) WithTimeout(timeout time.Duration) *FilterV1PutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter v1 put params +func (o *FilterV1PutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter v1 put params +func (o *FilterV1PutParams) WithContext(ctx context.Context) *FilterV1PutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter v1 put params +func (o *FilterV1PutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter v1 put params +func (o *FilterV1PutParams) WithHTTPClient(client *http.Client) *FilterV1PutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter v1 put params +func (o *FilterV1PutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithFilterContext adds the filter context to the filter v1 put params +func (o *FilterV1PutParams) WithFilterContext(context []string) *FilterV1PutParams { + o.SetFilterContext(context) + return o +} + +// SetFilterContext adds the filter context to the filter v1 put params +func (o *FilterV1PutParams) SetFilterContext(context []string) { + o.FilterContext = context +} + +// WithExpiresIn adds the expiresIn to the filter v1 put params +func (o *FilterV1PutParams) WithExpiresIn(expiresIn *float64) *FilterV1PutParams { + o.SetExpiresIn(expiresIn) + return o +} + +// SetExpiresIn adds the expiresIn to the filter v1 put params +func (o *FilterV1PutParams) SetExpiresIn(expiresIn *float64) { + o.ExpiresIn = expiresIn +} + +// WithID adds the id to the filter v1 put params +func (o *FilterV1PutParams) WithID(id string) *FilterV1PutParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter v1 put params +func (o *FilterV1PutParams) SetID(id string) { + o.ID = id +} + +// WithIrreversible adds the irreversible to the filter v1 put params +func (o *FilterV1PutParams) WithIrreversible(irreversible *bool) *FilterV1PutParams { + o.SetIrreversible(irreversible) + return o +} + +// SetIrreversible adds the irreversible to the filter v1 put params +func (o *FilterV1PutParams) SetIrreversible(irreversible *bool) { + o.Irreversible = irreversible +} + +// WithPhrase adds the phrase to the filter v1 put params +func (o *FilterV1PutParams) WithPhrase(phrase string) *FilterV1PutParams { + o.SetPhrase(phrase) + return o +} + +// SetPhrase adds the phrase to the filter v1 put params +func (o *FilterV1PutParams) SetPhrase(phrase string) { + o.Phrase = phrase +} + +// WithWholeWord adds the wholeWord to the filter v1 put params +func (o *FilterV1PutParams) WithWholeWord(wholeWord *bool) *FilterV1PutParams { + o.SetWholeWord(wholeWord) + return o +} + +// SetWholeWord adds the wholeWord to the filter v1 put params +func (o *FilterV1PutParams) SetWholeWord(wholeWord *bool) { + o.WholeWord = wholeWord +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterV1PutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Context != nil { + + // binding items for context[] + joinedContext := o.bindParamContext(reg) + + // form array param context[] + if err := r.SetFormParam("context[]", joinedContext...); err != nil { + return err + } + } + + if o.ExpiresIn != nil { + + // form param expires_in + var frExpiresIn float64 + if o.ExpiresIn != nil { + frExpiresIn = *o.ExpiresIn + } + fExpiresIn := swag.FormatFloat64(frExpiresIn) + if fExpiresIn != "" { + if err := r.SetFormParam("expires_in", fExpiresIn); err != nil { + return err + } + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Irreversible != nil { + + // form param irreversible + var frIrreversible bool + if o.Irreversible != nil { + frIrreversible = *o.Irreversible + } + fIrreversible := swag.FormatBool(frIrreversible) + if fIrreversible != "" { + if err := r.SetFormParam("irreversible", fIrreversible); err != nil { + return err + } + } + } + + // form param phrase + frPhrase := o.Phrase + fPhrase := frPhrase + if fPhrase != "" { + if err := r.SetFormParam("phrase", fPhrase); err != nil { + return err + } + } + + if o.WholeWord != nil { + + // form param whole_word + var frWholeWord bool + if o.WholeWord != nil { + frWholeWord = *o.WholeWord + } + fWholeWord := swag.FormatBool(frWholeWord) + if fWholeWord != "" { + if err := r.SetFormParam("whole_word", fWholeWord); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamFilterV1Put binds the parameter context[] +func (o *FilterV1PutParams) bindParamContext(formats strfmt.Registry) []string { + contextIR := o.FilterContext + + var contextIC []string + for _, contextIIR := range contextIR { // explode []string + + contextIIV := contextIIR // string as string + contextIC = append(contextIC, contextIIV) + } + + // items.CollectionFormat: "multi" + contextIS := swag.JoinByFormat(contextIC, "multi") + + return contextIS +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_put_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_put_responses.go new file mode 100644 index 0000000..0c350b3 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v1_put_responses.go @@ -0,0 +1,602 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterV1PutReader is a Reader for the FilterV1Put structure. +type FilterV1PutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterV1PutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterV1PutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterV1PutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterV1PutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewFilterV1PutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterV1PutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterV1PutNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewFilterV1PutConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewFilterV1PutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterV1PutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /api/v1/filters/{id}] filterV1Put", response, response.Code()) + } +} + +// NewFilterV1PutOK creates a FilterV1PutOK with default headers values +func NewFilterV1PutOK() *FilterV1PutOK { + return &FilterV1PutOK{} +} + +/* +FilterV1PutOK describes a response with status code 200, with default header values. + +Updated filter. +*/ +type FilterV1PutOK struct { + Payload *models.FilterV1 +} + +// IsSuccess returns true when this filter v1 put o k response has a 2xx status code +func (o *FilterV1PutOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter v1 put o k response has a 3xx status code +func (o *FilterV1PutOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 put o k response has a 4xx status code +func (o *FilterV1PutOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v1 put o k response has a 5xx status code +func (o *FilterV1PutOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 put o k response a status code equal to that given +func (o *FilterV1PutOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter v1 put o k response +func (o *FilterV1PutOK) Code() int { + return 200 +} + +func (o *FilterV1PutOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutOK %s", 200, payload) +} + +func (o *FilterV1PutOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutOK %s", 200, payload) +} + +func (o *FilterV1PutOK) GetPayload() *models.FilterV1 { + return o.Payload +} + +func (o *FilterV1PutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterV1) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterV1PutBadRequest creates a FilterV1PutBadRequest with default headers values +func NewFilterV1PutBadRequest() *FilterV1PutBadRequest { + return &FilterV1PutBadRequest{} +} + +/* +FilterV1PutBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterV1PutBadRequest struct { +} + +// IsSuccess returns true when this filter v1 put bad request response has a 2xx status code +func (o *FilterV1PutBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 put bad request response has a 3xx status code +func (o *FilterV1PutBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 put bad request response has a 4xx status code +func (o *FilterV1PutBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 put bad request response has a 5xx status code +func (o *FilterV1PutBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 put bad request response a status code equal to that given +func (o *FilterV1PutBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter v1 put bad request response +func (o *FilterV1PutBadRequest) Code() int { + return 400 +} + +func (o *FilterV1PutBadRequest) Error() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutBadRequest", 400) +} + +func (o *FilterV1PutBadRequest) String() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutBadRequest", 400) +} + +func (o *FilterV1PutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PutUnauthorized creates a FilterV1PutUnauthorized with default headers values +func NewFilterV1PutUnauthorized() *FilterV1PutUnauthorized { + return &FilterV1PutUnauthorized{} +} + +/* +FilterV1PutUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterV1PutUnauthorized struct { +} + +// IsSuccess returns true when this filter v1 put unauthorized response has a 2xx status code +func (o *FilterV1PutUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 put unauthorized response has a 3xx status code +func (o *FilterV1PutUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 put unauthorized response has a 4xx status code +func (o *FilterV1PutUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 put unauthorized response has a 5xx status code +func (o *FilterV1PutUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 put unauthorized response a status code equal to that given +func (o *FilterV1PutUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter v1 put unauthorized response +func (o *FilterV1PutUnauthorized) Code() int { + return 401 +} + +func (o *FilterV1PutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutUnauthorized", 401) +} + +func (o *FilterV1PutUnauthorized) String() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutUnauthorized", 401) +} + +func (o *FilterV1PutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PutForbidden creates a FilterV1PutForbidden with default headers values +func NewFilterV1PutForbidden() *FilterV1PutForbidden { + return &FilterV1PutForbidden{} +} + +/* +FilterV1PutForbidden describes a response with status code 403, with default header values. + +forbidden to moved accounts +*/ +type FilterV1PutForbidden struct { +} + +// IsSuccess returns true when this filter v1 put forbidden response has a 2xx status code +func (o *FilterV1PutForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 put forbidden response has a 3xx status code +func (o *FilterV1PutForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 put forbidden response has a 4xx status code +func (o *FilterV1PutForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 put forbidden response has a 5xx status code +func (o *FilterV1PutForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 put forbidden response a status code equal to that given +func (o *FilterV1PutForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the filter v1 put forbidden response +func (o *FilterV1PutForbidden) Code() int { + return 403 +} + +func (o *FilterV1PutForbidden) Error() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutForbidden", 403) +} + +func (o *FilterV1PutForbidden) String() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutForbidden", 403) +} + +func (o *FilterV1PutForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PutNotFound creates a FilterV1PutNotFound with default headers values +func NewFilterV1PutNotFound() *FilterV1PutNotFound { + return &FilterV1PutNotFound{} +} + +/* +FilterV1PutNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterV1PutNotFound struct { +} + +// IsSuccess returns true when this filter v1 put not found response has a 2xx status code +func (o *FilterV1PutNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 put not found response has a 3xx status code +func (o *FilterV1PutNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 put not found response has a 4xx status code +func (o *FilterV1PutNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 put not found response has a 5xx status code +func (o *FilterV1PutNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 put not found response a status code equal to that given +func (o *FilterV1PutNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter v1 put not found response +func (o *FilterV1PutNotFound) Code() int { + return 404 +} + +func (o *FilterV1PutNotFound) Error() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutNotFound", 404) +} + +func (o *FilterV1PutNotFound) String() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutNotFound", 404) +} + +func (o *FilterV1PutNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PutNotAcceptable creates a FilterV1PutNotAcceptable with default headers values +func NewFilterV1PutNotAcceptable() *FilterV1PutNotAcceptable { + return &FilterV1PutNotAcceptable{} +} + +/* +FilterV1PutNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterV1PutNotAcceptable struct { +} + +// IsSuccess returns true when this filter v1 put not acceptable response has a 2xx status code +func (o *FilterV1PutNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 put not acceptable response has a 3xx status code +func (o *FilterV1PutNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 put not acceptable response has a 4xx status code +func (o *FilterV1PutNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 put not acceptable response has a 5xx status code +func (o *FilterV1PutNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 put not acceptable response a status code equal to that given +func (o *FilterV1PutNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter v1 put not acceptable response +func (o *FilterV1PutNotAcceptable) Code() int { + return 406 +} + +func (o *FilterV1PutNotAcceptable) Error() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutNotAcceptable", 406) +} + +func (o *FilterV1PutNotAcceptable) String() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutNotAcceptable", 406) +} + +func (o *FilterV1PutNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PutConflict creates a FilterV1PutConflict with default headers values +func NewFilterV1PutConflict() *FilterV1PutConflict { + return &FilterV1PutConflict{} +} + +/* +FilterV1PutConflict describes a response with status code 409, with default header values. + +conflict (duplicate keyword) +*/ +type FilterV1PutConflict struct { +} + +// IsSuccess returns true when this filter v1 put conflict response has a 2xx status code +func (o *FilterV1PutConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 put conflict response has a 3xx status code +func (o *FilterV1PutConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 put conflict response has a 4xx status code +func (o *FilterV1PutConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 put conflict response has a 5xx status code +func (o *FilterV1PutConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 put conflict response a status code equal to that given +func (o *FilterV1PutConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the filter v1 put conflict response +func (o *FilterV1PutConflict) Code() int { + return 409 +} + +func (o *FilterV1PutConflict) Error() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutConflict", 409) +} + +func (o *FilterV1PutConflict) String() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutConflict", 409) +} + +func (o *FilterV1PutConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PutUnprocessableEntity creates a FilterV1PutUnprocessableEntity with default headers values +func NewFilterV1PutUnprocessableEntity() *FilterV1PutUnprocessableEntity { + return &FilterV1PutUnprocessableEntity{} +} + +/* +FilterV1PutUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable content +*/ +type FilterV1PutUnprocessableEntity struct { +} + +// IsSuccess returns true when this filter v1 put unprocessable entity response has a 2xx status code +func (o *FilterV1PutUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 put unprocessable entity response has a 3xx status code +func (o *FilterV1PutUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 put unprocessable entity response has a 4xx status code +func (o *FilterV1PutUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 put unprocessable entity response has a 5xx status code +func (o *FilterV1PutUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 put unprocessable entity response a status code equal to that given +func (o *FilterV1PutUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the filter v1 put unprocessable entity response +func (o *FilterV1PutUnprocessableEntity) Code() int { + return 422 +} + +func (o *FilterV1PutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutUnprocessableEntity", 422) +} + +func (o *FilterV1PutUnprocessableEntity) String() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutUnprocessableEntity", 422) +} + +func (o *FilterV1PutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PutInternalServerError creates a FilterV1PutInternalServerError with default headers values +func NewFilterV1PutInternalServerError() *FilterV1PutInternalServerError { + return &FilterV1PutInternalServerError{} +} + +/* +FilterV1PutInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterV1PutInternalServerError struct { +} + +// IsSuccess returns true when this filter v1 put internal server error response has a 2xx status code +func (o *FilterV1PutInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 put internal server error response has a 3xx status code +func (o *FilterV1PutInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 put internal server error response has a 4xx status code +func (o *FilterV1PutInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v1 put internal server error response has a 5xx status code +func (o *FilterV1PutInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter v1 put internal server error response a status code equal to that given +func (o *FilterV1PutInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter v1 put internal server error response +func (o *FilterV1PutInternalServerError) Code() int { + return 500 +} + +func (o *FilterV1PutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutInternalServerError", 500) +} + +func (o *FilterV1PutInternalServerError) String() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutInternalServerError", 500) +} + +func (o *FilterV1PutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_delete_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_delete_parameters.go new file mode 100644 index 0000000..bdb8ed4 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterV2DeleteParams creates a new FilterV2DeleteParams 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 NewFilterV2DeleteParams() *FilterV2DeleteParams { + return &FilterV2DeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterV2DeleteParamsWithTimeout creates a new FilterV2DeleteParams object +// with the ability to set a timeout on a request. +func NewFilterV2DeleteParamsWithTimeout(timeout time.Duration) *FilterV2DeleteParams { + return &FilterV2DeleteParams{ + timeout: timeout, + } +} + +// NewFilterV2DeleteParamsWithContext creates a new FilterV2DeleteParams object +// with the ability to set a context for a request. +func NewFilterV2DeleteParamsWithContext(ctx context.Context) *FilterV2DeleteParams { + return &FilterV2DeleteParams{ + Context: ctx, + } +} + +// NewFilterV2DeleteParamsWithHTTPClient creates a new FilterV2DeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterV2DeleteParamsWithHTTPClient(client *http.Client) *FilterV2DeleteParams { + return &FilterV2DeleteParams{ + HTTPClient: client, + } +} + +/* +FilterV2DeleteParams contains all the parameters to send to the API endpoint + + for the filter v2 delete operation. + + Typically these are written to a http.Request. +*/ +type FilterV2DeleteParams struct { + + /* ID. + + ID of the filter + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter v2 delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2DeleteParams) WithDefaults() *FilterV2DeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter v2 delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2DeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter v2 delete params +func (o *FilterV2DeleteParams) WithTimeout(timeout time.Duration) *FilterV2DeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter v2 delete params +func (o *FilterV2DeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter v2 delete params +func (o *FilterV2DeleteParams) WithContext(ctx context.Context) *FilterV2DeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter v2 delete params +func (o *FilterV2DeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter v2 delete params +func (o *FilterV2DeleteParams) WithHTTPClient(client *http.Client) *FilterV2DeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter v2 delete params +func (o *FilterV2DeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter v2 delete params +func (o *FilterV2DeleteParams) WithID(id string) *FilterV2DeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter v2 delete params +func (o *FilterV2DeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterV2DeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_delete_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_delete_responses.go new file mode 100644 index 0000000..b184a09 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_delete_responses.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// FilterV2DeleteReader is a Reader for the FilterV2Delete structure. +type FilterV2DeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterV2DeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterV2DeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterV2DeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterV2DeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterV2DeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterV2DeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterV2DeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v2/filters/{id}] filterV2Delete", response, response.Code()) + } +} + +// NewFilterV2DeleteOK creates a FilterV2DeleteOK with default headers values +func NewFilterV2DeleteOK() *FilterV2DeleteOK { + return &FilterV2DeleteOK{} +} + +/* +FilterV2DeleteOK describes a response with status code 200, with default header values. + +filter deleted +*/ +type FilterV2DeleteOK struct { +} + +// IsSuccess returns true when this filter v2 delete o k response has a 2xx status code +func (o *FilterV2DeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter v2 delete o k response has a 3xx status code +func (o *FilterV2DeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 delete o k response has a 4xx status code +func (o *FilterV2DeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v2 delete o k response has a 5xx status code +func (o *FilterV2DeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 delete o k response a status code equal to that given +func (o *FilterV2DeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter v2 delete o k response +func (o *FilterV2DeleteOK) Code() int { + return 200 +} + +func (o *FilterV2DeleteOK) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteOK", 200) +} + +func (o *FilterV2DeleteOK) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteOK", 200) +} + +func (o *FilterV2DeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2DeleteBadRequest creates a FilterV2DeleteBadRequest with default headers values +func NewFilterV2DeleteBadRequest() *FilterV2DeleteBadRequest { + return &FilterV2DeleteBadRequest{} +} + +/* +FilterV2DeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterV2DeleteBadRequest struct { +} + +// IsSuccess returns true when this filter v2 delete bad request response has a 2xx status code +func (o *FilterV2DeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 delete bad request response has a 3xx status code +func (o *FilterV2DeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 delete bad request response has a 4xx status code +func (o *FilterV2DeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 delete bad request response has a 5xx status code +func (o *FilterV2DeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 delete bad request response a status code equal to that given +func (o *FilterV2DeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter v2 delete bad request response +func (o *FilterV2DeleteBadRequest) Code() int { + return 400 +} + +func (o *FilterV2DeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteBadRequest", 400) +} + +func (o *FilterV2DeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteBadRequest", 400) +} + +func (o *FilterV2DeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2DeleteUnauthorized creates a FilterV2DeleteUnauthorized with default headers values +func NewFilterV2DeleteUnauthorized() *FilterV2DeleteUnauthorized { + return &FilterV2DeleteUnauthorized{} +} + +/* +FilterV2DeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterV2DeleteUnauthorized struct { +} + +// IsSuccess returns true when this filter v2 delete unauthorized response has a 2xx status code +func (o *FilterV2DeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 delete unauthorized response has a 3xx status code +func (o *FilterV2DeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 delete unauthorized response has a 4xx status code +func (o *FilterV2DeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 delete unauthorized response has a 5xx status code +func (o *FilterV2DeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 delete unauthorized response a status code equal to that given +func (o *FilterV2DeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter v2 delete unauthorized response +func (o *FilterV2DeleteUnauthorized) Code() int { + return 401 +} + +func (o *FilterV2DeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteUnauthorized", 401) +} + +func (o *FilterV2DeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteUnauthorized", 401) +} + +func (o *FilterV2DeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2DeleteNotFound creates a FilterV2DeleteNotFound with default headers values +func NewFilterV2DeleteNotFound() *FilterV2DeleteNotFound { + return &FilterV2DeleteNotFound{} +} + +/* +FilterV2DeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterV2DeleteNotFound struct { +} + +// IsSuccess returns true when this filter v2 delete not found response has a 2xx status code +func (o *FilterV2DeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 delete not found response has a 3xx status code +func (o *FilterV2DeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 delete not found response has a 4xx status code +func (o *FilterV2DeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 delete not found response has a 5xx status code +func (o *FilterV2DeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 delete not found response a status code equal to that given +func (o *FilterV2DeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter v2 delete not found response +func (o *FilterV2DeleteNotFound) Code() int { + return 404 +} + +func (o *FilterV2DeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteNotFound", 404) +} + +func (o *FilterV2DeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteNotFound", 404) +} + +func (o *FilterV2DeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2DeleteNotAcceptable creates a FilterV2DeleteNotAcceptable with default headers values +func NewFilterV2DeleteNotAcceptable() *FilterV2DeleteNotAcceptable { + return &FilterV2DeleteNotAcceptable{} +} + +/* +FilterV2DeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterV2DeleteNotAcceptable struct { +} + +// IsSuccess returns true when this filter v2 delete not acceptable response has a 2xx status code +func (o *FilterV2DeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 delete not acceptable response has a 3xx status code +func (o *FilterV2DeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 delete not acceptable response has a 4xx status code +func (o *FilterV2DeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 delete not acceptable response has a 5xx status code +func (o *FilterV2DeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 delete not acceptable response a status code equal to that given +func (o *FilterV2DeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter v2 delete not acceptable response +func (o *FilterV2DeleteNotAcceptable) Code() int { + return 406 +} + +func (o *FilterV2DeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteNotAcceptable", 406) +} + +func (o *FilterV2DeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteNotAcceptable", 406) +} + +func (o *FilterV2DeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2DeleteInternalServerError creates a FilterV2DeleteInternalServerError with default headers values +func NewFilterV2DeleteInternalServerError() *FilterV2DeleteInternalServerError { + return &FilterV2DeleteInternalServerError{} +} + +/* +FilterV2DeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterV2DeleteInternalServerError struct { +} + +// IsSuccess returns true when this filter v2 delete internal server error response has a 2xx status code +func (o *FilterV2DeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 delete internal server error response has a 3xx status code +func (o *FilterV2DeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 delete internal server error response has a 4xx status code +func (o *FilterV2DeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v2 delete internal server error response has a 5xx status code +func (o *FilterV2DeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter v2 delete internal server error response a status code equal to that given +func (o *FilterV2DeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter v2 delete internal server error response +func (o *FilterV2DeleteInternalServerError) Code() int { + return 500 +} + +func (o *FilterV2DeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteInternalServerError", 500) +} + +func (o *FilterV2DeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteInternalServerError", 500) +} + +func (o *FilterV2DeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_get_parameters.go new file mode 100644 index 0000000..ffc1936 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterV2GetParams creates a new FilterV2GetParams 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 NewFilterV2GetParams() *FilterV2GetParams { + return &FilterV2GetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterV2GetParamsWithTimeout creates a new FilterV2GetParams object +// with the ability to set a timeout on a request. +func NewFilterV2GetParamsWithTimeout(timeout time.Duration) *FilterV2GetParams { + return &FilterV2GetParams{ + timeout: timeout, + } +} + +// NewFilterV2GetParamsWithContext creates a new FilterV2GetParams object +// with the ability to set a context for a request. +func NewFilterV2GetParamsWithContext(ctx context.Context) *FilterV2GetParams { + return &FilterV2GetParams{ + Context: ctx, + } +} + +// NewFilterV2GetParamsWithHTTPClient creates a new FilterV2GetParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterV2GetParamsWithHTTPClient(client *http.Client) *FilterV2GetParams { + return &FilterV2GetParams{ + HTTPClient: client, + } +} + +/* +FilterV2GetParams contains all the parameters to send to the API endpoint + + for the filter v2 get operation. + + Typically these are written to a http.Request. +*/ +type FilterV2GetParams struct { + + /* ID. + + ID of the filter + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter v2 get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2GetParams) WithDefaults() *FilterV2GetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter v2 get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2GetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter v2 get params +func (o *FilterV2GetParams) WithTimeout(timeout time.Duration) *FilterV2GetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter v2 get params +func (o *FilterV2GetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter v2 get params +func (o *FilterV2GetParams) WithContext(ctx context.Context) *FilterV2GetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter v2 get params +func (o *FilterV2GetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter v2 get params +func (o *FilterV2GetParams) WithHTTPClient(client *http.Client) *FilterV2GetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter v2 get params +func (o *FilterV2GetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter v2 get params +func (o *FilterV2GetParams) WithID(id string) *FilterV2GetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter v2 get params +func (o *FilterV2GetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterV2GetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_get_responses.go new file mode 100644 index 0000000..914315e --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_get_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterV2GetReader is a Reader for the FilterV2Get structure. +type FilterV2GetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterV2GetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterV2GetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterV2GetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterV2GetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterV2GetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterV2GetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterV2GetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v2/filters/{id}] filterV2Get", response, response.Code()) + } +} + +// NewFilterV2GetOK creates a FilterV2GetOK with default headers values +func NewFilterV2GetOK() *FilterV2GetOK { + return &FilterV2GetOK{} +} + +/* +FilterV2GetOK describes a response with status code 200, with default header values. + +Requested filter. +*/ +type FilterV2GetOK struct { + Payload *models.FilterV2 +} + +// IsSuccess returns true when this filter v2 get o k response has a 2xx status code +func (o *FilterV2GetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter v2 get o k response has a 3xx status code +func (o *FilterV2GetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 get o k response has a 4xx status code +func (o *FilterV2GetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v2 get o k response has a 5xx status code +func (o *FilterV2GetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 get o k response a status code equal to that given +func (o *FilterV2GetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter v2 get o k response +func (o *FilterV2GetOK) Code() int { + return 200 +} + +func (o *FilterV2GetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetOK %s", 200, payload) +} + +func (o *FilterV2GetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetOK %s", 200, payload) +} + +func (o *FilterV2GetOK) GetPayload() *models.FilterV2 { + return o.Payload +} + +func (o *FilterV2GetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterV2) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterV2GetBadRequest creates a FilterV2GetBadRequest with default headers values +func NewFilterV2GetBadRequest() *FilterV2GetBadRequest { + return &FilterV2GetBadRequest{} +} + +/* +FilterV2GetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterV2GetBadRequest struct { +} + +// IsSuccess returns true when this filter v2 get bad request response has a 2xx status code +func (o *FilterV2GetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 get bad request response has a 3xx status code +func (o *FilterV2GetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 get bad request response has a 4xx status code +func (o *FilterV2GetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 get bad request response has a 5xx status code +func (o *FilterV2GetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 get bad request response a status code equal to that given +func (o *FilterV2GetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter v2 get bad request response +func (o *FilterV2GetBadRequest) Code() int { + return 400 +} + +func (o *FilterV2GetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetBadRequest", 400) +} + +func (o *FilterV2GetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetBadRequest", 400) +} + +func (o *FilterV2GetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2GetUnauthorized creates a FilterV2GetUnauthorized with default headers values +func NewFilterV2GetUnauthorized() *FilterV2GetUnauthorized { + return &FilterV2GetUnauthorized{} +} + +/* +FilterV2GetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterV2GetUnauthorized struct { +} + +// IsSuccess returns true when this filter v2 get unauthorized response has a 2xx status code +func (o *FilterV2GetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 get unauthorized response has a 3xx status code +func (o *FilterV2GetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 get unauthorized response has a 4xx status code +func (o *FilterV2GetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 get unauthorized response has a 5xx status code +func (o *FilterV2GetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 get unauthorized response a status code equal to that given +func (o *FilterV2GetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter v2 get unauthorized response +func (o *FilterV2GetUnauthorized) Code() int { + return 401 +} + +func (o *FilterV2GetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetUnauthorized", 401) +} + +func (o *FilterV2GetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetUnauthorized", 401) +} + +func (o *FilterV2GetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2GetNotFound creates a FilterV2GetNotFound with default headers values +func NewFilterV2GetNotFound() *FilterV2GetNotFound { + return &FilterV2GetNotFound{} +} + +/* +FilterV2GetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterV2GetNotFound struct { +} + +// IsSuccess returns true when this filter v2 get not found response has a 2xx status code +func (o *FilterV2GetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 get not found response has a 3xx status code +func (o *FilterV2GetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 get not found response has a 4xx status code +func (o *FilterV2GetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 get not found response has a 5xx status code +func (o *FilterV2GetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 get not found response a status code equal to that given +func (o *FilterV2GetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter v2 get not found response +func (o *FilterV2GetNotFound) Code() int { + return 404 +} + +func (o *FilterV2GetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetNotFound", 404) +} + +func (o *FilterV2GetNotFound) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetNotFound", 404) +} + +func (o *FilterV2GetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2GetNotAcceptable creates a FilterV2GetNotAcceptable with default headers values +func NewFilterV2GetNotAcceptable() *FilterV2GetNotAcceptable { + return &FilterV2GetNotAcceptable{} +} + +/* +FilterV2GetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterV2GetNotAcceptable struct { +} + +// IsSuccess returns true when this filter v2 get not acceptable response has a 2xx status code +func (o *FilterV2GetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 get not acceptable response has a 3xx status code +func (o *FilterV2GetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 get not acceptable response has a 4xx status code +func (o *FilterV2GetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 get not acceptable response has a 5xx status code +func (o *FilterV2GetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 get not acceptable response a status code equal to that given +func (o *FilterV2GetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter v2 get not acceptable response +func (o *FilterV2GetNotAcceptable) Code() int { + return 406 +} + +func (o *FilterV2GetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetNotAcceptable", 406) +} + +func (o *FilterV2GetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetNotAcceptable", 406) +} + +func (o *FilterV2GetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2GetInternalServerError creates a FilterV2GetInternalServerError with default headers values +func NewFilterV2GetInternalServerError() *FilterV2GetInternalServerError { + return &FilterV2GetInternalServerError{} +} + +/* +FilterV2GetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterV2GetInternalServerError struct { +} + +// IsSuccess returns true when this filter v2 get internal server error response has a 2xx status code +func (o *FilterV2GetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 get internal server error response has a 3xx status code +func (o *FilterV2GetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 get internal server error response has a 4xx status code +func (o *FilterV2GetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v2 get internal server error response has a 5xx status code +func (o *FilterV2GetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter v2 get internal server error response a status code equal to that given +func (o *FilterV2GetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter v2 get internal server error response +func (o *FilterV2GetInternalServerError) Code() int { + return 500 +} + +func (o *FilterV2GetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetInternalServerError", 500) +} + +func (o *FilterV2GetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetInternalServerError", 500) +} + +func (o *FilterV2GetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_post_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_post_parameters.go new file mode 100644 index 0000000..a19c745 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_post_parameters.go @@ -0,0 +1,421 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterV2PostParams creates a new FilterV2PostParams 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 NewFilterV2PostParams() *FilterV2PostParams { + return &FilterV2PostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterV2PostParamsWithTimeout creates a new FilterV2PostParams object +// with the ability to set a timeout on a request. +func NewFilterV2PostParamsWithTimeout(timeout time.Duration) *FilterV2PostParams { + return &FilterV2PostParams{ + timeout: timeout, + } +} + +// NewFilterV2PostParamsWithContext creates a new FilterV2PostParams object +// with the ability to set a context for a request. +func NewFilterV2PostParamsWithContext(ctx context.Context) *FilterV2PostParams { + return &FilterV2PostParams{ + Context: ctx, + } +} + +// NewFilterV2PostParamsWithHTTPClient creates a new FilterV2PostParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterV2PostParamsWithHTTPClient(client *http.Client) *FilterV2PostParams { + return &FilterV2PostParams{ + HTTPClient: client, + } +} + +/* +FilterV2PostParams contains all the parameters to send to the API endpoint + + for the filter v2 post operation. + + Typically these are written to a http.Request. +*/ +type FilterV2PostParams struct { + + /* FilterContext. + + The contexts in which the filter should be applied. + + Sample: home, public + */ + FilterContext []string + + /* ExpiresIn. + + Number of seconds from now that the filter should expire. If omitted, filter never expires. + + Sample: 86400 + */ + ExpiresIn *float64 + + /* FilterAction. + + The action to be taken when a status matches this filter. + + Sample: warn + + Default: "warn" + */ + FilterAction *string + + /* KeywordsAttributesKeyword. + + Keywords to be added (if not using id param) or updated (if using id param). + */ + KeywordsAttributesKeyword []string + + /* KeywordsAttributesWholeWord. + + Should each keyword consider word boundaries? + */ + KeywordsAttributesWholeWord []bool + + /* StatusesAttributesStatusID. + + Statuses to be added to the filter. + */ + StatusesAttributesStatusID []string + + /* Title. + + The name of the filter. + + Sample: illuminati nonsense + */ + Title string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter v2 post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2PostParams) WithDefaults() *FilterV2PostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter v2 post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2PostParams) SetDefaults() { + var ( + filterActionDefault = string("warn") + ) + + val := FilterV2PostParams{ + FilterAction: &filterActionDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the filter v2 post params +func (o *FilterV2PostParams) WithTimeout(timeout time.Duration) *FilterV2PostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter v2 post params +func (o *FilterV2PostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter v2 post params +func (o *FilterV2PostParams) WithContext(ctx context.Context) *FilterV2PostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter v2 post params +func (o *FilterV2PostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter v2 post params +func (o *FilterV2PostParams) WithHTTPClient(client *http.Client) *FilterV2PostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter v2 post params +func (o *FilterV2PostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithFilterContext adds the filter context to the filter v2 post params +func (o *FilterV2PostParams) WithFilterContext(context []string) *FilterV2PostParams { + o.SetFilterContext(context) + return o +} + +// SetFilterContext adds the filter context to the filter v2 post params +func (o *FilterV2PostParams) SetFilterContext(context []string) { + o.FilterContext = context +} + +// WithExpiresIn adds the expiresIn to the filter v2 post params +func (o *FilterV2PostParams) WithExpiresIn(expiresIn *float64) *FilterV2PostParams { + o.SetExpiresIn(expiresIn) + return o +} + +// SetExpiresIn adds the expiresIn to the filter v2 post params +func (o *FilterV2PostParams) SetExpiresIn(expiresIn *float64) { + o.ExpiresIn = expiresIn +} + +// WithFilterAction adds the filterAction to the filter v2 post params +func (o *FilterV2PostParams) WithFilterAction(filterAction *string) *FilterV2PostParams { + o.SetFilterAction(filterAction) + return o +} + +// SetFilterAction adds the filterAction to the filter v2 post params +func (o *FilterV2PostParams) SetFilterAction(filterAction *string) { + o.FilterAction = filterAction +} + +// WithKeywordsAttributesKeyword adds the keywordsAttributesKeyword to the filter v2 post params +func (o *FilterV2PostParams) WithKeywordsAttributesKeyword(keywordsAttributesKeyword []string) *FilterV2PostParams { + o.SetKeywordsAttributesKeyword(keywordsAttributesKeyword) + return o +} + +// SetKeywordsAttributesKeyword adds the keywordsAttributesKeyword to the filter v2 post params +func (o *FilterV2PostParams) SetKeywordsAttributesKeyword(keywordsAttributesKeyword []string) { + o.KeywordsAttributesKeyword = keywordsAttributesKeyword +} + +// WithKeywordsAttributesWholeWord adds the keywordsAttributesWholeWord to the filter v2 post params +func (o *FilterV2PostParams) WithKeywordsAttributesWholeWord(keywordsAttributesWholeWord []bool) *FilterV2PostParams { + o.SetKeywordsAttributesWholeWord(keywordsAttributesWholeWord) + return o +} + +// SetKeywordsAttributesWholeWord adds the keywordsAttributesWholeWord to the filter v2 post params +func (o *FilterV2PostParams) SetKeywordsAttributesWholeWord(keywordsAttributesWholeWord []bool) { + o.KeywordsAttributesWholeWord = keywordsAttributesWholeWord +} + +// WithStatusesAttributesStatusID adds the statusesAttributesStatusID to the filter v2 post params +func (o *FilterV2PostParams) WithStatusesAttributesStatusID(statusesAttributesStatusID []string) *FilterV2PostParams { + o.SetStatusesAttributesStatusID(statusesAttributesStatusID) + return o +} + +// SetStatusesAttributesStatusID adds the statusesAttributesStatusId to the filter v2 post params +func (o *FilterV2PostParams) SetStatusesAttributesStatusID(statusesAttributesStatusID []string) { + o.StatusesAttributesStatusID = statusesAttributesStatusID +} + +// WithTitle adds the title to the filter v2 post params +func (o *FilterV2PostParams) WithTitle(title string) *FilterV2PostParams { + o.SetTitle(title) + return o +} + +// SetTitle adds the title to the filter v2 post params +func (o *FilterV2PostParams) SetTitle(title string) { + o.Title = title +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterV2PostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Context != nil { + + // binding items for context[] + joinedContext := o.bindParamContext(reg) + + // form array param context[] + if err := r.SetFormParam("context[]", joinedContext...); err != nil { + return err + } + } + + if o.ExpiresIn != nil { + + // form param expires_in + var frExpiresIn float64 + if o.ExpiresIn != nil { + frExpiresIn = *o.ExpiresIn + } + fExpiresIn := swag.FormatFloat64(frExpiresIn) + if fExpiresIn != "" { + if err := r.SetFormParam("expires_in", fExpiresIn); err != nil { + return err + } + } + } + + if o.FilterAction != nil { + + // form param filter_action + var frFilterAction string + if o.FilterAction != nil { + frFilterAction = *o.FilterAction + } + fFilterAction := frFilterAction + if fFilterAction != "" { + if err := r.SetFormParam("filter_action", fFilterAction); err != nil { + return err + } + } + } + + if o.KeywordsAttributesKeyword != nil { + + // binding items for keywords_attributes[][keyword] + joinedKeywordsAttributesKeyword := o.bindParamKeywordsAttributesKeyword(reg) + + // form array param keywords_attributes[][keyword] + if err := r.SetFormParam("keywords_attributes[][keyword]", joinedKeywordsAttributesKeyword...); err != nil { + return err + } + } + + if o.KeywordsAttributesWholeWord != nil { + + // binding items for keywords_attributes[][whole_word] + joinedKeywordsAttributesWholeWord := o.bindParamKeywordsAttributesWholeWord(reg) + + // form array param keywords_attributes[][whole_word] + if err := r.SetFormParam("keywords_attributes[][whole_word]", joinedKeywordsAttributesWholeWord...); err != nil { + return err + } + } + + if o.StatusesAttributesStatusID != nil { + + // binding items for statuses_attributes[][status_id] + joinedStatusesAttributesStatusID := o.bindParamStatusesAttributesStatusID(reg) + + // form array param statuses_attributes[][status_id] + if err := r.SetFormParam("statuses_attributes[][status_id]", joinedStatusesAttributesStatusID...); err != nil { + return err + } + } + + // form param title + frTitle := o.Title + fTitle := frTitle + if fTitle != "" { + if err := r.SetFormParam("title", fTitle); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamFilterV2Post binds the parameter context[] +func (o *FilterV2PostParams) bindParamContext(formats strfmt.Registry) []string { + contextIR := o.FilterContext + + var contextIC []string + for _, contextIIR := range contextIR { // explode []string + + contextIIV := contextIIR // string as string + contextIC = append(contextIC, contextIIV) + } + + // items.CollectionFormat: "multi" + contextIS := swag.JoinByFormat(contextIC, "multi") + + return contextIS +} + +// bindParamFilterV2Post binds the parameter keywords_attributes[][keyword] +func (o *FilterV2PostParams) bindParamKeywordsAttributesKeyword(formats strfmt.Registry) []string { + keywordsAttributesKeywordIR := o.KeywordsAttributesKeyword + + var keywordsAttributesKeywordIC []string + for _, keywordsAttributesKeywordIIR := range keywordsAttributesKeywordIR { // explode []string + + keywordsAttributesKeywordIIV := keywordsAttributesKeywordIIR // string as string + keywordsAttributesKeywordIC = append(keywordsAttributesKeywordIC, keywordsAttributesKeywordIIV) + } + + // items.CollectionFormat: "multi" + keywordsAttributesKeywordIS := swag.JoinByFormat(keywordsAttributesKeywordIC, "multi") + + return keywordsAttributesKeywordIS +} + +// bindParamFilterV2Post binds the parameter keywords_attributes[][whole_word] +func (o *FilterV2PostParams) bindParamKeywordsAttributesWholeWord(formats strfmt.Registry) []string { + keywordsAttributesWholeWordIR := o.KeywordsAttributesWholeWord + + var keywordsAttributesWholeWordIC []string + for _, keywordsAttributesWholeWordIIR := range keywordsAttributesWholeWordIR { // explode []bool + + keywordsAttributesWholeWordIIV := swag.FormatBool(keywordsAttributesWholeWordIIR) // bool as string + keywordsAttributesWholeWordIC = append(keywordsAttributesWholeWordIC, keywordsAttributesWholeWordIIV) + } + + // items.CollectionFormat: "multi" + keywordsAttributesWholeWordIS := swag.JoinByFormat(keywordsAttributesWholeWordIC, "multi") + + return keywordsAttributesWholeWordIS +} + +// bindParamFilterV2Post binds the parameter statuses_attributes[][status_id] +func (o *FilterV2PostParams) bindParamStatusesAttributesStatusID(formats strfmt.Registry) []string { + statusesAttributesStatusIDIR := o.StatusesAttributesStatusID + + var statusesAttributesStatusIDIC []string + for _, statusesAttributesStatusIDIIR := range statusesAttributesStatusIDIR { // explode []string + + statusesAttributesStatusIDIIV := statusesAttributesStatusIDIIR // string as string + statusesAttributesStatusIDIC = append(statusesAttributesStatusIDIC, statusesAttributesStatusIDIIV) + } + + // items.CollectionFormat: "multi" + statusesAttributesStatusIDIS := swag.JoinByFormat(statusesAttributesStatusIDIC, "multi") + + return statusesAttributesStatusIDIS +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_post_parameters.go.orig b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_post_parameters.go.orig new file mode 100644 index 0000000..990b351 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_post_parameters.go.orig @@ -0,0 +1,421 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterV2PostParams creates a new FilterV2PostParams 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 NewFilterV2PostParams() *FilterV2PostParams { + return &FilterV2PostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterV2PostParamsWithTimeout creates a new FilterV2PostParams object +// with the ability to set a timeout on a request. +func NewFilterV2PostParamsWithTimeout(timeout time.Duration) *FilterV2PostParams { + return &FilterV2PostParams{ + timeout: timeout, + } +} + +// NewFilterV2PostParamsWithContext creates a new FilterV2PostParams object +// with the ability to set a context for a request. +func NewFilterV2PostParamsWithContext(ctx context.Context) *FilterV2PostParams { + return &FilterV2PostParams{ + Context: ctx, + } +} + +// NewFilterV2PostParamsWithHTTPClient creates a new FilterV2PostParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterV2PostParamsWithHTTPClient(client *http.Client) *FilterV2PostParams { + return &FilterV2PostParams{ + HTTPClient: client, + } +} + +/* +FilterV2PostParams contains all the parameters to send to the API endpoint + + for the filter v2 post operation. + + Typically these are written to a http.Request. +*/ +type FilterV2PostParams struct { + + /* Context. + + The contexts in which the filter should be applied. + + Sample: home, public + */ + Context []string + + /* ExpiresIn. + + Number of seconds from now that the filter should expire. If omitted, filter never expires. + + Sample: 86400 + */ + ExpiresIn *float64 + + /* FilterAction. + + The action to be taken when a status matches this filter. + + Sample: warn + + Default: "warn" + */ + FilterAction *string + + /* KeywordsAttributesKeyword. + + Keywords to be added (if not using id param) or updated (if using id param). + */ + KeywordsAttributesKeyword []string + + /* KeywordsAttributesWholeWord. + + Should each keyword consider word boundaries? + */ + KeywordsAttributesWholeWord []bool + + /* StatusesAttributesStatusID. + + Statuses to be added to the filter. + */ + StatusesAttributesStatusID []string + + /* Title. + + The name of the filter. + + Sample: illuminati nonsense + */ + Title string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter v2 post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2PostParams) WithDefaults() *FilterV2PostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter v2 post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2PostParams) SetDefaults() { + var ( + filterActionDefault = string("warn") + ) + + val := FilterV2PostParams{ + FilterAction: &filterActionDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the filter v2 post params +func (o *FilterV2PostParams) WithTimeout(timeout time.Duration) *FilterV2PostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter v2 post params +func (o *FilterV2PostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter v2 post params +func (o *FilterV2PostParams) WithContext(ctx context.Context) *FilterV2PostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter v2 post params +func (o *FilterV2PostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter v2 post params +func (o *FilterV2PostParams) WithHTTPClient(client *http.Client) *FilterV2PostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter v2 post params +func (o *FilterV2PostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithContext adds the context to the filter v2 post params +func (o *FilterV2PostParams) WithContext(context []string) *FilterV2PostParams { + o.SetContext(context) + return o +} + +// SetContext adds the context to the filter v2 post params +func (o *FilterV2PostParams) SetContext(context []string) { + o.Context = context +} + +// WithExpiresIn adds the expiresIn to the filter v2 post params +func (o *FilterV2PostParams) WithExpiresIn(expiresIn *float64) *FilterV2PostParams { + o.SetExpiresIn(expiresIn) + return o +} + +// SetExpiresIn adds the expiresIn to the filter v2 post params +func (o *FilterV2PostParams) SetExpiresIn(expiresIn *float64) { + o.ExpiresIn = expiresIn +} + +// WithFilterAction adds the filterAction to the filter v2 post params +func (o *FilterV2PostParams) WithFilterAction(filterAction *string) *FilterV2PostParams { + o.SetFilterAction(filterAction) + return o +} + +// SetFilterAction adds the filterAction to the filter v2 post params +func (o *FilterV2PostParams) SetFilterAction(filterAction *string) { + o.FilterAction = filterAction +} + +// WithKeywordsAttributesKeyword adds the keywordsAttributesKeyword to the filter v2 post params +func (o *FilterV2PostParams) WithKeywordsAttributesKeyword(keywordsAttributesKeyword []string) *FilterV2PostParams { + o.SetKeywordsAttributesKeyword(keywordsAttributesKeyword) + return o +} + +// SetKeywordsAttributesKeyword adds the keywordsAttributesKeyword to the filter v2 post params +func (o *FilterV2PostParams) SetKeywordsAttributesKeyword(keywordsAttributesKeyword []string) { + o.KeywordsAttributesKeyword = keywordsAttributesKeyword +} + +// WithKeywordsAttributesWholeWord adds the keywordsAttributesWholeWord to the filter v2 post params +func (o *FilterV2PostParams) WithKeywordsAttributesWholeWord(keywordsAttributesWholeWord []bool) *FilterV2PostParams { + o.SetKeywordsAttributesWholeWord(keywordsAttributesWholeWord) + return o +} + +// SetKeywordsAttributesWholeWord adds the keywordsAttributesWholeWord to the filter v2 post params +func (o *FilterV2PostParams) SetKeywordsAttributesWholeWord(keywordsAttributesWholeWord []bool) { + o.KeywordsAttributesWholeWord = keywordsAttributesWholeWord +} + +// WithStatusesAttributesStatusID adds the statusesAttributesStatusID to the filter v2 post params +func (o *FilterV2PostParams) WithStatusesAttributesStatusID(statusesAttributesStatusID []string) *FilterV2PostParams { + o.SetStatusesAttributesStatusID(statusesAttributesStatusID) + return o +} + +// SetStatusesAttributesStatusID adds the statusesAttributesStatusId to the filter v2 post params +func (o *FilterV2PostParams) SetStatusesAttributesStatusID(statusesAttributesStatusID []string) { + o.StatusesAttributesStatusID = statusesAttributesStatusID +} + +// WithTitle adds the title to the filter v2 post params +func (o *FilterV2PostParams) WithTitle(title string) *FilterV2PostParams { + o.SetTitle(title) + return o +} + +// SetTitle adds the title to the filter v2 post params +func (o *FilterV2PostParams) SetTitle(title string) { + o.Title = title +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterV2PostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Context != nil { + + // binding items for context[] + joinedContext := o.bindParamContext(reg) + + // form array param context[] + if err := r.SetFormParam("context[]", joinedContext...); err != nil { + return err + } + } + + if o.ExpiresIn != nil { + + // form param expires_in + var frExpiresIn float64 + if o.ExpiresIn != nil { + frExpiresIn = *o.ExpiresIn + } + fExpiresIn := swag.FormatFloat64(frExpiresIn) + if fExpiresIn != "" { + if err := r.SetFormParam("expires_in", fExpiresIn); err != nil { + return err + } + } + } + + if o.FilterAction != nil { + + // form param filter_action + var frFilterAction string + if o.FilterAction != nil { + frFilterAction = *o.FilterAction + } + fFilterAction := frFilterAction + if fFilterAction != "" { + if err := r.SetFormParam("filter_action", fFilterAction); err != nil { + return err + } + } + } + + if o.KeywordsAttributesKeyword != nil { + + // binding items for keywords_attributes[][keyword] + joinedKeywordsAttributesKeyword := o.bindParamKeywordsAttributesKeyword(reg) + + // form array param keywords_attributes[][keyword] + if err := r.SetFormParam("keywords_attributes[][keyword]", joinedKeywordsAttributesKeyword...); err != nil { + return err + } + } + + if o.KeywordsAttributesWholeWord != nil { + + // binding items for keywords_attributes[][whole_word] + joinedKeywordsAttributesWholeWord := o.bindParamKeywordsAttributesWholeWord(reg) + + // form array param keywords_attributes[][whole_word] + if err := r.SetFormParam("keywords_attributes[][whole_word]", joinedKeywordsAttributesWholeWord...); err != nil { + return err + } + } + + if o.StatusesAttributesStatusID != nil { + + // binding items for statuses_attributes[][status_id] + joinedStatusesAttributesStatusID := o.bindParamStatusesAttributesStatusID(reg) + + // form array param statuses_attributes[][status_id] + if err := r.SetFormParam("statuses_attributes[][status_id]", joinedStatusesAttributesStatusID...); err != nil { + return err + } + } + + // form param title + frTitle := o.Title + fTitle := frTitle + if fTitle != "" { + if err := r.SetFormParam("title", fTitle); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamFilterV2Post binds the parameter context[] +func (o *FilterV2PostParams) bindParamContext(formats strfmt.Registry) []string { + contextIR := o.Context + + var contextIC []string + for _, contextIIR := range contextIR { // explode []string + + contextIIV := contextIIR // string as string + contextIC = append(contextIC, contextIIV) + } + + // items.CollectionFormat: "multi" + contextIS := swag.JoinByFormat(contextIC, "multi") + + return contextIS +} + +// bindParamFilterV2Post binds the parameter keywords_attributes[][keyword] +func (o *FilterV2PostParams) bindParamKeywordsAttributesKeyword(formats strfmt.Registry) []string { + keywordsAttributesKeywordIR := o.KeywordsAttributesKeyword + + var keywordsAttributesKeywordIC []string + for _, keywordsAttributesKeywordIIR := range keywordsAttributesKeywordIR { // explode []string + + keywordsAttributesKeywordIIV := keywordsAttributesKeywordIIR // string as string + keywordsAttributesKeywordIC = append(keywordsAttributesKeywordIC, keywordsAttributesKeywordIIV) + } + + // items.CollectionFormat: "multi" + keywordsAttributesKeywordIS := swag.JoinByFormat(keywordsAttributesKeywordIC, "multi") + + return keywordsAttributesKeywordIS +} + +// bindParamFilterV2Post binds the parameter keywords_attributes[][whole_word] +func (o *FilterV2PostParams) bindParamKeywordsAttributesWholeWord(formats strfmt.Registry) []string { + keywordsAttributesWholeWordIR := o.KeywordsAttributesWholeWord + + var keywordsAttributesWholeWordIC []string + for _, keywordsAttributesWholeWordIIR := range keywordsAttributesWholeWordIR { // explode []bool + + keywordsAttributesWholeWordIIV := swag.FormatBool(keywordsAttributesWholeWordIIR) // bool as string + keywordsAttributesWholeWordIC = append(keywordsAttributesWholeWordIC, keywordsAttributesWholeWordIIV) + } + + // items.CollectionFormat: "multi" + keywordsAttributesWholeWordIS := swag.JoinByFormat(keywordsAttributesWholeWordIC, "multi") + + return keywordsAttributesWholeWordIS +} + +// bindParamFilterV2Post binds the parameter statuses_attributes[][status_id] +func (o *FilterV2PostParams) bindParamStatusesAttributesStatusID(formats strfmt.Registry) []string { + statusesAttributesStatusIDIR := o.StatusesAttributesStatusID + + var statusesAttributesStatusIDIC []string + for _, statusesAttributesStatusIDIIR := range statusesAttributesStatusIDIR { // explode []string + + statusesAttributesStatusIDIIV := statusesAttributesStatusIDIIR // string as string + statusesAttributesStatusIDIC = append(statusesAttributesStatusIDIC, statusesAttributesStatusIDIIV) + } + + // items.CollectionFormat: "multi" + statusesAttributesStatusIDIS := swag.JoinByFormat(statusesAttributesStatusIDIC, "multi") + + return statusesAttributesStatusIDIS +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_post_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_post_responses.go new file mode 100644 index 0000000..b004e25 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_post_responses.go @@ -0,0 +1,602 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterV2PostReader is a Reader for the FilterV2Post structure. +type FilterV2PostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterV2PostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterV2PostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterV2PostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterV2PostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewFilterV2PostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterV2PostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterV2PostNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewFilterV2PostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewFilterV2PostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterV2PostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v2/filters] filterV2Post", response, response.Code()) + } +} + +// NewFilterV2PostOK creates a FilterV2PostOK with default headers values +func NewFilterV2PostOK() *FilterV2PostOK { + return &FilterV2PostOK{} +} + +/* +FilterV2PostOK describes a response with status code 200, with default header values. + +New filter. +*/ +type FilterV2PostOK struct { + Payload *models.FilterV2 +} + +// IsSuccess returns true when this filter v2 post o k response has a 2xx status code +func (o *FilterV2PostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter v2 post o k response has a 3xx status code +func (o *FilterV2PostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 post o k response has a 4xx status code +func (o *FilterV2PostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v2 post o k response has a 5xx status code +func (o *FilterV2PostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 post o k response a status code equal to that given +func (o *FilterV2PostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter v2 post o k response +func (o *FilterV2PostOK) Code() int { + return 200 +} + +func (o *FilterV2PostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostOK %s", 200, payload) +} + +func (o *FilterV2PostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostOK %s", 200, payload) +} + +func (o *FilterV2PostOK) GetPayload() *models.FilterV2 { + return o.Payload +} + +func (o *FilterV2PostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterV2) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterV2PostBadRequest creates a FilterV2PostBadRequest with default headers values +func NewFilterV2PostBadRequest() *FilterV2PostBadRequest { + return &FilterV2PostBadRequest{} +} + +/* +FilterV2PostBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterV2PostBadRequest struct { +} + +// IsSuccess returns true when this filter v2 post bad request response has a 2xx status code +func (o *FilterV2PostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 post bad request response has a 3xx status code +func (o *FilterV2PostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 post bad request response has a 4xx status code +func (o *FilterV2PostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 post bad request response has a 5xx status code +func (o *FilterV2PostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 post bad request response a status code equal to that given +func (o *FilterV2PostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter v2 post bad request response +func (o *FilterV2PostBadRequest) Code() int { + return 400 +} + +func (o *FilterV2PostBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostBadRequest", 400) +} + +func (o *FilterV2PostBadRequest) String() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostBadRequest", 400) +} + +func (o *FilterV2PostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PostUnauthorized creates a FilterV2PostUnauthorized with default headers values +func NewFilterV2PostUnauthorized() *FilterV2PostUnauthorized { + return &FilterV2PostUnauthorized{} +} + +/* +FilterV2PostUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterV2PostUnauthorized struct { +} + +// IsSuccess returns true when this filter v2 post unauthorized response has a 2xx status code +func (o *FilterV2PostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 post unauthorized response has a 3xx status code +func (o *FilterV2PostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 post unauthorized response has a 4xx status code +func (o *FilterV2PostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 post unauthorized response has a 5xx status code +func (o *FilterV2PostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 post unauthorized response a status code equal to that given +func (o *FilterV2PostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter v2 post unauthorized response +func (o *FilterV2PostUnauthorized) Code() int { + return 401 +} + +func (o *FilterV2PostUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostUnauthorized", 401) +} + +func (o *FilterV2PostUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostUnauthorized", 401) +} + +func (o *FilterV2PostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PostForbidden creates a FilterV2PostForbidden with default headers values +func NewFilterV2PostForbidden() *FilterV2PostForbidden { + return &FilterV2PostForbidden{} +} + +/* +FilterV2PostForbidden describes a response with status code 403, with default header values. + +forbidden to moved accounts +*/ +type FilterV2PostForbidden struct { +} + +// IsSuccess returns true when this filter v2 post forbidden response has a 2xx status code +func (o *FilterV2PostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 post forbidden response has a 3xx status code +func (o *FilterV2PostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 post forbidden response has a 4xx status code +func (o *FilterV2PostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 post forbidden response has a 5xx status code +func (o *FilterV2PostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 post forbidden response a status code equal to that given +func (o *FilterV2PostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the filter v2 post forbidden response +func (o *FilterV2PostForbidden) Code() int { + return 403 +} + +func (o *FilterV2PostForbidden) Error() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostForbidden", 403) +} + +func (o *FilterV2PostForbidden) String() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostForbidden", 403) +} + +func (o *FilterV2PostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PostNotFound creates a FilterV2PostNotFound with default headers values +func NewFilterV2PostNotFound() *FilterV2PostNotFound { + return &FilterV2PostNotFound{} +} + +/* +FilterV2PostNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterV2PostNotFound struct { +} + +// IsSuccess returns true when this filter v2 post not found response has a 2xx status code +func (o *FilterV2PostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 post not found response has a 3xx status code +func (o *FilterV2PostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 post not found response has a 4xx status code +func (o *FilterV2PostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 post not found response has a 5xx status code +func (o *FilterV2PostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 post not found response a status code equal to that given +func (o *FilterV2PostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter v2 post not found response +func (o *FilterV2PostNotFound) Code() int { + return 404 +} + +func (o *FilterV2PostNotFound) Error() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostNotFound", 404) +} + +func (o *FilterV2PostNotFound) String() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostNotFound", 404) +} + +func (o *FilterV2PostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PostNotAcceptable creates a FilterV2PostNotAcceptable with default headers values +func NewFilterV2PostNotAcceptable() *FilterV2PostNotAcceptable { + return &FilterV2PostNotAcceptable{} +} + +/* +FilterV2PostNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterV2PostNotAcceptable struct { +} + +// IsSuccess returns true when this filter v2 post not acceptable response has a 2xx status code +func (o *FilterV2PostNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 post not acceptable response has a 3xx status code +func (o *FilterV2PostNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 post not acceptable response has a 4xx status code +func (o *FilterV2PostNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 post not acceptable response has a 5xx status code +func (o *FilterV2PostNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 post not acceptable response a status code equal to that given +func (o *FilterV2PostNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter v2 post not acceptable response +func (o *FilterV2PostNotAcceptable) Code() int { + return 406 +} + +func (o *FilterV2PostNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostNotAcceptable", 406) +} + +func (o *FilterV2PostNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostNotAcceptable", 406) +} + +func (o *FilterV2PostNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PostConflict creates a FilterV2PostConflict with default headers values +func NewFilterV2PostConflict() *FilterV2PostConflict { + return &FilterV2PostConflict{} +} + +/* +FilterV2PostConflict describes a response with status code 409, with default header values. + +conflict (duplicate title, keyword, or status) +*/ +type FilterV2PostConflict struct { +} + +// IsSuccess returns true when this filter v2 post conflict response has a 2xx status code +func (o *FilterV2PostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 post conflict response has a 3xx status code +func (o *FilterV2PostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 post conflict response has a 4xx status code +func (o *FilterV2PostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 post conflict response has a 5xx status code +func (o *FilterV2PostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 post conflict response a status code equal to that given +func (o *FilterV2PostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the filter v2 post conflict response +func (o *FilterV2PostConflict) Code() int { + return 409 +} + +func (o *FilterV2PostConflict) Error() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostConflict", 409) +} + +func (o *FilterV2PostConflict) String() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostConflict", 409) +} + +func (o *FilterV2PostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PostUnprocessableEntity creates a FilterV2PostUnprocessableEntity with default headers values +func NewFilterV2PostUnprocessableEntity() *FilterV2PostUnprocessableEntity { + return &FilterV2PostUnprocessableEntity{} +} + +/* +FilterV2PostUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable content +*/ +type FilterV2PostUnprocessableEntity struct { +} + +// IsSuccess returns true when this filter v2 post unprocessable entity response has a 2xx status code +func (o *FilterV2PostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 post unprocessable entity response has a 3xx status code +func (o *FilterV2PostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 post unprocessable entity response has a 4xx status code +func (o *FilterV2PostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 post unprocessable entity response has a 5xx status code +func (o *FilterV2PostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 post unprocessable entity response a status code equal to that given +func (o *FilterV2PostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the filter v2 post unprocessable entity response +func (o *FilterV2PostUnprocessableEntity) Code() int { + return 422 +} + +func (o *FilterV2PostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostUnprocessableEntity", 422) +} + +func (o *FilterV2PostUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostUnprocessableEntity", 422) +} + +func (o *FilterV2PostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PostInternalServerError creates a FilterV2PostInternalServerError with default headers values +func NewFilterV2PostInternalServerError() *FilterV2PostInternalServerError { + return &FilterV2PostInternalServerError{} +} + +/* +FilterV2PostInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterV2PostInternalServerError struct { +} + +// IsSuccess returns true when this filter v2 post internal server error response has a 2xx status code +func (o *FilterV2PostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 post internal server error response has a 3xx status code +func (o *FilterV2PostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 post internal server error response has a 4xx status code +func (o *FilterV2PostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v2 post internal server error response has a 5xx status code +func (o *FilterV2PostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter v2 post internal server error response a status code equal to that given +func (o *FilterV2PostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter v2 post internal server error response +func (o *FilterV2PostInternalServerError) Code() int { + return 500 +} + +func (o *FilterV2PostInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostInternalServerError", 500) +} + +func (o *FilterV2PostInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostInternalServerError", 500) +} + +func (o *FilterV2PostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_put_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_put_parameters.go new file mode 100644 index 0000000..46d60ec --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_put_parameters.go @@ -0,0 +1,396 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterV2PutParams creates a new FilterV2PutParams 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 NewFilterV2PutParams() *FilterV2PutParams { + return &FilterV2PutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterV2PutParamsWithTimeout creates a new FilterV2PutParams object +// with the ability to set a timeout on a request. +func NewFilterV2PutParamsWithTimeout(timeout time.Duration) *FilterV2PutParams { + return &FilterV2PutParams{ + timeout: timeout, + } +} + +// NewFilterV2PutParamsWithContext creates a new FilterV2PutParams object +// with the ability to set a context for a request. +func NewFilterV2PutParamsWithContext(ctx context.Context) *FilterV2PutParams { + return &FilterV2PutParams{ + Context: ctx, + } +} + +// NewFilterV2PutParamsWithHTTPClient creates a new FilterV2PutParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterV2PutParamsWithHTTPClient(client *http.Client) *FilterV2PutParams { + return &FilterV2PutParams{ + HTTPClient: client, + } +} + +/* +FilterV2PutParams contains all the parameters to send to the API endpoint + + for the filter v2 put operation. + + Typically these are written to a http.Request. +*/ +type FilterV2PutParams struct { + + /* FilterContext. + + The contexts in which the filter should be applied. + + Sample: home, public + */ + FilterContext []string + + /* ExpiresIn. + + Number of seconds from now that the filter should expire. + + Sample: 86400 + */ + ExpiresIn *float64 + + /* ID. + + ID of the filter. + */ + ID string + + /* KeywordsAttributesKeyword. + + Keywords to be added to the created filter. + */ + KeywordsAttributesKeyword []string + + /* KeywordsAttributesWholeWord. + + Should each keyword consider word boundaries? + */ + KeywordsAttributesWholeWord []bool + + /* StatusesAttributesStatusID. + + Statuses to be added to the newly created filter. + */ + StatusesAttributesStatusID []string + + /* Title. + + The name of the filter. + + Sample: illuminati nonsense + */ + Title string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter v2 put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2PutParams) WithDefaults() *FilterV2PutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter v2 put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2PutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter v2 put params +func (o *FilterV2PutParams) WithTimeout(timeout time.Duration) *FilterV2PutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter v2 put params +func (o *FilterV2PutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter v2 put params +func (o *FilterV2PutParams) WithContext(ctx context.Context) *FilterV2PutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter v2 put params +func (o *FilterV2PutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter v2 put params +func (o *FilterV2PutParams) WithHTTPClient(client *http.Client) *FilterV2PutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter v2 put params +func (o *FilterV2PutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithFilterContext adds the filter context to the filter v2 put params +func (o *FilterV2PutParams) WithFilterContext(context []string) *FilterV2PutParams { + o.SetFilterContext(context) + return o +} + +// SetFilterContext adds the filter context to the filter v2 put params +func (o *FilterV2PutParams) SetFilterContext(context []string) { + o.FilterContext = context +} + +// WithExpiresIn adds the expiresIn to the filter v2 put params +func (o *FilterV2PutParams) WithExpiresIn(expiresIn *float64) *FilterV2PutParams { + o.SetExpiresIn(expiresIn) + return o +} + +// SetExpiresIn adds the expiresIn to the filter v2 put params +func (o *FilterV2PutParams) SetExpiresIn(expiresIn *float64) { + o.ExpiresIn = expiresIn +} + +// WithID adds the id to the filter v2 put params +func (o *FilterV2PutParams) WithID(id string) *FilterV2PutParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter v2 put params +func (o *FilterV2PutParams) SetID(id string) { + o.ID = id +} + +// WithKeywordsAttributesKeyword adds the keywordsAttributesKeyword to the filter v2 put params +func (o *FilterV2PutParams) WithKeywordsAttributesKeyword(keywordsAttributesKeyword []string) *FilterV2PutParams { + o.SetKeywordsAttributesKeyword(keywordsAttributesKeyword) + return o +} + +// SetKeywordsAttributesKeyword adds the keywordsAttributesKeyword to the filter v2 put params +func (o *FilterV2PutParams) SetKeywordsAttributesKeyword(keywordsAttributesKeyword []string) { + o.KeywordsAttributesKeyword = keywordsAttributesKeyword +} + +// WithKeywordsAttributesWholeWord adds the keywordsAttributesWholeWord to the filter v2 put params +func (o *FilterV2PutParams) WithKeywordsAttributesWholeWord(keywordsAttributesWholeWord []bool) *FilterV2PutParams { + o.SetKeywordsAttributesWholeWord(keywordsAttributesWholeWord) + return o +} + +// SetKeywordsAttributesWholeWord adds the keywordsAttributesWholeWord to the filter v2 put params +func (o *FilterV2PutParams) SetKeywordsAttributesWholeWord(keywordsAttributesWholeWord []bool) { + o.KeywordsAttributesWholeWord = keywordsAttributesWholeWord +} + +// WithStatusesAttributesStatusID adds the statusesAttributesStatusID to the filter v2 put params +func (o *FilterV2PutParams) WithStatusesAttributesStatusID(statusesAttributesStatusID []string) *FilterV2PutParams { + o.SetStatusesAttributesStatusID(statusesAttributesStatusID) + return o +} + +// SetStatusesAttributesStatusID adds the statusesAttributesStatusId to the filter v2 put params +func (o *FilterV2PutParams) SetStatusesAttributesStatusID(statusesAttributesStatusID []string) { + o.StatusesAttributesStatusID = statusesAttributesStatusID +} + +// WithTitle adds the title to the filter v2 put params +func (o *FilterV2PutParams) WithTitle(title string) *FilterV2PutParams { + o.SetTitle(title) + return o +} + +// SetTitle adds the title to the filter v2 put params +func (o *FilterV2PutParams) SetTitle(title string) { + o.Title = title +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterV2PutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Context != nil { + + // binding items for context[] + joinedContext := o.bindParamContext(reg) + + // form array param context[] + if err := r.SetFormParam("context[]", joinedContext...); err != nil { + return err + } + } + + if o.ExpiresIn != nil { + + // form param expires_in + var frExpiresIn float64 + if o.ExpiresIn != nil { + frExpiresIn = *o.ExpiresIn + } + fExpiresIn := swag.FormatFloat64(frExpiresIn) + if fExpiresIn != "" { + if err := r.SetFormParam("expires_in", fExpiresIn); err != nil { + return err + } + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.KeywordsAttributesKeyword != nil { + + // binding items for keywords_attributes[][keyword] + joinedKeywordsAttributesKeyword := o.bindParamKeywordsAttributesKeyword(reg) + + // form array param keywords_attributes[][keyword] + if err := r.SetFormParam("keywords_attributes[][keyword]", joinedKeywordsAttributesKeyword...); err != nil { + return err + } + } + + if o.KeywordsAttributesWholeWord != nil { + + // binding items for keywords_attributes[][whole_word] + joinedKeywordsAttributesWholeWord := o.bindParamKeywordsAttributesWholeWord(reg) + + // form array param keywords_attributes[][whole_word] + if err := r.SetFormParam("keywords_attributes[][whole_word]", joinedKeywordsAttributesWholeWord...); err != nil { + return err + } + } + + if o.StatusesAttributesStatusID != nil { + + // binding items for statuses_attributes[][status_id] + joinedStatusesAttributesStatusID := o.bindParamStatusesAttributesStatusID(reg) + + // form array param statuses_attributes[][status_id] + if err := r.SetFormParam("statuses_attributes[][status_id]", joinedStatusesAttributesStatusID...); err != nil { + return err + } + } + + // form param title + frTitle := o.Title + fTitle := frTitle + if fTitle != "" { + if err := r.SetFormParam("title", fTitle); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamFilterV2Put binds the parameter context[] +func (o *FilterV2PutParams) bindParamContext(formats strfmt.Registry) []string { + contextIR := o.FilterContext + + var contextIC []string + for _, contextIIR := range contextIR { // explode []string + + contextIIV := contextIIR // string as string + contextIC = append(contextIC, contextIIV) + } + + // items.CollectionFormat: "multi" + contextIS := swag.JoinByFormat(contextIC, "multi") + + return contextIS +} + +// bindParamFilterV2Put binds the parameter keywords_attributes[][keyword] +func (o *FilterV2PutParams) bindParamKeywordsAttributesKeyword(formats strfmt.Registry) []string { + keywordsAttributesKeywordIR := o.KeywordsAttributesKeyword + + var keywordsAttributesKeywordIC []string + for _, keywordsAttributesKeywordIIR := range keywordsAttributesKeywordIR { // explode []string + + keywordsAttributesKeywordIIV := keywordsAttributesKeywordIIR // string as string + keywordsAttributesKeywordIC = append(keywordsAttributesKeywordIC, keywordsAttributesKeywordIIV) + } + + // items.CollectionFormat: "multi" + keywordsAttributesKeywordIS := swag.JoinByFormat(keywordsAttributesKeywordIC, "multi") + + return keywordsAttributesKeywordIS +} + +// bindParamFilterV2Put binds the parameter keywords_attributes[][whole_word] +func (o *FilterV2PutParams) bindParamKeywordsAttributesWholeWord(formats strfmt.Registry) []string { + keywordsAttributesWholeWordIR := o.KeywordsAttributesWholeWord + + var keywordsAttributesWholeWordIC []string + for _, keywordsAttributesWholeWordIIR := range keywordsAttributesWholeWordIR { // explode []bool + + keywordsAttributesWholeWordIIV := swag.FormatBool(keywordsAttributesWholeWordIIR) // bool as string + keywordsAttributesWholeWordIC = append(keywordsAttributesWholeWordIC, keywordsAttributesWholeWordIIV) + } + + // items.CollectionFormat: "multi" + keywordsAttributesWholeWordIS := swag.JoinByFormat(keywordsAttributesWholeWordIC, "multi") + + return keywordsAttributesWholeWordIS +} + +// bindParamFilterV2Put binds the parameter statuses_attributes[][status_id] +func (o *FilterV2PutParams) bindParamStatusesAttributesStatusID(formats strfmt.Registry) []string { + statusesAttributesStatusIDIR := o.StatusesAttributesStatusID + + var statusesAttributesStatusIDIC []string + for _, statusesAttributesStatusIDIIR := range statusesAttributesStatusIDIR { // explode []string + + statusesAttributesStatusIDIIV := statusesAttributesStatusIDIIR // string as string + statusesAttributesStatusIDIC = append(statusesAttributesStatusIDIC, statusesAttributesStatusIDIIV) + } + + // items.CollectionFormat: "multi" + statusesAttributesStatusIDIS := swag.JoinByFormat(statusesAttributesStatusIDIC, "multi") + + return statusesAttributesStatusIDIS +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_put_parameters.go.orig b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_put_parameters.go.orig new file mode 100644 index 0000000..a8b726a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_put_parameters.go.orig @@ -0,0 +1,396 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterV2PutParams creates a new FilterV2PutParams 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 NewFilterV2PutParams() *FilterV2PutParams { + return &FilterV2PutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterV2PutParamsWithTimeout creates a new FilterV2PutParams object +// with the ability to set a timeout on a request. +func NewFilterV2PutParamsWithTimeout(timeout time.Duration) *FilterV2PutParams { + return &FilterV2PutParams{ + timeout: timeout, + } +} + +// NewFilterV2PutParamsWithContext creates a new FilterV2PutParams object +// with the ability to set a context for a request. +func NewFilterV2PutParamsWithContext(ctx context.Context) *FilterV2PutParams { + return &FilterV2PutParams{ + Context: ctx, + } +} + +// NewFilterV2PutParamsWithHTTPClient creates a new FilterV2PutParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterV2PutParamsWithHTTPClient(client *http.Client) *FilterV2PutParams { + return &FilterV2PutParams{ + HTTPClient: client, + } +} + +/* +FilterV2PutParams contains all the parameters to send to the API endpoint + + for the filter v2 put operation. + + Typically these are written to a http.Request. +*/ +type FilterV2PutParams struct { + + /* Context. + + The contexts in which the filter should be applied. + + Sample: home, public + */ + Context []string + + /* ExpiresIn. + + Number of seconds from now that the filter should expire. + + Sample: 86400 + */ + ExpiresIn *float64 + + /* ID. + + ID of the filter. + */ + ID string + + /* KeywordsAttributesKeyword. + + Keywords to be added to the created filter. + */ + KeywordsAttributesKeyword []string + + /* KeywordsAttributesWholeWord. + + Should each keyword consider word boundaries? + */ + KeywordsAttributesWholeWord []bool + + /* StatusesAttributesStatusID. + + Statuses to be added to the newly created filter. + */ + StatusesAttributesStatusID []string + + /* Title. + + The name of the filter. + + Sample: illuminati nonsense + */ + Title string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter v2 put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2PutParams) WithDefaults() *FilterV2PutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter v2 put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2PutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter v2 put params +func (o *FilterV2PutParams) WithTimeout(timeout time.Duration) *FilterV2PutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter v2 put params +func (o *FilterV2PutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter v2 put params +func (o *FilterV2PutParams) WithContext(ctx context.Context) *FilterV2PutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter v2 put params +func (o *FilterV2PutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter v2 put params +func (o *FilterV2PutParams) WithHTTPClient(client *http.Client) *FilterV2PutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter v2 put params +func (o *FilterV2PutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithContext adds the context to the filter v2 put params +func (o *FilterV2PutParams) WithContext(context []string) *FilterV2PutParams { + o.SetContext(context) + return o +} + +// SetContext adds the context to the filter v2 put params +func (o *FilterV2PutParams) SetContext(context []string) { + o.Context = context +} + +// WithExpiresIn adds the expiresIn to the filter v2 put params +func (o *FilterV2PutParams) WithExpiresIn(expiresIn *float64) *FilterV2PutParams { + o.SetExpiresIn(expiresIn) + return o +} + +// SetExpiresIn adds the expiresIn to the filter v2 put params +func (o *FilterV2PutParams) SetExpiresIn(expiresIn *float64) { + o.ExpiresIn = expiresIn +} + +// WithID adds the id to the filter v2 put params +func (o *FilterV2PutParams) WithID(id string) *FilterV2PutParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter v2 put params +func (o *FilterV2PutParams) SetID(id string) { + o.ID = id +} + +// WithKeywordsAttributesKeyword adds the keywordsAttributesKeyword to the filter v2 put params +func (o *FilterV2PutParams) WithKeywordsAttributesKeyword(keywordsAttributesKeyword []string) *FilterV2PutParams { + o.SetKeywordsAttributesKeyword(keywordsAttributesKeyword) + return o +} + +// SetKeywordsAttributesKeyword adds the keywordsAttributesKeyword to the filter v2 put params +func (o *FilterV2PutParams) SetKeywordsAttributesKeyword(keywordsAttributesKeyword []string) { + o.KeywordsAttributesKeyword = keywordsAttributesKeyword +} + +// WithKeywordsAttributesWholeWord adds the keywordsAttributesWholeWord to the filter v2 put params +func (o *FilterV2PutParams) WithKeywordsAttributesWholeWord(keywordsAttributesWholeWord []bool) *FilterV2PutParams { + o.SetKeywordsAttributesWholeWord(keywordsAttributesWholeWord) + return o +} + +// SetKeywordsAttributesWholeWord adds the keywordsAttributesWholeWord to the filter v2 put params +func (o *FilterV2PutParams) SetKeywordsAttributesWholeWord(keywordsAttributesWholeWord []bool) { + o.KeywordsAttributesWholeWord = keywordsAttributesWholeWord +} + +// WithStatusesAttributesStatusID adds the statusesAttributesStatusID to the filter v2 put params +func (o *FilterV2PutParams) WithStatusesAttributesStatusID(statusesAttributesStatusID []string) *FilterV2PutParams { + o.SetStatusesAttributesStatusID(statusesAttributesStatusID) + return o +} + +// SetStatusesAttributesStatusID adds the statusesAttributesStatusId to the filter v2 put params +func (o *FilterV2PutParams) SetStatusesAttributesStatusID(statusesAttributesStatusID []string) { + o.StatusesAttributesStatusID = statusesAttributesStatusID +} + +// WithTitle adds the title to the filter v2 put params +func (o *FilterV2PutParams) WithTitle(title string) *FilterV2PutParams { + o.SetTitle(title) + return o +} + +// SetTitle adds the title to the filter v2 put params +func (o *FilterV2PutParams) SetTitle(title string) { + o.Title = title +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterV2PutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Context != nil { + + // binding items for context[] + joinedContext := o.bindParamContext(reg) + + // form array param context[] + if err := r.SetFormParam("context[]", joinedContext...); err != nil { + return err + } + } + + if o.ExpiresIn != nil { + + // form param expires_in + var frExpiresIn float64 + if o.ExpiresIn != nil { + frExpiresIn = *o.ExpiresIn + } + fExpiresIn := swag.FormatFloat64(frExpiresIn) + if fExpiresIn != "" { + if err := r.SetFormParam("expires_in", fExpiresIn); err != nil { + return err + } + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.KeywordsAttributesKeyword != nil { + + // binding items for keywords_attributes[][keyword] + joinedKeywordsAttributesKeyword := o.bindParamKeywordsAttributesKeyword(reg) + + // form array param keywords_attributes[][keyword] + if err := r.SetFormParam("keywords_attributes[][keyword]", joinedKeywordsAttributesKeyword...); err != nil { + return err + } + } + + if o.KeywordsAttributesWholeWord != nil { + + // binding items for keywords_attributes[][whole_word] + joinedKeywordsAttributesWholeWord := o.bindParamKeywordsAttributesWholeWord(reg) + + // form array param keywords_attributes[][whole_word] + if err := r.SetFormParam("keywords_attributes[][whole_word]", joinedKeywordsAttributesWholeWord...); err != nil { + return err + } + } + + if o.StatusesAttributesStatusID != nil { + + // binding items for statuses_attributes[][status_id] + joinedStatusesAttributesStatusID := o.bindParamStatusesAttributesStatusID(reg) + + // form array param statuses_attributes[][status_id] + if err := r.SetFormParam("statuses_attributes[][status_id]", joinedStatusesAttributesStatusID...); err != nil { + return err + } + } + + // form param title + frTitle := o.Title + fTitle := frTitle + if fTitle != "" { + if err := r.SetFormParam("title", fTitle); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamFilterV2Put binds the parameter context[] +func (o *FilterV2PutParams) bindParamContext(formats strfmt.Registry) []string { + contextIR := o.Context + + var contextIC []string + for _, contextIIR := range contextIR { // explode []string + + contextIIV := contextIIR // string as string + contextIC = append(contextIC, contextIIV) + } + + // items.CollectionFormat: "multi" + contextIS := swag.JoinByFormat(contextIC, "multi") + + return contextIS +} + +// bindParamFilterV2Put binds the parameter keywords_attributes[][keyword] +func (o *FilterV2PutParams) bindParamKeywordsAttributesKeyword(formats strfmt.Registry) []string { + keywordsAttributesKeywordIR := o.KeywordsAttributesKeyword + + var keywordsAttributesKeywordIC []string + for _, keywordsAttributesKeywordIIR := range keywordsAttributesKeywordIR { // explode []string + + keywordsAttributesKeywordIIV := keywordsAttributesKeywordIIR // string as string + keywordsAttributesKeywordIC = append(keywordsAttributesKeywordIC, keywordsAttributesKeywordIIV) + } + + // items.CollectionFormat: "multi" + keywordsAttributesKeywordIS := swag.JoinByFormat(keywordsAttributesKeywordIC, "multi") + + return keywordsAttributesKeywordIS +} + +// bindParamFilterV2Put binds the parameter keywords_attributes[][whole_word] +func (o *FilterV2PutParams) bindParamKeywordsAttributesWholeWord(formats strfmt.Registry) []string { + keywordsAttributesWholeWordIR := o.KeywordsAttributesWholeWord + + var keywordsAttributesWholeWordIC []string + for _, keywordsAttributesWholeWordIIR := range keywordsAttributesWholeWordIR { // explode []bool + + keywordsAttributesWholeWordIIV := swag.FormatBool(keywordsAttributesWholeWordIIR) // bool as string + keywordsAttributesWholeWordIC = append(keywordsAttributesWholeWordIC, keywordsAttributesWholeWordIIV) + } + + // items.CollectionFormat: "multi" + keywordsAttributesWholeWordIS := swag.JoinByFormat(keywordsAttributesWholeWordIC, "multi") + + return keywordsAttributesWholeWordIS +} + +// bindParamFilterV2Put binds the parameter statuses_attributes[][status_id] +func (o *FilterV2PutParams) bindParamStatusesAttributesStatusID(formats strfmt.Registry) []string { + statusesAttributesStatusIDIR := o.StatusesAttributesStatusID + + var statusesAttributesStatusIDIC []string + for _, statusesAttributesStatusIDIIR := range statusesAttributesStatusIDIR { // explode []string + + statusesAttributesStatusIDIIV := statusesAttributesStatusIDIIR // string as string + statusesAttributesStatusIDIC = append(statusesAttributesStatusIDIC, statusesAttributesStatusIDIIV) + } + + // items.CollectionFormat: "multi" + statusesAttributesStatusIDIS := swag.JoinByFormat(statusesAttributesStatusIDIC, "multi") + + return statusesAttributesStatusIDIS +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_put_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_put_responses.go new file mode 100644 index 0000000..5ce8861 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filter_v2_put_responses.go @@ -0,0 +1,602 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterV2PutReader is a Reader for the FilterV2Put structure. +type FilterV2PutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterV2PutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterV2PutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterV2PutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterV2PutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewFilterV2PutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterV2PutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterV2PutNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewFilterV2PutConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewFilterV2PutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterV2PutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /api/v2/filters/{id}] filterV2Put", response, response.Code()) + } +} + +// NewFilterV2PutOK creates a FilterV2PutOK with default headers values +func NewFilterV2PutOK() *FilterV2PutOK { + return &FilterV2PutOK{} +} + +/* +FilterV2PutOK describes a response with status code 200, with default header values. + +Updated filter. +*/ +type FilterV2PutOK struct { + Payload *models.FilterV2 +} + +// IsSuccess returns true when this filter v2 put o k response has a 2xx status code +func (o *FilterV2PutOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter v2 put o k response has a 3xx status code +func (o *FilterV2PutOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 put o k response has a 4xx status code +func (o *FilterV2PutOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v2 put o k response has a 5xx status code +func (o *FilterV2PutOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 put o k response a status code equal to that given +func (o *FilterV2PutOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter v2 put o k response +func (o *FilterV2PutOK) Code() int { + return 200 +} + +func (o *FilterV2PutOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutOK %s", 200, payload) +} + +func (o *FilterV2PutOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutOK %s", 200, payload) +} + +func (o *FilterV2PutOK) GetPayload() *models.FilterV2 { + return o.Payload +} + +func (o *FilterV2PutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterV2) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterV2PutBadRequest creates a FilterV2PutBadRequest with default headers values +func NewFilterV2PutBadRequest() *FilterV2PutBadRequest { + return &FilterV2PutBadRequest{} +} + +/* +FilterV2PutBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterV2PutBadRequest struct { +} + +// IsSuccess returns true when this filter v2 put bad request response has a 2xx status code +func (o *FilterV2PutBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 put bad request response has a 3xx status code +func (o *FilterV2PutBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 put bad request response has a 4xx status code +func (o *FilterV2PutBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 put bad request response has a 5xx status code +func (o *FilterV2PutBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 put bad request response a status code equal to that given +func (o *FilterV2PutBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter v2 put bad request response +func (o *FilterV2PutBadRequest) Code() int { + return 400 +} + +func (o *FilterV2PutBadRequest) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutBadRequest", 400) +} + +func (o *FilterV2PutBadRequest) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutBadRequest", 400) +} + +func (o *FilterV2PutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PutUnauthorized creates a FilterV2PutUnauthorized with default headers values +func NewFilterV2PutUnauthorized() *FilterV2PutUnauthorized { + return &FilterV2PutUnauthorized{} +} + +/* +FilterV2PutUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterV2PutUnauthorized struct { +} + +// IsSuccess returns true when this filter v2 put unauthorized response has a 2xx status code +func (o *FilterV2PutUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 put unauthorized response has a 3xx status code +func (o *FilterV2PutUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 put unauthorized response has a 4xx status code +func (o *FilterV2PutUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 put unauthorized response has a 5xx status code +func (o *FilterV2PutUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 put unauthorized response a status code equal to that given +func (o *FilterV2PutUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter v2 put unauthorized response +func (o *FilterV2PutUnauthorized) Code() int { + return 401 +} + +func (o *FilterV2PutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutUnauthorized", 401) +} + +func (o *FilterV2PutUnauthorized) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutUnauthorized", 401) +} + +func (o *FilterV2PutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PutForbidden creates a FilterV2PutForbidden with default headers values +func NewFilterV2PutForbidden() *FilterV2PutForbidden { + return &FilterV2PutForbidden{} +} + +/* +FilterV2PutForbidden describes a response with status code 403, with default header values. + +forbidden to moved accounts +*/ +type FilterV2PutForbidden struct { +} + +// IsSuccess returns true when this filter v2 put forbidden response has a 2xx status code +func (o *FilterV2PutForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 put forbidden response has a 3xx status code +func (o *FilterV2PutForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 put forbidden response has a 4xx status code +func (o *FilterV2PutForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 put forbidden response has a 5xx status code +func (o *FilterV2PutForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 put forbidden response a status code equal to that given +func (o *FilterV2PutForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the filter v2 put forbidden response +func (o *FilterV2PutForbidden) Code() int { + return 403 +} + +func (o *FilterV2PutForbidden) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutForbidden", 403) +} + +func (o *FilterV2PutForbidden) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutForbidden", 403) +} + +func (o *FilterV2PutForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PutNotFound creates a FilterV2PutNotFound with default headers values +func NewFilterV2PutNotFound() *FilterV2PutNotFound { + return &FilterV2PutNotFound{} +} + +/* +FilterV2PutNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterV2PutNotFound struct { +} + +// IsSuccess returns true when this filter v2 put not found response has a 2xx status code +func (o *FilterV2PutNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 put not found response has a 3xx status code +func (o *FilterV2PutNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 put not found response has a 4xx status code +func (o *FilterV2PutNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 put not found response has a 5xx status code +func (o *FilterV2PutNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 put not found response a status code equal to that given +func (o *FilterV2PutNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter v2 put not found response +func (o *FilterV2PutNotFound) Code() int { + return 404 +} + +func (o *FilterV2PutNotFound) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutNotFound", 404) +} + +func (o *FilterV2PutNotFound) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutNotFound", 404) +} + +func (o *FilterV2PutNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PutNotAcceptable creates a FilterV2PutNotAcceptable with default headers values +func NewFilterV2PutNotAcceptable() *FilterV2PutNotAcceptable { + return &FilterV2PutNotAcceptable{} +} + +/* +FilterV2PutNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterV2PutNotAcceptable struct { +} + +// IsSuccess returns true when this filter v2 put not acceptable response has a 2xx status code +func (o *FilterV2PutNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 put not acceptable response has a 3xx status code +func (o *FilterV2PutNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 put not acceptable response has a 4xx status code +func (o *FilterV2PutNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 put not acceptable response has a 5xx status code +func (o *FilterV2PutNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 put not acceptable response a status code equal to that given +func (o *FilterV2PutNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter v2 put not acceptable response +func (o *FilterV2PutNotAcceptable) Code() int { + return 406 +} + +func (o *FilterV2PutNotAcceptable) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutNotAcceptable", 406) +} + +func (o *FilterV2PutNotAcceptable) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutNotAcceptable", 406) +} + +func (o *FilterV2PutNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PutConflict creates a FilterV2PutConflict with default headers values +func NewFilterV2PutConflict() *FilterV2PutConflict { + return &FilterV2PutConflict{} +} + +/* +FilterV2PutConflict describes a response with status code 409, with default header values. + +conflict (duplicate title, keyword, or status) +*/ +type FilterV2PutConflict struct { +} + +// IsSuccess returns true when this filter v2 put conflict response has a 2xx status code +func (o *FilterV2PutConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 put conflict response has a 3xx status code +func (o *FilterV2PutConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 put conflict response has a 4xx status code +func (o *FilterV2PutConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 put conflict response has a 5xx status code +func (o *FilterV2PutConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 put conflict response a status code equal to that given +func (o *FilterV2PutConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the filter v2 put conflict response +func (o *FilterV2PutConflict) Code() int { + return 409 +} + +func (o *FilterV2PutConflict) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutConflict", 409) +} + +func (o *FilterV2PutConflict) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutConflict", 409) +} + +func (o *FilterV2PutConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PutUnprocessableEntity creates a FilterV2PutUnprocessableEntity with default headers values +func NewFilterV2PutUnprocessableEntity() *FilterV2PutUnprocessableEntity { + return &FilterV2PutUnprocessableEntity{} +} + +/* +FilterV2PutUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable content +*/ +type FilterV2PutUnprocessableEntity struct { +} + +// IsSuccess returns true when this filter v2 put unprocessable entity response has a 2xx status code +func (o *FilterV2PutUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 put unprocessable entity response has a 3xx status code +func (o *FilterV2PutUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 put unprocessable entity response has a 4xx status code +func (o *FilterV2PutUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 put unprocessable entity response has a 5xx status code +func (o *FilterV2PutUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 put unprocessable entity response a status code equal to that given +func (o *FilterV2PutUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the filter v2 put unprocessable entity response +func (o *FilterV2PutUnprocessableEntity) Code() int { + return 422 +} + +func (o *FilterV2PutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutUnprocessableEntity", 422) +} + +func (o *FilterV2PutUnprocessableEntity) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutUnprocessableEntity", 422) +} + +func (o *FilterV2PutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PutInternalServerError creates a FilterV2PutInternalServerError with default headers values +func NewFilterV2PutInternalServerError() *FilterV2PutInternalServerError { + return &FilterV2PutInternalServerError{} +} + +/* +FilterV2PutInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterV2PutInternalServerError struct { +} + +// IsSuccess returns true when this filter v2 put internal server error response has a 2xx status code +func (o *FilterV2PutInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 put internal server error response has a 3xx status code +func (o *FilterV2PutInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 put internal server error response has a 4xx status code +func (o *FilterV2PutInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v2 put internal server error response has a 5xx status code +func (o *FilterV2PutInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter v2 put internal server error response a status code equal to that given +func (o *FilterV2PutInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter v2 put internal server error response +func (o *FilterV2PutInternalServerError) Code() int { + return 500 +} + +func (o *FilterV2PutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutInternalServerError", 500) +} + +func (o *FilterV2PutInternalServerError) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutInternalServerError", 500) +} + +func (o *FilterV2PutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filters_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filters_client.go new file mode 100644 index 0000000..a3db9bd --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filters_client.go @@ -0,0 +1,877 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new filters API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new filters API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new filters API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for filters API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded". +func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} +} + +// WithContentTypeApplicationXML sets the Content-Type header to "application/xml". +func WithContentTypeApplicationXML(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/xml"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + FilterKeywordDelete(params *FilterKeywordDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterKeywordDeleteOK, error) + + FilterKeywordGet(params *FilterKeywordGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterKeywordGetOK, error) + + FilterKeywordPost(params *FilterKeywordPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterKeywordPostOK, error) + + FilterKeywordPut(params *FilterKeywordPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterKeywordPutOK, error) + + FilterKeywordsGet(params *FilterKeywordsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterKeywordsGetOK, error) + + FilterStatusDelete(params *FilterStatusDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterStatusDeleteOK, error) + + FilterStatusGet(params *FilterStatusGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterStatusGetOK, error) + + FilterStatusPost(params *FilterStatusPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterStatusPostOK, error) + + FilterStatusesGet(params *FilterStatusesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterStatusesGetOK, error) + + FilterV1Delete(params *FilterV1DeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV1DeleteOK, error) + + FilterV1Get(params *FilterV1GetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV1GetOK, error) + + FilterV1Post(params *FilterV1PostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV1PostOK, error) + + FilterV1Put(params *FilterV1PutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV1PutOK, error) + + FilterV2Delete(params *FilterV2DeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV2DeleteOK, error) + + FilterV2Get(params *FilterV2GetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV2GetOK, error) + + FilterV2Post(params *FilterV2PostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV2PostOK, error) + + FilterV2Put(params *FilterV2PutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV2PutOK, error) + + FiltersV1Get(params *FiltersV1GetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FiltersV1GetOK, error) + + FiltersV2Get(params *FiltersV2GetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FiltersV2GetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +FilterKeywordDelete deletes a single filter keyword with the given ID +*/ +func (a *Client) FilterKeywordDelete(params *FilterKeywordDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterKeywordDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterKeywordDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "filterKeywordDelete", + Method: "DELETE", + PathPattern: "/api/v2/filters/keywords/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterKeywordDeleteReader{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.(*FilterKeywordDeleteOK) + 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 filterKeywordDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterKeywordGet gets a single filter keyword with the given ID +*/ +func (a *Client) FilterKeywordGet(params *FilterKeywordGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterKeywordGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterKeywordGetParams() + } + op := &runtime.ClientOperation{ + ID: "filterKeywordGet", + Method: "GET", + PathPattern: "/api/v2/filters/keywords/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterKeywordGetReader{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.(*FilterKeywordGetOK) + 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 filterKeywordGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterKeywordPost adds a filter keyword to an existing filter +*/ +func (a *Client) FilterKeywordPost(params *FilterKeywordPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterKeywordPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterKeywordPostParams() + } + op := &runtime.ClientOperation{ + ID: "filterKeywordPost", + Method: "POST", + PathPattern: "/api/v2/filters/{id}/keywords", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterKeywordPostReader{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.(*FilterKeywordPostOK) + 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 filterKeywordPost: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterKeywordPut updates a single filter keyword with the given ID +*/ +func (a *Client) FilterKeywordPut(params *FilterKeywordPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterKeywordPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterKeywordPutParams() + } + op := &runtime.ClientOperation{ + ID: "filterKeywordPut", + Method: "PUT", + PathPattern: "/api/v2/filters/keywords{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterKeywordPutReader{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.(*FilterKeywordPutOK) + 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 filterKeywordPut: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterKeywordsGet gets all filter keywords for a given filter +*/ +func (a *Client) FilterKeywordsGet(params *FilterKeywordsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterKeywordsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterKeywordsGetParams() + } + op := &runtime.ClientOperation{ + ID: "filterKeywordsGet", + Method: "GET", + PathPattern: "/api/v2/filters/{id}/keywords", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterKeywordsGetReader{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.(*FilterKeywordsGetOK) + 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 filterKeywordsGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterStatusDelete deletes a single filter status with the given ID +*/ +func (a *Client) FilterStatusDelete(params *FilterStatusDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterStatusDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterStatusDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "filterStatusDelete", + Method: "DELETE", + PathPattern: "/api/v2/filters/statuses/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterStatusDeleteReader{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.(*FilterStatusDeleteOK) + 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 filterStatusDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterStatusGet gets a single filter status with the given ID +*/ +func (a *Client) FilterStatusGet(params *FilterStatusGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterStatusGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterStatusGetParams() + } + op := &runtime.ClientOperation{ + ID: "filterStatusGet", + Method: "GET", + PathPattern: "/api/v2/filters/statuses/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterStatusGetReader{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.(*FilterStatusGetOK) + 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 filterStatusGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterStatusPost adds a filter status to an existing filter +*/ +func (a *Client) FilterStatusPost(params *FilterStatusPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterStatusPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterStatusPostParams() + } + op := &runtime.ClientOperation{ + ID: "filterStatusPost", + Method: "POST", + PathPattern: "/api/v2/filters/{id}/statuses", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterStatusPostReader{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.(*FilterStatusPostOK) + 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 filterStatusPost: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterStatusesGet gets all filter statuses for a given filter +*/ +func (a *Client) FilterStatusesGet(params *FilterStatusesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterStatusesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterStatusesGetParams() + } + op := &runtime.ClientOperation{ + ID: "filterStatusesGet", + Method: "GET", + PathPattern: "/api/v2/filters/{id}/statuses", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterStatusesGetReader{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.(*FilterStatusesGetOK) + 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 filterStatusesGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterV1Delete deletes a single filter with the given ID +*/ +func (a *Client) FilterV1Delete(params *FilterV1DeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV1DeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterV1DeleteParams() + } + op := &runtime.ClientOperation{ + ID: "filterV1Delete", + Method: "DELETE", + PathPattern: "/api/v1/filters/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterV1DeleteReader{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.(*FilterV1DeleteOK) + 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 filterV1Delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterV1Get gets a single filter with the given ID +*/ +func (a *Client) FilterV1Get(params *FilterV1GetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV1GetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterV1GetParams() + } + op := &runtime.ClientOperation{ + ID: "filterV1Get", + Method: "GET", + PathPattern: "/api/v1/filters/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterV1GetReader{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.(*FilterV1GetOK) + 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 filterV1Get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterV1Post creates a single filter +*/ +func (a *Client) FilterV1Post(params *FilterV1PostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV1PostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterV1PostParams() + } + op := &runtime.ClientOperation{ + ID: "filterV1Post", + Method: "POST", + PathPattern: "/api/v1/filters", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterV1PostReader{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.(*FilterV1PostOK) + 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 filterV1Post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterV1Put updates a single filter with the given ID +*/ +func (a *Client) FilterV1Put(params *FilterV1PutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV1PutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterV1PutParams() + } + op := &runtime.ClientOperation{ + ID: "filterV1Put", + Method: "PUT", + PathPattern: "/api/v1/filters/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterV1PutReader{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.(*FilterV1PutOK) + 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 filterV1Put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterV2Delete deletes a single filter with the given ID +*/ +func (a *Client) FilterV2Delete(params *FilterV2DeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV2DeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterV2DeleteParams() + } + op := &runtime.ClientOperation{ + ID: "filterV2Delete", + Method: "DELETE", + PathPattern: "/api/v2/filters/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterV2DeleteReader{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.(*FilterV2DeleteOK) + 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 filterV2Delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterV2Get gets a single filter with the given ID +*/ +func (a *Client) FilterV2Get(params *FilterV2GetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV2GetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterV2GetParams() + } + op := &runtime.ClientOperation{ + ID: "filterV2Get", + Method: "GET", + PathPattern: "/api/v2/filters/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterV2GetReader{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.(*FilterV2GetOK) + 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 filterV2Get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterV2Post creates a single filter +*/ +func (a *Client) FilterV2Post(params *FilterV2PostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV2PostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterV2PostParams() + } + op := &runtime.ClientOperation{ + ID: "filterV2Post", + Method: "POST", + PathPattern: "/api/v2/filters", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterV2PostReader{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.(*FilterV2PostOK) + 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 filterV2Post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + FilterV2Put updates a single filter with the given ID + + Note that this is actually closer to a PATCH operation: + +only provided fields will be updated, and omitted fields will remain set to previous values. +*/ +func (a *Client) FilterV2Put(params *FilterV2PutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV2PutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterV2PutParams() + } + op := &runtime.ClientOperation{ + ID: "filterV2Put", + Method: "PUT", + PathPattern: "/api/v2/filters/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterV2PutReader{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.(*FilterV2PutOK) + 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 filterV2Put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FiltersV1Get gets all filters for the authenticated account +*/ +func (a *Client) FiltersV1Get(params *FiltersV1GetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FiltersV1GetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFiltersV1GetParams() + } + op := &runtime.ClientOperation{ + ID: "filtersV1Get", + Method: "GET", + PathPattern: "/api/v1/filters", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FiltersV1GetReader{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.(*FiltersV1GetOK) + 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 filtersV1Get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FiltersV2Get gets all filters for the authenticated account +*/ +func (a *Client) FiltersV2Get(params *FiltersV2GetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FiltersV2GetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFiltersV2GetParams() + } + op := &runtime.ClientOperation{ + ID: "filtersV2Get", + Method: "GET", + PathPattern: "/api/v2/filters", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FiltersV2GetReader{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.(*FiltersV2GetOK) + 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 filtersV2Get: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filters_v1_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filters_v1_get_parameters.go new file mode 100644 index 0000000..389bdde --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filters_v1_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFiltersV1GetParams creates a new FiltersV1GetParams 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 NewFiltersV1GetParams() *FiltersV1GetParams { + return &FiltersV1GetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFiltersV1GetParamsWithTimeout creates a new FiltersV1GetParams object +// with the ability to set a timeout on a request. +func NewFiltersV1GetParamsWithTimeout(timeout time.Duration) *FiltersV1GetParams { + return &FiltersV1GetParams{ + timeout: timeout, + } +} + +// NewFiltersV1GetParamsWithContext creates a new FiltersV1GetParams object +// with the ability to set a context for a request. +func NewFiltersV1GetParamsWithContext(ctx context.Context) *FiltersV1GetParams { + return &FiltersV1GetParams{ + Context: ctx, + } +} + +// NewFiltersV1GetParamsWithHTTPClient creates a new FiltersV1GetParams object +// with the ability to set a custom HTTPClient for a request. +func NewFiltersV1GetParamsWithHTTPClient(client *http.Client) *FiltersV1GetParams { + return &FiltersV1GetParams{ + HTTPClient: client, + } +} + +/* +FiltersV1GetParams contains all the parameters to send to the API endpoint + + for the filters v1 get operation. + + Typically these are written to a http.Request. +*/ +type FiltersV1GetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filters v1 get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FiltersV1GetParams) WithDefaults() *FiltersV1GetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filters v1 get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FiltersV1GetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filters v1 get params +func (o *FiltersV1GetParams) WithTimeout(timeout time.Duration) *FiltersV1GetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filters v1 get params +func (o *FiltersV1GetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filters v1 get params +func (o *FiltersV1GetParams) WithContext(ctx context.Context) *FiltersV1GetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filters v1 get params +func (o *FiltersV1GetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filters v1 get params +func (o *FiltersV1GetParams) WithHTTPClient(client *http.Client) *FiltersV1GetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filters v1 get params +func (o *FiltersV1GetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *FiltersV1GetParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filters_v1_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filters_v1_get_responses.go new file mode 100644 index 0000000..b2b22a1 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filters_v1_get_responses.go @@ -0,0 +1,414 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FiltersV1GetReader is a Reader for the FiltersV1Get structure. +type FiltersV1GetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FiltersV1GetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFiltersV1GetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFiltersV1GetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFiltersV1GetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFiltersV1GetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFiltersV1GetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFiltersV1GetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/filters] filtersV1Get", response, response.Code()) + } +} + +// NewFiltersV1GetOK creates a FiltersV1GetOK with default headers values +func NewFiltersV1GetOK() *FiltersV1GetOK { + return &FiltersV1GetOK{} +} + +/* +FiltersV1GetOK describes a response with status code 200, with default header values. + +Requested filters. +*/ +type FiltersV1GetOK struct { + Payload []*models.FilterV1 +} + +// IsSuccess returns true when this filters v1 get o k response has a 2xx status code +func (o *FiltersV1GetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filters v1 get o k response has a 3xx status code +func (o *FiltersV1GetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v1 get o k response has a 4xx status code +func (o *FiltersV1GetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filters v1 get o k response has a 5xx status code +func (o *FiltersV1GetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filters v1 get o k response a status code equal to that given +func (o *FiltersV1GetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filters v1 get o k response +func (o *FiltersV1GetOK) Code() int { + return 200 +} + +func (o *FiltersV1GetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetOK %s", 200, payload) +} + +func (o *FiltersV1GetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetOK %s", 200, payload) +} + +func (o *FiltersV1GetOK) GetPayload() []*models.FilterV1 { + return o.Payload +} + +func (o *FiltersV1GetOK) 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 +} + +// NewFiltersV1GetBadRequest creates a FiltersV1GetBadRequest with default headers values +func NewFiltersV1GetBadRequest() *FiltersV1GetBadRequest { + return &FiltersV1GetBadRequest{} +} + +/* +FiltersV1GetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FiltersV1GetBadRequest struct { +} + +// IsSuccess returns true when this filters v1 get bad request response has a 2xx status code +func (o *FiltersV1GetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filters v1 get bad request response has a 3xx status code +func (o *FiltersV1GetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v1 get bad request response has a 4xx status code +func (o *FiltersV1GetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filters v1 get bad request response has a 5xx status code +func (o *FiltersV1GetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filters v1 get bad request response a status code equal to that given +func (o *FiltersV1GetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filters v1 get bad request response +func (o *FiltersV1GetBadRequest) Code() int { + return 400 +} + +func (o *FiltersV1GetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetBadRequest", 400) +} + +func (o *FiltersV1GetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetBadRequest", 400) +} + +func (o *FiltersV1GetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFiltersV1GetUnauthorized creates a FiltersV1GetUnauthorized with default headers values +func NewFiltersV1GetUnauthorized() *FiltersV1GetUnauthorized { + return &FiltersV1GetUnauthorized{} +} + +/* +FiltersV1GetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FiltersV1GetUnauthorized struct { +} + +// IsSuccess returns true when this filters v1 get unauthorized response has a 2xx status code +func (o *FiltersV1GetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filters v1 get unauthorized response has a 3xx status code +func (o *FiltersV1GetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v1 get unauthorized response has a 4xx status code +func (o *FiltersV1GetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filters v1 get unauthorized response has a 5xx status code +func (o *FiltersV1GetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filters v1 get unauthorized response a status code equal to that given +func (o *FiltersV1GetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filters v1 get unauthorized response +func (o *FiltersV1GetUnauthorized) Code() int { + return 401 +} + +func (o *FiltersV1GetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetUnauthorized", 401) +} + +func (o *FiltersV1GetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetUnauthorized", 401) +} + +func (o *FiltersV1GetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFiltersV1GetNotFound creates a FiltersV1GetNotFound with default headers values +func NewFiltersV1GetNotFound() *FiltersV1GetNotFound { + return &FiltersV1GetNotFound{} +} + +/* +FiltersV1GetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FiltersV1GetNotFound struct { +} + +// IsSuccess returns true when this filters v1 get not found response has a 2xx status code +func (o *FiltersV1GetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filters v1 get not found response has a 3xx status code +func (o *FiltersV1GetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v1 get not found response has a 4xx status code +func (o *FiltersV1GetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filters v1 get not found response has a 5xx status code +func (o *FiltersV1GetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filters v1 get not found response a status code equal to that given +func (o *FiltersV1GetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filters v1 get not found response +func (o *FiltersV1GetNotFound) Code() int { + return 404 +} + +func (o *FiltersV1GetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetNotFound", 404) +} + +func (o *FiltersV1GetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetNotFound", 404) +} + +func (o *FiltersV1GetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFiltersV1GetNotAcceptable creates a FiltersV1GetNotAcceptable with default headers values +func NewFiltersV1GetNotAcceptable() *FiltersV1GetNotAcceptable { + return &FiltersV1GetNotAcceptable{} +} + +/* +FiltersV1GetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FiltersV1GetNotAcceptable struct { +} + +// IsSuccess returns true when this filters v1 get not acceptable response has a 2xx status code +func (o *FiltersV1GetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filters v1 get not acceptable response has a 3xx status code +func (o *FiltersV1GetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v1 get not acceptable response has a 4xx status code +func (o *FiltersV1GetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filters v1 get not acceptable response has a 5xx status code +func (o *FiltersV1GetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filters v1 get not acceptable response a status code equal to that given +func (o *FiltersV1GetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filters v1 get not acceptable response +func (o *FiltersV1GetNotAcceptable) Code() int { + return 406 +} + +func (o *FiltersV1GetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetNotAcceptable", 406) +} + +func (o *FiltersV1GetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetNotAcceptable", 406) +} + +func (o *FiltersV1GetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFiltersV1GetInternalServerError creates a FiltersV1GetInternalServerError with default headers values +func NewFiltersV1GetInternalServerError() *FiltersV1GetInternalServerError { + return &FiltersV1GetInternalServerError{} +} + +/* +FiltersV1GetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FiltersV1GetInternalServerError struct { +} + +// IsSuccess returns true when this filters v1 get internal server error response has a 2xx status code +func (o *FiltersV1GetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filters v1 get internal server error response has a 3xx status code +func (o *FiltersV1GetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v1 get internal server error response has a 4xx status code +func (o *FiltersV1GetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filters v1 get internal server error response has a 5xx status code +func (o *FiltersV1GetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filters v1 get internal server error response a status code equal to that given +func (o *FiltersV1GetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filters v1 get internal server error response +func (o *FiltersV1GetInternalServerError) Code() int { + return 500 +} + +func (o *FiltersV1GetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetInternalServerError", 500) +} + +func (o *FiltersV1GetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetInternalServerError", 500) +} + +func (o *FiltersV1GetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filters_v2_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filters_v2_get_parameters.go new file mode 100644 index 0000000..5b75aa1 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filters_v2_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFiltersV2GetParams creates a new FiltersV2GetParams 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 NewFiltersV2GetParams() *FiltersV2GetParams { + return &FiltersV2GetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFiltersV2GetParamsWithTimeout creates a new FiltersV2GetParams object +// with the ability to set a timeout on a request. +func NewFiltersV2GetParamsWithTimeout(timeout time.Duration) *FiltersV2GetParams { + return &FiltersV2GetParams{ + timeout: timeout, + } +} + +// NewFiltersV2GetParamsWithContext creates a new FiltersV2GetParams object +// with the ability to set a context for a request. +func NewFiltersV2GetParamsWithContext(ctx context.Context) *FiltersV2GetParams { + return &FiltersV2GetParams{ + Context: ctx, + } +} + +// NewFiltersV2GetParamsWithHTTPClient creates a new FiltersV2GetParams object +// with the ability to set a custom HTTPClient for a request. +func NewFiltersV2GetParamsWithHTTPClient(client *http.Client) *FiltersV2GetParams { + return &FiltersV2GetParams{ + HTTPClient: client, + } +} + +/* +FiltersV2GetParams contains all the parameters to send to the API endpoint + + for the filters v2 get operation. + + Typically these are written to a http.Request. +*/ +type FiltersV2GetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filters v2 get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FiltersV2GetParams) WithDefaults() *FiltersV2GetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filters v2 get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FiltersV2GetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filters v2 get params +func (o *FiltersV2GetParams) WithTimeout(timeout time.Duration) *FiltersV2GetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filters v2 get params +func (o *FiltersV2GetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filters v2 get params +func (o *FiltersV2GetParams) WithContext(ctx context.Context) *FiltersV2GetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filters v2 get params +func (o *FiltersV2GetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filters v2 get params +func (o *FiltersV2GetParams) WithHTTPClient(client *http.Client) *FiltersV2GetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filters v2 get params +func (o *FiltersV2GetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *FiltersV2GetParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filters_v2_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filters_v2_get_responses.go new file mode 100644 index 0000000..430f199 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/filters/filters_v2_get_responses.go @@ -0,0 +1,414 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FiltersV2GetReader is a Reader for the FiltersV2Get structure. +type FiltersV2GetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FiltersV2GetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFiltersV2GetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFiltersV2GetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFiltersV2GetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFiltersV2GetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFiltersV2GetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFiltersV2GetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v2/filters] filtersV2Get", response, response.Code()) + } +} + +// NewFiltersV2GetOK creates a FiltersV2GetOK with default headers values +func NewFiltersV2GetOK() *FiltersV2GetOK { + return &FiltersV2GetOK{} +} + +/* +FiltersV2GetOK describes a response with status code 200, with default header values. + +Requested filters. +*/ +type FiltersV2GetOK struct { + Payload []*models.FilterV2 +} + +// IsSuccess returns true when this filters v2 get o k response has a 2xx status code +func (o *FiltersV2GetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filters v2 get o k response has a 3xx status code +func (o *FiltersV2GetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v2 get o k response has a 4xx status code +func (o *FiltersV2GetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filters v2 get o k response has a 5xx status code +func (o *FiltersV2GetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filters v2 get o k response a status code equal to that given +func (o *FiltersV2GetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filters v2 get o k response +func (o *FiltersV2GetOK) Code() int { + return 200 +} + +func (o *FiltersV2GetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetOK %s", 200, payload) +} + +func (o *FiltersV2GetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetOK %s", 200, payload) +} + +func (o *FiltersV2GetOK) GetPayload() []*models.FilterV2 { + return o.Payload +} + +func (o *FiltersV2GetOK) 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 +} + +// NewFiltersV2GetBadRequest creates a FiltersV2GetBadRequest with default headers values +func NewFiltersV2GetBadRequest() *FiltersV2GetBadRequest { + return &FiltersV2GetBadRequest{} +} + +/* +FiltersV2GetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FiltersV2GetBadRequest struct { +} + +// IsSuccess returns true when this filters v2 get bad request response has a 2xx status code +func (o *FiltersV2GetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filters v2 get bad request response has a 3xx status code +func (o *FiltersV2GetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v2 get bad request response has a 4xx status code +func (o *FiltersV2GetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filters v2 get bad request response has a 5xx status code +func (o *FiltersV2GetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filters v2 get bad request response a status code equal to that given +func (o *FiltersV2GetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filters v2 get bad request response +func (o *FiltersV2GetBadRequest) Code() int { + return 400 +} + +func (o *FiltersV2GetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetBadRequest", 400) +} + +func (o *FiltersV2GetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetBadRequest", 400) +} + +func (o *FiltersV2GetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFiltersV2GetUnauthorized creates a FiltersV2GetUnauthorized with default headers values +func NewFiltersV2GetUnauthorized() *FiltersV2GetUnauthorized { + return &FiltersV2GetUnauthorized{} +} + +/* +FiltersV2GetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FiltersV2GetUnauthorized struct { +} + +// IsSuccess returns true when this filters v2 get unauthorized response has a 2xx status code +func (o *FiltersV2GetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filters v2 get unauthorized response has a 3xx status code +func (o *FiltersV2GetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v2 get unauthorized response has a 4xx status code +func (o *FiltersV2GetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filters v2 get unauthorized response has a 5xx status code +func (o *FiltersV2GetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filters v2 get unauthorized response a status code equal to that given +func (o *FiltersV2GetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filters v2 get unauthorized response +func (o *FiltersV2GetUnauthorized) Code() int { + return 401 +} + +func (o *FiltersV2GetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetUnauthorized", 401) +} + +func (o *FiltersV2GetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetUnauthorized", 401) +} + +func (o *FiltersV2GetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFiltersV2GetNotFound creates a FiltersV2GetNotFound with default headers values +func NewFiltersV2GetNotFound() *FiltersV2GetNotFound { + return &FiltersV2GetNotFound{} +} + +/* +FiltersV2GetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FiltersV2GetNotFound struct { +} + +// IsSuccess returns true when this filters v2 get not found response has a 2xx status code +func (o *FiltersV2GetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filters v2 get not found response has a 3xx status code +func (o *FiltersV2GetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v2 get not found response has a 4xx status code +func (o *FiltersV2GetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filters v2 get not found response has a 5xx status code +func (o *FiltersV2GetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filters v2 get not found response a status code equal to that given +func (o *FiltersV2GetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filters v2 get not found response +func (o *FiltersV2GetNotFound) Code() int { + return 404 +} + +func (o *FiltersV2GetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetNotFound", 404) +} + +func (o *FiltersV2GetNotFound) String() string { + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetNotFound", 404) +} + +func (o *FiltersV2GetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFiltersV2GetNotAcceptable creates a FiltersV2GetNotAcceptable with default headers values +func NewFiltersV2GetNotAcceptable() *FiltersV2GetNotAcceptable { + return &FiltersV2GetNotAcceptable{} +} + +/* +FiltersV2GetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FiltersV2GetNotAcceptable struct { +} + +// IsSuccess returns true when this filters v2 get not acceptable response has a 2xx status code +func (o *FiltersV2GetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filters v2 get not acceptable response has a 3xx status code +func (o *FiltersV2GetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v2 get not acceptable response has a 4xx status code +func (o *FiltersV2GetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filters v2 get not acceptable response has a 5xx status code +func (o *FiltersV2GetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filters v2 get not acceptable response a status code equal to that given +func (o *FiltersV2GetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filters v2 get not acceptable response +func (o *FiltersV2GetNotAcceptable) Code() int { + return 406 +} + +func (o *FiltersV2GetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetNotAcceptable", 406) +} + +func (o *FiltersV2GetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetNotAcceptable", 406) +} + +func (o *FiltersV2GetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFiltersV2GetInternalServerError creates a FiltersV2GetInternalServerError with default headers values +func NewFiltersV2GetInternalServerError() *FiltersV2GetInternalServerError { + return &FiltersV2GetInternalServerError{} +} + +/* +FiltersV2GetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FiltersV2GetInternalServerError struct { +} + +// IsSuccess returns true when this filters v2 get internal server error response has a 2xx status code +func (o *FiltersV2GetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filters v2 get internal server error response has a 3xx status code +func (o *FiltersV2GetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v2 get internal server error response has a 4xx status code +func (o *FiltersV2GetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filters v2 get internal server error response has a 5xx status code +func (o *FiltersV2GetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filters v2 get internal server error response a status code equal to that given +func (o *FiltersV2GetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filters v2 get internal server error response +func (o *FiltersV2GetInternalServerError) Code() int { + return 500 +} + +func (o *FiltersV2GetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetInternalServerError", 500) +} + +func (o *FiltersV2GetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetInternalServerError", 500) +} + +func (o *FiltersV2GetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/authorize_follow_request_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/authorize_follow_request_parameters.go new file mode 100644 index 0000000..905d870 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/authorize_follow_request_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package follow_requests + +// 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" +) + +// NewAuthorizeFollowRequestParams creates a new AuthorizeFollowRequestParams 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 NewAuthorizeFollowRequestParams() *AuthorizeFollowRequestParams { + return &AuthorizeFollowRequestParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAuthorizeFollowRequestParamsWithTimeout creates a new AuthorizeFollowRequestParams object +// with the ability to set a timeout on a request. +func NewAuthorizeFollowRequestParamsWithTimeout(timeout time.Duration) *AuthorizeFollowRequestParams { + return &AuthorizeFollowRequestParams{ + timeout: timeout, + } +} + +// NewAuthorizeFollowRequestParamsWithContext creates a new AuthorizeFollowRequestParams object +// with the ability to set a context for a request. +func NewAuthorizeFollowRequestParamsWithContext(ctx context.Context) *AuthorizeFollowRequestParams { + return &AuthorizeFollowRequestParams{ + Context: ctx, + } +} + +// NewAuthorizeFollowRequestParamsWithHTTPClient creates a new AuthorizeFollowRequestParams object +// with the ability to set a custom HTTPClient for a request. +func NewAuthorizeFollowRequestParamsWithHTTPClient(client *http.Client) *AuthorizeFollowRequestParams { + return &AuthorizeFollowRequestParams{ + HTTPClient: client, + } +} + +/* +AuthorizeFollowRequestParams contains all the parameters to send to the API endpoint + + for the authorize follow request operation. + + Typically these are written to a http.Request. +*/ +type AuthorizeFollowRequestParams struct { + + /* AccountID. + + ID of the account requesting to follow you. + */ + AccountID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the authorize follow request params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AuthorizeFollowRequestParams) WithDefaults() *AuthorizeFollowRequestParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the authorize follow request params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AuthorizeFollowRequestParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the authorize follow request params +func (o *AuthorizeFollowRequestParams) WithTimeout(timeout time.Duration) *AuthorizeFollowRequestParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the authorize follow request params +func (o *AuthorizeFollowRequestParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the authorize follow request params +func (o *AuthorizeFollowRequestParams) WithContext(ctx context.Context) *AuthorizeFollowRequestParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the authorize follow request params +func (o *AuthorizeFollowRequestParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the authorize follow request params +func (o *AuthorizeFollowRequestParams) WithHTTPClient(client *http.Client) *AuthorizeFollowRequestParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the authorize follow request params +func (o *AuthorizeFollowRequestParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAccountID adds the accountID to the authorize follow request params +func (o *AuthorizeFollowRequestParams) WithAccountID(accountID string) *AuthorizeFollowRequestParams { + o.SetAccountID(accountID) + return o +} + +// SetAccountID adds the accountId to the authorize follow request params +func (o *AuthorizeFollowRequestParams) SetAccountID(accountID string) { + o.AccountID = accountID +} + +// WriteToRequest writes these params to a swagger request +func (o *AuthorizeFollowRequestParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param account_id + if err := r.SetPathParam("account_id", o.AccountID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/authorize_follow_request_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/authorize_follow_request_responses.go new file mode 100644 index 0000000..9122c3a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/authorize_follow_request_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package follow_requests + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AuthorizeFollowRequestReader is a Reader for the AuthorizeFollowRequest structure. +type AuthorizeFollowRequestReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AuthorizeFollowRequestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAuthorizeFollowRequestOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAuthorizeFollowRequestBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAuthorizeFollowRequestUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAuthorizeFollowRequestNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAuthorizeFollowRequestNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAuthorizeFollowRequestInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/follow_requests/{account_id}/authorize] authorizeFollowRequest", response, response.Code()) + } +} + +// NewAuthorizeFollowRequestOK creates a AuthorizeFollowRequestOK with default headers values +func NewAuthorizeFollowRequestOK() *AuthorizeFollowRequestOK { + return &AuthorizeFollowRequestOK{} +} + +/* +AuthorizeFollowRequestOK describes a response with status code 200, with default header values. + +Your relationship to this account. +*/ +type AuthorizeFollowRequestOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this authorize follow request o k response has a 2xx status code +func (o *AuthorizeFollowRequestOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this authorize follow request o k response has a 3xx status code +func (o *AuthorizeFollowRequestOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this authorize follow request o k response has a 4xx status code +func (o *AuthorizeFollowRequestOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this authorize follow request o k response has a 5xx status code +func (o *AuthorizeFollowRequestOK) IsServerError() bool { + return false +} + +// IsCode returns true when this authorize follow request o k response a status code equal to that given +func (o *AuthorizeFollowRequestOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the authorize follow request o k response +func (o *AuthorizeFollowRequestOK) Code() int { + return 200 +} + +func (o *AuthorizeFollowRequestOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestOK %s", 200, payload) +} + +func (o *AuthorizeFollowRequestOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestOK %s", 200, payload) +} + +func (o *AuthorizeFollowRequestOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *AuthorizeFollowRequestOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAuthorizeFollowRequestBadRequest creates a AuthorizeFollowRequestBadRequest with default headers values +func NewAuthorizeFollowRequestBadRequest() *AuthorizeFollowRequestBadRequest { + return &AuthorizeFollowRequestBadRequest{} +} + +/* +AuthorizeFollowRequestBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AuthorizeFollowRequestBadRequest struct { +} + +// IsSuccess returns true when this authorize follow request bad request response has a 2xx status code +func (o *AuthorizeFollowRequestBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this authorize follow request bad request response has a 3xx status code +func (o *AuthorizeFollowRequestBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this authorize follow request bad request response has a 4xx status code +func (o *AuthorizeFollowRequestBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this authorize follow request bad request response has a 5xx status code +func (o *AuthorizeFollowRequestBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this authorize follow request bad request response a status code equal to that given +func (o *AuthorizeFollowRequestBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the authorize follow request bad request response +func (o *AuthorizeFollowRequestBadRequest) Code() int { + return 400 +} + +func (o *AuthorizeFollowRequestBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestBadRequest", 400) +} + +func (o *AuthorizeFollowRequestBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestBadRequest", 400) +} + +func (o *AuthorizeFollowRequestBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAuthorizeFollowRequestUnauthorized creates a AuthorizeFollowRequestUnauthorized with default headers values +func NewAuthorizeFollowRequestUnauthorized() *AuthorizeFollowRequestUnauthorized { + return &AuthorizeFollowRequestUnauthorized{} +} + +/* +AuthorizeFollowRequestUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AuthorizeFollowRequestUnauthorized struct { +} + +// IsSuccess returns true when this authorize follow request unauthorized response has a 2xx status code +func (o *AuthorizeFollowRequestUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this authorize follow request unauthorized response has a 3xx status code +func (o *AuthorizeFollowRequestUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this authorize follow request unauthorized response has a 4xx status code +func (o *AuthorizeFollowRequestUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this authorize follow request unauthorized response has a 5xx status code +func (o *AuthorizeFollowRequestUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this authorize follow request unauthorized response a status code equal to that given +func (o *AuthorizeFollowRequestUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the authorize follow request unauthorized response +func (o *AuthorizeFollowRequestUnauthorized) Code() int { + return 401 +} + +func (o *AuthorizeFollowRequestUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestUnauthorized", 401) +} + +func (o *AuthorizeFollowRequestUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestUnauthorized", 401) +} + +func (o *AuthorizeFollowRequestUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAuthorizeFollowRequestNotFound creates a AuthorizeFollowRequestNotFound with default headers values +func NewAuthorizeFollowRequestNotFound() *AuthorizeFollowRequestNotFound { + return &AuthorizeFollowRequestNotFound{} +} + +/* +AuthorizeFollowRequestNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AuthorizeFollowRequestNotFound struct { +} + +// IsSuccess returns true when this authorize follow request not found response has a 2xx status code +func (o *AuthorizeFollowRequestNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this authorize follow request not found response has a 3xx status code +func (o *AuthorizeFollowRequestNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this authorize follow request not found response has a 4xx status code +func (o *AuthorizeFollowRequestNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this authorize follow request not found response has a 5xx status code +func (o *AuthorizeFollowRequestNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this authorize follow request not found response a status code equal to that given +func (o *AuthorizeFollowRequestNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the authorize follow request not found response +func (o *AuthorizeFollowRequestNotFound) Code() int { + return 404 +} + +func (o *AuthorizeFollowRequestNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestNotFound", 404) +} + +func (o *AuthorizeFollowRequestNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestNotFound", 404) +} + +func (o *AuthorizeFollowRequestNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAuthorizeFollowRequestNotAcceptable creates a AuthorizeFollowRequestNotAcceptable with default headers values +func NewAuthorizeFollowRequestNotAcceptable() *AuthorizeFollowRequestNotAcceptable { + return &AuthorizeFollowRequestNotAcceptable{} +} + +/* +AuthorizeFollowRequestNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AuthorizeFollowRequestNotAcceptable struct { +} + +// IsSuccess returns true when this authorize follow request not acceptable response has a 2xx status code +func (o *AuthorizeFollowRequestNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this authorize follow request not acceptable response has a 3xx status code +func (o *AuthorizeFollowRequestNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this authorize follow request not acceptable response has a 4xx status code +func (o *AuthorizeFollowRequestNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this authorize follow request not acceptable response has a 5xx status code +func (o *AuthorizeFollowRequestNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this authorize follow request not acceptable response a status code equal to that given +func (o *AuthorizeFollowRequestNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the authorize follow request not acceptable response +func (o *AuthorizeFollowRequestNotAcceptable) Code() int { + return 406 +} + +func (o *AuthorizeFollowRequestNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestNotAcceptable", 406) +} + +func (o *AuthorizeFollowRequestNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestNotAcceptable", 406) +} + +func (o *AuthorizeFollowRequestNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAuthorizeFollowRequestInternalServerError creates a AuthorizeFollowRequestInternalServerError with default headers values +func NewAuthorizeFollowRequestInternalServerError() *AuthorizeFollowRequestInternalServerError { + return &AuthorizeFollowRequestInternalServerError{} +} + +/* +AuthorizeFollowRequestInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AuthorizeFollowRequestInternalServerError struct { +} + +// IsSuccess returns true when this authorize follow request internal server error response has a 2xx status code +func (o *AuthorizeFollowRequestInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this authorize follow request internal server error response has a 3xx status code +func (o *AuthorizeFollowRequestInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this authorize follow request internal server error response has a 4xx status code +func (o *AuthorizeFollowRequestInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this authorize follow request internal server error response has a 5xx status code +func (o *AuthorizeFollowRequestInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this authorize follow request internal server error response a status code equal to that given +func (o *AuthorizeFollowRequestInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the authorize follow request internal server error response +func (o *AuthorizeFollowRequestInternalServerError) Code() int { + return 500 +} + +func (o *AuthorizeFollowRequestInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestInternalServerError", 500) +} + +func (o *AuthorizeFollowRequestInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestInternalServerError", 500) +} + +func (o *AuthorizeFollowRequestInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/follow_requests_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/follow_requests_client.go new file mode 100644 index 0000000..dd53904 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/follow_requests_client.go @@ -0,0 +1,198 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package follow_requests + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new follow requests API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new follow requests API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new follow requests API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for follow requests API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + AuthorizeFollowRequest(params *AuthorizeFollowRequestParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AuthorizeFollowRequestOK, error) + + GetFollowRequests(params *GetFollowRequestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFollowRequestsOK, error) + + RejectFollowRequest(params *RejectFollowRequestParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RejectFollowRequestOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +AuthorizeFollowRequest accepts authorize follow request from the given account ID + +Accept a follow request and put the requesting account in your 'followers' list. +*/ +func (a *Client) AuthorizeFollowRequest(params *AuthorizeFollowRequestParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AuthorizeFollowRequestOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAuthorizeFollowRequestParams() + } + op := &runtime.ClientOperation{ + ID: "authorizeFollowRequest", + Method: "POST", + PathPattern: "/api/v1/follow_requests/{account_id}/authorize", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AuthorizeFollowRequestReader{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.(*AuthorizeFollowRequestOK) + 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 authorizeFollowRequest: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + GetFollowRequests gets an array of accounts that have requested to follow you + + The next and previous queries can be parsed from the returned Link header. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) GetFollowRequests(params *GetFollowRequestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFollowRequestsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetFollowRequestsParams() + } + op := &runtime.ClientOperation{ + ID: "getFollowRequests", + Method: "GET", + PathPattern: "/api/v1/follow_requests", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetFollowRequestsReader{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.(*GetFollowRequestsOK) + 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 getFollowRequests: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +RejectFollowRequest rejects deny follow request from the given account ID +*/ +func (a *Client) RejectFollowRequest(params *RejectFollowRequestParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RejectFollowRequestOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewRejectFollowRequestParams() + } + op := &runtime.ClientOperation{ + ID: "rejectFollowRequest", + Method: "POST", + PathPattern: "/api/v1/follow_requests/{account_id}/reject", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &RejectFollowRequestReader{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.(*RejectFollowRequestOK) + 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 rejectFollowRequest: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/get_follow_requests_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/get_follow_requests_parameters.go new file mode 100644 index 0000000..7f23814 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/get_follow_requests_parameters.go @@ -0,0 +1,279 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package follow_requests + +// 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" +) + +// NewGetFollowRequestsParams creates a new GetFollowRequestsParams 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 NewGetFollowRequestsParams() *GetFollowRequestsParams { + return &GetFollowRequestsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetFollowRequestsParamsWithTimeout creates a new GetFollowRequestsParams object +// with the ability to set a timeout on a request. +func NewGetFollowRequestsParamsWithTimeout(timeout time.Duration) *GetFollowRequestsParams { + return &GetFollowRequestsParams{ + timeout: timeout, + } +} + +// NewGetFollowRequestsParamsWithContext creates a new GetFollowRequestsParams object +// with the ability to set a context for a request. +func NewGetFollowRequestsParamsWithContext(ctx context.Context) *GetFollowRequestsParams { + return &GetFollowRequestsParams{ + Context: ctx, + } +} + +// NewGetFollowRequestsParamsWithHTTPClient creates a new GetFollowRequestsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetFollowRequestsParamsWithHTTPClient(client *http.Client) *GetFollowRequestsParams { + return &GetFollowRequestsParams{ + HTTPClient: client, + } +} + +/* +GetFollowRequestsParams contains all the parameters to send to the API endpoint + + for the get follow requests operation. + + Typically these are written to a http.Request. +*/ +type GetFollowRequestsParams struct { + + /* Limit. + + Number of follow requesting accounts to return. + + Default: 40 + */ + Limit *int64 + + /* MaxID. + + Return only follow requesting accounts *OLDER* than the given max ID. The follow requester with the specified ID will not be included in the response. NOTE: the ID is of the internal follow request, NOT any of the returned accounts. + */ + MaxID *string + + /* MinID. + + Return only follow requesting accounts *IMMEDIATELY NEWER* than the given min ID. The follow requester with the specified ID will not be included in the response. NOTE: the ID is of the internal follow request, NOT any of the returned accounts. + */ + MinID *string + + /* SinceID. + + Return only follow requesting accounts *NEWER* than the given since ID. The follow requester with the specified ID will not be included in the response. NOTE: the ID is of the internal follow request, NOT any of the returned accounts. + */ + SinceID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get follow requests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetFollowRequestsParams) WithDefaults() *GetFollowRequestsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get follow requests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetFollowRequestsParams) SetDefaults() { + var ( + limitDefault = int64(40) + ) + + val := GetFollowRequestsParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the get follow requests params +func (o *GetFollowRequestsParams) WithTimeout(timeout time.Duration) *GetFollowRequestsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get follow requests params +func (o *GetFollowRequestsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get follow requests params +func (o *GetFollowRequestsParams) WithContext(ctx context.Context) *GetFollowRequestsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get follow requests params +func (o *GetFollowRequestsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get follow requests params +func (o *GetFollowRequestsParams) WithHTTPClient(client *http.Client) *GetFollowRequestsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get follow requests params +func (o *GetFollowRequestsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the get follow requests params +func (o *GetFollowRequestsParams) WithLimit(limit *int64) *GetFollowRequestsParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the get follow requests params +func (o *GetFollowRequestsParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the get follow requests params +func (o *GetFollowRequestsParams) WithMaxID(maxID *string) *GetFollowRequestsParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the get follow requests params +func (o *GetFollowRequestsParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the get follow requests params +func (o *GetFollowRequestsParams) WithMinID(minID *string) *GetFollowRequestsParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the get follow requests params +func (o *GetFollowRequestsParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the get follow requests params +func (o *GetFollowRequestsParams) WithSinceID(sinceID *string) *GetFollowRequestsParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the get follow requests params +func (o *GetFollowRequestsParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WriteToRequest writes these params to a swagger request +func (o *GetFollowRequestsParams) 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.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if o.SinceID != nil { + + // query param since_id + var qrSinceID string + + if o.SinceID != nil { + qrSinceID = *o.SinceID + } + qSinceID := qrSinceID + if qSinceID != "" { + + if err := r.SetQueryParam("since_id", qSinceID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/get_follow_requests_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/get_follow_requests_responses.go new file mode 100644 index 0000000..69a2c5d --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/get_follow_requests_responses.go @@ -0,0 +1,426 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package follow_requests + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// GetFollowRequestsReader is a Reader for the GetFollowRequests structure. +type GetFollowRequestsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetFollowRequestsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetFollowRequestsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewGetFollowRequestsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewGetFollowRequestsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewGetFollowRequestsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewGetFollowRequestsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewGetFollowRequestsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/follow_requests] getFollowRequests", response, response.Code()) + } +} + +// NewGetFollowRequestsOK creates a GetFollowRequestsOK with default headers values +func NewGetFollowRequestsOK() *GetFollowRequestsOK { + return &GetFollowRequestsOK{} +} + +/* +GetFollowRequestsOK describes a response with status code 200, with default header values. + +GetFollowRequestsOK get follow requests o k +*/ +type GetFollowRequestsOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Account +} + +// IsSuccess returns true when this get follow requests o k response has a 2xx status code +func (o *GetFollowRequestsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get follow requests o k response has a 3xx status code +func (o *GetFollowRequestsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get follow requests o k response has a 4xx status code +func (o *GetFollowRequestsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get follow requests o k response has a 5xx status code +func (o *GetFollowRequestsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get follow requests o k response a status code equal to that given +func (o *GetFollowRequestsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get follow requests o k response +func (o *GetFollowRequestsOK) Code() int { + return 200 +} + +func (o *GetFollowRequestsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsOK %s", 200, payload) +} + +func (o *GetFollowRequestsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsOK %s", 200, payload) +} + +func (o *GetFollowRequestsOK) GetPayload() []*models.Account { + return o.Payload +} + +func (o *GetFollowRequestsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetFollowRequestsBadRequest creates a GetFollowRequestsBadRequest with default headers values +func NewGetFollowRequestsBadRequest() *GetFollowRequestsBadRequest { + return &GetFollowRequestsBadRequest{} +} + +/* +GetFollowRequestsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type GetFollowRequestsBadRequest struct { +} + +// IsSuccess returns true when this get follow requests bad request response has a 2xx status code +func (o *GetFollowRequestsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get follow requests bad request response has a 3xx status code +func (o *GetFollowRequestsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get follow requests bad request response has a 4xx status code +func (o *GetFollowRequestsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this get follow requests bad request response has a 5xx status code +func (o *GetFollowRequestsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this get follow requests bad request response a status code equal to that given +func (o *GetFollowRequestsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the get follow requests bad request response +func (o *GetFollowRequestsBadRequest) Code() int { + return 400 +} + +func (o *GetFollowRequestsBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsBadRequest", 400) +} + +func (o *GetFollowRequestsBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsBadRequest", 400) +} + +func (o *GetFollowRequestsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetFollowRequestsUnauthorized creates a GetFollowRequestsUnauthorized with default headers values +func NewGetFollowRequestsUnauthorized() *GetFollowRequestsUnauthorized { + return &GetFollowRequestsUnauthorized{} +} + +/* +GetFollowRequestsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type GetFollowRequestsUnauthorized struct { +} + +// IsSuccess returns true when this get follow requests unauthorized response has a 2xx status code +func (o *GetFollowRequestsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get follow requests unauthorized response has a 3xx status code +func (o *GetFollowRequestsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get follow requests unauthorized response has a 4xx status code +func (o *GetFollowRequestsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this get follow requests unauthorized response has a 5xx status code +func (o *GetFollowRequestsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this get follow requests unauthorized response a status code equal to that given +func (o *GetFollowRequestsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the get follow requests unauthorized response +func (o *GetFollowRequestsUnauthorized) Code() int { + return 401 +} + +func (o *GetFollowRequestsUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsUnauthorized", 401) +} + +func (o *GetFollowRequestsUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsUnauthorized", 401) +} + +func (o *GetFollowRequestsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetFollowRequestsNotFound creates a GetFollowRequestsNotFound with default headers values +func NewGetFollowRequestsNotFound() *GetFollowRequestsNotFound { + return &GetFollowRequestsNotFound{} +} + +/* +GetFollowRequestsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type GetFollowRequestsNotFound struct { +} + +// IsSuccess returns true when this get follow requests not found response has a 2xx status code +func (o *GetFollowRequestsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get follow requests not found response has a 3xx status code +func (o *GetFollowRequestsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get follow requests not found response has a 4xx status code +func (o *GetFollowRequestsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this get follow requests not found response has a 5xx status code +func (o *GetFollowRequestsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this get follow requests not found response a status code equal to that given +func (o *GetFollowRequestsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the get follow requests not found response +func (o *GetFollowRequestsNotFound) Code() int { + return 404 +} + +func (o *GetFollowRequestsNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsNotFound", 404) +} + +func (o *GetFollowRequestsNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsNotFound", 404) +} + +func (o *GetFollowRequestsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetFollowRequestsNotAcceptable creates a GetFollowRequestsNotAcceptable with default headers values +func NewGetFollowRequestsNotAcceptable() *GetFollowRequestsNotAcceptable { + return &GetFollowRequestsNotAcceptable{} +} + +/* +GetFollowRequestsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type GetFollowRequestsNotAcceptable struct { +} + +// IsSuccess returns true when this get follow requests not acceptable response has a 2xx status code +func (o *GetFollowRequestsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get follow requests not acceptable response has a 3xx status code +func (o *GetFollowRequestsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get follow requests not acceptable response has a 4xx status code +func (o *GetFollowRequestsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this get follow requests not acceptable response has a 5xx status code +func (o *GetFollowRequestsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this get follow requests not acceptable response a status code equal to that given +func (o *GetFollowRequestsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the get follow requests not acceptable response +func (o *GetFollowRequestsNotAcceptable) Code() int { + return 406 +} + +func (o *GetFollowRequestsNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsNotAcceptable", 406) +} + +func (o *GetFollowRequestsNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsNotAcceptable", 406) +} + +func (o *GetFollowRequestsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetFollowRequestsInternalServerError creates a GetFollowRequestsInternalServerError with default headers values +func NewGetFollowRequestsInternalServerError() *GetFollowRequestsInternalServerError { + return &GetFollowRequestsInternalServerError{} +} + +/* +GetFollowRequestsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type GetFollowRequestsInternalServerError struct { +} + +// IsSuccess returns true when this get follow requests internal server error response has a 2xx status code +func (o *GetFollowRequestsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get follow requests internal server error response has a 3xx status code +func (o *GetFollowRequestsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get follow requests internal server error response has a 4xx status code +func (o *GetFollowRequestsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this get follow requests internal server error response has a 5xx status code +func (o *GetFollowRequestsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this get follow requests internal server error response a status code equal to that given +func (o *GetFollowRequestsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the get follow requests internal server error response +func (o *GetFollowRequestsInternalServerError) Code() int { + return 500 +} + +func (o *GetFollowRequestsInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsInternalServerError", 500) +} + +func (o *GetFollowRequestsInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsInternalServerError", 500) +} + +func (o *GetFollowRequestsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/reject_follow_request_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/reject_follow_request_parameters.go new file mode 100644 index 0000000..810f337 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/reject_follow_request_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package follow_requests + +// 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" +) + +// NewRejectFollowRequestParams creates a new RejectFollowRequestParams 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 NewRejectFollowRequestParams() *RejectFollowRequestParams { + return &RejectFollowRequestParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewRejectFollowRequestParamsWithTimeout creates a new RejectFollowRequestParams object +// with the ability to set a timeout on a request. +func NewRejectFollowRequestParamsWithTimeout(timeout time.Duration) *RejectFollowRequestParams { + return &RejectFollowRequestParams{ + timeout: timeout, + } +} + +// NewRejectFollowRequestParamsWithContext creates a new RejectFollowRequestParams object +// with the ability to set a context for a request. +func NewRejectFollowRequestParamsWithContext(ctx context.Context) *RejectFollowRequestParams { + return &RejectFollowRequestParams{ + Context: ctx, + } +} + +// NewRejectFollowRequestParamsWithHTTPClient creates a new RejectFollowRequestParams object +// with the ability to set a custom HTTPClient for a request. +func NewRejectFollowRequestParamsWithHTTPClient(client *http.Client) *RejectFollowRequestParams { + return &RejectFollowRequestParams{ + HTTPClient: client, + } +} + +/* +RejectFollowRequestParams contains all the parameters to send to the API endpoint + + for the reject follow request operation. + + Typically these are written to a http.Request. +*/ +type RejectFollowRequestParams struct { + + /* AccountID. + + ID of the account requesting to follow you. + */ + AccountID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the reject follow request params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RejectFollowRequestParams) WithDefaults() *RejectFollowRequestParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the reject follow request params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RejectFollowRequestParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the reject follow request params +func (o *RejectFollowRequestParams) WithTimeout(timeout time.Duration) *RejectFollowRequestParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the reject follow request params +func (o *RejectFollowRequestParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the reject follow request params +func (o *RejectFollowRequestParams) WithContext(ctx context.Context) *RejectFollowRequestParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the reject follow request params +func (o *RejectFollowRequestParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the reject follow request params +func (o *RejectFollowRequestParams) WithHTTPClient(client *http.Client) *RejectFollowRequestParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the reject follow request params +func (o *RejectFollowRequestParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAccountID adds the accountID to the reject follow request params +func (o *RejectFollowRequestParams) WithAccountID(accountID string) *RejectFollowRequestParams { + o.SetAccountID(accountID) + return o +} + +// SetAccountID adds the accountId to the reject follow request params +func (o *RejectFollowRequestParams) SetAccountID(accountID string) { + o.AccountID = accountID +} + +// WriteToRequest writes these params to a swagger request +func (o *RejectFollowRequestParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param account_id + if err := r.SetPathParam("account_id", o.AccountID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/reject_follow_request_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/reject_follow_request_responses.go new file mode 100644 index 0000000..16a702f --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/follow_requests/reject_follow_request_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package follow_requests + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// RejectFollowRequestReader is a Reader for the RejectFollowRequest structure. +type RejectFollowRequestReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *RejectFollowRequestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewRejectFollowRequestOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewRejectFollowRequestBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewRejectFollowRequestUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewRejectFollowRequestNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewRejectFollowRequestNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewRejectFollowRequestInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/follow_requests/{account_id}/reject] rejectFollowRequest", response, response.Code()) + } +} + +// NewRejectFollowRequestOK creates a RejectFollowRequestOK with default headers values +func NewRejectFollowRequestOK() *RejectFollowRequestOK { + return &RejectFollowRequestOK{} +} + +/* +RejectFollowRequestOK describes a response with status code 200, with default header values. + +Your relationship to this account. +*/ +type RejectFollowRequestOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this reject follow request o k response has a 2xx status code +func (o *RejectFollowRequestOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this reject follow request o k response has a 3xx status code +func (o *RejectFollowRequestOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reject follow request o k response has a 4xx status code +func (o *RejectFollowRequestOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this reject follow request o k response has a 5xx status code +func (o *RejectFollowRequestOK) IsServerError() bool { + return false +} + +// IsCode returns true when this reject follow request o k response a status code equal to that given +func (o *RejectFollowRequestOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the reject follow request o k response +func (o *RejectFollowRequestOK) Code() int { + return 200 +} + +func (o *RejectFollowRequestOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestOK %s", 200, payload) +} + +func (o *RejectFollowRequestOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestOK %s", 200, payload) +} + +func (o *RejectFollowRequestOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *RejectFollowRequestOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRejectFollowRequestBadRequest creates a RejectFollowRequestBadRequest with default headers values +func NewRejectFollowRequestBadRequest() *RejectFollowRequestBadRequest { + return &RejectFollowRequestBadRequest{} +} + +/* +RejectFollowRequestBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type RejectFollowRequestBadRequest struct { +} + +// IsSuccess returns true when this reject follow request bad request response has a 2xx status code +func (o *RejectFollowRequestBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this reject follow request bad request response has a 3xx status code +func (o *RejectFollowRequestBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reject follow request bad request response has a 4xx status code +func (o *RejectFollowRequestBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this reject follow request bad request response has a 5xx status code +func (o *RejectFollowRequestBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this reject follow request bad request response a status code equal to that given +func (o *RejectFollowRequestBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the reject follow request bad request response +func (o *RejectFollowRequestBadRequest) Code() int { + return 400 +} + +func (o *RejectFollowRequestBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestBadRequest", 400) +} + +func (o *RejectFollowRequestBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestBadRequest", 400) +} + +func (o *RejectFollowRequestBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRejectFollowRequestUnauthorized creates a RejectFollowRequestUnauthorized with default headers values +func NewRejectFollowRequestUnauthorized() *RejectFollowRequestUnauthorized { + return &RejectFollowRequestUnauthorized{} +} + +/* +RejectFollowRequestUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type RejectFollowRequestUnauthorized struct { +} + +// IsSuccess returns true when this reject follow request unauthorized response has a 2xx status code +func (o *RejectFollowRequestUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this reject follow request unauthorized response has a 3xx status code +func (o *RejectFollowRequestUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reject follow request unauthorized response has a 4xx status code +func (o *RejectFollowRequestUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this reject follow request unauthorized response has a 5xx status code +func (o *RejectFollowRequestUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this reject follow request unauthorized response a status code equal to that given +func (o *RejectFollowRequestUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the reject follow request unauthorized response +func (o *RejectFollowRequestUnauthorized) Code() int { + return 401 +} + +func (o *RejectFollowRequestUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestUnauthorized", 401) +} + +func (o *RejectFollowRequestUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestUnauthorized", 401) +} + +func (o *RejectFollowRequestUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRejectFollowRequestNotFound creates a RejectFollowRequestNotFound with default headers values +func NewRejectFollowRequestNotFound() *RejectFollowRequestNotFound { + return &RejectFollowRequestNotFound{} +} + +/* +RejectFollowRequestNotFound describes a response with status code 404, with default header values. + +not found +*/ +type RejectFollowRequestNotFound struct { +} + +// IsSuccess returns true when this reject follow request not found response has a 2xx status code +func (o *RejectFollowRequestNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this reject follow request not found response has a 3xx status code +func (o *RejectFollowRequestNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reject follow request not found response has a 4xx status code +func (o *RejectFollowRequestNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this reject follow request not found response has a 5xx status code +func (o *RejectFollowRequestNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this reject follow request not found response a status code equal to that given +func (o *RejectFollowRequestNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the reject follow request not found response +func (o *RejectFollowRequestNotFound) Code() int { + return 404 +} + +func (o *RejectFollowRequestNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestNotFound", 404) +} + +func (o *RejectFollowRequestNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestNotFound", 404) +} + +func (o *RejectFollowRequestNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRejectFollowRequestNotAcceptable creates a RejectFollowRequestNotAcceptable with default headers values +func NewRejectFollowRequestNotAcceptable() *RejectFollowRequestNotAcceptable { + return &RejectFollowRequestNotAcceptable{} +} + +/* +RejectFollowRequestNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type RejectFollowRequestNotAcceptable struct { +} + +// IsSuccess returns true when this reject follow request not acceptable response has a 2xx status code +func (o *RejectFollowRequestNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this reject follow request not acceptable response has a 3xx status code +func (o *RejectFollowRequestNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reject follow request not acceptable response has a 4xx status code +func (o *RejectFollowRequestNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this reject follow request not acceptable response has a 5xx status code +func (o *RejectFollowRequestNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this reject follow request not acceptable response a status code equal to that given +func (o *RejectFollowRequestNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the reject follow request not acceptable response +func (o *RejectFollowRequestNotAcceptable) Code() int { + return 406 +} + +func (o *RejectFollowRequestNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestNotAcceptable", 406) +} + +func (o *RejectFollowRequestNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestNotAcceptable", 406) +} + +func (o *RejectFollowRequestNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRejectFollowRequestInternalServerError creates a RejectFollowRequestInternalServerError with default headers values +func NewRejectFollowRequestInternalServerError() *RejectFollowRequestInternalServerError { + return &RejectFollowRequestInternalServerError{} +} + +/* +RejectFollowRequestInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type RejectFollowRequestInternalServerError struct { +} + +// IsSuccess returns true when this reject follow request internal server error response has a 2xx status code +func (o *RejectFollowRequestInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this reject follow request internal server error response has a 3xx status code +func (o *RejectFollowRequestInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reject follow request internal server error response has a 4xx status code +func (o *RejectFollowRequestInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this reject follow request internal server error response has a 5xx status code +func (o *RejectFollowRequestInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this reject follow request internal server error response a status code equal to that given +func (o *RejectFollowRequestInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the reject follow request internal server error response +func (o *RejectFollowRequestInternalServerError) Code() int { + return 500 +} + +func (o *RejectFollowRequestInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestInternalServerError", 500) +} + +func (o *RejectFollowRequestInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestInternalServerError", 500) +} + +func (o *RejectFollowRequestInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/go_to_social_swagger_documentation_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/go_to_social_swagger_documentation_client.go new file mode 100644 index 0000000..66c545c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/go_to_social_swagger_documentation_client.go @@ -0,0 +1,262 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package client + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/client/accounts" + "git.coopcloud.tech/decentral1se/gtslib/client/admin" + "git.coopcloud.tech/decentral1se/gtslib/client/apps" + "git.coopcloud.tech/decentral1se/gtslib/client/blocks" + "git.coopcloud.tech/decentral1se/gtslib/client/bookmarks" + "git.coopcloud.tech/decentral1se/gtslib/client/conversations" + "git.coopcloud.tech/decentral1se/gtslib/client/custom_emojis" + "git.coopcloud.tech/decentral1se/gtslib/client/debug" + "git.coopcloud.tech/decentral1se/gtslib/client/favourites" + "git.coopcloud.tech/decentral1se/gtslib/client/featured_tags" + "git.coopcloud.tech/decentral1se/gtslib/client/federation" + "git.coopcloud.tech/decentral1se/gtslib/client/filters" + "git.coopcloud.tech/decentral1se/gtslib/client/follow_requests" + "git.coopcloud.tech/decentral1se/gtslib/client/health" + "git.coopcloud.tech/decentral1se/gtslib/client/instance" + "git.coopcloud.tech/decentral1se/gtslib/client/interaction_policies" + "git.coopcloud.tech/decentral1se/gtslib/client/lists" + "git.coopcloud.tech/decentral1se/gtslib/client/markers" + "git.coopcloud.tech/decentral1se/gtslib/client/media" + "git.coopcloud.tech/decentral1se/gtslib/client/mutes" + "git.coopcloud.tech/decentral1se/gtslib/client/nodeinfo" + "git.coopcloud.tech/decentral1se/gtslib/client/notifications" + "git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known" + "git.coopcloud.tech/decentral1se/gtslib/client/polls" + "git.coopcloud.tech/decentral1se/gtslib/client/preferences" + "git.coopcloud.tech/decentral1se/gtslib/client/reports" + "git.coopcloud.tech/decentral1se/gtslib/client/search" + "git.coopcloud.tech/decentral1se/gtslib/client/statuses" + "git.coopcloud.tech/decentral1se/gtslib/client/streaming" + "git.coopcloud.tech/decentral1se/gtslib/client/timelines" + "git.coopcloud.tech/decentral1se/gtslib/client/user" +) + +// Default go to social swagger documentation HTTP client. +var Default = NewHTTPClient(nil) + +const ( + // DefaultHost is the default Host + // found in Meta (info) section of spec file + DefaultHost string = "example.org" + // DefaultBasePath is the default BasePath + // found in Meta (info) section of spec file + DefaultBasePath string = "/" +) + +// DefaultSchemes are the default schemes found in Meta (info) section of spec file +var DefaultSchemes = []string{"http", "https", "wss"} + +// NewHTTPClient creates a new go to social swagger documentation HTTP client. +func NewHTTPClient(formats strfmt.Registry) *GoToSocialSwaggerDocumentation { + return NewHTTPClientWithConfig(formats, nil) +} + +// NewHTTPClientWithConfig creates a new go to social swagger documentation HTTP client, +// using a customizable transport config. +func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *GoToSocialSwaggerDocumentation { + // ensure nullable parameters have default + if cfg == nil { + cfg = DefaultTransportConfig() + } + + // create transport and client + transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes) + return New(transport, formats) +} + +// New creates a new go to social swagger documentation client +func New(transport runtime.ClientTransport, formats strfmt.Registry) *GoToSocialSwaggerDocumentation { + // ensure nullable parameters have default + if formats == nil { + formats = strfmt.Default + } + + cli := new(GoToSocialSwaggerDocumentation) + cli.Transport = transport + cli.Accounts = accounts.New(transport, formats) + cli.Admin = admin.New(transport, formats) + cli.Apps = apps.New(transport, formats) + cli.Blocks = blocks.New(transport, formats) + cli.Bookmarks = bookmarks.New(transport, formats) + cli.Conversations = conversations.New(transport, formats) + cli.CustomEmojis = custom_emojis.New(transport, formats) + cli.Debug = debug.New(transport, formats) + cli.Favourites = favourites.New(transport, formats) + cli.FeaturedTags = featured_tags.New(transport, formats) + cli.Federation = federation.New(transport, formats) + cli.Filters = filters.New(transport, formats) + cli.FollowRequests = follow_requests.New(transport, formats) + cli.Health = health.New(transport, formats) + cli.Instance = instance.New(transport, formats) + cli.InteractionPolicies = interaction_policies.New(transport, formats) + cli.Lists = lists.New(transport, formats) + cli.Markers = markers.New(transport, formats) + cli.Media = media.New(transport, formats) + cli.Mutes = mutes.New(transport, formats) + cli.Nodeinfo = nodeinfo.New(transport, formats) + cli.Notifications = notifications.New(transport, formats) + cli.NrWellKnown = nr_well_known.New(transport, formats) + cli.Polls = polls.New(transport, formats) + cli.Preferences = preferences.New(transport, formats) + cli.Reports = reports.New(transport, formats) + cli.Search = search.New(transport, formats) + cli.Statuses = statuses.New(transport, formats) + cli.Streaming = streaming.New(transport, formats) + cli.Timelines = timelines.New(transport, formats) + cli.User = user.New(transport, formats) + return cli +} + +// DefaultTransportConfig creates a TransportConfig with the +// default settings taken from the meta section of the spec file. +func DefaultTransportConfig() *TransportConfig { + return &TransportConfig{ + Host: DefaultHost, + BasePath: DefaultBasePath, + Schemes: DefaultSchemes, + } +} + +// TransportConfig contains the transport related info, +// found in the meta section of the spec file. +type TransportConfig struct { + Host string + BasePath string + Schemes []string +} + +// WithHost overrides the default host, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithHost(host string) *TransportConfig { + cfg.Host = host + return cfg +} + +// WithBasePath overrides the default basePath, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig { + cfg.BasePath = basePath + return cfg +} + +// WithSchemes overrides the default schemes, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { + cfg.Schemes = schemes + return cfg +} + +// GoToSocialSwaggerDocumentation is a client for go to social swagger documentation +type GoToSocialSwaggerDocumentation struct { + Accounts accounts.ClientService + + Admin admin.ClientService + + Apps apps.ClientService + + Blocks blocks.ClientService + + Bookmarks bookmarks.ClientService + + Conversations conversations.ClientService + + CustomEmojis custom_emojis.ClientService + + Debug debug.ClientService + + Favourites favourites.ClientService + + FeaturedTags featured_tags.ClientService + + Federation federation.ClientService + + Filters filters.ClientService + + FollowRequests follow_requests.ClientService + + Health health.ClientService + + Instance instance.ClientService + + InteractionPolicies interaction_policies.ClientService + + Lists lists.ClientService + + Markers markers.ClientService + + Media media.ClientService + + Mutes mutes.ClientService + + Nodeinfo nodeinfo.ClientService + + Notifications notifications.ClientService + + NrWellKnown nr_well_known.ClientService + + Polls polls.ClientService + + Preferences preferences.ClientService + + Reports reports.ClientService + + Search search.ClientService + + Statuses statuses.ClientService + + Streaming streaming.ClientService + + Timelines timelines.ClientService + + User user.ClientService + + Transport runtime.ClientTransport +} + +// SetTransport changes the transport on the client and all its subresources +func (c *GoToSocialSwaggerDocumentation) SetTransport(transport runtime.ClientTransport) { + c.Transport = transport + c.Accounts.SetTransport(transport) + c.Admin.SetTransport(transport) + c.Apps.SetTransport(transport) + c.Blocks.SetTransport(transport) + c.Bookmarks.SetTransport(transport) + c.Conversations.SetTransport(transport) + c.CustomEmojis.SetTransport(transport) + c.Debug.SetTransport(transport) + c.Favourites.SetTransport(transport) + c.FeaturedTags.SetTransport(transport) + c.Federation.SetTransport(transport) + c.Filters.SetTransport(transport) + c.FollowRequests.SetTransport(transport) + c.Health.SetTransport(transport) + c.Instance.SetTransport(transport) + c.InteractionPolicies.SetTransport(transport) + c.Lists.SetTransport(transport) + c.Markers.SetTransport(transport) + c.Media.SetTransport(transport) + c.Mutes.SetTransport(transport) + c.Nodeinfo.SetTransport(transport) + c.Notifications.SetTransport(transport) + c.NrWellKnown.SetTransport(transport) + c.Polls.SetTransport(transport) + c.Preferences.SetTransport(transport) + c.Reports.SetTransport(transport) + c.Search.SetTransport(transport) + c.Statuses.SetTransport(transport) + c.Streaming.SetTransport(transport) + c.Timelines.SetTransport(transport) + c.User.SetTransport(transport) +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/health_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/health_client.go new file mode 100644 index 0000000..34e569c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/health_client.go @@ -0,0 +1,229 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new health API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new health API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new health API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for health API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + LiveGet(params *LiveGetParams, opts ...ClientOption) (*LiveGetOK, error) + + LiveHead(params *LiveHeadParams, opts ...ClientOption) (*LiveHeadOK, error) + + ReadyGet(params *ReadyGetParams, opts ...ClientOption) (*ReadyGetOK, error) + + ReadyHead(params *ReadyHeadParams, opts ...ClientOption) (*ReadyHeadOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +LiveGet returns code 200 with no body if go to social is live ie able to respond to HTTP requests +*/ +func (a *Client) LiveGet(params *LiveGetParams, opts ...ClientOption) (*LiveGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewLiveGetParams() + } + op := &runtime.ClientOperation{ + ID: "liveGet", + Method: "GET", + PathPattern: "/livez", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &LiveGetReader{formats: a.formats}, + 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.(*LiveGetOK) + 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 liveGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +LiveHead returns code 200 if go to social is live ie able to respond to HTTP requests +*/ +func (a *Client) LiveHead(params *LiveHeadParams, opts ...ClientOption) (*LiveHeadOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewLiveHeadParams() + } + op := &runtime.ClientOperation{ + ID: "liveHead", + Method: "HEAD", + PathPattern: "/livez", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &LiveHeadReader{formats: a.formats}, + 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.(*LiveHeadOK) + 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 liveHead: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +ReadyGet returns code 200 with no body if go to social is ready ie able to connect to the database backend and do a simple s e l e c t + +If GtS is not ready, 500 Internal Error will be returned, and an error will be logged (but not returned to the caller, to avoid leaking internals). +*/ +func (a *Client) ReadyGet(params *ReadyGetParams, opts ...ClientOption) (*ReadyGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewReadyGetParams() + } + op := &runtime.ClientOperation{ + ID: "readyGet", + Method: "GET", + PathPattern: "/readyz", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ReadyGetReader{formats: a.formats}, + 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.(*ReadyGetOK) + 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 readyGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +ReadyHead returns code 200 with no body if go to social is ready ie able to connect to the database backend and do a simple s e l e c t + +If GtS is not ready, 500 Internal Error will be returned, and an error will be logged (but not returned to the caller, to avoid leaking internals). +*/ +func (a *Client) ReadyHead(params *ReadyHeadParams, opts ...ClientOption) (*ReadyHeadOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewReadyHeadParams() + } + op := &runtime.ClientOperation{ + ID: "readyHead", + Method: "HEAD", + PathPattern: "/readyz", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ReadyHeadReader{formats: a.formats}, + 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.(*ReadyHeadOK) + 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 readyHead: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/live_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/live_get_parameters.go new file mode 100644 index 0000000..6961e6b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/live_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// 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" +) + +// NewLiveGetParams creates a new LiveGetParams 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 NewLiveGetParams() *LiveGetParams { + return &LiveGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewLiveGetParamsWithTimeout creates a new LiveGetParams object +// with the ability to set a timeout on a request. +func NewLiveGetParamsWithTimeout(timeout time.Duration) *LiveGetParams { + return &LiveGetParams{ + timeout: timeout, + } +} + +// NewLiveGetParamsWithContext creates a new LiveGetParams object +// with the ability to set a context for a request. +func NewLiveGetParamsWithContext(ctx context.Context) *LiveGetParams { + return &LiveGetParams{ + Context: ctx, + } +} + +// NewLiveGetParamsWithHTTPClient creates a new LiveGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewLiveGetParamsWithHTTPClient(client *http.Client) *LiveGetParams { + return &LiveGetParams{ + HTTPClient: client, + } +} + +/* +LiveGetParams contains all the parameters to send to the API endpoint + + for the live get operation. + + Typically these are written to a http.Request. +*/ +type LiveGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the live get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *LiveGetParams) WithDefaults() *LiveGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the live get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *LiveGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the live get params +func (o *LiveGetParams) WithTimeout(timeout time.Duration) *LiveGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the live get params +func (o *LiveGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the live get params +func (o *LiveGetParams) WithContext(ctx context.Context) *LiveGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the live get params +func (o *LiveGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the live get params +func (o *LiveGetParams) WithHTTPClient(client *http.Client) *LiveGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the live get params +func (o *LiveGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *LiveGetParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/live_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/live_get_responses.go new file mode 100644 index 0000000..c6a54da --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/live_get_responses.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// 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" +) + +// LiveGetReader is a Reader for the LiveGet structure. +type LiveGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *LiveGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewLiveGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /livez] liveGet", response, response.Code()) + } +} + +// NewLiveGetOK creates a LiveGetOK with default headers values +func NewLiveGetOK() *LiveGetOK { + return &LiveGetOK{} +} + +/* +LiveGetOK describes a response with status code 200, with default header values. + +OK +*/ +type LiveGetOK struct { +} + +// IsSuccess returns true when this live get o k response has a 2xx status code +func (o *LiveGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this live get o k response has a 3xx status code +func (o *LiveGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this live get o k response has a 4xx status code +func (o *LiveGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this live get o k response has a 5xx status code +func (o *LiveGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this live get o k response a status code equal to that given +func (o *LiveGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the live get o k response +func (o *LiveGetOK) Code() int { + return 200 +} + +func (o *LiveGetOK) Error() string { + return fmt.Sprintf("[GET /livez][%d] liveGetOK", 200) +} + +func (o *LiveGetOK) String() string { + return fmt.Sprintf("[GET /livez][%d] liveGetOK", 200) +} + +func (o *LiveGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/live_head_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/live_head_parameters.go new file mode 100644 index 0000000..7129dec --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/live_head_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// 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" +) + +// NewLiveHeadParams creates a new LiveHeadParams 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 NewLiveHeadParams() *LiveHeadParams { + return &LiveHeadParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewLiveHeadParamsWithTimeout creates a new LiveHeadParams object +// with the ability to set a timeout on a request. +func NewLiveHeadParamsWithTimeout(timeout time.Duration) *LiveHeadParams { + return &LiveHeadParams{ + timeout: timeout, + } +} + +// NewLiveHeadParamsWithContext creates a new LiveHeadParams object +// with the ability to set a context for a request. +func NewLiveHeadParamsWithContext(ctx context.Context) *LiveHeadParams { + return &LiveHeadParams{ + Context: ctx, + } +} + +// NewLiveHeadParamsWithHTTPClient creates a new LiveHeadParams object +// with the ability to set a custom HTTPClient for a request. +func NewLiveHeadParamsWithHTTPClient(client *http.Client) *LiveHeadParams { + return &LiveHeadParams{ + HTTPClient: client, + } +} + +/* +LiveHeadParams contains all the parameters to send to the API endpoint + + for the live head operation. + + Typically these are written to a http.Request. +*/ +type LiveHeadParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the live head params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *LiveHeadParams) WithDefaults() *LiveHeadParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the live head params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *LiveHeadParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the live head params +func (o *LiveHeadParams) WithTimeout(timeout time.Duration) *LiveHeadParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the live head params +func (o *LiveHeadParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the live head params +func (o *LiveHeadParams) WithContext(ctx context.Context) *LiveHeadParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the live head params +func (o *LiveHeadParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the live head params +func (o *LiveHeadParams) WithHTTPClient(client *http.Client) *LiveHeadParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the live head params +func (o *LiveHeadParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *LiveHeadParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/live_head_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/live_head_responses.go new file mode 100644 index 0000000..b85cb27 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/live_head_responses.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// 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" +) + +// LiveHeadReader is a Reader for the LiveHead structure. +type LiveHeadReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *LiveHeadReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewLiveHeadOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /livez] liveHead", response, response.Code()) + } +} + +// NewLiveHeadOK creates a LiveHeadOK with default headers values +func NewLiveHeadOK() *LiveHeadOK { + return &LiveHeadOK{} +} + +/* +LiveHeadOK describes a response with status code 200, with default header values. + +OK +*/ +type LiveHeadOK struct { +} + +// IsSuccess returns true when this live head o k response has a 2xx status code +func (o *LiveHeadOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this live head o k response has a 3xx status code +func (o *LiveHeadOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this live head o k response has a 4xx status code +func (o *LiveHeadOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this live head o k response has a 5xx status code +func (o *LiveHeadOK) IsServerError() bool { + return false +} + +// IsCode returns true when this live head o k response a status code equal to that given +func (o *LiveHeadOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the live head o k response +func (o *LiveHeadOK) Code() int { + return 200 +} + +func (o *LiveHeadOK) Error() string { + return fmt.Sprintf("[HEAD /livez][%d] liveHeadOK", 200) +} + +func (o *LiveHeadOK) String() string { + return fmt.Sprintf("[HEAD /livez][%d] liveHeadOK", 200) +} + +func (o *LiveHeadOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/ready_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/ready_get_parameters.go new file mode 100644 index 0000000..bc847dc --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/ready_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// 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" +) + +// NewReadyGetParams creates a new ReadyGetParams 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 NewReadyGetParams() *ReadyGetParams { + return &ReadyGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewReadyGetParamsWithTimeout creates a new ReadyGetParams object +// with the ability to set a timeout on a request. +func NewReadyGetParamsWithTimeout(timeout time.Duration) *ReadyGetParams { + return &ReadyGetParams{ + timeout: timeout, + } +} + +// NewReadyGetParamsWithContext creates a new ReadyGetParams object +// with the ability to set a context for a request. +func NewReadyGetParamsWithContext(ctx context.Context) *ReadyGetParams { + return &ReadyGetParams{ + Context: ctx, + } +} + +// NewReadyGetParamsWithHTTPClient creates a new ReadyGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewReadyGetParamsWithHTTPClient(client *http.Client) *ReadyGetParams { + return &ReadyGetParams{ + HTTPClient: client, + } +} + +/* +ReadyGetParams contains all the parameters to send to the API endpoint + + for the ready get operation. + + Typically these are written to a http.Request. +*/ +type ReadyGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the ready get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ReadyGetParams) WithDefaults() *ReadyGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the ready get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ReadyGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the ready get params +func (o *ReadyGetParams) WithTimeout(timeout time.Duration) *ReadyGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the ready get params +func (o *ReadyGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the ready get params +func (o *ReadyGetParams) WithContext(ctx context.Context) *ReadyGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the ready get params +func (o *ReadyGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the ready get params +func (o *ReadyGetParams) WithHTTPClient(client *http.Client) *ReadyGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the ready get params +func (o *ReadyGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ReadyGetParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/ready_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/ready_get_responses.go new file mode 100644 index 0000000..a1cfd76 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/ready_get_responses.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// 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" +) + +// ReadyGetReader is a Reader for the ReadyGet structure. +type ReadyGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ReadyGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewReadyGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 500: + result := NewReadyGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /readyz] readyGet", response, response.Code()) + } +} + +// NewReadyGetOK creates a ReadyGetOK with default headers values +func NewReadyGetOK() *ReadyGetOK { + return &ReadyGetOK{} +} + +/* +ReadyGetOK describes a response with status code 200, with default header values. + +OK +*/ +type ReadyGetOK struct { +} + +// IsSuccess returns true when this ready get o k response has a 2xx status code +func (o *ReadyGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this ready get o k response has a 3xx status code +func (o *ReadyGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this ready get o k response has a 4xx status code +func (o *ReadyGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this ready get o k response has a 5xx status code +func (o *ReadyGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this ready get o k response a status code equal to that given +func (o *ReadyGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the ready get o k response +func (o *ReadyGetOK) Code() int { + return 200 +} + +func (o *ReadyGetOK) Error() string { + return fmt.Sprintf("[GET /readyz][%d] readyGetOK", 200) +} + +func (o *ReadyGetOK) String() string { + return fmt.Sprintf("[GET /readyz][%d] readyGetOK", 200) +} + +func (o *ReadyGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReadyGetInternalServerError creates a ReadyGetInternalServerError with default headers values +func NewReadyGetInternalServerError() *ReadyGetInternalServerError { + return &ReadyGetInternalServerError{} +} + +/* +ReadyGetInternalServerError describes a response with status code 500, with default header values. + +Not ready. Check logs for error message. +*/ +type ReadyGetInternalServerError struct { +} + +// IsSuccess returns true when this ready get internal server error response has a 2xx status code +func (o *ReadyGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this ready get internal server error response has a 3xx status code +func (o *ReadyGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this ready get internal server error response has a 4xx status code +func (o *ReadyGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this ready get internal server error response has a 5xx status code +func (o *ReadyGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this ready get internal server error response a status code equal to that given +func (o *ReadyGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the ready get internal server error response +func (o *ReadyGetInternalServerError) Code() int { + return 500 +} + +func (o *ReadyGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /readyz][%d] readyGetInternalServerError", 500) +} + +func (o *ReadyGetInternalServerError) String() string { + return fmt.Sprintf("[GET /readyz][%d] readyGetInternalServerError", 500) +} + +func (o *ReadyGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/ready_head_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/ready_head_parameters.go new file mode 100644 index 0000000..2469cc5 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/ready_head_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// 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" +) + +// NewReadyHeadParams creates a new ReadyHeadParams 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 NewReadyHeadParams() *ReadyHeadParams { + return &ReadyHeadParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewReadyHeadParamsWithTimeout creates a new ReadyHeadParams object +// with the ability to set a timeout on a request. +func NewReadyHeadParamsWithTimeout(timeout time.Duration) *ReadyHeadParams { + return &ReadyHeadParams{ + timeout: timeout, + } +} + +// NewReadyHeadParamsWithContext creates a new ReadyHeadParams object +// with the ability to set a context for a request. +func NewReadyHeadParamsWithContext(ctx context.Context) *ReadyHeadParams { + return &ReadyHeadParams{ + Context: ctx, + } +} + +// NewReadyHeadParamsWithHTTPClient creates a new ReadyHeadParams object +// with the ability to set a custom HTTPClient for a request. +func NewReadyHeadParamsWithHTTPClient(client *http.Client) *ReadyHeadParams { + return &ReadyHeadParams{ + HTTPClient: client, + } +} + +/* +ReadyHeadParams contains all the parameters to send to the API endpoint + + for the ready head operation. + + Typically these are written to a http.Request. +*/ +type ReadyHeadParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the ready head params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ReadyHeadParams) WithDefaults() *ReadyHeadParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the ready head params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ReadyHeadParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the ready head params +func (o *ReadyHeadParams) WithTimeout(timeout time.Duration) *ReadyHeadParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the ready head params +func (o *ReadyHeadParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the ready head params +func (o *ReadyHeadParams) WithContext(ctx context.Context) *ReadyHeadParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the ready head params +func (o *ReadyHeadParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the ready head params +func (o *ReadyHeadParams) WithHTTPClient(client *http.Client) *ReadyHeadParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the ready head params +func (o *ReadyHeadParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ReadyHeadParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/ready_head_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/ready_head_responses.go new file mode 100644 index 0000000..30e9d2e --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/health/ready_head_responses.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// 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" +) + +// ReadyHeadReader is a Reader for the ReadyHead structure. +type ReadyHeadReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ReadyHeadReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewReadyHeadOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /readyz] readyHead", response, response.Code()) + } +} + +// NewReadyHeadOK creates a ReadyHeadOK with default headers values +func NewReadyHeadOK() *ReadyHeadOK { + return &ReadyHeadOK{} +} + +/* +ReadyHeadOK describes a response with status code 200, with default header values. + +OK +*/ +type ReadyHeadOK struct { +} + +// IsSuccess returns true when this ready head o k response has a 2xx status code +func (o *ReadyHeadOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this ready head o k response has a 3xx status code +func (o *ReadyHeadOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this ready head o k response has a 4xx status code +func (o *ReadyHeadOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this ready head o k response has a 5xx status code +func (o *ReadyHeadOK) IsServerError() bool { + return false +} + +// IsCode returns true when this ready head o k response a status code equal to that given +func (o *ReadyHeadOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the ready head o k response +func (o *ReadyHeadOK) Code() int { + return 200 +} + +func (o *ReadyHeadOK) Error() string { + return fmt.Sprintf("[HEAD /readyz][%d] readyHeadOK", 200) +} + +func (o *ReadyHeadOK) String() string { + return fmt.Sprintf("[HEAD /readyz][%d] readyHeadOK", 200) +} + +func (o *ReadyHeadOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_client.go new file mode 100644 index 0000000..9bcbbc6 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_client.go @@ -0,0 +1,294 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new instance API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new instance API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new instance API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for instance API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeMultipartFormData sets the Content-Type header to "multipart/form-data". +func WithContentTypeMultipartFormData(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"multipart/form-data"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + InstanceGetV1(params *InstanceGetV1Params, opts ...ClientOption) (*InstanceGetV1OK, error) + + InstanceGetV2(params *InstanceGetV2Params, opts ...ClientOption) (*InstanceGetV2OK, error) + + InstancePeersGet(params *InstancePeersGetParams, opts ...ClientOption) (*InstancePeersGetOK, error) + + InstanceUpdate(params *InstanceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InstanceUpdateOK, error) + + Rules(params *RulesParams, opts ...ClientOption) (*RulesOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +InstanceGetV1 views instance information +*/ +func (a *Client) InstanceGetV1(params *InstanceGetV1Params, opts ...ClientOption) (*InstanceGetV1OK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInstanceGetV1Params() + } + op := &runtime.ClientOperation{ + ID: "instanceGetV1", + Method: "GET", + PathPattern: "/api/v1/instance", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &InstanceGetV1Reader{formats: a.formats}, + 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.(*InstanceGetV1OK) + 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 instanceGetV1: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +InstanceGetV2 views instance information +*/ +func (a *Client) InstanceGetV2(params *InstanceGetV2Params, opts ...ClientOption) (*InstanceGetV2OK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInstanceGetV2Params() + } + op := &runtime.ClientOperation{ + ID: "instanceGetV2", + Method: "GET", + PathPattern: "/api/v2/instance", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &InstanceGetV2Reader{formats: a.formats}, + 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.(*InstanceGetV2OK) + 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 instanceGetV2: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +InstancePeersGet instance peers get API +*/ +func (a *Client) InstancePeersGet(params *InstancePeersGetParams, opts ...ClientOption) (*InstancePeersGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInstancePeersGetParams() + } + op := &runtime.ClientOperation{ + ID: "instancePeersGet", + Method: "GET", + PathPattern: "/api/v1/instance/peers", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &InstancePeersGetReader{formats: a.formats}, + 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.(*InstancePeersGetOK) + 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 instancePeersGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +InstanceUpdate updates your instance information and or upload a new avatar header for the instance + +This requires admin permissions on the instance. +*/ +func (a *Client) InstanceUpdate(params *InstanceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InstanceUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInstanceUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "instanceUpdate", + Method: "PATCH", + PathPattern: "/api/v1/instance", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &InstanceUpdateReader{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.(*InstanceUpdateOK) + 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 instanceUpdate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +Rules views instance rules public + +The rules will be returned in order (sorted by Order ascending). +*/ +func (a *Client) Rules(params *RulesParams, opts ...ClientOption) (*RulesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewRulesParams() + } + op := &runtime.ClientOperation{ + ID: "rules", + Method: "GET", + PathPattern: "/api/v1/instance/rules", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &RulesReader{formats: a.formats}, + 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.(*RulesOK) + 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 rules: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_get_v1_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_get_v1_parameters.go new file mode 100644 index 0000000..4124b6a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_get_v1_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// 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" +) + +// NewInstanceGetV1Params creates a new InstanceGetV1Params 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 NewInstanceGetV1Params() *InstanceGetV1Params { + return &InstanceGetV1Params{ + timeout: cr.DefaultTimeout, + } +} + +// NewInstanceGetV1ParamsWithTimeout creates a new InstanceGetV1Params object +// with the ability to set a timeout on a request. +func NewInstanceGetV1ParamsWithTimeout(timeout time.Duration) *InstanceGetV1Params { + return &InstanceGetV1Params{ + timeout: timeout, + } +} + +// NewInstanceGetV1ParamsWithContext creates a new InstanceGetV1Params object +// with the ability to set a context for a request. +func NewInstanceGetV1ParamsWithContext(ctx context.Context) *InstanceGetV1Params { + return &InstanceGetV1Params{ + Context: ctx, + } +} + +// NewInstanceGetV1ParamsWithHTTPClient creates a new InstanceGetV1Params object +// with the ability to set a custom HTTPClient for a request. +func NewInstanceGetV1ParamsWithHTTPClient(client *http.Client) *InstanceGetV1Params { + return &InstanceGetV1Params{ + HTTPClient: client, + } +} + +/* +InstanceGetV1Params contains all the parameters to send to the API endpoint + + for the instance get v1 operation. + + Typically these are written to a http.Request. +*/ +type InstanceGetV1Params struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the instance get v1 params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InstanceGetV1Params) WithDefaults() *InstanceGetV1Params { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the instance get v1 params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InstanceGetV1Params) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the instance get v1 params +func (o *InstanceGetV1Params) WithTimeout(timeout time.Duration) *InstanceGetV1Params { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the instance get v1 params +func (o *InstanceGetV1Params) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the instance get v1 params +func (o *InstanceGetV1Params) WithContext(ctx context.Context) *InstanceGetV1Params { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the instance get v1 params +func (o *InstanceGetV1Params) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the instance get v1 params +func (o *InstanceGetV1Params) WithHTTPClient(client *http.Client) *InstanceGetV1Params { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the instance get v1 params +func (o *InstanceGetV1Params) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *InstanceGetV1Params) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_get_v1_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_get_v1_responses.go new file mode 100644 index 0000000..b8b0e8a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_get_v1_responses.go @@ -0,0 +1,230 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// InstanceGetV1Reader is a Reader for the InstanceGetV1 structure. +type InstanceGetV1Reader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InstanceGetV1Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInstanceGetV1OK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 406: + result := NewInstanceGetV1NotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewInstanceGetV1InternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/instance] instanceGetV1", response, response.Code()) + } +} + +// NewInstanceGetV1OK creates a InstanceGetV1OK with default headers values +func NewInstanceGetV1OK() *InstanceGetV1OK { + return &InstanceGetV1OK{} +} + +/* +InstanceGetV1OK describes a response with status code 200, with default header values. + +Instance information. +*/ +type InstanceGetV1OK struct { + Payload *models.InstanceV1 +} + +// IsSuccess returns true when this instance get v1 o k response has a 2xx status code +func (o *InstanceGetV1OK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this instance get v1 o k response has a 3xx status code +func (o *InstanceGetV1OK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance get v1 o k response has a 4xx status code +func (o *InstanceGetV1OK) IsClientError() bool { + return false +} + +// IsServerError returns true when this instance get v1 o k response has a 5xx status code +func (o *InstanceGetV1OK) IsServerError() bool { + return false +} + +// IsCode returns true when this instance get v1 o k response a status code equal to that given +func (o *InstanceGetV1OK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the instance get v1 o k response +func (o *InstanceGetV1OK) Code() int { + return 200 +} + +func (o *InstanceGetV1OK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/instance][%d] instanceGetV1OK %s", 200, payload) +} + +func (o *InstanceGetV1OK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/instance][%d] instanceGetV1OK %s", 200, payload) +} + +func (o *InstanceGetV1OK) GetPayload() *models.InstanceV1 { + return o.Payload +} + +func (o *InstanceGetV1OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.InstanceV1) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewInstanceGetV1NotAcceptable creates a InstanceGetV1NotAcceptable with default headers values +func NewInstanceGetV1NotAcceptable() *InstanceGetV1NotAcceptable { + return &InstanceGetV1NotAcceptable{} +} + +/* +InstanceGetV1NotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type InstanceGetV1NotAcceptable struct { +} + +// IsSuccess returns true when this instance get v1 not acceptable response has a 2xx status code +func (o *InstanceGetV1NotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance get v1 not acceptable response has a 3xx status code +func (o *InstanceGetV1NotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance get v1 not acceptable response has a 4xx status code +func (o *InstanceGetV1NotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance get v1 not acceptable response has a 5xx status code +func (o *InstanceGetV1NotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this instance get v1 not acceptable response a status code equal to that given +func (o *InstanceGetV1NotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the instance get v1 not acceptable response +func (o *InstanceGetV1NotAcceptable) Code() int { + return 406 +} + +func (o *InstanceGetV1NotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/instance][%d] instanceGetV1NotAcceptable", 406) +} + +func (o *InstanceGetV1NotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/instance][%d] instanceGetV1NotAcceptable", 406) +} + +func (o *InstanceGetV1NotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstanceGetV1InternalServerError creates a InstanceGetV1InternalServerError with default headers values +func NewInstanceGetV1InternalServerError() *InstanceGetV1InternalServerError { + return &InstanceGetV1InternalServerError{} +} + +/* +InstanceGetV1InternalServerError describes a response with status code 500, with default header values. + +internal error +*/ +type InstanceGetV1InternalServerError struct { +} + +// IsSuccess returns true when this instance get v1 internal server error response has a 2xx status code +func (o *InstanceGetV1InternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance get v1 internal server error response has a 3xx status code +func (o *InstanceGetV1InternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance get v1 internal server error response has a 4xx status code +func (o *InstanceGetV1InternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this instance get v1 internal server error response has a 5xx status code +func (o *InstanceGetV1InternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this instance get v1 internal server error response a status code equal to that given +func (o *InstanceGetV1InternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the instance get v1 internal server error response +func (o *InstanceGetV1InternalServerError) Code() int { + return 500 +} + +func (o *InstanceGetV1InternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/instance][%d] instanceGetV1InternalServerError", 500) +} + +func (o *InstanceGetV1InternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/instance][%d] instanceGetV1InternalServerError", 500) +} + +func (o *InstanceGetV1InternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_get_v2_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_get_v2_parameters.go new file mode 100644 index 0000000..140d7cb --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_get_v2_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// 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" +) + +// NewInstanceGetV2Params creates a new InstanceGetV2Params 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 NewInstanceGetV2Params() *InstanceGetV2Params { + return &InstanceGetV2Params{ + timeout: cr.DefaultTimeout, + } +} + +// NewInstanceGetV2ParamsWithTimeout creates a new InstanceGetV2Params object +// with the ability to set a timeout on a request. +func NewInstanceGetV2ParamsWithTimeout(timeout time.Duration) *InstanceGetV2Params { + return &InstanceGetV2Params{ + timeout: timeout, + } +} + +// NewInstanceGetV2ParamsWithContext creates a new InstanceGetV2Params object +// with the ability to set a context for a request. +func NewInstanceGetV2ParamsWithContext(ctx context.Context) *InstanceGetV2Params { + return &InstanceGetV2Params{ + Context: ctx, + } +} + +// NewInstanceGetV2ParamsWithHTTPClient creates a new InstanceGetV2Params object +// with the ability to set a custom HTTPClient for a request. +func NewInstanceGetV2ParamsWithHTTPClient(client *http.Client) *InstanceGetV2Params { + return &InstanceGetV2Params{ + HTTPClient: client, + } +} + +/* +InstanceGetV2Params contains all the parameters to send to the API endpoint + + for the instance get v2 operation. + + Typically these are written to a http.Request. +*/ +type InstanceGetV2Params struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the instance get v2 params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InstanceGetV2Params) WithDefaults() *InstanceGetV2Params { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the instance get v2 params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InstanceGetV2Params) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the instance get v2 params +func (o *InstanceGetV2Params) WithTimeout(timeout time.Duration) *InstanceGetV2Params { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the instance get v2 params +func (o *InstanceGetV2Params) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the instance get v2 params +func (o *InstanceGetV2Params) WithContext(ctx context.Context) *InstanceGetV2Params { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the instance get v2 params +func (o *InstanceGetV2Params) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the instance get v2 params +func (o *InstanceGetV2Params) WithHTTPClient(client *http.Client) *InstanceGetV2Params { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the instance get v2 params +func (o *InstanceGetV2Params) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *InstanceGetV2Params) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_get_v2_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_get_v2_responses.go new file mode 100644 index 0000000..6edaaca --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_get_v2_responses.go @@ -0,0 +1,230 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// InstanceGetV2Reader is a Reader for the InstanceGetV2 structure. +type InstanceGetV2Reader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InstanceGetV2Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInstanceGetV2OK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 406: + result := NewInstanceGetV2NotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewInstanceGetV2InternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v2/instance] instanceGetV2", response, response.Code()) + } +} + +// NewInstanceGetV2OK creates a InstanceGetV2OK with default headers values +func NewInstanceGetV2OK() *InstanceGetV2OK { + return &InstanceGetV2OK{} +} + +/* +InstanceGetV2OK describes a response with status code 200, with default header values. + +Instance information. +*/ +type InstanceGetV2OK struct { + Payload *models.InstanceV2 +} + +// IsSuccess returns true when this instance get v2 o k response has a 2xx status code +func (o *InstanceGetV2OK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this instance get v2 o k response has a 3xx status code +func (o *InstanceGetV2OK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance get v2 o k response has a 4xx status code +func (o *InstanceGetV2OK) IsClientError() bool { + return false +} + +// IsServerError returns true when this instance get v2 o k response has a 5xx status code +func (o *InstanceGetV2OK) IsServerError() bool { + return false +} + +// IsCode returns true when this instance get v2 o k response a status code equal to that given +func (o *InstanceGetV2OK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the instance get v2 o k response +func (o *InstanceGetV2OK) Code() int { + return 200 +} + +func (o *InstanceGetV2OK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/instance][%d] instanceGetV2OK %s", 200, payload) +} + +func (o *InstanceGetV2OK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/instance][%d] instanceGetV2OK %s", 200, payload) +} + +func (o *InstanceGetV2OK) GetPayload() *models.InstanceV2 { + return o.Payload +} + +func (o *InstanceGetV2OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.InstanceV2) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewInstanceGetV2NotAcceptable creates a InstanceGetV2NotAcceptable with default headers values +func NewInstanceGetV2NotAcceptable() *InstanceGetV2NotAcceptable { + return &InstanceGetV2NotAcceptable{} +} + +/* +InstanceGetV2NotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type InstanceGetV2NotAcceptable struct { +} + +// IsSuccess returns true when this instance get v2 not acceptable response has a 2xx status code +func (o *InstanceGetV2NotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance get v2 not acceptable response has a 3xx status code +func (o *InstanceGetV2NotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance get v2 not acceptable response has a 4xx status code +func (o *InstanceGetV2NotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance get v2 not acceptable response has a 5xx status code +func (o *InstanceGetV2NotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this instance get v2 not acceptable response a status code equal to that given +func (o *InstanceGetV2NotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the instance get v2 not acceptable response +func (o *InstanceGetV2NotAcceptable) Code() int { + return 406 +} + +func (o *InstanceGetV2NotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v2/instance][%d] instanceGetV2NotAcceptable", 406) +} + +func (o *InstanceGetV2NotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v2/instance][%d] instanceGetV2NotAcceptable", 406) +} + +func (o *InstanceGetV2NotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstanceGetV2InternalServerError creates a InstanceGetV2InternalServerError with default headers values +func NewInstanceGetV2InternalServerError() *InstanceGetV2InternalServerError { + return &InstanceGetV2InternalServerError{} +} + +/* +InstanceGetV2InternalServerError describes a response with status code 500, with default header values. + +internal error +*/ +type InstanceGetV2InternalServerError struct { +} + +// IsSuccess returns true when this instance get v2 internal server error response has a 2xx status code +func (o *InstanceGetV2InternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance get v2 internal server error response has a 3xx status code +func (o *InstanceGetV2InternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance get v2 internal server error response has a 4xx status code +func (o *InstanceGetV2InternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this instance get v2 internal server error response has a 5xx status code +func (o *InstanceGetV2InternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this instance get v2 internal server error response a status code equal to that given +func (o *InstanceGetV2InternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the instance get v2 internal server error response +func (o *InstanceGetV2InternalServerError) Code() int { + return 500 +} + +func (o *InstanceGetV2InternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v2/instance][%d] instanceGetV2InternalServerError", 500) +} + +func (o *InstanceGetV2InternalServerError) String() string { + return fmt.Sprintf("[GET /api/v2/instance][%d] instanceGetV2InternalServerError", 500) +} + +func (o *InstanceGetV2InternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_peers_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_peers_get_parameters.go new file mode 100644 index 0000000..9048ab1 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_peers_get_parameters.go @@ -0,0 +1,186 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// 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" +) + +// NewInstancePeersGetParams creates a new InstancePeersGetParams 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 NewInstancePeersGetParams() *InstancePeersGetParams { + return &InstancePeersGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewInstancePeersGetParamsWithTimeout creates a new InstancePeersGetParams object +// with the ability to set a timeout on a request. +func NewInstancePeersGetParamsWithTimeout(timeout time.Duration) *InstancePeersGetParams { + return &InstancePeersGetParams{ + timeout: timeout, + } +} + +// NewInstancePeersGetParamsWithContext creates a new InstancePeersGetParams object +// with the ability to set a context for a request. +func NewInstancePeersGetParamsWithContext(ctx context.Context) *InstancePeersGetParams { + return &InstancePeersGetParams{ + Context: ctx, + } +} + +// NewInstancePeersGetParamsWithHTTPClient creates a new InstancePeersGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewInstancePeersGetParamsWithHTTPClient(client *http.Client) *InstancePeersGetParams { + return &InstancePeersGetParams{ + HTTPClient: client, + } +} + +/* +InstancePeersGetParams contains all the parameters to send to the API endpoint + + for the instance peers get operation. + + Typically these are written to a http.Request. +*/ +type InstancePeersGetParams struct { + + /* Filter. + + Comma-separated list of filters to apply to results. Recognized filters are: + - `open` -- include peers that are not suspended or silenced + - `suspended` -- include peers that have been suspended. + + If filter is `open`, only instances that haven't been suspended or silenced will be returned. + + If filter is `suspended`, only suspended instances will be shown. + + If filter is `open,suspended`, then all known instances will be returned. + + If filter is an empty string or not set, then `open` will be assumed as the default. + + Default: "open" + */ + Filter *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the instance peers get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InstancePeersGetParams) WithDefaults() *InstancePeersGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the instance peers get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InstancePeersGetParams) SetDefaults() { + var ( + filterDefault = string("open") + ) + + val := InstancePeersGetParams{ + Filter: &filterDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the instance peers get params +func (o *InstancePeersGetParams) WithTimeout(timeout time.Duration) *InstancePeersGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the instance peers get params +func (o *InstancePeersGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the instance peers get params +func (o *InstancePeersGetParams) WithContext(ctx context.Context) *InstancePeersGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the instance peers get params +func (o *InstancePeersGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the instance peers get params +func (o *InstancePeersGetParams) WithHTTPClient(client *http.Client) *InstancePeersGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the instance peers get params +func (o *InstancePeersGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithFilter adds the filter to the instance peers get params +func (o *InstancePeersGetParams) WithFilter(filter *string) *InstancePeersGetParams { + o.SetFilter(filter) + return o +} + +// SetFilter adds the filter to the instance peers get params +func (o *InstancePeersGetParams) SetFilter(filter *string) { + o.Filter = filter +} + +// WriteToRequest writes these params to a swagger request +func (o *InstancePeersGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Filter != nil { + + // query param filter + var qrFilter string + + if o.Filter != nil { + qrFilter = *o.Filter + } + qFilter := qrFilter + if qFilter != "" { + + if err := r.SetQueryParam("filter", qFilter); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_peers_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_peers_get_responses.go new file mode 100644 index 0000000..879385a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_peers_get_responses.go @@ -0,0 +1,482 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// InstancePeersGetReader is a Reader for the InstancePeersGet structure. +type InstancePeersGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InstancePeersGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInstancePeersGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewInstancePeersGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewInstancePeersGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewInstancePeersGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewInstancePeersGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewInstancePeersGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewInstancePeersGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/instance/peers] instancePeersGet", response, response.Code()) + } +} + +// NewInstancePeersGetOK creates a InstancePeersGetOK with default headers values +func NewInstancePeersGetOK() *InstancePeersGetOK { + return &InstancePeersGetOK{} +} + +/* + InstancePeersGetOK describes a response with status code 200, with default header values. + + If no filter parameter is provided, or filter is empty, then a legacy, Mastodon-API compatible response will be returned. This will consist of just a 'flat' array of strings like `["example.com", "example.org"]`, which corresponds to domains this instance peers with. + +If a filter parameter is provided, then an array of objects with at least a `domain` key set on each object will be returned. + +Domains that are silenced or suspended will also have a key `suspended_at` or `silenced_at` that contains an iso8601 date string. If one of these keys is not present on the domain object, it is open. Suspended instances may in some cases be obfuscated, which means they will have some letters replaced by `*` to make it more difficult for bad actors to target instances with harassment. + +Whether a flat response or a more detailed response is returned, domains will be sorted alphabetically by hostname. +*/ +type InstancePeersGetOK struct { + Payload []*models.Domain +} + +// IsSuccess returns true when this instance peers get o k response has a 2xx status code +func (o *InstancePeersGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this instance peers get o k response has a 3xx status code +func (o *InstancePeersGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance peers get o k response has a 4xx status code +func (o *InstancePeersGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this instance peers get o k response has a 5xx status code +func (o *InstancePeersGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this instance peers get o k response a status code equal to that given +func (o *InstancePeersGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the instance peers get o k response +func (o *InstancePeersGetOK) Code() int { + return 200 +} + +func (o *InstancePeersGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetOK %s", 200, payload) +} + +func (o *InstancePeersGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetOK %s", 200, payload) +} + +func (o *InstancePeersGetOK) GetPayload() []*models.Domain { + return o.Payload +} + +func (o *InstancePeersGetOK) 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 +} + +// NewInstancePeersGetBadRequest creates a InstancePeersGetBadRequest with default headers values +func NewInstancePeersGetBadRequest() *InstancePeersGetBadRequest { + return &InstancePeersGetBadRequest{} +} + +/* +InstancePeersGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type InstancePeersGetBadRequest struct { +} + +// IsSuccess returns true when this instance peers get bad request response has a 2xx status code +func (o *InstancePeersGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance peers get bad request response has a 3xx status code +func (o *InstancePeersGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance peers get bad request response has a 4xx status code +func (o *InstancePeersGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance peers get bad request response has a 5xx status code +func (o *InstancePeersGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this instance peers get bad request response a status code equal to that given +func (o *InstancePeersGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the instance peers get bad request response +func (o *InstancePeersGetBadRequest) Code() int { + return 400 +} + +func (o *InstancePeersGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetBadRequest", 400) +} + +func (o *InstancePeersGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetBadRequest", 400) +} + +func (o *InstancePeersGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstancePeersGetUnauthorized creates a InstancePeersGetUnauthorized with default headers values +func NewInstancePeersGetUnauthorized() *InstancePeersGetUnauthorized { + return &InstancePeersGetUnauthorized{} +} + +/* +InstancePeersGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type InstancePeersGetUnauthorized struct { +} + +// IsSuccess returns true when this instance peers get unauthorized response has a 2xx status code +func (o *InstancePeersGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance peers get unauthorized response has a 3xx status code +func (o *InstancePeersGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance peers get unauthorized response has a 4xx status code +func (o *InstancePeersGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance peers get unauthorized response has a 5xx status code +func (o *InstancePeersGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this instance peers get unauthorized response a status code equal to that given +func (o *InstancePeersGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the instance peers get unauthorized response +func (o *InstancePeersGetUnauthorized) Code() int { + return 401 +} + +func (o *InstancePeersGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetUnauthorized", 401) +} + +func (o *InstancePeersGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetUnauthorized", 401) +} + +func (o *InstancePeersGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstancePeersGetForbidden creates a InstancePeersGetForbidden with default headers values +func NewInstancePeersGetForbidden() *InstancePeersGetForbidden { + return &InstancePeersGetForbidden{} +} + +/* +InstancePeersGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type InstancePeersGetForbidden struct { +} + +// IsSuccess returns true when this instance peers get forbidden response has a 2xx status code +func (o *InstancePeersGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance peers get forbidden response has a 3xx status code +func (o *InstancePeersGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance peers get forbidden response has a 4xx status code +func (o *InstancePeersGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance peers get forbidden response has a 5xx status code +func (o *InstancePeersGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this instance peers get forbidden response a status code equal to that given +func (o *InstancePeersGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the instance peers get forbidden response +func (o *InstancePeersGetForbidden) Code() int { + return 403 +} + +func (o *InstancePeersGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetForbidden", 403) +} + +func (o *InstancePeersGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetForbidden", 403) +} + +func (o *InstancePeersGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstancePeersGetNotFound creates a InstancePeersGetNotFound with default headers values +func NewInstancePeersGetNotFound() *InstancePeersGetNotFound { + return &InstancePeersGetNotFound{} +} + +/* +InstancePeersGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type InstancePeersGetNotFound struct { +} + +// IsSuccess returns true when this instance peers get not found response has a 2xx status code +func (o *InstancePeersGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance peers get not found response has a 3xx status code +func (o *InstancePeersGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance peers get not found response has a 4xx status code +func (o *InstancePeersGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance peers get not found response has a 5xx status code +func (o *InstancePeersGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this instance peers get not found response a status code equal to that given +func (o *InstancePeersGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the instance peers get not found response +func (o *InstancePeersGetNotFound) Code() int { + return 404 +} + +func (o *InstancePeersGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetNotFound", 404) +} + +func (o *InstancePeersGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetNotFound", 404) +} + +func (o *InstancePeersGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstancePeersGetNotAcceptable creates a InstancePeersGetNotAcceptable with default headers values +func NewInstancePeersGetNotAcceptable() *InstancePeersGetNotAcceptable { + return &InstancePeersGetNotAcceptable{} +} + +/* +InstancePeersGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type InstancePeersGetNotAcceptable struct { +} + +// IsSuccess returns true when this instance peers get not acceptable response has a 2xx status code +func (o *InstancePeersGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance peers get not acceptable response has a 3xx status code +func (o *InstancePeersGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance peers get not acceptable response has a 4xx status code +func (o *InstancePeersGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance peers get not acceptable response has a 5xx status code +func (o *InstancePeersGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this instance peers get not acceptable response a status code equal to that given +func (o *InstancePeersGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the instance peers get not acceptable response +func (o *InstancePeersGetNotAcceptable) Code() int { + return 406 +} + +func (o *InstancePeersGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetNotAcceptable", 406) +} + +func (o *InstancePeersGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetNotAcceptable", 406) +} + +func (o *InstancePeersGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstancePeersGetInternalServerError creates a InstancePeersGetInternalServerError with default headers values +func NewInstancePeersGetInternalServerError() *InstancePeersGetInternalServerError { + return &InstancePeersGetInternalServerError{} +} + +/* +InstancePeersGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type InstancePeersGetInternalServerError struct { +} + +// IsSuccess returns true when this instance peers get internal server error response has a 2xx status code +func (o *InstancePeersGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance peers get internal server error response has a 3xx status code +func (o *InstancePeersGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance peers get internal server error response has a 4xx status code +func (o *InstancePeersGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this instance peers get internal server error response has a 5xx status code +func (o *InstancePeersGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this instance peers get internal server error response a status code equal to that given +func (o *InstancePeersGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the instance peers get internal server error response +func (o *InstancePeersGetInternalServerError) Code() int { + return 500 +} + +func (o *InstancePeersGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetInternalServerError", 500) +} + +func (o *InstancePeersGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetInternalServerError", 500) +} + +func (o *InstancePeersGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_update_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_update_parameters.go new file mode 100644 index 0000000..5b1ffbc --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_update_parameters.go @@ -0,0 +1,359 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// 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" +) + +// NewInstanceUpdateParams creates a new InstanceUpdateParams 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 NewInstanceUpdateParams() *InstanceUpdateParams { + return &InstanceUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewInstanceUpdateParamsWithTimeout creates a new InstanceUpdateParams object +// with the ability to set a timeout on a request. +func NewInstanceUpdateParamsWithTimeout(timeout time.Duration) *InstanceUpdateParams { + return &InstanceUpdateParams{ + timeout: timeout, + } +} + +// NewInstanceUpdateParamsWithContext creates a new InstanceUpdateParams object +// with the ability to set a context for a request. +func NewInstanceUpdateParamsWithContext(ctx context.Context) *InstanceUpdateParams { + return &InstanceUpdateParams{ + Context: ctx, + } +} + +// NewInstanceUpdateParamsWithHTTPClient creates a new InstanceUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewInstanceUpdateParamsWithHTTPClient(client *http.Client) *InstanceUpdateParams { + return &InstanceUpdateParams{ + HTTPClient: client, + } +} + +/* +InstanceUpdateParams contains all the parameters to send to the API endpoint + + for the instance update operation. + + Typically these are written to a http.Request. +*/ +type InstanceUpdateParams struct { + + /* ContactEmail. + + Email address to use as the instance contact. + */ + ContactEmail string + + /* ContactUsername. + + Username of the contact account. This must be the username of an instance admin. + */ + ContactUsername string + + /* Description. + + Longer description of the instance. + */ + Description string + + /* Header. + + Header image to use for the instance. + */ + Header runtime.NamedReadCloser + + /* ShortDescription. + + Short description of the instance. + */ + ShortDescription string + + /* Terms. + + Terms and conditions of the instance. + */ + Terms string + + /* Thumbnail. + + Thumbnail image to use for the instance. + */ + Thumbnail runtime.NamedReadCloser + + /* ThumbnailDescription. + + Image description of the submitted instance thumbnail. + */ + ThumbnailDescription *string + + /* Title. + + Title to use for the instance. + */ + Title string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the instance update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InstanceUpdateParams) WithDefaults() *InstanceUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the instance update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InstanceUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the instance update params +func (o *InstanceUpdateParams) WithTimeout(timeout time.Duration) *InstanceUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the instance update params +func (o *InstanceUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the instance update params +func (o *InstanceUpdateParams) WithContext(ctx context.Context) *InstanceUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the instance update params +func (o *InstanceUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the instance update params +func (o *InstanceUpdateParams) WithHTTPClient(client *http.Client) *InstanceUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the instance update params +func (o *InstanceUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithContactEmail adds the contactEmail to the instance update params +func (o *InstanceUpdateParams) WithContactEmail(contactEmail string) *InstanceUpdateParams { + o.SetContactEmail(contactEmail) + return o +} + +// SetContactEmail adds the contactEmail to the instance update params +func (o *InstanceUpdateParams) SetContactEmail(contactEmail string) { + o.ContactEmail = contactEmail +} + +// WithContactUsername adds the contactUsername to the instance update params +func (o *InstanceUpdateParams) WithContactUsername(contactUsername string) *InstanceUpdateParams { + o.SetContactUsername(contactUsername) + return o +} + +// SetContactUsername adds the contactUsername to the instance update params +func (o *InstanceUpdateParams) SetContactUsername(contactUsername string) { + o.ContactUsername = contactUsername +} + +// WithDescription adds the description to the instance update params +func (o *InstanceUpdateParams) WithDescription(description string) *InstanceUpdateParams { + o.SetDescription(description) + return o +} + +// SetDescription adds the description to the instance update params +func (o *InstanceUpdateParams) SetDescription(description string) { + o.Description = description +} + +// WithHeader adds the header to the instance update params +func (o *InstanceUpdateParams) WithHeader(header runtime.NamedReadCloser) *InstanceUpdateParams { + o.SetHeader(header) + return o +} + +// SetHeader adds the header to the instance update params +func (o *InstanceUpdateParams) SetHeader(header runtime.NamedReadCloser) { + o.Header = header +} + +// WithShortDescription adds the shortDescription to the instance update params +func (o *InstanceUpdateParams) WithShortDescription(shortDescription string) *InstanceUpdateParams { + o.SetShortDescription(shortDescription) + return o +} + +// SetShortDescription adds the shortDescription to the instance update params +func (o *InstanceUpdateParams) SetShortDescription(shortDescription string) { + o.ShortDescription = shortDescription +} + +// WithTerms adds the terms to the instance update params +func (o *InstanceUpdateParams) WithTerms(terms string) *InstanceUpdateParams { + o.SetTerms(terms) + return o +} + +// SetTerms adds the terms to the instance update params +func (o *InstanceUpdateParams) SetTerms(terms string) { + o.Terms = terms +} + +// WithThumbnail adds the thumbnail to the instance update params +func (o *InstanceUpdateParams) WithThumbnail(thumbnail runtime.NamedReadCloser) *InstanceUpdateParams { + o.SetThumbnail(thumbnail) + return o +} + +// SetThumbnail adds the thumbnail to the instance update params +func (o *InstanceUpdateParams) SetThumbnail(thumbnail runtime.NamedReadCloser) { + o.Thumbnail = thumbnail +} + +// WithThumbnailDescription adds the thumbnailDescription to the instance update params +func (o *InstanceUpdateParams) WithThumbnailDescription(thumbnailDescription *string) *InstanceUpdateParams { + o.SetThumbnailDescription(thumbnailDescription) + return o +} + +// SetThumbnailDescription adds the thumbnailDescription to the instance update params +func (o *InstanceUpdateParams) SetThumbnailDescription(thumbnailDescription *string) { + o.ThumbnailDescription = thumbnailDescription +} + +// WithTitle adds the title to the instance update params +func (o *InstanceUpdateParams) WithTitle(title string) *InstanceUpdateParams { + o.SetTitle(title) + return o +} + +// SetTitle adds the title to the instance update params +func (o *InstanceUpdateParams) SetTitle(title string) { + o.Title = title +} + +// WriteToRequest writes these params to a swagger request +func (o *InstanceUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param contact_email + frContactEmail := o.ContactEmail + fContactEmail := frContactEmail + if err := r.SetFormParam("contact_email", fContactEmail); err != nil { + return err + } + + // form param contact_username + frContactUsername := o.ContactUsername + fContactUsername := frContactUsername + if err := r.SetFormParam("contact_username", fContactUsername); err != nil { + return err + } + + // form param description + frDescription := o.Description + fDescription := frDescription + if err := r.SetFormParam("description", fDescription); err != nil { + return err + } + + if o.Header != nil { + + if o.Header != nil { + // form file param header + if err := r.SetFileParam("header", o.Header); err != nil { + return err + } + } + } + + // form param short_description + frShortDescription := o.ShortDescription + fShortDescription := frShortDescription + if err := r.SetFormParam("short_description", fShortDescription); err != nil { + return err + } + + // form param terms + frTerms := o.Terms + fTerms := frTerms + if err := r.SetFormParam("terms", fTerms); err != nil { + return err + } + + if o.Thumbnail != nil { + + if o.Thumbnail != nil { + // form file param thumbnail + if err := r.SetFileParam("thumbnail", o.Thumbnail); err != nil { + return err + } + } + } + + if o.ThumbnailDescription != nil { + + // form param thumbnail_description + var frThumbnailDescription string + if o.ThumbnailDescription != nil { + frThumbnailDescription = *o.ThumbnailDescription + } + fThumbnailDescription := frThumbnailDescription + if fThumbnailDescription != "" { + if err := r.SetFormParam("thumbnail_description", fThumbnailDescription); err != nil { + return err + } + } + } + + // form param title + frTitle := o.Title + fTitle := frTitle + if err := r.SetFormParam("title", fTitle); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_update_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_update_responses.go new file mode 100644 index 0000000..d2dc250 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/instance_update_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// InstanceUpdateReader is a Reader for the InstanceUpdate structure. +type InstanceUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InstanceUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInstanceUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewInstanceUpdateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewInstanceUpdateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewInstanceUpdateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewInstanceUpdateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewInstanceUpdateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewInstanceUpdateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PATCH /api/v1/instance] instanceUpdate", response, response.Code()) + } +} + +// NewInstanceUpdateOK creates a InstanceUpdateOK with default headers values +func NewInstanceUpdateOK() *InstanceUpdateOK { + return &InstanceUpdateOK{} +} + +/* +InstanceUpdateOK describes a response with status code 200, with default header values. + +The newly updated instance. +*/ +type InstanceUpdateOK struct { + Payload *models.InstanceV1 +} + +// IsSuccess returns true when this instance update o k response has a 2xx status code +func (o *InstanceUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this instance update o k response has a 3xx status code +func (o *InstanceUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance update o k response has a 4xx status code +func (o *InstanceUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this instance update o k response has a 5xx status code +func (o *InstanceUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this instance update o k response a status code equal to that given +func (o *InstanceUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the instance update o k response +func (o *InstanceUpdateOK) Code() int { + return 200 +} + +func (o *InstanceUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateOK %s", 200, payload) +} + +func (o *InstanceUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateOK %s", 200, payload) +} + +func (o *InstanceUpdateOK) GetPayload() *models.InstanceV1 { + return o.Payload +} + +func (o *InstanceUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.InstanceV1) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewInstanceUpdateBadRequest creates a InstanceUpdateBadRequest with default headers values +func NewInstanceUpdateBadRequest() *InstanceUpdateBadRequest { + return &InstanceUpdateBadRequest{} +} + +/* +InstanceUpdateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type InstanceUpdateBadRequest struct { +} + +// IsSuccess returns true when this instance update bad request response has a 2xx status code +func (o *InstanceUpdateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance update bad request response has a 3xx status code +func (o *InstanceUpdateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance update bad request response has a 4xx status code +func (o *InstanceUpdateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance update bad request response has a 5xx status code +func (o *InstanceUpdateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this instance update bad request response a status code equal to that given +func (o *InstanceUpdateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the instance update bad request response +func (o *InstanceUpdateBadRequest) Code() int { + return 400 +} + +func (o *InstanceUpdateBadRequest) Error() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateBadRequest", 400) +} + +func (o *InstanceUpdateBadRequest) String() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateBadRequest", 400) +} + +func (o *InstanceUpdateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstanceUpdateUnauthorized creates a InstanceUpdateUnauthorized with default headers values +func NewInstanceUpdateUnauthorized() *InstanceUpdateUnauthorized { + return &InstanceUpdateUnauthorized{} +} + +/* +InstanceUpdateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type InstanceUpdateUnauthorized struct { +} + +// IsSuccess returns true when this instance update unauthorized response has a 2xx status code +func (o *InstanceUpdateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance update unauthorized response has a 3xx status code +func (o *InstanceUpdateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance update unauthorized response has a 4xx status code +func (o *InstanceUpdateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance update unauthorized response has a 5xx status code +func (o *InstanceUpdateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this instance update unauthorized response a status code equal to that given +func (o *InstanceUpdateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the instance update unauthorized response +func (o *InstanceUpdateUnauthorized) Code() int { + return 401 +} + +func (o *InstanceUpdateUnauthorized) Error() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateUnauthorized", 401) +} + +func (o *InstanceUpdateUnauthorized) String() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateUnauthorized", 401) +} + +func (o *InstanceUpdateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstanceUpdateForbidden creates a InstanceUpdateForbidden with default headers values +func NewInstanceUpdateForbidden() *InstanceUpdateForbidden { + return &InstanceUpdateForbidden{} +} + +/* +InstanceUpdateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type InstanceUpdateForbidden struct { +} + +// IsSuccess returns true when this instance update forbidden response has a 2xx status code +func (o *InstanceUpdateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance update forbidden response has a 3xx status code +func (o *InstanceUpdateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance update forbidden response has a 4xx status code +func (o *InstanceUpdateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance update forbidden response has a 5xx status code +func (o *InstanceUpdateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this instance update forbidden response a status code equal to that given +func (o *InstanceUpdateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the instance update forbidden response +func (o *InstanceUpdateForbidden) Code() int { + return 403 +} + +func (o *InstanceUpdateForbidden) Error() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateForbidden", 403) +} + +func (o *InstanceUpdateForbidden) String() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateForbidden", 403) +} + +func (o *InstanceUpdateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstanceUpdateNotFound creates a InstanceUpdateNotFound with default headers values +func NewInstanceUpdateNotFound() *InstanceUpdateNotFound { + return &InstanceUpdateNotFound{} +} + +/* +InstanceUpdateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type InstanceUpdateNotFound struct { +} + +// IsSuccess returns true when this instance update not found response has a 2xx status code +func (o *InstanceUpdateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance update not found response has a 3xx status code +func (o *InstanceUpdateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance update not found response has a 4xx status code +func (o *InstanceUpdateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance update not found response has a 5xx status code +func (o *InstanceUpdateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this instance update not found response a status code equal to that given +func (o *InstanceUpdateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the instance update not found response +func (o *InstanceUpdateNotFound) Code() int { + return 404 +} + +func (o *InstanceUpdateNotFound) Error() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateNotFound", 404) +} + +func (o *InstanceUpdateNotFound) String() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateNotFound", 404) +} + +func (o *InstanceUpdateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstanceUpdateNotAcceptable creates a InstanceUpdateNotAcceptable with default headers values +func NewInstanceUpdateNotAcceptable() *InstanceUpdateNotAcceptable { + return &InstanceUpdateNotAcceptable{} +} + +/* +InstanceUpdateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type InstanceUpdateNotAcceptable struct { +} + +// IsSuccess returns true when this instance update not acceptable response has a 2xx status code +func (o *InstanceUpdateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance update not acceptable response has a 3xx status code +func (o *InstanceUpdateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance update not acceptable response has a 4xx status code +func (o *InstanceUpdateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance update not acceptable response has a 5xx status code +func (o *InstanceUpdateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this instance update not acceptable response a status code equal to that given +func (o *InstanceUpdateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the instance update not acceptable response +func (o *InstanceUpdateNotAcceptable) Code() int { + return 406 +} + +func (o *InstanceUpdateNotAcceptable) Error() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateNotAcceptable", 406) +} + +func (o *InstanceUpdateNotAcceptable) String() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateNotAcceptable", 406) +} + +func (o *InstanceUpdateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstanceUpdateInternalServerError creates a InstanceUpdateInternalServerError with default headers values +func NewInstanceUpdateInternalServerError() *InstanceUpdateInternalServerError { + return &InstanceUpdateInternalServerError{} +} + +/* +InstanceUpdateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type InstanceUpdateInternalServerError struct { +} + +// IsSuccess returns true when this instance update internal server error response has a 2xx status code +func (o *InstanceUpdateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance update internal server error response has a 3xx status code +func (o *InstanceUpdateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance update internal server error response has a 4xx status code +func (o *InstanceUpdateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this instance update internal server error response has a 5xx status code +func (o *InstanceUpdateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this instance update internal server error response a status code equal to that given +func (o *InstanceUpdateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the instance update internal server error response +func (o *InstanceUpdateInternalServerError) Code() int { + return 500 +} + +func (o *InstanceUpdateInternalServerError) Error() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateInternalServerError", 500) +} + +func (o *InstanceUpdateInternalServerError) String() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateInternalServerError", 500) +} + +func (o *InstanceUpdateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/rules_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/rules_parameters.go new file mode 100644 index 0000000..374afc9 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/rules_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// 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" +) + +// NewRulesParams creates a new RulesParams 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 NewRulesParams() *RulesParams { + return &RulesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewRulesParamsWithTimeout creates a new RulesParams object +// with the ability to set a timeout on a request. +func NewRulesParamsWithTimeout(timeout time.Duration) *RulesParams { + return &RulesParams{ + timeout: timeout, + } +} + +// NewRulesParamsWithContext creates a new RulesParams object +// with the ability to set a context for a request. +func NewRulesParamsWithContext(ctx context.Context) *RulesParams { + return &RulesParams{ + Context: ctx, + } +} + +// NewRulesParamsWithHTTPClient creates a new RulesParams object +// with the ability to set a custom HTTPClient for a request. +func NewRulesParamsWithHTTPClient(client *http.Client) *RulesParams { + return &RulesParams{ + HTTPClient: client, + } +} + +/* +RulesParams contains all the parameters to send to the API endpoint + + for the rules operation. + + Typically these are written to a http.Request. +*/ +type RulesParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the rules params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RulesParams) WithDefaults() *RulesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the rules params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RulesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the rules params +func (o *RulesParams) WithTimeout(timeout time.Duration) *RulesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the rules params +func (o *RulesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the rules params +func (o *RulesParams) WithContext(ctx context.Context) *RulesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the rules params +func (o *RulesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the rules params +func (o *RulesParams) WithHTTPClient(client *http.Client) *RulesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the rules params +func (o *RulesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *RulesParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/rules_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/rules_responses.go new file mode 100644 index 0000000..9d293de --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/instance/rules_responses.go @@ -0,0 +1,352 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// RulesReader is a Reader for the Rules structure. +type RulesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *RulesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewRulesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewRulesBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewRulesNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewRulesNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewRulesInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/instance/rules] rules", response, response.Code()) + } +} + +// NewRulesOK creates a RulesOK with default headers values +func NewRulesOK() *RulesOK { + return &RulesOK{} +} + +/* +RulesOK describes a response with status code 200, with default header values. + +An array with all the rules for the local instance. +*/ +type RulesOK struct { + Payload []*models.InstanceRule +} + +// IsSuccess returns true when this rules o k response has a 2xx status code +func (o *RulesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this rules o k response has a 3xx status code +func (o *RulesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rules o k response has a 4xx status code +func (o *RulesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this rules o k response has a 5xx status code +func (o *RulesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this rules o k response a status code equal to that given +func (o *RulesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the rules o k response +func (o *RulesOK) Code() int { + return 200 +} + +func (o *RulesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/instance/rules][%d] rulesOK %s", 200, payload) +} + +func (o *RulesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/instance/rules][%d] rulesOK %s", 200, payload) +} + +func (o *RulesOK) GetPayload() []*models.InstanceRule { + return o.Payload +} + +func (o *RulesOK) 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 +} + +// NewRulesBadRequest creates a RulesBadRequest with default headers values +func NewRulesBadRequest() *RulesBadRequest { + return &RulesBadRequest{} +} + +/* +RulesBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type RulesBadRequest struct { +} + +// IsSuccess returns true when this rules bad request response has a 2xx status code +func (o *RulesBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rules bad request response has a 3xx status code +func (o *RulesBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rules bad request response has a 4xx status code +func (o *RulesBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this rules bad request response has a 5xx status code +func (o *RulesBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this rules bad request response a status code equal to that given +func (o *RulesBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the rules bad request response +func (o *RulesBadRequest) Code() int { + return 400 +} + +func (o *RulesBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/instance/rules][%d] rulesBadRequest", 400) +} + +func (o *RulesBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/instance/rules][%d] rulesBadRequest", 400) +} + +func (o *RulesBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRulesNotFound creates a RulesNotFound with default headers values +func NewRulesNotFound() *RulesNotFound { + return &RulesNotFound{} +} + +/* +RulesNotFound describes a response with status code 404, with default header values. + +not found +*/ +type RulesNotFound struct { +} + +// IsSuccess returns true when this rules not found response has a 2xx status code +func (o *RulesNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rules not found response has a 3xx status code +func (o *RulesNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rules not found response has a 4xx status code +func (o *RulesNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this rules not found response has a 5xx status code +func (o *RulesNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this rules not found response a status code equal to that given +func (o *RulesNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the rules not found response +func (o *RulesNotFound) Code() int { + return 404 +} + +func (o *RulesNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/instance/rules][%d] rulesNotFound", 404) +} + +func (o *RulesNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/instance/rules][%d] rulesNotFound", 404) +} + +func (o *RulesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRulesNotAcceptable creates a RulesNotAcceptable with default headers values +func NewRulesNotAcceptable() *RulesNotAcceptable { + return &RulesNotAcceptable{} +} + +/* +RulesNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type RulesNotAcceptable struct { +} + +// IsSuccess returns true when this rules not acceptable response has a 2xx status code +func (o *RulesNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rules not acceptable response has a 3xx status code +func (o *RulesNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rules not acceptable response has a 4xx status code +func (o *RulesNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this rules not acceptable response has a 5xx status code +func (o *RulesNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this rules not acceptable response a status code equal to that given +func (o *RulesNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the rules not acceptable response +func (o *RulesNotAcceptable) Code() int { + return 406 +} + +func (o *RulesNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/instance/rules][%d] rulesNotAcceptable", 406) +} + +func (o *RulesNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/instance/rules][%d] rulesNotAcceptable", 406) +} + +func (o *RulesNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRulesInternalServerError creates a RulesInternalServerError with default headers values +func NewRulesInternalServerError() *RulesInternalServerError { + return &RulesInternalServerError{} +} + +/* +RulesInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type RulesInternalServerError struct { +} + +// IsSuccess returns true when this rules internal server error response has a 2xx status code +func (o *RulesInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rules internal server error response has a 3xx status code +func (o *RulesInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rules internal server error response has a 4xx status code +func (o *RulesInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this rules internal server error response has a 5xx status code +func (o *RulesInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this rules internal server error response a status code equal to that given +func (o *RulesInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the rules internal server error response +func (o *RulesInternalServerError) Code() int { + return 500 +} + +func (o *RulesInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/instance/rules][%d] rulesInternalServerError", 500) +} + +func (o *RulesInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/instance/rules][%d] rulesInternalServerError", 500) +} + +func (o *RulesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/interaction_policies/interaction_policies_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/interaction_policies/interaction_policies_client.go new file mode 100644 index 0000000..6fd58d6 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/interaction_policies/interaction_policies_client.go @@ -0,0 +1,196 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package interaction_policies + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new interaction policies API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new interaction policies API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new interaction policies API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for interaction policies API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded". +func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} +} + +// WithContentTypeMultipartFormData sets the Content-Type header to "multipart/form-data". +func WithContentTypeMultipartFormData(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"multipart/form-data"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + PoliciesDefaultsGet(params *PoliciesDefaultsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PoliciesDefaultsGetOK, error) + + PoliciesDefaultsUpdate(params *PoliciesDefaultsUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PoliciesDefaultsUpdateOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +PoliciesDefaultsGet gets default interaction policies for new statuses created by you +*/ +func (a *Client) PoliciesDefaultsGet(params *PoliciesDefaultsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PoliciesDefaultsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPoliciesDefaultsGetParams() + } + op := &runtime.ClientOperation{ + ID: "policiesDefaultsGet", + Method: "GET", + PathPattern: "/api/v1/interaction_policies/defaults", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PoliciesDefaultsGetReader{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.(*PoliciesDefaultsGetOK) + 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 policiesDefaultsGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PoliciesDefaultsUpdate updates default interaction policies per visibility level for new statuses created by you + + If submitting using form data, use the following pattern: + +`VISIBILITY[INTERACTION_TYPE][CONDITION][INDEX]=Value` + +For example: `public[can_reply][always][0]=author` + +Using `curl` this might look something like: + +`curl -F 'public[can_reply][always][0]=author' -F 'public[can_reply][always][1]=followers'` + +The JSON equivalent would be: + +`curl -H 'Content-Type: application/json' -d '{"public":{"can_reply":{"always":["author","followers"]}}}'` + +Any visibility level left unspecified in the request body will be returned to the default. + +Ie., in the example above, "public" would be updated, but "unlisted", "private", and "direct" would be reset to defaults. + +The server will perform some normalization on submitted policies so that you can't submit totally invalid policies. +*/ +func (a *Client) PoliciesDefaultsUpdate(params *PoliciesDefaultsUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PoliciesDefaultsUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPoliciesDefaultsUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "policiesDefaultsUpdate", + Method: "PATCH", + PathPattern: "/api/v1/interaction_policies/defaults", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data", "application/x-www-form-urlencoded", "application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PoliciesDefaultsUpdateReader{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.(*PoliciesDefaultsUpdateOK) + 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 policiesDefaultsUpdate: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/interaction_policies/policies_defaults_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/interaction_policies/policies_defaults_get_parameters.go new file mode 100644 index 0000000..2048c0e --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/interaction_policies/policies_defaults_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package interaction_policies + +// 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" +) + +// NewPoliciesDefaultsGetParams creates a new PoliciesDefaultsGetParams 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 NewPoliciesDefaultsGetParams() *PoliciesDefaultsGetParams { + return &PoliciesDefaultsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPoliciesDefaultsGetParamsWithTimeout creates a new PoliciesDefaultsGetParams object +// with the ability to set a timeout on a request. +func NewPoliciesDefaultsGetParamsWithTimeout(timeout time.Duration) *PoliciesDefaultsGetParams { + return &PoliciesDefaultsGetParams{ + timeout: timeout, + } +} + +// NewPoliciesDefaultsGetParamsWithContext creates a new PoliciesDefaultsGetParams object +// with the ability to set a context for a request. +func NewPoliciesDefaultsGetParamsWithContext(ctx context.Context) *PoliciesDefaultsGetParams { + return &PoliciesDefaultsGetParams{ + Context: ctx, + } +} + +// NewPoliciesDefaultsGetParamsWithHTTPClient creates a new PoliciesDefaultsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPoliciesDefaultsGetParamsWithHTTPClient(client *http.Client) *PoliciesDefaultsGetParams { + return &PoliciesDefaultsGetParams{ + HTTPClient: client, + } +} + +/* +PoliciesDefaultsGetParams contains all the parameters to send to the API endpoint + + for the policies defaults get operation. + + Typically these are written to a http.Request. +*/ +type PoliciesDefaultsGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the policies defaults get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PoliciesDefaultsGetParams) WithDefaults() *PoliciesDefaultsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the policies defaults get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PoliciesDefaultsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the policies defaults get params +func (o *PoliciesDefaultsGetParams) WithTimeout(timeout time.Duration) *PoliciesDefaultsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the policies defaults get params +func (o *PoliciesDefaultsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the policies defaults get params +func (o *PoliciesDefaultsGetParams) WithContext(ctx context.Context) *PoliciesDefaultsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the policies defaults get params +func (o *PoliciesDefaultsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the policies defaults get params +func (o *PoliciesDefaultsGetParams) WithHTTPClient(client *http.Client) *PoliciesDefaultsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the policies defaults get params +func (o *PoliciesDefaultsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *PoliciesDefaultsGetParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/interaction_policies/policies_defaults_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/interaction_policies/policies_defaults_get_responses.go new file mode 100644 index 0000000..cdc5f74 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/interaction_policies/policies_defaults_get_responses.go @@ -0,0 +1,292 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package interaction_policies + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// PoliciesDefaultsGetReader is a Reader for the PoliciesDefaultsGet structure. +type PoliciesDefaultsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PoliciesDefaultsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPoliciesDefaultsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewPoliciesDefaultsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewPoliciesDefaultsGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPoliciesDefaultsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/interaction_policies/defaults] policiesDefaultsGet", response, response.Code()) + } +} + +// NewPoliciesDefaultsGetOK creates a PoliciesDefaultsGetOK with default headers values +func NewPoliciesDefaultsGetOK() *PoliciesDefaultsGetOK { + return &PoliciesDefaultsGetOK{} +} + +/* +PoliciesDefaultsGetOK describes a response with status code 200, with default header values. + +A default policies object containing a policy for each status visibility. +*/ +type PoliciesDefaultsGetOK struct { + Payload *models.DefaultPolicies +} + +// IsSuccess returns true when this policies defaults get o k response has a 2xx status code +func (o *PoliciesDefaultsGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this policies defaults get o k response has a 3xx status code +func (o *PoliciesDefaultsGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this policies defaults get o k response has a 4xx status code +func (o *PoliciesDefaultsGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this policies defaults get o k response has a 5xx status code +func (o *PoliciesDefaultsGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this policies defaults get o k response a status code equal to that given +func (o *PoliciesDefaultsGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the policies defaults get o k response +func (o *PoliciesDefaultsGetOK) Code() int { + return 200 +} + +func (o *PoliciesDefaultsGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/interaction_policies/defaults][%d] policiesDefaultsGetOK %s", 200, payload) +} + +func (o *PoliciesDefaultsGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/interaction_policies/defaults][%d] policiesDefaultsGetOK %s", 200, payload) +} + +func (o *PoliciesDefaultsGetOK) GetPayload() *models.DefaultPolicies { + return o.Payload +} + +func (o *PoliciesDefaultsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DefaultPolicies) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPoliciesDefaultsGetUnauthorized creates a PoliciesDefaultsGetUnauthorized with default headers values +func NewPoliciesDefaultsGetUnauthorized() *PoliciesDefaultsGetUnauthorized { + return &PoliciesDefaultsGetUnauthorized{} +} + +/* +PoliciesDefaultsGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type PoliciesDefaultsGetUnauthorized struct { +} + +// IsSuccess returns true when this policies defaults get unauthorized response has a 2xx status code +func (o *PoliciesDefaultsGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this policies defaults get unauthorized response has a 3xx status code +func (o *PoliciesDefaultsGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this policies defaults get unauthorized response has a 4xx status code +func (o *PoliciesDefaultsGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this policies defaults get unauthorized response has a 5xx status code +func (o *PoliciesDefaultsGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this policies defaults get unauthorized response a status code equal to that given +func (o *PoliciesDefaultsGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the policies defaults get unauthorized response +func (o *PoliciesDefaultsGetUnauthorized) Code() int { + return 401 +} + +func (o *PoliciesDefaultsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/interaction_policies/defaults][%d] policiesDefaultsGetUnauthorized", 401) +} + +func (o *PoliciesDefaultsGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/interaction_policies/defaults][%d] policiesDefaultsGetUnauthorized", 401) +} + +func (o *PoliciesDefaultsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPoliciesDefaultsGetNotAcceptable creates a PoliciesDefaultsGetNotAcceptable with default headers values +func NewPoliciesDefaultsGetNotAcceptable() *PoliciesDefaultsGetNotAcceptable { + return &PoliciesDefaultsGetNotAcceptable{} +} + +/* +PoliciesDefaultsGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type PoliciesDefaultsGetNotAcceptable struct { +} + +// IsSuccess returns true when this policies defaults get not acceptable response has a 2xx status code +func (o *PoliciesDefaultsGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this policies defaults get not acceptable response has a 3xx status code +func (o *PoliciesDefaultsGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this policies defaults get not acceptable response has a 4xx status code +func (o *PoliciesDefaultsGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this policies defaults get not acceptable response has a 5xx status code +func (o *PoliciesDefaultsGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this policies defaults get not acceptable response a status code equal to that given +func (o *PoliciesDefaultsGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the policies defaults get not acceptable response +func (o *PoliciesDefaultsGetNotAcceptable) Code() int { + return 406 +} + +func (o *PoliciesDefaultsGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/interaction_policies/defaults][%d] policiesDefaultsGetNotAcceptable", 406) +} + +func (o *PoliciesDefaultsGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/interaction_policies/defaults][%d] policiesDefaultsGetNotAcceptable", 406) +} + +func (o *PoliciesDefaultsGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPoliciesDefaultsGetInternalServerError creates a PoliciesDefaultsGetInternalServerError with default headers values +func NewPoliciesDefaultsGetInternalServerError() *PoliciesDefaultsGetInternalServerError { + return &PoliciesDefaultsGetInternalServerError{} +} + +/* +PoliciesDefaultsGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type PoliciesDefaultsGetInternalServerError struct { +} + +// IsSuccess returns true when this policies defaults get internal server error response has a 2xx status code +func (o *PoliciesDefaultsGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this policies defaults get internal server error response has a 3xx status code +func (o *PoliciesDefaultsGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this policies defaults get internal server error response has a 4xx status code +func (o *PoliciesDefaultsGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this policies defaults get internal server error response has a 5xx status code +func (o *PoliciesDefaultsGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this policies defaults get internal server error response a status code equal to that given +func (o *PoliciesDefaultsGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the policies defaults get internal server error response +func (o *PoliciesDefaultsGetInternalServerError) Code() int { + return 500 +} + +func (o *PoliciesDefaultsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/interaction_policies/defaults][%d] policiesDefaultsGetInternalServerError", 500) +} + +func (o *PoliciesDefaultsGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/interaction_policies/defaults][%d] policiesDefaultsGetInternalServerError", 500) +} + +func (o *PoliciesDefaultsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/interaction_policies/policies_defaults_update_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/interaction_policies/policies_defaults_update_parameters.go new file mode 100644 index 0000000..a30d631 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/interaction_policies/policies_defaults_update_parameters.go @@ -0,0 +1,897 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package interaction_policies + +// 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" +) + +// NewPoliciesDefaultsUpdateParams creates a new PoliciesDefaultsUpdateParams 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 NewPoliciesDefaultsUpdateParams() *PoliciesDefaultsUpdateParams { + return &PoliciesDefaultsUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPoliciesDefaultsUpdateParamsWithTimeout creates a new PoliciesDefaultsUpdateParams object +// with the ability to set a timeout on a request. +func NewPoliciesDefaultsUpdateParamsWithTimeout(timeout time.Duration) *PoliciesDefaultsUpdateParams { + return &PoliciesDefaultsUpdateParams{ + timeout: timeout, + } +} + +// NewPoliciesDefaultsUpdateParamsWithContext creates a new PoliciesDefaultsUpdateParams object +// with the ability to set a context for a request. +func NewPoliciesDefaultsUpdateParamsWithContext(ctx context.Context) *PoliciesDefaultsUpdateParams { + return &PoliciesDefaultsUpdateParams{ + Context: ctx, + } +} + +// NewPoliciesDefaultsUpdateParamsWithHTTPClient creates a new PoliciesDefaultsUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewPoliciesDefaultsUpdateParamsWithHTTPClient(client *http.Client) *PoliciesDefaultsUpdateParams { + return &PoliciesDefaultsUpdateParams{ + HTTPClient: client, + } +} + +/* +PoliciesDefaultsUpdateParams contains all the parameters to send to the API endpoint + + for the policies defaults update operation. + + Typically these are written to a http.Request. +*/ +type PoliciesDefaultsUpdateParams struct { + + /* DirectCanFavouriteAlways0. + + Nth entry for direct.can_favourite.always. + */ + DirectCanFavouriteAlways0 *string + + /* DirectCanFavouriteWithApproval0. + + Nth entry for direct.can_favourite.with_approval. + */ + DirectCanFavouriteWithApproval0 *string + + /* DirectCanReblogAlways0. + + Nth entry for direct.can_reblog.always. + */ + DirectCanReblogAlways0 *string + + /* DirectCanReblogWithApproval0. + + Nth entry for direct.can_reblog.with_approval. + */ + DirectCanReblogWithApproval0 *string + + /* DirectCanReplyAlways0. + + Nth entry for direct.can_reply.always. + */ + DirectCanReplyAlways0 *string + + /* DirectCanReplyWithApproval0. + + Nth entry for direct.can_reply.with_approval. + */ + DirectCanReplyWithApproval0 *string + + /* PrivateCanFavouriteAlways0. + + Nth entry for private.can_favourite.always. + */ + PrivateCanFavouriteAlways0 *string + + /* PrivateCanFavouriteWithApproval0. + + Nth entry for private.can_favourite.with_approval. + */ + PrivateCanFavouriteWithApproval0 *string + + /* PrivateCanReblogAlways0. + + Nth entry for private.can_reblog.always. + */ + PrivateCanReblogAlways0 *string + + /* PrivateCanReblogWithApproval0. + + Nth entry for private.can_reblog.with_approval. + */ + PrivateCanReblogWithApproval0 *string + + /* PrivateCanReplyAlways0. + + Nth entry for private.can_reply.always. + */ + PrivateCanReplyAlways0 *string + + /* PrivateCanReplyWithApproval0. + + Nth entry for private.can_reply.with_approval. + */ + PrivateCanReplyWithApproval0 *string + + /* PublicCanFavouriteAlways0. + + Nth entry for public.can_favourite.always. + */ + PublicCanFavouriteAlways0 *string + + /* PublicCanFavouriteWithApproval0. + + Nth entry for public.can_favourite.with_approval. + */ + PublicCanFavouriteWithApproval0 *string + + /* PublicCanReblogAlways0. + + Nth entry for public.can_reblog.always. + */ + PublicCanReblogAlways0 *string + + /* PublicCanReblogWithApproval0. + + Nth entry for public.can_reblog.with_approval. + */ + PublicCanReblogWithApproval0 *string + + /* PublicCanReplyAlways0. + + Nth entry for public.can_reply.always. + */ + PublicCanReplyAlways0 *string + + /* PublicCanReplyWithApproval0. + + Nth entry for public.can_reply.with_approval. + */ + PublicCanReplyWithApproval0 *string + + /* UnlistedCanFavouriteAlways0. + + Nth entry for unlisted.can_favourite.always. + */ + UnlistedCanFavouriteAlways0 *string + + /* UnlistedCanFavouriteWithApproval0. + + Nth entry for unlisted.can_favourite.with_approval. + */ + UnlistedCanFavouriteWithApproval0 *string + + /* UnlistedCanReblogAlways0. + + Nth entry for unlisted.can_reblog.always. + */ + UnlistedCanReblogAlways0 *string + + /* UnlistedCanReblogWithApproval0. + + Nth entry for unlisted.can_reblog.with_approval. + */ + UnlistedCanReblogWithApproval0 *string + + /* UnlistedCanReplyAlways0. + + Nth entry for unlisted.can_reply.always. + */ + UnlistedCanReplyAlways0 *string + + /* UnlistedCanReplyWithApproval0. + + Nth entry for unlisted.can_reply.with_approval. + */ + UnlistedCanReplyWithApproval0 *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the policies defaults update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PoliciesDefaultsUpdateParams) WithDefaults() *PoliciesDefaultsUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the policies defaults update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PoliciesDefaultsUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithTimeout(timeout time.Duration) *PoliciesDefaultsUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithContext(ctx context.Context) *PoliciesDefaultsUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithHTTPClient(client *http.Client) *PoliciesDefaultsUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDirectCanFavouriteAlways0 adds the directCanFavouriteAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithDirectCanFavouriteAlways0(directCanFavouriteAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetDirectCanFavouriteAlways0(directCanFavouriteAlways0) + return o +} + +// SetDirectCanFavouriteAlways0 adds the directCanFavouriteAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetDirectCanFavouriteAlways0(directCanFavouriteAlways0 *string) { + o.DirectCanFavouriteAlways0 = directCanFavouriteAlways0 +} + +// WithDirectCanFavouriteWithApproval0 adds the directCanFavouriteWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithDirectCanFavouriteWithApproval0(directCanFavouriteWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetDirectCanFavouriteWithApproval0(directCanFavouriteWithApproval0) + return o +} + +// SetDirectCanFavouriteWithApproval0 adds the directCanFavouriteWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetDirectCanFavouriteWithApproval0(directCanFavouriteWithApproval0 *string) { + o.DirectCanFavouriteWithApproval0 = directCanFavouriteWithApproval0 +} + +// WithDirectCanReblogAlways0 adds the directCanReblogAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithDirectCanReblogAlways0(directCanReblogAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetDirectCanReblogAlways0(directCanReblogAlways0) + return o +} + +// SetDirectCanReblogAlways0 adds the directCanReblogAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetDirectCanReblogAlways0(directCanReblogAlways0 *string) { + o.DirectCanReblogAlways0 = directCanReblogAlways0 +} + +// WithDirectCanReblogWithApproval0 adds the directCanReblogWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithDirectCanReblogWithApproval0(directCanReblogWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetDirectCanReblogWithApproval0(directCanReblogWithApproval0) + return o +} + +// SetDirectCanReblogWithApproval0 adds the directCanReblogWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetDirectCanReblogWithApproval0(directCanReblogWithApproval0 *string) { + o.DirectCanReblogWithApproval0 = directCanReblogWithApproval0 +} + +// WithDirectCanReplyAlways0 adds the directCanReplyAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithDirectCanReplyAlways0(directCanReplyAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetDirectCanReplyAlways0(directCanReplyAlways0) + return o +} + +// SetDirectCanReplyAlways0 adds the directCanReplyAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetDirectCanReplyAlways0(directCanReplyAlways0 *string) { + o.DirectCanReplyAlways0 = directCanReplyAlways0 +} + +// WithDirectCanReplyWithApproval0 adds the directCanReplyWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithDirectCanReplyWithApproval0(directCanReplyWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetDirectCanReplyWithApproval0(directCanReplyWithApproval0) + return o +} + +// SetDirectCanReplyWithApproval0 adds the directCanReplyWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetDirectCanReplyWithApproval0(directCanReplyWithApproval0 *string) { + o.DirectCanReplyWithApproval0 = directCanReplyWithApproval0 +} + +// WithPrivateCanFavouriteAlways0 adds the privateCanFavouriteAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPrivateCanFavouriteAlways0(privateCanFavouriteAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetPrivateCanFavouriteAlways0(privateCanFavouriteAlways0) + return o +} + +// SetPrivateCanFavouriteAlways0 adds the privateCanFavouriteAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPrivateCanFavouriteAlways0(privateCanFavouriteAlways0 *string) { + o.PrivateCanFavouriteAlways0 = privateCanFavouriteAlways0 +} + +// WithPrivateCanFavouriteWithApproval0 adds the privateCanFavouriteWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPrivateCanFavouriteWithApproval0(privateCanFavouriteWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetPrivateCanFavouriteWithApproval0(privateCanFavouriteWithApproval0) + return o +} + +// SetPrivateCanFavouriteWithApproval0 adds the privateCanFavouriteWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPrivateCanFavouriteWithApproval0(privateCanFavouriteWithApproval0 *string) { + o.PrivateCanFavouriteWithApproval0 = privateCanFavouriteWithApproval0 +} + +// WithPrivateCanReblogAlways0 adds the privateCanReblogAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPrivateCanReblogAlways0(privateCanReblogAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetPrivateCanReblogAlways0(privateCanReblogAlways0) + return o +} + +// SetPrivateCanReblogAlways0 adds the privateCanReblogAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPrivateCanReblogAlways0(privateCanReblogAlways0 *string) { + o.PrivateCanReblogAlways0 = privateCanReblogAlways0 +} + +// WithPrivateCanReblogWithApproval0 adds the privateCanReblogWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPrivateCanReblogWithApproval0(privateCanReblogWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetPrivateCanReblogWithApproval0(privateCanReblogWithApproval0) + return o +} + +// SetPrivateCanReblogWithApproval0 adds the privateCanReblogWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPrivateCanReblogWithApproval0(privateCanReblogWithApproval0 *string) { + o.PrivateCanReblogWithApproval0 = privateCanReblogWithApproval0 +} + +// WithPrivateCanReplyAlways0 adds the privateCanReplyAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPrivateCanReplyAlways0(privateCanReplyAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetPrivateCanReplyAlways0(privateCanReplyAlways0) + return o +} + +// SetPrivateCanReplyAlways0 adds the privateCanReplyAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPrivateCanReplyAlways0(privateCanReplyAlways0 *string) { + o.PrivateCanReplyAlways0 = privateCanReplyAlways0 +} + +// WithPrivateCanReplyWithApproval0 adds the privateCanReplyWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPrivateCanReplyWithApproval0(privateCanReplyWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetPrivateCanReplyWithApproval0(privateCanReplyWithApproval0) + return o +} + +// SetPrivateCanReplyWithApproval0 adds the privateCanReplyWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPrivateCanReplyWithApproval0(privateCanReplyWithApproval0 *string) { + o.PrivateCanReplyWithApproval0 = privateCanReplyWithApproval0 +} + +// WithPublicCanFavouriteAlways0 adds the publicCanFavouriteAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPublicCanFavouriteAlways0(publicCanFavouriteAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetPublicCanFavouriteAlways0(publicCanFavouriteAlways0) + return o +} + +// SetPublicCanFavouriteAlways0 adds the publicCanFavouriteAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPublicCanFavouriteAlways0(publicCanFavouriteAlways0 *string) { + o.PublicCanFavouriteAlways0 = publicCanFavouriteAlways0 +} + +// WithPublicCanFavouriteWithApproval0 adds the publicCanFavouriteWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPublicCanFavouriteWithApproval0(publicCanFavouriteWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetPublicCanFavouriteWithApproval0(publicCanFavouriteWithApproval0) + return o +} + +// SetPublicCanFavouriteWithApproval0 adds the publicCanFavouriteWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPublicCanFavouriteWithApproval0(publicCanFavouriteWithApproval0 *string) { + o.PublicCanFavouriteWithApproval0 = publicCanFavouriteWithApproval0 +} + +// WithPublicCanReblogAlways0 adds the publicCanReblogAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPublicCanReblogAlways0(publicCanReblogAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetPublicCanReblogAlways0(publicCanReblogAlways0) + return o +} + +// SetPublicCanReblogAlways0 adds the publicCanReblogAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPublicCanReblogAlways0(publicCanReblogAlways0 *string) { + o.PublicCanReblogAlways0 = publicCanReblogAlways0 +} + +// WithPublicCanReblogWithApproval0 adds the publicCanReblogWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPublicCanReblogWithApproval0(publicCanReblogWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetPublicCanReblogWithApproval0(publicCanReblogWithApproval0) + return o +} + +// SetPublicCanReblogWithApproval0 adds the publicCanReblogWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPublicCanReblogWithApproval0(publicCanReblogWithApproval0 *string) { + o.PublicCanReblogWithApproval0 = publicCanReblogWithApproval0 +} + +// WithPublicCanReplyAlways0 adds the publicCanReplyAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPublicCanReplyAlways0(publicCanReplyAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetPublicCanReplyAlways0(publicCanReplyAlways0) + return o +} + +// SetPublicCanReplyAlways0 adds the publicCanReplyAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPublicCanReplyAlways0(publicCanReplyAlways0 *string) { + o.PublicCanReplyAlways0 = publicCanReplyAlways0 +} + +// WithPublicCanReplyWithApproval0 adds the publicCanReplyWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPublicCanReplyWithApproval0(publicCanReplyWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetPublicCanReplyWithApproval0(publicCanReplyWithApproval0) + return o +} + +// SetPublicCanReplyWithApproval0 adds the publicCanReplyWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPublicCanReplyWithApproval0(publicCanReplyWithApproval0 *string) { + o.PublicCanReplyWithApproval0 = publicCanReplyWithApproval0 +} + +// WithUnlistedCanFavouriteAlways0 adds the unlistedCanFavouriteAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithUnlistedCanFavouriteAlways0(unlistedCanFavouriteAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetUnlistedCanFavouriteAlways0(unlistedCanFavouriteAlways0) + return o +} + +// SetUnlistedCanFavouriteAlways0 adds the unlistedCanFavouriteAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetUnlistedCanFavouriteAlways0(unlistedCanFavouriteAlways0 *string) { + o.UnlistedCanFavouriteAlways0 = unlistedCanFavouriteAlways0 +} + +// WithUnlistedCanFavouriteWithApproval0 adds the unlistedCanFavouriteWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithUnlistedCanFavouriteWithApproval0(unlistedCanFavouriteWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetUnlistedCanFavouriteWithApproval0(unlistedCanFavouriteWithApproval0) + return o +} + +// SetUnlistedCanFavouriteWithApproval0 adds the unlistedCanFavouriteWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetUnlistedCanFavouriteWithApproval0(unlistedCanFavouriteWithApproval0 *string) { + o.UnlistedCanFavouriteWithApproval0 = unlistedCanFavouriteWithApproval0 +} + +// WithUnlistedCanReblogAlways0 adds the unlistedCanReblogAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithUnlistedCanReblogAlways0(unlistedCanReblogAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetUnlistedCanReblogAlways0(unlistedCanReblogAlways0) + return o +} + +// SetUnlistedCanReblogAlways0 adds the unlistedCanReblogAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetUnlistedCanReblogAlways0(unlistedCanReblogAlways0 *string) { + o.UnlistedCanReblogAlways0 = unlistedCanReblogAlways0 +} + +// WithUnlistedCanReblogWithApproval0 adds the unlistedCanReblogWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithUnlistedCanReblogWithApproval0(unlistedCanReblogWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetUnlistedCanReblogWithApproval0(unlistedCanReblogWithApproval0) + return o +} + +// SetUnlistedCanReblogWithApproval0 adds the unlistedCanReblogWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetUnlistedCanReblogWithApproval0(unlistedCanReblogWithApproval0 *string) { + o.UnlistedCanReblogWithApproval0 = unlistedCanReblogWithApproval0 +} + +// WithUnlistedCanReplyAlways0 adds the unlistedCanReplyAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithUnlistedCanReplyAlways0(unlistedCanReplyAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetUnlistedCanReplyAlways0(unlistedCanReplyAlways0) + return o +} + +// SetUnlistedCanReplyAlways0 adds the unlistedCanReplyAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetUnlistedCanReplyAlways0(unlistedCanReplyAlways0 *string) { + o.UnlistedCanReplyAlways0 = unlistedCanReplyAlways0 +} + +// WithUnlistedCanReplyWithApproval0 adds the unlistedCanReplyWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithUnlistedCanReplyWithApproval0(unlistedCanReplyWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetUnlistedCanReplyWithApproval0(unlistedCanReplyWithApproval0) + return o +} + +// SetUnlistedCanReplyWithApproval0 adds the unlistedCanReplyWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetUnlistedCanReplyWithApproval0(unlistedCanReplyWithApproval0 *string) { + o.UnlistedCanReplyWithApproval0 = unlistedCanReplyWithApproval0 +} + +// WriteToRequest writes these params to a swagger request +func (o *PoliciesDefaultsUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.DirectCanFavouriteAlways0 != nil { + + // form param direct[can_favourite][always][0] + var frDirectCanFavouriteAlways0 string + if o.DirectCanFavouriteAlways0 != nil { + frDirectCanFavouriteAlways0 = *o.DirectCanFavouriteAlways0 + } + fDirectCanFavouriteAlways0 := frDirectCanFavouriteAlways0 + if fDirectCanFavouriteAlways0 != "" { + if err := r.SetFormParam("direct[can_favourite][always][0]", fDirectCanFavouriteAlways0); err != nil { + return err + } + } + } + + if o.DirectCanFavouriteWithApproval0 != nil { + + // form param direct[can_favourite][with_approval][0] + var frDirectCanFavouriteWithApproval0 string + if o.DirectCanFavouriteWithApproval0 != nil { + frDirectCanFavouriteWithApproval0 = *o.DirectCanFavouriteWithApproval0 + } + fDirectCanFavouriteWithApproval0 := frDirectCanFavouriteWithApproval0 + if fDirectCanFavouriteWithApproval0 != "" { + if err := r.SetFormParam("direct[can_favourite][with_approval][0]", fDirectCanFavouriteWithApproval0); err != nil { + return err + } + } + } + + if o.DirectCanReblogAlways0 != nil { + + // form param direct[can_reblog][always][0] + var frDirectCanReblogAlways0 string + if o.DirectCanReblogAlways0 != nil { + frDirectCanReblogAlways0 = *o.DirectCanReblogAlways0 + } + fDirectCanReblogAlways0 := frDirectCanReblogAlways0 + if fDirectCanReblogAlways0 != "" { + if err := r.SetFormParam("direct[can_reblog][always][0]", fDirectCanReblogAlways0); err != nil { + return err + } + } + } + + if o.DirectCanReblogWithApproval0 != nil { + + // form param direct[can_reblog][with_approval][0] + var frDirectCanReblogWithApproval0 string + if o.DirectCanReblogWithApproval0 != nil { + frDirectCanReblogWithApproval0 = *o.DirectCanReblogWithApproval0 + } + fDirectCanReblogWithApproval0 := frDirectCanReblogWithApproval0 + if fDirectCanReblogWithApproval0 != "" { + if err := r.SetFormParam("direct[can_reblog][with_approval][0]", fDirectCanReblogWithApproval0); err != nil { + return err + } + } + } + + if o.DirectCanReplyAlways0 != nil { + + // form param direct[can_reply][always][0] + var frDirectCanReplyAlways0 string + if o.DirectCanReplyAlways0 != nil { + frDirectCanReplyAlways0 = *o.DirectCanReplyAlways0 + } + fDirectCanReplyAlways0 := frDirectCanReplyAlways0 + if fDirectCanReplyAlways0 != "" { + if err := r.SetFormParam("direct[can_reply][always][0]", fDirectCanReplyAlways0); err != nil { + return err + } + } + } + + if o.DirectCanReplyWithApproval0 != nil { + + // form param direct[can_reply][with_approval][0] + var frDirectCanReplyWithApproval0 string + if o.DirectCanReplyWithApproval0 != nil { + frDirectCanReplyWithApproval0 = *o.DirectCanReplyWithApproval0 + } + fDirectCanReplyWithApproval0 := frDirectCanReplyWithApproval0 + if fDirectCanReplyWithApproval0 != "" { + if err := r.SetFormParam("direct[can_reply][with_approval][0]", fDirectCanReplyWithApproval0); err != nil { + return err + } + } + } + + if o.PrivateCanFavouriteAlways0 != nil { + + // form param private[can_favourite][always][0] + var frPrivateCanFavouriteAlways0 string + if o.PrivateCanFavouriteAlways0 != nil { + frPrivateCanFavouriteAlways0 = *o.PrivateCanFavouriteAlways0 + } + fPrivateCanFavouriteAlways0 := frPrivateCanFavouriteAlways0 + if fPrivateCanFavouriteAlways0 != "" { + if err := r.SetFormParam("private[can_favourite][always][0]", fPrivateCanFavouriteAlways0); err != nil { + return err + } + } + } + + if o.PrivateCanFavouriteWithApproval0 != nil { + + // form param private[can_favourite][with_approval][0] + var frPrivateCanFavouriteWithApproval0 string + if o.PrivateCanFavouriteWithApproval0 != nil { + frPrivateCanFavouriteWithApproval0 = *o.PrivateCanFavouriteWithApproval0 + } + fPrivateCanFavouriteWithApproval0 := frPrivateCanFavouriteWithApproval0 + if fPrivateCanFavouriteWithApproval0 != "" { + if err := r.SetFormParam("private[can_favourite][with_approval][0]", fPrivateCanFavouriteWithApproval0); err != nil { + return err + } + } + } + + if o.PrivateCanReblogAlways0 != nil { + + // form param private[can_reblog][always][0] + var frPrivateCanReblogAlways0 string + if o.PrivateCanReblogAlways0 != nil { + frPrivateCanReblogAlways0 = *o.PrivateCanReblogAlways0 + } + fPrivateCanReblogAlways0 := frPrivateCanReblogAlways0 + if fPrivateCanReblogAlways0 != "" { + if err := r.SetFormParam("private[can_reblog][always][0]", fPrivateCanReblogAlways0); err != nil { + return err + } + } + } + + if o.PrivateCanReblogWithApproval0 != nil { + + // form param private[can_reblog][with_approval][0] + var frPrivateCanReblogWithApproval0 string + if o.PrivateCanReblogWithApproval0 != nil { + frPrivateCanReblogWithApproval0 = *o.PrivateCanReblogWithApproval0 + } + fPrivateCanReblogWithApproval0 := frPrivateCanReblogWithApproval0 + if fPrivateCanReblogWithApproval0 != "" { + if err := r.SetFormParam("private[can_reblog][with_approval][0]", fPrivateCanReblogWithApproval0); err != nil { + return err + } + } + } + + if o.PrivateCanReplyAlways0 != nil { + + // form param private[can_reply][always][0] + var frPrivateCanReplyAlways0 string + if o.PrivateCanReplyAlways0 != nil { + frPrivateCanReplyAlways0 = *o.PrivateCanReplyAlways0 + } + fPrivateCanReplyAlways0 := frPrivateCanReplyAlways0 + if fPrivateCanReplyAlways0 != "" { + if err := r.SetFormParam("private[can_reply][always][0]", fPrivateCanReplyAlways0); err != nil { + return err + } + } + } + + if o.PrivateCanReplyWithApproval0 != nil { + + // form param private[can_reply][with_approval][0] + var frPrivateCanReplyWithApproval0 string + if o.PrivateCanReplyWithApproval0 != nil { + frPrivateCanReplyWithApproval0 = *o.PrivateCanReplyWithApproval0 + } + fPrivateCanReplyWithApproval0 := frPrivateCanReplyWithApproval0 + if fPrivateCanReplyWithApproval0 != "" { + if err := r.SetFormParam("private[can_reply][with_approval][0]", fPrivateCanReplyWithApproval0); err != nil { + return err + } + } + } + + if o.PublicCanFavouriteAlways0 != nil { + + // form param public[can_favourite][always][0] + var frPublicCanFavouriteAlways0 string + if o.PublicCanFavouriteAlways0 != nil { + frPublicCanFavouriteAlways0 = *o.PublicCanFavouriteAlways0 + } + fPublicCanFavouriteAlways0 := frPublicCanFavouriteAlways0 + if fPublicCanFavouriteAlways0 != "" { + if err := r.SetFormParam("public[can_favourite][always][0]", fPublicCanFavouriteAlways0); err != nil { + return err + } + } + } + + if o.PublicCanFavouriteWithApproval0 != nil { + + // form param public[can_favourite][with_approval][0] + var frPublicCanFavouriteWithApproval0 string + if o.PublicCanFavouriteWithApproval0 != nil { + frPublicCanFavouriteWithApproval0 = *o.PublicCanFavouriteWithApproval0 + } + fPublicCanFavouriteWithApproval0 := frPublicCanFavouriteWithApproval0 + if fPublicCanFavouriteWithApproval0 != "" { + if err := r.SetFormParam("public[can_favourite][with_approval][0]", fPublicCanFavouriteWithApproval0); err != nil { + return err + } + } + } + + if o.PublicCanReblogAlways0 != nil { + + // form param public[can_reblog][always][0] + var frPublicCanReblogAlways0 string + if o.PublicCanReblogAlways0 != nil { + frPublicCanReblogAlways0 = *o.PublicCanReblogAlways0 + } + fPublicCanReblogAlways0 := frPublicCanReblogAlways0 + if fPublicCanReblogAlways0 != "" { + if err := r.SetFormParam("public[can_reblog][always][0]", fPublicCanReblogAlways0); err != nil { + return err + } + } + } + + if o.PublicCanReblogWithApproval0 != nil { + + // form param public[can_reblog][with_approval][0] + var frPublicCanReblogWithApproval0 string + if o.PublicCanReblogWithApproval0 != nil { + frPublicCanReblogWithApproval0 = *o.PublicCanReblogWithApproval0 + } + fPublicCanReblogWithApproval0 := frPublicCanReblogWithApproval0 + if fPublicCanReblogWithApproval0 != "" { + if err := r.SetFormParam("public[can_reblog][with_approval][0]", fPublicCanReblogWithApproval0); err != nil { + return err + } + } + } + + if o.PublicCanReplyAlways0 != nil { + + // form param public[can_reply][always][0] + var frPublicCanReplyAlways0 string + if o.PublicCanReplyAlways0 != nil { + frPublicCanReplyAlways0 = *o.PublicCanReplyAlways0 + } + fPublicCanReplyAlways0 := frPublicCanReplyAlways0 + if fPublicCanReplyAlways0 != "" { + if err := r.SetFormParam("public[can_reply][always][0]", fPublicCanReplyAlways0); err != nil { + return err + } + } + } + + if o.PublicCanReplyWithApproval0 != nil { + + // form param public[can_reply][with_approval][0] + var frPublicCanReplyWithApproval0 string + if o.PublicCanReplyWithApproval0 != nil { + frPublicCanReplyWithApproval0 = *o.PublicCanReplyWithApproval0 + } + fPublicCanReplyWithApproval0 := frPublicCanReplyWithApproval0 + if fPublicCanReplyWithApproval0 != "" { + if err := r.SetFormParam("public[can_reply][with_approval][0]", fPublicCanReplyWithApproval0); err != nil { + return err + } + } + } + + if o.UnlistedCanFavouriteAlways0 != nil { + + // form param unlisted[can_favourite][always][0] + var frUnlistedCanFavouriteAlways0 string + if o.UnlistedCanFavouriteAlways0 != nil { + frUnlistedCanFavouriteAlways0 = *o.UnlistedCanFavouriteAlways0 + } + fUnlistedCanFavouriteAlways0 := frUnlistedCanFavouriteAlways0 + if fUnlistedCanFavouriteAlways0 != "" { + if err := r.SetFormParam("unlisted[can_favourite][always][0]", fUnlistedCanFavouriteAlways0); err != nil { + return err + } + } + } + + if o.UnlistedCanFavouriteWithApproval0 != nil { + + // form param unlisted[can_favourite][with_approval][0] + var frUnlistedCanFavouriteWithApproval0 string + if o.UnlistedCanFavouriteWithApproval0 != nil { + frUnlistedCanFavouriteWithApproval0 = *o.UnlistedCanFavouriteWithApproval0 + } + fUnlistedCanFavouriteWithApproval0 := frUnlistedCanFavouriteWithApproval0 + if fUnlistedCanFavouriteWithApproval0 != "" { + if err := r.SetFormParam("unlisted[can_favourite][with_approval][0]", fUnlistedCanFavouriteWithApproval0); err != nil { + return err + } + } + } + + if o.UnlistedCanReblogAlways0 != nil { + + // form param unlisted[can_reblog][always][0] + var frUnlistedCanReblogAlways0 string + if o.UnlistedCanReblogAlways0 != nil { + frUnlistedCanReblogAlways0 = *o.UnlistedCanReblogAlways0 + } + fUnlistedCanReblogAlways0 := frUnlistedCanReblogAlways0 + if fUnlistedCanReblogAlways0 != "" { + if err := r.SetFormParam("unlisted[can_reblog][always][0]", fUnlistedCanReblogAlways0); err != nil { + return err + } + } + } + + if o.UnlistedCanReblogWithApproval0 != nil { + + // form param unlisted[can_reblog][with_approval][0] + var frUnlistedCanReblogWithApproval0 string + if o.UnlistedCanReblogWithApproval0 != nil { + frUnlistedCanReblogWithApproval0 = *o.UnlistedCanReblogWithApproval0 + } + fUnlistedCanReblogWithApproval0 := frUnlistedCanReblogWithApproval0 + if fUnlistedCanReblogWithApproval0 != "" { + if err := r.SetFormParam("unlisted[can_reblog][with_approval][0]", fUnlistedCanReblogWithApproval0); err != nil { + return err + } + } + } + + if o.UnlistedCanReplyAlways0 != nil { + + // form param unlisted[can_reply][always][0] + var frUnlistedCanReplyAlways0 string + if o.UnlistedCanReplyAlways0 != nil { + frUnlistedCanReplyAlways0 = *o.UnlistedCanReplyAlways0 + } + fUnlistedCanReplyAlways0 := frUnlistedCanReplyAlways0 + if fUnlistedCanReplyAlways0 != "" { + if err := r.SetFormParam("unlisted[can_reply][always][0]", fUnlistedCanReplyAlways0); err != nil { + return err + } + } + } + + if o.UnlistedCanReplyWithApproval0 != nil { + + // form param unlisted[can_reply][with_approval][0] + var frUnlistedCanReplyWithApproval0 string + if o.UnlistedCanReplyWithApproval0 != nil { + frUnlistedCanReplyWithApproval0 = *o.UnlistedCanReplyWithApproval0 + } + fUnlistedCanReplyWithApproval0 := frUnlistedCanReplyWithApproval0 + if fUnlistedCanReplyWithApproval0 != "" { + if err := r.SetFormParam("unlisted[can_reply][with_approval][0]", fUnlistedCanReplyWithApproval0); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/interaction_policies/policies_defaults_update_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/interaction_policies/policies_defaults_update_responses.go new file mode 100644 index 0000000..82f0d01 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/interaction_policies/policies_defaults_update_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package interaction_policies + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// PoliciesDefaultsUpdateReader is a Reader for the PoliciesDefaultsUpdate structure. +type PoliciesDefaultsUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PoliciesDefaultsUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPoliciesDefaultsUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPoliciesDefaultsUpdateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPoliciesDefaultsUpdateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewPoliciesDefaultsUpdateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPoliciesDefaultsUpdateUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPoliciesDefaultsUpdateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PATCH /api/v1/interaction_policies/defaults] policiesDefaultsUpdate", response, response.Code()) + } +} + +// NewPoliciesDefaultsUpdateOK creates a PoliciesDefaultsUpdateOK with default headers values +func NewPoliciesDefaultsUpdateOK() *PoliciesDefaultsUpdateOK { + return &PoliciesDefaultsUpdateOK{} +} + +/* +PoliciesDefaultsUpdateOK describes a response with status code 200, with default header values. + +Updated default policies object containing a policy for each status visibility. +*/ +type PoliciesDefaultsUpdateOK struct { + Payload *models.DefaultPolicies +} + +// IsSuccess returns true when this policies defaults update o k response has a 2xx status code +func (o *PoliciesDefaultsUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this policies defaults update o k response has a 3xx status code +func (o *PoliciesDefaultsUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this policies defaults update o k response has a 4xx status code +func (o *PoliciesDefaultsUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this policies defaults update o k response has a 5xx status code +func (o *PoliciesDefaultsUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this policies defaults update o k response a status code equal to that given +func (o *PoliciesDefaultsUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the policies defaults update o k response +func (o *PoliciesDefaultsUpdateOK) Code() int { + return 200 +} + +func (o *PoliciesDefaultsUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateOK %s", 200, payload) +} + +func (o *PoliciesDefaultsUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateOK %s", 200, payload) +} + +func (o *PoliciesDefaultsUpdateOK) GetPayload() *models.DefaultPolicies { + return o.Payload +} + +func (o *PoliciesDefaultsUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DefaultPolicies) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPoliciesDefaultsUpdateBadRequest creates a PoliciesDefaultsUpdateBadRequest with default headers values +func NewPoliciesDefaultsUpdateBadRequest() *PoliciesDefaultsUpdateBadRequest { + return &PoliciesDefaultsUpdateBadRequest{} +} + +/* +PoliciesDefaultsUpdateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type PoliciesDefaultsUpdateBadRequest struct { +} + +// IsSuccess returns true when this policies defaults update bad request response has a 2xx status code +func (o *PoliciesDefaultsUpdateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this policies defaults update bad request response has a 3xx status code +func (o *PoliciesDefaultsUpdateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this policies defaults update bad request response has a 4xx status code +func (o *PoliciesDefaultsUpdateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this policies defaults update bad request response has a 5xx status code +func (o *PoliciesDefaultsUpdateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this policies defaults update bad request response a status code equal to that given +func (o *PoliciesDefaultsUpdateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the policies defaults update bad request response +func (o *PoliciesDefaultsUpdateBadRequest) Code() int { + return 400 +} + +func (o *PoliciesDefaultsUpdateBadRequest) Error() string { + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateBadRequest", 400) +} + +func (o *PoliciesDefaultsUpdateBadRequest) String() string { + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateBadRequest", 400) +} + +func (o *PoliciesDefaultsUpdateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPoliciesDefaultsUpdateUnauthorized creates a PoliciesDefaultsUpdateUnauthorized with default headers values +func NewPoliciesDefaultsUpdateUnauthorized() *PoliciesDefaultsUpdateUnauthorized { + return &PoliciesDefaultsUpdateUnauthorized{} +} + +/* +PoliciesDefaultsUpdateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type PoliciesDefaultsUpdateUnauthorized struct { +} + +// IsSuccess returns true when this policies defaults update unauthorized response has a 2xx status code +func (o *PoliciesDefaultsUpdateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this policies defaults update unauthorized response has a 3xx status code +func (o *PoliciesDefaultsUpdateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this policies defaults update unauthorized response has a 4xx status code +func (o *PoliciesDefaultsUpdateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this policies defaults update unauthorized response has a 5xx status code +func (o *PoliciesDefaultsUpdateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this policies defaults update unauthorized response a status code equal to that given +func (o *PoliciesDefaultsUpdateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the policies defaults update unauthorized response +func (o *PoliciesDefaultsUpdateUnauthorized) Code() int { + return 401 +} + +func (o *PoliciesDefaultsUpdateUnauthorized) Error() string { + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateUnauthorized", 401) +} + +func (o *PoliciesDefaultsUpdateUnauthorized) String() string { + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateUnauthorized", 401) +} + +func (o *PoliciesDefaultsUpdateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPoliciesDefaultsUpdateNotAcceptable creates a PoliciesDefaultsUpdateNotAcceptable with default headers values +func NewPoliciesDefaultsUpdateNotAcceptable() *PoliciesDefaultsUpdateNotAcceptable { + return &PoliciesDefaultsUpdateNotAcceptable{} +} + +/* +PoliciesDefaultsUpdateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type PoliciesDefaultsUpdateNotAcceptable struct { +} + +// IsSuccess returns true when this policies defaults update not acceptable response has a 2xx status code +func (o *PoliciesDefaultsUpdateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this policies defaults update not acceptable response has a 3xx status code +func (o *PoliciesDefaultsUpdateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this policies defaults update not acceptable response has a 4xx status code +func (o *PoliciesDefaultsUpdateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this policies defaults update not acceptable response has a 5xx status code +func (o *PoliciesDefaultsUpdateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this policies defaults update not acceptable response a status code equal to that given +func (o *PoliciesDefaultsUpdateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the policies defaults update not acceptable response +func (o *PoliciesDefaultsUpdateNotAcceptable) Code() int { + return 406 +} + +func (o *PoliciesDefaultsUpdateNotAcceptable) Error() string { + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateNotAcceptable", 406) +} + +func (o *PoliciesDefaultsUpdateNotAcceptable) String() string { + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateNotAcceptable", 406) +} + +func (o *PoliciesDefaultsUpdateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPoliciesDefaultsUpdateUnprocessableEntity creates a PoliciesDefaultsUpdateUnprocessableEntity with default headers values +func NewPoliciesDefaultsUpdateUnprocessableEntity() *PoliciesDefaultsUpdateUnprocessableEntity { + return &PoliciesDefaultsUpdateUnprocessableEntity{} +} + +/* +PoliciesDefaultsUpdateUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable +*/ +type PoliciesDefaultsUpdateUnprocessableEntity struct { +} + +// IsSuccess returns true when this policies defaults update unprocessable entity response has a 2xx status code +func (o *PoliciesDefaultsUpdateUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this policies defaults update unprocessable entity response has a 3xx status code +func (o *PoliciesDefaultsUpdateUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this policies defaults update unprocessable entity response has a 4xx status code +func (o *PoliciesDefaultsUpdateUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this policies defaults update unprocessable entity response has a 5xx status code +func (o *PoliciesDefaultsUpdateUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this policies defaults update unprocessable entity response a status code equal to that given +func (o *PoliciesDefaultsUpdateUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the policies defaults update unprocessable entity response +func (o *PoliciesDefaultsUpdateUnprocessableEntity) Code() int { + return 422 +} + +func (o *PoliciesDefaultsUpdateUnprocessableEntity) Error() string { + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateUnprocessableEntity", 422) +} + +func (o *PoliciesDefaultsUpdateUnprocessableEntity) String() string { + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateUnprocessableEntity", 422) +} + +func (o *PoliciesDefaultsUpdateUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPoliciesDefaultsUpdateInternalServerError creates a PoliciesDefaultsUpdateInternalServerError with default headers values +func NewPoliciesDefaultsUpdateInternalServerError() *PoliciesDefaultsUpdateInternalServerError { + return &PoliciesDefaultsUpdateInternalServerError{} +} + +/* +PoliciesDefaultsUpdateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type PoliciesDefaultsUpdateInternalServerError struct { +} + +// IsSuccess returns true when this policies defaults update internal server error response has a 2xx status code +func (o *PoliciesDefaultsUpdateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this policies defaults update internal server error response has a 3xx status code +func (o *PoliciesDefaultsUpdateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this policies defaults update internal server error response has a 4xx status code +func (o *PoliciesDefaultsUpdateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this policies defaults update internal server error response has a 5xx status code +func (o *PoliciesDefaultsUpdateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this policies defaults update internal server error response a status code equal to that given +func (o *PoliciesDefaultsUpdateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the policies defaults update internal server error response +func (o *PoliciesDefaultsUpdateInternalServerError) Code() int { + return 500 +} + +func (o *PoliciesDefaultsUpdateInternalServerError) Error() string { + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateInternalServerError", 500) +} + +func (o *PoliciesDefaultsUpdateInternalServerError) String() string { + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateInternalServerError", 500) +} + +func (o *PoliciesDefaultsUpdateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/add_list_accounts_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/add_list_accounts_parameters.go new file mode 100644 index 0000000..e9e6b8a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/add_list_accounts_parameters.go @@ -0,0 +1,197 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package lists + +// 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" +) + +// NewAddListAccountsParams creates a new AddListAccountsParams 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 NewAddListAccountsParams() *AddListAccountsParams { + return &AddListAccountsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAddListAccountsParamsWithTimeout creates a new AddListAccountsParams object +// with the ability to set a timeout on a request. +func NewAddListAccountsParamsWithTimeout(timeout time.Duration) *AddListAccountsParams { + return &AddListAccountsParams{ + timeout: timeout, + } +} + +// NewAddListAccountsParamsWithContext creates a new AddListAccountsParams object +// with the ability to set a context for a request. +func NewAddListAccountsParamsWithContext(ctx context.Context) *AddListAccountsParams { + return &AddListAccountsParams{ + Context: ctx, + } +} + +// NewAddListAccountsParamsWithHTTPClient creates a new AddListAccountsParams object +// with the ability to set a custom HTTPClient for a request. +func NewAddListAccountsParamsWithHTTPClient(client *http.Client) *AddListAccountsParams { + return &AddListAccountsParams{ + HTTPClient: client, + } +} + +/* +AddListAccountsParams contains all the parameters to send to the API endpoint + + for the add list accounts operation. + + Typically these are written to a http.Request. +*/ +type AddListAccountsParams struct { + + /* AccountIds. + + Array of accountIDs to modify. Each accountID must correspond to an account that the requesting account follows. + */ + AccountIds []string + + /* ID. + + ID of the list + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the add list accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AddListAccountsParams) WithDefaults() *AddListAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the add list accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AddListAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the add list accounts params +func (o *AddListAccountsParams) WithTimeout(timeout time.Duration) *AddListAccountsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the add list accounts params +func (o *AddListAccountsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the add list accounts params +func (o *AddListAccountsParams) WithContext(ctx context.Context) *AddListAccountsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the add list accounts params +func (o *AddListAccountsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the add list accounts params +func (o *AddListAccountsParams) WithHTTPClient(client *http.Client) *AddListAccountsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the add list accounts params +func (o *AddListAccountsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAccountIds adds the accountIds to the add list accounts params +func (o *AddListAccountsParams) WithAccountIds(accountIds []string) *AddListAccountsParams { + o.SetAccountIds(accountIds) + return o +} + +// SetAccountIds adds the accountIds to the add list accounts params +func (o *AddListAccountsParams) SetAccountIds(accountIds []string) { + o.AccountIds = accountIds +} + +// WithID adds the id to the add list accounts params +func (o *AddListAccountsParams) WithID(id string) *AddListAccountsParams { + o.SetID(id) + return o +} + +// SetID adds the id to the add list accounts params +func (o *AddListAccountsParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AddListAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.AccountIds != nil { + + // binding items for account_ids[] + joinedAccountIds := o.bindParamAccountIds(reg) + + // form array param account_ids[] + if err := r.SetFormParam("account_ids[]", joinedAccountIds...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamAddListAccounts binds the parameter account_ids[] +func (o *AddListAccountsParams) bindParamAccountIds(formats strfmt.Registry) []string { + accountIdsIR := o.AccountIds + + var accountIdsIC []string + for _, accountIdsIIR := range accountIdsIR { // explode []string + + accountIdsIIV := accountIdsIIR // string as string + accountIdsIC = append(accountIdsIC, accountIdsIIV) + } + + // items.CollectionFormat: "multi" + accountIdsIS := swag.JoinByFormat(accountIdsIC, "multi") + + return accountIdsIS +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/add_list_accounts_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/add_list_accounts_responses.go new file mode 100644 index 0000000..e05e60f --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/add_list_accounts_responses.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package lists + +// 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" +) + +// AddListAccountsReader is a Reader for the AddListAccounts structure. +type AddListAccountsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AddListAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAddListAccountsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAddListAccountsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAddListAccountsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAddListAccountsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAddListAccountsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAddListAccountsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/lists/{id}/accounts] addListAccounts", response, response.Code()) + } +} + +// NewAddListAccountsOK creates a AddListAccountsOK with default headers values +func NewAddListAccountsOK() *AddListAccountsOK { + return &AddListAccountsOK{} +} + +/* +AddListAccountsOK describes a response with status code 200, with default header values. + +list accounts updated +*/ +type AddListAccountsOK struct { +} + +// IsSuccess returns true when this add list accounts o k response has a 2xx status code +func (o *AddListAccountsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this add list accounts o k response has a 3xx status code +func (o *AddListAccountsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this add list accounts o k response has a 4xx status code +func (o *AddListAccountsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this add list accounts o k response has a 5xx status code +func (o *AddListAccountsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this add list accounts o k response a status code equal to that given +func (o *AddListAccountsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the add list accounts o k response +func (o *AddListAccountsOK) Code() int { + return 200 +} + +func (o *AddListAccountsOK) Error() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsOK", 200) +} + +func (o *AddListAccountsOK) String() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsOK", 200) +} + +func (o *AddListAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAddListAccountsBadRequest creates a AddListAccountsBadRequest with default headers values +func NewAddListAccountsBadRequest() *AddListAccountsBadRequest { + return &AddListAccountsBadRequest{} +} + +/* +AddListAccountsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AddListAccountsBadRequest struct { +} + +// IsSuccess returns true when this add list accounts bad request response has a 2xx status code +func (o *AddListAccountsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this add list accounts bad request response has a 3xx status code +func (o *AddListAccountsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this add list accounts bad request response has a 4xx status code +func (o *AddListAccountsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this add list accounts bad request response has a 5xx status code +func (o *AddListAccountsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this add list accounts bad request response a status code equal to that given +func (o *AddListAccountsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the add list accounts bad request response +func (o *AddListAccountsBadRequest) Code() int { + return 400 +} + +func (o *AddListAccountsBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsBadRequest", 400) +} + +func (o *AddListAccountsBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsBadRequest", 400) +} + +func (o *AddListAccountsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAddListAccountsUnauthorized creates a AddListAccountsUnauthorized with default headers values +func NewAddListAccountsUnauthorized() *AddListAccountsUnauthorized { + return &AddListAccountsUnauthorized{} +} + +/* +AddListAccountsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AddListAccountsUnauthorized struct { +} + +// IsSuccess returns true when this add list accounts unauthorized response has a 2xx status code +func (o *AddListAccountsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this add list accounts unauthorized response has a 3xx status code +func (o *AddListAccountsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this add list accounts unauthorized response has a 4xx status code +func (o *AddListAccountsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this add list accounts unauthorized response has a 5xx status code +func (o *AddListAccountsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this add list accounts unauthorized response a status code equal to that given +func (o *AddListAccountsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the add list accounts unauthorized response +func (o *AddListAccountsUnauthorized) Code() int { + return 401 +} + +func (o *AddListAccountsUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsUnauthorized", 401) +} + +func (o *AddListAccountsUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsUnauthorized", 401) +} + +func (o *AddListAccountsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAddListAccountsNotFound creates a AddListAccountsNotFound with default headers values +func NewAddListAccountsNotFound() *AddListAccountsNotFound { + return &AddListAccountsNotFound{} +} + +/* +AddListAccountsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AddListAccountsNotFound struct { +} + +// IsSuccess returns true when this add list accounts not found response has a 2xx status code +func (o *AddListAccountsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this add list accounts not found response has a 3xx status code +func (o *AddListAccountsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this add list accounts not found response has a 4xx status code +func (o *AddListAccountsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this add list accounts not found response has a 5xx status code +func (o *AddListAccountsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this add list accounts not found response a status code equal to that given +func (o *AddListAccountsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the add list accounts not found response +func (o *AddListAccountsNotFound) Code() int { + return 404 +} + +func (o *AddListAccountsNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsNotFound", 404) +} + +func (o *AddListAccountsNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsNotFound", 404) +} + +func (o *AddListAccountsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAddListAccountsNotAcceptable creates a AddListAccountsNotAcceptable with default headers values +func NewAddListAccountsNotAcceptable() *AddListAccountsNotAcceptable { + return &AddListAccountsNotAcceptable{} +} + +/* +AddListAccountsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AddListAccountsNotAcceptable struct { +} + +// IsSuccess returns true when this add list accounts not acceptable response has a 2xx status code +func (o *AddListAccountsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this add list accounts not acceptable response has a 3xx status code +func (o *AddListAccountsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this add list accounts not acceptable response has a 4xx status code +func (o *AddListAccountsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this add list accounts not acceptable response has a 5xx status code +func (o *AddListAccountsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this add list accounts not acceptable response a status code equal to that given +func (o *AddListAccountsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the add list accounts not acceptable response +func (o *AddListAccountsNotAcceptable) Code() int { + return 406 +} + +func (o *AddListAccountsNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsNotAcceptable", 406) +} + +func (o *AddListAccountsNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsNotAcceptable", 406) +} + +func (o *AddListAccountsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAddListAccountsInternalServerError creates a AddListAccountsInternalServerError with default headers values +func NewAddListAccountsInternalServerError() *AddListAccountsInternalServerError { + return &AddListAccountsInternalServerError{} +} + +/* +AddListAccountsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AddListAccountsInternalServerError struct { +} + +// IsSuccess returns true when this add list accounts internal server error response has a 2xx status code +func (o *AddListAccountsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this add list accounts internal server error response has a 3xx status code +func (o *AddListAccountsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this add list accounts internal server error response has a 4xx status code +func (o *AddListAccountsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this add list accounts internal server error response has a 5xx status code +func (o *AddListAccountsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this add list accounts internal server error response a status code equal to that given +func (o *AddListAccountsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the add list accounts internal server error response +func (o *AddListAccountsInternalServerError) Code() int { + return 500 +} + +func (o *AddListAccountsInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsInternalServerError", 500) +} + +func (o *AddListAccountsInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsInternalServerError", 500) +} + +func (o *AddListAccountsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_accounts_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_accounts_parameters.go new file mode 100644 index 0000000..06944e4 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_accounts_parameters.go @@ -0,0 +1,301 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package lists + +// 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" +) + +// NewListAccountsParams creates a new ListAccountsParams 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 NewListAccountsParams() *ListAccountsParams { + return &ListAccountsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListAccountsParamsWithTimeout creates a new ListAccountsParams object +// with the ability to set a timeout on a request. +func NewListAccountsParamsWithTimeout(timeout time.Duration) *ListAccountsParams { + return &ListAccountsParams{ + timeout: timeout, + } +} + +// NewListAccountsParamsWithContext creates a new ListAccountsParams object +// with the ability to set a context for a request. +func NewListAccountsParamsWithContext(ctx context.Context) *ListAccountsParams { + return &ListAccountsParams{ + Context: ctx, + } +} + +// NewListAccountsParamsWithHTTPClient creates a new ListAccountsParams object +// with the ability to set a custom HTTPClient for a request. +func NewListAccountsParamsWithHTTPClient(client *http.Client) *ListAccountsParams { + return &ListAccountsParams{ + HTTPClient: client, + } +} + +/* +ListAccountsParams contains all the parameters to send to the API endpoint + + for the list accounts operation. + + Typically these are written to a http.Request. +*/ +type ListAccountsParams struct { + + /* ID. + + ID of the list + */ + ID string + + /* Limit. + + Number of accounts to return. If set to 0 explicitly, all accounts in the list will be returned, and pagination headers will not be used. This is a workaround for Mastodon API peculiarities: https://docs.joinmastodon.org/methods/lists/#query-parameters. + + Default: 40 + */ + Limit *int64 + + /* MaxID. + + Return only list entries *OLDER* than the given max ID. The account from the list entry with the specified ID will not be included in the response. + */ + MaxID *string + + /* MinID. + + Return only list entries *IMMEDIATELY NEWER* than the given min ID. The account from the list entry with the specified ID will not be included in the response. + */ + MinID *string + + /* SinceID. + + Return only list entries *NEWER* than the given since ID. The account from the list entry with the specified ID will not be included in the response. + */ + SinceID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListAccountsParams) WithDefaults() *ListAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListAccountsParams) SetDefaults() { + var ( + limitDefault = int64(40) + ) + + val := ListAccountsParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the list accounts params +func (o *ListAccountsParams) WithTimeout(timeout time.Duration) *ListAccountsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list accounts params +func (o *ListAccountsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list accounts params +func (o *ListAccountsParams) WithContext(ctx context.Context) *ListAccountsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list accounts params +func (o *ListAccountsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list accounts params +func (o *ListAccountsParams) WithHTTPClient(client *http.Client) *ListAccountsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list accounts params +func (o *ListAccountsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the list accounts params +func (o *ListAccountsParams) WithID(id string) *ListAccountsParams { + o.SetID(id) + return o +} + +// SetID adds the id to the list accounts params +func (o *ListAccountsParams) SetID(id string) { + o.ID = id +} + +// WithLimit adds the limit to the list accounts params +func (o *ListAccountsParams) WithLimit(limit *int64) *ListAccountsParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the list accounts params +func (o *ListAccountsParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the list accounts params +func (o *ListAccountsParams) WithMaxID(maxID *string) *ListAccountsParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the list accounts params +func (o *ListAccountsParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the list accounts params +func (o *ListAccountsParams) WithMinID(minID *string) *ListAccountsParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the list accounts params +func (o *ListAccountsParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the list accounts params +func (o *ListAccountsParams) WithSinceID(sinceID *string) *ListAccountsParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the list accounts params +func (o *ListAccountsParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); 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.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if o.SinceID != nil { + + // query param since_id + var qrSinceID string + + if o.SinceID != nil { + qrSinceID = *o.SinceID + } + qSinceID := qrSinceID + if qSinceID != "" { + + if err := r.SetQueryParam("since_id", qSinceID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_accounts_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_accounts_responses.go new file mode 100644 index 0000000..ae65986 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_accounts_responses.go @@ -0,0 +1,426 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package lists + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ListAccountsReader is a Reader for the ListAccounts structure. +type ListAccountsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListAccountsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewListAccountsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewListAccountsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewListAccountsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewListAccountsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewListAccountsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/lists/{id}/accounts] listAccounts", response, response.Code()) + } +} + +// NewListAccountsOK creates a ListAccountsOK with default headers values +func NewListAccountsOK() *ListAccountsOK { + return &ListAccountsOK{} +} + +/* +ListAccountsOK describes a response with status code 200, with default header values. + +Array of accounts. +*/ +type ListAccountsOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Account +} + +// IsSuccess returns true when this list accounts o k response has a 2xx status code +func (o *ListAccountsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list accounts o k response has a 3xx status code +func (o *ListAccountsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list accounts o k response has a 4xx status code +func (o *ListAccountsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list accounts o k response has a 5xx status code +func (o *ListAccountsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list accounts o k response a status code equal to that given +func (o *ListAccountsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list accounts o k response +func (o *ListAccountsOK) Code() int { + return 200 +} + +func (o *ListAccountsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsOK %s", 200, payload) +} + +func (o *ListAccountsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsOK %s", 200, payload) +} + +func (o *ListAccountsOK) GetPayload() []*models.Account { + return o.Payload +} + +func (o *ListAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListAccountsBadRequest creates a ListAccountsBadRequest with default headers values +func NewListAccountsBadRequest() *ListAccountsBadRequest { + return &ListAccountsBadRequest{} +} + +/* +ListAccountsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ListAccountsBadRequest struct { +} + +// IsSuccess returns true when this list accounts bad request response has a 2xx status code +func (o *ListAccountsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list accounts bad request response has a 3xx status code +func (o *ListAccountsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list accounts bad request response has a 4xx status code +func (o *ListAccountsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this list accounts bad request response has a 5xx status code +func (o *ListAccountsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this list accounts bad request response a status code equal to that given +func (o *ListAccountsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the list accounts bad request response +func (o *ListAccountsBadRequest) Code() int { + return 400 +} + +func (o *ListAccountsBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsBadRequest", 400) +} + +func (o *ListAccountsBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsBadRequest", 400) +} + +func (o *ListAccountsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListAccountsUnauthorized creates a ListAccountsUnauthorized with default headers values +func NewListAccountsUnauthorized() *ListAccountsUnauthorized { + return &ListAccountsUnauthorized{} +} + +/* +ListAccountsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ListAccountsUnauthorized struct { +} + +// IsSuccess returns true when this list accounts unauthorized response has a 2xx status code +func (o *ListAccountsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list accounts unauthorized response has a 3xx status code +func (o *ListAccountsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list accounts unauthorized response has a 4xx status code +func (o *ListAccountsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this list accounts unauthorized response has a 5xx status code +func (o *ListAccountsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this list accounts unauthorized response a status code equal to that given +func (o *ListAccountsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the list accounts unauthorized response +func (o *ListAccountsUnauthorized) Code() int { + return 401 +} + +func (o *ListAccountsUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsUnauthorized", 401) +} + +func (o *ListAccountsUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsUnauthorized", 401) +} + +func (o *ListAccountsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListAccountsNotFound creates a ListAccountsNotFound with default headers values +func NewListAccountsNotFound() *ListAccountsNotFound { + return &ListAccountsNotFound{} +} + +/* +ListAccountsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ListAccountsNotFound struct { +} + +// IsSuccess returns true when this list accounts not found response has a 2xx status code +func (o *ListAccountsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list accounts not found response has a 3xx status code +func (o *ListAccountsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list accounts not found response has a 4xx status code +func (o *ListAccountsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this list accounts not found response has a 5xx status code +func (o *ListAccountsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this list accounts not found response a status code equal to that given +func (o *ListAccountsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the list accounts not found response +func (o *ListAccountsNotFound) Code() int { + return 404 +} + +func (o *ListAccountsNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsNotFound", 404) +} + +func (o *ListAccountsNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsNotFound", 404) +} + +func (o *ListAccountsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListAccountsNotAcceptable creates a ListAccountsNotAcceptable with default headers values +func NewListAccountsNotAcceptable() *ListAccountsNotAcceptable { + return &ListAccountsNotAcceptable{} +} + +/* +ListAccountsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ListAccountsNotAcceptable struct { +} + +// IsSuccess returns true when this list accounts not acceptable response has a 2xx status code +func (o *ListAccountsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list accounts not acceptable response has a 3xx status code +func (o *ListAccountsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list accounts not acceptable response has a 4xx status code +func (o *ListAccountsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this list accounts not acceptable response has a 5xx status code +func (o *ListAccountsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this list accounts not acceptable response a status code equal to that given +func (o *ListAccountsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the list accounts not acceptable response +func (o *ListAccountsNotAcceptable) Code() int { + return 406 +} + +func (o *ListAccountsNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsNotAcceptable", 406) +} + +func (o *ListAccountsNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsNotAcceptable", 406) +} + +func (o *ListAccountsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListAccountsInternalServerError creates a ListAccountsInternalServerError with default headers values +func NewListAccountsInternalServerError() *ListAccountsInternalServerError { + return &ListAccountsInternalServerError{} +} + +/* +ListAccountsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ListAccountsInternalServerError struct { +} + +// IsSuccess returns true when this list accounts internal server error response has a 2xx status code +func (o *ListAccountsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list accounts internal server error response has a 3xx status code +func (o *ListAccountsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list accounts internal server error response has a 4xx status code +func (o *ListAccountsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this list accounts internal server error response has a 5xx status code +func (o *ListAccountsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this list accounts internal server error response a status code equal to that given +func (o *ListAccountsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the list accounts internal server error response +func (o *ListAccountsInternalServerError) Code() int { + return 500 +} + +func (o *ListAccountsInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsInternalServerError", 500) +} + +func (o *ListAccountsInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsInternalServerError", 500) +} + +func (o *ListAccountsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_create_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_create_parameters.go new file mode 100644 index 0000000..e79592d --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_create_parameters.go @@ -0,0 +1,205 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package lists + +// 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" +) + +// NewListCreateParams creates a new ListCreateParams 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 NewListCreateParams() *ListCreateParams { + return &ListCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListCreateParamsWithTimeout creates a new ListCreateParams object +// with the ability to set a timeout on a request. +func NewListCreateParamsWithTimeout(timeout time.Duration) *ListCreateParams { + return &ListCreateParams{ + timeout: timeout, + } +} + +// NewListCreateParamsWithContext creates a new ListCreateParams object +// with the ability to set a context for a request. +func NewListCreateParamsWithContext(ctx context.Context) *ListCreateParams { + return &ListCreateParams{ + Context: ctx, + } +} + +// NewListCreateParamsWithHTTPClient creates a new ListCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewListCreateParamsWithHTTPClient(client *http.Client) *ListCreateParams { + return &ListCreateParams{ + HTTPClient: client, + } +} + +/* +ListCreateParams contains all the parameters to send to the API endpoint + + for the list create operation. + + Typically these are written to a http.Request. +*/ +type ListCreateParams struct { + + /* RepliesPolicy. + + RepliesPolicy for this list. + followed = Show replies to any followed user + list = Show replies to members of the list + none = Show replies to no one + Sample: list + + Default: "list" + */ + RepliesPolicy *string + + /* Title. + + Title of this list. + Sample: Cool People + */ + Title string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListCreateParams) WithDefaults() *ListCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListCreateParams) SetDefaults() { + var ( + repliesPolicyDefault = string("list") + ) + + val := ListCreateParams{ + RepliesPolicy: &repliesPolicyDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the list create params +func (o *ListCreateParams) WithTimeout(timeout time.Duration) *ListCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list create params +func (o *ListCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list create params +func (o *ListCreateParams) WithContext(ctx context.Context) *ListCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list create params +func (o *ListCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list create params +func (o *ListCreateParams) WithHTTPClient(client *http.Client) *ListCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list create params +func (o *ListCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithRepliesPolicy adds the repliesPolicy to the list create params +func (o *ListCreateParams) WithRepliesPolicy(repliesPolicy *string) *ListCreateParams { + o.SetRepliesPolicy(repliesPolicy) + return o +} + +// SetRepliesPolicy adds the repliesPolicy to the list create params +func (o *ListCreateParams) SetRepliesPolicy(repliesPolicy *string) { + o.RepliesPolicy = repliesPolicy +} + +// WithTitle adds the title to the list create params +func (o *ListCreateParams) WithTitle(title string) *ListCreateParams { + o.SetTitle(title) + return o +} + +// SetTitle adds the title to the list create params +func (o *ListCreateParams) SetTitle(title string) { + o.Title = title +} + +// WriteToRequest writes these params to a swagger request +func (o *ListCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.RepliesPolicy != nil { + + // form param replies_policy + var frRepliesPolicy string + if o.RepliesPolicy != nil { + frRepliesPolicy = *o.RepliesPolicy + } + fRepliesPolicy := frRepliesPolicy + if fRepliesPolicy != "" { + if err := r.SetFormParam("replies_policy", fRepliesPolicy); err != nil { + return err + } + } + } + + // form param title + frTitle := o.Title + fTitle := frTitle + if fTitle != "" { + if err := r.SetFormParam("title", fTitle); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_create_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_create_responses.go new file mode 100644 index 0000000..b938343 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_create_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package lists + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ListCreateReader is a Reader for the ListCreate structure. +type ListCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewListCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewListCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewListCreateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewListCreateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewListCreateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewListCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/lists] listCreate", response, response.Code()) + } +} + +// NewListCreateOK creates a ListCreateOK with default headers values +func NewListCreateOK() *ListCreateOK { + return &ListCreateOK{} +} + +/* +ListCreateOK describes a response with status code 200, with default header values. + +The newly created list. +*/ +type ListCreateOK struct { + Payload *models.List +} + +// IsSuccess returns true when this list create o k response has a 2xx status code +func (o *ListCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list create o k response has a 3xx status code +func (o *ListCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list create o k response has a 4xx status code +func (o *ListCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list create o k response has a 5xx status code +func (o *ListCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list create o k response a status code equal to that given +func (o *ListCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list create o k response +func (o *ListCreateOK) Code() int { + return 200 +} + +func (o *ListCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateOK %s", 200, payload) +} + +func (o *ListCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateOK %s", 200, payload) +} + +func (o *ListCreateOK) GetPayload() *models.List { + return o.Payload +} + +func (o *ListCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.List) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListCreateBadRequest creates a ListCreateBadRequest with default headers values +func NewListCreateBadRequest() *ListCreateBadRequest { + return &ListCreateBadRequest{} +} + +/* +ListCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ListCreateBadRequest struct { +} + +// IsSuccess returns true when this list create bad request response has a 2xx status code +func (o *ListCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list create bad request response has a 3xx status code +func (o *ListCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list create bad request response has a 4xx status code +func (o *ListCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this list create bad request response has a 5xx status code +func (o *ListCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this list create bad request response a status code equal to that given +func (o *ListCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the list create bad request response +func (o *ListCreateBadRequest) Code() int { + return 400 +} + +func (o *ListCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateBadRequest", 400) +} + +func (o *ListCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateBadRequest", 400) +} + +func (o *ListCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListCreateUnauthorized creates a ListCreateUnauthorized with default headers values +func NewListCreateUnauthorized() *ListCreateUnauthorized { + return &ListCreateUnauthorized{} +} + +/* +ListCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ListCreateUnauthorized struct { +} + +// IsSuccess returns true when this list create unauthorized response has a 2xx status code +func (o *ListCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list create unauthorized response has a 3xx status code +func (o *ListCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list create unauthorized response has a 4xx status code +func (o *ListCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this list create unauthorized response has a 5xx status code +func (o *ListCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this list create unauthorized response a status code equal to that given +func (o *ListCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the list create unauthorized response +func (o *ListCreateUnauthorized) Code() int { + return 401 +} + +func (o *ListCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateUnauthorized", 401) +} + +func (o *ListCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateUnauthorized", 401) +} + +func (o *ListCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListCreateForbidden creates a ListCreateForbidden with default headers values +func NewListCreateForbidden() *ListCreateForbidden { + return &ListCreateForbidden{} +} + +/* +ListCreateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type ListCreateForbidden struct { +} + +// IsSuccess returns true when this list create forbidden response has a 2xx status code +func (o *ListCreateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list create forbidden response has a 3xx status code +func (o *ListCreateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list create forbidden response has a 4xx status code +func (o *ListCreateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this list create forbidden response has a 5xx status code +func (o *ListCreateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this list create forbidden response a status code equal to that given +func (o *ListCreateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the list create forbidden response +func (o *ListCreateForbidden) Code() int { + return 403 +} + +func (o *ListCreateForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateForbidden", 403) +} + +func (o *ListCreateForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateForbidden", 403) +} + +func (o *ListCreateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListCreateNotFound creates a ListCreateNotFound with default headers values +func NewListCreateNotFound() *ListCreateNotFound { + return &ListCreateNotFound{} +} + +/* +ListCreateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ListCreateNotFound struct { +} + +// IsSuccess returns true when this list create not found response has a 2xx status code +func (o *ListCreateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list create not found response has a 3xx status code +func (o *ListCreateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list create not found response has a 4xx status code +func (o *ListCreateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this list create not found response has a 5xx status code +func (o *ListCreateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this list create not found response a status code equal to that given +func (o *ListCreateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the list create not found response +func (o *ListCreateNotFound) Code() int { + return 404 +} + +func (o *ListCreateNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateNotFound", 404) +} + +func (o *ListCreateNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateNotFound", 404) +} + +func (o *ListCreateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListCreateNotAcceptable creates a ListCreateNotAcceptable with default headers values +func NewListCreateNotAcceptable() *ListCreateNotAcceptable { + return &ListCreateNotAcceptable{} +} + +/* +ListCreateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ListCreateNotAcceptable struct { +} + +// IsSuccess returns true when this list create not acceptable response has a 2xx status code +func (o *ListCreateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list create not acceptable response has a 3xx status code +func (o *ListCreateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list create not acceptable response has a 4xx status code +func (o *ListCreateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this list create not acceptable response has a 5xx status code +func (o *ListCreateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this list create not acceptable response a status code equal to that given +func (o *ListCreateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the list create not acceptable response +func (o *ListCreateNotAcceptable) Code() int { + return 406 +} + +func (o *ListCreateNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateNotAcceptable", 406) +} + +func (o *ListCreateNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateNotAcceptable", 406) +} + +func (o *ListCreateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListCreateInternalServerError creates a ListCreateInternalServerError with default headers values +func NewListCreateInternalServerError() *ListCreateInternalServerError { + return &ListCreateInternalServerError{} +} + +/* +ListCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ListCreateInternalServerError struct { +} + +// IsSuccess returns true when this list create internal server error response has a 2xx status code +func (o *ListCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list create internal server error response has a 3xx status code +func (o *ListCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list create internal server error response has a 4xx status code +func (o *ListCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this list create internal server error response has a 5xx status code +func (o *ListCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this list create internal server error response a status code equal to that given +func (o *ListCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the list create internal server error response +func (o *ListCreateInternalServerError) Code() int { + return 500 +} + +func (o *ListCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateInternalServerError", 500) +} + +func (o *ListCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateInternalServerError", 500) +} + +func (o *ListCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_delete_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_delete_parameters.go new file mode 100644 index 0000000..04d1c11 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package lists + +// 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" +) + +// NewListDeleteParams creates a new ListDeleteParams 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 NewListDeleteParams() *ListDeleteParams { + return &ListDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListDeleteParamsWithTimeout creates a new ListDeleteParams object +// with the ability to set a timeout on a request. +func NewListDeleteParamsWithTimeout(timeout time.Duration) *ListDeleteParams { + return &ListDeleteParams{ + timeout: timeout, + } +} + +// NewListDeleteParamsWithContext creates a new ListDeleteParams object +// with the ability to set a context for a request. +func NewListDeleteParamsWithContext(ctx context.Context) *ListDeleteParams { + return &ListDeleteParams{ + Context: ctx, + } +} + +// NewListDeleteParamsWithHTTPClient creates a new ListDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewListDeleteParamsWithHTTPClient(client *http.Client) *ListDeleteParams { + return &ListDeleteParams{ + HTTPClient: client, + } +} + +/* +ListDeleteParams contains all the parameters to send to the API endpoint + + for the list delete operation. + + Typically these are written to a http.Request. +*/ +type ListDeleteParams struct { + + /* ID. + + ID of the list + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListDeleteParams) WithDefaults() *ListDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list delete params +func (o *ListDeleteParams) WithTimeout(timeout time.Duration) *ListDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list delete params +func (o *ListDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list delete params +func (o *ListDeleteParams) WithContext(ctx context.Context) *ListDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list delete params +func (o *ListDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list delete params +func (o *ListDeleteParams) WithHTTPClient(client *http.Client) *ListDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list delete params +func (o *ListDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the list delete params +func (o *ListDeleteParams) WithID(id string) *ListDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the list delete params +func (o *ListDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *ListDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_delete_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_delete_responses.go new file mode 100644 index 0000000..6cc5d14 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_delete_responses.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package lists + +// 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" +) + +// ListDeleteReader is a Reader for the ListDelete structure. +type ListDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewListDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewListDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewListDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewListDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewListDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/lists/{id}] listDelete", response, response.Code()) + } +} + +// NewListDeleteOK creates a ListDeleteOK with default headers values +func NewListDeleteOK() *ListDeleteOK { + return &ListDeleteOK{} +} + +/* +ListDeleteOK describes a response with status code 200, with default header values. + +list deleted +*/ +type ListDeleteOK struct { +} + +// IsSuccess returns true when this list delete o k response has a 2xx status code +func (o *ListDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list delete o k response has a 3xx status code +func (o *ListDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list delete o k response has a 4xx status code +func (o *ListDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list delete o k response has a 5xx status code +func (o *ListDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list delete o k response a status code equal to that given +func (o *ListDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list delete o k response +func (o *ListDeleteOK) Code() int { + return 200 +} + +func (o *ListDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteOK", 200) +} + +func (o *ListDeleteOK) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteOK", 200) +} + +func (o *ListDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListDeleteBadRequest creates a ListDeleteBadRequest with default headers values +func NewListDeleteBadRequest() *ListDeleteBadRequest { + return &ListDeleteBadRequest{} +} + +/* +ListDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ListDeleteBadRequest struct { +} + +// IsSuccess returns true when this list delete bad request response has a 2xx status code +func (o *ListDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list delete bad request response has a 3xx status code +func (o *ListDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list delete bad request response has a 4xx status code +func (o *ListDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this list delete bad request response has a 5xx status code +func (o *ListDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this list delete bad request response a status code equal to that given +func (o *ListDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the list delete bad request response +func (o *ListDeleteBadRequest) Code() int { + return 400 +} + +func (o *ListDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteBadRequest", 400) +} + +func (o *ListDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteBadRequest", 400) +} + +func (o *ListDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListDeleteUnauthorized creates a ListDeleteUnauthorized with default headers values +func NewListDeleteUnauthorized() *ListDeleteUnauthorized { + return &ListDeleteUnauthorized{} +} + +/* +ListDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ListDeleteUnauthorized struct { +} + +// IsSuccess returns true when this list delete unauthorized response has a 2xx status code +func (o *ListDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list delete unauthorized response has a 3xx status code +func (o *ListDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list delete unauthorized response has a 4xx status code +func (o *ListDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this list delete unauthorized response has a 5xx status code +func (o *ListDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this list delete unauthorized response a status code equal to that given +func (o *ListDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the list delete unauthorized response +func (o *ListDeleteUnauthorized) Code() int { + return 401 +} + +func (o *ListDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteUnauthorized", 401) +} + +func (o *ListDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteUnauthorized", 401) +} + +func (o *ListDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListDeleteNotFound creates a ListDeleteNotFound with default headers values +func NewListDeleteNotFound() *ListDeleteNotFound { + return &ListDeleteNotFound{} +} + +/* +ListDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ListDeleteNotFound struct { +} + +// IsSuccess returns true when this list delete not found response has a 2xx status code +func (o *ListDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list delete not found response has a 3xx status code +func (o *ListDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list delete not found response has a 4xx status code +func (o *ListDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this list delete not found response has a 5xx status code +func (o *ListDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this list delete not found response a status code equal to that given +func (o *ListDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the list delete not found response +func (o *ListDeleteNotFound) Code() int { + return 404 +} + +func (o *ListDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteNotFound", 404) +} + +func (o *ListDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteNotFound", 404) +} + +func (o *ListDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListDeleteNotAcceptable creates a ListDeleteNotAcceptable with default headers values +func NewListDeleteNotAcceptable() *ListDeleteNotAcceptable { + return &ListDeleteNotAcceptable{} +} + +/* +ListDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ListDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this list delete not acceptable response has a 2xx status code +func (o *ListDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list delete not acceptable response has a 3xx status code +func (o *ListDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list delete not acceptable response has a 4xx status code +func (o *ListDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this list delete not acceptable response has a 5xx status code +func (o *ListDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this list delete not acceptable response a status code equal to that given +func (o *ListDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the list delete not acceptable response +func (o *ListDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *ListDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteNotAcceptable", 406) +} + +func (o *ListDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteNotAcceptable", 406) +} + +func (o *ListDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListDeleteInternalServerError creates a ListDeleteInternalServerError with default headers values +func NewListDeleteInternalServerError() *ListDeleteInternalServerError { + return &ListDeleteInternalServerError{} +} + +/* +ListDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ListDeleteInternalServerError struct { +} + +// IsSuccess returns true when this list delete internal server error response has a 2xx status code +func (o *ListDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list delete internal server error response has a 3xx status code +func (o *ListDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list delete internal server error response has a 4xx status code +func (o *ListDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this list delete internal server error response has a 5xx status code +func (o *ListDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this list delete internal server error response a status code equal to that given +func (o *ListDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the list delete internal server error response +func (o *ListDeleteInternalServerError) Code() int { + return 500 +} + +func (o *ListDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteInternalServerError", 500) +} + +func (o *ListDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteInternalServerError", 500) +} + +func (o *ListDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_parameters.go new file mode 100644 index 0000000..213bc3b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package lists + +// 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" +) + +// NewListParams creates a new ListParams 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 NewListParams() *ListParams { + return &ListParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListParamsWithTimeout creates a new ListParams object +// with the ability to set a timeout on a request. +func NewListParamsWithTimeout(timeout time.Duration) *ListParams { + return &ListParams{ + timeout: timeout, + } +} + +// NewListParamsWithContext creates a new ListParams object +// with the ability to set a context for a request. +func NewListParamsWithContext(ctx context.Context) *ListParams { + return &ListParams{ + Context: ctx, + } +} + +// NewListParamsWithHTTPClient creates a new ListParams object +// with the ability to set a custom HTTPClient for a request. +func NewListParamsWithHTTPClient(client *http.Client) *ListParams { + return &ListParams{ + HTTPClient: client, + } +} + +/* +ListParams contains all the parameters to send to the API endpoint + + for the list operation. + + Typically these are written to a http.Request. +*/ +type ListParams struct { + + /* ID. + + ID of the list + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListParams) WithDefaults() *ListParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list params +func (o *ListParams) WithTimeout(timeout time.Duration) *ListParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list params +func (o *ListParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list params +func (o *ListParams) WithContext(ctx context.Context) *ListParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list params +func (o *ListParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list params +func (o *ListParams) WithHTTPClient(client *http.Client) *ListParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list params +func (o *ListParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the list params +func (o *ListParams) WithID(id string) *ListParams { + o.SetID(id) + return o +} + +// SetID adds the id to the list params +func (o *ListParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *ListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_responses.go new file mode 100644 index 0000000..17040c8 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package lists + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ListReader is a Reader for the List structure. +type ListReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewListBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewListUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewListNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewListNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewListInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/lists/{id}] list", response, response.Code()) + } +} + +// NewListOK creates a ListOK with default headers values +func NewListOK() *ListOK { + return &ListOK{} +} + +/* +ListOK describes a response with status code 200, with default header values. + +Requested list. +*/ +type ListOK struct { + Payload *models.List +} + +// IsSuccess returns true when this list o k response has a 2xx status code +func (o *ListOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list o k response has a 3xx status code +func (o *ListOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list o k response has a 4xx status code +func (o *ListOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list o k response has a 5xx status code +func (o *ListOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list o k response a status code equal to that given +func (o *ListOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list o k response +func (o *ListOK) Code() int { + return 200 +} + +func (o *ListOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listOK %s", 200, payload) +} + +func (o *ListOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listOK %s", 200, payload) +} + +func (o *ListOK) GetPayload() *models.List { + return o.Payload +} + +func (o *ListOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.List) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListBadRequest creates a ListBadRequest with default headers values +func NewListBadRequest() *ListBadRequest { + return &ListBadRequest{} +} + +/* +ListBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ListBadRequest struct { +} + +// IsSuccess returns true when this list bad request response has a 2xx status code +func (o *ListBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list bad request response has a 3xx status code +func (o *ListBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list bad request response has a 4xx status code +func (o *ListBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this list bad request response has a 5xx status code +func (o *ListBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this list bad request response a status code equal to that given +func (o *ListBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the list bad request response +func (o *ListBadRequest) Code() int { + return 400 +} + +func (o *ListBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listBadRequest", 400) +} + +func (o *ListBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listBadRequest", 400) +} + +func (o *ListBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListUnauthorized creates a ListUnauthorized with default headers values +func NewListUnauthorized() *ListUnauthorized { + return &ListUnauthorized{} +} + +/* +ListUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ListUnauthorized struct { +} + +// IsSuccess returns true when this list unauthorized response has a 2xx status code +func (o *ListUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list unauthorized response has a 3xx status code +func (o *ListUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list unauthorized response has a 4xx status code +func (o *ListUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this list unauthorized response has a 5xx status code +func (o *ListUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this list unauthorized response a status code equal to that given +func (o *ListUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the list unauthorized response +func (o *ListUnauthorized) Code() int { + return 401 +} + +func (o *ListUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listUnauthorized", 401) +} + +func (o *ListUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listUnauthorized", 401) +} + +func (o *ListUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListNotFound creates a ListNotFound with default headers values +func NewListNotFound() *ListNotFound { + return &ListNotFound{} +} + +/* +ListNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ListNotFound struct { +} + +// IsSuccess returns true when this list not found response has a 2xx status code +func (o *ListNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list not found response has a 3xx status code +func (o *ListNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list not found response has a 4xx status code +func (o *ListNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this list not found response has a 5xx status code +func (o *ListNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this list not found response a status code equal to that given +func (o *ListNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the list not found response +func (o *ListNotFound) Code() int { + return 404 +} + +func (o *ListNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listNotFound", 404) +} + +func (o *ListNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listNotFound", 404) +} + +func (o *ListNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListNotAcceptable creates a ListNotAcceptable with default headers values +func NewListNotAcceptable() *ListNotAcceptable { + return &ListNotAcceptable{} +} + +/* +ListNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ListNotAcceptable struct { +} + +// IsSuccess returns true when this list not acceptable response has a 2xx status code +func (o *ListNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list not acceptable response has a 3xx status code +func (o *ListNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list not acceptable response has a 4xx status code +func (o *ListNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this list not acceptable response has a 5xx status code +func (o *ListNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this list not acceptable response a status code equal to that given +func (o *ListNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the list not acceptable response +func (o *ListNotAcceptable) Code() int { + return 406 +} + +func (o *ListNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listNotAcceptable", 406) +} + +func (o *ListNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listNotAcceptable", 406) +} + +func (o *ListNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListInternalServerError creates a ListInternalServerError with default headers values +func NewListInternalServerError() *ListInternalServerError { + return &ListInternalServerError{} +} + +/* +ListInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ListInternalServerError struct { +} + +// IsSuccess returns true when this list internal server error response has a 2xx status code +func (o *ListInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list internal server error response has a 3xx status code +func (o *ListInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list internal server error response has a 4xx status code +func (o *ListInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this list internal server error response has a 5xx status code +func (o *ListInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this list internal server error response a status code equal to that given +func (o *ListInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the list internal server error response +func (o *ListInternalServerError) Code() int { + return 500 +} + +func (o *ListInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listInternalServerError", 500) +} + +func (o *ListInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listInternalServerError", 500) +} + +func (o *ListInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_update_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_update_parameters.go new file mode 100644 index 0000000..7302251 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_update_parameters.go @@ -0,0 +1,220 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package lists + +// 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" +) + +// NewListUpdateParams creates a new ListUpdateParams 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 NewListUpdateParams() *ListUpdateParams { + return &ListUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListUpdateParamsWithTimeout creates a new ListUpdateParams object +// with the ability to set a timeout on a request. +func NewListUpdateParamsWithTimeout(timeout time.Duration) *ListUpdateParams { + return &ListUpdateParams{ + timeout: timeout, + } +} + +// NewListUpdateParamsWithContext creates a new ListUpdateParams object +// with the ability to set a context for a request. +func NewListUpdateParamsWithContext(ctx context.Context) *ListUpdateParams { + return &ListUpdateParams{ + Context: ctx, + } +} + +// NewListUpdateParamsWithHTTPClient creates a new ListUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewListUpdateParamsWithHTTPClient(client *http.Client) *ListUpdateParams { + return &ListUpdateParams{ + HTTPClient: client, + } +} + +/* +ListUpdateParams contains all the parameters to send to the API endpoint + + for the list update operation. + + Typically these are written to a http.Request. +*/ +type ListUpdateParams struct { + + /* ID. + + ID of the list + */ + ID string + + /* RepliesPolicy. + + RepliesPolicy for this list. + followed = Show replies to any followed user + list = Show replies to members of the list + none = Show replies to no one + Sample: list + */ + RepliesPolicy *string + + /* Title. + + Title of this list. + Sample: Cool People + */ + Title *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListUpdateParams) WithDefaults() *ListUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list update params +func (o *ListUpdateParams) WithTimeout(timeout time.Duration) *ListUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list update params +func (o *ListUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list update params +func (o *ListUpdateParams) WithContext(ctx context.Context) *ListUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list update params +func (o *ListUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list update params +func (o *ListUpdateParams) WithHTTPClient(client *http.Client) *ListUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list update params +func (o *ListUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the list update params +func (o *ListUpdateParams) WithID(id string) *ListUpdateParams { + o.SetID(id) + return o +} + +// SetID adds the id to the list update params +func (o *ListUpdateParams) SetID(id string) { + o.ID = id +} + +// WithRepliesPolicy adds the repliesPolicy to the list update params +func (o *ListUpdateParams) WithRepliesPolicy(repliesPolicy *string) *ListUpdateParams { + o.SetRepliesPolicy(repliesPolicy) + return o +} + +// SetRepliesPolicy adds the repliesPolicy to the list update params +func (o *ListUpdateParams) SetRepliesPolicy(repliesPolicy *string) { + o.RepliesPolicy = repliesPolicy +} + +// WithTitle adds the title to the list update params +func (o *ListUpdateParams) WithTitle(title *string) *ListUpdateParams { + o.SetTitle(title) + return o +} + +// SetTitle adds the title to the list update params +func (o *ListUpdateParams) SetTitle(title *string) { + o.Title = title +} + +// WriteToRequest writes these params to a swagger request +func (o *ListUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.RepliesPolicy != nil { + + // form param replies_policy + var frRepliesPolicy string + if o.RepliesPolicy != nil { + frRepliesPolicy = *o.RepliesPolicy + } + fRepliesPolicy := frRepliesPolicy + if fRepliesPolicy != "" { + if err := r.SetFormParam("replies_policy", fRepliesPolicy); err != nil { + return err + } + } + } + + if o.Title != nil { + + // form param title + var frTitle string + if o.Title != nil { + frTitle = *o.Title + } + fTitle := frTitle + if fTitle != "" { + if err := r.SetFormParam("title", fTitle); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_update_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_update_responses.go new file mode 100644 index 0000000..e40bcd4 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/list_update_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package lists + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ListUpdateReader is a Reader for the ListUpdate structure. +type ListUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewListUpdateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewListUpdateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewListUpdateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewListUpdateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewListUpdateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewListUpdateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /api/v1/lists/{id}] listUpdate", response, response.Code()) + } +} + +// NewListUpdateOK creates a ListUpdateOK with default headers values +func NewListUpdateOK() *ListUpdateOK { + return &ListUpdateOK{} +} + +/* +ListUpdateOK describes a response with status code 200, with default header values. + +The newly updated list. +*/ +type ListUpdateOK struct { + Payload *models.List +} + +// IsSuccess returns true when this list update o k response has a 2xx status code +func (o *ListUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list update o k response has a 3xx status code +func (o *ListUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list update o k response has a 4xx status code +func (o *ListUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list update o k response has a 5xx status code +func (o *ListUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list update o k response a status code equal to that given +func (o *ListUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list update o k response +func (o *ListUpdateOK) Code() int { + return 200 +} + +func (o *ListUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateOK %s", 200, payload) +} + +func (o *ListUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateOK %s", 200, payload) +} + +func (o *ListUpdateOK) GetPayload() *models.List { + return o.Payload +} + +func (o *ListUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.List) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListUpdateBadRequest creates a ListUpdateBadRequest with default headers values +func NewListUpdateBadRequest() *ListUpdateBadRequest { + return &ListUpdateBadRequest{} +} + +/* +ListUpdateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ListUpdateBadRequest struct { +} + +// IsSuccess returns true when this list update bad request response has a 2xx status code +func (o *ListUpdateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list update bad request response has a 3xx status code +func (o *ListUpdateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list update bad request response has a 4xx status code +func (o *ListUpdateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this list update bad request response has a 5xx status code +func (o *ListUpdateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this list update bad request response a status code equal to that given +func (o *ListUpdateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the list update bad request response +func (o *ListUpdateBadRequest) Code() int { + return 400 +} + +func (o *ListUpdateBadRequest) Error() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateBadRequest", 400) +} + +func (o *ListUpdateBadRequest) String() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateBadRequest", 400) +} + +func (o *ListUpdateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListUpdateUnauthorized creates a ListUpdateUnauthorized with default headers values +func NewListUpdateUnauthorized() *ListUpdateUnauthorized { + return &ListUpdateUnauthorized{} +} + +/* +ListUpdateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ListUpdateUnauthorized struct { +} + +// IsSuccess returns true when this list update unauthorized response has a 2xx status code +func (o *ListUpdateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list update unauthorized response has a 3xx status code +func (o *ListUpdateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list update unauthorized response has a 4xx status code +func (o *ListUpdateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this list update unauthorized response has a 5xx status code +func (o *ListUpdateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this list update unauthorized response a status code equal to that given +func (o *ListUpdateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the list update unauthorized response +func (o *ListUpdateUnauthorized) Code() int { + return 401 +} + +func (o *ListUpdateUnauthorized) Error() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateUnauthorized", 401) +} + +func (o *ListUpdateUnauthorized) String() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateUnauthorized", 401) +} + +func (o *ListUpdateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListUpdateForbidden creates a ListUpdateForbidden with default headers values +func NewListUpdateForbidden() *ListUpdateForbidden { + return &ListUpdateForbidden{} +} + +/* +ListUpdateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type ListUpdateForbidden struct { +} + +// IsSuccess returns true when this list update forbidden response has a 2xx status code +func (o *ListUpdateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list update forbidden response has a 3xx status code +func (o *ListUpdateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list update forbidden response has a 4xx status code +func (o *ListUpdateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this list update forbidden response has a 5xx status code +func (o *ListUpdateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this list update forbidden response a status code equal to that given +func (o *ListUpdateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the list update forbidden response +func (o *ListUpdateForbidden) Code() int { + return 403 +} + +func (o *ListUpdateForbidden) Error() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateForbidden", 403) +} + +func (o *ListUpdateForbidden) String() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateForbidden", 403) +} + +func (o *ListUpdateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListUpdateNotFound creates a ListUpdateNotFound with default headers values +func NewListUpdateNotFound() *ListUpdateNotFound { + return &ListUpdateNotFound{} +} + +/* +ListUpdateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ListUpdateNotFound struct { +} + +// IsSuccess returns true when this list update not found response has a 2xx status code +func (o *ListUpdateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list update not found response has a 3xx status code +func (o *ListUpdateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list update not found response has a 4xx status code +func (o *ListUpdateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this list update not found response has a 5xx status code +func (o *ListUpdateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this list update not found response a status code equal to that given +func (o *ListUpdateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the list update not found response +func (o *ListUpdateNotFound) Code() int { + return 404 +} + +func (o *ListUpdateNotFound) Error() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateNotFound", 404) +} + +func (o *ListUpdateNotFound) String() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateNotFound", 404) +} + +func (o *ListUpdateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListUpdateNotAcceptable creates a ListUpdateNotAcceptable with default headers values +func NewListUpdateNotAcceptable() *ListUpdateNotAcceptable { + return &ListUpdateNotAcceptable{} +} + +/* +ListUpdateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ListUpdateNotAcceptable struct { +} + +// IsSuccess returns true when this list update not acceptable response has a 2xx status code +func (o *ListUpdateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list update not acceptable response has a 3xx status code +func (o *ListUpdateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list update not acceptable response has a 4xx status code +func (o *ListUpdateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this list update not acceptable response has a 5xx status code +func (o *ListUpdateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this list update not acceptable response a status code equal to that given +func (o *ListUpdateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the list update not acceptable response +func (o *ListUpdateNotAcceptable) Code() int { + return 406 +} + +func (o *ListUpdateNotAcceptable) Error() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateNotAcceptable", 406) +} + +func (o *ListUpdateNotAcceptable) String() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateNotAcceptable", 406) +} + +func (o *ListUpdateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListUpdateInternalServerError creates a ListUpdateInternalServerError with default headers values +func NewListUpdateInternalServerError() *ListUpdateInternalServerError { + return &ListUpdateInternalServerError{} +} + +/* +ListUpdateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ListUpdateInternalServerError struct { +} + +// IsSuccess returns true when this list update internal server error response has a 2xx status code +func (o *ListUpdateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list update internal server error response has a 3xx status code +func (o *ListUpdateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list update internal server error response has a 4xx status code +func (o *ListUpdateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this list update internal server error response has a 5xx status code +func (o *ListUpdateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this list update internal server error response a status code equal to that given +func (o *ListUpdateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the list update internal server error response +func (o *ListUpdateInternalServerError) Code() int { + return 500 +} + +func (o *ListUpdateInternalServerError) Error() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateInternalServerError", 500) +} + +func (o *ListUpdateInternalServerError) String() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateInternalServerError", 500) +} + +func (o *ListUpdateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/lists_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/lists_client.go new file mode 100644 index 0000000..f4d930b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/lists_client.go @@ -0,0 +1,430 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package lists + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new lists API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new lists API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new lists API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for lists API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded". +func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} +} + +// WithContentTypeApplicationXML sets the Content-Type header to "application/xml". +func WithContentTypeApplicationXML(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/xml"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + AddListAccounts(params *AddListAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AddListAccountsOK, error) + + List(params *ListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOK, error) + + ListAccounts(params *ListAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListAccountsOK, error) + + ListCreate(params *ListCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListCreateOK, error) + + ListDelete(params *ListDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListDeleteOK, error) + + ListUpdate(params *ListUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListUpdateOK, error) + + Lists(params *ListsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListsOK, error) + + RemoveListAccounts(params *RemoveListAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RemoveListAccountsOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +AddListAccounts adds one or more accounts to the given list +*/ +func (a *Client) AddListAccounts(params *AddListAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AddListAccountsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAddListAccountsParams() + } + op := &runtime.ClientOperation{ + ID: "addListAccounts", + Method: "POST", + PathPattern: "/api/v1/lists/{id}/accounts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AddListAccountsReader{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.(*AddListAccountsOK) + 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 addListAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +List gets a single list with the given ID +*/ +func (a *Client) List(params *ListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListParams() + } + op := &runtime.ClientOperation{ + ID: "list", + Method: "GET", + PathPattern: "/api/v1/lists/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ListReader{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.(*ListOK) + 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 list: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ListAccounts pages through accounts in this list + + The returned Link header can be used to generate the previous and next queries when scrolling up or down a timeline. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) ListAccounts(params *ListAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListAccountsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListAccountsParams() + } + op := &runtime.ClientOperation{ + ID: "listAccounts", + Method: "GET", + PathPattern: "/api/v1/lists/{id}/accounts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ListAccountsReader{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.(*ListAccountsOK) + 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 listAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +ListCreate creates a new list +*/ +func (a *Client) ListCreate(params *ListCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListCreateParams() + } + op := &runtime.ClientOperation{ + ID: "listCreate", + Method: "POST", + PathPattern: "/api/v1/lists", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ListCreateReader{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.(*ListCreateOK) + 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 listCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +ListDelete deletes a single list with the given ID +*/ +func (a *Client) ListDelete(params *ListDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "listDelete", + Method: "DELETE", + PathPattern: "/api/v1/lists/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ListDeleteReader{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.(*ListDeleteOK) + 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 listDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +ListUpdate updates an existing list +*/ +func (a *Client) ListUpdate(params *ListUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "listUpdate", + Method: "PUT", + PathPattern: "/api/v1/lists/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ListUpdateReader{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.(*ListUpdateOK) + 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 listUpdate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +Lists gets all lists for owned by authorized user +*/ +func (a *Client) Lists(params *ListsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListsParams() + } + op := &runtime.ClientOperation{ + ID: "lists", + Method: "GET", + PathPattern: "/api/v1/lists", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ListsReader{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.(*ListsOK) + 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 lists: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +RemoveListAccounts removes one or more accounts from the given list +*/ +func (a *Client) RemoveListAccounts(params *RemoveListAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RemoveListAccountsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewRemoveListAccountsParams() + } + op := &runtime.ClientOperation{ + ID: "removeListAccounts", + Method: "DELETE", + PathPattern: "/api/v1/lists/{id}/accounts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &RemoveListAccountsReader{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.(*RemoveListAccountsOK) + 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 removeListAccounts: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/lists_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/lists_parameters.go new file mode 100644 index 0000000..829d8f8 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/lists_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package lists + +// 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" +) + +// NewListsParams creates a new ListsParams 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 NewListsParams() *ListsParams { + return &ListsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListsParamsWithTimeout creates a new ListsParams object +// with the ability to set a timeout on a request. +func NewListsParamsWithTimeout(timeout time.Duration) *ListsParams { + return &ListsParams{ + timeout: timeout, + } +} + +// NewListsParamsWithContext creates a new ListsParams object +// with the ability to set a context for a request. +func NewListsParamsWithContext(ctx context.Context) *ListsParams { + return &ListsParams{ + Context: ctx, + } +} + +// NewListsParamsWithHTTPClient creates a new ListsParams object +// with the ability to set a custom HTTPClient for a request. +func NewListsParamsWithHTTPClient(client *http.Client) *ListsParams { + return &ListsParams{ + HTTPClient: client, + } +} + +/* +ListsParams contains all the parameters to send to the API endpoint + + for the lists operation. + + Typically these are written to a http.Request. +*/ +type ListsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the lists params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListsParams) WithDefaults() *ListsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the lists params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the lists params +func (o *ListsParams) WithTimeout(timeout time.Duration) *ListsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the lists params +func (o *ListsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the lists params +func (o *ListsParams) WithContext(ctx context.Context) *ListsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the lists params +func (o *ListsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the lists params +func (o *ListsParams) WithHTTPClient(client *http.Client) *ListsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the lists params +func (o *ListsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ListsParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/lists_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/lists_responses.go new file mode 100644 index 0000000..dd5327f --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/lists_responses.go @@ -0,0 +1,414 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package lists + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ListsReader is a Reader for the Lists structure. +type ListsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewListsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewListsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewListsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewListsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewListsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/lists] lists", response, response.Code()) + } +} + +// NewListsOK creates a ListsOK with default headers values +func NewListsOK() *ListsOK { + return &ListsOK{} +} + +/* +ListsOK describes a response with status code 200, with default header values. + +Array of all lists owned by the requesting user. +*/ +type ListsOK struct { + Payload []*models.List +} + +// IsSuccess returns true when this lists o k response has a 2xx status code +func (o *ListsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this lists o k response has a 3xx status code +func (o *ListsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this lists o k response has a 4xx status code +func (o *ListsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this lists o k response has a 5xx status code +func (o *ListsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this lists o k response a status code equal to that given +func (o *ListsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the lists o k response +func (o *ListsOK) Code() int { + return 200 +} + +func (o *ListsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/lists][%d] listsOK %s", 200, payload) +} + +func (o *ListsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/lists][%d] listsOK %s", 200, payload) +} + +func (o *ListsOK) GetPayload() []*models.List { + return o.Payload +} + +func (o *ListsOK) 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 +} + +// NewListsBadRequest creates a ListsBadRequest with default headers values +func NewListsBadRequest() *ListsBadRequest { + return &ListsBadRequest{} +} + +/* +ListsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ListsBadRequest struct { +} + +// IsSuccess returns true when this lists bad request response has a 2xx status code +func (o *ListsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this lists bad request response has a 3xx status code +func (o *ListsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this lists bad request response has a 4xx status code +func (o *ListsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this lists bad request response has a 5xx status code +func (o *ListsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this lists bad request response a status code equal to that given +func (o *ListsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the lists bad request response +func (o *ListsBadRequest) Code() int { + return 400 +} + +func (o *ListsBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/lists][%d] listsBadRequest", 400) +} + +func (o *ListsBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/lists][%d] listsBadRequest", 400) +} + +func (o *ListsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListsUnauthorized creates a ListsUnauthorized with default headers values +func NewListsUnauthorized() *ListsUnauthorized { + return &ListsUnauthorized{} +} + +/* +ListsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ListsUnauthorized struct { +} + +// IsSuccess returns true when this lists unauthorized response has a 2xx status code +func (o *ListsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this lists unauthorized response has a 3xx status code +func (o *ListsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this lists unauthorized response has a 4xx status code +func (o *ListsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this lists unauthorized response has a 5xx status code +func (o *ListsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this lists unauthorized response a status code equal to that given +func (o *ListsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the lists unauthorized response +func (o *ListsUnauthorized) Code() int { + return 401 +} + +func (o *ListsUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/lists][%d] listsUnauthorized", 401) +} + +func (o *ListsUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/lists][%d] listsUnauthorized", 401) +} + +func (o *ListsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListsNotFound creates a ListsNotFound with default headers values +func NewListsNotFound() *ListsNotFound { + return &ListsNotFound{} +} + +/* +ListsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ListsNotFound struct { +} + +// IsSuccess returns true when this lists not found response has a 2xx status code +func (o *ListsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this lists not found response has a 3xx status code +func (o *ListsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this lists not found response has a 4xx status code +func (o *ListsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this lists not found response has a 5xx status code +func (o *ListsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this lists not found response a status code equal to that given +func (o *ListsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the lists not found response +func (o *ListsNotFound) Code() int { + return 404 +} + +func (o *ListsNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/lists][%d] listsNotFound", 404) +} + +func (o *ListsNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/lists][%d] listsNotFound", 404) +} + +func (o *ListsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListsNotAcceptable creates a ListsNotAcceptable with default headers values +func NewListsNotAcceptable() *ListsNotAcceptable { + return &ListsNotAcceptable{} +} + +/* +ListsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ListsNotAcceptable struct { +} + +// IsSuccess returns true when this lists not acceptable response has a 2xx status code +func (o *ListsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this lists not acceptable response has a 3xx status code +func (o *ListsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this lists not acceptable response has a 4xx status code +func (o *ListsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this lists not acceptable response has a 5xx status code +func (o *ListsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this lists not acceptable response a status code equal to that given +func (o *ListsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the lists not acceptable response +func (o *ListsNotAcceptable) Code() int { + return 406 +} + +func (o *ListsNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/lists][%d] listsNotAcceptable", 406) +} + +func (o *ListsNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/lists][%d] listsNotAcceptable", 406) +} + +func (o *ListsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListsInternalServerError creates a ListsInternalServerError with default headers values +func NewListsInternalServerError() *ListsInternalServerError { + return &ListsInternalServerError{} +} + +/* +ListsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ListsInternalServerError struct { +} + +// IsSuccess returns true when this lists internal server error response has a 2xx status code +func (o *ListsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this lists internal server error response has a 3xx status code +func (o *ListsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this lists internal server error response has a 4xx status code +func (o *ListsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this lists internal server error response has a 5xx status code +func (o *ListsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this lists internal server error response a status code equal to that given +func (o *ListsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the lists internal server error response +func (o *ListsInternalServerError) Code() int { + return 500 +} + +func (o *ListsInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/lists][%d] listsInternalServerError", 500) +} + +func (o *ListsInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/lists][%d] listsInternalServerError", 500) +} + +func (o *ListsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/remove_list_accounts_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/remove_list_accounts_parameters.go new file mode 100644 index 0000000..f8527f0 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/remove_list_accounts_parameters.go @@ -0,0 +1,197 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package lists + +// 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" +) + +// NewRemoveListAccountsParams creates a new RemoveListAccountsParams 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 NewRemoveListAccountsParams() *RemoveListAccountsParams { + return &RemoveListAccountsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewRemoveListAccountsParamsWithTimeout creates a new RemoveListAccountsParams object +// with the ability to set a timeout on a request. +func NewRemoveListAccountsParamsWithTimeout(timeout time.Duration) *RemoveListAccountsParams { + return &RemoveListAccountsParams{ + timeout: timeout, + } +} + +// NewRemoveListAccountsParamsWithContext creates a new RemoveListAccountsParams object +// with the ability to set a context for a request. +func NewRemoveListAccountsParamsWithContext(ctx context.Context) *RemoveListAccountsParams { + return &RemoveListAccountsParams{ + Context: ctx, + } +} + +// NewRemoveListAccountsParamsWithHTTPClient creates a new RemoveListAccountsParams object +// with the ability to set a custom HTTPClient for a request. +func NewRemoveListAccountsParamsWithHTTPClient(client *http.Client) *RemoveListAccountsParams { + return &RemoveListAccountsParams{ + HTTPClient: client, + } +} + +/* +RemoveListAccountsParams contains all the parameters to send to the API endpoint + + for the remove list accounts operation. + + Typically these are written to a http.Request. +*/ +type RemoveListAccountsParams struct { + + /* AccountIds. + + Array of accountIDs to modify. Each accountID must correspond to an account that the requesting account follows. + */ + AccountIds []string + + /* ID. + + ID of the list + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the remove list accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RemoveListAccountsParams) WithDefaults() *RemoveListAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the remove list accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RemoveListAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the remove list accounts params +func (o *RemoveListAccountsParams) WithTimeout(timeout time.Duration) *RemoveListAccountsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the remove list accounts params +func (o *RemoveListAccountsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the remove list accounts params +func (o *RemoveListAccountsParams) WithContext(ctx context.Context) *RemoveListAccountsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the remove list accounts params +func (o *RemoveListAccountsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the remove list accounts params +func (o *RemoveListAccountsParams) WithHTTPClient(client *http.Client) *RemoveListAccountsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the remove list accounts params +func (o *RemoveListAccountsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAccountIds adds the accountIds to the remove list accounts params +func (o *RemoveListAccountsParams) WithAccountIds(accountIds []string) *RemoveListAccountsParams { + o.SetAccountIds(accountIds) + return o +} + +// SetAccountIds adds the accountIds to the remove list accounts params +func (o *RemoveListAccountsParams) SetAccountIds(accountIds []string) { + o.AccountIds = accountIds +} + +// WithID adds the id to the remove list accounts params +func (o *RemoveListAccountsParams) WithID(id string) *RemoveListAccountsParams { + o.SetID(id) + return o +} + +// SetID adds the id to the remove list accounts params +func (o *RemoveListAccountsParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *RemoveListAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.AccountIds != nil { + + // binding items for account_ids[] + joinedAccountIds := o.bindParamAccountIds(reg) + + // form array param account_ids[] + if err := r.SetFormParam("account_ids[]", joinedAccountIds...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamRemoveListAccounts binds the parameter account_ids[] +func (o *RemoveListAccountsParams) bindParamAccountIds(formats strfmt.Registry) []string { + accountIdsIR := o.AccountIds + + var accountIdsIC []string + for _, accountIdsIIR := range accountIdsIR { // explode []string + + accountIdsIIV := accountIdsIIR // string as string + accountIdsIC = append(accountIdsIC, accountIdsIIV) + } + + // items.CollectionFormat: "multi" + accountIdsIS := swag.JoinByFormat(accountIdsIC, "multi") + + return accountIdsIS +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/remove_list_accounts_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/remove_list_accounts_responses.go new file mode 100644 index 0000000..53926ed --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/lists/remove_list_accounts_responses.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package lists + +// 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" +) + +// RemoveListAccountsReader is a Reader for the RemoveListAccounts structure. +type RemoveListAccountsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *RemoveListAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewRemoveListAccountsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewRemoveListAccountsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewRemoveListAccountsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewRemoveListAccountsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewRemoveListAccountsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewRemoveListAccountsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/lists/{id}/accounts] removeListAccounts", response, response.Code()) + } +} + +// NewRemoveListAccountsOK creates a RemoveListAccountsOK with default headers values +func NewRemoveListAccountsOK() *RemoveListAccountsOK { + return &RemoveListAccountsOK{} +} + +/* +RemoveListAccountsOK describes a response with status code 200, with default header values. + +list accounts updated +*/ +type RemoveListAccountsOK struct { +} + +// IsSuccess returns true when this remove list accounts o k response has a 2xx status code +func (o *RemoveListAccountsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this remove list accounts o k response has a 3xx status code +func (o *RemoveListAccountsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this remove list accounts o k response has a 4xx status code +func (o *RemoveListAccountsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this remove list accounts o k response has a 5xx status code +func (o *RemoveListAccountsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this remove list accounts o k response a status code equal to that given +func (o *RemoveListAccountsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the remove list accounts o k response +func (o *RemoveListAccountsOK) Code() int { + return 200 +} + +func (o *RemoveListAccountsOK) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsOK", 200) +} + +func (o *RemoveListAccountsOK) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsOK", 200) +} + +func (o *RemoveListAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRemoveListAccountsBadRequest creates a RemoveListAccountsBadRequest with default headers values +func NewRemoveListAccountsBadRequest() *RemoveListAccountsBadRequest { + return &RemoveListAccountsBadRequest{} +} + +/* +RemoveListAccountsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type RemoveListAccountsBadRequest struct { +} + +// IsSuccess returns true when this remove list accounts bad request response has a 2xx status code +func (o *RemoveListAccountsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this remove list accounts bad request response has a 3xx status code +func (o *RemoveListAccountsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this remove list accounts bad request response has a 4xx status code +func (o *RemoveListAccountsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this remove list accounts bad request response has a 5xx status code +func (o *RemoveListAccountsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this remove list accounts bad request response a status code equal to that given +func (o *RemoveListAccountsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the remove list accounts bad request response +func (o *RemoveListAccountsBadRequest) Code() int { + return 400 +} + +func (o *RemoveListAccountsBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsBadRequest", 400) +} + +func (o *RemoveListAccountsBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsBadRequest", 400) +} + +func (o *RemoveListAccountsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRemoveListAccountsUnauthorized creates a RemoveListAccountsUnauthorized with default headers values +func NewRemoveListAccountsUnauthorized() *RemoveListAccountsUnauthorized { + return &RemoveListAccountsUnauthorized{} +} + +/* +RemoveListAccountsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type RemoveListAccountsUnauthorized struct { +} + +// IsSuccess returns true when this remove list accounts unauthorized response has a 2xx status code +func (o *RemoveListAccountsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this remove list accounts unauthorized response has a 3xx status code +func (o *RemoveListAccountsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this remove list accounts unauthorized response has a 4xx status code +func (o *RemoveListAccountsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this remove list accounts unauthorized response has a 5xx status code +func (o *RemoveListAccountsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this remove list accounts unauthorized response a status code equal to that given +func (o *RemoveListAccountsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the remove list accounts unauthorized response +func (o *RemoveListAccountsUnauthorized) Code() int { + return 401 +} + +func (o *RemoveListAccountsUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsUnauthorized", 401) +} + +func (o *RemoveListAccountsUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsUnauthorized", 401) +} + +func (o *RemoveListAccountsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRemoveListAccountsNotFound creates a RemoveListAccountsNotFound with default headers values +func NewRemoveListAccountsNotFound() *RemoveListAccountsNotFound { + return &RemoveListAccountsNotFound{} +} + +/* +RemoveListAccountsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type RemoveListAccountsNotFound struct { +} + +// IsSuccess returns true when this remove list accounts not found response has a 2xx status code +func (o *RemoveListAccountsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this remove list accounts not found response has a 3xx status code +func (o *RemoveListAccountsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this remove list accounts not found response has a 4xx status code +func (o *RemoveListAccountsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this remove list accounts not found response has a 5xx status code +func (o *RemoveListAccountsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this remove list accounts not found response a status code equal to that given +func (o *RemoveListAccountsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the remove list accounts not found response +func (o *RemoveListAccountsNotFound) Code() int { + return 404 +} + +func (o *RemoveListAccountsNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsNotFound", 404) +} + +func (o *RemoveListAccountsNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsNotFound", 404) +} + +func (o *RemoveListAccountsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRemoveListAccountsNotAcceptable creates a RemoveListAccountsNotAcceptable with default headers values +func NewRemoveListAccountsNotAcceptable() *RemoveListAccountsNotAcceptable { + return &RemoveListAccountsNotAcceptable{} +} + +/* +RemoveListAccountsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type RemoveListAccountsNotAcceptable struct { +} + +// IsSuccess returns true when this remove list accounts not acceptable response has a 2xx status code +func (o *RemoveListAccountsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this remove list accounts not acceptable response has a 3xx status code +func (o *RemoveListAccountsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this remove list accounts not acceptable response has a 4xx status code +func (o *RemoveListAccountsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this remove list accounts not acceptable response has a 5xx status code +func (o *RemoveListAccountsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this remove list accounts not acceptable response a status code equal to that given +func (o *RemoveListAccountsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the remove list accounts not acceptable response +func (o *RemoveListAccountsNotAcceptable) Code() int { + return 406 +} + +func (o *RemoveListAccountsNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsNotAcceptable", 406) +} + +func (o *RemoveListAccountsNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsNotAcceptable", 406) +} + +func (o *RemoveListAccountsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRemoveListAccountsInternalServerError creates a RemoveListAccountsInternalServerError with default headers values +func NewRemoveListAccountsInternalServerError() *RemoveListAccountsInternalServerError { + return &RemoveListAccountsInternalServerError{} +} + +/* +RemoveListAccountsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type RemoveListAccountsInternalServerError struct { +} + +// IsSuccess returns true when this remove list accounts internal server error response has a 2xx status code +func (o *RemoveListAccountsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this remove list accounts internal server error response has a 3xx status code +func (o *RemoveListAccountsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this remove list accounts internal server error response has a 4xx status code +func (o *RemoveListAccountsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this remove list accounts internal server error response has a 5xx status code +func (o *RemoveListAccountsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this remove list accounts internal server error response a status code equal to that given +func (o *RemoveListAccountsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the remove list accounts internal server error response +func (o *RemoveListAccountsInternalServerError) Code() int { + return 500 +} + +func (o *RemoveListAccountsInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsInternalServerError", 500) +} + +func (o *RemoveListAccountsInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsInternalServerError", 500) +} + +func (o *RemoveListAccountsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/markers/markers_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/markers/markers_client.go new file mode 100644 index 0000000..f0a8636 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/markers/markers_client.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package markers + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new markers API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new markers API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new markers API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for markers API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeMultipartFormData sets the Content-Type header to "multipart/form-data". +func WithContentTypeMultipartFormData(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"multipart/form-data"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + MarkersGet(params *MarkersGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MarkersGetOK, error) + + MarkersPost(params *MarkersPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MarkersPostOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +MarkersGet Get timeline markers by name +*/ +func (a *Client) MarkersGet(params *MarkersGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MarkersGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMarkersGetParams() + } + op := &runtime.ClientOperation{ + ID: "markersGet", + Method: "GET", + PathPattern: "/api/v1/markers", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MarkersGetReader{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.(*MarkersGetOK) + 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 markersGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +MarkersPost Update timeline markers by name +*/ +func (a *Client) MarkersPost(params *MarkersPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MarkersPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMarkersPostParams() + } + op := &runtime.ClientOperation{ + ID: "markersPost", + Method: "POST", + PathPattern: "/api/v1/markers", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MarkersPostReader{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.(*MarkersPostOK) + 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 markersPost: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/markers/markers_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/markers/markers_get_parameters.go new file mode 100644 index 0000000..b3b3b31 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/markers/markers_get_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package markers + +// 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" +) + +// NewMarkersGetParams creates a new MarkersGetParams 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 NewMarkersGetParams() *MarkersGetParams { + return &MarkersGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMarkersGetParamsWithTimeout creates a new MarkersGetParams object +// with the ability to set a timeout on a request. +func NewMarkersGetParamsWithTimeout(timeout time.Duration) *MarkersGetParams { + return &MarkersGetParams{ + timeout: timeout, + } +} + +// NewMarkersGetParamsWithContext creates a new MarkersGetParams object +// with the ability to set a context for a request. +func NewMarkersGetParamsWithContext(ctx context.Context) *MarkersGetParams { + return &MarkersGetParams{ + Context: ctx, + } +} + +// NewMarkersGetParamsWithHTTPClient creates a new MarkersGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewMarkersGetParamsWithHTTPClient(client *http.Client) *MarkersGetParams { + return &MarkersGetParams{ + HTTPClient: client, + } +} + +/* +MarkersGetParams contains all the parameters to send to the API endpoint + + for the markers get operation. + + Typically these are written to a http.Request. +*/ +type MarkersGetParams struct { + + /* Timeline. + + Timelines to retrieve. + */ + Timeline []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the markers get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MarkersGetParams) WithDefaults() *MarkersGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the markers get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MarkersGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the markers get params +func (o *MarkersGetParams) WithTimeout(timeout time.Duration) *MarkersGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the markers get params +func (o *MarkersGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the markers get params +func (o *MarkersGetParams) WithContext(ctx context.Context) *MarkersGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the markers get params +func (o *MarkersGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the markers get params +func (o *MarkersGetParams) WithHTTPClient(client *http.Client) *MarkersGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the markers get params +func (o *MarkersGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithTimeline adds the timeline to the markers get params +func (o *MarkersGetParams) WithTimeline(timeline []string) *MarkersGetParams { + o.SetTimeline(timeline) + return o +} + +// SetTimeline adds the timeline to the markers get params +func (o *MarkersGetParams) SetTimeline(timeline []string) { + o.Timeline = timeline +} + +// WriteToRequest writes these params to a swagger request +func (o *MarkersGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Timeline != nil { + + // binding items for timeline + joinedTimeline := o.bindParamTimeline(reg) + + // query array param timeline + if err := r.SetQueryParam("timeline", joinedTimeline...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamMarkersGet binds the parameter timeline +func (o *MarkersGetParams) bindParamTimeline(formats strfmt.Registry) []string { + timelineIR := o.Timeline + + var timelineIC []string + for _, timelineIIR := range timelineIR { // explode []string + + timelineIIV := timelineIIR // string as string + timelineIC = append(timelineIC, timelineIIV) + } + + // items.CollectionFormat: "" + timelineIS := swag.JoinByFormat(timelineIC, "") + + return timelineIS +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/markers/markers_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/markers/markers_get_responses.go new file mode 100644 index 0000000..7f88c80 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/markers/markers_get_responses.go @@ -0,0 +1,292 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package markers + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// MarkersGetReader is a Reader for the MarkersGet structure. +type MarkersGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MarkersGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMarkersGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewMarkersGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewMarkersGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewMarkersGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/markers] markersGet", response, response.Code()) + } +} + +// NewMarkersGetOK creates a MarkersGetOK with default headers values +func NewMarkersGetOK() *MarkersGetOK { + return &MarkersGetOK{} +} + +/* +MarkersGetOK describes a response with status code 200, with default header values. + +Requested markers +*/ +type MarkersGetOK struct { + Payload *models.Marker +} + +// IsSuccess returns true when this markers get o k response has a 2xx status code +func (o *MarkersGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this markers get o k response has a 3xx status code +func (o *MarkersGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this markers get o k response has a 4xx status code +func (o *MarkersGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this markers get o k response has a 5xx status code +func (o *MarkersGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this markers get o k response a status code equal to that given +func (o *MarkersGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the markers get o k response +func (o *MarkersGetOK) Code() int { + return 200 +} + +func (o *MarkersGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/markers][%d] markersGetOK %s", 200, payload) +} + +func (o *MarkersGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/markers][%d] markersGetOK %s", 200, payload) +} + +func (o *MarkersGetOK) GetPayload() *models.Marker { + return o.Payload +} + +func (o *MarkersGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Marker) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMarkersGetBadRequest creates a MarkersGetBadRequest with default headers values +func NewMarkersGetBadRequest() *MarkersGetBadRequest { + return &MarkersGetBadRequest{} +} + +/* +MarkersGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type MarkersGetBadRequest struct { +} + +// IsSuccess returns true when this markers get bad request response has a 2xx status code +func (o *MarkersGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this markers get bad request response has a 3xx status code +func (o *MarkersGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this markers get bad request response has a 4xx status code +func (o *MarkersGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this markers get bad request response has a 5xx status code +func (o *MarkersGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this markers get bad request response a status code equal to that given +func (o *MarkersGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the markers get bad request response +func (o *MarkersGetBadRequest) Code() int { + return 400 +} + +func (o *MarkersGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/markers][%d] markersGetBadRequest", 400) +} + +func (o *MarkersGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/markers][%d] markersGetBadRequest", 400) +} + +func (o *MarkersGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMarkersGetUnauthorized creates a MarkersGetUnauthorized with default headers values +func NewMarkersGetUnauthorized() *MarkersGetUnauthorized { + return &MarkersGetUnauthorized{} +} + +/* +MarkersGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type MarkersGetUnauthorized struct { +} + +// IsSuccess returns true when this markers get unauthorized response has a 2xx status code +func (o *MarkersGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this markers get unauthorized response has a 3xx status code +func (o *MarkersGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this markers get unauthorized response has a 4xx status code +func (o *MarkersGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this markers get unauthorized response has a 5xx status code +func (o *MarkersGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this markers get unauthorized response a status code equal to that given +func (o *MarkersGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the markers get unauthorized response +func (o *MarkersGetUnauthorized) Code() int { + return 401 +} + +func (o *MarkersGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/markers][%d] markersGetUnauthorized", 401) +} + +func (o *MarkersGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/markers][%d] markersGetUnauthorized", 401) +} + +func (o *MarkersGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMarkersGetInternalServerError creates a MarkersGetInternalServerError with default headers values +func NewMarkersGetInternalServerError() *MarkersGetInternalServerError { + return &MarkersGetInternalServerError{} +} + +/* +MarkersGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type MarkersGetInternalServerError struct { +} + +// IsSuccess returns true when this markers get internal server error response has a 2xx status code +func (o *MarkersGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this markers get internal server error response has a 3xx status code +func (o *MarkersGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this markers get internal server error response has a 4xx status code +func (o *MarkersGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this markers get internal server error response has a 5xx status code +func (o *MarkersGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this markers get internal server error response a status code equal to that given +func (o *MarkersGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the markers get internal server error response +func (o *MarkersGetInternalServerError) Code() int { + return 500 +} + +func (o *MarkersGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/markers][%d] markersGetInternalServerError", 500) +} + +func (o *MarkersGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/markers][%d] markersGetInternalServerError", 500) +} + +func (o *MarkersGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/markers/markers_post_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/markers/markers_post_parameters.go new file mode 100644 index 0000000..0c32120 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/markers/markers_post_parameters.go @@ -0,0 +1,193 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package markers + +// 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" +) + +// NewMarkersPostParams creates a new MarkersPostParams 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 NewMarkersPostParams() *MarkersPostParams { + return &MarkersPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMarkersPostParamsWithTimeout creates a new MarkersPostParams object +// with the ability to set a timeout on a request. +func NewMarkersPostParamsWithTimeout(timeout time.Duration) *MarkersPostParams { + return &MarkersPostParams{ + timeout: timeout, + } +} + +// NewMarkersPostParamsWithContext creates a new MarkersPostParams object +// with the ability to set a context for a request. +func NewMarkersPostParamsWithContext(ctx context.Context) *MarkersPostParams { + return &MarkersPostParams{ + Context: ctx, + } +} + +// NewMarkersPostParamsWithHTTPClient creates a new MarkersPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewMarkersPostParamsWithHTTPClient(client *http.Client) *MarkersPostParams { + return &MarkersPostParams{ + HTTPClient: client, + } +} + +/* +MarkersPostParams contains all the parameters to send to the API endpoint + + for the markers post operation. + + Typically these are written to a http.Request. +*/ +type MarkersPostParams struct { + + /* HomeLastReadID. + + Last status ID read on the home timeline. + */ + HomeLastReadID *string + + /* NotificationsLastReadID. + + Last notification ID read on the notifications timeline. + */ + NotificationsLastReadID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the markers post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MarkersPostParams) WithDefaults() *MarkersPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the markers post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MarkersPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the markers post params +func (o *MarkersPostParams) WithTimeout(timeout time.Duration) *MarkersPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the markers post params +func (o *MarkersPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the markers post params +func (o *MarkersPostParams) WithContext(ctx context.Context) *MarkersPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the markers post params +func (o *MarkersPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the markers post params +func (o *MarkersPostParams) WithHTTPClient(client *http.Client) *MarkersPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the markers post params +func (o *MarkersPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithHomeLastReadID adds the homeLastReadID to the markers post params +func (o *MarkersPostParams) WithHomeLastReadID(homeLastReadID *string) *MarkersPostParams { + o.SetHomeLastReadID(homeLastReadID) + return o +} + +// SetHomeLastReadID adds the homeLastReadId to the markers post params +func (o *MarkersPostParams) SetHomeLastReadID(homeLastReadID *string) { + o.HomeLastReadID = homeLastReadID +} + +// WithNotificationsLastReadID adds the notificationsLastReadID to the markers post params +func (o *MarkersPostParams) WithNotificationsLastReadID(notificationsLastReadID *string) *MarkersPostParams { + o.SetNotificationsLastReadID(notificationsLastReadID) + return o +} + +// SetNotificationsLastReadID adds the notificationsLastReadId to the markers post params +func (o *MarkersPostParams) SetNotificationsLastReadID(notificationsLastReadID *string) { + o.NotificationsLastReadID = notificationsLastReadID +} + +// WriteToRequest writes these params to a swagger request +func (o *MarkersPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.HomeLastReadID != nil { + + // form param home[last_read_id] + var frHomeLastReadID string + if o.HomeLastReadID != nil { + frHomeLastReadID = *o.HomeLastReadID + } + fHomeLastReadID := frHomeLastReadID + if fHomeLastReadID != "" { + if err := r.SetFormParam("home[last_read_id]", fHomeLastReadID); err != nil { + return err + } + } + } + + if o.NotificationsLastReadID != nil { + + // form param notifications[last_read_id] + var frNotificationsLastReadID string + if o.NotificationsLastReadID != nil { + frNotificationsLastReadID = *o.NotificationsLastReadID + } + fNotificationsLastReadID := frNotificationsLastReadID + if fNotificationsLastReadID != "" { + if err := r.SetFormParam("notifications[last_read_id]", fNotificationsLastReadID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/markers/markers_post_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/markers/markers_post_responses.go new file mode 100644 index 0000000..c385bb2 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/markers/markers_post_responses.go @@ -0,0 +1,354 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package markers + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// MarkersPostReader is a Reader for the MarkersPost structure. +type MarkersPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MarkersPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMarkersPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewMarkersPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewMarkersPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewMarkersPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewMarkersPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/markers] markersPost", response, response.Code()) + } +} + +// NewMarkersPostOK creates a MarkersPostOK with default headers values +func NewMarkersPostOK() *MarkersPostOK { + return &MarkersPostOK{} +} + +/* +MarkersPostOK describes a response with status code 200, with default header values. + +Requested markers +*/ +type MarkersPostOK struct { + Payload *models.Marker +} + +// IsSuccess returns true when this markers post o k response has a 2xx status code +func (o *MarkersPostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this markers post o k response has a 3xx status code +func (o *MarkersPostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this markers post o k response has a 4xx status code +func (o *MarkersPostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this markers post o k response has a 5xx status code +func (o *MarkersPostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this markers post o k response a status code equal to that given +func (o *MarkersPostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the markers post o k response +func (o *MarkersPostOK) Code() int { + return 200 +} + +func (o *MarkersPostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/markers][%d] markersPostOK %s", 200, payload) +} + +func (o *MarkersPostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/markers][%d] markersPostOK %s", 200, payload) +} + +func (o *MarkersPostOK) GetPayload() *models.Marker { + return o.Payload +} + +func (o *MarkersPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Marker) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMarkersPostBadRequest creates a MarkersPostBadRequest with default headers values +func NewMarkersPostBadRequest() *MarkersPostBadRequest { + return &MarkersPostBadRequest{} +} + +/* +MarkersPostBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type MarkersPostBadRequest struct { +} + +// IsSuccess returns true when this markers post bad request response has a 2xx status code +func (o *MarkersPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this markers post bad request response has a 3xx status code +func (o *MarkersPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this markers post bad request response has a 4xx status code +func (o *MarkersPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this markers post bad request response has a 5xx status code +func (o *MarkersPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this markers post bad request response a status code equal to that given +func (o *MarkersPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the markers post bad request response +func (o *MarkersPostBadRequest) Code() int { + return 400 +} + +func (o *MarkersPostBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/markers][%d] markersPostBadRequest", 400) +} + +func (o *MarkersPostBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/markers][%d] markersPostBadRequest", 400) +} + +func (o *MarkersPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMarkersPostUnauthorized creates a MarkersPostUnauthorized with default headers values +func NewMarkersPostUnauthorized() *MarkersPostUnauthorized { + return &MarkersPostUnauthorized{} +} + +/* +MarkersPostUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type MarkersPostUnauthorized struct { +} + +// IsSuccess returns true when this markers post unauthorized response has a 2xx status code +func (o *MarkersPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this markers post unauthorized response has a 3xx status code +func (o *MarkersPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this markers post unauthorized response has a 4xx status code +func (o *MarkersPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this markers post unauthorized response has a 5xx status code +func (o *MarkersPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this markers post unauthorized response a status code equal to that given +func (o *MarkersPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the markers post unauthorized response +func (o *MarkersPostUnauthorized) Code() int { + return 401 +} + +func (o *MarkersPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/markers][%d] markersPostUnauthorized", 401) +} + +func (o *MarkersPostUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/markers][%d] markersPostUnauthorized", 401) +} + +func (o *MarkersPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMarkersPostConflict creates a MarkersPostConflict with default headers values +func NewMarkersPostConflict() *MarkersPostConflict { + return &MarkersPostConflict{} +} + +/* +MarkersPostConflict describes a response with status code 409, with default header values. + +conflict (when two clients try to update the same timeline at the same time) +*/ +type MarkersPostConflict struct { +} + +// IsSuccess returns true when this markers post conflict response has a 2xx status code +func (o *MarkersPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this markers post conflict response has a 3xx status code +func (o *MarkersPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this markers post conflict response has a 4xx status code +func (o *MarkersPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this markers post conflict response has a 5xx status code +func (o *MarkersPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this markers post conflict response a status code equal to that given +func (o *MarkersPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the markers post conflict response +func (o *MarkersPostConflict) Code() int { + return 409 +} + +func (o *MarkersPostConflict) Error() string { + return fmt.Sprintf("[POST /api/v1/markers][%d] markersPostConflict", 409) +} + +func (o *MarkersPostConflict) String() string { + return fmt.Sprintf("[POST /api/v1/markers][%d] markersPostConflict", 409) +} + +func (o *MarkersPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMarkersPostInternalServerError creates a MarkersPostInternalServerError with default headers values +func NewMarkersPostInternalServerError() *MarkersPostInternalServerError { + return &MarkersPostInternalServerError{} +} + +/* +MarkersPostInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type MarkersPostInternalServerError struct { +} + +// IsSuccess returns true when this markers post internal server error response has a 2xx status code +func (o *MarkersPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this markers post internal server error response has a 3xx status code +func (o *MarkersPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this markers post internal server error response has a 4xx status code +func (o *MarkersPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this markers post internal server error response has a 5xx status code +func (o *MarkersPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this markers post internal server error response a status code equal to that given +func (o *MarkersPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the markers post internal server error response +func (o *MarkersPostInternalServerError) Code() int { + return 500 +} + +func (o *MarkersPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/markers][%d] markersPostInternalServerError", 500) +} + +func (o *MarkersPostInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/markers][%d] markersPostInternalServerError", 500) +} + +func (o *MarkersPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_client.go new file mode 100644 index 0000000..511994e --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_client.go @@ -0,0 +1,227 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package media + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new media API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new media API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new media API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for media API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded". +func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} +} + +// WithContentTypeApplicationXML sets the Content-Type header to "application/xml". +func WithContentTypeApplicationXML(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/xml"} +} + +// WithContentTypeMultipartFormData sets the Content-Type header to "multipart/form-data". +func WithContentTypeMultipartFormData(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"multipart/form-data"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + MediaCreate(params *MediaCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MediaCreateOK, error) + + MediaGet(params *MediaGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MediaGetOK, error) + + MediaUpdate(params *MediaUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MediaUpdateOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +MediaCreate uploads a new media attachment +*/ +func (a *Client) MediaCreate(params *MediaCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MediaCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMediaCreateParams() + } + op := &runtime.ClientOperation{ + ID: "mediaCreate", + Method: "POST", + PathPattern: "/api/{api_version}/media", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MediaCreateReader{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.(*MediaCreateOK) + 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 mediaCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +MediaGet gets a media attachment that you own +*/ +func (a *Client) MediaGet(params *MediaGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MediaGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMediaGetParams() + } + op := &runtime.ClientOperation{ + ID: "mediaGet", + Method: "GET", + PathPattern: "/api/v1/media/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MediaGetReader{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.(*MediaGetOK) + 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 mediaGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + MediaUpdate updates a media attachment + + You must own the media attachment, and the attachment must not yet be attached to a status. + +The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'. +The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'. +*/ +func (a *Client) MediaUpdate(params *MediaUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MediaUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMediaUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "mediaUpdate", + Method: "PUT", + PathPattern: "/api/v1/media/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MediaUpdateReader{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.(*MediaUpdateOK) + 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 mediaUpdate: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_create_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_create_parameters.go new file mode 100644 index 0000000..ba66245 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_create_parameters.go @@ -0,0 +1,249 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package media + +// 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" +) + +// NewMediaCreateParams creates a new MediaCreateParams 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 NewMediaCreateParams() *MediaCreateParams { + return &MediaCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMediaCreateParamsWithTimeout creates a new MediaCreateParams object +// with the ability to set a timeout on a request. +func NewMediaCreateParamsWithTimeout(timeout time.Duration) *MediaCreateParams { + return &MediaCreateParams{ + timeout: timeout, + } +} + +// NewMediaCreateParamsWithContext creates a new MediaCreateParams object +// with the ability to set a context for a request. +func NewMediaCreateParamsWithContext(ctx context.Context) *MediaCreateParams { + return &MediaCreateParams{ + Context: ctx, + } +} + +// NewMediaCreateParamsWithHTTPClient creates a new MediaCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewMediaCreateParamsWithHTTPClient(client *http.Client) *MediaCreateParams { + return &MediaCreateParams{ + HTTPClient: client, + } +} + +/* +MediaCreateParams contains all the parameters to send to the API endpoint + + for the media create operation. + + Typically these are written to a http.Request. +*/ +type MediaCreateParams struct { + + /* APIVersion. + + Version of the API to use. Must be either `v1` or `v2`. + */ + APIVersion string + + /* Description. + + Image or media description to use as alt-text on the attachment. This is very useful for users of screenreaders! May or may not be required, depending on your instance settings. + */ + Description *string + + /* File. + + The media attachment to upload. + */ + File runtime.NamedReadCloser + + /* Focus. + + Focus of the media file. If present, it should be in the form of two comma-separated floats between -1 and 1. For example: `-0.5,0.25`. + + Default: "0,0" + */ + Focus *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the media create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MediaCreateParams) WithDefaults() *MediaCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the media create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MediaCreateParams) SetDefaults() { + var ( + focusDefault = string("0,0") + ) + + val := MediaCreateParams{ + Focus: &focusDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the media create params +func (o *MediaCreateParams) WithTimeout(timeout time.Duration) *MediaCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the media create params +func (o *MediaCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the media create params +func (o *MediaCreateParams) WithContext(ctx context.Context) *MediaCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the media create params +func (o *MediaCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the media create params +func (o *MediaCreateParams) WithHTTPClient(client *http.Client) *MediaCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the media create params +func (o *MediaCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAPIVersion adds the aPIVersion to the media create params +func (o *MediaCreateParams) WithAPIVersion(aPIVersion string) *MediaCreateParams { + o.SetAPIVersion(aPIVersion) + return o +} + +// SetAPIVersion adds the apiVersion to the media create params +func (o *MediaCreateParams) SetAPIVersion(aPIVersion string) { + o.APIVersion = aPIVersion +} + +// WithDescription adds the description to the media create params +func (o *MediaCreateParams) WithDescription(description *string) *MediaCreateParams { + o.SetDescription(description) + return o +} + +// SetDescription adds the description to the media create params +func (o *MediaCreateParams) SetDescription(description *string) { + o.Description = description +} + +// WithFile adds the file to the media create params +func (o *MediaCreateParams) WithFile(file runtime.NamedReadCloser) *MediaCreateParams { + o.SetFile(file) + return o +} + +// SetFile adds the file to the media create params +func (o *MediaCreateParams) SetFile(file runtime.NamedReadCloser) { + o.File = file +} + +// WithFocus adds the focus to the media create params +func (o *MediaCreateParams) WithFocus(focus *string) *MediaCreateParams { + o.SetFocus(focus) + return o +} + +// SetFocus adds the focus to the media create params +func (o *MediaCreateParams) SetFocus(focus *string) { + o.Focus = focus +} + +// WriteToRequest writes these params to a swagger request +func (o *MediaCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param api_version + if err := r.SetPathParam("api_version", o.APIVersion); err != nil { + return err + } + + if o.Description != nil { + + // form param description + var frDescription string + if o.Description != nil { + frDescription = *o.Description + } + fDescription := frDescription + if fDescription != "" { + if err := r.SetFormParam("description", fDescription); err != nil { + return err + } + } + } + // form file param file + if err := r.SetFileParam("file", o.File); err != nil { + return err + } + + if o.Focus != nil { + + // form param focus + var frFocus string + if o.Focus != nil { + frFocus = *o.Focus + } + fFocus := frFocus + if fFocus != "" { + if err := r.SetFormParam("focus", fFocus); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_create_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_create_responses.go new file mode 100644 index 0000000..5ffbeeb --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_create_responses.go @@ -0,0 +1,354 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package media + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// MediaCreateReader is a Reader for the MediaCreate structure. +type MediaCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MediaCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMediaCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewMediaCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewMediaCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewMediaCreateUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewMediaCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/{api_version}/media] mediaCreate", response, response.Code()) + } +} + +// NewMediaCreateOK creates a MediaCreateOK with default headers values +func NewMediaCreateOK() *MediaCreateOK { + return &MediaCreateOK{} +} + +/* +MediaCreateOK describes a response with status code 200, with default header values. + +The newly-created media attachment. +*/ +type MediaCreateOK struct { + Payload *models.Attachment +} + +// IsSuccess returns true when this media create o k response has a 2xx status code +func (o *MediaCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this media create o k response has a 3xx status code +func (o *MediaCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media create o k response has a 4xx status code +func (o *MediaCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this media create o k response has a 5xx status code +func (o *MediaCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this media create o k response a status code equal to that given +func (o *MediaCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the media create o k response +func (o *MediaCreateOK) Code() int { + return 200 +} + +func (o *MediaCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/{api_version}/media][%d] mediaCreateOK %s", 200, payload) +} + +func (o *MediaCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/{api_version}/media][%d] mediaCreateOK %s", 200, payload) +} + +func (o *MediaCreateOK) GetPayload() *models.Attachment { + return o.Payload +} + +func (o *MediaCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Attachment) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMediaCreateBadRequest creates a MediaCreateBadRequest with default headers values +func NewMediaCreateBadRequest() *MediaCreateBadRequest { + return &MediaCreateBadRequest{} +} + +/* +MediaCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type MediaCreateBadRequest struct { +} + +// IsSuccess returns true when this media create bad request response has a 2xx status code +func (o *MediaCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media create bad request response has a 3xx status code +func (o *MediaCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media create bad request response has a 4xx status code +func (o *MediaCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this media create bad request response has a 5xx status code +func (o *MediaCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this media create bad request response a status code equal to that given +func (o *MediaCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the media create bad request response +func (o *MediaCreateBadRequest) Code() int { + return 400 +} + +func (o *MediaCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/{api_version}/media][%d] mediaCreateBadRequest", 400) +} + +func (o *MediaCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/{api_version}/media][%d] mediaCreateBadRequest", 400) +} + +func (o *MediaCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaCreateUnauthorized creates a MediaCreateUnauthorized with default headers values +func NewMediaCreateUnauthorized() *MediaCreateUnauthorized { + return &MediaCreateUnauthorized{} +} + +/* +MediaCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type MediaCreateUnauthorized struct { +} + +// IsSuccess returns true when this media create unauthorized response has a 2xx status code +func (o *MediaCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media create unauthorized response has a 3xx status code +func (o *MediaCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media create unauthorized response has a 4xx status code +func (o *MediaCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this media create unauthorized response has a 5xx status code +func (o *MediaCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this media create unauthorized response a status code equal to that given +func (o *MediaCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the media create unauthorized response +func (o *MediaCreateUnauthorized) Code() int { + return 401 +} + +func (o *MediaCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/{api_version}/media][%d] mediaCreateUnauthorized", 401) +} + +func (o *MediaCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/{api_version}/media][%d] mediaCreateUnauthorized", 401) +} + +func (o *MediaCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaCreateUnprocessableEntity creates a MediaCreateUnprocessableEntity with default headers values +func NewMediaCreateUnprocessableEntity() *MediaCreateUnprocessableEntity { + return &MediaCreateUnprocessableEntity{} +} + +/* +MediaCreateUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable +*/ +type MediaCreateUnprocessableEntity struct { +} + +// IsSuccess returns true when this media create unprocessable entity response has a 2xx status code +func (o *MediaCreateUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media create unprocessable entity response has a 3xx status code +func (o *MediaCreateUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media create unprocessable entity response has a 4xx status code +func (o *MediaCreateUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this media create unprocessable entity response has a 5xx status code +func (o *MediaCreateUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this media create unprocessable entity response a status code equal to that given +func (o *MediaCreateUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the media create unprocessable entity response +func (o *MediaCreateUnprocessableEntity) Code() int { + return 422 +} + +func (o *MediaCreateUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/{api_version}/media][%d] mediaCreateUnprocessableEntity", 422) +} + +func (o *MediaCreateUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/{api_version}/media][%d] mediaCreateUnprocessableEntity", 422) +} + +func (o *MediaCreateUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaCreateInternalServerError creates a MediaCreateInternalServerError with default headers values +func NewMediaCreateInternalServerError() *MediaCreateInternalServerError { + return &MediaCreateInternalServerError{} +} + +/* +MediaCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type MediaCreateInternalServerError struct { +} + +// IsSuccess returns true when this media create internal server error response has a 2xx status code +func (o *MediaCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media create internal server error response has a 3xx status code +func (o *MediaCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media create internal server error response has a 4xx status code +func (o *MediaCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this media create internal server error response has a 5xx status code +func (o *MediaCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this media create internal server error response a status code equal to that given +func (o *MediaCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the media create internal server error response +func (o *MediaCreateInternalServerError) Code() int { + return 500 +} + +func (o *MediaCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/{api_version}/media][%d] mediaCreateInternalServerError", 500) +} + +func (o *MediaCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/{api_version}/media][%d] mediaCreateInternalServerError", 500) +} + +func (o *MediaCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_get_parameters.go new file mode 100644 index 0000000..f0d80a5 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package media + +// 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" +) + +// NewMediaGetParams creates a new MediaGetParams 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 NewMediaGetParams() *MediaGetParams { + return &MediaGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMediaGetParamsWithTimeout creates a new MediaGetParams object +// with the ability to set a timeout on a request. +func NewMediaGetParamsWithTimeout(timeout time.Duration) *MediaGetParams { + return &MediaGetParams{ + timeout: timeout, + } +} + +// NewMediaGetParamsWithContext creates a new MediaGetParams object +// with the ability to set a context for a request. +func NewMediaGetParamsWithContext(ctx context.Context) *MediaGetParams { + return &MediaGetParams{ + Context: ctx, + } +} + +// NewMediaGetParamsWithHTTPClient creates a new MediaGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewMediaGetParamsWithHTTPClient(client *http.Client) *MediaGetParams { + return &MediaGetParams{ + HTTPClient: client, + } +} + +/* +MediaGetParams contains all the parameters to send to the API endpoint + + for the media get operation. + + Typically these are written to a http.Request. +*/ +type MediaGetParams struct { + + /* ID. + + id of the attachment + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the media get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MediaGetParams) WithDefaults() *MediaGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the media get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MediaGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the media get params +func (o *MediaGetParams) WithTimeout(timeout time.Duration) *MediaGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the media get params +func (o *MediaGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the media get params +func (o *MediaGetParams) WithContext(ctx context.Context) *MediaGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the media get params +func (o *MediaGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the media get params +func (o *MediaGetParams) WithHTTPClient(client *http.Client) *MediaGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the media get params +func (o *MediaGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the media get params +func (o *MediaGetParams) WithID(id string) *MediaGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the media get params +func (o *MediaGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *MediaGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_get_responses.go new file mode 100644 index 0000000..748f9a6 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_get_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package media + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// MediaGetReader is a Reader for the MediaGet structure. +type MediaGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MediaGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMediaGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewMediaGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewMediaGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewMediaGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewMediaGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewMediaGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/media/{id}] mediaGet", response, response.Code()) + } +} + +// NewMediaGetOK creates a MediaGetOK with default headers values +func NewMediaGetOK() *MediaGetOK { + return &MediaGetOK{} +} + +/* +MediaGetOK describes a response with status code 200, with default header values. + +The requested media attachment. +*/ +type MediaGetOK struct { + Payload *models.Attachment +} + +// IsSuccess returns true when this media get o k response has a 2xx status code +func (o *MediaGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this media get o k response has a 3xx status code +func (o *MediaGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media get o k response has a 4xx status code +func (o *MediaGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this media get o k response has a 5xx status code +func (o *MediaGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this media get o k response a status code equal to that given +func (o *MediaGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the media get o k response +func (o *MediaGetOK) Code() int { + return 200 +} + +func (o *MediaGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetOK %s", 200, payload) +} + +func (o *MediaGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetOK %s", 200, payload) +} + +func (o *MediaGetOK) GetPayload() *models.Attachment { + return o.Payload +} + +func (o *MediaGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Attachment) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMediaGetBadRequest creates a MediaGetBadRequest with default headers values +func NewMediaGetBadRequest() *MediaGetBadRequest { + return &MediaGetBadRequest{} +} + +/* +MediaGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type MediaGetBadRequest struct { +} + +// IsSuccess returns true when this media get bad request response has a 2xx status code +func (o *MediaGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media get bad request response has a 3xx status code +func (o *MediaGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media get bad request response has a 4xx status code +func (o *MediaGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this media get bad request response has a 5xx status code +func (o *MediaGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this media get bad request response a status code equal to that given +func (o *MediaGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the media get bad request response +func (o *MediaGetBadRequest) Code() int { + return 400 +} + +func (o *MediaGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetBadRequest", 400) +} + +func (o *MediaGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetBadRequest", 400) +} + +func (o *MediaGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaGetUnauthorized creates a MediaGetUnauthorized with default headers values +func NewMediaGetUnauthorized() *MediaGetUnauthorized { + return &MediaGetUnauthorized{} +} + +/* +MediaGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type MediaGetUnauthorized struct { +} + +// IsSuccess returns true when this media get unauthorized response has a 2xx status code +func (o *MediaGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media get unauthorized response has a 3xx status code +func (o *MediaGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media get unauthorized response has a 4xx status code +func (o *MediaGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this media get unauthorized response has a 5xx status code +func (o *MediaGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this media get unauthorized response a status code equal to that given +func (o *MediaGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the media get unauthorized response +func (o *MediaGetUnauthorized) Code() int { + return 401 +} + +func (o *MediaGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetUnauthorized", 401) +} + +func (o *MediaGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetUnauthorized", 401) +} + +func (o *MediaGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaGetNotFound creates a MediaGetNotFound with default headers values +func NewMediaGetNotFound() *MediaGetNotFound { + return &MediaGetNotFound{} +} + +/* +MediaGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type MediaGetNotFound struct { +} + +// IsSuccess returns true when this media get not found response has a 2xx status code +func (o *MediaGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media get not found response has a 3xx status code +func (o *MediaGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media get not found response has a 4xx status code +func (o *MediaGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this media get not found response has a 5xx status code +func (o *MediaGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this media get not found response a status code equal to that given +func (o *MediaGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the media get not found response +func (o *MediaGetNotFound) Code() int { + return 404 +} + +func (o *MediaGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetNotFound", 404) +} + +func (o *MediaGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetNotFound", 404) +} + +func (o *MediaGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaGetNotAcceptable creates a MediaGetNotAcceptable with default headers values +func NewMediaGetNotAcceptable() *MediaGetNotAcceptable { + return &MediaGetNotAcceptable{} +} + +/* +MediaGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type MediaGetNotAcceptable struct { +} + +// IsSuccess returns true when this media get not acceptable response has a 2xx status code +func (o *MediaGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media get not acceptable response has a 3xx status code +func (o *MediaGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media get not acceptable response has a 4xx status code +func (o *MediaGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this media get not acceptable response has a 5xx status code +func (o *MediaGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this media get not acceptable response a status code equal to that given +func (o *MediaGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the media get not acceptable response +func (o *MediaGetNotAcceptable) Code() int { + return 406 +} + +func (o *MediaGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetNotAcceptable", 406) +} + +func (o *MediaGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetNotAcceptable", 406) +} + +func (o *MediaGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaGetInternalServerError creates a MediaGetInternalServerError with default headers values +func NewMediaGetInternalServerError() *MediaGetInternalServerError { + return &MediaGetInternalServerError{} +} + +/* +MediaGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type MediaGetInternalServerError struct { +} + +// IsSuccess returns true when this media get internal server error response has a 2xx status code +func (o *MediaGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media get internal server error response has a 3xx status code +func (o *MediaGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media get internal server error response has a 4xx status code +func (o *MediaGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this media get internal server error response has a 5xx status code +func (o *MediaGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this media get internal server error response a status code equal to that given +func (o *MediaGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the media get internal server error response +func (o *MediaGetInternalServerError) Code() int { + return 500 +} + +func (o *MediaGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetInternalServerError", 500) +} + +func (o *MediaGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetInternalServerError", 500) +} + +func (o *MediaGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_update_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_update_parameters.go new file mode 100644 index 0000000..f0ccacf --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_update_parameters.go @@ -0,0 +1,212 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package media + +// 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" +) + +// NewMediaUpdateParams creates a new MediaUpdateParams 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 NewMediaUpdateParams() *MediaUpdateParams { + return &MediaUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMediaUpdateParamsWithTimeout creates a new MediaUpdateParams object +// with the ability to set a timeout on a request. +func NewMediaUpdateParamsWithTimeout(timeout time.Duration) *MediaUpdateParams { + return &MediaUpdateParams{ + timeout: timeout, + } +} + +// NewMediaUpdateParamsWithContext creates a new MediaUpdateParams object +// with the ability to set a context for a request. +func NewMediaUpdateParamsWithContext(ctx context.Context) *MediaUpdateParams { + return &MediaUpdateParams{ + Context: ctx, + } +} + +// NewMediaUpdateParamsWithHTTPClient creates a new MediaUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewMediaUpdateParamsWithHTTPClient(client *http.Client) *MediaUpdateParams { + return &MediaUpdateParams{ + HTTPClient: client, + } +} + +/* +MediaUpdateParams contains all the parameters to send to the API endpoint + + for the media update operation. + + Typically these are written to a http.Request. +*/ +type MediaUpdateParams struct { + + /* Description. + + Image or media description to use as alt-text on the attachment. This is very useful for users of screenreaders! May or may not be required, depending on your instance settings. + */ + Description string + + /* Focus. + + Focus of the media file. If present, it should be in the form of two comma-separated floats between -1 and 1. For example: `-0.5,0.25`. + + Default: "0,0" + */ + Focus string + + /* ID. + + id of the attachment to update + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the media update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MediaUpdateParams) WithDefaults() *MediaUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the media update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MediaUpdateParams) SetDefaults() { + var ( + focusDefault = string("0,0") + ) + + val := MediaUpdateParams{ + Focus: focusDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the media update params +func (o *MediaUpdateParams) WithTimeout(timeout time.Duration) *MediaUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the media update params +func (o *MediaUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the media update params +func (o *MediaUpdateParams) WithContext(ctx context.Context) *MediaUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the media update params +func (o *MediaUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the media update params +func (o *MediaUpdateParams) WithHTTPClient(client *http.Client) *MediaUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the media update params +func (o *MediaUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDescription adds the description to the media update params +func (o *MediaUpdateParams) WithDescription(description string) *MediaUpdateParams { + o.SetDescription(description) + return o +} + +// SetDescription adds the description to the media update params +func (o *MediaUpdateParams) SetDescription(description string) { + o.Description = description +} + +// WithFocus adds the focus to the media update params +func (o *MediaUpdateParams) WithFocus(focus string) *MediaUpdateParams { + o.SetFocus(focus) + return o +} + +// SetFocus adds the focus to the media update params +func (o *MediaUpdateParams) SetFocus(focus string) { + o.Focus = focus +} + +// WithID adds the id to the media update params +func (o *MediaUpdateParams) WithID(id string) *MediaUpdateParams { + o.SetID(id) + return o +} + +// SetID adds the id to the media update params +func (o *MediaUpdateParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *MediaUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param description + frDescription := o.Description + fDescription := frDescription + if err := r.SetFormParam("description", fDescription); err != nil { + return err + } + + // form param focus + frFocus := o.Focus + fFocus := frFocus + if err := r.SetFormParam("focus", fFocus); err != nil { + return err + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_update_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_update_responses.go new file mode 100644 index 0000000..d91412b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/media/media_update_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package media + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// MediaUpdateReader is a Reader for the MediaUpdate structure. +type MediaUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MediaUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMediaUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewMediaUpdateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewMediaUpdateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewMediaUpdateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewMediaUpdateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewMediaUpdateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /api/v1/media/{id}] mediaUpdate", response, response.Code()) + } +} + +// NewMediaUpdateOK creates a MediaUpdateOK with default headers values +func NewMediaUpdateOK() *MediaUpdateOK { + return &MediaUpdateOK{} +} + +/* +MediaUpdateOK describes a response with status code 200, with default header values. + +The newly-updated media attachment. +*/ +type MediaUpdateOK struct { + Payload *models.Attachment +} + +// IsSuccess returns true when this media update o k response has a 2xx status code +func (o *MediaUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this media update o k response has a 3xx status code +func (o *MediaUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media update o k response has a 4xx status code +func (o *MediaUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this media update o k response has a 5xx status code +func (o *MediaUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this media update o k response a status code equal to that given +func (o *MediaUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the media update o k response +func (o *MediaUpdateOK) Code() int { + return 200 +} + +func (o *MediaUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateOK %s", 200, payload) +} + +func (o *MediaUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateOK %s", 200, payload) +} + +func (o *MediaUpdateOK) GetPayload() *models.Attachment { + return o.Payload +} + +func (o *MediaUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Attachment) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMediaUpdateBadRequest creates a MediaUpdateBadRequest with default headers values +func NewMediaUpdateBadRequest() *MediaUpdateBadRequest { + return &MediaUpdateBadRequest{} +} + +/* +MediaUpdateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type MediaUpdateBadRequest struct { +} + +// IsSuccess returns true when this media update bad request response has a 2xx status code +func (o *MediaUpdateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media update bad request response has a 3xx status code +func (o *MediaUpdateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media update bad request response has a 4xx status code +func (o *MediaUpdateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this media update bad request response has a 5xx status code +func (o *MediaUpdateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this media update bad request response a status code equal to that given +func (o *MediaUpdateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the media update bad request response +func (o *MediaUpdateBadRequest) Code() int { + return 400 +} + +func (o *MediaUpdateBadRequest) Error() string { + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateBadRequest", 400) +} + +func (o *MediaUpdateBadRequest) String() string { + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateBadRequest", 400) +} + +func (o *MediaUpdateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaUpdateUnauthorized creates a MediaUpdateUnauthorized with default headers values +func NewMediaUpdateUnauthorized() *MediaUpdateUnauthorized { + return &MediaUpdateUnauthorized{} +} + +/* +MediaUpdateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type MediaUpdateUnauthorized struct { +} + +// IsSuccess returns true when this media update unauthorized response has a 2xx status code +func (o *MediaUpdateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media update unauthorized response has a 3xx status code +func (o *MediaUpdateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media update unauthorized response has a 4xx status code +func (o *MediaUpdateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this media update unauthorized response has a 5xx status code +func (o *MediaUpdateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this media update unauthorized response a status code equal to that given +func (o *MediaUpdateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the media update unauthorized response +func (o *MediaUpdateUnauthorized) Code() int { + return 401 +} + +func (o *MediaUpdateUnauthorized) Error() string { + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateUnauthorized", 401) +} + +func (o *MediaUpdateUnauthorized) String() string { + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateUnauthorized", 401) +} + +func (o *MediaUpdateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaUpdateNotFound creates a MediaUpdateNotFound with default headers values +func NewMediaUpdateNotFound() *MediaUpdateNotFound { + return &MediaUpdateNotFound{} +} + +/* +MediaUpdateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type MediaUpdateNotFound struct { +} + +// IsSuccess returns true when this media update not found response has a 2xx status code +func (o *MediaUpdateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media update not found response has a 3xx status code +func (o *MediaUpdateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media update not found response has a 4xx status code +func (o *MediaUpdateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this media update not found response has a 5xx status code +func (o *MediaUpdateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this media update not found response a status code equal to that given +func (o *MediaUpdateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the media update not found response +func (o *MediaUpdateNotFound) Code() int { + return 404 +} + +func (o *MediaUpdateNotFound) Error() string { + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateNotFound", 404) +} + +func (o *MediaUpdateNotFound) String() string { + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateNotFound", 404) +} + +func (o *MediaUpdateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaUpdateNotAcceptable creates a MediaUpdateNotAcceptable with default headers values +func NewMediaUpdateNotAcceptable() *MediaUpdateNotAcceptable { + return &MediaUpdateNotAcceptable{} +} + +/* +MediaUpdateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type MediaUpdateNotAcceptable struct { +} + +// IsSuccess returns true when this media update not acceptable response has a 2xx status code +func (o *MediaUpdateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media update not acceptable response has a 3xx status code +func (o *MediaUpdateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media update not acceptable response has a 4xx status code +func (o *MediaUpdateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this media update not acceptable response has a 5xx status code +func (o *MediaUpdateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this media update not acceptable response a status code equal to that given +func (o *MediaUpdateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the media update not acceptable response +func (o *MediaUpdateNotAcceptable) Code() int { + return 406 +} + +func (o *MediaUpdateNotAcceptable) Error() string { + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateNotAcceptable", 406) +} + +func (o *MediaUpdateNotAcceptable) String() string { + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateNotAcceptable", 406) +} + +func (o *MediaUpdateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaUpdateInternalServerError creates a MediaUpdateInternalServerError with default headers values +func NewMediaUpdateInternalServerError() *MediaUpdateInternalServerError { + return &MediaUpdateInternalServerError{} +} + +/* +MediaUpdateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type MediaUpdateInternalServerError struct { +} + +// IsSuccess returns true when this media update internal server error response has a 2xx status code +func (o *MediaUpdateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media update internal server error response has a 3xx status code +func (o *MediaUpdateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media update internal server error response has a 4xx status code +func (o *MediaUpdateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this media update internal server error response has a 5xx status code +func (o *MediaUpdateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this media update internal server error response a status code equal to that given +func (o *MediaUpdateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the media update internal server error response +func (o *MediaUpdateInternalServerError) Code() int { + return 500 +} + +func (o *MediaUpdateInternalServerError) Error() string { + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateInternalServerError", 500) +} + +func (o *MediaUpdateInternalServerError) String() string { + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateInternalServerError", 500) +} + +func (o *MediaUpdateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/mutes/mutes_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/mutes/mutes_client.go new file mode 100644 index 0000000..0ccb0c8 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/mutes/mutes_client.go @@ -0,0 +1,114 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package mutes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new mutes API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new mutes API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new mutes API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for mutes API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + MutesGet(params *MutesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MutesGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + MutesGet gets an array of accounts that requesting account has muted + + The next and previous queries can be parsed from the returned Link header. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) MutesGet(params *MutesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MutesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMutesGetParams() + } + op := &runtime.ClientOperation{ + ID: "mutesGet", + Method: "GET", + PathPattern: "/api/v1/mutes", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MutesGetReader{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.(*MutesGetOK) + 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 mutesGet: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/mutes/mutes_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/mutes/mutes_get_parameters.go new file mode 100644 index 0000000..1128c8b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/mutes/mutes_get_parameters.go @@ -0,0 +1,279 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package mutes + +// 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" +) + +// NewMutesGetParams creates a new MutesGetParams 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 NewMutesGetParams() *MutesGetParams { + return &MutesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMutesGetParamsWithTimeout creates a new MutesGetParams object +// with the ability to set a timeout on a request. +func NewMutesGetParamsWithTimeout(timeout time.Duration) *MutesGetParams { + return &MutesGetParams{ + timeout: timeout, + } +} + +// NewMutesGetParamsWithContext creates a new MutesGetParams object +// with the ability to set a context for a request. +func NewMutesGetParamsWithContext(ctx context.Context) *MutesGetParams { + return &MutesGetParams{ + Context: ctx, + } +} + +// NewMutesGetParamsWithHTTPClient creates a new MutesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewMutesGetParamsWithHTTPClient(client *http.Client) *MutesGetParams { + return &MutesGetParams{ + HTTPClient: client, + } +} + +/* +MutesGetParams contains all the parameters to send to the API endpoint + + for the mutes get operation. + + Typically these are written to a http.Request. +*/ +type MutesGetParams struct { + + /* Limit. + + Number of muted accounts to return. + + Default: 40 + */ + Limit *int64 + + /* MaxID. + + Return only muted accounts *OLDER* than the given max ID. The muted account with the specified ID will not be included in the response. NOTE: the ID is of the internal mute, NOT any of the returned accounts. + */ + MaxID *string + + /* MinID. + + Return only muted accounts *IMMEDIATELY NEWER* than the given min ID. The muted account with the specified ID will not be included in the response. NOTE: the ID is of the internal mute, NOT any of the returned accounts. + */ + MinID *string + + /* SinceID. + + Return only muted accounts *NEWER* than the given since ID. The muted account with the specified ID will not be included in the response. NOTE: the ID is of the internal mute, NOT any of the returned accounts. + */ + SinceID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the mutes get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MutesGetParams) WithDefaults() *MutesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the mutes get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MutesGetParams) SetDefaults() { + var ( + limitDefault = int64(40) + ) + + val := MutesGetParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the mutes get params +func (o *MutesGetParams) WithTimeout(timeout time.Duration) *MutesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the mutes get params +func (o *MutesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the mutes get params +func (o *MutesGetParams) WithContext(ctx context.Context) *MutesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the mutes get params +func (o *MutesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the mutes get params +func (o *MutesGetParams) WithHTTPClient(client *http.Client) *MutesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the mutes get params +func (o *MutesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the mutes get params +func (o *MutesGetParams) WithLimit(limit *int64) *MutesGetParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the mutes get params +func (o *MutesGetParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the mutes get params +func (o *MutesGetParams) WithMaxID(maxID *string) *MutesGetParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the mutes get params +func (o *MutesGetParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the mutes get params +func (o *MutesGetParams) WithMinID(minID *string) *MutesGetParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the mutes get params +func (o *MutesGetParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the mutes get params +func (o *MutesGetParams) WithSinceID(sinceID *string) *MutesGetParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the mutes get params +func (o *MutesGetParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WriteToRequest writes these params to a swagger request +func (o *MutesGetParams) 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.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if o.SinceID != nil { + + // query param since_id + var qrSinceID string + + if o.SinceID != nil { + qrSinceID = *o.SinceID + } + qSinceID := qrSinceID + if qSinceID != "" { + + if err := r.SetQueryParam("since_id", qSinceID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/mutes/mutes_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/mutes/mutes_get_responses.go new file mode 100644 index 0000000..6bda06a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/mutes/mutes_get_responses.go @@ -0,0 +1,426 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package mutes + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// MutesGetReader is a Reader for the MutesGet structure. +type MutesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MutesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMutesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewMutesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewMutesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewMutesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewMutesGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewMutesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/mutes] mutesGet", response, response.Code()) + } +} + +// NewMutesGetOK creates a MutesGetOK with default headers values +func NewMutesGetOK() *MutesGetOK { + return &MutesGetOK{} +} + +/* +MutesGetOK describes a response with status code 200, with default header values. + +List of muted accounts, including when their mutes expire (if applicable). +*/ +type MutesGetOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.MutedAccount +} + +// IsSuccess returns true when this mutes get o k response has a 2xx status code +func (o *MutesGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this mutes get o k response has a 3xx status code +func (o *MutesGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this mutes get o k response has a 4xx status code +func (o *MutesGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this mutes get o k response has a 5xx status code +func (o *MutesGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this mutes get o k response a status code equal to that given +func (o *MutesGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the mutes get o k response +func (o *MutesGetOK) Code() int { + return 200 +} + +func (o *MutesGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetOK %s", 200, payload) +} + +func (o *MutesGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetOK %s", 200, payload) +} + +func (o *MutesGetOK) GetPayload() []*models.MutedAccount { + return o.Payload +} + +func (o *MutesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMutesGetBadRequest creates a MutesGetBadRequest with default headers values +func NewMutesGetBadRequest() *MutesGetBadRequest { + return &MutesGetBadRequest{} +} + +/* +MutesGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type MutesGetBadRequest struct { +} + +// IsSuccess returns true when this mutes get bad request response has a 2xx status code +func (o *MutesGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this mutes get bad request response has a 3xx status code +func (o *MutesGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this mutes get bad request response has a 4xx status code +func (o *MutesGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this mutes get bad request response has a 5xx status code +func (o *MutesGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this mutes get bad request response a status code equal to that given +func (o *MutesGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the mutes get bad request response +func (o *MutesGetBadRequest) Code() int { + return 400 +} + +func (o *MutesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetBadRequest", 400) +} + +func (o *MutesGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetBadRequest", 400) +} + +func (o *MutesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMutesGetUnauthorized creates a MutesGetUnauthorized with default headers values +func NewMutesGetUnauthorized() *MutesGetUnauthorized { + return &MutesGetUnauthorized{} +} + +/* +MutesGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type MutesGetUnauthorized struct { +} + +// IsSuccess returns true when this mutes get unauthorized response has a 2xx status code +func (o *MutesGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this mutes get unauthorized response has a 3xx status code +func (o *MutesGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this mutes get unauthorized response has a 4xx status code +func (o *MutesGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this mutes get unauthorized response has a 5xx status code +func (o *MutesGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this mutes get unauthorized response a status code equal to that given +func (o *MutesGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the mutes get unauthorized response +func (o *MutesGetUnauthorized) Code() int { + return 401 +} + +func (o *MutesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetUnauthorized", 401) +} + +func (o *MutesGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetUnauthorized", 401) +} + +func (o *MutesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMutesGetNotFound creates a MutesGetNotFound with default headers values +func NewMutesGetNotFound() *MutesGetNotFound { + return &MutesGetNotFound{} +} + +/* +MutesGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type MutesGetNotFound struct { +} + +// IsSuccess returns true when this mutes get not found response has a 2xx status code +func (o *MutesGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this mutes get not found response has a 3xx status code +func (o *MutesGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this mutes get not found response has a 4xx status code +func (o *MutesGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this mutes get not found response has a 5xx status code +func (o *MutesGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this mutes get not found response a status code equal to that given +func (o *MutesGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the mutes get not found response +func (o *MutesGetNotFound) Code() int { + return 404 +} + +func (o *MutesGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetNotFound", 404) +} + +func (o *MutesGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetNotFound", 404) +} + +func (o *MutesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMutesGetNotAcceptable creates a MutesGetNotAcceptable with default headers values +func NewMutesGetNotAcceptable() *MutesGetNotAcceptable { + return &MutesGetNotAcceptable{} +} + +/* +MutesGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type MutesGetNotAcceptable struct { +} + +// IsSuccess returns true when this mutes get not acceptable response has a 2xx status code +func (o *MutesGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this mutes get not acceptable response has a 3xx status code +func (o *MutesGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this mutes get not acceptable response has a 4xx status code +func (o *MutesGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this mutes get not acceptable response has a 5xx status code +func (o *MutesGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this mutes get not acceptable response a status code equal to that given +func (o *MutesGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the mutes get not acceptable response +func (o *MutesGetNotAcceptable) Code() int { + return 406 +} + +func (o *MutesGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetNotAcceptable", 406) +} + +func (o *MutesGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetNotAcceptable", 406) +} + +func (o *MutesGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMutesGetInternalServerError creates a MutesGetInternalServerError with default headers values +func NewMutesGetInternalServerError() *MutesGetInternalServerError { + return &MutesGetInternalServerError{} +} + +/* +MutesGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type MutesGetInternalServerError struct { +} + +// IsSuccess returns true when this mutes get internal server error response has a 2xx status code +func (o *MutesGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this mutes get internal server error response has a 3xx status code +func (o *MutesGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this mutes get internal server error response has a 4xx status code +func (o *MutesGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this mutes get internal server error response has a 5xx status code +func (o *MutesGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this mutes get internal server error response a status code equal to that given +func (o *MutesGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the mutes get internal server error response +func (o *MutesGetInternalServerError) Code() int { + return 500 +} + +func (o *MutesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetInternalServerError", 500) +} + +func (o *MutesGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetInternalServerError", 500) +} + +func (o *MutesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nodeinfo/node_info_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nodeinfo/node_info_get_parameters.go new file mode 100644 index 0000000..7a346d8 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nodeinfo/node_info_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package nodeinfo + +// 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" +) + +// NewNodeInfoGetParams creates a new NodeInfoGetParams 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 NewNodeInfoGetParams() *NodeInfoGetParams { + return &NodeInfoGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewNodeInfoGetParamsWithTimeout creates a new NodeInfoGetParams object +// with the ability to set a timeout on a request. +func NewNodeInfoGetParamsWithTimeout(timeout time.Duration) *NodeInfoGetParams { + return &NodeInfoGetParams{ + timeout: timeout, + } +} + +// NewNodeInfoGetParamsWithContext creates a new NodeInfoGetParams object +// with the ability to set a context for a request. +func NewNodeInfoGetParamsWithContext(ctx context.Context) *NodeInfoGetParams { + return &NodeInfoGetParams{ + Context: ctx, + } +} + +// NewNodeInfoGetParamsWithHTTPClient creates a new NodeInfoGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewNodeInfoGetParamsWithHTTPClient(client *http.Client) *NodeInfoGetParams { + return &NodeInfoGetParams{ + HTTPClient: client, + } +} + +/* +NodeInfoGetParams contains all the parameters to send to the API endpoint + + for the node info get operation. + + Typically these are written to a http.Request. +*/ +type NodeInfoGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the node info get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *NodeInfoGetParams) WithDefaults() *NodeInfoGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the node info get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *NodeInfoGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the node info get params +func (o *NodeInfoGetParams) WithTimeout(timeout time.Duration) *NodeInfoGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the node info get params +func (o *NodeInfoGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the node info get params +func (o *NodeInfoGetParams) WithContext(ctx context.Context) *NodeInfoGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the node info get params +func (o *NodeInfoGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the node info get params +func (o *NodeInfoGetParams) WithHTTPClient(client *http.Client) *NodeInfoGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the node info get params +func (o *NodeInfoGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *NodeInfoGetParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nodeinfo/node_info_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nodeinfo/node_info_get_responses.go new file mode 100644 index 0000000..93604ea --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nodeinfo/node_info_get_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package nodeinfo + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// NodeInfoGetReader is a Reader for the NodeInfoGet structure. +type NodeInfoGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *NodeInfoGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewNodeInfoGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /nodeinfo/2.0] nodeInfoGet", response, response.Code()) + } +} + +// NewNodeInfoGetOK creates a NodeInfoGetOK with default headers values +func NewNodeInfoGetOK() *NodeInfoGetOK { + return &NodeInfoGetOK{} +} + +/* +NodeInfoGetOK describes a response with status code 200, with default header values. + +NodeInfoGetOK node info get o k +*/ +type NodeInfoGetOK struct { + Payload *models.Nodeinfo +} + +// IsSuccess returns true when this node info get o k response has a 2xx status code +func (o *NodeInfoGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this node info get o k response has a 3xx status code +func (o *NodeInfoGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this node info get o k response has a 4xx status code +func (o *NodeInfoGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this node info get o k response has a 5xx status code +func (o *NodeInfoGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this node info get o k response a status code equal to that given +func (o *NodeInfoGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the node info get o k response +func (o *NodeInfoGetOK) Code() int { + return 200 +} + +func (o *NodeInfoGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /nodeinfo/2.0][%d] nodeInfoGetOK %s", 200, payload) +} + +func (o *NodeInfoGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /nodeinfo/2.0][%d] nodeInfoGetOK %s", 200, payload) +} + +func (o *NodeInfoGetOK) GetPayload() *models.Nodeinfo { + return o.Payload +} + +func (o *NodeInfoGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Nodeinfo) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nodeinfo/nodeinfo_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nodeinfo/nodeinfo_client.go new file mode 100644 index 0000000..19ab6a5 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nodeinfo/nodeinfo_client.go @@ -0,0 +1,131 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package nodeinfo + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new nodeinfo API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new nodeinfo API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new nodeinfo API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for nodeinfo API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithAccept allows the client to force the Accept header +// to negotiate a specific Producer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithAccept(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{mime} + } +} + +// WithAcceptApplicationJSON sets the Accept header to "application/json". +func WithAcceptApplicationJSON(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{"application/json"} +} + +// WithAcceptApplicationJSONProfileHTTPNodeinfoDiasporaSoftwareNsSchema20 sets the Accept header to "application/json; profile=\"http://nodeinfo.diaspora.software/ns/schema/2.0#\"". +func WithAcceptApplicationJSONProfileHTTPNodeinfoDiasporaSoftwareNsSchema20(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{"application/json; profile=\"http://nodeinfo.diaspora.software/ns/schema/2.0#\""} +} + +// ClientService is the interface for Client methods +type ClientService interface { + NodeInfoGet(params *NodeInfoGetParams, opts ...ClientOption) (*NodeInfoGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +NodeInfoGet returns a compliant nodeinfo response to node info queries + +See: https://nodeinfo.diaspora.software/schema.html +*/ +func (a *Client) NodeInfoGet(params *NodeInfoGetParams, opts ...ClientOption) (*NodeInfoGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewNodeInfoGetParams() + } + op := &runtime.ClientOperation{ + ID: "nodeInfoGet", + Method: "GET", + PathPattern: "/nodeinfo/2.0", + ProducesMediaTypes: []string{"application/json; profile=\"http://nodeinfo.diaspora.software/ns/schema/2.0#\""}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &NodeInfoGetReader{formats: a.formats}, + 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.(*NodeInfoGetOK) + 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 nodeInfoGet: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/clear_notifications_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/clear_notifications_parameters.go new file mode 100644 index 0000000..682e23e --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/clear_notifications_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package notifications + +// 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" +) + +// NewClearNotificationsParams creates a new ClearNotificationsParams 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 NewClearNotificationsParams() *ClearNotificationsParams { + return &ClearNotificationsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewClearNotificationsParamsWithTimeout creates a new ClearNotificationsParams object +// with the ability to set a timeout on a request. +func NewClearNotificationsParamsWithTimeout(timeout time.Duration) *ClearNotificationsParams { + return &ClearNotificationsParams{ + timeout: timeout, + } +} + +// NewClearNotificationsParamsWithContext creates a new ClearNotificationsParams object +// with the ability to set a context for a request. +func NewClearNotificationsParamsWithContext(ctx context.Context) *ClearNotificationsParams { + return &ClearNotificationsParams{ + Context: ctx, + } +} + +// NewClearNotificationsParamsWithHTTPClient creates a new ClearNotificationsParams object +// with the ability to set a custom HTTPClient for a request. +func NewClearNotificationsParamsWithHTTPClient(client *http.Client) *ClearNotificationsParams { + return &ClearNotificationsParams{ + HTTPClient: client, + } +} + +/* +ClearNotificationsParams contains all the parameters to send to the API endpoint + + for the clear notifications operation. + + Typically these are written to a http.Request. +*/ +type ClearNotificationsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the clear notifications params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ClearNotificationsParams) WithDefaults() *ClearNotificationsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the clear notifications params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ClearNotificationsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the clear notifications params +func (o *ClearNotificationsParams) WithTimeout(timeout time.Duration) *ClearNotificationsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the clear notifications params +func (o *ClearNotificationsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the clear notifications params +func (o *ClearNotificationsParams) WithContext(ctx context.Context) *ClearNotificationsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the clear notifications params +func (o *ClearNotificationsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the clear notifications params +func (o *ClearNotificationsParams) WithHTTPClient(client *http.Client) *ClearNotificationsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the clear notifications params +func (o *ClearNotificationsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ClearNotificationsParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/clear_notifications_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/clear_notifications_responses.go new file mode 100644 index 0000000..3bc8a00 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/clear_notifications_responses.go @@ -0,0 +1,412 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package notifications + +// 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" +) + +// ClearNotificationsReader is a Reader for the ClearNotifications structure. +type ClearNotificationsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ClearNotificationsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewClearNotificationsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewClearNotificationsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewClearNotificationsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewClearNotificationsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewClearNotificationsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewClearNotificationsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/notifications/clear] clearNotifications", response, response.Code()) + } +} + +// NewClearNotificationsOK creates a ClearNotificationsOK with default headers values +func NewClearNotificationsOK() *ClearNotificationsOK { + return &ClearNotificationsOK{} +} + +/* +ClearNotificationsOK describes a response with status code 200, with default header values. + +ClearNotificationsOK clear notifications o k +*/ +type ClearNotificationsOK struct { + Payload interface{} +} + +// IsSuccess returns true when this clear notifications o k response has a 2xx status code +func (o *ClearNotificationsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this clear notifications o k response has a 3xx status code +func (o *ClearNotificationsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this clear notifications o k response has a 4xx status code +func (o *ClearNotificationsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this clear notifications o k response has a 5xx status code +func (o *ClearNotificationsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this clear notifications o k response a status code equal to that given +func (o *ClearNotificationsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the clear notifications o k response +func (o *ClearNotificationsOK) Code() int { + return 200 +} + +func (o *ClearNotificationsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsOK %s", 200, payload) +} + +func (o *ClearNotificationsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsOK %s", 200, payload) +} + +func (o *ClearNotificationsOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ClearNotificationsOK) 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 +} + +// NewClearNotificationsBadRequest creates a ClearNotificationsBadRequest with default headers values +func NewClearNotificationsBadRequest() *ClearNotificationsBadRequest { + return &ClearNotificationsBadRequest{} +} + +/* +ClearNotificationsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ClearNotificationsBadRequest struct { +} + +// IsSuccess returns true when this clear notifications bad request response has a 2xx status code +func (o *ClearNotificationsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this clear notifications bad request response has a 3xx status code +func (o *ClearNotificationsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this clear notifications bad request response has a 4xx status code +func (o *ClearNotificationsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this clear notifications bad request response has a 5xx status code +func (o *ClearNotificationsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this clear notifications bad request response a status code equal to that given +func (o *ClearNotificationsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the clear notifications bad request response +func (o *ClearNotificationsBadRequest) Code() int { + return 400 +} + +func (o *ClearNotificationsBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsBadRequest", 400) +} + +func (o *ClearNotificationsBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsBadRequest", 400) +} + +func (o *ClearNotificationsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewClearNotificationsUnauthorized creates a ClearNotificationsUnauthorized with default headers values +func NewClearNotificationsUnauthorized() *ClearNotificationsUnauthorized { + return &ClearNotificationsUnauthorized{} +} + +/* +ClearNotificationsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ClearNotificationsUnauthorized struct { +} + +// IsSuccess returns true when this clear notifications unauthorized response has a 2xx status code +func (o *ClearNotificationsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this clear notifications unauthorized response has a 3xx status code +func (o *ClearNotificationsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this clear notifications unauthorized response has a 4xx status code +func (o *ClearNotificationsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this clear notifications unauthorized response has a 5xx status code +func (o *ClearNotificationsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this clear notifications unauthorized response a status code equal to that given +func (o *ClearNotificationsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the clear notifications unauthorized response +func (o *ClearNotificationsUnauthorized) Code() int { + return 401 +} + +func (o *ClearNotificationsUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsUnauthorized", 401) +} + +func (o *ClearNotificationsUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsUnauthorized", 401) +} + +func (o *ClearNotificationsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewClearNotificationsNotFound creates a ClearNotificationsNotFound with default headers values +func NewClearNotificationsNotFound() *ClearNotificationsNotFound { + return &ClearNotificationsNotFound{} +} + +/* +ClearNotificationsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ClearNotificationsNotFound struct { +} + +// IsSuccess returns true when this clear notifications not found response has a 2xx status code +func (o *ClearNotificationsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this clear notifications not found response has a 3xx status code +func (o *ClearNotificationsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this clear notifications not found response has a 4xx status code +func (o *ClearNotificationsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this clear notifications not found response has a 5xx status code +func (o *ClearNotificationsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this clear notifications not found response a status code equal to that given +func (o *ClearNotificationsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the clear notifications not found response +func (o *ClearNotificationsNotFound) Code() int { + return 404 +} + +func (o *ClearNotificationsNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsNotFound", 404) +} + +func (o *ClearNotificationsNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsNotFound", 404) +} + +func (o *ClearNotificationsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewClearNotificationsNotAcceptable creates a ClearNotificationsNotAcceptable with default headers values +func NewClearNotificationsNotAcceptable() *ClearNotificationsNotAcceptable { + return &ClearNotificationsNotAcceptable{} +} + +/* +ClearNotificationsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ClearNotificationsNotAcceptable struct { +} + +// IsSuccess returns true when this clear notifications not acceptable response has a 2xx status code +func (o *ClearNotificationsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this clear notifications not acceptable response has a 3xx status code +func (o *ClearNotificationsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this clear notifications not acceptable response has a 4xx status code +func (o *ClearNotificationsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this clear notifications not acceptable response has a 5xx status code +func (o *ClearNotificationsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this clear notifications not acceptable response a status code equal to that given +func (o *ClearNotificationsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the clear notifications not acceptable response +func (o *ClearNotificationsNotAcceptable) Code() int { + return 406 +} + +func (o *ClearNotificationsNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsNotAcceptable", 406) +} + +func (o *ClearNotificationsNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsNotAcceptable", 406) +} + +func (o *ClearNotificationsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewClearNotificationsInternalServerError creates a ClearNotificationsInternalServerError with default headers values +func NewClearNotificationsInternalServerError() *ClearNotificationsInternalServerError { + return &ClearNotificationsInternalServerError{} +} + +/* +ClearNotificationsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ClearNotificationsInternalServerError struct { +} + +// IsSuccess returns true when this clear notifications internal server error response has a 2xx status code +func (o *ClearNotificationsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this clear notifications internal server error response has a 3xx status code +func (o *ClearNotificationsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this clear notifications internal server error response has a 4xx status code +func (o *ClearNotificationsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this clear notifications internal server error response has a 5xx status code +func (o *ClearNotificationsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this clear notifications internal server error response a status code equal to that given +func (o *ClearNotificationsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the clear notifications internal server error response +func (o *ClearNotificationsInternalServerError) Code() int { + return 500 +} + +func (o *ClearNotificationsInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsInternalServerError", 500) +} + +func (o *ClearNotificationsInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsInternalServerError", 500) +} + +func (o *ClearNotificationsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/notification_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/notification_parameters.go new file mode 100644 index 0000000..11a983c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/notification_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package notifications + +// 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" +) + +// NewNotificationParams creates a new NotificationParams 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 NewNotificationParams() *NotificationParams { + return &NotificationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewNotificationParamsWithTimeout creates a new NotificationParams object +// with the ability to set a timeout on a request. +func NewNotificationParamsWithTimeout(timeout time.Duration) *NotificationParams { + return &NotificationParams{ + timeout: timeout, + } +} + +// NewNotificationParamsWithContext creates a new NotificationParams object +// with the ability to set a context for a request. +func NewNotificationParamsWithContext(ctx context.Context) *NotificationParams { + return &NotificationParams{ + Context: ctx, + } +} + +// NewNotificationParamsWithHTTPClient creates a new NotificationParams object +// with the ability to set a custom HTTPClient for a request. +func NewNotificationParamsWithHTTPClient(client *http.Client) *NotificationParams { + return &NotificationParams{ + HTTPClient: client, + } +} + +/* +NotificationParams contains all the parameters to send to the API endpoint + + for the notification operation. + + Typically these are written to a http.Request. +*/ +type NotificationParams struct { + + /* ID. + + The ID of the notification. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the notification params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *NotificationParams) WithDefaults() *NotificationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the notification params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *NotificationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the notification params +func (o *NotificationParams) WithTimeout(timeout time.Duration) *NotificationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the notification params +func (o *NotificationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the notification params +func (o *NotificationParams) WithContext(ctx context.Context) *NotificationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the notification params +func (o *NotificationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the notification params +func (o *NotificationParams) WithHTTPClient(client *http.Client) *NotificationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the notification params +func (o *NotificationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the notification params +func (o *NotificationParams) WithID(id string) *NotificationParams { + o.SetID(id) + return o +} + +// SetID adds the id to the notification params +func (o *NotificationParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *NotificationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/notification_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/notification_responses.go new file mode 100644 index 0000000..c4b8fe8 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/notification_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package notifications + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// NotificationReader is a Reader for the Notification structure. +type NotificationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *NotificationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewNotificationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewNotificationBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewNotificationUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewNotificationNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewNotificationNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewNotificationInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/notification/{id}] notification", response, response.Code()) + } +} + +// NewNotificationOK creates a NotificationOK with default headers values +func NewNotificationOK() *NotificationOK { + return &NotificationOK{} +} + +/* +NotificationOK describes a response with status code 200, with default header values. + +Requested notification. +*/ +type NotificationOK struct { + Payload *models.Notification +} + +// IsSuccess returns true when this notification o k response has a 2xx status code +func (o *NotificationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this notification o k response has a 3xx status code +func (o *NotificationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notification o k response has a 4xx status code +func (o *NotificationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this notification o k response has a 5xx status code +func (o *NotificationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this notification o k response a status code equal to that given +func (o *NotificationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the notification o k response +func (o *NotificationOK) Code() int { + return 200 +} + +func (o *NotificationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationOK %s", 200, payload) +} + +func (o *NotificationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationOK %s", 200, payload) +} + +func (o *NotificationOK) GetPayload() *models.Notification { + return o.Payload +} + +func (o *NotificationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Notification) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewNotificationBadRequest creates a NotificationBadRequest with default headers values +func NewNotificationBadRequest() *NotificationBadRequest { + return &NotificationBadRequest{} +} + +/* +NotificationBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type NotificationBadRequest struct { +} + +// IsSuccess returns true when this notification bad request response has a 2xx status code +func (o *NotificationBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this notification bad request response has a 3xx status code +func (o *NotificationBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notification bad request response has a 4xx status code +func (o *NotificationBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this notification bad request response has a 5xx status code +func (o *NotificationBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this notification bad request response a status code equal to that given +func (o *NotificationBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the notification bad request response +func (o *NotificationBadRequest) Code() int { + return 400 +} + +func (o *NotificationBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationBadRequest", 400) +} + +func (o *NotificationBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationBadRequest", 400) +} + +func (o *NotificationBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewNotificationUnauthorized creates a NotificationUnauthorized with default headers values +func NewNotificationUnauthorized() *NotificationUnauthorized { + return &NotificationUnauthorized{} +} + +/* +NotificationUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type NotificationUnauthorized struct { +} + +// IsSuccess returns true when this notification unauthorized response has a 2xx status code +func (o *NotificationUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this notification unauthorized response has a 3xx status code +func (o *NotificationUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notification unauthorized response has a 4xx status code +func (o *NotificationUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this notification unauthorized response has a 5xx status code +func (o *NotificationUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this notification unauthorized response a status code equal to that given +func (o *NotificationUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the notification unauthorized response +func (o *NotificationUnauthorized) Code() int { + return 401 +} + +func (o *NotificationUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationUnauthorized", 401) +} + +func (o *NotificationUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationUnauthorized", 401) +} + +func (o *NotificationUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewNotificationNotFound creates a NotificationNotFound with default headers values +func NewNotificationNotFound() *NotificationNotFound { + return &NotificationNotFound{} +} + +/* +NotificationNotFound describes a response with status code 404, with default header values. + +not found +*/ +type NotificationNotFound struct { +} + +// IsSuccess returns true when this notification not found response has a 2xx status code +func (o *NotificationNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this notification not found response has a 3xx status code +func (o *NotificationNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notification not found response has a 4xx status code +func (o *NotificationNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this notification not found response has a 5xx status code +func (o *NotificationNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this notification not found response a status code equal to that given +func (o *NotificationNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the notification not found response +func (o *NotificationNotFound) Code() int { + return 404 +} + +func (o *NotificationNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationNotFound", 404) +} + +func (o *NotificationNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationNotFound", 404) +} + +func (o *NotificationNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewNotificationNotAcceptable creates a NotificationNotAcceptable with default headers values +func NewNotificationNotAcceptable() *NotificationNotAcceptable { + return &NotificationNotAcceptable{} +} + +/* +NotificationNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type NotificationNotAcceptable struct { +} + +// IsSuccess returns true when this notification not acceptable response has a 2xx status code +func (o *NotificationNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this notification not acceptable response has a 3xx status code +func (o *NotificationNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notification not acceptable response has a 4xx status code +func (o *NotificationNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this notification not acceptable response has a 5xx status code +func (o *NotificationNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this notification not acceptable response a status code equal to that given +func (o *NotificationNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the notification not acceptable response +func (o *NotificationNotAcceptable) Code() int { + return 406 +} + +func (o *NotificationNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationNotAcceptable", 406) +} + +func (o *NotificationNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationNotAcceptable", 406) +} + +func (o *NotificationNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewNotificationInternalServerError creates a NotificationInternalServerError with default headers values +func NewNotificationInternalServerError() *NotificationInternalServerError { + return &NotificationInternalServerError{} +} + +/* +NotificationInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type NotificationInternalServerError struct { +} + +// IsSuccess returns true when this notification internal server error response has a 2xx status code +func (o *NotificationInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this notification internal server error response has a 3xx status code +func (o *NotificationInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notification internal server error response has a 4xx status code +func (o *NotificationInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this notification internal server error response has a 5xx status code +func (o *NotificationInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this notification internal server error response a status code equal to that given +func (o *NotificationInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the notification internal server error response +func (o *NotificationInternalServerError) Code() int { + return 500 +} + +func (o *NotificationInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationInternalServerError", 500) +} + +func (o *NotificationInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationInternalServerError", 500) +} + +func (o *NotificationInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/notifications_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/notifications_client.go new file mode 100644 index 0000000..26f8290 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/notifications_client.go @@ -0,0 +1,199 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package notifications + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new notifications API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new notifications API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new notifications API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for notifications API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ClearNotifications(params *ClearNotificationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ClearNotificationsOK, error) + + Notification(params *NotificationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*NotificationOK, error) + + Notifications(params *NotificationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*NotificationsOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +ClearNotifications clears delete all notifications for currently authorized user + +Will return an empty object `{}` to indicate success. +*/ +func (a *Client) ClearNotifications(params *ClearNotificationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ClearNotificationsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewClearNotificationsParams() + } + op := &runtime.ClientOperation{ + ID: "clearNotifications", + Method: "POST", + PathPattern: "/api/v1/notifications/clear", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ClearNotificationsReader{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.(*ClearNotificationsOK) + 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 clearNotifications: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +Notification gets a single notification with the given ID +*/ +func (a *Client) Notification(params *NotificationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*NotificationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewNotificationParams() + } + op := &runtime.ClientOperation{ + ID: "notification", + Method: "GET", + PathPattern: "/api/v1/notification/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &NotificationReader{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.(*NotificationOK) + 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 notification: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + Notifications gets notifications for currently authorized user + + The notifications will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer). + +The next and previous queries can be parsed from the returned Link header. +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) Notifications(params *NotificationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*NotificationsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewNotificationsParams() + } + op := &runtime.ClientOperation{ + ID: "notifications", + Method: "GET", + PathPattern: "/api/v1/notifications", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &NotificationsReader{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.(*NotificationsOK) + 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 notifications: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/notifications_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/notifications_parameters.go new file mode 100644 index 0000000..3496edb --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/notifications_parameters.go @@ -0,0 +1,369 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package notifications + +// 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" +) + +// NewNotificationsParams creates a new NotificationsParams 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 NewNotificationsParams() *NotificationsParams { + return &NotificationsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewNotificationsParamsWithTimeout creates a new NotificationsParams object +// with the ability to set a timeout on a request. +func NewNotificationsParamsWithTimeout(timeout time.Duration) *NotificationsParams { + return &NotificationsParams{ + timeout: timeout, + } +} + +// NewNotificationsParamsWithContext creates a new NotificationsParams object +// with the ability to set a context for a request. +func NewNotificationsParamsWithContext(ctx context.Context) *NotificationsParams { + return &NotificationsParams{ + Context: ctx, + } +} + +// NewNotificationsParamsWithHTTPClient creates a new NotificationsParams object +// with the ability to set a custom HTTPClient for a request. +func NewNotificationsParamsWithHTTPClient(client *http.Client) *NotificationsParams { + return &NotificationsParams{ + HTTPClient: client, + } +} + +/* +NotificationsParams contains all the parameters to send to the API endpoint + + for the notifications operation. + + Typically these are written to a http.Request. +*/ +type NotificationsParams struct { + + /* ExcludeTypes. + + Types of notifications to exclude. + */ + ExcludeTypes []string + + /* Limit. + + Number of notifications to return. + + Default: 20 + */ + Limit *int64 + + /* MaxID. + + Return only notifications *OLDER* than the given max notification ID. The notification with the specified ID will not be included in the response. + */ + MaxID *string + + /* MinID. + + Return only notifications *immediately newer* than the given since notification ID. The notification with the specified ID will not be included in the response. + */ + MinID *string + + /* SinceID. + + Return only notifications *newer* than the given since notification ID. The notification with the specified ID will not be included in the response. + */ + SinceID *string + + /* Types. + + Types of notifications to include. If not provided, all notification types will be included. + */ + Types []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the notifications params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *NotificationsParams) WithDefaults() *NotificationsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the notifications params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *NotificationsParams) SetDefaults() { + var ( + limitDefault = int64(20) + ) + + val := NotificationsParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the notifications params +func (o *NotificationsParams) WithTimeout(timeout time.Duration) *NotificationsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the notifications params +func (o *NotificationsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the notifications params +func (o *NotificationsParams) WithContext(ctx context.Context) *NotificationsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the notifications params +func (o *NotificationsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the notifications params +func (o *NotificationsParams) WithHTTPClient(client *http.Client) *NotificationsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the notifications params +func (o *NotificationsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExcludeTypes adds the excludeTypes to the notifications params +func (o *NotificationsParams) WithExcludeTypes(excludeTypes []string) *NotificationsParams { + o.SetExcludeTypes(excludeTypes) + return o +} + +// SetExcludeTypes adds the excludeTypes to the notifications params +func (o *NotificationsParams) SetExcludeTypes(excludeTypes []string) { + o.ExcludeTypes = excludeTypes +} + +// WithLimit adds the limit to the notifications params +func (o *NotificationsParams) WithLimit(limit *int64) *NotificationsParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the notifications params +func (o *NotificationsParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the notifications params +func (o *NotificationsParams) WithMaxID(maxID *string) *NotificationsParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the notifications params +func (o *NotificationsParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the notifications params +func (o *NotificationsParams) WithMinID(minID *string) *NotificationsParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the notifications params +func (o *NotificationsParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the notifications params +func (o *NotificationsParams) WithSinceID(sinceID *string) *NotificationsParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the notifications params +func (o *NotificationsParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WithTypes adds the types to the notifications params +func (o *NotificationsParams) WithTypes(types []string) *NotificationsParams { + o.SetTypes(types) + return o +} + +// SetTypes adds the types to the notifications params +func (o *NotificationsParams) SetTypes(types []string) { + o.Types = types +} + +// WriteToRequest writes these params to a swagger request +func (o *NotificationsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ExcludeTypes != nil { + + // binding items for exclude_types[] + joinedExcludeTypes := o.bindParamExcludeTypes(reg) + + // query array param exclude_types[] + if err := r.SetQueryParam("exclude_types[]", joinedExcludeTypes...); 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.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if o.SinceID != nil { + + // query param since_id + var qrSinceID string + + if o.SinceID != nil { + qrSinceID = *o.SinceID + } + qSinceID := qrSinceID + if qSinceID != "" { + + if err := r.SetQueryParam("since_id", qSinceID); err != nil { + return err + } + } + } + + if o.Types != nil { + + // binding items for types[] + joinedTypes := o.bindParamTypes(reg) + + // query array param types[] + if err := r.SetQueryParam("types[]", joinedTypes...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamNotifications binds the parameter exclude_types[] +func (o *NotificationsParams) bindParamExcludeTypes(formats strfmt.Registry) []string { + excludeTypesIR := o.ExcludeTypes + + var excludeTypesIC []string + for _, excludeTypesIIR := range excludeTypesIR { // explode []string + + excludeTypesIIV := excludeTypesIIR // string as string + excludeTypesIC = append(excludeTypesIC, excludeTypesIIV) + } + + // items.CollectionFormat: "" + excludeTypesIS := swag.JoinByFormat(excludeTypesIC, "") + + return excludeTypesIS +} + +// bindParamNotifications binds the parameter types[] +func (o *NotificationsParams) bindParamTypes(formats strfmt.Registry) []string { + typesIR := o.Types + + var typesIC []string + for _, typesIIR := range typesIR { // explode []string + + typesIIV := typesIIR // string as string + typesIC = append(typesIC, typesIIV) + } + + // items.CollectionFormat: "" + typesIS := swag.JoinByFormat(typesIC, "") + + return typesIS +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/notifications_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/notifications_responses.go new file mode 100644 index 0000000..d46fdb3 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/notifications/notifications_responses.go @@ -0,0 +1,426 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package notifications + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// NotificationsReader is a Reader for the Notifications structure. +type NotificationsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *NotificationsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewNotificationsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewNotificationsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewNotificationsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewNotificationsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewNotificationsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewNotificationsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/notifications] notifications", response, response.Code()) + } +} + +// NewNotificationsOK creates a NotificationsOK with default headers values +func NewNotificationsOK() *NotificationsOK { + return &NotificationsOK{} +} + +/* +NotificationsOK describes a response with status code 200, with default header values. + +Array of notifications. +*/ +type NotificationsOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Notification +} + +// IsSuccess returns true when this notifications o k response has a 2xx status code +func (o *NotificationsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this notifications o k response has a 3xx status code +func (o *NotificationsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notifications o k response has a 4xx status code +func (o *NotificationsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this notifications o k response has a 5xx status code +func (o *NotificationsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this notifications o k response a status code equal to that given +func (o *NotificationsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the notifications o k response +func (o *NotificationsOK) Code() int { + return 200 +} + +func (o *NotificationsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsOK %s", 200, payload) +} + +func (o *NotificationsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsOK %s", 200, payload) +} + +func (o *NotificationsOK) GetPayload() []*models.Notification { + return o.Payload +} + +func (o *NotificationsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewNotificationsBadRequest creates a NotificationsBadRequest with default headers values +func NewNotificationsBadRequest() *NotificationsBadRequest { + return &NotificationsBadRequest{} +} + +/* +NotificationsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type NotificationsBadRequest struct { +} + +// IsSuccess returns true when this notifications bad request response has a 2xx status code +func (o *NotificationsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this notifications bad request response has a 3xx status code +func (o *NotificationsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notifications bad request response has a 4xx status code +func (o *NotificationsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this notifications bad request response has a 5xx status code +func (o *NotificationsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this notifications bad request response a status code equal to that given +func (o *NotificationsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the notifications bad request response +func (o *NotificationsBadRequest) Code() int { + return 400 +} + +func (o *NotificationsBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsBadRequest", 400) +} + +func (o *NotificationsBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsBadRequest", 400) +} + +func (o *NotificationsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewNotificationsUnauthorized creates a NotificationsUnauthorized with default headers values +func NewNotificationsUnauthorized() *NotificationsUnauthorized { + return &NotificationsUnauthorized{} +} + +/* +NotificationsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type NotificationsUnauthorized struct { +} + +// IsSuccess returns true when this notifications unauthorized response has a 2xx status code +func (o *NotificationsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this notifications unauthorized response has a 3xx status code +func (o *NotificationsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notifications unauthorized response has a 4xx status code +func (o *NotificationsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this notifications unauthorized response has a 5xx status code +func (o *NotificationsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this notifications unauthorized response a status code equal to that given +func (o *NotificationsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the notifications unauthorized response +func (o *NotificationsUnauthorized) Code() int { + return 401 +} + +func (o *NotificationsUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsUnauthorized", 401) +} + +func (o *NotificationsUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsUnauthorized", 401) +} + +func (o *NotificationsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewNotificationsNotFound creates a NotificationsNotFound with default headers values +func NewNotificationsNotFound() *NotificationsNotFound { + return &NotificationsNotFound{} +} + +/* +NotificationsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type NotificationsNotFound struct { +} + +// IsSuccess returns true when this notifications not found response has a 2xx status code +func (o *NotificationsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this notifications not found response has a 3xx status code +func (o *NotificationsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notifications not found response has a 4xx status code +func (o *NotificationsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this notifications not found response has a 5xx status code +func (o *NotificationsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this notifications not found response a status code equal to that given +func (o *NotificationsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the notifications not found response +func (o *NotificationsNotFound) Code() int { + return 404 +} + +func (o *NotificationsNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsNotFound", 404) +} + +func (o *NotificationsNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsNotFound", 404) +} + +func (o *NotificationsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewNotificationsNotAcceptable creates a NotificationsNotAcceptable with default headers values +func NewNotificationsNotAcceptable() *NotificationsNotAcceptable { + return &NotificationsNotAcceptable{} +} + +/* +NotificationsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type NotificationsNotAcceptable struct { +} + +// IsSuccess returns true when this notifications not acceptable response has a 2xx status code +func (o *NotificationsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this notifications not acceptable response has a 3xx status code +func (o *NotificationsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notifications not acceptable response has a 4xx status code +func (o *NotificationsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this notifications not acceptable response has a 5xx status code +func (o *NotificationsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this notifications not acceptable response a status code equal to that given +func (o *NotificationsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the notifications not acceptable response +func (o *NotificationsNotAcceptable) Code() int { + return 406 +} + +func (o *NotificationsNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsNotAcceptable", 406) +} + +func (o *NotificationsNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsNotAcceptable", 406) +} + +func (o *NotificationsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewNotificationsInternalServerError creates a NotificationsInternalServerError with default headers values +func NewNotificationsInternalServerError() *NotificationsInternalServerError { + return &NotificationsInternalServerError{} +} + +/* +NotificationsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type NotificationsInternalServerError struct { +} + +// IsSuccess returns true when this notifications internal server error response has a 2xx status code +func (o *NotificationsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this notifications internal server error response has a 3xx status code +func (o *NotificationsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notifications internal server error response has a 4xx status code +func (o *NotificationsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this notifications internal server error response has a 5xx status code +func (o *NotificationsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this notifications internal server error response a status code equal to that given +func (o *NotificationsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the notifications internal server error response +func (o *NotificationsInternalServerError) Code() int { + return 500 +} + +func (o *NotificationsInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsInternalServerError", 500) +} + +func (o *NotificationsInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsInternalServerError", 500) +} + +func (o *NotificationsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/host_meta_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/host_meta_get_parameters.go new file mode 100644 index 0000000..09061cb --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/host_meta_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package nr_well_known + +// 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" +) + +// NewHostMetaGetParams creates a new HostMetaGetParams 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 NewHostMetaGetParams() *HostMetaGetParams { + return &HostMetaGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHostMetaGetParamsWithTimeout creates a new HostMetaGetParams object +// with the ability to set a timeout on a request. +func NewHostMetaGetParamsWithTimeout(timeout time.Duration) *HostMetaGetParams { + return &HostMetaGetParams{ + timeout: timeout, + } +} + +// NewHostMetaGetParamsWithContext creates a new HostMetaGetParams object +// with the ability to set a context for a request. +func NewHostMetaGetParamsWithContext(ctx context.Context) *HostMetaGetParams { + return &HostMetaGetParams{ + Context: ctx, + } +} + +// NewHostMetaGetParamsWithHTTPClient creates a new HostMetaGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewHostMetaGetParamsWithHTTPClient(client *http.Client) *HostMetaGetParams { + return &HostMetaGetParams{ + HTTPClient: client, + } +} + +/* +HostMetaGetParams contains all the parameters to send to the API endpoint + + for the host meta get operation. + + Typically these are written to a http.Request. +*/ +type HostMetaGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the host meta get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HostMetaGetParams) WithDefaults() *HostMetaGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the host meta get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HostMetaGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the host meta get params +func (o *HostMetaGetParams) WithTimeout(timeout time.Duration) *HostMetaGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the host meta get params +func (o *HostMetaGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the host meta get params +func (o *HostMetaGetParams) WithContext(ctx context.Context) *HostMetaGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the host meta get params +func (o *HostMetaGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the host meta get params +func (o *HostMetaGetParams) WithHTTPClient(client *http.Client) *HostMetaGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the host meta get params +func (o *HostMetaGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *HostMetaGetParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/host_meta_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/host_meta_get_responses.go new file mode 100644 index 0000000..a1fa20e --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/host_meta_get_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package nr_well_known + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// HostMetaGetReader is a Reader for the HostMetaGet structure. +type HostMetaGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HostMetaGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHostMetaGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /.well-known/host-meta] hostMetaGet", response, response.Code()) + } +} + +// NewHostMetaGetOK creates a HostMetaGetOK with default headers values +func NewHostMetaGetOK() *HostMetaGetOK { + return &HostMetaGetOK{} +} + +/* +HostMetaGetOK describes a response with status code 200, with default header values. + +HostMetaGetOK host meta get o k +*/ +type HostMetaGetOK struct { + Payload *models.HostMeta +} + +// IsSuccess returns true when this host meta get o k response has a 2xx status code +func (o *HostMetaGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this host meta get o k response has a 3xx status code +func (o *HostMetaGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this host meta get o k response has a 4xx status code +func (o *HostMetaGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this host meta get o k response has a 5xx status code +func (o *HostMetaGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this host meta get o k response a status code equal to that given +func (o *HostMetaGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the host meta get o k response +func (o *HostMetaGetOK) Code() int { + return 200 +} + +func (o *HostMetaGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /.well-known/host-meta][%d] hostMetaGetOK %s", 200, payload) +} + +func (o *HostMetaGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /.well-known/host-meta][%d] hostMetaGetOK %s", 200, payload) +} + +func (o *HostMetaGetOK) GetPayload() *models.HostMeta { + return o.Payload +} + +func (o *HostMetaGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HostMeta) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/node_info_well_known_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/node_info_well_known_get_parameters.go new file mode 100644 index 0000000..e74259d --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/node_info_well_known_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package nr_well_known + +// 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" +) + +// NewNodeInfoWellKnownGetParams creates a new NodeInfoWellKnownGetParams 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 NewNodeInfoWellKnownGetParams() *NodeInfoWellKnownGetParams { + return &NodeInfoWellKnownGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewNodeInfoWellKnownGetParamsWithTimeout creates a new NodeInfoWellKnownGetParams object +// with the ability to set a timeout on a request. +func NewNodeInfoWellKnownGetParamsWithTimeout(timeout time.Duration) *NodeInfoWellKnownGetParams { + return &NodeInfoWellKnownGetParams{ + timeout: timeout, + } +} + +// NewNodeInfoWellKnownGetParamsWithContext creates a new NodeInfoWellKnownGetParams object +// with the ability to set a context for a request. +func NewNodeInfoWellKnownGetParamsWithContext(ctx context.Context) *NodeInfoWellKnownGetParams { + return &NodeInfoWellKnownGetParams{ + Context: ctx, + } +} + +// NewNodeInfoWellKnownGetParamsWithHTTPClient creates a new NodeInfoWellKnownGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewNodeInfoWellKnownGetParamsWithHTTPClient(client *http.Client) *NodeInfoWellKnownGetParams { + return &NodeInfoWellKnownGetParams{ + HTTPClient: client, + } +} + +/* +NodeInfoWellKnownGetParams contains all the parameters to send to the API endpoint + + for the node info well known get operation. + + Typically these are written to a http.Request. +*/ +type NodeInfoWellKnownGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the node info well known get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *NodeInfoWellKnownGetParams) WithDefaults() *NodeInfoWellKnownGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the node info well known get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *NodeInfoWellKnownGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the node info well known get params +func (o *NodeInfoWellKnownGetParams) WithTimeout(timeout time.Duration) *NodeInfoWellKnownGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the node info well known get params +func (o *NodeInfoWellKnownGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the node info well known get params +func (o *NodeInfoWellKnownGetParams) WithContext(ctx context.Context) *NodeInfoWellKnownGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the node info well known get params +func (o *NodeInfoWellKnownGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the node info well known get params +func (o *NodeInfoWellKnownGetParams) WithHTTPClient(client *http.Client) *NodeInfoWellKnownGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the node info well known get params +func (o *NodeInfoWellKnownGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *NodeInfoWellKnownGetParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/node_info_well_known_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/node_info_well_known_get_responses.go new file mode 100644 index 0000000..cc580f8 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/node_info_well_known_get_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package nr_well_known + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// NodeInfoWellKnownGetReader is a Reader for the NodeInfoWellKnownGet structure. +type NodeInfoWellKnownGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *NodeInfoWellKnownGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewNodeInfoWellKnownGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /.well-known/nodeinfo] nodeInfoWellKnownGet", response, response.Code()) + } +} + +// NewNodeInfoWellKnownGetOK creates a NodeInfoWellKnownGetOK with default headers values +func NewNodeInfoWellKnownGetOK() *NodeInfoWellKnownGetOK { + return &NodeInfoWellKnownGetOK{} +} + +/* +NodeInfoWellKnownGetOK describes a response with status code 200, with default header values. + +NodeInfoWellKnownGetOK node info well known get o k +*/ +type NodeInfoWellKnownGetOK struct { + Payload *models.WellKnownResponse +} + +// IsSuccess returns true when this node info well known get o k response has a 2xx status code +func (o *NodeInfoWellKnownGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this node info well known get o k response has a 3xx status code +func (o *NodeInfoWellKnownGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this node info well known get o k response has a 4xx status code +func (o *NodeInfoWellKnownGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this node info well known get o k response has a 5xx status code +func (o *NodeInfoWellKnownGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this node info well known get o k response a status code equal to that given +func (o *NodeInfoWellKnownGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the node info well known get o k response +func (o *NodeInfoWellKnownGetOK) Code() int { + return 200 +} + +func (o *NodeInfoWellKnownGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /.well-known/nodeinfo][%d] nodeInfoWellKnownGetOK %s", 200, payload) +} + +func (o *NodeInfoWellKnownGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /.well-known/nodeinfo][%d] nodeInfoWellKnownGetOK %s", 200, payload) +} + +func (o *NodeInfoWellKnownGetOK) GetPayload() *models.WellKnownResponse { + return o.Payload +} + +func (o *NodeInfoWellKnownGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.WellKnownResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/nr_well_known_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/nr_well_known_client.go new file mode 100644 index 0000000..22f509b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/nr_well_known_client.go @@ -0,0 +1,230 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package nr_well_known + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new nr well known API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new nr well known API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new nr well known API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for nr well known API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithAccept allows the client to force the Accept header +// to negotiate a specific Producer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithAccept(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{mime} + } +} + +// WithAcceptApplicationJrdJSON sets the Accept header to "application/jrd+json". +func WithAcceptApplicationJrdJSON(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{"application/jrd+json"} +} + +// WithAcceptApplicationJSON sets the Accept header to "application/json". +func WithAcceptApplicationJSON(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{"application/json"} +} + +// WithAcceptApplicationXrdXML sets the Accept header to "application/xrd+xml\"". +func WithAcceptApplicationXrdXML(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{"application/xrd+xml\""} +} + +// ClientService is the interface for Client methods +type ClientService interface { + HostMetaGet(params *HostMetaGetParams, opts ...ClientOption) (*HostMetaGetOK, error) + + NodeInfoWellKnownGet(params *NodeInfoWellKnownGetParams, opts ...ClientOption) (*NodeInfoWellKnownGetOK, error) + + WebfingerGet(params *WebfingerGetParams, opts ...ClientOption) (*WebfingerGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +HostMetaGet returns a compliant hostmeta response to web host metadata queries + +See: https://www.rfc-editor.org/rfc/rfc6415.html +*/ +func (a *Client) HostMetaGet(params *HostMetaGetParams, opts ...ClientOption) (*HostMetaGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHostMetaGetParams() + } + op := &runtime.ClientOperation{ + ID: "hostMetaGet", + Method: "GET", + PathPattern: "/.well-known/host-meta", + ProducesMediaTypes: []string{"application/xrd+xml\""}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &HostMetaGetReader{formats: a.formats}, + 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.(*HostMetaGetOK) + 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 hostMetaGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + NodeInfoWellKnownGet returns a well known response which redirects callers to nodeinfo 2 0 + + eg. `{"links":[{"rel":"http://nodeinfo.diaspora.software/ns/schema/2.0","href":"http://example.org/nodeinfo/2.0"}]}` + +See: https://nodeinfo.diaspora.software/protocol.html +*/ +func (a *Client) NodeInfoWellKnownGet(params *NodeInfoWellKnownGetParams, opts ...ClientOption) (*NodeInfoWellKnownGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewNodeInfoWellKnownGetParams() + } + op := &runtime.ClientOperation{ + ID: "nodeInfoWellKnownGet", + Method: "GET", + PathPattern: "/.well-known/nodeinfo", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &NodeInfoWellKnownGetReader{formats: a.formats}, + 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.(*NodeInfoWellKnownGetOK) + 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 nodeInfoWellKnownGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + WebfingerGet handles webfinger account lookup requests + + For example, a GET to `https://goblin.technology/.well-known/webfinger?resource=acct:tobi@goblin.technology` would return: + +``` + +{"subject":"acct:tobi@goblin.technology","aliases":["https://goblin.technology/users/tobi","https://goblin.technology/@tobi"],"links":[{"rel":"http://webfinger.net/rel/profile-page","type":"text/html","href":"https://goblin.technology/@tobi"},{"rel":"self","type":"application/activity+json","href":"https://goblin.technology/users/tobi"}]} + +``` + +See: https://webfinger.net/ +*/ +func (a *Client) WebfingerGet(params *WebfingerGetParams, opts ...ClientOption) (*WebfingerGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewWebfingerGetParams() + } + op := &runtime.ClientOperation{ + ID: "webfingerGet", + Method: "GET", + PathPattern: "/.well-known/webfinger", + ProducesMediaTypes: []string{"application/jrd+json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &WebfingerGetReader{formats: a.formats}, + 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.(*WebfingerGetOK) + 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 webfingerGet: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/webfinger_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/webfinger_get_parameters.go new file mode 100644 index 0000000..34f3a88 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/webfinger_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package nr_well_known + +// 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" +) + +// NewWebfingerGetParams creates a new WebfingerGetParams 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 NewWebfingerGetParams() *WebfingerGetParams { + return &WebfingerGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewWebfingerGetParamsWithTimeout creates a new WebfingerGetParams object +// with the ability to set a timeout on a request. +func NewWebfingerGetParamsWithTimeout(timeout time.Duration) *WebfingerGetParams { + return &WebfingerGetParams{ + timeout: timeout, + } +} + +// NewWebfingerGetParamsWithContext creates a new WebfingerGetParams object +// with the ability to set a context for a request. +func NewWebfingerGetParamsWithContext(ctx context.Context) *WebfingerGetParams { + return &WebfingerGetParams{ + Context: ctx, + } +} + +// NewWebfingerGetParamsWithHTTPClient creates a new WebfingerGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewWebfingerGetParamsWithHTTPClient(client *http.Client) *WebfingerGetParams { + return &WebfingerGetParams{ + HTTPClient: client, + } +} + +/* +WebfingerGetParams contains all the parameters to send to the API endpoint + + for the webfinger get operation. + + Typically these are written to a http.Request. +*/ +type WebfingerGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the webfinger get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *WebfingerGetParams) WithDefaults() *WebfingerGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the webfinger get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *WebfingerGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the webfinger get params +func (o *WebfingerGetParams) WithTimeout(timeout time.Duration) *WebfingerGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the webfinger get params +func (o *WebfingerGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the webfinger get params +func (o *WebfingerGetParams) WithContext(ctx context.Context) *WebfingerGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the webfinger get params +func (o *WebfingerGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the webfinger get params +func (o *WebfingerGetParams) WithHTTPClient(client *http.Client) *WebfingerGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the webfinger get params +func (o *WebfingerGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *WebfingerGetParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/webfinger_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/webfinger_get_responses.go new file mode 100644 index 0000000..6ba575a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known/webfinger_get_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package nr_well_known + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// WebfingerGetReader is a Reader for the WebfingerGet structure. +type WebfingerGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *WebfingerGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewWebfingerGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /.well-known/webfinger] webfingerGet", response, response.Code()) + } +} + +// NewWebfingerGetOK creates a WebfingerGetOK with default headers values +func NewWebfingerGetOK() *WebfingerGetOK { + return &WebfingerGetOK{} +} + +/* +WebfingerGetOK describes a response with status code 200, with default header values. + +WebfingerGetOK webfinger get o k +*/ +type WebfingerGetOK struct { + Payload *models.WellKnownResponse +} + +// IsSuccess returns true when this webfinger get o k response has a 2xx status code +func (o *WebfingerGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this webfinger get o k response has a 3xx status code +func (o *WebfingerGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this webfinger get o k response has a 4xx status code +func (o *WebfingerGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this webfinger get o k response has a 5xx status code +func (o *WebfingerGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this webfinger get o k response a status code equal to that given +func (o *WebfingerGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the webfinger get o k response +func (o *WebfingerGetOK) Code() int { + return 200 +} + +func (o *WebfingerGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /.well-known/webfinger][%d] webfingerGetOK %s", 200, payload) +} + +func (o *WebfingerGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /.well-known/webfinger][%d] webfingerGetOK %s", 200, payload) +} + +func (o *WebfingerGetOK) GetPayload() *models.WellKnownResponse { + return o.Payload +} + +func (o *WebfingerGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.WellKnownResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/polls/poll_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/polls/poll_parameters.go new file mode 100644 index 0000000..9aa473d --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/polls/poll_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package polls + +// 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" +) + +// NewPollParams creates a new PollParams 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 NewPollParams() *PollParams { + return &PollParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPollParamsWithTimeout creates a new PollParams object +// with the ability to set a timeout on a request. +func NewPollParamsWithTimeout(timeout time.Duration) *PollParams { + return &PollParams{ + timeout: timeout, + } +} + +// NewPollParamsWithContext creates a new PollParams object +// with the ability to set a context for a request. +func NewPollParamsWithContext(ctx context.Context) *PollParams { + return &PollParams{ + Context: ctx, + } +} + +// NewPollParamsWithHTTPClient creates a new PollParams object +// with the ability to set a custom HTTPClient for a request. +func NewPollParamsWithHTTPClient(client *http.Client) *PollParams { + return &PollParams{ + HTTPClient: client, + } +} + +/* +PollParams contains all the parameters to send to the API endpoint + + for the poll operation. + + Typically these are written to a http.Request. +*/ +type PollParams struct { + + /* ID. + + Target poll ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the poll params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PollParams) WithDefaults() *PollParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the poll params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PollParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the poll params +func (o *PollParams) WithTimeout(timeout time.Duration) *PollParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the poll params +func (o *PollParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the poll params +func (o *PollParams) WithContext(ctx context.Context) *PollParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the poll params +func (o *PollParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the poll params +func (o *PollParams) WithHTTPClient(client *http.Client) *PollParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the poll params +func (o *PollParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the poll params +func (o *PollParams) WithID(id string) *PollParams { + o.SetID(id) + return o +} + +// SetID adds the id to the poll params +func (o *PollParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PollParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/polls/poll_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/polls/poll_responses.go new file mode 100644 index 0000000..357d657 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/polls/poll_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package polls + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// PollReader is a Reader for the Poll structure. +type PollReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PollReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPollOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPollBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPollUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPollForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPollNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewPollNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPollInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/polls/{id}] poll", response, response.Code()) + } +} + +// NewPollOK creates a PollOK with default headers values +func NewPollOK() *PollOK { + return &PollOK{} +} + +/* +PollOK describes a response with status code 200, with default header values. + +The requested poll. +*/ +type PollOK struct { + Payload *models.Poll +} + +// IsSuccess returns true when this poll o k response has a 2xx status code +func (o *PollOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this poll o k response has a 3xx status code +func (o *PollOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll o k response has a 4xx status code +func (o *PollOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this poll o k response has a 5xx status code +func (o *PollOK) IsServerError() bool { + return false +} + +// IsCode returns true when this poll o k response a status code equal to that given +func (o *PollOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the poll o k response +func (o *PollOK) Code() int { + return 200 +} + +func (o *PollOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollOK %s", 200, payload) +} + +func (o *PollOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollOK %s", 200, payload) +} + +func (o *PollOK) GetPayload() *models.Poll { + return o.Payload +} + +func (o *PollOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Poll) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPollBadRequest creates a PollBadRequest with default headers values +func NewPollBadRequest() *PollBadRequest { + return &PollBadRequest{} +} + +/* +PollBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type PollBadRequest struct { +} + +// IsSuccess returns true when this poll bad request response has a 2xx status code +func (o *PollBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll bad request response has a 3xx status code +func (o *PollBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll bad request response has a 4xx status code +func (o *PollBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll bad request response has a 5xx status code +func (o *PollBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this poll bad request response a status code equal to that given +func (o *PollBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the poll bad request response +func (o *PollBadRequest) Code() int { + return 400 +} + +func (o *PollBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollBadRequest", 400) +} + +func (o *PollBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollBadRequest", 400) +} + +func (o *PollBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollUnauthorized creates a PollUnauthorized with default headers values +func NewPollUnauthorized() *PollUnauthorized { + return &PollUnauthorized{} +} + +/* +PollUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type PollUnauthorized struct { +} + +// IsSuccess returns true when this poll unauthorized response has a 2xx status code +func (o *PollUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll unauthorized response has a 3xx status code +func (o *PollUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll unauthorized response has a 4xx status code +func (o *PollUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll unauthorized response has a 5xx status code +func (o *PollUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this poll unauthorized response a status code equal to that given +func (o *PollUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the poll unauthorized response +func (o *PollUnauthorized) Code() int { + return 401 +} + +func (o *PollUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollUnauthorized", 401) +} + +func (o *PollUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollUnauthorized", 401) +} + +func (o *PollUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollForbidden creates a PollForbidden with default headers values +func NewPollForbidden() *PollForbidden { + return &PollForbidden{} +} + +/* +PollForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type PollForbidden struct { +} + +// IsSuccess returns true when this poll forbidden response has a 2xx status code +func (o *PollForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll forbidden response has a 3xx status code +func (o *PollForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll forbidden response has a 4xx status code +func (o *PollForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll forbidden response has a 5xx status code +func (o *PollForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this poll forbidden response a status code equal to that given +func (o *PollForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the poll forbidden response +func (o *PollForbidden) Code() int { + return 403 +} + +func (o *PollForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollForbidden", 403) +} + +func (o *PollForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollForbidden", 403) +} + +func (o *PollForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollNotFound creates a PollNotFound with default headers values +func NewPollNotFound() *PollNotFound { + return &PollNotFound{} +} + +/* +PollNotFound describes a response with status code 404, with default header values. + +not found +*/ +type PollNotFound struct { +} + +// IsSuccess returns true when this poll not found response has a 2xx status code +func (o *PollNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll not found response has a 3xx status code +func (o *PollNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll not found response has a 4xx status code +func (o *PollNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll not found response has a 5xx status code +func (o *PollNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this poll not found response a status code equal to that given +func (o *PollNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the poll not found response +func (o *PollNotFound) Code() int { + return 404 +} + +func (o *PollNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollNotFound", 404) +} + +func (o *PollNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollNotFound", 404) +} + +func (o *PollNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollNotAcceptable creates a PollNotAcceptable with default headers values +func NewPollNotAcceptable() *PollNotAcceptable { + return &PollNotAcceptable{} +} + +/* +PollNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type PollNotAcceptable struct { +} + +// IsSuccess returns true when this poll not acceptable response has a 2xx status code +func (o *PollNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll not acceptable response has a 3xx status code +func (o *PollNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll not acceptable response has a 4xx status code +func (o *PollNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll not acceptable response has a 5xx status code +func (o *PollNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this poll not acceptable response a status code equal to that given +func (o *PollNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the poll not acceptable response +func (o *PollNotAcceptable) Code() int { + return 406 +} + +func (o *PollNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollNotAcceptable", 406) +} + +func (o *PollNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollNotAcceptable", 406) +} + +func (o *PollNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollInternalServerError creates a PollInternalServerError with default headers values +func NewPollInternalServerError() *PollInternalServerError { + return &PollInternalServerError{} +} + +/* +PollInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type PollInternalServerError struct { +} + +// IsSuccess returns true when this poll internal server error response has a 2xx status code +func (o *PollInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll internal server error response has a 3xx status code +func (o *PollInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll internal server error response has a 4xx status code +func (o *PollInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this poll internal server error response has a 5xx status code +func (o *PollInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this poll internal server error response a status code equal to that given +func (o *PollInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the poll internal server error response +func (o *PollInternalServerError) Code() int { + return 500 +} + +func (o *PollInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollInternalServerError", 500) +} + +func (o *PollInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollInternalServerError", 500) +} + +func (o *PollInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/polls/poll_vote_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/polls/poll_vote_parameters.go new file mode 100644 index 0000000..f3dd68c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/polls/poll_vote_parameters.go @@ -0,0 +1,197 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package polls + +// 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" +) + +// NewPollVoteParams creates a new PollVoteParams 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 NewPollVoteParams() *PollVoteParams { + return &PollVoteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPollVoteParamsWithTimeout creates a new PollVoteParams object +// with the ability to set a timeout on a request. +func NewPollVoteParamsWithTimeout(timeout time.Duration) *PollVoteParams { + return &PollVoteParams{ + timeout: timeout, + } +} + +// NewPollVoteParamsWithContext creates a new PollVoteParams object +// with the ability to set a context for a request. +func NewPollVoteParamsWithContext(ctx context.Context) *PollVoteParams { + return &PollVoteParams{ + Context: ctx, + } +} + +// NewPollVoteParamsWithHTTPClient creates a new PollVoteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPollVoteParamsWithHTTPClient(client *http.Client) *PollVoteParams { + return &PollVoteParams{ + HTTPClient: client, + } +} + +/* +PollVoteParams contains all the parameters to send to the API endpoint + + for the poll vote operation. + + Typically these are written to a http.Request. +*/ +type PollVoteParams struct { + + /* Choices. + + Poll choice indices on which to vote. + */ + Choices []int64 + + /* ID. + + Target poll ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the poll vote params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PollVoteParams) WithDefaults() *PollVoteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the poll vote params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PollVoteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the poll vote params +func (o *PollVoteParams) WithTimeout(timeout time.Duration) *PollVoteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the poll vote params +func (o *PollVoteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the poll vote params +func (o *PollVoteParams) WithContext(ctx context.Context) *PollVoteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the poll vote params +func (o *PollVoteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the poll vote params +func (o *PollVoteParams) WithHTTPClient(client *http.Client) *PollVoteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the poll vote params +func (o *PollVoteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithChoices adds the choices to the poll vote params +func (o *PollVoteParams) WithChoices(choices []int64) *PollVoteParams { + o.SetChoices(choices) + return o +} + +// SetChoices adds the choices to the poll vote params +func (o *PollVoteParams) SetChoices(choices []int64) { + o.Choices = choices +} + +// WithID adds the id to the poll vote params +func (o *PollVoteParams) WithID(id string) *PollVoteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the poll vote params +func (o *PollVoteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PollVoteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Choices != nil { + + // binding items for choices + joinedChoices := o.bindParamChoices(reg) + + // form array param choices + if err := r.SetFormParam("choices", joinedChoices...); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamPollVote binds the parameter choices +func (o *PollVoteParams) bindParamChoices(formats strfmt.Registry) []string { + choicesIR := o.Choices + + var choicesIC []string + for _, choicesIIR := range choicesIR { // explode []int64 + + choicesIIV := swag.FormatInt64(choicesIIR) // int64 as string + choicesIC = append(choicesIC, choicesIIV) + } + + // items.CollectionFormat: "" + choicesIS := swag.JoinByFormat(choicesIC, "") + + return choicesIS +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/polls/poll_vote_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/polls/poll_vote_responses.go new file mode 100644 index 0000000..5649bf0 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/polls/poll_vote_responses.go @@ -0,0 +1,540 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package polls + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// PollVoteReader is a Reader for the PollVote structure. +type PollVoteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PollVoteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPollVoteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPollVoteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPollVoteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPollVoteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPollVoteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewPollVoteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPollVoteUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPollVoteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/polls/{id}/votes] pollVote", response, response.Code()) + } +} + +// NewPollVoteOK creates a PollVoteOK with default headers values +func NewPollVoteOK() *PollVoteOK { + return &PollVoteOK{} +} + +/* +PollVoteOK describes a response with status code 200, with default header values. + +The updated poll with user vote choices. +*/ +type PollVoteOK struct { + Payload *models.Poll +} + +// IsSuccess returns true when this poll vote o k response has a 2xx status code +func (o *PollVoteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this poll vote o k response has a 3xx status code +func (o *PollVoteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll vote o k response has a 4xx status code +func (o *PollVoteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this poll vote o k response has a 5xx status code +func (o *PollVoteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this poll vote o k response a status code equal to that given +func (o *PollVoteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the poll vote o k response +func (o *PollVoteOK) Code() int { + return 200 +} + +func (o *PollVoteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteOK %s", 200, payload) +} + +func (o *PollVoteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteOK %s", 200, payload) +} + +func (o *PollVoteOK) GetPayload() *models.Poll { + return o.Payload +} + +func (o *PollVoteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Poll) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPollVoteBadRequest creates a PollVoteBadRequest with default headers values +func NewPollVoteBadRequest() *PollVoteBadRequest { + return &PollVoteBadRequest{} +} + +/* +PollVoteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type PollVoteBadRequest struct { +} + +// IsSuccess returns true when this poll vote bad request response has a 2xx status code +func (o *PollVoteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll vote bad request response has a 3xx status code +func (o *PollVoteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll vote bad request response has a 4xx status code +func (o *PollVoteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll vote bad request response has a 5xx status code +func (o *PollVoteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this poll vote bad request response a status code equal to that given +func (o *PollVoteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the poll vote bad request response +func (o *PollVoteBadRequest) Code() int { + return 400 +} + +func (o *PollVoteBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteBadRequest", 400) +} + +func (o *PollVoteBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteBadRequest", 400) +} + +func (o *PollVoteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollVoteUnauthorized creates a PollVoteUnauthorized with default headers values +func NewPollVoteUnauthorized() *PollVoteUnauthorized { + return &PollVoteUnauthorized{} +} + +/* +PollVoteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type PollVoteUnauthorized struct { +} + +// IsSuccess returns true when this poll vote unauthorized response has a 2xx status code +func (o *PollVoteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll vote unauthorized response has a 3xx status code +func (o *PollVoteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll vote unauthorized response has a 4xx status code +func (o *PollVoteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll vote unauthorized response has a 5xx status code +func (o *PollVoteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this poll vote unauthorized response a status code equal to that given +func (o *PollVoteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the poll vote unauthorized response +func (o *PollVoteUnauthorized) Code() int { + return 401 +} + +func (o *PollVoteUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteUnauthorized", 401) +} + +func (o *PollVoteUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteUnauthorized", 401) +} + +func (o *PollVoteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollVoteForbidden creates a PollVoteForbidden with default headers values +func NewPollVoteForbidden() *PollVoteForbidden { + return &PollVoteForbidden{} +} + +/* +PollVoteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type PollVoteForbidden struct { +} + +// IsSuccess returns true when this poll vote forbidden response has a 2xx status code +func (o *PollVoteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll vote forbidden response has a 3xx status code +func (o *PollVoteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll vote forbidden response has a 4xx status code +func (o *PollVoteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll vote forbidden response has a 5xx status code +func (o *PollVoteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this poll vote forbidden response a status code equal to that given +func (o *PollVoteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the poll vote forbidden response +func (o *PollVoteForbidden) Code() int { + return 403 +} + +func (o *PollVoteForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteForbidden", 403) +} + +func (o *PollVoteForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteForbidden", 403) +} + +func (o *PollVoteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollVoteNotFound creates a PollVoteNotFound with default headers values +func NewPollVoteNotFound() *PollVoteNotFound { + return &PollVoteNotFound{} +} + +/* +PollVoteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type PollVoteNotFound struct { +} + +// IsSuccess returns true when this poll vote not found response has a 2xx status code +func (o *PollVoteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll vote not found response has a 3xx status code +func (o *PollVoteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll vote not found response has a 4xx status code +func (o *PollVoteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll vote not found response has a 5xx status code +func (o *PollVoteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this poll vote not found response a status code equal to that given +func (o *PollVoteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the poll vote not found response +func (o *PollVoteNotFound) Code() int { + return 404 +} + +func (o *PollVoteNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteNotFound", 404) +} + +func (o *PollVoteNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteNotFound", 404) +} + +func (o *PollVoteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollVoteNotAcceptable creates a PollVoteNotAcceptable with default headers values +func NewPollVoteNotAcceptable() *PollVoteNotAcceptable { + return &PollVoteNotAcceptable{} +} + +/* +PollVoteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type PollVoteNotAcceptable struct { +} + +// IsSuccess returns true when this poll vote not acceptable response has a 2xx status code +func (o *PollVoteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll vote not acceptable response has a 3xx status code +func (o *PollVoteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll vote not acceptable response has a 4xx status code +func (o *PollVoteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll vote not acceptable response has a 5xx status code +func (o *PollVoteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this poll vote not acceptable response a status code equal to that given +func (o *PollVoteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the poll vote not acceptable response +func (o *PollVoteNotAcceptable) Code() int { + return 406 +} + +func (o *PollVoteNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteNotAcceptable", 406) +} + +func (o *PollVoteNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteNotAcceptable", 406) +} + +func (o *PollVoteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollVoteUnprocessableEntity creates a PollVoteUnprocessableEntity with default headers values +func NewPollVoteUnprocessableEntity() *PollVoteUnprocessableEntity { + return &PollVoteUnprocessableEntity{} +} + +/* +PollVoteUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable entity +*/ +type PollVoteUnprocessableEntity struct { +} + +// IsSuccess returns true when this poll vote unprocessable entity response has a 2xx status code +func (o *PollVoteUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll vote unprocessable entity response has a 3xx status code +func (o *PollVoteUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll vote unprocessable entity response has a 4xx status code +func (o *PollVoteUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll vote unprocessable entity response has a 5xx status code +func (o *PollVoteUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this poll vote unprocessable entity response a status code equal to that given +func (o *PollVoteUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the poll vote unprocessable entity response +func (o *PollVoteUnprocessableEntity) Code() int { + return 422 +} + +func (o *PollVoteUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteUnprocessableEntity", 422) +} + +func (o *PollVoteUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteUnprocessableEntity", 422) +} + +func (o *PollVoteUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollVoteInternalServerError creates a PollVoteInternalServerError with default headers values +func NewPollVoteInternalServerError() *PollVoteInternalServerError { + return &PollVoteInternalServerError{} +} + +/* +PollVoteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type PollVoteInternalServerError struct { +} + +// IsSuccess returns true when this poll vote internal server error response has a 2xx status code +func (o *PollVoteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll vote internal server error response has a 3xx status code +func (o *PollVoteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll vote internal server error response has a 4xx status code +func (o *PollVoteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this poll vote internal server error response has a 5xx status code +func (o *PollVoteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this poll vote internal server error response a status code equal to that given +func (o *PollVoteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the poll vote internal server error response +func (o *PollVoteInternalServerError) Code() int { + return 500 +} + +func (o *PollVoteInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteInternalServerError", 500) +} + +func (o *PollVoteInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteInternalServerError", 500) +} + +func (o *PollVoteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/polls/polls_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/polls/polls_client.go new file mode 100644 index 0000000..c94bd09 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/polls/polls_client.go @@ -0,0 +1,147 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package polls + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new polls API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new polls API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new polls API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for polls API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + Poll(params *PollParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PollOK, error) + + PollVote(params *PollVoteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PollVoteOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +Poll views poll with given ID +*/ +func (a *Client) Poll(params *PollParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PollOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPollParams() + } + op := &runtime.ClientOperation{ + ID: "poll", + Method: "GET", + PathPattern: "/api/v1/polls/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PollReader{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.(*PollOK) + 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 poll: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PollVote votes with choices in the given poll +*/ +func (a *Client) PollVote(params *PollVoteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PollVoteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPollVoteParams() + } + op := &runtime.ClientOperation{ + ID: "pollVote", + Method: "POST", + PathPattern: "/api/v1/polls/{id}/votes", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PollVoteReader{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.(*PollVoteOK) + 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 pollVote: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/preferences/preferences_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/preferences/preferences_client.go new file mode 100644 index 0000000..6697a13 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/preferences/preferences_client.go @@ -0,0 +1,121 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package preferences + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new preferences API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new preferences API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new preferences API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for preferences API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PreferencesGet(params *PreferencesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PreferencesGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PreferencesGet returns an object of user preferences + + Example: + +``` + +{ +"posting:default:visibility": "public", +"posting:default:sensitive": false, +"posting:default:language": "en", +"reading:expand:media": "default", +"reading:expand:spoilers": false, +"reading:autoplay:gifs": false +} + +```` +*/ +func (a *Client) PreferencesGet(params *PreferencesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PreferencesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPreferencesGetParams() + } + op := &runtime.ClientOperation{ + ID: "preferencesGet", + Method: "GET", + PathPattern: "/api/v1/preferences", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PreferencesGetReader{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.(*PreferencesGetOK) + 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 preferencesGet: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/preferences/preferences_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/preferences/preferences_get_parameters.go new file mode 100644 index 0000000..eb0d67e --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/preferences/preferences_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package preferences + +// 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" +) + +// NewPreferencesGetParams creates a new PreferencesGetParams 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 NewPreferencesGetParams() *PreferencesGetParams { + return &PreferencesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPreferencesGetParamsWithTimeout creates a new PreferencesGetParams object +// with the ability to set a timeout on a request. +func NewPreferencesGetParamsWithTimeout(timeout time.Duration) *PreferencesGetParams { + return &PreferencesGetParams{ + timeout: timeout, + } +} + +// NewPreferencesGetParamsWithContext creates a new PreferencesGetParams object +// with the ability to set a context for a request. +func NewPreferencesGetParamsWithContext(ctx context.Context) *PreferencesGetParams { + return &PreferencesGetParams{ + Context: ctx, + } +} + +// NewPreferencesGetParamsWithHTTPClient creates a new PreferencesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPreferencesGetParamsWithHTTPClient(client *http.Client) *PreferencesGetParams { + return &PreferencesGetParams{ + HTTPClient: client, + } +} + +/* +PreferencesGetParams contains all the parameters to send to the API endpoint + + for the preferences get operation. + + Typically these are written to a http.Request. +*/ +type PreferencesGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the preferences get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PreferencesGetParams) WithDefaults() *PreferencesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the preferences get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PreferencesGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the preferences get params +func (o *PreferencesGetParams) WithTimeout(timeout time.Duration) *PreferencesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the preferences get params +func (o *PreferencesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the preferences get params +func (o *PreferencesGetParams) WithContext(ctx context.Context) *PreferencesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the preferences get params +func (o *PreferencesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the preferences get params +func (o *PreferencesGetParams) WithHTTPClient(client *http.Client) *PreferencesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the preferences get params +func (o *PreferencesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *PreferencesGetParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/preferences/preferences_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/preferences/preferences_get_responses.go new file mode 100644 index 0000000..2fcca8d --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/preferences/preferences_get_responses.go @@ -0,0 +1,412 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package preferences + +// 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" +) + +// PreferencesGetReader is a Reader for the PreferencesGet structure. +type PreferencesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PreferencesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPreferencesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPreferencesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPreferencesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPreferencesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewPreferencesGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPreferencesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/preferences] preferencesGet", response, response.Code()) + } +} + +// NewPreferencesGetOK creates a PreferencesGetOK with default headers values +func NewPreferencesGetOK() *PreferencesGetOK { + return &PreferencesGetOK{} +} + +/* +PreferencesGetOK describes a response with status code 200, with default header values. + +PreferencesGetOK preferences get o k +*/ +type PreferencesGetOK struct { + Payload interface{} +} + +// IsSuccess returns true when this preferences get o k response has a 2xx status code +func (o *PreferencesGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this preferences get o k response has a 3xx status code +func (o *PreferencesGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this preferences get o k response has a 4xx status code +func (o *PreferencesGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this preferences get o k response has a 5xx status code +func (o *PreferencesGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this preferences get o k response a status code equal to that given +func (o *PreferencesGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the preferences get o k response +func (o *PreferencesGetOK) Code() int { + return 200 +} + +func (o *PreferencesGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetOK %s", 200, payload) +} + +func (o *PreferencesGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetOK %s", 200, payload) +} + +func (o *PreferencesGetOK) GetPayload() interface{} { + return o.Payload +} + +func (o *PreferencesGetOK) 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 +} + +// NewPreferencesGetBadRequest creates a PreferencesGetBadRequest with default headers values +func NewPreferencesGetBadRequest() *PreferencesGetBadRequest { + return &PreferencesGetBadRequest{} +} + +/* +PreferencesGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type PreferencesGetBadRequest struct { +} + +// IsSuccess returns true when this preferences get bad request response has a 2xx status code +func (o *PreferencesGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this preferences get bad request response has a 3xx status code +func (o *PreferencesGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this preferences get bad request response has a 4xx status code +func (o *PreferencesGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this preferences get bad request response has a 5xx status code +func (o *PreferencesGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this preferences get bad request response a status code equal to that given +func (o *PreferencesGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the preferences get bad request response +func (o *PreferencesGetBadRequest) Code() int { + return 400 +} + +func (o *PreferencesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetBadRequest", 400) +} + +func (o *PreferencesGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetBadRequest", 400) +} + +func (o *PreferencesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPreferencesGetUnauthorized creates a PreferencesGetUnauthorized with default headers values +func NewPreferencesGetUnauthorized() *PreferencesGetUnauthorized { + return &PreferencesGetUnauthorized{} +} + +/* +PreferencesGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type PreferencesGetUnauthorized struct { +} + +// IsSuccess returns true when this preferences get unauthorized response has a 2xx status code +func (o *PreferencesGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this preferences get unauthorized response has a 3xx status code +func (o *PreferencesGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this preferences get unauthorized response has a 4xx status code +func (o *PreferencesGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this preferences get unauthorized response has a 5xx status code +func (o *PreferencesGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this preferences get unauthorized response a status code equal to that given +func (o *PreferencesGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the preferences get unauthorized response +func (o *PreferencesGetUnauthorized) Code() int { + return 401 +} + +func (o *PreferencesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetUnauthorized", 401) +} + +func (o *PreferencesGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetUnauthorized", 401) +} + +func (o *PreferencesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPreferencesGetNotFound creates a PreferencesGetNotFound with default headers values +func NewPreferencesGetNotFound() *PreferencesGetNotFound { + return &PreferencesGetNotFound{} +} + +/* +PreferencesGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type PreferencesGetNotFound struct { +} + +// IsSuccess returns true when this preferences get not found response has a 2xx status code +func (o *PreferencesGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this preferences get not found response has a 3xx status code +func (o *PreferencesGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this preferences get not found response has a 4xx status code +func (o *PreferencesGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this preferences get not found response has a 5xx status code +func (o *PreferencesGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this preferences get not found response a status code equal to that given +func (o *PreferencesGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the preferences get not found response +func (o *PreferencesGetNotFound) Code() int { + return 404 +} + +func (o *PreferencesGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetNotFound", 404) +} + +func (o *PreferencesGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetNotFound", 404) +} + +func (o *PreferencesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPreferencesGetNotAcceptable creates a PreferencesGetNotAcceptable with default headers values +func NewPreferencesGetNotAcceptable() *PreferencesGetNotAcceptable { + return &PreferencesGetNotAcceptable{} +} + +/* +PreferencesGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type PreferencesGetNotAcceptable struct { +} + +// IsSuccess returns true when this preferences get not acceptable response has a 2xx status code +func (o *PreferencesGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this preferences get not acceptable response has a 3xx status code +func (o *PreferencesGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this preferences get not acceptable response has a 4xx status code +func (o *PreferencesGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this preferences get not acceptable response has a 5xx status code +func (o *PreferencesGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this preferences get not acceptable response a status code equal to that given +func (o *PreferencesGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the preferences get not acceptable response +func (o *PreferencesGetNotAcceptable) Code() int { + return 406 +} + +func (o *PreferencesGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetNotAcceptable", 406) +} + +func (o *PreferencesGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetNotAcceptable", 406) +} + +func (o *PreferencesGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPreferencesGetInternalServerError creates a PreferencesGetInternalServerError with default headers values +func NewPreferencesGetInternalServerError() *PreferencesGetInternalServerError { + return &PreferencesGetInternalServerError{} +} + +/* +PreferencesGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type PreferencesGetInternalServerError struct { +} + +// IsSuccess returns true when this preferences get internal server error response has a 2xx status code +func (o *PreferencesGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this preferences get internal server error response has a 3xx status code +func (o *PreferencesGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this preferences get internal server error response has a 4xx status code +func (o *PreferencesGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this preferences get internal server error response has a 5xx status code +func (o *PreferencesGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this preferences get internal server error response a status code equal to that given +func (o *PreferencesGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the preferences get internal server error response +func (o *PreferencesGetInternalServerError) Code() int { + return 500 +} + +func (o *PreferencesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetInternalServerError", 500) +} + +func (o *PreferencesGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetInternalServerError", 500) +} + +func (o *PreferencesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/report_create_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/report_create_parameters.go new file mode 100644 index 0000000..2df991d --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/report_create_parameters.go @@ -0,0 +1,365 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package reports + +// 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" +) + +// NewReportCreateParams creates a new ReportCreateParams 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 NewReportCreateParams() *ReportCreateParams { + return &ReportCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewReportCreateParamsWithTimeout creates a new ReportCreateParams object +// with the ability to set a timeout on a request. +func NewReportCreateParamsWithTimeout(timeout time.Duration) *ReportCreateParams { + return &ReportCreateParams{ + timeout: timeout, + } +} + +// NewReportCreateParamsWithContext creates a new ReportCreateParams object +// with the ability to set a context for a request. +func NewReportCreateParamsWithContext(ctx context.Context) *ReportCreateParams { + return &ReportCreateParams{ + Context: ctx, + } +} + +// NewReportCreateParamsWithHTTPClient creates a new ReportCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewReportCreateParamsWithHTTPClient(client *http.Client) *ReportCreateParams { + return &ReportCreateParams{ + HTTPClient: client, + } +} + +/* +ReportCreateParams contains all the parameters to send to the API endpoint + + for the report create operation. + + Typically these are written to a http.Request. +*/ +type ReportCreateParams struct { + + /* AccountID. + + ID of the account to report. + Sample: 01GPE75FXSH2EGFBF85NXPH3KP + */ + AccountID string + + /* Category. + + Specify if the report is due to spam, violation of enumerated instance rules, or some other reason. + Currently only 'other' is supported. + Sample: other + + Default: "other" + */ + Category *string + + /* Comment. + + The reason for the report. Default maximum of 1000 characters. + Sample: Anti-Blackness, transphobia. + */ + Comment *string + + /* Forward. + + If the account is remote, should the report be forwarded to the remote admin? + Sample: true + */ + Forward *bool + + /* RuleIds. + + IDs of rules on this instance which have been broken according to the reporter. + Sample: ["01GPBN5YDY6JKBWE44H7YQBDCQ","01GPBN65PDWSBPWVDD0SQCFFY3"] + */ + RuleIDs []string + + /* StatusIds. + + IDs of statuses to attach to the report to provide additional context. + Sample: ["01GPE76N4SBVRZ8K24TW51ZZQ4","01GPE76WN9JZE62EPT3Q9FRRD4"] + */ + StatusIDs []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the report create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ReportCreateParams) WithDefaults() *ReportCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the report create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ReportCreateParams) SetDefaults() { + var ( + categoryDefault = string("other") + + forwardDefault = bool(false) + ) + + val := ReportCreateParams{ + Category: &categoryDefault, + Forward: &forwardDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the report create params +func (o *ReportCreateParams) WithTimeout(timeout time.Duration) *ReportCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the report create params +func (o *ReportCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the report create params +func (o *ReportCreateParams) WithContext(ctx context.Context) *ReportCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the report create params +func (o *ReportCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the report create params +func (o *ReportCreateParams) WithHTTPClient(client *http.Client) *ReportCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the report create params +func (o *ReportCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAccountID adds the accountID to the report create params +func (o *ReportCreateParams) WithAccountID(accountID string) *ReportCreateParams { + o.SetAccountID(accountID) + return o +} + +// SetAccountID adds the accountId to the report create params +func (o *ReportCreateParams) SetAccountID(accountID string) { + o.AccountID = accountID +} + +// WithCategory adds the category to the report create params +func (o *ReportCreateParams) WithCategory(category *string) *ReportCreateParams { + o.SetCategory(category) + return o +} + +// SetCategory adds the category to the report create params +func (o *ReportCreateParams) SetCategory(category *string) { + o.Category = category +} + +// WithComment adds the comment to the report create params +func (o *ReportCreateParams) WithComment(comment *string) *ReportCreateParams { + o.SetComment(comment) + return o +} + +// SetComment adds the comment to the report create params +func (o *ReportCreateParams) SetComment(comment *string) { + o.Comment = comment +} + +// WithForward adds the forward to the report create params +func (o *ReportCreateParams) WithForward(forward *bool) *ReportCreateParams { + o.SetForward(forward) + return o +} + +// SetForward adds the forward to the report create params +func (o *ReportCreateParams) SetForward(forward *bool) { + o.Forward = forward +} + +// WithRuleIDs adds the ruleIds to the report create params +func (o *ReportCreateParams) WithRuleIDs(ruleIds []string) *ReportCreateParams { + o.SetRuleIDs(ruleIds) + return o +} + +// SetRuleIDs adds the ruleIds to the report create params +func (o *ReportCreateParams) SetRuleIDs(ruleIds []string) { + o.RuleIDs = ruleIds +} + +// WithStatusIDs adds the statusIds to the report create params +func (o *ReportCreateParams) WithStatusIDs(statusIds []string) *ReportCreateParams { + o.SetStatusIDs(statusIds) + return o +} + +// SetStatusIDs adds the statusIds to the report create params +func (o *ReportCreateParams) SetStatusIDs(statusIds []string) { + o.StatusIDs = statusIds +} + +// WriteToRequest writes these params to a swagger request +func (o *ReportCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param account_id + frAccountID := o.AccountID + fAccountID := frAccountID + if fAccountID != "" { + if err := r.SetFormParam("account_id", fAccountID); err != nil { + return err + } + } + + if o.Category != nil { + + // form param category + var frCategory string + if o.Category != nil { + frCategory = *o.Category + } + fCategory := frCategory + if fCategory != "" { + if err := r.SetFormParam("category", fCategory); err != nil { + return err + } + } + } + + if o.Comment != nil { + + // form param comment + var frComment string + if o.Comment != nil { + frComment = *o.Comment + } + fComment := frComment + if fComment != "" { + if err := r.SetFormParam("comment", fComment); err != nil { + return err + } + } + } + + if o.Forward != nil { + + // form param forward + var frForward bool + if o.Forward != nil { + frForward = *o.Forward + } + fForward := swag.FormatBool(frForward) + if fForward != "" { + if err := r.SetFormParam("forward", fForward); err != nil { + return err + } + } + } + + if o.RuleIDs != nil { + + // binding items for rule_ids + joinedRuleIds := o.bindParamRuleIds(reg) + + // form array param rule_ids + if err := r.SetFormParam("rule_ids", joinedRuleIds...); err != nil { + return err + } + } + + if o.StatusIDs != nil { + + // binding items for status_ids + joinedStatusIds := o.bindParamStatusIds(reg) + + // form array param status_ids + if err := r.SetFormParam("status_ids", joinedStatusIds...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamReportCreate binds the parameter rule_ids +func (o *ReportCreateParams) bindParamRuleIds(formats strfmt.Registry) []string { + ruleIdsIR := o.RuleIDs + + var ruleIdsIC []string + for _, ruleIdsIIR := range ruleIdsIR { // explode []string + + ruleIdsIIV := ruleIdsIIR // string as string + ruleIdsIC = append(ruleIdsIC, ruleIdsIIV) + } + + // items.CollectionFormat: "" + ruleIdsIS := swag.JoinByFormat(ruleIdsIC, "") + + return ruleIdsIS +} + +// bindParamReportCreate binds the parameter status_ids +func (o *ReportCreateParams) bindParamStatusIds(formats strfmt.Registry) []string { + statusIdsIR := o.StatusIDs + + var statusIdsIC []string + for _, statusIdsIIR := range statusIdsIR { // explode []string + + statusIdsIIV := statusIdsIIR // string as string + statusIdsIC = append(statusIdsIC, statusIdsIIV) + } + + // items.CollectionFormat: "" + statusIdsIS := swag.JoinByFormat(statusIdsIC, "") + + return statusIdsIS +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/report_create_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/report_create_responses.go new file mode 100644 index 0000000..2fc087a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/report_create_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package reports + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ReportCreateReader is a Reader for the ReportCreate structure. +type ReportCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ReportCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewReportCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewReportCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewReportCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewReportCreateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewReportCreateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewReportCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/reports] reportCreate", response, response.Code()) + } +} + +// NewReportCreateOK creates a ReportCreateOK with default headers values +func NewReportCreateOK() *ReportCreateOK { + return &ReportCreateOK{} +} + +/* +ReportCreateOK describes a response with status code 200, with default header values. + +The created report. +*/ +type ReportCreateOK struct { + Payload *models.Report +} + +// IsSuccess returns true when this report create o k response has a 2xx status code +func (o *ReportCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this report create o k response has a 3xx status code +func (o *ReportCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report create o k response has a 4xx status code +func (o *ReportCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this report create o k response has a 5xx status code +func (o *ReportCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this report create o k response a status code equal to that given +func (o *ReportCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the report create o k response +func (o *ReportCreateOK) Code() int { + return 200 +} + +func (o *ReportCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateOK %s", 200, payload) +} + +func (o *ReportCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateOK %s", 200, payload) +} + +func (o *ReportCreateOK) GetPayload() *models.Report { + return o.Payload +} + +func (o *ReportCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Report) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewReportCreateBadRequest creates a ReportCreateBadRequest with default headers values +func NewReportCreateBadRequest() *ReportCreateBadRequest { + return &ReportCreateBadRequest{} +} + +/* +ReportCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ReportCreateBadRequest struct { +} + +// IsSuccess returns true when this report create bad request response has a 2xx status code +func (o *ReportCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this report create bad request response has a 3xx status code +func (o *ReportCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report create bad request response has a 4xx status code +func (o *ReportCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this report create bad request response has a 5xx status code +func (o *ReportCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this report create bad request response a status code equal to that given +func (o *ReportCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the report create bad request response +func (o *ReportCreateBadRequest) Code() int { + return 400 +} + +func (o *ReportCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateBadRequest", 400) +} + +func (o *ReportCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateBadRequest", 400) +} + +func (o *ReportCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportCreateUnauthorized creates a ReportCreateUnauthorized with default headers values +func NewReportCreateUnauthorized() *ReportCreateUnauthorized { + return &ReportCreateUnauthorized{} +} + +/* +ReportCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ReportCreateUnauthorized struct { +} + +// IsSuccess returns true when this report create unauthorized response has a 2xx status code +func (o *ReportCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this report create unauthorized response has a 3xx status code +func (o *ReportCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report create unauthorized response has a 4xx status code +func (o *ReportCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this report create unauthorized response has a 5xx status code +func (o *ReportCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this report create unauthorized response a status code equal to that given +func (o *ReportCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the report create unauthorized response +func (o *ReportCreateUnauthorized) Code() int { + return 401 +} + +func (o *ReportCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateUnauthorized", 401) +} + +func (o *ReportCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateUnauthorized", 401) +} + +func (o *ReportCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportCreateNotFound creates a ReportCreateNotFound with default headers values +func NewReportCreateNotFound() *ReportCreateNotFound { + return &ReportCreateNotFound{} +} + +/* +ReportCreateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ReportCreateNotFound struct { +} + +// IsSuccess returns true when this report create not found response has a 2xx status code +func (o *ReportCreateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this report create not found response has a 3xx status code +func (o *ReportCreateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report create not found response has a 4xx status code +func (o *ReportCreateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this report create not found response has a 5xx status code +func (o *ReportCreateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this report create not found response a status code equal to that given +func (o *ReportCreateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the report create not found response +func (o *ReportCreateNotFound) Code() int { + return 404 +} + +func (o *ReportCreateNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateNotFound", 404) +} + +func (o *ReportCreateNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateNotFound", 404) +} + +func (o *ReportCreateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportCreateNotAcceptable creates a ReportCreateNotAcceptable with default headers values +func NewReportCreateNotAcceptable() *ReportCreateNotAcceptable { + return &ReportCreateNotAcceptable{} +} + +/* +ReportCreateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ReportCreateNotAcceptable struct { +} + +// IsSuccess returns true when this report create not acceptable response has a 2xx status code +func (o *ReportCreateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this report create not acceptable response has a 3xx status code +func (o *ReportCreateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report create not acceptable response has a 4xx status code +func (o *ReportCreateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this report create not acceptable response has a 5xx status code +func (o *ReportCreateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this report create not acceptable response a status code equal to that given +func (o *ReportCreateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the report create not acceptable response +func (o *ReportCreateNotAcceptable) Code() int { + return 406 +} + +func (o *ReportCreateNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateNotAcceptable", 406) +} + +func (o *ReportCreateNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateNotAcceptable", 406) +} + +func (o *ReportCreateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportCreateInternalServerError creates a ReportCreateInternalServerError with default headers values +func NewReportCreateInternalServerError() *ReportCreateInternalServerError { + return &ReportCreateInternalServerError{} +} + +/* +ReportCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ReportCreateInternalServerError struct { +} + +// IsSuccess returns true when this report create internal server error response has a 2xx status code +func (o *ReportCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this report create internal server error response has a 3xx status code +func (o *ReportCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report create internal server error response has a 4xx status code +func (o *ReportCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this report create internal server error response has a 5xx status code +func (o *ReportCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this report create internal server error response a status code equal to that given +func (o *ReportCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the report create internal server error response +func (o *ReportCreateInternalServerError) Code() int { + return 500 +} + +func (o *ReportCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateInternalServerError", 500) +} + +func (o *ReportCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateInternalServerError", 500) +} + +func (o *ReportCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/report_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/report_get_parameters.go new file mode 100644 index 0000000..7d50fd2 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/report_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package reports + +// 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" +) + +// NewReportGetParams creates a new ReportGetParams 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 NewReportGetParams() *ReportGetParams { + return &ReportGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewReportGetParamsWithTimeout creates a new ReportGetParams object +// with the ability to set a timeout on a request. +func NewReportGetParamsWithTimeout(timeout time.Duration) *ReportGetParams { + return &ReportGetParams{ + timeout: timeout, + } +} + +// NewReportGetParamsWithContext creates a new ReportGetParams object +// with the ability to set a context for a request. +func NewReportGetParamsWithContext(ctx context.Context) *ReportGetParams { + return &ReportGetParams{ + Context: ctx, + } +} + +// NewReportGetParamsWithHTTPClient creates a new ReportGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewReportGetParamsWithHTTPClient(client *http.Client) *ReportGetParams { + return &ReportGetParams{ + HTTPClient: client, + } +} + +/* +ReportGetParams contains all the parameters to send to the API endpoint + + for the report get operation. + + Typically these are written to a http.Request. +*/ +type ReportGetParams struct { + + /* ID. + + ID of the report + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the report get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ReportGetParams) WithDefaults() *ReportGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the report get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ReportGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the report get params +func (o *ReportGetParams) WithTimeout(timeout time.Duration) *ReportGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the report get params +func (o *ReportGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the report get params +func (o *ReportGetParams) WithContext(ctx context.Context) *ReportGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the report get params +func (o *ReportGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the report get params +func (o *ReportGetParams) WithHTTPClient(client *http.Client) *ReportGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the report get params +func (o *ReportGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the report get params +func (o *ReportGetParams) WithID(id string) *ReportGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the report get params +func (o *ReportGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *ReportGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/report_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/report_get_responses.go new file mode 100644 index 0000000..8fb1a8d --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/report_get_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package reports + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ReportGetReader is a Reader for the ReportGet structure. +type ReportGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ReportGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewReportGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewReportGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewReportGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewReportGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewReportGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewReportGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/reports/{id}] reportGet", response, response.Code()) + } +} + +// NewReportGetOK creates a ReportGetOK with default headers values +func NewReportGetOK() *ReportGetOK { + return &ReportGetOK{} +} + +/* +ReportGetOK describes a response with status code 200, with default header values. + +The requested report. +*/ +type ReportGetOK struct { + Payload *models.Report +} + +// IsSuccess returns true when this report get o k response has a 2xx status code +func (o *ReportGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this report get o k response has a 3xx status code +func (o *ReportGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report get o k response has a 4xx status code +func (o *ReportGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this report get o k response has a 5xx status code +func (o *ReportGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this report get o k response a status code equal to that given +func (o *ReportGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the report get o k response +func (o *ReportGetOK) Code() int { + return 200 +} + +func (o *ReportGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetOK %s", 200, payload) +} + +func (o *ReportGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetOK %s", 200, payload) +} + +func (o *ReportGetOK) GetPayload() *models.Report { + return o.Payload +} + +func (o *ReportGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Report) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewReportGetBadRequest creates a ReportGetBadRequest with default headers values +func NewReportGetBadRequest() *ReportGetBadRequest { + return &ReportGetBadRequest{} +} + +/* +ReportGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ReportGetBadRequest struct { +} + +// IsSuccess returns true when this report get bad request response has a 2xx status code +func (o *ReportGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this report get bad request response has a 3xx status code +func (o *ReportGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report get bad request response has a 4xx status code +func (o *ReportGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this report get bad request response has a 5xx status code +func (o *ReportGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this report get bad request response a status code equal to that given +func (o *ReportGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the report get bad request response +func (o *ReportGetBadRequest) Code() int { + return 400 +} + +func (o *ReportGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetBadRequest", 400) +} + +func (o *ReportGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetBadRequest", 400) +} + +func (o *ReportGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportGetUnauthorized creates a ReportGetUnauthorized with default headers values +func NewReportGetUnauthorized() *ReportGetUnauthorized { + return &ReportGetUnauthorized{} +} + +/* +ReportGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ReportGetUnauthorized struct { +} + +// IsSuccess returns true when this report get unauthorized response has a 2xx status code +func (o *ReportGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this report get unauthorized response has a 3xx status code +func (o *ReportGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report get unauthorized response has a 4xx status code +func (o *ReportGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this report get unauthorized response has a 5xx status code +func (o *ReportGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this report get unauthorized response a status code equal to that given +func (o *ReportGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the report get unauthorized response +func (o *ReportGetUnauthorized) Code() int { + return 401 +} + +func (o *ReportGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetUnauthorized", 401) +} + +func (o *ReportGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetUnauthorized", 401) +} + +func (o *ReportGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportGetNotFound creates a ReportGetNotFound with default headers values +func NewReportGetNotFound() *ReportGetNotFound { + return &ReportGetNotFound{} +} + +/* +ReportGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ReportGetNotFound struct { +} + +// IsSuccess returns true when this report get not found response has a 2xx status code +func (o *ReportGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this report get not found response has a 3xx status code +func (o *ReportGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report get not found response has a 4xx status code +func (o *ReportGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this report get not found response has a 5xx status code +func (o *ReportGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this report get not found response a status code equal to that given +func (o *ReportGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the report get not found response +func (o *ReportGetNotFound) Code() int { + return 404 +} + +func (o *ReportGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetNotFound", 404) +} + +func (o *ReportGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetNotFound", 404) +} + +func (o *ReportGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportGetNotAcceptable creates a ReportGetNotAcceptable with default headers values +func NewReportGetNotAcceptable() *ReportGetNotAcceptable { + return &ReportGetNotAcceptable{} +} + +/* +ReportGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ReportGetNotAcceptable struct { +} + +// IsSuccess returns true when this report get not acceptable response has a 2xx status code +func (o *ReportGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this report get not acceptable response has a 3xx status code +func (o *ReportGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report get not acceptable response has a 4xx status code +func (o *ReportGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this report get not acceptable response has a 5xx status code +func (o *ReportGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this report get not acceptable response a status code equal to that given +func (o *ReportGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the report get not acceptable response +func (o *ReportGetNotAcceptable) Code() int { + return 406 +} + +func (o *ReportGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetNotAcceptable", 406) +} + +func (o *ReportGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetNotAcceptable", 406) +} + +func (o *ReportGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportGetInternalServerError creates a ReportGetInternalServerError with default headers values +func NewReportGetInternalServerError() *ReportGetInternalServerError { + return &ReportGetInternalServerError{} +} + +/* +ReportGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ReportGetInternalServerError struct { +} + +// IsSuccess returns true when this report get internal server error response has a 2xx status code +func (o *ReportGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this report get internal server error response has a 3xx status code +func (o *ReportGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report get internal server error response has a 4xx status code +func (o *ReportGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this report get internal server error response has a 5xx status code +func (o *ReportGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this report get internal server error response a status code equal to that given +func (o *ReportGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the report get internal server error response +func (o *ReportGetInternalServerError) Code() int { + return 500 +} + +func (o *ReportGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetInternalServerError", 500) +} + +func (o *ReportGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetInternalServerError", 500) +} + +func (o *ReportGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/reports_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/reports_client.go new file mode 100644 index 0000000..e5f29fc --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/reports_client.go @@ -0,0 +1,227 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package reports + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new reports API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new reports API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new reports API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for reports API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded". +func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} +} + +// WithContentTypeApplicationXML sets the Content-Type header to "application/xml". +func WithContentTypeApplicationXML(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/xml"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + ReportCreate(params *ReportCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ReportCreateOK, error) + + ReportGet(params *ReportGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ReportGetOK, error) + + Reports(params *ReportsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ReportsOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +ReportCreate creates a new user report with the given parameters +*/ +func (a *Client) ReportCreate(params *ReportCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ReportCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewReportCreateParams() + } + op := &runtime.ClientOperation{ + ID: "reportCreate", + Method: "POST", + PathPattern: "/api/v1/reports", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ReportCreateReader{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.(*ReportCreateOK) + 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 reportCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +ReportGet gets one report with the given id +*/ +func (a *Client) ReportGet(params *ReportGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ReportGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewReportGetParams() + } + op := &runtime.ClientOperation{ + ID: "reportGet", + Method: "GET", + PathPattern: "/api/v1/reports/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ReportGetReader{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.(*ReportGetOK) + 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 reportGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + Reports sees reports created by the requesting account + + The reports will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer). + +The next and previous queries can be parsed from the returned Link header. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) Reports(params *ReportsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ReportsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewReportsParams() + } + op := &runtime.ClientOperation{ + ID: "reports", + Method: "GET", + PathPattern: "/api/v1/reports", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ReportsReader{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.(*ReportsOK) + 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 reports: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/reports_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/reports_parameters.go new file mode 100644 index 0000000..0e2c98b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/reports_parameters.go @@ -0,0 +1,347 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package reports + +// 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" +) + +// NewReportsParams creates a new ReportsParams 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 NewReportsParams() *ReportsParams { + return &ReportsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewReportsParamsWithTimeout creates a new ReportsParams object +// with the ability to set a timeout on a request. +func NewReportsParamsWithTimeout(timeout time.Duration) *ReportsParams { + return &ReportsParams{ + timeout: timeout, + } +} + +// NewReportsParamsWithContext creates a new ReportsParams object +// with the ability to set a context for a request. +func NewReportsParamsWithContext(ctx context.Context) *ReportsParams { + return &ReportsParams{ + Context: ctx, + } +} + +// NewReportsParamsWithHTTPClient creates a new ReportsParams object +// with the ability to set a custom HTTPClient for a request. +func NewReportsParamsWithHTTPClient(client *http.Client) *ReportsParams { + return &ReportsParams{ + HTTPClient: client, + } +} + +/* +ReportsParams contains all the parameters to send to the API endpoint + + for the reports operation. + + Typically these are written to a http.Request. +*/ +type ReportsParams struct { + + /* Limit. + + Number of reports to return. + + Default: 20 + */ + Limit *int64 + + /* MaxID. + + Return only reports *OLDER* than the given max ID (for paging downwards). The report with the specified ID will not be included in the response. + */ + MaxID *string + + /* MinID. + + Return only reports immediately *NEWER* than the given min ID (for paging upwards). The report with the specified ID will not be included in the response. + */ + MinID *string + + /* Resolved. + + If set to true, only resolved reports will be returned. If false, only unresolved reports will be returned. If unset, reports will not be filtered on their resolved status. + */ + Resolved *bool + + /* SinceID. + + Return only reports *NEWER* than the given since ID. The report with the specified ID will not be included in the response. + */ + SinceID *string + + /* TargetAccountID. + + Return only reports that target the given account id. + */ + TargetAccountID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the reports params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ReportsParams) WithDefaults() *ReportsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the reports params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ReportsParams) SetDefaults() { + var ( + limitDefault = int64(20) + ) + + val := ReportsParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the reports params +func (o *ReportsParams) WithTimeout(timeout time.Duration) *ReportsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the reports params +func (o *ReportsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the reports params +func (o *ReportsParams) WithContext(ctx context.Context) *ReportsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the reports params +func (o *ReportsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the reports params +func (o *ReportsParams) WithHTTPClient(client *http.Client) *ReportsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the reports params +func (o *ReportsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the reports params +func (o *ReportsParams) WithLimit(limit *int64) *ReportsParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the reports params +func (o *ReportsParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the reports params +func (o *ReportsParams) WithMaxID(maxID *string) *ReportsParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the reports params +func (o *ReportsParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the reports params +func (o *ReportsParams) WithMinID(minID *string) *ReportsParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the reports params +func (o *ReportsParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithResolved adds the resolved to the reports params +func (o *ReportsParams) WithResolved(resolved *bool) *ReportsParams { + o.SetResolved(resolved) + return o +} + +// SetResolved adds the resolved to the reports params +func (o *ReportsParams) SetResolved(resolved *bool) { + o.Resolved = resolved +} + +// WithSinceID adds the sinceID to the reports params +func (o *ReportsParams) WithSinceID(sinceID *string) *ReportsParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the reports params +func (o *ReportsParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WithTargetAccountID adds the targetAccountID to the reports params +func (o *ReportsParams) WithTargetAccountID(targetAccountID *string) *ReportsParams { + o.SetTargetAccountID(targetAccountID) + return o +} + +// SetTargetAccountID adds the targetAccountId to the reports params +func (o *ReportsParams) SetTargetAccountID(targetAccountID *string) { + o.TargetAccountID = targetAccountID +} + +// WriteToRequest writes these params to a swagger request +func (o *ReportsParams) 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.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if o.Resolved != nil { + + // query param resolved + var qrResolved bool + + if o.Resolved != nil { + qrResolved = *o.Resolved + } + qResolved := swag.FormatBool(qrResolved) + if qResolved != "" { + + if err := r.SetQueryParam("resolved", qResolved); err != nil { + return err + } + } + } + + if o.SinceID != nil { + + // query param since_id + var qrSinceID string + + if o.SinceID != nil { + qrSinceID = *o.SinceID + } + qSinceID := qrSinceID + if qSinceID != "" { + + if err := r.SetQueryParam("since_id", qSinceID); err != nil { + return err + } + } + } + + if o.TargetAccountID != nil { + + // query param target_account_id + var qrTargetAccountID string + + if o.TargetAccountID != nil { + qrTargetAccountID = *o.TargetAccountID + } + qTargetAccountID := qrTargetAccountID + if qTargetAccountID != "" { + + if err := r.SetQueryParam("target_account_id", qTargetAccountID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/reports_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/reports_responses.go new file mode 100644 index 0000000..e050711 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/reports/reports_responses.go @@ -0,0 +1,426 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package reports + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ReportsReader is a Reader for the Reports structure. +type ReportsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ReportsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewReportsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewReportsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewReportsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewReportsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewReportsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewReportsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/reports] reports", response, response.Code()) + } +} + +// NewReportsOK creates a ReportsOK with default headers values +func NewReportsOK() *ReportsOK { + return &ReportsOK{} +} + +/* +ReportsOK describes a response with status code 200, with default header values. + +Array of reports. +*/ +type ReportsOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Report +} + +// IsSuccess returns true when this reports o k response has a 2xx status code +func (o *ReportsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this reports o k response has a 3xx status code +func (o *ReportsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reports o k response has a 4xx status code +func (o *ReportsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this reports o k response has a 5xx status code +func (o *ReportsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this reports o k response a status code equal to that given +func (o *ReportsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the reports o k response +func (o *ReportsOK) Code() int { + return 200 +} + +func (o *ReportsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsOK %s", 200, payload) +} + +func (o *ReportsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsOK %s", 200, payload) +} + +func (o *ReportsOK) GetPayload() []*models.Report { + return o.Payload +} + +func (o *ReportsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewReportsBadRequest creates a ReportsBadRequest with default headers values +func NewReportsBadRequest() *ReportsBadRequest { + return &ReportsBadRequest{} +} + +/* +ReportsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ReportsBadRequest struct { +} + +// IsSuccess returns true when this reports bad request response has a 2xx status code +func (o *ReportsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this reports bad request response has a 3xx status code +func (o *ReportsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reports bad request response has a 4xx status code +func (o *ReportsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this reports bad request response has a 5xx status code +func (o *ReportsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this reports bad request response a status code equal to that given +func (o *ReportsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the reports bad request response +func (o *ReportsBadRequest) Code() int { + return 400 +} + +func (o *ReportsBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsBadRequest", 400) +} + +func (o *ReportsBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsBadRequest", 400) +} + +func (o *ReportsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportsUnauthorized creates a ReportsUnauthorized with default headers values +func NewReportsUnauthorized() *ReportsUnauthorized { + return &ReportsUnauthorized{} +} + +/* +ReportsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ReportsUnauthorized struct { +} + +// IsSuccess returns true when this reports unauthorized response has a 2xx status code +func (o *ReportsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this reports unauthorized response has a 3xx status code +func (o *ReportsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reports unauthorized response has a 4xx status code +func (o *ReportsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this reports unauthorized response has a 5xx status code +func (o *ReportsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this reports unauthorized response a status code equal to that given +func (o *ReportsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the reports unauthorized response +func (o *ReportsUnauthorized) Code() int { + return 401 +} + +func (o *ReportsUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsUnauthorized", 401) +} + +func (o *ReportsUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsUnauthorized", 401) +} + +func (o *ReportsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportsNotFound creates a ReportsNotFound with default headers values +func NewReportsNotFound() *ReportsNotFound { + return &ReportsNotFound{} +} + +/* +ReportsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ReportsNotFound struct { +} + +// IsSuccess returns true when this reports not found response has a 2xx status code +func (o *ReportsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this reports not found response has a 3xx status code +func (o *ReportsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reports not found response has a 4xx status code +func (o *ReportsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this reports not found response has a 5xx status code +func (o *ReportsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this reports not found response a status code equal to that given +func (o *ReportsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the reports not found response +func (o *ReportsNotFound) Code() int { + return 404 +} + +func (o *ReportsNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsNotFound", 404) +} + +func (o *ReportsNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsNotFound", 404) +} + +func (o *ReportsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportsNotAcceptable creates a ReportsNotAcceptable with default headers values +func NewReportsNotAcceptable() *ReportsNotAcceptable { + return &ReportsNotAcceptable{} +} + +/* +ReportsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ReportsNotAcceptable struct { +} + +// IsSuccess returns true when this reports not acceptable response has a 2xx status code +func (o *ReportsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this reports not acceptable response has a 3xx status code +func (o *ReportsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reports not acceptable response has a 4xx status code +func (o *ReportsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this reports not acceptable response has a 5xx status code +func (o *ReportsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this reports not acceptable response a status code equal to that given +func (o *ReportsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the reports not acceptable response +func (o *ReportsNotAcceptable) Code() int { + return 406 +} + +func (o *ReportsNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsNotAcceptable", 406) +} + +func (o *ReportsNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsNotAcceptable", 406) +} + +func (o *ReportsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportsInternalServerError creates a ReportsInternalServerError with default headers values +func NewReportsInternalServerError() *ReportsInternalServerError { + return &ReportsInternalServerError{} +} + +/* +ReportsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ReportsInternalServerError struct { +} + +// IsSuccess returns true when this reports internal server error response has a 2xx status code +func (o *ReportsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this reports internal server error response has a 3xx status code +func (o *ReportsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reports internal server error response has a 4xx status code +func (o *ReportsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this reports internal server error response has a 5xx status code +func (o *ReportsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this reports internal server error response a status code equal to that given +func (o *ReportsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the reports internal server error response +func (o *ReportsInternalServerError) Code() int { + return 500 +} + +func (o *ReportsInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsInternalServerError", 500) +} + +func (o *ReportsInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsInternalServerError", 500) +} + +func (o *ReportsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/search/search_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/search/search_client.go new file mode 100644 index 0000000..457cc7a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/search/search_client.go @@ -0,0 +1,108 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package search + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new search API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new search API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new search API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for search API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + SearchGet(params *SearchGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*SearchGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +SearchGet searches for statuses accounts or hashtags on this instance or elsewhere + +If statuses are in the result, they will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer). +*/ +func (a *Client) SearchGet(params *SearchGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*SearchGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewSearchGetParams() + } + op := &runtime.ClientOperation{ + ID: "searchGet", + Method: "GET", + PathPattern: "/api/{api_version}/search", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &SearchGetReader{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.(*SearchGetOK) + 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 searchGet: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/search/search_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/search/search_get_parameters.go new file mode 100644 index 0000000..3ba36a4 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/search/search_get_parameters.go @@ -0,0 +1,524 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package search + +// 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" +) + +// NewSearchGetParams creates a new SearchGetParams 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 NewSearchGetParams() *SearchGetParams { + return &SearchGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewSearchGetParamsWithTimeout creates a new SearchGetParams object +// with the ability to set a timeout on a request. +func NewSearchGetParamsWithTimeout(timeout time.Duration) *SearchGetParams { + return &SearchGetParams{ + timeout: timeout, + } +} + +// NewSearchGetParamsWithContext creates a new SearchGetParams object +// with the ability to set a context for a request. +func NewSearchGetParamsWithContext(ctx context.Context) *SearchGetParams { + return &SearchGetParams{ + Context: ctx, + } +} + +// NewSearchGetParamsWithHTTPClient creates a new SearchGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewSearchGetParamsWithHTTPClient(client *http.Client) *SearchGetParams { + return &SearchGetParams{ + HTTPClient: client, + } +} + +/* +SearchGetParams contains all the parameters to send to the API endpoint + + for the search get operation. + + Typically these are written to a http.Request. +*/ +type SearchGetParams struct { + + /* AccountID. + + Restrict results to statuses created by the specified account. + */ + AccountID *string + + /* APIVersion. + + Version of the API to use. Must be either `v1` or `v2`. If v1 is used, Hashtag results will be a slice of strings. If v2 is used, Hashtag results will be a slice of apimodel tags. + */ + APIVersion string + + /* ExcludeUnreviewed. + + If searching for hashtags, exclude those not yet approved by instance admin. Currently this parameter is unused. + */ + ExcludeUnreviewed *bool + + /* Following. + + If search type includes accounts, and search query is an arbitrary string, show only accounts that the requesting account follows. If this is set to `true`, then the GoToSocial instance will enhance the search by also searching within account notes, not just in usernames and display names. + */ + Following *bool + + /* Limit. + + Number of each type of item to return. + + Default: 20 + */ + Limit *int64 + + /* MaxID. + + Return only items *OLDER* than the given max ID. The item with the specified ID will not be included in the response. Currently only used if 'type' is set to a specific type. + */ + MaxID *string + + /* MinID. + + Return only items *immediately newer* than the given min ID. The item with the specified ID will not be included in the response. Currently only used if 'type' is set to a specific type. + */ + MinID *string + + /* Offset. + + Page number of results to return (starts at 0). This parameter is currently not used, page by selecting a specific query type and using maxID and minID instead. + */ + Offset *int64 + + /* Q. + + Query string to search for. This can be in the following forms: + - `@[username]` -- search for an account with the given username on any domain. Can return multiple results. + - @[username]@[domain]` -- search for a remote account with exact username and domain. Will only ever return 1 result at most. + - `https://example.org/some/arbitrary/url` -- search for an account OR a status with the given URL. Will only ever return 1 result at most. + - `#[hashtag_name]` -- search for a hashtag with the given hashtag name, or starting with the given hashtag name. Case insensitive. Can return multiple results. + - any arbitrary string -- search for accounts or statuses containing the given string. Can return multiple results. + + Arbitrary string queries may include the following operators: + - `from:localuser`, `from:remoteuser@instance.tld`: restrict results to statuses created by the specified account. + */ + Q string + + /* Resolve. + + If searching query is for `@[username]@[domain]`, or a URL, allow the GoToSocial instance to resolve the search by making calls to remote instances (webfinger, ActivityPub, etc). + */ + Resolve *bool + + /* Type. + + Type of item to return. One of: + - `` -- empty string; return any/all results. + - `accounts` -- return only account(s). + - `statuses` -- return only status(es). + - `hashtags` -- return only hashtag(s). + If `type` is specified, paging can be performed using max_id and min_id parameters. + If `type` is not specified, see the `offset` parameter for paging. + */ + Type *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the search get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *SearchGetParams) WithDefaults() *SearchGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the search get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *SearchGetParams) SetDefaults() { + var ( + excludeUnreviewedDefault = bool(false) + + followingDefault = bool(false) + + limitDefault = int64(20) + + offsetDefault = int64(0) + + resolveDefault = bool(false) + ) + + val := SearchGetParams{ + ExcludeUnreviewed: &excludeUnreviewedDefault, + Following: &followingDefault, + Limit: &limitDefault, + Offset: &offsetDefault, + Resolve: &resolveDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the search get params +func (o *SearchGetParams) WithTimeout(timeout time.Duration) *SearchGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the search get params +func (o *SearchGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the search get params +func (o *SearchGetParams) WithContext(ctx context.Context) *SearchGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the search get params +func (o *SearchGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the search get params +func (o *SearchGetParams) WithHTTPClient(client *http.Client) *SearchGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the search get params +func (o *SearchGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAccountID adds the accountID to the search get params +func (o *SearchGetParams) WithAccountID(accountID *string) *SearchGetParams { + o.SetAccountID(accountID) + return o +} + +// SetAccountID adds the accountId to the search get params +func (o *SearchGetParams) SetAccountID(accountID *string) { + o.AccountID = accountID +} + +// WithAPIVersion adds the aPIVersion to the search get params +func (o *SearchGetParams) WithAPIVersion(aPIVersion string) *SearchGetParams { + o.SetAPIVersion(aPIVersion) + return o +} + +// SetAPIVersion adds the apiVersion to the search get params +func (o *SearchGetParams) SetAPIVersion(aPIVersion string) { + o.APIVersion = aPIVersion +} + +// WithExcludeUnreviewed adds the excludeUnreviewed to the search get params +func (o *SearchGetParams) WithExcludeUnreviewed(excludeUnreviewed *bool) *SearchGetParams { + o.SetExcludeUnreviewed(excludeUnreviewed) + return o +} + +// SetExcludeUnreviewed adds the excludeUnreviewed to the search get params +func (o *SearchGetParams) SetExcludeUnreviewed(excludeUnreviewed *bool) { + o.ExcludeUnreviewed = excludeUnreviewed +} + +// WithFollowing adds the following to the search get params +func (o *SearchGetParams) WithFollowing(following *bool) *SearchGetParams { + o.SetFollowing(following) + return o +} + +// SetFollowing adds the following to the search get params +func (o *SearchGetParams) SetFollowing(following *bool) { + o.Following = following +} + +// WithLimit adds the limit to the search get params +func (o *SearchGetParams) WithLimit(limit *int64) *SearchGetParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the search get params +func (o *SearchGetParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the search get params +func (o *SearchGetParams) WithMaxID(maxID *string) *SearchGetParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the search get params +func (o *SearchGetParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the search get params +func (o *SearchGetParams) WithMinID(minID *string) *SearchGetParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the search get params +func (o *SearchGetParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithOffset adds the offset to the search get params +func (o *SearchGetParams) WithOffset(offset *int64) *SearchGetParams { + o.SetOffset(offset) + return o +} + +// SetOffset adds the offset to the search get params +func (o *SearchGetParams) SetOffset(offset *int64) { + o.Offset = offset +} + +// WithQ adds the q to the search get params +func (o *SearchGetParams) WithQ(q string) *SearchGetParams { + o.SetQ(q) + return o +} + +// SetQ adds the q to the search get params +func (o *SearchGetParams) SetQ(q string) { + o.Q = q +} + +// WithResolve adds the resolve to the search get params +func (o *SearchGetParams) WithResolve(resolve *bool) *SearchGetParams { + o.SetResolve(resolve) + return o +} + +// SetResolve adds the resolve to the search get params +func (o *SearchGetParams) SetResolve(resolve *bool) { + o.Resolve = resolve +} + +// WithType adds the typeVar to the search get params +func (o *SearchGetParams) WithType(typeVar *string) *SearchGetParams { + o.SetType(typeVar) + return o +} + +// SetType adds the type to the search get params +func (o *SearchGetParams) SetType(typeVar *string) { + o.Type = typeVar +} + +// WriteToRequest writes these params to a swagger request +func (o *SearchGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.AccountID != nil { + + // query param account_id + var qrAccountID string + + if o.AccountID != nil { + qrAccountID = *o.AccountID + } + qAccountID := qrAccountID + if qAccountID != "" { + + if err := r.SetQueryParam("account_id", qAccountID); err != nil { + return err + } + } + } + + // path param api_version + if err := r.SetPathParam("api_version", o.APIVersion); err != nil { + return err + } + + if o.ExcludeUnreviewed != nil { + + // query param exclude_unreviewed + var qrExcludeUnreviewed bool + + if o.ExcludeUnreviewed != nil { + qrExcludeUnreviewed = *o.ExcludeUnreviewed + } + qExcludeUnreviewed := swag.FormatBool(qrExcludeUnreviewed) + if qExcludeUnreviewed != "" { + + if err := r.SetQueryParam("exclude_unreviewed", qExcludeUnreviewed); err != nil { + return err + } + } + } + + if o.Following != nil { + + // query param following + var qrFollowing bool + + if o.Following != nil { + qrFollowing = *o.Following + } + qFollowing := swag.FormatBool(qrFollowing) + if qFollowing != "" { + + if err := r.SetQueryParam("following", qFollowing); 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.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if o.Offset != nil { + + // query param offset + var qrOffset int64 + + if o.Offset != nil { + qrOffset = *o.Offset + } + qOffset := swag.FormatInt64(qrOffset) + if qOffset != "" { + + if err := r.SetQueryParam("offset", qOffset); err != nil { + return err + } + } + } + + // query param q + qrQ := o.Q + qQ := qrQ + if qQ != "" { + + if err := r.SetQueryParam("q", qQ); err != nil { + return err + } + } + + if o.Resolve != nil { + + // query param resolve + var qrResolve bool + + if o.Resolve != nil { + qrResolve = *o.Resolve + } + qResolve := swag.FormatBool(qrResolve) + if qResolve != "" { + + if err := r.SetQueryParam("resolve", qResolve); err != nil { + return err + } + } + } + + 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...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/search/search_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/search/search_get_responses.go new file mode 100644 index 0000000..8523ca2 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/search/search_get_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package search + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// SearchGetReader is a Reader for the SearchGet structure. +type SearchGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *SearchGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewSearchGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewSearchGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewSearchGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewSearchGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewSearchGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewSearchGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/{api_version}/search] searchGet", response, response.Code()) + } +} + +// NewSearchGetOK creates a SearchGetOK with default headers values +func NewSearchGetOK() *SearchGetOK { + return &SearchGetOK{} +} + +/* +SearchGetOK describes a response with status code 200, with default header values. + +Results of the search. +*/ +type SearchGetOK struct { + Payload *models.SearchResult +} + +// IsSuccess returns true when this search get o k response has a 2xx status code +func (o *SearchGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this search get o k response has a 3xx status code +func (o *SearchGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this search get o k response has a 4xx status code +func (o *SearchGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this search get o k response has a 5xx status code +func (o *SearchGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this search get o k response a status code equal to that given +func (o *SearchGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the search get o k response +func (o *SearchGetOK) Code() int { + return 200 +} + +func (o *SearchGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetOK %s", 200, payload) +} + +func (o *SearchGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetOK %s", 200, payload) +} + +func (o *SearchGetOK) GetPayload() *models.SearchResult { + return o.Payload +} + +func (o *SearchGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SearchResult) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewSearchGetBadRequest creates a SearchGetBadRequest with default headers values +func NewSearchGetBadRequest() *SearchGetBadRequest { + return &SearchGetBadRequest{} +} + +/* +SearchGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type SearchGetBadRequest struct { +} + +// IsSuccess returns true when this search get bad request response has a 2xx status code +func (o *SearchGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this search get bad request response has a 3xx status code +func (o *SearchGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this search get bad request response has a 4xx status code +func (o *SearchGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this search get bad request response has a 5xx status code +func (o *SearchGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this search get bad request response a status code equal to that given +func (o *SearchGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the search get bad request response +func (o *SearchGetBadRequest) Code() int { + return 400 +} + +func (o *SearchGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetBadRequest", 400) +} + +func (o *SearchGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetBadRequest", 400) +} + +func (o *SearchGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewSearchGetUnauthorized creates a SearchGetUnauthorized with default headers values +func NewSearchGetUnauthorized() *SearchGetUnauthorized { + return &SearchGetUnauthorized{} +} + +/* +SearchGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type SearchGetUnauthorized struct { +} + +// IsSuccess returns true when this search get unauthorized response has a 2xx status code +func (o *SearchGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this search get unauthorized response has a 3xx status code +func (o *SearchGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this search get unauthorized response has a 4xx status code +func (o *SearchGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this search get unauthorized response has a 5xx status code +func (o *SearchGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this search get unauthorized response a status code equal to that given +func (o *SearchGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the search get unauthorized response +func (o *SearchGetUnauthorized) Code() int { + return 401 +} + +func (o *SearchGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetUnauthorized", 401) +} + +func (o *SearchGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetUnauthorized", 401) +} + +func (o *SearchGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewSearchGetNotFound creates a SearchGetNotFound with default headers values +func NewSearchGetNotFound() *SearchGetNotFound { + return &SearchGetNotFound{} +} + +/* +SearchGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type SearchGetNotFound struct { +} + +// IsSuccess returns true when this search get not found response has a 2xx status code +func (o *SearchGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this search get not found response has a 3xx status code +func (o *SearchGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this search get not found response has a 4xx status code +func (o *SearchGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this search get not found response has a 5xx status code +func (o *SearchGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this search get not found response a status code equal to that given +func (o *SearchGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the search get not found response +func (o *SearchGetNotFound) Code() int { + return 404 +} + +func (o *SearchGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetNotFound", 404) +} + +func (o *SearchGetNotFound) String() string { + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetNotFound", 404) +} + +func (o *SearchGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewSearchGetNotAcceptable creates a SearchGetNotAcceptable with default headers values +func NewSearchGetNotAcceptable() *SearchGetNotAcceptable { + return &SearchGetNotAcceptable{} +} + +/* +SearchGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type SearchGetNotAcceptable struct { +} + +// IsSuccess returns true when this search get not acceptable response has a 2xx status code +func (o *SearchGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this search get not acceptable response has a 3xx status code +func (o *SearchGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this search get not acceptable response has a 4xx status code +func (o *SearchGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this search get not acceptable response has a 5xx status code +func (o *SearchGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this search get not acceptable response a status code equal to that given +func (o *SearchGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the search get not acceptable response +func (o *SearchGetNotAcceptable) Code() int { + return 406 +} + +func (o *SearchGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetNotAcceptable", 406) +} + +func (o *SearchGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetNotAcceptable", 406) +} + +func (o *SearchGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewSearchGetInternalServerError creates a SearchGetInternalServerError with default headers values +func NewSearchGetInternalServerError() *SearchGetInternalServerError { + return &SearchGetInternalServerError{} +} + +/* +SearchGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type SearchGetInternalServerError struct { +} + +// IsSuccess returns true when this search get internal server error response has a 2xx status code +func (o *SearchGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this search get internal server error response has a 3xx status code +func (o *SearchGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this search get internal server error response has a 4xx status code +func (o *SearchGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this search get internal server error response has a 5xx status code +func (o *SearchGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this search get internal server error response a status code equal to that given +func (o *SearchGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the search get internal server error response +func (o *SearchGetInternalServerError) Code() int { + return 500 +} + +func (o *SearchGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetInternalServerError", 500) +} + +func (o *SearchGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetInternalServerError", 500) +} + +func (o *SearchGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_bookmark_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_bookmark_parameters.go new file mode 100644 index 0000000..70d0206 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_bookmark_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusBookmarkParams creates a new StatusBookmarkParams 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 NewStatusBookmarkParams() *StatusBookmarkParams { + return &StatusBookmarkParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusBookmarkParamsWithTimeout creates a new StatusBookmarkParams object +// with the ability to set a timeout on a request. +func NewStatusBookmarkParamsWithTimeout(timeout time.Duration) *StatusBookmarkParams { + return &StatusBookmarkParams{ + timeout: timeout, + } +} + +// NewStatusBookmarkParamsWithContext creates a new StatusBookmarkParams object +// with the ability to set a context for a request. +func NewStatusBookmarkParamsWithContext(ctx context.Context) *StatusBookmarkParams { + return &StatusBookmarkParams{ + Context: ctx, + } +} + +// NewStatusBookmarkParamsWithHTTPClient creates a new StatusBookmarkParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusBookmarkParamsWithHTTPClient(client *http.Client) *StatusBookmarkParams { + return &StatusBookmarkParams{ + HTTPClient: client, + } +} + +/* +StatusBookmarkParams contains all the parameters to send to the API endpoint + + for the status bookmark operation. + + Typically these are written to a http.Request. +*/ +type StatusBookmarkParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status bookmark params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusBookmarkParams) WithDefaults() *StatusBookmarkParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status bookmark params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusBookmarkParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status bookmark params +func (o *StatusBookmarkParams) WithTimeout(timeout time.Duration) *StatusBookmarkParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status bookmark params +func (o *StatusBookmarkParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status bookmark params +func (o *StatusBookmarkParams) WithContext(ctx context.Context) *StatusBookmarkParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status bookmark params +func (o *StatusBookmarkParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status bookmark params +func (o *StatusBookmarkParams) WithHTTPClient(client *http.Client) *StatusBookmarkParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status bookmark params +func (o *StatusBookmarkParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status bookmark params +func (o *StatusBookmarkParams) WithID(id string) *StatusBookmarkParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status bookmark params +func (o *StatusBookmarkParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusBookmarkParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_bookmark_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_bookmark_responses.go new file mode 100644 index 0000000..3f0f760 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_bookmark_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusBookmarkReader is a Reader for the StatusBookmark structure. +type StatusBookmarkReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusBookmarkReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusBookmarkOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusBookmarkBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusBookmarkUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusBookmarkForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusBookmarkNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusBookmarkNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusBookmarkInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses/{id}/bookmark] statusBookmark", response, response.Code()) + } +} + +// NewStatusBookmarkOK creates a StatusBookmarkOK with default headers values +func NewStatusBookmarkOK() *StatusBookmarkOK { + return &StatusBookmarkOK{} +} + +/* +StatusBookmarkOK describes a response with status code 200, with default header values. + +The status. +*/ +type StatusBookmarkOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status bookmark o k response has a 2xx status code +func (o *StatusBookmarkOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status bookmark o k response has a 3xx status code +func (o *StatusBookmarkOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status bookmark o k response has a 4xx status code +func (o *StatusBookmarkOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status bookmark o k response has a 5xx status code +func (o *StatusBookmarkOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status bookmark o k response a status code equal to that given +func (o *StatusBookmarkOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status bookmark o k response +func (o *StatusBookmarkOK) Code() int { + return 200 +} + +func (o *StatusBookmarkOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkOK %s", 200, payload) +} + +func (o *StatusBookmarkOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkOK %s", 200, payload) +} + +func (o *StatusBookmarkOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusBookmarkOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusBookmarkBadRequest creates a StatusBookmarkBadRequest with default headers values +func NewStatusBookmarkBadRequest() *StatusBookmarkBadRequest { + return &StatusBookmarkBadRequest{} +} + +/* +StatusBookmarkBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusBookmarkBadRequest struct { +} + +// IsSuccess returns true when this status bookmark bad request response has a 2xx status code +func (o *StatusBookmarkBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status bookmark bad request response has a 3xx status code +func (o *StatusBookmarkBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status bookmark bad request response has a 4xx status code +func (o *StatusBookmarkBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status bookmark bad request response has a 5xx status code +func (o *StatusBookmarkBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status bookmark bad request response a status code equal to that given +func (o *StatusBookmarkBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status bookmark bad request response +func (o *StatusBookmarkBadRequest) Code() int { + return 400 +} + +func (o *StatusBookmarkBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkBadRequest", 400) +} + +func (o *StatusBookmarkBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkBadRequest", 400) +} + +func (o *StatusBookmarkBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusBookmarkUnauthorized creates a StatusBookmarkUnauthorized with default headers values +func NewStatusBookmarkUnauthorized() *StatusBookmarkUnauthorized { + return &StatusBookmarkUnauthorized{} +} + +/* +StatusBookmarkUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusBookmarkUnauthorized struct { +} + +// IsSuccess returns true when this status bookmark unauthorized response has a 2xx status code +func (o *StatusBookmarkUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status bookmark unauthorized response has a 3xx status code +func (o *StatusBookmarkUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status bookmark unauthorized response has a 4xx status code +func (o *StatusBookmarkUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status bookmark unauthorized response has a 5xx status code +func (o *StatusBookmarkUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status bookmark unauthorized response a status code equal to that given +func (o *StatusBookmarkUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status bookmark unauthorized response +func (o *StatusBookmarkUnauthorized) Code() int { + return 401 +} + +func (o *StatusBookmarkUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkUnauthorized", 401) +} + +func (o *StatusBookmarkUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkUnauthorized", 401) +} + +func (o *StatusBookmarkUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusBookmarkForbidden creates a StatusBookmarkForbidden with default headers values +func NewStatusBookmarkForbidden() *StatusBookmarkForbidden { + return &StatusBookmarkForbidden{} +} + +/* +StatusBookmarkForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusBookmarkForbidden struct { +} + +// IsSuccess returns true when this status bookmark forbidden response has a 2xx status code +func (o *StatusBookmarkForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status bookmark forbidden response has a 3xx status code +func (o *StatusBookmarkForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status bookmark forbidden response has a 4xx status code +func (o *StatusBookmarkForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status bookmark forbidden response has a 5xx status code +func (o *StatusBookmarkForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status bookmark forbidden response a status code equal to that given +func (o *StatusBookmarkForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status bookmark forbidden response +func (o *StatusBookmarkForbidden) Code() int { + return 403 +} + +func (o *StatusBookmarkForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkForbidden", 403) +} + +func (o *StatusBookmarkForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkForbidden", 403) +} + +func (o *StatusBookmarkForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusBookmarkNotFound creates a StatusBookmarkNotFound with default headers values +func NewStatusBookmarkNotFound() *StatusBookmarkNotFound { + return &StatusBookmarkNotFound{} +} + +/* +StatusBookmarkNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusBookmarkNotFound struct { +} + +// IsSuccess returns true when this status bookmark not found response has a 2xx status code +func (o *StatusBookmarkNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status bookmark not found response has a 3xx status code +func (o *StatusBookmarkNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status bookmark not found response has a 4xx status code +func (o *StatusBookmarkNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status bookmark not found response has a 5xx status code +func (o *StatusBookmarkNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status bookmark not found response a status code equal to that given +func (o *StatusBookmarkNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status bookmark not found response +func (o *StatusBookmarkNotFound) Code() int { + return 404 +} + +func (o *StatusBookmarkNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkNotFound", 404) +} + +func (o *StatusBookmarkNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkNotFound", 404) +} + +func (o *StatusBookmarkNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusBookmarkNotAcceptable creates a StatusBookmarkNotAcceptable with default headers values +func NewStatusBookmarkNotAcceptable() *StatusBookmarkNotAcceptable { + return &StatusBookmarkNotAcceptable{} +} + +/* +StatusBookmarkNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusBookmarkNotAcceptable struct { +} + +// IsSuccess returns true when this status bookmark not acceptable response has a 2xx status code +func (o *StatusBookmarkNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status bookmark not acceptable response has a 3xx status code +func (o *StatusBookmarkNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status bookmark not acceptable response has a 4xx status code +func (o *StatusBookmarkNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status bookmark not acceptable response has a 5xx status code +func (o *StatusBookmarkNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status bookmark not acceptable response a status code equal to that given +func (o *StatusBookmarkNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status bookmark not acceptable response +func (o *StatusBookmarkNotAcceptable) Code() int { + return 406 +} + +func (o *StatusBookmarkNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkNotAcceptable", 406) +} + +func (o *StatusBookmarkNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkNotAcceptable", 406) +} + +func (o *StatusBookmarkNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusBookmarkInternalServerError creates a StatusBookmarkInternalServerError with default headers values +func NewStatusBookmarkInternalServerError() *StatusBookmarkInternalServerError { + return &StatusBookmarkInternalServerError{} +} + +/* +StatusBookmarkInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusBookmarkInternalServerError struct { +} + +// IsSuccess returns true when this status bookmark internal server error response has a 2xx status code +func (o *StatusBookmarkInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status bookmark internal server error response has a 3xx status code +func (o *StatusBookmarkInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status bookmark internal server error response has a 4xx status code +func (o *StatusBookmarkInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status bookmark internal server error response has a 5xx status code +func (o *StatusBookmarkInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status bookmark internal server error response a status code equal to that given +func (o *StatusBookmarkInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status bookmark internal server error response +func (o *StatusBookmarkInternalServerError) Code() int { + return 500 +} + +func (o *StatusBookmarkInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkInternalServerError", 500) +} + +func (o *StatusBookmarkInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkInternalServerError", 500) +} + +func (o *StatusBookmarkInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_boosted_by_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_boosted_by_parameters.go new file mode 100644 index 0000000..672711e --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_boosted_by_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusBoostedByParams creates a new StatusBoostedByParams 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 NewStatusBoostedByParams() *StatusBoostedByParams { + return &StatusBoostedByParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusBoostedByParamsWithTimeout creates a new StatusBoostedByParams object +// with the ability to set a timeout on a request. +func NewStatusBoostedByParamsWithTimeout(timeout time.Duration) *StatusBoostedByParams { + return &StatusBoostedByParams{ + timeout: timeout, + } +} + +// NewStatusBoostedByParamsWithContext creates a new StatusBoostedByParams object +// with the ability to set a context for a request. +func NewStatusBoostedByParamsWithContext(ctx context.Context) *StatusBoostedByParams { + return &StatusBoostedByParams{ + Context: ctx, + } +} + +// NewStatusBoostedByParamsWithHTTPClient creates a new StatusBoostedByParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusBoostedByParamsWithHTTPClient(client *http.Client) *StatusBoostedByParams { + return &StatusBoostedByParams{ + HTTPClient: client, + } +} + +/* +StatusBoostedByParams contains all the parameters to send to the API endpoint + + for the status boosted by operation. + + Typically these are written to a http.Request. +*/ +type StatusBoostedByParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status boosted by params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusBoostedByParams) WithDefaults() *StatusBoostedByParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status boosted by params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusBoostedByParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status boosted by params +func (o *StatusBoostedByParams) WithTimeout(timeout time.Duration) *StatusBoostedByParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status boosted by params +func (o *StatusBoostedByParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status boosted by params +func (o *StatusBoostedByParams) WithContext(ctx context.Context) *StatusBoostedByParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status boosted by params +func (o *StatusBoostedByParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status boosted by params +func (o *StatusBoostedByParams) WithHTTPClient(client *http.Client) *StatusBoostedByParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status boosted by params +func (o *StatusBoostedByParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status boosted by params +func (o *StatusBoostedByParams) WithID(id string) *StatusBoostedByParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status boosted by params +func (o *StatusBoostedByParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusBoostedByParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_boosted_by_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_boosted_by_responses.go new file mode 100644 index 0000000..2248741 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_boosted_by_responses.go @@ -0,0 +1,352 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusBoostedByReader is a Reader for the StatusBoostedBy structure. +type StatusBoostedByReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusBoostedByReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusBoostedByOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusBoostedByBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusBoostedByUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusBoostedByForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusBoostedByNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/statuses/{id}/reblogged_by] statusBoostedBy", response, response.Code()) + } +} + +// NewStatusBoostedByOK creates a StatusBoostedByOK with default headers values +func NewStatusBoostedByOK() *StatusBoostedByOK { + return &StatusBoostedByOK{} +} + +/* +StatusBoostedByOK describes a response with status code 200, with default header values. + +StatusBoostedByOK status boosted by o k +*/ +type StatusBoostedByOK struct { + Payload []*models.Account +} + +// IsSuccess returns true when this status boosted by o k response has a 2xx status code +func (o *StatusBoostedByOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status boosted by o k response has a 3xx status code +func (o *StatusBoostedByOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status boosted by o k response has a 4xx status code +func (o *StatusBoostedByOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status boosted by o k response has a 5xx status code +func (o *StatusBoostedByOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status boosted by o k response a status code equal to that given +func (o *StatusBoostedByOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status boosted by o k response +func (o *StatusBoostedByOK) Code() int { + return 200 +} + +func (o *StatusBoostedByOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}/reblogged_by][%d] statusBoostedByOK %s", 200, payload) +} + +func (o *StatusBoostedByOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}/reblogged_by][%d] statusBoostedByOK %s", 200, payload) +} + +func (o *StatusBoostedByOK) GetPayload() []*models.Account { + return o.Payload +} + +func (o *StatusBoostedByOK) 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 +} + +// NewStatusBoostedByBadRequest creates a StatusBoostedByBadRequest with default headers values +func NewStatusBoostedByBadRequest() *StatusBoostedByBadRequest { + return &StatusBoostedByBadRequest{} +} + +/* +StatusBoostedByBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusBoostedByBadRequest struct { +} + +// IsSuccess returns true when this status boosted by bad request response has a 2xx status code +func (o *StatusBoostedByBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status boosted by bad request response has a 3xx status code +func (o *StatusBoostedByBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status boosted by bad request response has a 4xx status code +func (o *StatusBoostedByBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status boosted by bad request response has a 5xx status code +func (o *StatusBoostedByBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status boosted by bad request response a status code equal to that given +func (o *StatusBoostedByBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status boosted by bad request response +func (o *StatusBoostedByBadRequest) Code() int { + return 400 +} + +func (o *StatusBoostedByBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/reblogged_by][%d] statusBoostedByBadRequest", 400) +} + +func (o *StatusBoostedByBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/reblogged_by][%d] statusBoostedByBadRequest", 400) +} + +func (o *StatusBoostedByBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusBoostedByUnauthorized creates a StatusBoostedByUnauthorized with default headers values +func NewStatusBoostedByUnauthorized() *StatusBoostedByUnauthorized { + return &StatusBoostedByUnauthorized{} +} + +/* +StatusBoostedByUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusBoostedByUnauthorized struct { +} + +// IsSuccess returns true when this status boosted by unauthorized response has a 2xx status code +func (o *StatusBoostedByUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status boosted by unauthorized response has a 3xx status code +func (o *StatusBoostedByUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status boosted by unauthorized response has a 4xx status code +func (o *StatusBoostedByUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status boosted by unauthorized response has a 5xx status code +func (o *StatusBoostedByUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status boosted by unauthorized response a status code equal to that given +func (o *StatusBoostedByUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status boosted by unauthorized response +func (o *StatusBoostedByUnauthorized) Code() int { + return 401 +} + +func (o *StatusBoostedByUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/reblogged_by][%d] statusBoostedByUnauthorized", 401) +} + +func (o *StatusBoostedByUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/reblogged_by][%d] statusBoostedByUnauthorized", 401) +} + +func (o *StatusBoostedByUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusBoostedByForbidden creates a StatusBoostedByForbidden with default headers values +func NewStatusBoostedByForbidden() *StatusBoostedByForbidden { + return &StatusBoostedByForbidden{} +} + +/* +StatusBoostedByForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusBoostedByForbidden struct { +} + +// IsSuccess returns true when this status boosted by forbidden response has a 2xx status code +func (o *StatusBoostedByForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status boosted by forbidden response has a 3xx status code +func (o *StatusBoostedByForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status boosted by forbidden response has a 4xx status code +func (o *StatusBoostedByForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status boosted by forbidden response has a 5xx status code +func (o *StatusBoostedByForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status boosted by forbidden response a status code equal to that given +func (o *StatusBoostedByForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status boosted by forbidden response +func (o *StatusBoostedByForbidden) Code() int { + return 403 +} + +func (o *StatusBoostedByForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/reblogged_by][%d] statusBoostedByForbidden", 403) +} + +func (o *StatusBoostedByForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/reblogged_by][%d] statusBoostedByForbidden", 403) +} + +func (o *StatusBoostedByForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusBoostedByNotFound creates a StatusBoostedByNotFound with default headers values +func NewStatusBoostedByNotFound() *StatusBoostedByNotFound { + return &StatusBoostedByNotFound{} +} + +/* +StatusBoostedByNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusBoostedByNotFound struct { +} + +// IsSuccess returns true when this status boosted by not found response has a 2xx status code +func (o *StatusBoostedByNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status boosted by not found response has a 3xx status code +func (o *StatusBoostedByNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status boosted by not found response has a 4xx status code +func (o *StatusBoostedByNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status boosted by not found response has a 5xx status code +func (o *StatusBoostedByNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status boosted by not found response a status code equal to that given +func (o *StatusBoostedByNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status boosted by not found response +func (o *StatusBoostedByNotFound) Code() int { + return 404 +} + +func (o *StatusBoostedByNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/reblogged_by][%d] statusBoostedByNotFound", 404) +} + +func (o *StatusBoostedByNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/reblogged_by][%d] statusBoostedByNotFound", 404) +} + +func (o *StatusBoostedByNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_create_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_create_parameters.go new file mode 100644 index 0000000..daa60df --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_create_parameters.go @@ -0,0 +1,635 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusCreateParams creates a new StatusCreateParams 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 NewStatusCreateParams() *StatusCreateParams { + return &StatusCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusCreateParamsWithTimeout creates a new StatusCreateParams object +// with the ability to set a timeout on a request. +func NewStatusCreateParamsWithTimeout(timeout time.Duration) *StatusCreateParams { + return &StatusCreateParams{ + timeout: timeout, + } +} + +// NewStatusCreateParamsWithContext creates a new StatusCreateParams object +// with the ability to set a context for a request. +func NewStatusCreateParamsWithContext(ctx context.Context) *StatusCreateParams { + return &StatusCreateParams{ + Context: ctx, + } +} + +// NewStatusCreateParamsWithHTTPClient creates a new StatusCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusCreateParamsWithHTTPClient(client *http.Client) *StatusCreateParams { + return &StatusCreateParams{ + HTTPClient: client, + } +} + +/* +StatusCreateParams contains all the parameters to send to the API endpoint + + for the status create operation. + + Typically these are written to a http.Request. +*/ +type StatusCreateParams struct { + + /* ContentType. + + Content type to use when parsing this status. + */ + ContentType *string + + /* Federated. + + This status will be federated beyond the local timeline(s). + */ + Federated *bool + + /* InReplyToID. + + ID of the status being replied to, if status is a reply. + */ + InReplyToID *string + + /* Language. + + ISO 639 language code for this status. + */ + Language *string + + /* MediaIds. + + Array of Attachment ids to be attached as media. + If provided, status becomes optional, and poll cannot be used. + + If the status is being submitted as a form, the key is 'media_ids[]', + but if it's json or xml, the key is 'media_ids'. + */ + MediaIDs []string + + /* PollExpiresIn. + + Duration the poll should be open, in seconds. + If provided, media_ids cannot be used, and poll[options] must be provided. + + Format: int64 + */ + PollExpiresIn *int64 + + /* PollHideTotals. + + Hide vote counts until the poll ends. + + Default: true + */ + PollHideTotals *bool + + /* PollMultiple. + + Allow multiple choices on this poll. + */ + PollMultiple *bool + + /* PollOptions. + + Array of possible poll answers. + If provided, media_ids cannot be used, and poll[expires_in] must be provided. + */ + PollOptions []string + + /* ScheduledAt. + + ISO 8601 Datetime at which to schedule a status. + Providing this parameter will cause ScheduledStatus to be returned instead of Status. + Must be at least 5 minutes in the future. + + This feature isn't implemented yet. + */ + ScheduledAt *string + + /* Sensitive. + + Status and attached media should be marked as sensitive. + */ + Sensitive *bool + + /* SpoilerText. + + Text to be shown as a warning or subject before the actual content. + Statuses are generally collapsed behind this field. + */ + SpoilerText *string + + /* Status. + + Text content of the status. + If media_ids is provided, this becomes optional. + Attaching a poll is optional while status is provided. + */ + Status *string + + /* Visibility. + + Visibility of the posted status. + */ + Visibility *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusCreateParams) WithDefaults() *StatusCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusCreateParams) SetDefaults() { + var ( + pollHideTotalsDefault = bool(true) + + pollMultipleDefault = bool(false) + ) + + val := StatusCreateParams{ + PollHideTotals: &pollHideTotalsDefault, + PollMultiple: &pollMultipleDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the status create params +func (o *StatusCreateParams) WithTimeout(timeout time.Duration) *StatusCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status create params +func (o *StatusCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status create params +func (o *StatusCreateParams) WithContext(ctx context.Context) *StatusCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status create params +func (o *StatusCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status create params +func (o *StatusCreateParams) WithHTTPClient(client *http.Client) *StatusCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status create params +func (o *StatusCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithContentType adds the contentType to the status create params +func (o *StatusCreateParams) WithContentType(contentType *string) *StatusCreateParams { + o.SetContentType(contentType) + return o +} + +// SetContentType adds the contentType to the status create params +func (o *StatusCreateParams) SetContentType(contentType *string) { + o.ContentType = contentType +} + +// WithFederated adds the federated to the status create params +func (o *StatusCreateParams) WithFederated(federated *bool) *StatusCreateParams { + o.SetFederated(federated) + return o +} + +// SetFederated adds the federated to the status create params +func (o *StatusCreateParams) SetFederated(federated *bool) { + o.Federated = federated +} + +// WithInReplyToID adds the inReplyToID to the status create params +func (o *StatusCreateParams) WithInReplyToID(inReplyToID *string) *StatusCreateParams { + o.SetInReplyToID(inReplyToID) + return o +} + +// SetInReplyToID adds the inReplyToId to the status create params +func (o *StatusCreateParams) SetInReplyToID(inReplyToID *string) { + o.InReplyToID = inReplyToID +} + +// WithLanguage adds the language to the status create params +func (o *StatusCreateParams) WithLanguage(language *string) *StatusCreateParams { + o.SetLanguage(language) + return o +} + +// SetLanguage adds the language to the status create params +func (o *StatusCreateParams) SetLanguage(language *string) { + o.Language = language +} + +// WithMediaIDs adds the mediaIds to the status create params +func (o *StatusCreateParams) WithMediaIDs(mediaIds []string) *StatusCreateParams { + o.SetMediaIDs(mediaIds) + return o +} + +// SetMediaIDs adds the mediaIds to the status create params +func (o *StatusCreateParams) SetMediaIDs(mediaIds []string) { + o.MediaIDs = mediaIds +} + +// WithPollExpiresIn adds the pollExpiresIn to the status create params +func (o *StatusCreateParams) WithPollExpiresIn(pollExpiresIn *int64) *StatusCreateParams { + o.SetPollExpiresIn(pollExpiresIn) + return o +} + +// SetPollExpiresIn adds the pollExpiresIn to the status create params +func (o *StatusCreateParams) SetPollExpiresIn(pollExpiresIn *int64) { + o.PollExpiresIn = pollExpiresIn +} + +// WithPollHideTotals adds the pollHideTotals to the status create params +func (o *StatusCreateParams) WithPollHideTotals(pollHideTotals *bool) *StatusCreateParams { + o.SetPollHideTotals(pollHideTotals) + return o +} + +// SetPollHideTotals adds the pollHideTotals to the status create params +func (o *StatusCreateParams) SetPollHideTotals(pollHideTotals *bool) { + o.PollHideTotals = pollHideTotals +} + +// WithPollMultiple adds the pollMultiple to the status create params +func (o *StatusCreateParams) WithPollMultiple(pollMultiple *bool) *StatusCreateParams { + o.SetPollMultiple(pollMultiple) + return o +} + +// SetPollMultiple adds the pollMultiple to the status create params +func (o *StatusCreateParams) SetPollMultiple(pollMultiple *bool) { + o.PollMultiple = pollMultiple +} + +// WithPollOptions adds the pollOptions to the status create params +func (o *StatusCreateParams) WithPollOptions(pollOptions []string) *StatusCreateParams { + o.SetPollOptions(pollOptions) + return o +} + +// SetPollOptions adds the pollOptions to the status create params +func (o *StatusCreateParams) SetPollOptions(pollOptions []string) { + o.PollOptions = pollOptions +} + +// WithScheduledAt adds the scheduledAt to the status create params +func (o *StatusCreateParams) WithScheduledAt(scheduledAt *string) *StatusCreateParams { + o.SetScheduledAt(scheduledAt) + return o +} + +// SetScheduledAt adds the scheduledAt to the status create params +func (o *StatusCreateParams) SetScheduledAt(scheduledAt *string) { + o.ScheduledAt = scheduledAt +} + +// WithSensitive adds the sensitive to the status create params +func (o *StatusCreateParams) WithSensitive(sensitive *bool) *StatusCreateParams { + o.SetSensitive(sensitive) + return o +} + +// SetSensitive adds the sensitive to the status create params +func (o *StatusCreateParams) SetSensitive(sensitive *bool) { + o.Sensitive = sensitive +} + +// WithSpoilerText adds the spoilerText to the status create params +func (o *StatusCreateParams) WithSpoilerText(spoilerText *string) *StatusCreateParams { + o.SetSpoilerText(spoilerText) + return o +} + +// SetSpoilerText adds the spoilerText to the status create params +func (o *StatusCreateParams) SetSpoilerText(spoilerText *string) { + o.SpoilerText = spoilerText +} + +// WithStatus adds the status to the status create params +func (o *StatusCreateParams) WithStatus(status *string) *StatusCreateParams { + o.SetStatus(status) + return o +} + +// SetStatus adds the status to the status create params +func (o *StatusCreateParams) SetStatus(status *string) { + o.Status = status +} + +// WithVisibility adds the visibility to the status create params +func (o *StatusCreateParams) WithVisibility(visibility *string) *StatusCreateParams { + o.SetVisibility(visibility) + return o +} + +// SetVisibility adds the visibility to the status create params +func (o *StatusCreateParams) SetVisibility(visibility *string) { + o.Visibility = visibility +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ContentType != nil { + + // form param content_type + var frContentType string + if o.ContentType != nil { + frContentType = *o.ContentType + } + fContentType := frContentType + if fContentType != "" { + if err := r.SetFormParam("content_type", fContentType); err != nil { + return err + } + } + } + + if o.Federated != nil { + + // form param federated + var frFederated bool + if o.Federated != nil { + frFederated = *o.Federated + } + fFederated := swag.FormatBool(frFederated) + if fFederated != "" { + if err := r.SetFormParam("federated", fFederated); err != nil { + return err + } + } + } + + if o.InReplyToID != nil { + + // form param in_reply_to_id + var frInReplyToID string + if o.InReplyToID != nil { + frInReplyToID = *o.InReplyToID + } + fInReplyToID := frInReplyToID + if fInReplyToID != "" { + if err := r.SetFormParam("in_reply_to_id", fInReplyToID); err != nil { + return err + } + } + } + + if o.Language != nil { + + // form param language + var frLanguage string + if o.Language != nil { + frLanguage = *o.Language + } + fLanguage := frLanguage + if fLanguage != "" { + if err := r.SetFormParam("language", fLanguage); err != nil { + return err + } + } + } + + if o.MediaIDs != nil { + + // binding items for media_ids + joinedMediaIds := o.bindParamMediaIds(reg) + + // form array param media_ids + if err := r.SetFormParam("media_ids", joinedMediaIds...); err != nil { + return err + } + } + + if o.PollExpiresIn != nil { + + // form param poll[expires_in] + var frPollExpiresIn int64 + if o.PollExpiresIn != nil { + frPollExpiresIn = *o.PollExpiresIn + } + fPollExpiresIn := swag.FormatInt64(frPollExpiresIn) + if fPollExpiresIn != "" { + if err := r.SetFormParam("poll[expires_in]", fPollExpiresIn); err != nil { + return err + } + } + } + + if o.PollHideTotals != nil { + + // form param poll[hide_totals] + var frPollHideTotals bool + if o.PollHideTotals != nil { + frPollHideTotals = *o.PollHideTotals + } + fPollHideTotals := swag.FormatBool(frPollHideTotals) + if fPollHideTotals != "" { + if err := r.SetFormParam("poll[hide_totals]", fPollHideTotals); err != nil { + return err + } + } + } + + if o.PollMultiple != nil { + + // form param poll[multiple] + var frPollMultiple bool + if o.PollMultiple != nil { + frPollMultiple = *o.PollMultiple + } + fPollMultiple := swag.FormatBool(frPollMultiple) + if fPollMultiple != "" { + if err := r.SetFormParam("poll[multiple]", fPollMultiple); err != nil { + return err + } + } + } + + if o.PollOptions != nil { + + // binding items for poll[options][] + joinedPollOptions := o.bindParamPollOptions(reg) + + // form array param poll[options][] + if err := r.SetFormParam("poll[options][]", joinedPollOptions...); err != nil { + return err + } + } + + if o.ScheduledAt != nil { + + // form param scheduled_at + var frScheduledAt string + if o.ScheduledAt != nil { + frScheduledAt = *o.ScheduledAt + } + fScheduledAt := frScheduledAt + if fScheduledAt != "" { + if err := r.SetFormParam("scheduled_at", fScheduledAt); err != nil { + return err + } + } + } + + if o.Sensitive != nil { + + // form param sensitive + var frSensitive bool + if o.Sensitive != nil { + frSensitive = *o.Sensitive + } + fSensitive := swag.FormatBool(frSensitive) + if fSensitive != "" { + if err := r.SetFormParam("sensitive", fSensitive); err != nil { + return err + } + } + } + + if o.SpoilerText != nil { + + // form param spoiler_text + var frSpoilerText string + if o.SpoilerText != nil { + frSpoilerText = *o.SpoilerText + } + fSpoilerText := frSpoilerText + if fSpoilerText != "" { + if err := r.SetFormParam("spoiler_text", fSpoilerText); err != nil { + return err + } + } + } + + if o.Status != nil { + + // form param status + var frStatus string + if o.Status != nil { + frStatus = *o.Status + } + fStatus := frStatus + if fStatus != "" { + if err := r.SetFormParam("status", fStatus); err != nil { + return err + } + } + } + + if o.Visibility != nil { + + // form param visibility + var frVisibility string + if o.Visibility != nil { + frVisibility = *o.Visibility + } + fVisibility := frVisibility + if fVisibility != "" { + if err := r.SetFormParam("visibility", fVisibility); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamStatusCreate binds the parameter media_ids +func (o *StatusCreateParams) bindParamMediaIds(formats strfmt.Registry) []string { + mediaIdsIR := o.MediaIDs + + var mediaIdsIC []string + for _, mediaIdsIIR := range mediaIdsIR { // explode []string + + mediaIdsIIV := mediaIdsIIR // string as string + mediaIdsIC = append(mediaIdsIC, mediaIdsIIV) + } + + // items.CollectionFormat: "" + mediaIdsIS := swag.JoinByFormat(mediaIdsIC, "") + + return mediaIdsIS +} + +// bindParamStatusCreate binds the parameter poll[options][] +func (o *StatusCreateParams) bindParamPollOptions(formats strfmt.Registry) []string { + pollOptionsIR := o.PollOptions + + var pollOptionsIC []string + for _, pollOptionsIIR := range pollOptionsIR { // explode []string + + pollOptionsIIV := pollOptionsIIR // string as string + pollOptionsIC = append(pollOptionsIC, pollOptionsIIV) + } + + // items.CollectionFormat: "" + pollOptionsIS := swag.JoinByFormat(pollOptionsIC, "") + + return pollOptionsIS +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_create_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_create_responses.go new file mode 100644 index 0000000..78d42e7 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_create_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusCreateReader is a Reader for the StatusCreate structure. +type StatusCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusCreateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusCreateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusCreateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses] statusCreate", response, response.Code()) + } +} + +// NewStatusCreateOK creates a StatusCreateOK with default headers values +func NewStatusCreateOK() *StatusCreateOK { + return &StatusCreateOK{} +} + +/* +StatusCreateOK describes a response with status code 200, with default header values. + +The newly created status. +*/ +type StatusCreateOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status create o k response has a 2xx status code +func (o *StatusCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status create o k response has a 3xx status code +func (o *StatusCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status create o k response has a 4xx status code +func (o *StatusCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status create o k response has a 5xx status code +func (o *StatusCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status create o k response a status code equal to that given +func (o *StatusCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status create o k response +func (o *StatusCreateOK) Code() int { + return 200 +} + +func (o *StatusCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateOK %s", 200, payload) +} + +func (o *StatusCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateOK %s", 200, payload) +} + +func (o *StatusCreateOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusCreateBadRequest creates a StatusCreateBadRequest with default headers values +func NewStatusCreateBadRequest() *StatusCreateBadRequest { + return &StatusCreateBadRequest{} +} + +/* +StatusCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusCreateBadRequest struct { +} + +// IsSuccess returns true when this status create bad request response has a 2xx status code +func (o *StatusCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status create bad request response has a 3xx status code +func (o *StatusCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status create bad request response has a 4xx status code +func (o *StatusCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status create bad request response has a 5xx status code +func (o *StatusCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status create bad request response a status code equal to that given +func (o *StatusCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status create bad request response +func (o *StatusCreateBadRequest) Code() int { + return 400 +} + +func (o *StatusCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateBadRequest", 400) +} + +func (o *StatusCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateBadRequest", 400) +} + +func (o *StatusCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusCreateUnauthorized creates a StatusCreateUnauthorized with default headers values +func NewStatusCreateUnauthorized() *StatusCreateUnauthorized { + return &StatusCreateUnauthorized{} +} + +/* +StatusCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusCreateUnauthorized struct { +} + +// IsSuccess returns true when this status create unauthorized response has a 2xx status code +func (o *StatusCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status create unauthorized response has a 3xx status code +func (o *StatusCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status create unauthorized response has a 4xx status code +func (o *StatusCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status create unauthorized response has a 5xx status code +func (o *StatusCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status create unauthorized response a status code equal to that given +func (o *StatusCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status create unauthorized response +func (o *StatusCreateUnauthorized) Code() int { + return 401 +} + +func (o *StatusCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateUnauthorized", 401) +} + +func (o *StatusCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateUnauthorized", 401) +} + +func (o *StatusCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusCreateForbidden creates a StatusCreateForbidden with default headers values +func NewStatusCreateForbidden() *StatusCreateForbidden { + return &StatusCreateForbidden{} +} + +/* +StatusCreateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusCreateForbidden struct { +} + +// IsSuccess returns true when this status create forbidden response has a 2xx status code +func (o *StatusCreateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status create forbidden response has a 3xx status code +func (o *StatusCreateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status create forbidden response has a 4xx status code +func (o *StatusCreateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status create forbidden response has a 5xx status code +func (o *StatusCreateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status create forbidden response a status code equal to that given +func (o *StatusCreateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status create forbidden response +func (o *StatusCreateForbidden) Code() int { + return 403 +} + +func (o *StatusCreateForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateForbidden", 403) +} + +func (o *StatusCreateForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateForbidden", 403) +} + +func (o *StatusCreateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusCreateNotFound creates a StatusCreateNotFound with default headers values +func NewStatusCreateNotFound() *StatusCreateNotFound { + return &StatusCreateNotFound{} +} + +/* +StatusCreateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusCreateNotFound struct { +} + +// IsSuccess returns true when this status create not found response has a 2xx status code +func (o *StatusCreateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status create not found response has a 3xx status code +func (o *StatusCreateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status create not found response has a 4xx status code +func (o *StatusCreateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status create not found response has a 5xx status code +func (o *StatusCreateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status create not found response a status code equal to that given +func (o *StatusCreateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status create not found response +func (o *StatusCreateNotFound) Code() int { + return 404 +} + +func (o *StatusCreateNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateNotFound", 404) +} + +func (o *StatusCreateNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateNotFound", 404) +} + +func (o *StatusCreateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusCreateNotAcceptable creates a StatusCreateNotAcceptable with default headers values +func NewStatusCreateNotAcceptable() *StatusCreateNotAcceptable { + return &StatusCreateNotAcceptable{} +} + +/* +StatusCreateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusCreateNotAcceptable struct { +} + +// IsSuccess returns true when this status create not acceptable response has a 2xx status code +func (o *StatusCreateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status create not acceptable response has a 3xx status code +func (o *StatusCreateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status create not acceptable response has a 4xx status code +func (o *StatusCreateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status create not acceptable response has a 5xx status code +func (o *StatusCreateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status create not acceptable response a status code equal to that given +func (o *StatusCreateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status create not acceptable response +func (o *StatusCreateNotAcceptable) Code() int { + return 406 +} + +func (o *StatusCreateNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateNotAcceptable", 406) +} + +func (o *StatusCreateNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateNotAcceptable", 406) +} + +func (o *StatusCreateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusCreateInternalServerError creates a StatusCreateInternalServerError with default headers values +func NewStatusCreateInternalServerError() *StatusCreateInternalServerError { + return &StatusCreateInternalServerError{} +} + +/* +StatusCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusCreateInternalServerError struct { +} + +// IsSuccess returns true when this status create internal server error response has a 2xx status code +func (o *StatusCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status create internal server error response has a 3xx status code +func (o *StatusCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status create internal server error response has a 4xx status code +func (o *StatusCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status create internal server error response has a 5xx status code +func (o *StatusCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status create internal server error response a status code equal to that given +func (o *StatusCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status create internal server error response +func (o *StatusCreateInternalServerError) Code() int { + return 500 +} + +func (o *StatusCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateInternalServerError", 500) +} + +func (o *StatusCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateInternalServerError", 500) +} + +func (o *StatusCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_delete_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_delete_parameters.go new file mode 100644 index 0000000..e74c572 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusDeleteParams creates a new StatusDeleteParams 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 NewStatusDeleteParams() *StatusDeleteParams { + return &StatusDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusDeleteParamsWithTimeout creates a new StatusDeleteParams object +// with the ability to set a timeout on a request. +func NewStatusDeleteParamsWithTimeout(timeout time.Duration) *StatusDeleteParams { + return &StatusDeleteParams{ + timeout: timeout, + } +} + +// NewStatusDeleteParamsWithContext creates a new StatusDeleteParams object +// with the ability to set a context for a request. +func NewStatusDeleteParamsWithContext(ctx context.Context) *StatusDeleteParams { + return &StatusDeleteParams{ + Context: ctx, + } +} + +// NewStatusDeleteParamsWithHTTPClient creates a new StatusDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusDeleteParamsWithHTTPClient(client *http.Client) *StatusDeleteParams { + return &StatusDeleteParams{ + HTTPClient: client, + } +} + +/* +StatusDeleteParams contains all the parameters to send to the API endpoint + + for the status delete operation. + + Typically these are written to a http.Request. +*/ +type StatusDeleteParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusDeleteParams) WithDefaults() *StatusDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status delete params +func (o *StatusDeleteParams) WithTimeout(timeout time.Duration) *StatusDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status delete params +func (o *StatusDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status delete params +func (o *StatusDeleteParams) WithContext(ctx context.Context) *StatusDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status delete params +func (o *StatusDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status delete params +func (o *StatusDeleteParams) WithHTTPClient(client *http.Client) *StatusDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status delete params +func (o *StatusDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status delete params +func (o *StatusDeleteParams) WithID(id string) *StatusDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status delete params +func (o *StatusDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_delete_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_delete_responses.go new file mode 100644 index 0000000..bd4408c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_delete_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusDeleteReader is a Reader for the StatusDelete structure. +type StatusDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/statuses/{id}] statusDelete", response, response.Code()) + } +} + +// NewStatusDeleteOK creates a StatusDeleteOK with default headers values +func NewStatusDeleteOK() *StatusDeleteOK { + return &StatusDeleteOK{} +} + +/* +StatusDeleteOK describes a response with status code 200, with default header values. + +The status that was just deleted. +*/ +type StatusDeleteOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status delete o k response has a 2xx status code +func (o *StatusDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status delete o k response has a 3xx status code +func (o *StatusDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status delete o k response has a 4xx status code +func (o *StatusDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status delete o k response has a 5xx status code +func (o *StatusDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status delete o k response a status code equal to that given +func (o *StatusDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status delete o k response +func (o *StatusDeleteOK) Code() int { + return 200 +} + +func (o *StatusDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteOK %s", 200, payload) +} + +func (o *StatusDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteOK %s", 200, payload) +} + +func (o *StatusDeleteOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusDeleteBadRequest creates a StatusDeleteBadRequest with default headers values +func NewStatusDeleteBadRequest() *StatusDeleteBadRequest { + return &StatusDeleteBadRequest{} +} + +/* +StatusDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusDeleteBadRequest struct { +} + +// IsSuccess returns true when this status delete bad request response has a 2xx status code +func (o *StatusDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status delete bad request response has a 3xx status code +func (o *StatusDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status delete bad request response has a 4xx status code +func (o *StatusDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status delete bad request response has a 5xx status code +func (o *StatusDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status delete bad request response a status code equal to that given +func (o *StatusDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status delete bad request response +func (o *StatusDeleteBadRequest) Code() int { + return 400 +} + +func (o *StatusDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteBadRequest", 400) +} + +func (o *StatusDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteBadRequest", 400) +} + +func (o *StatusDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusDeleteUnauthorized creates a StatusDeleteUnauthorized with default headers values +func NewStatusDeleteUnauthorized() *StatusDeleteUnauthorized { + return &StatusDeleteUnauthorized{} +} + +/* +StatusDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusDeleteUnauthorized struct { +} + +// IsSuccess returns true when this status delete unauthorized response has a 2xx status code +func (o *StatusDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status delete unauthorized response has a 3xx status code +func (o *StatusDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status delete unauthorized response has a 4xx status code +func (o *StatusDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status delete unauthorized response has a 5xx status code +func (o *StatusDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status delete unauthorized response a status code equal to that given +func (o *StatusDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status delete unauthorized response +func (o *StatusDeleteUnauthorized) Code() int { + return 401 +} + +func (o *StatusDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteUnauthorized", 401) +} + +func (o *StatusDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteUnauthorized", 401) +} + +func (o *StatusDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusDeleteForbidden creates a StatusDeleteForbidden with default headers values +func NewStatusDeleteForbidden() *StatusDeleteForbidden { + return &StatusDeleteForbidden{} +} + +/* +StatusDeleteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusDeleteForbidden struct { +} + +// IsSuccess returns true when this status delete forbidden response has a 2xx status code +func (o *StatusDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status delete forbidden response has a 3xx status code +func (o *StatusDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status delete forbidden response has a 4xx status code +func (o *StatusDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status delete forbidden response has a 5xx status code +func (o *StatusDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status delete forbidden response a status code equal to that given +func (o *StatusDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status delete forbidden response +func (o *StatusDeleteForbidden) Code() int { + return 403 +} + +func (o *StatusDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteForbidden", 403) +} + +func (o *StatusDeleteForbidden) String() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteForbidden", 403) +} + +func (o *StatusDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusDeleteNotFound creates a StatusDeleteNotFound with default headers values +func NewStatusDeleteNotFound() *StatusDeleteNotFound { + return &StatusDeleteNotFound{} +} + +/* +StatusDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusDeleteNotFound struct { +} + +// IsSuccess returns true when this status delete not found response has a 2xx status code +func (o *StatusDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status delete not found response has a 3xx status code +func (o *StatusDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status delete not found response has a 4xx status code +func (o *StatusDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status delete not found response has a 5xx status code +func (o *StatusDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status delete not found response a status code equal to that given +func (o *StatusDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status delete not found response +func (o *StatusDeleteNotFound) Code() int { + return 404 +} + +func (o *StatusDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteNotFound", 404) +} + +func (o *StatusDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteNotFound", 404) +} + +func (o *StatusDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusDeleteNotAcceptable creates a StatusDeleteNotAcceptable with default headers values +func NewStatusDeleteNotAcceptable() *StatusDeleteNotAcceptable { + return &StatusDeleteNotAcceptable{} +} + +/* +StatusDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this status delete not acceptable response has a 2xx status code +func (o *StatusDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status delete not acceptable response has a 3xx status code +func (o *StatusDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status delete not acceptable response has a 4xx status code +func (o *StatusDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status delete not acceptable response has a 5xx status code +func (o *StatusDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status delete not acceptable response a status code equal to that given +func (o *StatusDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status delete not acceptable response +func (o *StatusDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *StatusDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteNotAcceptable", 406) +} + +func (o *StatusDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteNotAcceptable", 406) +} + +func (o *StatusDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusDeleteInternalServerError creates a StatusDeleteInternalServerError with default headers values +func NewStatusDeleteInternalServerError() *StatusDeleteInternalServerError { + return &StatusDeleteInternalServerError{} +} + +/* +StatusDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusDeleteInternalServerError struct { +} + +// IsSuccess returns true when this status delete internal server error response has a 2xx status code +func (o *StatusDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status delete internal server error response has a 3xx status code +func (o *StatusDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status delete internal server error response has a 4xx status code +func (o *StatusDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status delete internal server error response has a 5xx status code +func (o *StatusDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status delete internal server error response a status code equal to that given +func (o *StatusDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status delete internal server error response +func (o *StatusDeleteInternalServerError) Code() int { + return 500 +} + +func (o *StatusDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteInternalServerError", 500) +} + +func (o *StatusDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteInternalServerError", 500) +} + +func (o *StatusDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_fave_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_fave_parameters.go new file mode 100644 index 0000000..8062d36 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_fave_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusFaveParams creates a new StatusFaveParams 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 NewStatusFaveParams() *StatusFaveParams { + return &StatusFaveParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusFaveParamsWithTimeout creates a new StatusFaveParams object +// with the ability to set a timeout on a request. +func NewStatusFaveParamsWithTimeout(timeout time.Duration) *StatusFaveParams { + return &StatusFaveParams{ + timeout: timeout, + } +} + +// NewStatusFaveParamsWithContext creates a new StatusFaveParams object +// with the ability to set a context for a request. +func NewStatusFaveParamsWithContext(ctx context.Context) *StatusFaveParams { + return &StatusFaveParams{ + Context: ctx, + } +} + +// NewStatusFaveParamsWithHTTPClient creates a new StatusFaveParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusFaveParamsWithHTTPClient(client *http.Client) *StatusFaveParams { + return &StatusFaveParams{ + HTTPClient: client, + } +} + +/* +StatusFaveParams contains all the parameters to send to the API endpoint + + for the status fave operation. + + Typically these are written to a http.Request. +*/ +type StatusFaveParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status fave params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusFaveParams) WithDefaults() *StatusFaveParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status fave params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusFaveParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status fave params +func (o *StatusFaveParams) WithTimeout(timeout time.Duration) *StatusFaveParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status fave params +func (o *StatusFaveParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status fave params +func (o *StatusFaveParams) WithContext(ctx context.Context) *StatusFaveParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status fave params +func (o *StatusFaveParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status fave params +func (o *StatusFaveParams) WithHTTPClient(client *http.Client) *StatusFaveParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status fave params +func (o *StatusFaveParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status fave params +func (o *StatusFaveParams) WithID(id string) *StatusFaveParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status fave params +func (o *StatusFaveParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusFaveParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_fave_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_fave_responses.go new file mode 100644 index 0000000..c54847f --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_fave_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusFaveReader is a Reader for the StatusFave structure. +type StatusFaveReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusFaveReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusFaveOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusFaveBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusFaveUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusFaveForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusFaveNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusFaveNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusFaveInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses/{id}/favourite] statusFave", response, response.Code()) + } +} + +// NewStatusFaveOK creates a StatusFaveOK with default headers values +func NewStatusFaveOK() *StatusFaveOK { + return &StatusFaveOK{} +} + +/* +StatusFaveOK describes a response with status code 200, with default header values. + +The newly faved status. +*/ +type StatusFaveOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status fave o k response has a 2xx status code +func (o *StatusFaveOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status fave o k response has a 3xx status code +func (o *StatusFaveOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status fave o k response has a 4xx status code +func (o *StatusFaveOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status fave o k response has a 5xx status code +func (o *StatusFaveOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status fave o k response a status code equal to that given +func (o *StatusFaveOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status fave o k response +func (o *StatusFaveOK) Code() int { + return 200 +} + +func (o *StatusFaveOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveOK %s", 200, payload) +} + +func (o *StatusFaveOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveOK %s", 200, payload) +} + +func (o *StatusFaveOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusFaveOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusFaveBadRequest creates a StatusFaveBadRequest with default headers values +func NewStatusFaveBadRequest() *StatusFaveBadRequest { + return &StatusFaveBadRequest{} +} + +/* +StatusFaveBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusFaveBadRequest struct { +} + +// IsSuccess returns true when this status fave bad request response has a 2xx status code +func (o *StatusFaveBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status fave bad request response has a 3xx status code +func (o *StatusFaveBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status fave bad request response has a 4xx status code +func (o *StatusFaveBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status fave bad request response has a 5xx status code +func (o *StatusFaveBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status fave bad request response a status code equal to that given +func (o *StatusFaveBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status fave bad request response +func (o *StatusFaveBadRequest) Code() int { + return 400 +} + +func (o *StatusFaveBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveBadRequest", 400) +} + +func (o *StatusFaveBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveBadRequest", 400) +} + +func (o *StatusFaveBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusFaveUnauthorized creates a StatusFaveUnauthorized with default headers values +func NewStatusFaveUnauthorized() *StatusFaveUnauthorized { + return &StatusFaveUnauthorized{} +} + +/* +StatusFaveUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusFaveUnauthorized struct { +} + +// IsSuccess returns true when this status fave unauthorized response has a 2xx status code +func (o *StatusFaveUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status fave unauthorized response has a 3xx status code +func (o *StatusFaveUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status fave unauthorized response has a 4xx status code +func (o *StatusFaveUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status fave unauthorized response has a 5xx status code +func (o *StatusFaveUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status fave unauthorized response a status code equal to that given +func (o *StatusFaveUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status fave unauthorized response +func (o *StatusFaveUnauthorized) Code() int { + return 401 +} + +func (o *StatusFaveUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveUnauthorized", 401) +} + +func (o *StatusFaveUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveUnauthorized", 401) +} + +func (o *StatusFaveUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusFaveForbidden creates a StatusFaveForbidden with default headers values +func NewStatusFaveForbidden() *StatusFaveForbidden { + return &StatusFaveForbidden{} +} + +/* +StatusFaveForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusFaveForbidden struct { +} + +// IsSuccess returns true when this status fave forbidden response has a 2xx status code +func (o *StatusFaveForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status fave forbidden response has a 3xx status code +func (o *StatusFaveForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status fave forbidden response has a 4xx status code +func (o *StatusFaveForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status fave forbidden response has a 5xx status code +func (o *StatusFaveForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status fave forbidden response a status code equal to that given +func (o *StatusFaveForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status fave forbidden response +func (o *StatusFaveForbidden) Code() int { + return 403 +} + +func (o *StatusFaveForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveForbidden", 403) +} + +func (o *StatusFaveForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveForbidden", 403) +} + +func (o *StatusFaveForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusFaveNotFound creates a StatusFaveNotFound with default headers values +func NewStatusFaveNotFound() *StatusFaveNotFound { + return &StatusFaveNotFound{} +} + +/* +StatusFaveNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusFaveNotFound struct { +} + +// IsSuccess returns true when this status fave not found response has a 2xx status code +func (o *StatusFaveNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status fave not found response has a 3xx status code +func (o *StatusFaveNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status fave not found response has a 4xx status code +func (o *StatusFaveNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status fave not found response has a 5xx status code +func (o *StatusFaveNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status fave not found response a status code equal to that given +func (o *StatusFaveNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status fave not found response +func (o *StatusFaveNotFound) Code() int { + return 404 +} + +func (o *StatusFaveNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveNotFound", 404) +} + +func (o *StatusFaveNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveNotFound", 404) +} + +func (o *StatusFaveNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusFaveNotAcceptable creates a StatusFaveNotAcceptable with default headers values +func NewStatusFaveNotAcceptable() *StatusFaveNotAcceptable { + return &StatusFaveNotAcceptable{} +} + +/* +StatusFaveNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusFaveNotAcceptable struct { +} + +// IsSuccess returns true when this status fave not acceptable response has a 2xx status code +func (o *StatusFaveNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status fave not acceptable response has a 3xx status code +func (o *StatusFaveNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status fave not acceptable response has a 4xx status code +func (o *StatusFaveNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status fave not acceptable response has a 5xx status code +func (o *StatusFaveNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status fave not acceptable response a status code equal to that given +func (o *StatusFaveNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status fave not acceptable response +func (o *StatusFaveNotAcceptable) Code() int { + return 406 +} + +func (o *StatusFaveNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveNotAcceptable", 406) +} + +func (o *StatusFaveNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveNotAcceptable", 406) +} + +func (o *StatusFaveNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusFaveInternalServerError creates a StatusFaveInternalServerError with default headers values +func NewStatusFaveInternalServerError() *StatusFaveInternalServerError { + return &StatusFaveInternalServerError{} +} + +/* +StatusFaveInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusFaveInternalServerError struct { +} + +// IsSuccess returns true when this status fave internal server error response has a 2xx status code +func (o *StatusFaveInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status fave internal server error response has a 3xx status code +func (o *StatusFaveInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status fave internal server error response has a 4xx status code +func (o *StatusFaveInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status fave internal server error response has a 5xx status code +func (o *StatusFaveInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status fave internal server error response a status code equal to that given +func (o *StatusFaveInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status fave internal server error response +func (o *StatusFaveInternalServerError) Code() int { + return 500 +} + +func (o *StatusFaveInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveInternalServerError", 500) +} + +func (o *StatusFaveInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveInternalServerError", 500) +} + +func (o *StatusFaveInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_faved_by_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_faved_by_parameters.go new file mode 100644 index 0000000..7517d8f --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_faved_by_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusFavedByParams creates a new StatusFavedByParams 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 NewStatusFavedByParams() *StatusFavedByParams { + return &StatusFavedByParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusFavedByParamsWithTimeout creates a new StatusFavedByParams object +// with the ability to set a timeout on a request. +func NewStatusFavedByParamsWithTimeout(timeout time.Duration) *StatusFavedByParams { + return &StatusFavedByParams{ + timeout: timeout, + } +} + +// NewStatusFavedByParamsWithContext creates a new StatusFavedByParams object +// with the ability to set a context for a request. +func NewStatusFavedByParamsWithContext(ctx context.Context) *StatusFavedByParams { + return &StatusFavedByParams{ + Context: ctx, + } +} + +// NewStatusFavedByParamsWithHTTPClient creates a new StatusFavedByParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusFavedByParamsWithHTTPClient(client *http.Client) *StatusFavedByParams { + return &StatusFavedByParams{ + HTTPClient: client, + } +} + +/* +StatusFavedByParams contains all the parameters to send to the API endpoint + + for the status faved by operation. + + Typically these are written to a http.Request. +*/ +type StatusFavedByParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status faved by params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusFavedByParams) WithDefaults() *StatusFavedByParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status faved by params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusFavedByParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status faved by params +func (o *StatusFavedByParams) WithTimeout(timeout time.Duration) *StatusFavedByParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status faved by params +func (o *StatusFavedByParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status faved by params +func (o *StatusFavedByParams) WithContext(ctx context.Context) *StatusFavedByParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status faved by params +func (o *StatusFavedByParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status faved by params +func (o *StatusFavedByParams) WithHTTPClient(client *http.Client) *StatusFavedByParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status faved by params +func (o *StatusFavedByParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status faved by params +func (o *StatusFavedByParams) WithID(id string) *StatusFavedByParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status faved by params +func (o *StatusFavedByParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusFavedByParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_faved_by_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_faved_by_responses.go new file mode 100644 index 0000000..52dae22 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_faved_by_responses.go @@ -0,0 +1,476 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusFavedByReader is a Reader for the StatusFavedBy structure. +type StatusFavedByReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusFavedByReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusFavedByOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusFavedByBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusFavedByUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusFavedByForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusFavedByNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusFavedByNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusFavedByInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/statuses/{id}/favourited_by] statusFavedBy", response, response.Code()) + } +} + +// NewStatusFavedByOK creates a StatusFavedByOK with default headers values +func NewStatusFavedByOK() *StatusFavedByOK { + return &StatusFavedByOK{} +} + +/* +StatusFavedByOK describes a response with status code 200, with default header values. + +StatusFavedByOK status faved by o k +*/ +type StatusFavedByOK struct { + Payload []*models.Account +} + +// IsSuccess returns true when this status faved by o k response has a 2xx status code +func (o *StatusFavedByOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status faved by o k response has a 3xx status code +func (o *StatusFavedByOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status faved by o k response has a 4xx status code +func (o *StatusFavedByOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status faved by o k response has a 5xx status code +func (o *StatusFavedByOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status faved by o k response a status code equal to that given +func (o *StatusFavedByOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status faved by o k response +func (o *StatusFavedByOK) Code() int { + return 200 +} + +func (o *StatusFavedByOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByOK %s", 200, payload) +} + +func (o *StatusFavedByOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByOK %s", 200, payload) +} + +func (o *StatusFavedByOK) GetPayload() []*models.Account { + return o.Payload +} + +func (o *StatusFavedByOK) 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 +} + +// NewStatusFavedByBadRequest creates a StatusFavedByBadRequest with default headers values +func NewStatusFavedByBadRequest() *StatusFavedByBadRequest { + return &StatusFavedByBadRequest{} +} + +/* +StatusFavedByBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusFavedByBadRequest struct { +} + +// IsSuccess returns true when this status faved by bad request response has a 2xx status code +func (o *StatusFavedByBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status faved by bad request response has a 3xx status code +func (o *StatusFavedByBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status faved by bad request response has a 4xx status code +func (o *StatusFavedByBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status faved by bad request response has a 5xx status code +func (o *StatusFavedByBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status faved by bad request response a status code equal to that given +func (o *StatusFavedByBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status faved by bad request response +func (o *StatusFavedByBadRequest) Code() int { + return 400 +} + +func (o *StatusFavedByBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByBadRequest", 400) +} + +func (o *StatusFavedByBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByBadRequest", 400) +} + +func (o *StatusFavedByBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusFavedByUnauthorized creates a StatusFavedByUnauthorized with default headers values +func NewStatusFavedByUnauthorized() *StatusFavedByUnauthorized { + return &StatusFavedByUnauthorized{} +} + +/* +StatusFavedByUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusFavedByUnauthorized struct { +} + +// IsSuccess returns true when this status faved by unauthorized response has a 2xx status code +func (o *StatusFavedByUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status faved by unauthorized response has a 3xx status code +func (o *StatusFavedByUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status faved by unauthorized response has a 4xx status code +func (o *StatusFavedByUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status faved by unauthorized response has a 5xx status code +func (o *StatusFavedByUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status faved by unauthorized response a status code equal to that given +func (o *StatusFavedByUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status faved by unauthorized response +func (o *StatusFavedByUnauthorized) Code() int { + return 401 +} + +func (o *StatusFavedByUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByUnauthorized", 401) +} + +func (o *StatusFavedByUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByUnauthorized", 401) +} + +func (o *StatusFavedByUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusFavedByForbidden creates a StatusFavedByForbidden with default headers values +func NewStatusFavedByForbidden() *StatusFavedByForbidden { + return &StatusFavedByForbidden{} +} + +/* +StatusFavedByForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusFavedByForbidden struct { +} + +// IsSuccess returns true when this status faved by forbidden response has a 2xx status code +func (o *StatusFavedByForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status faved by forbidden response has a 3xx status code +func (o *StatusFavedByForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status faved by forbidden response has a 4xx status code +func (o *StatusFavedByForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status faved by forbidden response has a 5xx status code +func (o *StatusFavedByForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status faved by forbidden response a status code equal to that given +func (o *StatusFavedByForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status faved by forbidden response +func (o *StatusFavedByForbidden) Code() int { + return 403 +} + +func (o *StatusFavedByForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByForbidden", 403) +} + +func (o *StatusFavedByForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByForbidden", 403) +} + +func (o *StatusFavedByForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusFavedByNotFound creates a StatusFavedByNotFound with default headers values +func NewStatusFavedByNotFound() *StatusFavedByNotFound { + return &StatusFavedByNotFound{} +} + +/* +StatusFavedByNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusFavedByNotFound struct { +} + +// IsSuccess returns true when this status faved by not found response has a 2xx status code +func (o *StatusFavedByNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status faved by not found response has a 3xx status code +func (o *StatusFavedByNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status faved by not found response has a 4xx status code +func (o *StatusFavedByNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status faved by not found response has a 5xx status code +func (o *StatusFavedByNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status faved by not found response a status code equal to that given +func (o *StatusFavedByNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status faved by not found response +func (o *StatusFavedByNotFound) Code() int { + return 404 +} + +func (o *StatusFavedByNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByNotFound", 404) +} + +func (o *StatusFavedByNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByNotFound", 404) +} + +func (o *StatusFavedByNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusFavedByNotAcceptable creates a StatusFavedByNotAcceptable with default headers values +func NewStatusFavedByNotAcceptable() *StatusFavedByNotAcceptable { + return &StatusFavedByNotAcceptable{} +} + +/* +StatusFavedByNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusFavedByNotAcceptable struct { +} + +// IsSuccess returns true when this status faved by not acceptable response has a 2xx status code +func (o *StatusFavedByNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status faved by not acceptable response has a 3xx status code +func (o *StatusFavedByNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status faved by not acceptable response has a 4xx status code +func (o *StatusFavedByNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status faved by not acceptable response has a 5xx status code +func (o *StatusFavedByNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status faved by not acceptable response a status code equal to that given +func (o *StatusFavedByNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status faved by not acceptable response +func (o *StatusFavedByNotAcceptable) Code() int { + return 406 +} + +func (o *StatusFavedByNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByNotAcceptable", 406) +} + +func (o *StatusFavedByNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByNotAcceptable", 406) +} + +func (o *StatusFavedByNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusFavedByInternalServerError creates a StatusFavedByInternalServerError with default headers values +func NewStatusFavedByInternalServerError() *StatusFavedByInternalServerError { + return &StatusFavedByInternalServerError{} +} + +/* +StatusFavedByInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusFavedByInternalServerError struct { +} + +// IsSuccess returns true when this status faved by internal server error response has a 2xx status code +func (o *StatusFavedByInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status faved by internal server error response has a 3xx status code +func (o *StatusFavedByInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status faved by internal server error response has a 4xx status code +func (o *StatusFavedByInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status faved by internal server error response has a 5xx status code +func (o *StatusFavedByInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status faved by internal server error response a status code equal to that given +func (o *StatusFavedByInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status faved by internal server error response +func (o *StatusFavedByInternalServerError) Code() int { + return 500 +} + +func (o *StatusFavedByInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByInternalServerError", 500) +} + +func (o *StatusFavedByInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByInternalServerError", 500) +} + +func (o *StatusFavedByInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_get_parameters.go new file mode 100644 index 0000000..e21d586 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusGetParams creates a new StatusGetParams 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 NewStatusGetParams() *StatusGetParams { + return &StatusGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusGetParamsWithTimeout creates a new StatusGetParams object +// with the ability to set a timeout on a request. +func NewStatusGetParamsWithTimeout(timeout time.Duration) *StatusGetParams { + return &StatusGetParams{ + timeout: timeout, + } +} + +// NewStatusGetParamsWithContext creates a new StatusGetParams object +// with the ability to set a context for a request. +func NewStatusGetParamsWithContext(ctx context.Context) *StatusGetParams { + return &StatusGetParams{ + Context: ctx, + } +} + +// NewStatusGetParamsWithHTTPClient creates a new StatusGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusGetParamsWithHTTPClient(client *http.Client) *StatusGetParams { + return &StatusGetParams{ + HTTPClient: client, + } +} + +/* +StatusGetParams contains all the parameters to send to the API endpoint + + for the status get operation. + + Typically these are written to a http.Request. +*/ +type StatusGetParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusGetParams) WithDefaults() *StatusGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status get params +func (o *StatusGetParams) WithTimeout(timeout time.Duration) *StatusGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status get params +func (o *StatusGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status get params +func (o *StatusGetParams) WithContext(ctx context.Context) *StatusGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status get params +func (o *StatusGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status get params +func (o *StatusGetParams) WithHTTPClient(client *http.Client) *StatusGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status get params +func (o *StatusGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status get params +func (o *StatusGetParams) WithID(id string) *StatusGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status get params +func (o *StatusGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_get_responses.go new file mode 100644 index 0000000..6ac57b1 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_get_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusGetReader is a Reader for the StatusGet structure. +type StatusGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/statuses/{id}] statusGet", response, response.Code()) + } +} + +// NewStatusGetOK creates a StatusGetOK with default headers values +func NewStatusGetOK() *StatusGetOK { + return &StatusGetOK{} +} + +/* +StatusGetOK describes a response with status code 200, with default header values. + +The requested status. +*/ +type StatusGetOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status get o k response has a 2xx status code +func (o *StatusGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status get o k response has a 3xx status code +func (o *StatusGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status get o k response has a 4xx status code +func (o *StatusGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status get o k response has a 5xx status code +func (o *StatusGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status get o k response a status code equal to that given +func (o *StatusGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status get o k response +func (o *StatusGetOK) Code() int { + return 200 +} + +func (o *StatusGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetOK %s", 200, payload) +} + +func (o *StatusGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetOK %s", 200, payload) +} + +func (o *StatusGetOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusGetBadRequest creates a StatusGetBadRequest with default headers values +func NewStatusGetBadRequest() *StatusGetBadRequest { + return &StatusGetBadRequest{} +} + +/* +StatusGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusGetBadRequest struct { +} + +// IsSuccess returns true when this status get bad request response has a 2xx status code +func (o *StatusGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status get bad request response has a 3xx status code +func (o *StatusGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status get bad request response has a 4xx status code +func (o *StatusGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status get bad request response has a 5xx status code +func (o *StatusGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status get bad request response a status code equal to that given +func (o *StatusGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status get bad request response +func (o *StatusGetBadRequest) Code() int { + return 400 +} + +func (o *StatusGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetBadRequest", 400) +} + +func (o *StatusGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetBadRequest", 400) +} + +func (o *StatusGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusGetUnauthorized creates a StatusGetUnauthorized with default headers values +func NewStatusGetUnauthorized() *StatusGetUnauthorized { + return &StatusGetUnauthorized{} +} + +/* +StatusGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusGetUnauthorized struct { +} + +// IsSuccess returns true when this status get unauthorized response has a 2xx status code +func (o *StatusGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status get unauthorized response has a 3xx status code +func (o *StatusGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status get unauthorized response has a 4xx status code +func (o *StatusGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status get unauthorized response has a 5xx status code +func (o *StatusGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status get unauthorized response a status code equal to that given +func (o *StatusGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status get unauthorized response +func (o *StatusGetUnauthorized) Code() int { + return 401 +} + +func (o *StatusGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetUnauthorized", 401) +} + +func (o *StatusGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetUnauthorized", 401) +} + +func (o *StatusGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusGetForbidden creates a StatusGetForbidden with default headers values +func NewStatusGetForbidden() *StatusGetForbidden { + return &StatusGetForbidden{} +} + +/* +StatusGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusGetForbidden struct { +} + +// IsSuccess returns true when this status get forbidden response has a 2xx status code +func (o *StatusGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status get forbidden response has a 3xx status code +func (o *StatusGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status get forbidden response has a 4xx status code +func (o *StatusGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status get forbidden response has a 5xx status code +func (o *StatusGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status get forbidden response a status code equal to that given +func (o *StatusGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status get forbidden response +func (o *StatusGetForbidden) Code() int { + return 403 +} + +func (o *StatusGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetForbidden", 403) +} + +func (o *StatusGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetForbidden", 403) +} + +func (o *StatusGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusGetNotFound creates a StatusGetNotFound with default headers values +func NewStatusGetNotFound() *StatusGetNotFound { + return &StatusGetNotFound{} +} + +/* +StatusGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusGetNotFound struct { +} + +// IsSuccess returns true when this status get not found response has a 2xx status code +func (o *StatusGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status get not found response has a 3xx status code +func (o *StatusGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status get not found response has a 4xx status code +func (o *StatusGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status get not found response has a 5xx status code +func (o *StatusGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status get not found response a status code equal to that given +func (o *StatusGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status get not found response +func (o *StatusGetNotFound) Code() int { + return 404 +} + +func (o *StatusGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetNotFound", 404) +} + +func (o *StatusGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetNotFound", 404) +} + +func (o *StatusGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusGetNotAcceptable creates a StatusGetNotAcceptable with default headers values +func NewStatusGetNotAcceptable() *StatusGetNotAcceptable { + return &StatusGetNotAcceptable{} +} + +/* +StatusGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusGetNotAcceptable struct { +} + +// IsSuccess returns true when this status get not acceptable response has a 2xx status code +func (o *StatusGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status get not acceptable response has a 3xx status code +func (o *StatusGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status get not acceptable response has a 4xx status code +func (o *StatusGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status get not acceptable response has a 5xx status code +func (o *StatusGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status get not acceptable response a status code equal to that given +func (o *StatusGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status get not acceptable response +func (o *StatusGetNotAcceptable) Code() int { + return 406 +} + +func (o *StatusGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetNotAcceptable", 406) +} + +func (o *StatusGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetNotAcceptable", 406) +} + +func (o *StatusGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusGetInternalServerError creates a StatusGetInternalServerError with default headers values +func NewStatusGetInternalServerError() *StatusGetInternalServerError { + return &StatusGetInternalServerError{} +} + +/* +StatusGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusGetInternalServerError struct { +} + +// IsSuccess returns true when this status get internal server error response has a 2xx status code +func (o *StatusGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status get internal server error response has a 3xx status code +func (o *StatusGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status get internal server error response has a 4xx status code +func (o *StatusGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status get internal server error response has a 5xx status code +func (o *StatusGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status get internal server error response a status code equal to that given +func (o *StatusGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status get internal server error response +func (o *StatusGetInternalServerError) Code() int { + return 500 +} + +func (o *StatusGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetInternalServerError", 500) +} + +func (o *StatusGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetInternalServerError", 500) +} + +func (o *StatusGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_history_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_history_get_parameters.go new file mode 100644 index 0000000..1b5c6e2 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_history_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusHistoryGetParams creates a new StatusHistoryGetParams 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 NewStatusHistoryGetParams() *StatusHistoryGetParams { + return &StatusHistoryGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusHistoryGetParamsWithTimeout creates a new StatusHistoryGetParams object +// with the ability to set a timeout on a request. +func NewStatusHistoryGetParamsWithTimeout(timeout time.Duration) *StatusHistoryGetParams { + return &StatusHistoryGetParams{ + timeout: timeout, + } +} + +// NewStatusHistoryGetParamsWithContext creates a new StatusHistoryGetParams object +// with the ability to set a context for a request. +func NewStatusHistoryGetParamsWithContext(ctx context.Context) *StatusHistoryGetParams { + return &StatusHistoryGetParams{ + Context: ctx, + } +} + +// NewStatusHistoryGetParamsWithHTTPClient creates a new StatusHistoryGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusHistoryGetParamsWithHTTPClient(client *http.Client) *StatusHistoryGetParams { + return &StatusHistoryGetParams{ + HTTPClient: client, + } +} + +/* +StatusHistoryGetParams contains all the parameters to send to the API endpoint + + for the status history get operation. + + Typically these are written to a http.Request. +*/ +type StatusHistoryGetParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status history get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusHistoryGetParams) WithDefaults() *StatusHistoryGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status history get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusHistoryGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status history get params +func (o *StatusHistoryGetParams) WithTimeout(timeout time.Duration) *StatusHistoryGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status history get params +func (o *StatusHistoryGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status history get params +func (o *StatusHistoryGetParams) WithContext(ctx context.Context) *StatusHistoryGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status history get params +func (o *StatusHistoryGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status history get params +func (o *StatusHistoryGetParams) WithHTTPClient(client *http.Client) *StatusHistoryGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status history get params +func (o *StatusHistoryGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status history get params +func (o *StatusHistoryGetParams) WithID(id string) *StatusHistoryGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status history get params +func (o *StatusHistoryGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusHistoryGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_history_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_history_get_responses.go new file mode 100644 index 0000000..f333a73 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_history_get_responses.go @@ -0,0 +1,476 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusHistoryGetReader is a Reader for the StatusHistoryGet structure. +type StatusHistoryGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusHistoryGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusHistoryGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusHistoryGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusHistoryGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusHistoryGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusHistoryGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusHistoryGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusHistoryGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/statuses/{id}/history] statusHistoryGet", response, response.Code()) + } +} + +// NewStatusHistoryGetOK creates a StatusHistoryGetOK with default headers values +func NewStatusHistoryGetOK() *StatusHistoryGetOK { + return &StatusHistoryGetOK{} +} + +/* +StatusHistoryGetOK describes a response with status code 200, with default header values. + +StatusHistoryGetOK status history get o k +*/ +type StatusHistoryGetOK struct { + Payload []*models.StatusEdit +} + +// IsSuccess returns true when this status history get o k response has a 2xx status code +func (o *StatusHistoryGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status history get o k response has a 3xx status code +func (o *StatusHistoryGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status history get o k response has a 4xx status code +func (o *StatusHistoryGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status history get o k response has a 5xx status code +func (o *StatusHistoryGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status history get o k response a status code equal to that given +func (o *StatusHistoryGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status history get o k response +func (o *StatusHistoryGetOK) Code() int { + return 200 +} + +func (o *StatusHistoryGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetOK %s", 200, payload) +} + +func (o *StatusHistoryGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetOK %s", 200, payload) +} + +func (o *StatusHistoryGetOK) GetPayload() []*models.StatusEdit { + return o.Payload +} + +func (o *StatusHistoryGetOK) 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 +} + +// NewStatusHistoryGetBadRequest creates a StatusHistoryGetBadRequest with default headers values +func NewStatusHistoryGetBadRequest() *StatusHistoryGetBadRequest { + return &StatusHistoryGetBadRequest{} +} + +/* +StatusHistoryGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusHistoryGetBadRequest struct { +} + +// IsSuccess returns true when this status history get bad request response has a 2xx status code +func (o *StatusHistoryGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status history get bad request response has a 3xx status code +func (o *StatusHistoryGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status history get bad request response has a 4xx status code +func (o *StatusHistoryGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status history get bad request response has a 5xx status code +func (o *StatusHistoryGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status history get bad request response a status code equal to that given +func (o *StatusHistoryGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status history get bad request response +func (o *StatusHistoryGetBadRequest) Code() int { + return 400 +} + +func (o *StatusHistoryGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetBadRequest", 400) +} + +func (o *StatusHistoryGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetBadRequest", 400) +} + +func (o *StatusHistoryGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusHistoryGetUnauthorized creates a StatusHistoryGetUnauthorized with default headers values +func NewStatusHistoryGetUnauthorized() *StatusHistoryGetUnauthorized { + return &StatusHistoryGetUnauthorized{} +} + +/* +StatusHistoryGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusHistoryGetUnauthorized struct { +} + +// IsSuccess returns true when this status history get unauthorized response has a 2xx status code +func (o *StatusHistoryGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status history get unauthorized response has a 3xx status code +func (o *StatusHistoryGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status history get unauthorized response has a 4xx status code +func (o *StatusHistoryGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status history get unauthorized response has a 5xx status code +func (o *StatusHistoryGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status history get unauthorized response a status code equal to that given +func (o *StatusHistoryGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status history get unauthorized response +func (o *StatusHistoryGetUnauthorized) Code() int { + return 401 +} + +func (o *StatusHistoryGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetUnauthorized", 401) +} + +func (o *StatusHistoryGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetUnauthorized", 401) +} + +func (o *StatusHistoryGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusHistoryGetForbidden creates a StatusHistoryGetForbidden with default headers values +func NewStatusHistoryGetForbidden() *StatusHistoryGetForbidden { + return &StatusHistoryGetForbidden{} +} + +/* +StatusHistoryGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusHistoryGetForbidden struct { +} + +// IsSuccess returns true when this status history get forbidden response has a 2xx status code +func (o *StatusHistoryGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status history get forbidden response has a 3xx status code +func (o *StatusHistoryGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status history get forbidden response has a 4xx status code +func (o *StatusHistoryGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status history get forbidden response has a 5xx status code +func (o *StatusHistoryGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status history get forbidden response a status code equal to that given +func (o *StatusHistoryGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status history get forbidden response +func (o *StatusHistoryGetForbidden) Code() int { + return 403 +} + +func (o *StatusHistoryGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetForbidden", 403) +} + +func (o *StatusHistoryGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetForbidden", 403) +} + +func (o *StatusHistoryGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusHistoryGetNotFound creates a StatusHistoryGetNotFound with default headers values +func NewStatusHistoryGetNotFound() *StatusHistoryGetNotFound { + return &StatusHistoryGetNotFound{} +} + +/* +StatusHistoryGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusHistoryGetNotFound struct { +} + +// IsSuccess returns true when this status history get not found response has a 2xx status code +func (o *StatusHistoryGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status history get not found response has a 3xx status code +func (o *StatusHistoryGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status history get not found response has a 4xx status code +func (o *StatusHistoryGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status history get not found response has a 5xx status code +func (o *StatusHistoryGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status history get not found response a status code equal to that given +func (o *StatusHistoryGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status history get not found response +func (o *StatusHistoryGetNotFound) Code() int { + return 404 +} + +func (o *StatusHistoryGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetNotFound", 404) +} + +func (o *StatusHistoryGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetNotFound", 404) +} + +func (o *StatusHistoryGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusHistoryGetNotAcceptable creates a StatusHistoryGetNotAcceptable with default headers values +func NewStatusHistoryGetNotAcceptable() *StatusHistoryGetNotAcceptable { + return &StatusHistoryGetNotAcceptable{} +} + +/* +StatusHistoryGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusHistoryGetNotAcceptable struct { +} + +// IsSuccess returns true when this status history get not acceptable response has a 2xx status code +func (o *StatusHistoryGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status history get not acceptable response has a 3xx status code +func (o *StatusHistoryGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status history get not acceptable response has a 4xx status code +func (o *StatusHistoryGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status history get not acceptable response has a 5xx status code +func (o *StatusHistoryGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status history get not acceptable response a status code equal to that given +func (o *StatusHistoryGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status history get not acceptable response +func (o *StatusHistoryGetNotAcceptable) Code() int { + return 406 +} + +func (o *StatusHistoryGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetNotAcceptable", 406) +} + +func (o *StatusHistoryGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetNotAcceptable", 406) +} + +func (o *StatusHistoryGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusHistoryGetInternalServerError creates a StatusHistoryGetInternalServerError with default headers values +func NewStatusHistoryGetInternalServerError() *StatusHistoryGetInternalServerError { + return &StatusHistoryGetInternalServerError{} +} + +/* +StatusHistoryGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusHistoryGetInternalServerError struct { +} + +// IsSuccess returns true when this status history get internal server error response has a 2xx status code +func (o *StatusHistoryGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status history get internal server error response has a 3xx status code +func (o *StatusHistoryGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status history get internal server error response has a 4xx status code +func (o *StatusHistoryGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status history get internal server error response has a 5xx status code +func (o *StatusHistoryGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status history get internal server error response a status code equal to that given +func (o *StatusHistoryGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status history get internal server error response +func (o *StatusHistoryGetInternalServerError) Code() int { + return 500 +} + +func (o *StatusHistoryGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetInternalServerError", 500) +} + +func (o *StatusHistoryGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetInternalServerError", 500) +} + +func (o *StatusHistoryGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_mute_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_mute_parameters.go new file mode 100644 index 0000000..374f9e8 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_mute_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusMuteParams creates a new StatusMuteParams 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 NewStatusMuteParams() *StatusMuteParams { + return &StatusMuteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusMuteParamsWithTimeout creates a new StatusMuteParams object +// with the ability to set a timeout on a request. +func NewStatusMuteParamsWithTimeout(timeout time.Duration) *StatusMuteParams { + return &StatusMuteParams{ + timeout: timeout, + } +} + +// NewStatusMuteParamsWithContext creates a new StatusMuteParams object +// with the ability to set a context for a request. +func NewStatusMuteParamsWithContext(ctx context.Context) *StatusMuteParams { + return &StatusMuteParams{ + Context: ctx, + } +} + +// NewStatusMuteParamsWithHTTPClient creates a new StatusMuteParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusMuteParamsWithHTTPClient(client *http.Client) *StatusMuteParams { + return &StatusMuteParams{ + HTTPClient: client, + } +} + +/* +StatusMuteParams contains all the parameters to send to the API endpoint + + for the status mute operation. + + Typically these are written to a http.Request. +*/ +type StatusMuteParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status mute params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusMuteParams) WithDefaults() *StatusMuteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status mute params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusMuteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status mute params +func (o *StatusMuteParams) WithTimeout(timeout time.Duration) *StatusMuteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status mute params +func (o *StatusMuteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status mute params +func (o *StatusMuteParams) WithContext(ctx context.Context) *StatusMuteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status mute params +func (o *StatusMuteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status mute params +func (o *StatusMuteParams) WithHTTPClient(client *http.Client) *StatusMuteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status mute params +func (o *StatusMuteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status mute params +func (o *StatusMuteParams) WithID(id string) *StatusMuteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status mute params +func (o *StatusMuteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusMuteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_mute_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_mute_responses.go new file mode 100644 index 0000000..ce52efd --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_mute_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusMuteReader is a Reader for the StatusMute structure. +type StatusMuteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusMuteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusMuteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusMuteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusMuteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusMuteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusMuteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusMuteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusMuteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses/{id}/mute] statusMute", response, response.Code()) + } +} + +// NewStatusMuteOK creates a StatusMuteOK with default headers values +func NewStatusMuteOK() *StatusMuteOK { + return &StatusMuteOK{} +} + +/* +StatusMuteOK describes a response with status code 200, with default header values. + +The now-muted status. +*/ +type StatusMuteOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status mute o k response has a 2xx status code +func (o *StatusMuteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status mute o k response has a 3xx status code +func (o *StatusMuteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status mute o k response has a 4xx status code +func (o *StatusMuteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status mute o k response has a 5xx status code +func (o *StatusMuteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status mute o k response a status code equal to that given +func (o *StatusMuteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status mute o k response +func (o *StatusMuteOK) Code() int { + return 200 +} + +func (o *StatusMuteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteOK %s", 200, payload) +} + +func (o *StatusMuteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteOK %s", 200, payload) +} + +func (o *StatusMuteOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusMuteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusMuteBadRequest creates a StatusMuteBadRequest with default headers values +func NewStatusMuteBadRequest() *StatusMuteBadRequest { + return &StatusMuteBadRequest{} +} + +/* +StatusMuteBadRequest describes a response with status code 400, with default header values. + +bad request; you're not part of the target status thread +*/ +type StatusMuteBadRequest struct { +} + +// IsSuccess returns true when this status mute bad request response has a 2xx status code +func (o *StatusMuteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status mute bad request response has a 3xx status code +func (o *StatusMuteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status mute bad request response has a 4xx status code +func (o *StatusMuteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status mute bad request response has a 5xx status code +func (o *StatusMuteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status mute bad request response a status code equal to that given +func (o *StatusMuteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status mute bad request response +func (o *StatusMuteBadRequest) Code() int { + return 400 +} + +func (o *StatusMuteBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteBadRequest", 400) +} + +func (o *StatusMuteBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteBadRequest", 400) +} + +func (o *StatusMuteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusMuteUnauthorized creates a StatusMuteUnauthorized with default headers values +func NewStatusMuteUnauthorized() *StatusMuteUnauthorized { + return &StatusMuteUnauthorized{} +} + +/* +StatusMuteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusMuteUnauthorized struct { +} + +// IsSuccess returns true when this status mute unauthorized response has a 2xx status code +func (o *StatusMuteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status mute unauthorized response has a 3xx status code +func (o *StatusMuteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status mute unauthorized response has a 4xx status code +func (o *StatusMuteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status mute unauthorized response has a 5xx status code +func (o *StatusMuteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status mute unauthorized response a status code equal to that given +func (o *StatusMuteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status mute unauthorized response +func (o *StatusMuteUnauthorized) Code() int { + return 401 +} + +func (o *StatusMuteUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteUnauthorized", 401) +} + +func (o *StatusMuteUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteUnauthorized", 401) +} + +func (o *StatusMuteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusMuteForbidden creates a StatusMuteForbidden with default headers values +func NewStatusMuteForbidden() *StatusMuteForbidden { + return &StatusMuteForbidden{} +} + +/* +StatusMuteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusMuteForbidden struct { +} + +// IsSuccess returns true when this status mute forbidden response has a 2xx status code +func (o *StatusMuteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status mute forbidden response has a 3xx status code +func (o *StatusMuteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status mute forbidden response has a 4xx status code +func (o *StatusMuteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status mute forbidden response has a 5xx status code +func (o *StatusMuteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status mute forbidden response a status code equal to that given +func (o *StatusMuteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status mute forbidden response +func (o *StatusMuteForbidden) Code() int { + return 403 +} + +func (o *StatusMuteForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteForbidden", 403) +} + +func (o *StatusMuteForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteForbidden", 403) +} + +func (o *StatusMuteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusMuteNotFound creates a StatusMuteNotFound with default headers values +func NewStatusMuteNotFound() *StatusMuteNotFound { + return &StatusMuteNotFound{} +} + +/* +StatusMuteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusMuteNotFound struct { +} + +// IsSuccess returns true when this status mute not found response has a 2xx status code +func (o *StatusMuteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status mute not found response has a 3xx status code +func (o *StatusMuteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status mute not found response has a 4xx status code +func (o *StatusMuteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status mute not found response has a 5xx status code +func (o *StatusMuteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status mute not found response a status code equal to that given +func (o *StatusMuteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status mute not found response +func (o *StatusMuteNotFound) Code() int { + return 404 +} + +func (o *StatusMuteNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteNotFound", 404) +} + +func (o *StatusMuteNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteNotFound", 404) +} + +func (o *StatusMuteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusMuteNotAcceptable creates a StatusMuteNotAcceptable with default headers values +func NewStatusMuteNotAcceptable() *StatusMuteNotAcceptable { + return &StatusMuteNotAcceptable{} +} + +/* +StatusMuteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusMuteNotAcceptable struct { +} + +// IsSuccess returns true when this status mute not acceptable response has a 2xx status code +func (o *StatusMuteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status mute not acceptable response has a 3xx status code +func (o *StatusMuteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status mute not acceptable response has a 4xx status code +func (o *StatusMuteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status mute not acceptable response has a 5xx status code +func (o *StatusMuteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status mute not acceptable response a status code equal to that given +func (o *StatusMuteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status mute not acceptable response +func (o *StatusMuteNotAcceptable) Code() int { + return 406 +} + +func (o *StatusMuteNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteNotAcceptable", 406) +} + +func (o *StatusMuteNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteNotAcceptable", 406) +} + +func (o *StatusMuteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusMuteInternalServerError creates a StatusMuteInternalServerError with default headers values +func NewStatusMuteInternalServerError() *StatusMuteInternalServerError { + return &StatusMuteInternalServerError{} +} + +/* +StatusMuteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusMuteInternalServerError struct { +} + +// IsSuccess returns true when this status mute internal server error response has a 2xx status code +func (o *StatusMuteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status mute internal server error response has a 3xx status code +func (o *StatusMuteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status mute internal server error response has a 4xx status code +func (o *StatusMuteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status mute internal server error response has a 5xx status code +func (o *StatusMuteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status mute internal server error response a status code equal to that given +func (o *StatusMuteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status mute internal server error response +func (o *StatusMuteInternalServerError) Code() int { + return 500 +} + +func (o *StatusMuteInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteInternalServerError", 500) +} + +func (o *StatusMuteInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteInternalServerError", 500) +} + +func (o *StatusMuteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_pin_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_pin_parameters.go new file mode 100644 index 0000000..0601477 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_pin_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusPinParams creates a new StatusPinParams 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 NewStatusPinParams() *StatusPinParams { + return &StatusPinParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusPinParamsWithTimeout creates a new StatusPinParams object +// with the ability to set a timeout on a request. +func NewStatusPinParamsWithTimeout(timeout time.Duration) *StatusPinParams { + return &StatusPinParams{ + timeout: timeout, + } +} + +// NewStatusPinParamsWithContext creates a new StatusPinParams object +// with the ability to set a context for a request. +func NewStatusPinParamsWithContext(ctx context.Context) *StatusPinParams { + return &StatusPinParams{ + Context: ctx, + } +} + +// NewStatusPinParamsWithHTTPClient creates a new StatusPinParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusPinParamsWithHTTPClient(client *http.Client) *StatusPinParams { + return &StatusPinParams{ + HTTPClient: client, + } +} + +/* +StatusPinParams contains all the parameters to send to the API endpoint + + for the status pin operation. + + Typically these are written to a http.Request. +*/ +type StatusPinParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status pin params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusPinParams) WithDefaults() *StatusPinParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status pin params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusPinParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status pin params +func (o *StatusPinParams) WithTimeout(timeout time.Duration) *StatusPinParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status pin params +func (o *StatusPinParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status pin params +func (o *StatusPinParams) WithContext(ctx context.Context) *StatusPinParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status pin params +func (o *StatusPinParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status pin params +func (o *StatusPinParams) WithHTTPClient(client *http.Client) *StatusPinParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status pin params +func (o *StatusPinParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status pin params +func (o *StatusPinParams) WithID(id string) *StatusPinParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status pin params +func (o *StatusPinParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusPinParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_pin_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_pin_responses.go new file mode 100644 index 0000000..d1a4b03 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_pin_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusPinReader is a Reader for the StatusPin structure. +type StatusPinReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusPinReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusPinOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusPinBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusPinUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusPinForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusPinNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusPinNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusPinInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses/{id}/pin] statusPin", response, response.Code()) + } +} + +// NewStatusPinOK creates a StatusPinOK with default headers values +func NewStatusPinOK() *StatusPinOK { + return &StatusPinOK{} +} + +/* +StatusPinOK describes a response with status code 200, with default header values. + +The status. +*/ +type StatusPinOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status pin o k response has a 2xx status code +func (o *StatusPinOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status pin o k response has a 3xx status code +func (o *StatusPinOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status pin o k response has a 4xx status code +func (o *StatusPinOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status pin o k response has a 5xx status code +func (o *StatusPinOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status pin o k response a status code equal to that given +func (o *StatusPinOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status pin o k response +func (o *StatusPinOK) Code() int { + return 200 +} + +func (o *StatusPinOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinOK %s", 200, payload) +} + +func (o *StatusPinOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinOK %s", 200, payload) +} + +func (o *StatusPinOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusPinOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusPinBadRequest creates a StatusPinBadRequest with default headers values +func NewStatusPinBadRequest() *StatusPinBadRequest { + return &StatusPinBadRequest{} +} + +/* +StatusPinBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusPinBadRequest struct { +} + +// IsSuccess returns true when this status pin bad request response has a 2xx status code +func (o *StatusPinBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status pin bad request response has a 3xx status code +func (o *StatusPinBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status pin bad request response has a 4xx status code +func (o *StatusPinBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status pin bad request response has a 5xx status code +func (o *StatusPinBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status pin bad request response a status code equal to that given +func (o *StatusPinBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status pin bad request response +func (o *StatusPinBadRequest) Code() int { + return 400 +} + +func (o *StatusPinBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinBadRequest", 400) +} + +func (o *StatusPinBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinBadRequest", 400) +} + +func (o *StatusPinBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusPinUnauthorized creates a StatusPinUnauthorized with default headers values +func NewStatusPinUnauthorized() *StatusPinUnauthorized { + return &StatusPinUnauthorized{} +} + +/* +StatusPinUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusPinUnauthorized struct { +} + +// IsSuccess returns true when this status pin unauthorized response has a 2xx status code +func (o *StatusPinUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status pin unauthorized response has a 3xx status code +func (o *StatusPinUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status pin unauthorized response has a 4xx status code +func (o *StatusPinUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status pin unauthorized response has a 5xx status code +func (o *StatusPinUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status pin unauthorized response a status code equal to that given +func (o *StatusPinUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status pin unauthorized response +func (o *StatusPinUnauthorized) Code() int { + return 401 +} + +func (o *StatusPinUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinUnauthorized", 401) +} + +func (o *StatusPinUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinUnauthorized", 401) +} + +func (o *StatusPinUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusPinForbidden creates a StatusPinForbidden with default headers values +func NewStatusPinForbidden() *StatusPinForbidden { + return &StatusPinForbidden{} +} + +/* +StatusPinForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusPinForbidden struct { +} + +// IsSuccess returns true when this status pin forbidden response has a 2xx status code +func (o *StatusPinForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status pin forbidden response has a 3xx status code +func (o *StatusPinForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status pin forbidden response has a 4xx status code +func (o *StatusPinForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status pin forbidden response has a 5xx status code +func (o *StatusPinForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status pin forbidden response a status code equal to that given +func (o *StatusPinForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status pin forbidden response +func (o *StatusPinForbidden) Code() int { + return 403 +} + +func (o *StatusPinForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinForbidden", 403) +} + +func (o *StatusPinForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinForbidden", 403) +} + +func (o *StatusPinForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusPinNotFound creates a StatusPinNotFound with default headers values +func NewStatusPinNotFound() *StatusPinNotFound { + return &StatusPinNotFound{} +} + +/* +StatusPinNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusPinNotFound struct { +} + +// IsSuccess returns true when this status pin not found response has a 2xx status code +func (o *StatusPinNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status pin not found response has a 3xx status code +func (o *StatusPinNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status pin not found response has a 4xx status code +func (o *StatusPinNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status pin not found response has a 5xx status code +func (o *StatusPinNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status pin not found response a status code equal to that given +func (o *StatusPinNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status pin not found response +func (o *StatusPinNotFound) Code() int { + return 404 +} + +func (o *StatusPinNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinNotFound", 404) +} + +func (o *StatusPinNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinNotFound", 404) +} + +func (o *StatusPinNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusPinNotAcceptable creates a StatusPinNotAcceptable with default headers values +func NewStatusPinNotAcceptable() *StatusPinNotAcceptable { + return &StatusPinNotAcceptable{} +} + +/* +StatusPinNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusPinNotAcceptable struct { +} + +// IsSuccess returns true when this status pin not acceptable response has a 2xx status code +func (o *StatusPinNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status pin not acceptable response has a 3xx status code +func (o *StatusPinNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status pin not acceptable response has a 4xx status code +func (o *StatusPinNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status pin not acceptable response has a 5xx status code +func (o *StatusPinNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status pin not acceptable response a status code equal to that given +func (o *StatusPinNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status pin not acceptable response +func (o *StatusPinNotAcceptable) Code() int { + return 406 +} + +func (o *StatusPinNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinNotAcceptable", 406) +} + +func (o *StatusPinNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinNotAcceptable", 406) +} + +func (o *StatusPinNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusPinInternalServerError creates a StatusPinInternalServerError with default headers values +func NewStatusPinInternalServerError() *StatusPinInternalServerError { + return &StatusPinInternalServerError{} +} + +/* +StatusPinInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusPinInternalServerError struct { +} + +// IsSuccess returns true when this status pin internal server error response has a 2xx status code +func (o *StatusPinInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status pin internal server error response has a 3xx status code +func (o *StatusPinInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status pin internal server error response has a 4xx status code +func (o *StatusPinInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status pin internal server error response has a 5xx status code +func (o *StatusPinInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status pin internal server error response a status code equal to that given +func (o *StatusPinInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status pin internal server error response +func (o *StatusPinInternalServerError) Code() int { + return 500 +} + +func (o *StatusPinInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinInternalServerError", 500) +} + +func (o *StatusPinInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinInternalServerError", 500) +} + +func (o *StatusPinInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_reblog_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_reblog_parameters.go new file mode 100644 index 0000000..cab1693 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_reblog_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusReblogParams creates a new StatusReblogParams 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 NewStatusReblogParams() *StatusReblogParams { + return &StatusReblogParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusReblogParamsWithTimeout creates a new StatusReblogParams object +// with the ability to set a timeout on a request. +func NewStatusReblogParamsWithTimeout(timeout time.Duration) *StatusReblogParams { + return &StatusReblogParams{ + timeout: timeout, + } +} + +// NewStatusReblogParamsWithContext creates a new StatusReblogParams object +// with the ability to set a context for a request. +func NewStatusReblogParamsWithContext(ctx context.Context) *StatusReblogParams { + return &StatusReblogParams{ + Context: ctx, + } +} + +// NewStatusReblogParamsWithHTTPClient creates a new StatusReblogParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusReblogParamsWithHTTPClient(client *http.Client) *StatusReblogParams { + return &StatusReblogParams{ + HTTPClient: client, + } +} + +/* +StatusReblogParams contains all the parameters to send to the API endpoint + + for the status reblog operation. + + Typically these are written to a http.Request. +*/ +type StatusReblogParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status reblog params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusReblogParams) WithDefaults() *StatusReblogParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status reblog params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusReblogParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status reblog params +func (o *StatusReblogParams) WithTimeout(timeout time.Duration) *StatusReblogParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status reblog params +func (o *StatusReblogParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status reblog params +func (o *StatusReblogParams) WithContext(ctx context.Context) *StatusReblogParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status reblog params +func (o *StatusReblogParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status reblog params +func (o *StatusReblogParams) WithHTTPClient(client *http.Client) *StatusReblogParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status reblog params +func (o *StatusReblogParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status reblog params +func (o *StatusReblogParams) WithID(id string) *StatusReblogParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status reblog params +func (o *StatusReblogParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusReblogParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_reblog_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_reblog_responses.go new file mode 100644 index 0000000..68104ab --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_reblog_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusReblogReader is a Reader for the StatusReblog structure. +type StatusReblogReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusReblogReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusReblogOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusReblogBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusReblogUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusReblogForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusReblogNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusReblogNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusReblogInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses/{id}/reblog] statusReblog", response, response.Code()) + } +} + +// NewStatusReblogOK creates a StatusReblogOK with default headers values +func NewStatusReblogOK() *StatusReblogOK { + return &StatusReblogOK{} +} + +/* +StatusReblogOK describes a response with status code 200, with default header values. + +The boost of the status. +*/ +type StatusReblogOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status reblog o k response has a 2xx status code +func (o *StatusReblogOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status reblog o k response has a 3xx status code +func (o *StatusReblogOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status reblog o k response has a 4xx status code +func (o *StatusReblogOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status reblog o k response has a 5xx status code +func (o *StatusReblogOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status reblog o k response a status code equal to that given +func (o *StatusReblogOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status reblog o k response +func (o *StatusReblogOK) Code() int { + return 200 +} + +func (o *StatusReblogOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogOK %s", 200, payload) +} + +func (o *StatusReblogOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogOK %s", 200, payload) +} + +func (o *StatusReblogOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusReblogOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusReblogBadRequest creates a StatusReblogBadRequest with default headers values +func NewStatusReblogBadRequest() *StatusReblogBadRequest { + return &StatusReblogBadRequest{} +} + +/* +StatusReblogBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusReblogBadRequest struct { +} + +// IsSuccess returns true when this status reblog bad request response has a 2xx status code +func (o *StatusReblogBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status reblog bad request response has a 3xx status code +func (o *StatusReblogBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status reblog bad request response has a 4xx status code +func (o *StatusReblogBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status reblog bad request response has a 5xx status code +func (o *StatusReblogBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status reblog bad request response a status code equal to that given +func (o *StatusReblogBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status reblog bad request response +func (o *StatusReblogBadRequest) Code() int { + return 400 +} + +func (o *StatusReblogBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogBadRequest", 400) +} + +func (o *StatusReblogBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogBadRequest", 400) +} + +func (o *StatusReblogBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusReblogUnauthorized creates a StatusReblogUnauthorized with default headers values +func NewStatusReblogUnauthorized() *StatusReblogUnauthorized { + return &StatusReblogUnauthorized{} +} + +/* +StatusReblogUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusReblogUnauthorized struct { +} + +// IsSuccess returns true when this status reblog unauthorized response has a 2xx status code +func (o *StatusReblogUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status reblog unauthorized response has a 3xx status code +func (o *StatusReblogUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status reblog unauthorized response has a 4xx status code +func (o *StatusReblogUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status reblog unauthorized response has a 5xx status code +func (o *StatusReblogUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status reblog unauthorized response a status code equal to that given +func (o *StatusReblogUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status reblog unauthorized response +func (o *StatusReblogUnauthorized) Code() int { + return 401 +} + +func (o *StatusReblogUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogUnauthorized", 401) +} + +func (o *StatusReblogUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogUnauthorized", 401) +} + +func (o *StatusReblogUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusReblogForbidden creates a StatusReblogForbidden with default headers values +func NewStatusReblogForbidden() *StatusReblogForbidden { + return &StatusReblogForbidden{} +} + +/* +StatusReblogForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusReblogForbidden struct { +} + +// IsSuccess returns true when this status reblog forbidden response has a 2xx status code +func (o *StatusReblogForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status reblog forbidden response has a 3xx status code +func (o *StatusReblogForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status reblog forbidden response has a 4xx status code +func (o *StatusReblogForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status reblog forbidden response has a 5xx status code +func (o *StatusReblogForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status reblog forbidden response a status code equal to that given +func (o *StatusReblogForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status reblog forbidden response +func (o *StatusReblogForbidden) Code() int { + return 403 +} + +func (o *StatusReblogForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogForbidden", 403) +} + +func (o *StatusReblogForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogForbidden", 403) +} + +func (o *StatusReblogForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusReblogNotFound creates a StatusReblogNotFound with default headers values +func NewStatusReblogNotFound() *StatusReblogNotFound { + return &StatusReblogNotFound{} +} + +/* +StatusReblogNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusReblogNotFound struct { +} + +// IsSuccess returns true when this status reblog not found response has a 2xx status code +func (o *StatusReblogNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status reblog not found response has a 3xx status code +func (o *StatusReblogNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status reblog not found response has a 4xx status code +func (o *StatusReblogNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status reblog not found response has a 5xx status code +func (o *StatusReblogNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status reblog not found response a status code equal to that given +func (o *StatusReblogNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status reblog not found response +func (o *StatusReblogNotFound) Code() int { + return 404 +} + +func (o *StatusReblogNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogNotFound", 404) +} + +func (o *StatusReblogNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogNotFound", 404) +} + +func (o *StatusReblogNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusReblogNotAcceptable creates a StatusReblogNotAcceptable with default headers values +func NewStatusReblogNotAcceptable() *StatusReblogNotAcceptable { + return &StatusReblogNotAcceptable{} +} + +/* +StatusReblogNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusReblogNotAcceptable struct { +} + +// IsSuccess returns true when this status reblog not acceptable response has a 2xx status code +func (o *StatusReblogNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status reblog not acceptable response has a 3xx status code +func (o *StatusReblogNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status reblog not acceptable response has a 4xx status code +func (o *StatusReblogNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status reblog not acceptable response has a 5xx status code +func (o *StatusReblogNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status reblog not acceptable response a status code equal to that given +func (o *StatusReblogNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status reblog not acceptable response +func (o *StatusReblogNotAcceptable) Code() int { + return 406 +} + +func (o *StatusReblogNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogNotAcceptable", 406) +} + +func (o *StatusReblogNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogNotAcceptable", 406) +} + +func (o *StatusReblogNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusReblogInternalServerError creates a StatusReblogInternalServerError with default headers values +func NewStatusReblogInternalServerError() *StatusReblogInternalServerError { + return &StatusReblogInternalServerError{} +} + +/* +StatusReblogInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusReblogInternalServerError struct { +} + +// IsSuccess returns true when this status reblog internal server error response has a 2xx status code +func (o *StatusReblogInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status reblog internal server error response has a 3xx status code +func (o *StatusReblogInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status reblog internal server error response has a 4xx status code +func (o *StatusReblogInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status reblog internal server error response has a 5xx status code +func (o *StatusReblogInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status reblog internal server error response a status code equal to that given +func (o *StatusReblogInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status reblog internal server error response +func (o *StatusReblogInternalServerError) Code() int { + return 500 +} + +func (o *StatusReblogInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogInternalServerError", 500) +} + +func (o *StatusReblogInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogInternalServerError", 500) +} + +func (o *StatusReblogInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_source_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_source_get_parameters.go new file mode 100644 index 0000000..ed65517 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_source_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusSourceGetParams creates a new StatusSourceGetParams 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 NewStatusSourceGetParams() *StatusSourceGetParams { + return &StatusSourceGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusSourceGetParamsWithTimeout creates a new StatusSourceGetParams object +// with the ability to set a timeout on a request. +func NewStatusSourceGetParamsWithTimeout(timeout time.Duration) *StatusSourceGetParams { + return &StatusSourceGetParams{ + timeout: timeout, + } +} + +// NewStatusSourceGetParamsWithContext creates a new StatusSourceGetParams object +// with the ability to set a context for a request. +func NewStatusSourceGetParamsWithContext(ctx context.Context) *StatusSourceGetParams { + return &StatusSourceGetParams{ + Context: ctx, + } +} + +// NewStatusSourceGetParamsWithHTTPClient creates a new StatusSourceGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusSourceGetParamsWithHTTPClient(client *http.Client) *StatusSourceGetParams { + return &StatusSourceGetParams{ + HTTPClient: client, + } +} + +/* +StatusSourceGetParams contains all the parameters to send to the API endpoint + + for the status source get operation. + + Typically these are written to a http.Request. +*/ +type StatusSourceGetParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status source get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusSourceGetParams) WithDefaults() *StatusSourceGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status source get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusSourceGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status source get params +func (o *StatusSourceGetParams) WithTimeout(timeout time.Duration) *StatusSourceGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status source get params +func (o *StatusSourceGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status source get params +func (o *StatusSourceGetParams) WithContext(ctx context.Context) *StatusSourceGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status source get params +func (o *StatusSourceGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status source get params +func (o *StatusSourceGetParams) WithHTTPClient(client *http.Client) *StatusSourceGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status source get params +func (o *StatusSourceGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status source get params +func (o *StatusSourceGetParams) WithID(id string) *StatusSourceGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status source get params +func (o *StatusSourceGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusSourceGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_source_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_source_get_responses.go new file mode 100644 index 0000000..571c35d --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_source_get_responses.go @@ -0,0 +1,476 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusSourceGetReader is a Reader for the StatusSourceGet structure. +type StatusSourceGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusSourceGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusSourceGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusSourceGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusSourceGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusSourceGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusSourceGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusSourceGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusSourceGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/statuses/{id}/source] statusSourceGet", response, response.Code()) + } +} + +// NewStatusSourceGetOK creates a StatusSourceGetOK with default headers values +func NewStatusSourceGetOK() *StatusSourceGetOK { + return &StatusSourceGetOK{} +} + +/* +StatusSourceGetOK describes a response with status code 200, with default header values. + +StatusSourceGetOK status source get o k +*/ +type StatusSourceGetOK struct { + Payload []*models.StatusSource +} + +// IsSuccess returns true when this status source get o k response has a 2xx status code +func (o *StatusSourceGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status source get o k response has a 3xx status code +func (o *StatusSourceGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status source get o k response has a 4xx status code +func (o *StatusSourceGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status source get o k response has a 5xx status code +func (o *StatusSourceGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status source get o k response a status code equal to that given +func (o *StatusSourceGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status source get o k response +func (o *StatusSourceGetOK) Code() int { + return 200 +} + +func (o *StatusSourceGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetOK %s", 200, payload) +} + +func (o *StatusSourceGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetOK %s", 200, payload) +} + +func (o *StatusSourceGetOK) GetPayload() []*models.StatusSource { + return o.Payload +} + +func (o *StatusSourceGetOK) 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 +} + +// NewStatusSourceGetBadRequest creates a StatusSourceGetBadRequest with default headers values +func NewStatusSourceGetBadRequest() *StatusSourceGetBadRequest { + return &StatusSourceGetBadRequest{} +} + +/* +StatusSourceGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusSourceGetBadRequest struct { +} + +// IsSuccess returns true when this status source get bad request response has a 2xx status code +func (o *StatusSourceGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status source get bad request response has a 3xx status code +func (o *StatusSourceGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status source get bad request response has a 4xx status code +func (o *StatusSourceGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status source get bad request response has a 5xx status code +func (o *StatusSourceGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status source get bad request response a status code equal to that given +func (o *StatusSourceGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status source get bad request response +func (o *StatusSourceGetBadRequest) Code() int { + return 400 +} + +func (o *StatusSourceGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetBadRequest", 400) +} + +func (o *StatusSourceGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetBadRequest", 400) +} + +func (o *StatusSourceGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusSourceGetUnauthorized creates a StatusSourceGetUnauthorized with default headers values +func NewStatusSourceGetUnauthorized() *StatusSourceGetUnauthorized { + return &StatusSourceGetUnauthorized{} +} + +/* +StatusSourceGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusSourceGetUnauthorized struct { +} + +// IsSuccess returns true when this status source get unauthorized response has a 2xx status code +func (o *StatusSourceGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status source get unauthorized response has a 3xx status code +func (o *StatusSourceGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status source get unauthorized response has a 4xx status code +func (o *StatusSourceGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status source get unauthorized response has a 5xx status code +func (o *StatusSourceGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status source get unauthorized response a status code equal to that given +func (o *StatusSourceGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status source get unauthorized response +func (o *StatusSourceGetUnauthorized) Code() int { + return 401 +} + +func (o *StatusSourceGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetUnauthorized", 401) +} + +func (o *StatusSourceGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetUnauthorized", 401) +} + +func (o *StatusSourceGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusSourceGetForbidden creates a StatusSourceGetForbidden with default headers values +func NewStatusSourceGetForbidden() *StatusSourceGetForbidden { + return &StatusSourceGetForbidden{} +} + +/* +StatusSourceGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusSourceGetForbidden struct { +} + +// IsSuccess returns true when this status source get forbidden response has a 2xx status code +func (o *StatusSourceGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status source get forbidden response has a 3xx status code +func (o *StatusSourceGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status source get forbidden response has a 4xx status code +func (o *StatusSourceGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status source get forbidden response has a 5xx status code +func (o *StatusSourceGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status source get forbidden response a status code equal to that given +func (o *StatusSourceGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status source get forbidden response +func (o *StatusSourceGetForbidden) Code() int { + return 403 +} + +func (o *StatusSourceGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetForbidden", 403) +} + +func (o *StatusSourceGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetForbidden", 403) +} + +func (o *StatusSourceGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusSourceGetNotFound creates a StatusSourceGetNotFound with default headers values +func NewStatusSourceGetNotFound() *StatusSourceGetNotFound { + return &StatusSourceGetNotFound{} +} + +/* +StatusSourceGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusSourceGetNotFound struct { +} + +// IsSuccess returns true when this status source get not found response has a 2xx status code +func (o *StatusSourceGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status source get not found response has a 3xx status code +func (o *StatusSourceGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status source get not found response has a 4xx status code +func (o *StatusSourceGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status source get not found response has a 5xx status code +func (o *StatusSourceGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status source get not found response a status code equal to that given +func (o *StatusSourceGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status source get not found response +func (o *StatusSourceGetNotFound) Code() int { + return 404 +} + +func (o *StatusSourceGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetNotFound", 404) +} + +func (o *StatusSourceGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetNotFound", 404) +} + +func (o *StatusSourceGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusSourceGetNotAcceptable creates a StatusSourceGetNotAcceptable with default headers values +func NewStatusSourceGetNotAcceptable() *StatusSourceGetNotAcceptable { + return &StatusSourceGetNotAcceptable{} +} + +/* +StatusSourceGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusSourceGetNotAcceptable struct { +} + +// IsSuccess returns true when this status source get not acceptable response has a 2xx status code +func (o *StatusSourceGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status source get not acceptable response has a 3xx status code +func (o *StatusSourceGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status source get not acceptable response has a 4xx status code +func (o *StatusSourceGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status source get not acceptable response has a 5xx status code +func (o *StatusSourceGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status source get not acceptable response a status code equal to that given +func (o *StatusSourceGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status source get not acceptable response +func (o *StatusSourceGetNotAcceptable) Code() int { + return 406 +} + +func (o *StatusSourceGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetNotAcceptable", 406) +} + +func (o *StatusSourceGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetNotAcceptable", 406) +} + +func (o *StatusSourceGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusSourceGetInternalServerError creates a StatusSourceGetInternalServerError with default headers values +func NewStatusSourceGetInternalServerError() *StatusSourceGetInternalServerError { + return &StatusSourceGetInternalServerError{} +} + +/* +StatusSourceGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusSourceGetInternalServerError struct { +} + +// IsSuccess returns true when this status source get internal server error response has a 2xx status code +func (o *StatusSourceGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status source get internal server error response has a 3xx status code +func (o *StatusSourceGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status source get internal server error response has a 4xx status code +func (o *StatusSourceGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status source get internal server error response has a 5xx status code +func (o *StatusSourceGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status source get internal server error response a status code equal to that given +func (o *StatusSourceGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status source get internal server error response +func (o *StatusSourceGetInternalServerError) Code() int { + return 500 +} + +func (o *StatusSourceGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetInternalServerError", 500) +} + +func (o *StatusSourceGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetInternalServerError", 500) +} + +func (o *StatusSourceGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unbookmark_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unbookmark_parameters.go new file mode 100644 index 0000000..5c3e1d7 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unbookmark_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusUnbookmarkParams creates a new StatusUnbookmarkParams 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 NewStatusUnbookmarkParams() *StatusUnbookmarkParams { + return &StatusUnbookmarkParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusUnbookmarkParamsWithTimeout creates a new StatusUnbookmarkParams object +// with the ability to set a timeout on a request. +func NewStatusUnbookmarkParamsWithTimeout(timeout time.Duration) *StatusUnbookmarkParams { + return &StatusUnbookmarkParams{ + timeout: timeout, + } +} + +// NewStatusUnbookmarkParamsWithContext creates a new StatusUnbookmarkParams object +// with the ability to set a context for a request. +func NewStatusUnbookmarkParamsWithContext(ctx context.Context) *StatusUnbookmarkParams { + return &StatusUnbookmarkParams{ + Context: ctx, + } +} + +// NewStatusUnbookmarkParamsWithHTTPClient creates a new StatusUnbookmarkParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusUnbookmarkParamsWithHTTPClient(client *http.Client) *StatusUnbookmarkParams { + return &StatusUnbookmarkParams{ + HTTPClient: client, + } +} + +/* +StatusUnbookmarkParams contains all the parameters to send to the API endpoint + + for the status unbookmark operation. + + Typically these are written to a http.Request. +*/ +type StatusUnbookmarkParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status unbookmark params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusUnbookmarkParams) WithDefaults() *StatusUnbookmarkParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status unbookmark params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusUnbookmarkParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status unbookmark params +func (o *StatusUnbookmarkParams) WithTimeout(timeout time.Duration) *StatusUnbookmarkParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status unbookmark params +func (o *StatusUnbookmarkParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status unbookmark params +func (o *StatusUnbookmarkParams) WithContext(ctx context.Context) *StatusUnbookmarkParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status unbookmark params +func (o *StatusUnbookmarkParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status unbookmark params +func (o *StatusUnbookmarkParams) WithHTTPClient(client *http.Client) *StatusUnbookmarkParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status unbookmark params +func (o *StatusUnbookmarkParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status unbookmark params +func (o *StatusUnbookmarkParams) WithID(id string) *StatusUnbookmarkParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status unbookmark params +func (o *StatusUnbookmarkParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusUnbookmarkParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unbookmark_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unbookmark_responses.go new file mode 100644 index 0000000..5c1d792 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unbookmark_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusUnbookmarkReader is a Reader for the StatusUnbookmark structure. +type StatusUnbookmarkReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusUnbookmarkReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusUnbookmarkOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusUnbookmarkBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusUnbookmarkUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusUnbookmarkForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusUnbookmarkNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusUnbookmarkNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusUnbookmarkInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses/{id}/unbookmark] statusUnbookmark", response, response.Code()) + } +} + +// NewStatusUnbookmarkOK creates a StatusUnbookmarkOK with default headers values +func NewStatusUnbookmarkOK() *StatusUnbookmarkOK { + return &StatusUnbookmarkOK{} +} + +/* +StatusUnbookmarkOK describes a response with status code 200, with default header values. + +The status. +*/ +type StatusUnbookmarkOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status unbookmark o k response has a 2xx status code +func (o *StatusUnbookmarkOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status unbookmark o k response has a 3xx status code +func (o *StatusUnbookmarkOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unbookmark o k response has a 4xx status code +func (o *StatusUnbookmarkOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status unbookmark o k response has a 5xx status code +func (o *StatusUnbookmarkOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status unbookmark o k response a status code equal to that given +func (o *StatusUnbookmarkOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status unbookmark o k response +func (o *StatusUnbookmarkOK) Code() int { + return 200 +} + +func (o *StatusUnbookmarkOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkOK %s", 200, payload) +} + +func (o *StatusUnbookmarkOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkOK %s", 200, payload) +} + +func (o *StatusUnbookmarkOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusUnbookmarkOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusUnbookmarkBadRequest creates a StatusUnbookmarkBadRequest with default headers values +func NewStatusUnbookmarkBadRequest() *StatusUnbookmarkBadRequest { + return &StatusUnbookmarkBadRequest{} +} + +/* +StatusUnbookmarkBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusUnbookmarkBadRequest struct { +} + +// IsSuccess returns true when this status unbookmark bad request response has a 2xx status code +func (o *StatusUnbookmarkBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unbookmark bad request response has a 3xx status code +func (o *StatusUnbookmarkBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unbookmark bad request response has a 4xx status code +func (o *StatusUnbookmarkBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unbookmark bad request response has a 5xx status code +func (o *StatusUnbookmarkBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status unbookmark bad request response a status code equal to that given +func (o *StatusUnbookmarkBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status unbookmark bad request response +func (o *StatusUnbookmarkBadRequest) Code() int { + return 400 +} + +func (o *StatusUnbookmarkBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkBadRequest", 400) +} + +func (o *StatusUnbookmarkBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkBadRequest", 400) +} + +func (o *StatusUnbookmarkBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnbookmarkUnauthorized creates a StatusUnbookmarkUnauthorized with default headers values +func NewStatusUnbookmarkUnauthorized() *StatusUnbookmarkUnauthorized { + return &StatusUnbookmarkUnauthorized{} +} + +/* +StatusUnbookmarkUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusUnbookmarkUnauthorized struct { +} + +// IsSuccess returns true when this status unbookmark unauthorized response has a 2xx status code +func (o *StatusUnbookmarkUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unbookmark unauthorized response has a 3xx status code +func (o *StatusUnbookmarkUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unbookmark unauthorized response has a 4xx status code +func (o *StatusUnbookmarkUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unbookmark unauthorized response has a 5xx status code +func (o *StatusUnbookmarkUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status unbookmark unauthorized response a status code equal to that given +func (o *StatusUnbookmarkUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status unbookmark unauthorized response +func (o *StatusUnbookmarkUnauthorized) Code() int { + return 401 +} + +func (o *StatusUnbookmarkUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkUnauthorized", 401) +} + +func (o *StatusUnbookmarkUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkUnauthorized", 401) +} + +func (o *StatusUnbookmarkUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnbookmarkForbidden creates a StatusUnbookmarkForbidden with default headers values +func NewStatusUnbookmarkForbidden() *StatusUnbookmarkForbidden { + return &StatusUnbookmarkForbidden{} +} + +/* +StatusUnbookmarkForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusUnbookmarkForbidden struct { +} + +// IsSuccess returns true when this status unbookmark forbidden response has a 2xx status code +func (o *StatusUnbookmarkForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unbookmark forbidden response has a 3xx status code +func (o *StatusUnbookmarkForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unbookmark forbidden response has a 4xx status code +func (o *StatusUnbookmarkForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unbookmark forbidden response has a 5xx status code +func (o *StatusUnbookmarkForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status unbookmark forbidden response a status code equal to that given +func (o *StatusUnbookmarkForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status unbookmark forbidden response +func (o *StatusUnbookmarkForbidden) Code() int { + return 403 +} + +func (o *StatusUnbookmarkForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkForbidden", 403) +} + +func (o *StatusUnbookmarkForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkForbidden", 403) +} + +func (o *StatusUnbookmarkForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnbookmarkNotFound creates a StatusUnbookmarkNotFound with default headers values +func NewStatusUnbookmarkNotFound() *StatusUnbookmarkNotFound { + return &StatusUnbookmarkNotFound{} +} + +/* +StatusUnbookmarkNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusUnbookmarkNotFound struct { +} + +// IsSuccess returns true when this status unbookmark not found response has a 2xx status code +func (o *StatusUnbookmarkNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unbookmark not found response has a 3xx status code +func (o *StatusUnbookmarkNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unbookmark not found response has a 4xx status code +func (o *StatusUnbookmarkNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unbookmark not found response has a 5xx status code +func (o *StatusUnbookmarkNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status unbookmark not found response a status code equal to that given +func (o *StatusUnbookmarkNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status unbookmark not found response +func (o *StatusUnbookmarkNotFound) Code() int { + return 404 +} + +func (o *StatusUnbookmarkNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkNotFound", 404) +} + +func (o *StatusUnbookmarkNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkNotFound", 404) +} + +func (o *StatusUnbookmarkNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnbookmarkNotAcceptable creates a StatusUnbookmarkNotAcceptable with default headers values +func NewStatusUnbookmarkNotAcceptable() *StatusUnbookmarkNotAcceptable { + return &StatusUnbookmarkNotAcceptable{} +} + +/* +StatusUnbookmarkNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusUnbookmarkNotAcceptable struct { +} + +// IsSuccess returns true when this status unbookmark not acceptable response has a 2xx status code +func (o *StatusUnbookmarkNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unbookmark not acceptable response has a 3xx status code +func (o *StatusUnbookmarkNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unbookmark not acceptable response has a 4xx status code +func (o *StatusUnbookmarkNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unbookmark not acceptable response has a 5xx status code +func (o *StatusUnbookmarkNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status unbookmark not acceptable response a status code equal to that given +func (o *StatusUnbookmarkNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status unbookmark not acceptable response +func (o *StatusUnbookmarkNotAcceptable) Code() int { + return 406 +} + +func (o *StatusUnbookmarkNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkNotAcceptable", 406) +} + +func (o *StatusUnbookmarkNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkNotAcceptable", 406) +} + +func (o *StatusUnbookmarkNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnbookmarkInternalServerError creates a StatusUnbookmarkInternalServerError with default headers values +func NewStatusUnbookmarkInternalServerError() *StatusUnbookmarkInternalServerError { + return &StatusUnbookmarkInternalServerError{} +} + +/* +StatusUnbookmarkInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusUnbookmarkInternalServerError struct { +} + +// IsSuccess returns true when this status unbookmark internal server error response has a 2xx status code +func (o *StatusUnbookmarkInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unbookmark internal server error response has a 3xx status code +func (o *StatusUnbookmarkInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unbookmark internal server error response has a 4xx status code +func (o *StatusUnbookmarkInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status unbookmark internal server error response has a 5xx status code +func (o *StatusUnbookmarkInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status unbookmark internal server error response a status code equal to that given +func (o *StatusUnbookmarkInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status unbookmark internal server error response +func (o *StatusUnbookmarkInternalServerError) Code() int { + return 500 +} + +func (o *StatusUnbookmarkInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkInternalServerError", 500) +} + +func (o *StatusUnbookmarkInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkInternalServerError", 500) +} + +func (o *StatusUnbookmarkInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unfave_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unfave_parameters.go new file mode 100644 index 0000000..ec57983 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unfave_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusUnfaveParams creates a new StatusUnfaveParams 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 NewStatusUnfaveParams() *StatusUnfaveParams { + return &StatusUnfaveParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusUnfaveParamsWithTimeout creates a new StatusUnfaveParams object +// with the ability to set a timeout on a request. +func NewStatusUnfaveParamsWithTimeout(timeout time.Duration) *StatusUnfaveParams { + return &StatusUnfaveParams{ + timeout: timeout, + } +} + +// NewStatusUnfaveParamsWithContext creates a new StatusUnfaveParams object +// with the ability to set a context for a request. +func NewStatusUnfaveParamsWithContext(ctx context.Context) *StatusUnfaveParams { + return &StatusUnfaveParams{ + Context: ctx, + } +} + +// NewStatusUnfaveParamsWithHTTPClient creates a new StatusUnfaveParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusUnfaveParamsWithHTTPClient(client *http.Client) *StatusUnfaveParams { + return &StatusUnfaveParams{ + HTTPClient: client, + } +} + +/* +StatusUnfaveParams contains all the parameters to send to the API endpoint + + for the status unfave operation. + + Typically these are written to a http.Request. +*/ +type StatusUnfaveParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status unfave params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusUnfaveParams) WithDefaults() *StatusUnfaveParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status unfave params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusUnfaveParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status unfave params +func (o *StatusUnfaveParams) WithTimeout(timeout time.Duration) *StatusUnfaveParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status unfave params +func (o *StatusUnfaveParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status unfave params +func (o *StatusUnfaveParams) WithContext(ctx context.Context) *StatusUnfaveParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status unfave params +func (o *StatusUnfaveParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status unfave params +func (o *StatusUnfaveParams) WithHTTPClient(client *http.Client) *StatusUnfaveParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status unfave params +func (o *StatusUnfaveParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status unfave params +func (o *StatusUnfaveParams) WithID(id string) *StatusUnfaveParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status unfave params +func (o *StatusUnfaveParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusUnfaveParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unfave_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unfave_responses.go new file mode 100644 index 0000000..823e0db --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unfave_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusUnfaveReader is a Reader for the StatusUnfave structure. +type StatusUnfaveReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusUnfaveReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusUnfaveOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusUnfaveBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusUnfaveUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusUnfaveForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusUnfaveNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusUnfaveNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusUnfaveInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses/{id}/unfavourite] statusUnfave", response, response.Code()) + } +} + +// NewStatusUnfaveOK creates a StatusUnfaveOK with default headers values +func NewStatusUnfaveOK() *StatusUnfaveOK { + return &StatusUnfaveOK{} +} + +/* +StatusUnfaveOK describes a response with status code 200, with default header values. + +The unfaved status. +*/ +type StatusUnfaveOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status unfave o k response has a 2xx status code +func (o *StatusUnfaveOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status unfave o k response has a 3xx status code +func (o *StatusUnfaveOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unfave o k response has a 4xx status code +func (o *StatusUnfaveOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status unfave o k response has a 5xx status code +func (o *StatusUnfaveOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status unfave o k response a status code equal to that given +func (o *StatusUnfaveOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status unfave o k response +func (o *StatusUnfaveOK) Code() int { + return 200 +} + +func (o *StatusUnfaveOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveOK %s", 200, payload) +} + +func (o *StatusUnfaveOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveOK %s", 200, payload) +} + +func (o *StatusUnfaveOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusUnfaveOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusUnfaveBadRequest creates a StatusUnfaveBadRequest with default headers values +func NewStatusUnfaveBadRequest() *StatusUnfaveBadRequest { + return &StatusUnfaveBadRequest{} +} + +/* +StatusUnfaveBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusUnfaveBadRequest struct { +} + +// IsSuccess returns true when this status unfave bad request response has a 2xx status code +func (o *StatusUnfaveBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unfave bad request response has a 3xx status code +func (o *StatusUnfaveBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unfave bad request response has a 4xx status code +func (o *StatusUnfaveBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unfave bad request response has a 5xx status code +func (o *StatusUnfaveBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status unfave bad request response a status code equal to that given +func (o *StatusUnfaveBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status unfave bad request response +func (o *StatusUnfaveBadRequest) Code() int { + return 400 +} + +func (o *StatusUnfaveBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveBadRequest", 400) +} + +func (o *StatusUnfaveBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveBadRequest", 400) +} + +func (o *StatusUnfaveBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnfaveUnauthorized creates a StatusUnfaveUnauthorized with default headers values +func NewStatusUnfaveUnauthorized() *StatusUnfaveUnauthorized { + return &StatusUnfaveUnauthorized{} +} + +/* +StatusUnfaveUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusUnfaveUnauthorized struct { +} + +// IsSuccess returns true when this status unfave unauthorized response has a 2xx status code +func (o *StatusUnfaveUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unfave unauthorized response has a 3xx status code +func (o *StatusUnfaveUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unfave unauthorized response has a 4xx status code +func (o *StatusUnfaveUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unfave unauthorized response has a 5xx status code +func (o *StatusUnfaveUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status unfave unauthorized response a status code equal to that given +func (o *StatusUnfaveUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status unfave unauthorized response +func (o *StatusUnfaveUnauthorized) Code() int { + return 401 +} + +func (o *StatusUnfaveUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveUnauthorized", 401) +} + +func (o *StatusUnfaveUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveUnauthorized", 401) +} + +func (o *StatusUnfaveUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnfaveForbidden creates a StatusUnfaveForbidden with default headers values +func NewStatusUnfaveForbidden() *StatusUnfaveForbidden { + return &StatusUnfaveForbidden{} +} + +/* +StatusUnfaveForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusUnfaveForbidden struct { +} + +// IsSuccess returns true when this status unfave forbidden response has a 2xx status code +func (o *StatusUnfaveForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unfave forbidden response has a 3xx status code +func (o *StatusUnfaveForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unfave forbidden response has a 4xx status code +func (o *StatusUnfaveForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unfave forbidden response has a 5xx status code +func (o *StatusUnfaveForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status unfave forbidden response a status code equal to that given +func (o *StatusUnfaveForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status unfave forbidden response +func (o *StatusUnfaveForbidden) Code() int { + return 403 +} + +func (o *StatusUnfaveForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveForbidden", 403) +} + +func (o *StatusUnfaveForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveForbidden", 403) +} + +func (o *StatusUnfaveForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnfaveNotFound creates a StatusUnfaveNotFound with default headers values +func NewStatusUnfaveNotFound() *StatusUnfaveNotFound { + return &StatusUnfaveNotFound{} +} + +/* +StatusUnfaveNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusUnfaveNotFound struct { +} + +// IsSuccess returns true when this status unfave not found response has a 2xx status code +func (o *StatusUnfaveNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unfave not found response has a 3xx status code +func (o *StatusUnfaveNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unfave not found response has a 4xx status code +func (o *StatusUnfaveNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unfave not found response has a 5xx status code +func (o *StatusUnfaveNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status unfave not found response a status code equal to that given +func (o *StatusUnfaveNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status unfave not found response +func (o *StatusUnfaveNotFound) Code() int { + return 404 +} + +func (o *StatusUnfaveNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveNotFound", 404) +} + +func (o *StatusUnfaveNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveNotFound", 404) +} + +func (o *StatusUnfaveNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnfaveNotAcceptable creates a StatusUnfaveNotAcceptable with default headers values +func NewStatusUnfaveNotAcceptable() *StatusUnfaveNotAcceptable { + return &StatusUnfaveNotAcceptable{} +} + +/* +StatusUnfaveNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusUnfaveNotAcceptable struct { +} + +// IsSuccess returns true when this status unfave not acceptable response has a 2xx status code +func (o *StatusUnfaveNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unfave not acceptable response has a 3xx status code +func (o *StatusUnfaveNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unfave not acceptable response has a 4xx status code +func (o *StatusUnfaveNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unfave not acceptable response has a 5xx status code +func (o *StatusUnfaveNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status unfave not acceptable response a status code equal to that given +func (o *StatusUnfaveNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status unfave not acceptable response +func (o *StatusUnfaveNotAcceptable) Code() int { + return 406 +} + +func (o *StatusUnfaveNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveNotAcceptable", 406) +} + +func (o *StatusUnfaveNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveNotAcceptable", 406) +} + +func (o *StatusUnfaveNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnfaveInternalServerError creates a StatusUnfaveInternalServerError with default headers values +func NewStatusUnfaveInternalServerError() *StatusUnfaveInternalServerError { + return &StatusUnfaveInternalServerError{} +} + +/* +StatusUnfaveInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusUnfaveInternalServerError struct { +} + +// IsSuccess returns true when this status unfave internal server error response has a 2xx status code +func (o *StatusUnfaveInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unfave internal server error response has a 3xx status code +func (o *StatusUnfaveInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unfave internal server error response has a 4xx status code +func (o *StatusUnfaveInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status unfave internal server error response has a 5xx status code +func (o *StatusUnfaveInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status unfave internal server error response a status code equal to that given +func (o *StatusUnfaveInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status unfave internal server error response +func (o *StatusUnfaveInternalServerError) Code() int { + return 500 +} + +func (o *StatusUnfaveInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveInternalServerError", 500) +} + +func (o *StatusUnfaveInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveInternalServerError", 500) +} + +func (o *StatusUnfaveInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unmute_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unmute_parameters.go new file mode 100644 index 0000000..7da7ed0 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unmute_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusUnmuteParams creates a new StatusUnmuteParams 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 NewStatusUnmuteParams() *StatusUnmuteParams { + return &StatusUnmuteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusUnmuteParamsWithTimeout creates a new StatusUnmuteParams object +// with the ability to set a timeout on a request. +func NewStatusUnmuteParamsWithTimeout(timeout time.Duration) *StatusUnmuteParams { + return &StatusUnmuteParams{ + timeout: timeout, + } +} + +// NewStatusUnmuteParamsWithContext creates a new StatusUnmuteParams object +// with the ability to set a context for a request. +func NewStatusUnmuteParamsWithContext(ctx context.Context) *StatusUnmuteParams { + return &StatusUnmuteParams{ + Context: ctx, + } +} + +// NewStatusUnmuteParamsWithHTTPClient creates a new StatusUnmuteParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusUnmuteParamsWithHTTPClient(client *http.Client) *StatusUnmuteParams { + return &StatusUnmuteParams{ + HTTPClient: client, + } +} + +/* +StatusUnmuteParams contains all the parameters to send to the API endpoint + + for the status unmute operation. + + Typically these are written to a http.Request. +*/ +type StatusUnmuteParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status unmute params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusUnmuteParams) WithDefaults() *StatusUnmuteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status unmute params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusUnmuteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status unmute params +func (o *StatusUnmuteParams) WithTimeout(timeout time.Duration) *StatusUnmuteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status unmute params +func (o *StatusUnmuteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status unmute params +func (o *StatusUnmuteParams) WithContext(ctx context.Context) *StatusUnmuteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status unmute params +func (o *StatusUnmuteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status unmute params +func (o *StatusUnmuteParams) WithHTTPClient(client *http.Client) *StatusUnmuteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status unmute params +func (o *StatusUnmuteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status unmute params +func (o *StatusUnmuteParams) WithID(id string) *StatusUnmuteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status unmute params +func (o *StatusUnmuteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusUnmuteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unmute_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unmute_responses.go new file mode 100644 index 0000000..bfa61de --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unmute_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusUnmuteReader is a Reader for the StatusUnmute structure. +type StatusUnmuteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusUnmuteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusUnmuteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusUnmuteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusUnmuteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusUnmuteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusUnmuteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusUnmuteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusUnmuteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses/{id}/unmute] statusUnmute", response, response.Code()) + } +} + +// NewStatusUnmuteOK creates a StatusUnmuteOK with default headers values +func NewStatusUnmuteOK() *StatusUnmuteOK { + return &StatusUnmuteOK{} +} + +/* +StatusUnmuteOK describes a response with status code 200, with default header values. + +The now-unmuted status. +*/ +type StatusUnmuteOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status unmute o k response has a 2xx status code +func (o *StatusUnmuteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status unmute o k response has a 3xx status code +func (o *StatusUnmuteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unmute o k response has a 4xx status code +func (o *StatusUnmuteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status unmute o k response has a 5xx status code +func (o *StatusUnmuteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status unmute o k response a status code equal to that given +func (o *StatusUnmuteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status unmute o k response +func (o *StatusUnmuteOK) Code() int { + return 200 +} + +func (o *StatusUnmuteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteOK %s", 200, payload) +} + +func (o *StatusUnmuteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteOK %s", 200, payload) +} + +func (o *StatusUnmuteOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusUnmuteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusUnmuteBadRequest creates a StatusUnmuteBadRequest with default headers values +func NewStatusUnmuteBadRequest() *StatusUnmuteBadRequest { + return &StatusUnmuteBadRequest{} +} + +/* +StatusUnmuteBadRequest describes a response with status code 400, with default header values. + +bad request; you're not part of the target status thread +*/ +type StatusUnmuteBadRequest struct { +} + +// IsSuccess returns true when this status unmute bad request response has a 2xx status code +func (o *StatusUnmuteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unmute bad request response has a 3xx status code +func (o *StatusUnmuteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unmute bad request response has a 4xx status code +func (o *StatusUnmuteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unmute bad request response has a 5xx status code +func (o *StatusUnmuteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status unmute bad request response a status code equal to that given +func (o *StatusUnmuteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status unmute bad request response +func (o *StatusUnmuteBadRequest) Code() int { + return 400 +} + +func (o *StatusUnmuteBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteBadRequest", 400) +} + +func (o *StatusUnmuteBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteBadRequest", 400) +} + +func (o *StatusUnmuteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnmuteUnauthorized creates a StatusUnmuteUnauthorized with default headers values +func NewStatusUnmuteUnauthorized() *StatusUnmuteUnauthorized { + return &StatusUnmuteUnauthorized{} +} + +/* +StatusUnmuteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusUnmuteUnauthorized struct { +} + +// IsSuccess returns true when this status unmute unauthorized response has a 2xx status code +func (o *StatusUnmuteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unmute unauthorized response has a 3xx status code +func (o *StatusUnmuteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unmute unauthorized response has a 4xx status code +func (o *StatusUnmuteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unmute unauthorized response has a 5xx status code +func (o *StatusUnmuteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status unmute unauthorized response a status code equal to that given +func (o *StatusUnmuteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status unmute unauthorized response +func (o *StatusUnmuteUnauthorized) Code() int { + return 401 +} + +func (o *StatusUnmuteUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteUnauthorized", 401) +} + +func (o *StatusUnmuteUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteUnauthorized", 401) +} + +func (o *StatusUnmuteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnmuteForbidden creates a StatusUnmuteForbidden with default headers values +func NewStatusUnmuteForbidden() *StatusUnmuteForbidden { + return &StatusUnmuteForbidden{} +} + +/* +StatusUnmuteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusUnmuteForbidden struct { +} + +// IsSuccess returns true when this status unmute forbidden response has a 2xx status code +func (o *StatusUnmuteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unmute forbidden response has a 3xx status code +func (o *StatusUnmuteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unmute forbidden response has a 4xx status code +func (o *StatusUnmuteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unmute forbidden response has a 5xx status code +func (o *StatusUnmuteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status unmute forbidden response a status code equal to that given +func (o *StatusUnmuteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status unmute forbidden response +func (o *StatusUnmuteForbidden) Code() int { + return 403 +} + +func (o *StatusUnmuteForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteForbidden", 403) +} + +func (o *StatusUnmuteForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteForbidden", 403) +} + +func (o *StatusUnmuteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnmuteNotFound creates a StatusUnmuteNotFound with default headers values +func NewStatusUnmuteNotFound() *StatusUnmuteNotFound { + return &StatusUnmuteNotFound{} +} + +/* +StatusUnmuteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusUnmuteNotFound struct { +} + +// IsSuccess returns true when this status unmute not found response has a 2xx status code +func (o *StatusUnmuteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unmute not found response has a 3xx status code +func (o *StatusUnmuteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unmute not found response has a 4xx status code +func (o *StatusUnmuteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unmute not found response has a 5xx status code +func (o *StatusUnmuteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status unmute not found response a status code equal to that given +func (o *StatusUnmuteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status unmute not found response +func (o *StatusUnmuteNotFound) Code() int { + return 404 +} + +func (o *StatusUnmuteNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteNotFound", 404) +} + +func (o *StatusUnmuteNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteNotFound", 404) +} + +func (o *StatusUnmuteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnmuteNotAcceptable creates a StatusUnmuteNotAcceptable with default headers values +func NewStatusUnmuteNotAcceptable() *StatusUnmuteNotAcceptable { + return &StatusUnmuteNotAcceptable{} +} + +/* +StatusUnmuteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusUnmuteNotAcceptable struct { +} + +// IsSuccess returns true when this status unmute not acceptable response has a 2xx status code +func (o *StatusUnmuteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unmute not acceptable response has a 3xx status code +func (o *StatusUnmuteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unmute not acceptable response has a 4xx status code +func (o *StatusUnmuteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unmute not acceptable response has a 5xx status code +func (o *StatusUnmuteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status unmute not acceptable response a status code equal to that given +func (o *StatusUnmuteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status unmute not acceptable response +func (o *StatusUnmuteNotAcceptable) Code() int { + return 406 +} + +func (o *StatusUnmuteNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteNotAcceptable", 406) +} + +func (o *StatusUnmuteNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteNotAcceptable", 406) +} + +func (o *StatusUnmuteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnmuteInternalServerError creates a StatusUnmuteInternalServerError with default headers values +func NewStatusUnmuteInternalServerError() *StatusUnmuteInternalServerError { + return &StatusUnmuteInternalServerError{} +} + +/* +StatusUnmuteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusUnmuteInternalServerError struct { +} + +// IsSuccess returns true when this status unmute internal server error response has a 2xx status code +func (o *StatusUnmuteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unmute internal server error response has a 3xx status code +func (o *StatusUnmuteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unmute internal server error response has a 4xx status code +func (o *StatusUnmuteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status unmute internal server error response has a 5xx status code +func (o *StatusUnmuteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status unmute internal server error response a status code equal to that given +func (o *StatusUnmuteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status unmute internal server error response +func (o *StatusUnmuteInternalServerError) Code() int { + return 500 +} + +func (o *StatusUnmuteInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteInternalServerError", 500) +} + +func (o *StatusUnmuteInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteInternalServerError", 500) +} + +func (o *StatusUnmuteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unpin_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unpin_parameters.go new file mode 100644 index 0000000..e25a60a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unpin_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusUnpinParams creates a new StatusUnpinParams 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 NewStatusUnpinParams() *StatusUnpinParams { + return &StatusUnpinParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusUnpinParamsWithTimeout creates a new StatusUnpinParams object +// with the ability to set a timeout on a request. +func NewStatusUnpinParamsWithTimeout(timeout time.Duration) *StatusUnpinParams { + return &StatusUnpinParams{ + timeout: timeout, + } +} + +// NewStatusUnpinParamsWithContext creates a new StatusUnpinParams object +// with the ability to set a context for a request. +func NewStatusUnpinParamsWithContext(ctx context.Context) *StatusUnpinParams { + return &StatusUnpinParams{ + Context: ctx, + } +} + +// NewStatusUnpinParamsWithHTTPClient creates a new StatusUnpinParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusUnpinParamsWithHTTPClient(client *http.Client) *StatusUnpinParams { + return &StatusUnpinParams{ + HTTPClient: client, + } +} + +/* +StatusUnpinParams contains all the parameters to send to the API endpoint + + for the status unpin operation. + + Typically these are written to a http.Request. +*/ +type StatusUnpinParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status unpin params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusUnpinParams) WithDefaults() *StatusUnpinParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status unpin params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusUnpinParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status unpin params +func (o *StatusUnpinParams) WithTimeout(timeout time.Duration) *StatusUnpinParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status unpin params +func (o *StatusUnpinParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status unpin params +func (o *StatusUnpinParams) WithContext(ctx context.Context) *StatusUnpinParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status unpin params +func (o *StatusUnpinParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status unpin params +func (o *StatusUnpinParams) WithHTTPClient(client *http.Client) *StatusUnpinParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status unpin params +func (o *StatusUnpinParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status unpin params +func (o *StatusUnpinParams) WithID(id string) *StatusUnpinParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status unpin params +func (o *StatusUnpinParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusUnpinParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unpin_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unpin_responses.go new file mode 100644 index 0000000..9ad1b58 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unpin_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusUnpinReader is a Reader for the StatusUnpin structure. +type StatusUnpinReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusUnpinReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusUnpinOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusUnpinBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusUnpinUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusUnpinForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusUnpinNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusUnpinNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusUnpinInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses/{id}/unpin] statusUnpin", response, response.Code()) + } +} + +// NewStatusUnpinOK creates a StatusUnpinOK with default headers values +func NewStatusUnpinOK() *StatusUnpinOK { + return &StatusUnpinOK{} +} + +/* +StatusUnpinOK describes a response with status code 200, with default header values. + +The status. +*/ +type StatusUnpinOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status unpin o k response has a 2xx status code +func (o *StatusUnpinOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status unpin o k response has a 3xx status code +func (o *StatusUnpinOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unpin o k response has a 4xx status code +func (o *StatusUnpinOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status unpin o k response has a 5xx status code +func (o *StatusUnpinOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status unpin o k response a status code equal to that given +func (o *StatusUnpinOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status unpin o k response +func (o *StatusUnpinOK) Code() int { + return 200 +} + +func (o *StatusUnpinOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinOK %s", 200, payload) +} + +func (o *StatusUnpinOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinOK %s", 200, payload) +} + +func (o *StatusUnpinOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusUnpinOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusUnpinBadRequest creates a StatusUnpinBadRequest with default headers values +func NewStatusUnpinBadRequest() *StatusUnpinBadRequest { + return &StatusUnpinBadRequest{} +} + +/* +StatusUnpinBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusUnpinBadRequest struct { +} + +// IsSuccess returns true when this status unpin bad request response has a 2xx status code +func (o *StatusUnpinBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unpin bad request response has a 3xx status code +func (o *StatusUnpinBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unpin bad request response has a 4xx status code +func (o *StatusUnpinBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unpin bad request response has a 5xx status code +func (o *StatusUnpinBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status unpin bad request response a status code equal to that given +func (o *StatusUnpinBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status unpin bad request response +func (o *StatusUnpinBadRequest) Code() int { + return 400 +} + +func (o *StatusUnpinBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinBadRequest", 400) +} + +func (o *StatusUnpinBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinBadRequest", 400) +} + +func (o *StatusUnpinBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnpinUnauthorized creates a StatusUnpinUnauthorized with default headers values +func NewStatusUnpinUnauthorized() *StatusUnpinUnauthorized { + return &StatusUnpinUnauthorized{} +} + +/* +StatusUnpinUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusUnpinUnauthorized struct { +} + +// IsSuccess returns true when this status unpin unauthorized response has a 2xx status code +func (o *StatusUnpinUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unpin unauthorized response has a 3xx status code +func (o *StatusUnpinUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unpin unauthorized response has a 4xx status code +func (o *StatusUnpinUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unpin unauthorized response has a 5xx status code +func (o *StatusUnpinUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status unpin unauthorized response a status code equal to that given +func (o *StatusUnpinUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status unpin unauthorized response +func (o *StatusUnpinUnauthorized) Code() int { + return 401 +} + +func (o *StatusUnpinUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinUnauthorized", 401) +} + +func (o *StatusUnpinUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinUnauthorized", 401) +} + +func (o *StatusUnpinUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnpinForbidden creates a StatusUnpinForbidden with default headers values +func NewStatusUnpinForbidden() *StatusUnpinForbidden { + return &StatusUnpinForbidden{} +} + +/* +StatusUnpinForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusUnpinForbidden struct { +} + +// IsSuccess returns true when this status unpin forbidden response has a 2xx status code +func (o *StatusUnpinForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unpin forbidden response has a 3xx status code +func (o *StatusUnpinForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unpin forbidden response has a 4xx status code +func (o *StatusUnpinForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unpin forbidden response has a 5xx status code +func (o *StatusUnpinForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status unpin forbidden response a status code equal to that given +func (o *StatusUnpinForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status unpin forbidden response +func (o *StatusUnpinForbidden) Code() int { + return 403 +} + +func (o *StatusUnpinForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinForbidden", 403) +} + +func (o *StatusUnpinForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinForbidden", 403) +} + +func (o *StatusUnpinForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnpinNotFound creates a StatusUnpinNotFound with default headers values +func NewStatusUnpinNotFound() *StatusUnpinNotFound { + return &StatusUnpinNotFound{} +} + +/* +StatusUnpinNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusUnpinNotFound struct { +} + +// IsSuccess returns true when this status unpin not found response has a 2xx status code +func (o *StatusUnpinNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unpin not found response has a 3xx status code +func (o *StatusUnpinNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unpin not found response has a 4xx status code +func (o *StatusUnpinNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unpin not found response has a 5xx status code +func (o *StatusUnpinNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status unpin not found response a status code equal to that given +func (o *StatusUnpinNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status unpin not found response +func (o *StatusUnpinNotFound) Code() int { + return 404 +} + +func (o *StatusUnpinNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinNotFound", 404) +} + +func (o *StatusUnpinNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinNotFound", 404) +} + +func (o *StatusUnpinNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnpinNotAcceptable creates a StatusUnpinNotAcceptable with default headers values +func NewStatusUnpinNotAcceptable() *StatusUnpinNotAcceptable { + return &StatusUnpinNotAcceptable{} +} + +/* +StatusUnpinNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusUnpinNotAcceptable struct { +} + +// IsSuccess returns true when this status unpin not acceptable response has a 2xx status code +func (o *StatusUnpinNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unpin not acceptable response has a 3xx status code +func (o *StatusUnpinNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unpin not acceptable response has a 4xx status code +func (o *StatusUnpinNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unpin not acceptable response has a 5xx status code +func (o *StatusUnpinNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status unpin not acceptable response a status code equal to that given +func (o *StatusUnpinNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status unpin not acceptable response +func (o *StatusUnpinNotAcceptable) Code() int { + return 406 +} + +func (o *StatusUnpinNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinNotAcceptable", 406) +} + +func (o *StatusUnpinNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinNotAcceptable", 406) +} + +func (o *StatusUnpinNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnpinInternalServerError creates a StatusUnpinInternalServerError with default headers values +func NewStatusUnpinInternalServerError() *StatusUnpinInternalServerError { + return &StatusUnpinInternalServerError{} +} + +/* +StatusUnpinInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusUnpinInternalServerError struct { +} + +// IsSuccess returns true when this status unpin internal server error response has a 2xx status code +func (o *StatusUnpinInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unpin internal server error response has a 3xx status code +func (o *StatusUnpinInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unpin internal server error response has a 4xx status code +func (o *StatusUnpinInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status unpin internal server error response has a 5xx status code +func (o *StatusUnpinInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status unpin internal server error response a status code equal to that given +func (o *StatusUnpinInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status unpin internal server error response +func (o *StatusUnpinInternalServerError) Code() int { + return 500 +} + +func (o *StatusUnpinInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinInternalServerError", 500) +} + +func (o *StatusUnpinInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinInternalServerError", 500) +} + +func (o *StatusUnpinInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unreblog_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unreblog_parameters.go new file mode 100644 index 0000000..e7832a4 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unreblog_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusUnreblogParams creates a new StatusUnreblogParams 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 NewStatusUnreblogParams() *StatusUnreblogParams { + return &StatusUnreblogParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusUnreblogParamsWithTimeout creates a new StatusUnreblogParams object +// with the ability to set a timeout on a request. +func NewStatusUnreblogParamsWithTimeout(timeout time.Duration) *StatusUnreblogParams { + return &StatusUnreblogParams{ + timeout: timeout, + } +} + +// NewStatusUnreblogParamsWithContext creates a new StatusUnreblogParams object +// with the ability to set a context for a request. +func NewStatusUnreblogParamsWithContext(ctx context.Context) *StatusUnreblogParams { + return &StatusUnreblogParams{ + Context: ctx, + } +} + +// NewStatusUnreblogParamsWithHTTPClient creates a new StatusUnreblogParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusUnreblogParamsWithHTTPClient(client *http.Client) *StatusUnreblogParams { + return &StatusUnreblogParams{ + HTTPClient: client, + } +} + +/* +StatusUnreblogParams contains all the parameters to send to the API endpoint + + for the status unreblog operation. + + Typically these are written to a http.Request. +*/ +type StatusUnreblogParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status unreblog params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusUnreblogParams) WithDefaults() *StatusUnreblogParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status unreblog params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusUnreblogParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status unreblog params +func (o *StatusUnreblogParams) WithTimeout(timeout time.Duration) *StatusUnreblogParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status unreblog params +func (o *StatusUnreblogParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status unreblog params +func (o *StatusUnreblogParams) WithContext(ctx context.Context) *StatusUnreblogParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status unreblog params +func (o *StatusUnreblogParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status unreblog params +func (o *StatusUnreblogParams) WithHTTPClient(client *http.Client) *StatusUnreblogParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status unreblog params +func (o *StatusUnreblogParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status unreblog params +func (o *StatusUnreblogParams) WithID(id string) *StatusUnreblogParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status unreblog params +func (o *StatusUnreblogParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusUnreblogParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unreblog_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unreblog_responses.go new file mode 100644 index 0000000..4486c3b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/status_unreblog_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusUnreblogReader is a Reader for the StatusUnreblog structure. +type StatusUnreblogReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusUnreblogReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusUnreblogOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusUnreblogBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusUnreblogUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusUnreblogForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusUnreblogNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusUnreblogNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusUnreblogInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses/{id}/unreblog] statusUnreblog", response, response.Code()) + } +} + +// NewStatusUnreblogOK creates a StatusUnreblogOK with default headers values +func NewStatusUnreblogOK() *StatusUnreblogOK { + return &StatusUnreblogOK{} +} + +/* +StatusUnreblogOK describes a response with status code 200, with default header values. + +The unboosted status. +*/ +type StatusUnreblogOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status unreblog o k response has a 2xx status code +func (o *StatusUnreblogOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status unreblog o k response has a 3xx status code +func (o *StatusUnreblogOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unreblog o k response has a 4xx status code +func (o *StatusUnreblogOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status unreblog o k response has a 5xx status code +func (o *StatusUnreblogOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status unreblog o k response a status code equal to that given +func (o *StatusUnreblogOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status unreblog o k response +func (o *StatusUnreblogOK) Code() int { + return 200 +} + +func (o *StatusUnreblogOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogOK %s", 200, payload) +} + +func (o *StatusUnreblogOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogOK %s", 200, payload) +} + +func (o *StatusUnreblogOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusUnreblogOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusUnreblogBadRequest creates a StatusUnreblogBadRequest with default headers values +func NewStatusUnreblogBadRequest() *StatusUnreblogBadRequest { + return &StatusUnreblogBadRequest{} +} + +/* +StatusUnreblogBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusUnreblogBadRequest struct { +} + +// IsSuccess returns true when this status unreblog bad request response has a 2xx status code +func (o *StatusUnreblogBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unreblog bad request response has a 3xx status code +func (o *StatusUnreblogBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unreblog bad request response has a 4xx status code +func (o *StatusUnreblogBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unreblog bad request response has a 5xx status code +func (o *StatusUnreblogBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status unreblog bad request response a status code equal to that given +func (o *StatusUnreblogBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status unreblog bad request response +func (o *StatusUnreblogBadRequest) Code() int { + return 400 +} + +func (o *StatusUnreblogBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogBadRequest", 400) +} + +func (o *StatusUnreblogBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogBadRequest", 400) +} + +func (o *StatusUnreblogBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnreblogUnauthorized creates a StatusUnreblogUnauthorized with default headers values +func NewStatusUnreblogUnauthorized() *StatusUnreblogUnauthorized { + return &StatusUnreblogUnauthorized{} +} + +/* +StatusUnreblogUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusUnreblogUnauthorized struct { +} + +// IsSuccess returns true when this status unreblog unauthorized response has a 2xx status code +func (o *StatusUnreblogUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unreblog unauthorized response has a 3xx status code +func (o *StatusUnreblogUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unreblog unauthorized response has a 4xx status code +func (o *StatusUnreblogUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unreblog unauthorized response has a 5xx status code +func (o *StatusUnreblogUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status unreblog unauthorized response a status code equal to that given +func (o *StatusUnreblogUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status unreblog unauthorized response +func (o *StatusUnreblogUnauthorized) Code() int { + return 401 +} + +func (o *StatusUnreblogUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogUnauthorized", 401) +} + +func (o *StatusUnreblogUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogUnauthorized", 401) +} + +func (o *StatusUnreblogUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnreblogForbidden creates a StatusUnreblogForbidden with default headers values +func NewStatusUnreblogForbidden() *StatusUnreblogForbidden { + return &StatusUnreblogForbidden{} +} + +/* +StatusUnreblogForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusUnreblogForbidden struct { +} + +// IsSuccess returns true when this status unreblog forbidden response has a 2xx status code +func (o *StatusUnreblogForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unreblog forbidden response has a 3xx status code +func (o *StatusUnreblogForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unreblog forbidden response has a 4xx status code +func (o *StatusUnreblogForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unreblog forbidden response has a 5xx status code +func (o *StatusUnreblogForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status unreblog forbidden response a status code equal to that given +func (o *StatusUnreblogForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status unreblog forbidden response +func (o *StatusUnreblogForbidden) Code() int { + return 403 +} + +func (o *StatusUnreblogForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogForbidden", 403) +} + +func (o *StatusUnreblogForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogForbidden", 403) +} + +func (o *StatusUnreblogForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnreblogNotFound creates a StatusUnreblogNotFound with default headers values +func NewStatusUnreblogNotFound() *StatusUnreblogNotFound { + return &StatusUnreblogNotFound{} +} + +/* +StatusUnreblogNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusUnreblogNotFound struct { +} + +// IsSuccess returns true when this status unreblog not found response has a 2xx status code +func (o *StatusUnreblogNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unreblog not found response has a 3xx status code +func (o *StatusUnreblogNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unreblog not found response has a 4xx status code +func (o *StatusUnreblogNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unreblog not found response has a 5xx status code +func (o *StatusUnreblogNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status unreblog not found response a status code equal to that given +func (o *StatusUnreblogNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status unreblog not found response +func (o *StatusUnreblogNotFound) Code() int { + return 404 +} + +func (o *StatusUnreblogNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogNotFound", 404) +} + +func (o *StatusUnreblogNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogNotFound", 404) +} + +func (o *StatusUnreblogNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnreblogNotAcceptable creates a StatusUnreblogNotAcceptable with default headers values +func NewStatusUnreblogNotAcceptable() *StatusUnreblogNotAcceptable { + return &StatusUnreblogNotAcceptable{} +} + +/* +StatusUnreblogNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusUnreblogNotAcceptable struct { +} + +// IsSuccess returns true when this status unreblog not acceptable response has a 2xx status code +func (o *StatusUnreblogNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unreblog not acceptable response has a 3xx status code +func (o *StatusUnreblogNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unreblog not acceptable response has a 4xx status code +func (o *StatusUnreblogNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unreblog not acceptable response has a 5xx status code +func (o *StatusUnreblogNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status unreblog not acceptable response a status code equal to that given +func (o *StatusUnreblogNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status unreblog not acceptable response +func (o *StatusUnreblogNotAcceptable) Code() int { + return 406 +} + +func (o *StatusUnreblogNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogNotAcceptable", 406) +} + +func (o *StatusUnreblogNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogNotAcceptable", 406) +} + +func (o *StatusUnreblogNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnreblogInternalServerError creates a StatusUnreblogInternalServerError with default headers values +func NewStatusUnreblogInternalServerError() *StatusUnreblogInternalServerError { + return &StatusUnreblogInternalServerError{} +} + +/* +StatusUnreblogInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusUnreblogInternalServerError struct { +} + +// IsSuccess returns true when this status unreblog internal server error response has a 2xx status code +func (o *StatusUnreblogInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unreblog internal server error response has a 3xx status code +func (o *StatusUnreblogInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unreblog internal server error response has a 4xx status code +func (o *StatusUnreblogInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status unreblog internal server error response has a 5xx status code +func (o *StatusUnreblogInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status unreblog internal server error response a status code equal to that given +func (o *StatusUnreblogInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status unreblog internal server error response +func (o *StatusUnreblogInternalServerError) Code() int { + return 500 +} + +func (o *StatusUnreblogInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogInternalServerError", 500) +} + +func (o *StatusUnreblogInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogInternalServerError", 500) +} + +func (o *StatusUnreblogInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/statuses_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/statuses_client.go new file mode 100644 index 0000000..5ad608d --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/statuses_client.go @@ -0,0 +1,861 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new statuses API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new statuses API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new statuses API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for statuses API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded". +func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} +} + +// WithContentTypeApplicationXML sets the Content-Type header to "application/xml". +func WithContentTypeApplicationXML(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/xml"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + StatusBookmark(params *StatusBookmarkParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusBookmarkOK, error) + + StatusBoostedBy(params *StatusBoostedByParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusBoostedByOK, error) + + StatusCreate(params *StatusCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusCreateOK, error) + + StatusDelete(params *StatusDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusDeleteOK, error) + + StatusFave(params *StatusFaveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusFaveOK, error) + + StatusFavedBy(params *StatusFavedByParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusFavedByOK, error) + + StatusGet(params *StatusGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusGetOK, error) + + StatusHistoryGet(params *StatusHistoryGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusHistoryGetOK, error) + + StatusMute(params *StatusMuteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusMuteOK, error) + + StatusPin(params *StatusPinParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusPinOK, error) + + StatusReblog(params *StatusReblogParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusReblogOK, error) + + StatusSourceGet(params *StatusSourceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusSourceGetOK, error) + + StatusUnbookmark(params *StatusUnbookmarkParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusUnbookmarkOK, error) + + StatusUnfave(params *StatusUnfaveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusUnfaveOK, error) + + StatusUnmute(params *StatusUnmuteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusUnmuteOK, error) + + StatusUnpin(params *StatusUnpinParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusUnpinOK, error) + + StatusUnreblog(params *StatusUnreblogParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusUnreblogOK, error) + + ThreadContext(params *ThreadContextParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ThreadContextOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +StatusBookmark bookmarks status with the given ID +*/ +func (a *Client) StatusBookmark(params *StatusBookmarkParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusBookmarkOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusBookmarkParams() + } + op := &runtime.ClientOperation{ + ID: "statusBookmark", + Method: "POST", + PathPattern: "/api/v1/statuses/{id}/bookmark", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusBookmarkReader{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.(*StatusBookmarkOK) + 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 statusBookmark: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +StatusBoostedBy views accounts that have reblogged boosted the target status +*/ +func (a *Client) StatusBoostedBy(params *StatusBoostedByParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusBoostedByOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusBoostedByParams() + } + op := &runtime.ClientOperation{ + ID: "statusBoostedBy", + Method: "GET", + PathPattern: "/api/v1/statuses/{id}/reblogged_by", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusBoostedByReader{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.(*StatusBoostedByOK) + 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 statusBoostedBy: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + StatusCreate creates a new status + + The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'. + +The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'. +*/ +func (a *Client) StatusCreate(params *StatusCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusCreateParams() + } + op := &runtime.ClientOperation{ + ID: "statusCreate", + Method: "POST", + PathPattern: "/api/v1/statuses", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusCreateReader{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.(*StatusCreateOK) + 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 statusCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + StatusDelete deletes status with the given ID the status must belong to you + + The deleted status will be returned in the response. The `text` field will contain the original text of the status as it was submitted. + +This is useful when doing a 'delete and redraft' type operation. +*/ +func (a *Client) StatusDelete(params *StatusDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "statusDelete", + Method: "DELETE", + PathPattern: "/api/v1/statuses/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusDeleteReader{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.(*StatusDeleteOK) + 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 statusDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +StatusFave stars like favourite the given status if permitted +*/ +func (a *Client) StatusFave(params *StatusFaveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusFaveOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusFaveParams() + } + op := &runtime.ClientOperation{ + ID: "statusFave", + Method: "POST", + PathPattern: "/api/v1/statuses/{id}/favourite", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusFaveReader{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.(*StatusFaveOK) + 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 statusFave: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +StatusFavedBy views accounts that have faved starred liked the target status +*/ +func (a *Client) StatusFavedBy(params *StatusFavedByParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusFavedByOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusFavedByParams() + } + op := &runtime.ClientOperation{ + ID: "statusFavedBy", + Method: "GET", + PathPattern: "/api/v1/statuses/{id}/favourited_by", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusFavedByReader{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.(*StatusFavedByOK) + 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 statusFavedBy: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +StatusGet views status with the given ID +*/ +func (a *Client) StatusGet(params *StatusGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusGetParams() + } + op := &runtime.ClientOperation{ + ID: "statusGet", + Method: "GET", + PathPattern: "/api/v1/statuses/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusGetReader{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.(*StatusGetOK) + 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 statusGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +StatusHistoryGet views edit history of status with the given ID + +UNIMPLEMENTED: Currently this endpoint will always return an array of length 1, containing only the latest/current version of the status. +*/ +func (a *Client) StatusHistoryGet(params *StatusHistoryGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusHistoryGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusHistoryGetParams() + } + op := &runtime.ClientOperation{ + ID: "statusHistoryGet", + Method: "GET", + PathPattern: "/api/v1/statuses/{id}/history", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusHistoryGetReader{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.(*StatusHistoryGetOK) + 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 statusHistoryGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + StatusMute mutes a status s thread this prevents notifications from being created for future replies likes boosts etc in the thread of which the target status is a part + + Target status must belong to you or mention you. + +Status thread mutes and unmutes are idempotent. If you already mute a thread, muting it again just means it stays muted and you'll get 200 OK back. +*/ +func (a *Client) StatusMute(params *StatusMuteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusMuteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusMuteParams() + } + op := &runtime.ClientOperation{ + ID: "statusMute", + Method: "POST", + PathPattern: "/api/v1/statuses/{id}/mute", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusMuteReader{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.(*StatusMuteOK) + 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 statusMute: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + StatusPin pins a status to the top of your profile and add it to your featured activity pub collection + + You can only pin original posts (not reblogs) that you authored yourself. + +Supported privacy levels for pinned posts are public, unlisted, and private/followers-only, +but only public posts will appear on the web version of your profile. +*/ +func (a *Client) StatusPin(params *StatusPinParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusPinOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusPinParams() + } + op := &runtime.ClientOperation{ + ID: "statusPin", + Method: "POST", + PathPattern: "/api/v1/statuses/{id}/pin", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusPinReader{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.(*StatusPinOK) + 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 statusPin: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + StatusReblog reblogs boost status with the given ID + + If the target status is rebloggable/boostable, it will be shared with your followers. + +This is equivalent to an ActivityPub 'Announce' activity. +*/ +func (a *Client) StatusReblog(params *StatusReblogParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusReblogOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusReblogParams() + } + op := &runtime.ClientOperation{ + ID: "statusReblog", + Method: "POST", + PathPattern: "/api/v1/statuses/{id}/reblog", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusReblogReader{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.(*StatusReblogOK) + 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 statusReblog: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +StatusSourceGet views source text of status with the given ID requester must own the status +*/ +func (a *Client) StatusSourceGet(params *StatusSourceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusSourceGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusSourceGetParams() + } + op := &runtime.ClientOperation{ + ID: "statusSourceGet", + Method: "GET", + PathPattern: "/api/v1/statuses/{id}/source", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusSourceGetReader{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.(*StatusSourceGetOK) + 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 statusSourceGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +StatusUnbookmark unbookmarks status with the given ID +*/ +func (a *Client) StatusUnbookmark(params *StatusUnbookmarkParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusUnbookmarkOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusUnbookmarkParams() + } + op := &runtime.ClientOperation{ + ID: "statusUnbookmark", + Method: "POST", + PathPattern: "/api/v1/statuses/{id}/unbookmark", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusUnbookmarkReader{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.(*StatusUnbookmarkOK) + 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 statusUnbookmark: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +StatusUnfave unstars unlike unfavourite the given status +*/ +func (a *Client) StatusUnfave(params *StatusUnfaveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusUnfaveOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusUnfaveParams() + } + op := &runtime.ClientOperation{ + ID: "statusUnfave", + Method: "POST", + PathPattern: "/api/v1/statuses/{id}/unfavourite", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusUnfaveReader{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.(*StatusUnfaveOK) + 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 statusUnfave: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + StatusUnmute unmutes a status s thread this reenables notifications for future replies likes boosts etc in the thread of which the target status is a part + + Target status must belong to you or mention you. + +Status thread mutes and unmutes are idempotent. If you already unmuted a thread, unmuting it again just means it stays unmuted and you'll get 200 OK back. +*/ +func (a *Client) StatusUnmute(params *StatusUnmuteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusUnmuteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusUnmuteParams() + } + op := &runtime.ClientOperation{ + ID: "statusUnmute", + Method: "POST", + PathPattern: "/api/v1/statuses/{id}/unmute", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusUnmuteReader{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.(*StatusUnmuteOK) + 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 statusUnmute: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +StatusUnpin unpins one of your pinned statuses +*/ +func (a *Client) StatusUnpin(params *StatusUnpinParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusUnpinOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusUnpinParams() + } + op := &runtime.ClientOperation{ + ID: "statusUnpin", + Method: "POST", + PathPattern: "/api/v1/statuses/{id}/unpin", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusUnpinReader{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.(*StatusUnpinOK) + 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 statusUnpin: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +StatusUnreblog unreblogs unboost status with the given ID +*/ +func (a *Client) StatusUnreblog(params *StatusUnreblogParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusUnreblogOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusUnreblogParams() + } + op := &runtime.ClientOperation{ + ID: "statusUnreblog", + Method: "POST", + PathPattern: "/api/v1/statuses/{id}/unreblog", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusUnreblogReader{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.(*StatusUnreblogOK) + 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 statusUnreblog: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +ThreadContext returns ancestors and descendants of the given status + +The returned statuses will be ordered in a thread structure, so they are suitable to be displayed in the order in which they were returned. +*/ +func (a *Client) ThreadContext(params *ThreadContextParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ThreadContextOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewThreadContextParams() + } + op := &runtime.ClientOperation{ + ID: "threadContext", + Method: "GET", + PathPattern: "/api/v1/statuses/{id}/context", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ThreadContextReader{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.(*ThreadContextOK) + 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 threadContext: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/thread_context_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/thread_context_parameters.go new file mode 100644 index 0000000..f697a6c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/thread_context_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewThreadContextParams creates a new ThreadContextParams 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 NewThreadContextParams() *ThreadContextParams { + return &ThreadContextParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewThreadContextParamsWithTimeout creates a new ThreadContextParams object +// with the ability to set a timeout on a request. +func NewThreadContextParamsWithTimeout(timeout time.Duration) *ThreadContextParams { + return &ThreadContextParams{ + timeout: timeout, + } +} + +// NewThreadContextParamsWithContext creates a new ThreadContextParams object +// with the ability to set a context for a request. +func NewThreadContextParamsWithContext(ctx context.Context) *ThreadContextParams { + return &ThreadContextParams{ + Context: ctx, + } +} + +// NewThreadContextParamsWithHTTPClient creates a new ThreadContextParams object +// with the ability to set a custom HTTPClient for a request. +func NewThreadContextParamsWithHTTPClient(client *http.Client) *ThreadContextParams { + return &ThreadContextParams{ + HTTPClient: client, + } +} + +/* +ThreadContextParams contains all the parameters to send to the API endpoint + + for the thread context operation. + + Typically these are written to a http.Request. +*/ +type ThreadContextParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the thread context params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ThreadContextParams) WithDefaults() *ThreadContextParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the thread context params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ThreadContextParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the thread context params +func (o *ThreadContextParams) WithTimeout(timeout time.Duration) *ThreadContextParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the thread context params +func (o *ThreadContextParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the thread context params +func (o *ThreadContextParams) WithContext(ctx context.Context) *ThreadContextParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the thread context params +func (o *ThreadContextParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the thread context params +func (o *ThreadContextParams) WithHTTPClient(client *http.Client) *ThreadContextParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the thread context params +func (o *ThreadContextParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the thread context params +func (o *ThreadContextParams) WithID(id string) *ThreadContextParams { + o.SetID(id) + return o +} + +// SetID adds the id to the thread context params +func (o *ThreadContextParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *ThreadContextParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/thread_context_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/thread_context_responses.go new file mode 100644 index 0000000..9809eef --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/statuses/thread_context_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ThreadContextReader is a Reader for the ThreadContext structure. +type ThreadContextReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ThreadContextReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewThreadContextOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewThreadContextBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewThreadContextUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewThreadContextForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewThreadContextNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewThreadContextNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewThreadContextInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/statuses/{id}/context] threadContext", response, response.Code()) + } +} + +// NewThreadContextOK creates a ThreadContextOK with default headers values +func NewThreadContextOK() *ThreadContextOK { + return &ThreadContextOK{} +} + +/* +ThreadContextOK describes a response with status code 200, with default header values. + +Thread context object. +*/ +type ThreadContextOK struct { + Payload *models.ThreadContext +} + +// IsSuccess returns true when this thread context o k response has a 2xx status code +func (o *ThreadContextOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this thread context o k response has a 3xx status code +func (o *ThreadContextOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this thread context o k response has a 4xx status code +func (o *ThreadContextOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this thread context o k response has a 5xx status code +func (o *ThreadContextOK) IsServerError() bool { + return false +} + +// IsCode returns true when this thread context o k response a status code equal to that given +func (o *ThreadContextOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the thread context o k response +func (o *ThreadContextOK) Code() int { + return 200 +} + +func (o *ThreadContextOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextOK %s", 200, payload) +} + +func (o *ThreadContextOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextOK %s", 200, payload) +} + +func (o *ThreadContextOK) GetPayload() *models.ThreadContext { + return o.Payload +} + +func (o *ThreadContextOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ThreadContext) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewThreadContextBadRequest creates a ThreadContextBadRequest with default headers values +func NewThreadContextBadRequest() *ThreadContextBadRequest { + return &ThreadContextBadRequest{} +} + +/* +ThreadContextBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ThreadContextBadRequest struct { +} + +// IsSuccess returns true when this thread context bad request response has a 2xx status code +func (o *ThreadContextBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this thread context bad request response has a 3xx status code +func (o *ThreadContextBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this thread context bad request response has a 4xx status code +func (o *ThreadContextBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this thread context bad request response has a 5xx status code +func (o *ThreadContextBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this thread context bad request response a status code equal to that given +func (o *ThreadContextBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the thread context bad request response +func (o *ThreadContextBadRequest) Code() int { + return 400 +} + +func (o *ThreadContextBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextBadRequest", 400) +} + +func (o *ThreadContextBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextBadRequest", 400) +} + +func (o *ThreadContextBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewThreadContextUnauthorized creates a ThreadContextUnauthorized with default headers values +func NewThreadContextUnauthorized() *ThreadContextUnauthorized { + return &ThreadContextUnauthorized{} +} + +/* +ThreadContextUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ThreadContextUnauthorized struct { +} + +// IsSuccess returns true when this thread context unauthorized response has a 2xx status code +func (o *ThreadContextUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this thread context unauthorized response has a 3xx status code +func (o *ThreadContextUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this thread context unauthorized response has a 4xx status code +func (o *ThreadContextUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this thread context unauthorized response has a 5xx status code +func (o *ThreadContextUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this thread context unauthorized response a status code equal to that given +func (o *ThreadContextUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the thread context unauthorized response +func (o *ThreadContextUnauthorized) Code() int { + return 401 +} + +func (o *ThreadContextUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextUnauthorized", 401) +} + +func (o *ThreadContextUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextUnauthorized", 401) +} + +func (o *ThreadContextUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewThreadContextForbidden creates a ThreadContextForbidden with default headers values +func NewThreadContextForbidden() *ThreadContextForbidden { + return &ThreadContextForbidden{} +} + +/* +ThreadContextForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type ThreadContextForbidden struct { +} + +// IsSuccess returns true when this thread context forbidden response has a 2xx status code +func (o *ThreadContextForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this thread context forbidden response has a 3xx status code +func (o *ThreadContextForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this thread context forbidden response has a 4xx status code +func (o *ThreadContextForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this thread context forbidden response has a 5xx status code +func (o *ThreadContextForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this thread context forbidden response a status code equal to that given +func (o *ThreadContextForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the thread context forbidden response +func (o *ThreadContextForbidden) Code() int { + return 403 +} + +func (o *ThreadContextForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextForbidden", 403) +} + +func (o *ThreadContextForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextForbidden", 403) +} + +func (o *ThreadContextForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewThreadContextNotFound creates a ThreadContextNotFound with default headers values +func NewThreadContextNotFound() *ThreadContextNotFound { + return &ThreadContextNotFound{} +} + +/* +ThreadContextNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ThreadContextNotFound struct { +} + +// IsSuccess returns true when this thread context not found response has a 2xx status code +func (o *ThreadContextNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this thread context not found response has a 3xx status code +func (o *ThreadContextNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this thread context not found response has a 4xx status code +func (o *ThreadContextNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this thread context not found response has a 5xx status code +func (o *ThreadContextNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this thread context not found response a status code equal to that given +func (o *ThreadContextNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the thread context not found response +func (o *ThreadContextNotFound) Code() int { + return 404 +} + +func (o *ThreadContextNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextNotFound", 404) +} + +func (o *ThreadContextNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextNotFound", 404) +} + +func (o *ThreadContextNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewThreadContextNotAcceptable creates a ThreadContextNotAcceptable with default headers values +func NewThreadContextNotAcceptable() *ThreadContextNotAcceptable { + return &ThreadContextNotAcceptable{} +} + +/* +ThreadContextNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ThreadContextNotAcceptable struct { +} + +// IsSuccess returns true when this thread context not acceptable response has a 2xx status code +func (o *ThreadContextNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this thread context not acceptable response has a 3xx status code +func (o *ThreadContextNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this thread context not acceptable response has a 4xx status code +func (o *ThreadContextNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this thread context not acceptable response has a 5xx status code +func (o *ThreadContextNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this thread context not acceptable response a status code equal to that given +func (o *ThreadContextNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the thread context not acceptable response +func (o *ThreadContextNotAcceptable) Code() int { + return 406 +} + +func (o *ThreadContextNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextNotAcceptable", 406) +} + +func (o *ThreadContextNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextNotAcceptable", 406) +} + +func (o *ThreadContextNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewThreadContextInternalServerError creates a ThreadContextInternalServerError with default headers values +func NewThreadContextInternalServerError() *ThreadContextInternalServerError { + return &ThreadContextInternalServerError{} +} + +/* +ThreadContextInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ThreadContextInternalServerError struct { +} + +// IsSuccess returns true when this thread context internal server error response has a 2xx status code +func (o *ThreadContextInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this thread context internal server error response has a 3xx status code +func (o *ThreadContextInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this thread context internal server error response has a 4xx status code +func (o *ThreadContextInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this thread context internal server error response has a 5xx status code +func (o *ThreadContextInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this thread context internal server error response a status code equal to that given +func (o *ThreadContextInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the thread context internal server error response +func (o *ThreadContextInternalServerError) Code() int { + return 500 +} + +func (o *ThreadContextInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextInternalServerError", 500) +} + +func (o *ThreadContextInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextInternalServerError", 500) +} + +func (o *ThreadContextInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/streaming/stream_get_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/streaming/stream_get_parameters.go new file mode 100644 index 0000000..c66912a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/streaming/stream_get_parameters.go @@ -0,0 +1,263 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package streaming + +// 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" +) + +// NewStreamGetParams creates a new StreamGetParams 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 NewStreamGetParams() *StreamGetParams { + return &StreamGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStreamGetParamsWithTimeout creates a new StreamGetParams object +// with the ability to set a timeout on a request. +func NewStreamGetParamsWithTimeout(timeout time.Duration) *StreamGetParams { + return &StreamGetParams{ + timeout: timeout, + } +} + +// NewStreamGetParamsWithContext creates a new StreamGetParams object +// with the ability to set a context for a request. +func NewStreamGetParamsWithContext(ctx context.Context) *StreamGetParams { + return &StreamGetParams{ + Context: ctx, + } +} + +// NewStreamGetParamsWithHTTPClient creates a new StreamGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewStreamGetParamsWithHTTPClient(client *http.Client) *StreamGetParams { + return &StreamGetParams{ + HTTPClient: client, + } +} + +/* +StreamGetParams contains all the parameters to send to the API endpoint + + for the stream get operation. + + Typically these are written to a http.Request. +*/ +type StreamGetParams struct { + + /* AccessToken. + + Access token for the requesting account. + */ + AccessToken string + + /* List. + + ID of the list to subscribe to. + Only used if stream type is 'list'. + */ + List *string + + /* Stream. + + Type of stream to request. + + Options are: + + `user`: receive updates for the account's home timeline. + `public`: receive updates for the public timeline. + `public:local`: receive updates for the local timeline. + `hashtag`: receive updates for a given hashtag. + `hashtag:local`: receive local updates for a given hashtag. + `list`: receive updates for a certain list of accounts. + `direct`: receive updates for direct messages. + */ + Stream string + + /* Tag. + + Name of the tag to subscribe to. + Only used if stream type is 'hashtag' or 'hashtag:local'. + */ + Tag *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the stream get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StreamGetParams) WithDefaults() *StreamGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the stream get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StreamGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the stream get params +func (o *StreamGetParams) WithTimeout(timeout time.Duration) *StreamGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the stream get params +func (o *StreamGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the stream get params +func (o *StreamGetParams) WithContext(ctx context.Context) *StreamGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the stream get params +func (o *StreamGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the stream get params +func (o *StreamGetParams) WithHTTPClient(client *http.Client) *StreamGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the stream get params +func (o *StreamGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAccessToken adds the accessToken to the stream get params +func (o *StreamGetParams) WithAccessToken(accessToken string) *StreamGetParams { + o.SetAccessToken(accessToken) + return o +} + +// SetAccessToken adds the accessToken to the stream get params +func (o *StreamGetParams) SetAccessToken(accessToken string) { + o.AccessToken = accessToken +} + +// WithList adds the list to the stream get params +func (o *StreamGetParams) WithList(list *string) *StreamGetParams { + o.SetList(list) + return o +} + +// SetList adds the list to the stream get params +func (o *StreamGetParams) SetList(list *string) { + o.List = list +} + +// WithStream adds the stream to the stream get params +func (o *StreamGetParams) WithStream(stream string) *StreamGetParams { + o.SetStream(stream) + return o +} + +// SetStream adds the stream to the stream get params +func (o *StreamGetParams) SetStream(stream string) { + o.Stream = stream +} + +// WithTag adds the tag to the stream get params +func (o *StreamGetParams) WithTag(tag *string) *StreamGetParams { + o.SetTag(tag) + return o +} + +// SetTag adds the tag to the stream get params +func (o *StreamGetParams) SetTag(tag *string) { + o.Tag = tag +} + +// WriteToRequest writes these params to a swagger request +func (o *StreamGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param access_token + qrAccessToken := o.AccessToken + qAccessToken := qrAccessToken + if qAccessToken != "" { + + if err := r.SetQueryParam("access_token", qAccessToken); err != nil { + return err + } + } + + if o.List != nil { + + // query param list + var qrList string + + if o.List != nil { + qrList = *o.List + } + qList := qrList + if qList != "" { + + if err := r.SetQueryParam("list", qList); err != nil { + return err + } + } + } + + // query param stream + qrStream := o.Stream + qStream := qrStream + if qStream != "" { + + if err := r.SetQueryParam("stream", qStream); err != nil { + return err + } + } + + if o.Tag != nil { + + // query param tag + var qrTag string + + if o.Tag != nil { + qrTag = *o.Tag + } + qTag := qrTag + if qTag != "" { + + if err := r.SetQueryParam("tag", qTag); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/streaming/stream_get_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/streaming/stream_get_responses.go new file mode 100644 index 0000000..77cab35 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/streaming/stream_get_responses.go @@ -0,0 +1,389 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package streaming + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// StreamGetReader is a Reader for the StreamGet structure. +type StreamGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StreamGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 101: + result := NewStreamGetSwitchingProtocols() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 400: + result := NewStreamGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStreamGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/streaming] streamGet", response, response.Code()) + } +} + +// NewStreamGetSwitchingProtocols creates a StreamGetSwitchingProtocols with default headers values +func NewStreamGetSwitchingProtocols() *StreamGetSwitchingProtocols { + return &StreamGetSwitchingProtocols{} +} + +/* +StreamGetSwitchingProtocols describes a response with status code 101, with default header values. + +StreamGetSwitchingProtocols stream get switching protocols +*/ +type StreamGetSwitchingProtocols struct { + Payload *StreamGetSwitchingProtocolsBody +} + +// IsSuccess returns true when this stream get switching protocols response has a 2xx status code +func (o *StreamGetSwitchingProtocols) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this stream get switching protocols response has a 3xx status code +func (o *StreamGetSwitchingProtocols) IsRedirect() bool { + return false +} + +// IsClientError returns true when this stream get switching protocols response has a 4xx status code +func (o *StreamGetSwitchingProtocols) IsClientError() bool { + return false +} + +// IsServerError returns true when this stream get switching protocols response has a 5xx status code +func (o *StreamGetSwitchingProtocols) IsServerError() bool { + return false +} + +// IsCode returns true when this stream get switching protocols response a status code equal to that given +func (o *StreamGetSwitchingProtocols) IsCode(code int) bool { + return code == 101 +} + +// Code gets the status code for the stream get switching protocols response +func (o *StreamGetSwitchingProtocols) Code() int { + return 101 +} + +func (o *StreamGetSwitchingProtocols) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/streaming][%d] streamGetSwitchingProtocols %s", 101, payload) +} + +func (o *StreamGetSwitchingProtocols) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/streaming][%d] streamGetSwitchingProtocols %s", 101, payload) +} + +func (o *StreamGetSwitchingProtocols) GetPayload() *StreamGetSwitchingProtocolsBody { + return o.Payload +} + +func (o *StreamGetSwitchingProtocols) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(StreamGetSwitchingProtocolsBody) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStreamGetBadRequest creates a StreamGetBadRequest with default headers values +func NewStreamGetBadRequest() *StreamGetBadRequest { + return &StreamGetBadRequest{} +} + +/* +StreamGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StreamGetBadRequest struct { +} + +// IsSuccess returns true when this stream get bad request response has a 2xx status code +func (o *StreamGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this stream get bad request response has a 3xx status code +func (o *StreamGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this stream get bad request response has a 4xx status code +func (o *StreamGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this stream get bad request response has a 5xx status code +func (o *StreamGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this stream get bad request response a status code equal to that given +func (o *StreamGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the stream get bad request response +func (o *StreamGetBadRequest) Code() int { + return 400 +} + +func (o *StreamGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/streaming][%d] streamGetBadRequest", 400) +} + +func (o *StreamGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/streaming][%d] streamGetBadRequest", 400) +} + +func (o *StreamGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStreamGetUnauthorized creates a StreamGetUnauthorized with default headers values +func NewStreamGetUnauthorized() *StreamGetUnauthorized { + return &StreamGetUnauthorized{} +} + +/* +StreamGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StreamGetUnauthorized struct { +} + +// IsSuccess returns true when this stream get unauthorized response has a 2xx status code +func (o *StreamGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this stream get unauthorized response has a 3xx status code +func (o *StreamGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this stream get unauthorized response has a 4xx status code +func (o *StreamGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this stream get unauthorized response has a 5xx status code +func (o *StreamGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this stream get unauthorized response a status code equal to that given +func (o *StreamGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the stream get unauthorized response +func (o *StreamGetUnauthorized) Code() int { + return 401 +} + +func (o *StreamGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/streaming][%d] streamGetUnauthorized", 401) +} + +func (o *StreamGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/streaming][%d] streamGetUnauthorized", 401) +} + +func (o *StreamGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +/* +StreamGetSwitchingProtocolsBody stream get switching protocols body +swagger:model StreamGetSwitchingProtocolsBody +*/ +type StreamGetSwitchingProtocolsBody struct { + + // The type of event being received. + // + // `update`: a new status has been received. + // `notification`: a new notification has been received. + // `delete`: a status has been deleted. + // `filters_changed`: filters (including keywords and statuses) have changed. + // Enum: ["update","notification","delete","filters_changed"] + Event string `json:"event,omitempty"` + + // The payload of the streamed message. + // Different depending on the `event` type. + // + // If present, it should be parsed as a string. + // + // If `event` = `update`, then the payload will be a JSON string of a status. + // If `event` = `notification`, then the payload will be a JSON string of a notification. + // If `event` = `delete`, then the payload will be a status ID. + // If `event` = `filters_changed`, then there is no payload. + // Example: {\"id\":\"01FC3TZ5CFG6H65GCKCJRKA669\",\"created_at\":\"2021-08-02T16:25:52Z\",\"sensitive\":false,\"spoiler_text\":\"\",\"visibility\":\"public\",\"language\":\"en\",\"uri\":\"https://gts.superseriousbusiness.org/users/dumpsterqueer/statuses/01FC3TZ5CFG6H65GCKCJRKA669\",\"url\":\"https://gts.superseriousbusiness.org/@dumpsterqueer/statuses/01FC3TZ5CFG6H65GCKCJRKA669\",\"replies_count\":0,\"reblogs_count\":0,\"favourites_count\":0,\"favourited\":false,\"reblogged\":false,\"muted\":false,\"bookmarked\":fals…//gts.superseriousbusiness.org/fileserver/01JNN207W98SGG3CBJ76R5MVDN/header/original/019036W043D8FXPJKSKCX7G965.png\",\"header_static\":\"https://gts.superseriousbusiness.org/fileserver/01JNN207W98SGG3CBJ76R5MVDN/header/small/019036W043D8FXPJKSKCX7G965.png\",\"followers_count\":33,\"following_count\":28,\"statuses_count\":126,\"last_status_at\":\"2021-08-02T16:25:52Z\",\"emojis\":[],\"fields\":[]},\"media_attachments\":[],\"mentions\":[],\"tags\":[],\"emojis\":[],\"card\":null,\"poll\":null,\"text\":\"a\"} + Payload string `json:"payload,omitempty"` + + // stream + Stream []string `json:"stream"` +} + +// Validate validates this stream get switching protocols body +func (o *StreamGetSwitchingProtocolsBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateEvent(formats); err != nil { + res = append(res, err) + } + + if err := o.validateStream(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var streamGetSwitchingProtocolsBodyTypeEventPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["update","notification","delete","filters_changed"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + streamGetSwitchingProtocolsBodyTypeEventPropEnum = append(streamGetSwitchingProtocolsBodyTypeEventPropEnum, v) + } +} + +const ( + + // StreamGetSwitchingProtocolsBodyEventUpdate captures enum value "update" + StreamGetSwitchingProtocolsBodyEventUpdate string = "update" + + // StreamGetSwitchingProtocolsBodyEventNotification captures enum value "notification" + StreamGetSwitchingProtocolsBodyEventNotification string = "notification" + + // StreamGetSwitchingProtocolsBodyEventDelete captures enum value "delete" + StreamGetSwitchingProtocolsBodyEventDelete string = "delete" + + // StreamGetSwitchingProtocolsBodyEventFiltersChanged captures enum value "filters_changed" + StreamGetSwitchingProtocolsBodyEventFiltersChanged string = "filters_changed" +) + +// prop value enum +func (o *StreamGetSwitchingProtocolsBody) validateEventEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, streamGetSwitchingProtocolsBodyTypeEventPropEnum, true); err != nil { + return err + } + return nil +} + +func (o *StreamGetSwitchingProtocolsBody) validateEvent(formats strfmt.Registry) error { + if swag.IsZero(o.Event) { // not required + return nil + } + + // value enum + if err := o.validateEventEnum("streamGetSwitchingProtocols"+"."+"event", "body", o.Event); err != nil { + return err + } + + return nil +} + +var streamGetSwitchingProtocolsBodyStreamItemsEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["user","public","public:local","hashtag","hashtag:local","list","direct"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + streamGetSwitchingProtocolsBodyStreamItemsEnum = append(streamGetSwitchingProtocolsBodyStreamItemsEnum, v) + } +} + +func (o *StreamGetSwitchingProtocolsBody) validateStreamItemsEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, streamGetSwitchingProtocolsBodyStreamItemsEnum, true); err != nil { + return err + } + return nil +} + +func (o *StreamGetSwitchingProtocolsBody) validateStream(formats strfmt.Registry) error { + if swag.IsZero(o.Stream) { // not required + return nil + } + + for i := 0; i < len(o.Stream); i++ { + + // value enum + if err := o.validateStreamItemsEnum("streamGetSwitchingProtocols"+"."+"stream"+"."+strconv.Itoa(i), "body", o.Stream[i]); err != nil { + return err + } + + } + + return nil +} + +// ContextValidate validates this stream get switching protocols body based on context it is used +func (o *StreamGetSwitchingProtocolsBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *StreamGetSwitchingProtocolsBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *StreamGetSwitchingProtocolsBody) UnmarshalBinary(b []byte) error { + var res StreamGetSwitchingProtocolsBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/streaming/streaming_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/streaming/streaming_client.go new file mode 100644 index 0000000..9c9f6a4 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/streaming/streaming_client.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package streaming + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new streaming API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new streaming API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new streaming API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for streaming API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + StreamGet(params *StreamGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error + + SetTransport(transport runtime.ClientTransport) +} + +/* + StreamGet initiates a websocket connection for live streaming of statuses and notifications + + The scheme used should *always* be `wss`. The streaming basepath can be viewed at `/api/v1/instance`. + +On a successful connection, a code `101` will be returned, which indicates that the connection is being upgraded to a secure websocket connection. + +As long as the connection is open, various message types will be streamed into it. + +GoToSocial will ping the connection every 30 seconds to check whether the client is still receiving. + +If the ping fails, or something else goes wrong during transmission, then the connection will be dropped, and the client will be expected to start it again. +*/ +func (a *Client) StreamGet(params *StreamGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error { + // TODO: Validate the params before sending + if params == nil { + params = NewStreamGetParams() + } + op := &runtime.ClientOperation{ + ID: "streamGet", + Method: "GET", + PathPattern: "/api/v1/streaming", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https", "wss"}, + Params: params, + Reader: &StreamGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + _, err := a.transport.Submit(op) + if err != nil { + return err + } + return nil +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/home_timeline_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/home_timeline_parameters.go new file mode 100644 index 0000000..f7affdf --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/home_timeline_parameters.go @@ -0,0 +1,316 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timelines + +// 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" +) + +// NewHomeTimelineParams creates a new HomeTimelineParams 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 NewHomeTimelineParams() *HomeTimelineParams { + return &HomeTimelineParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHomeTimelineParamsWithTimeout creates a new HomeTimelineParams object +// with the ability to set a timeout on a request. +func NewHomeTimelineParamsWithTimeout(timeout time.Duration) *HomeTimelineParams { + return &HomeTimelineParams{ + timeout: timeout, + } +} + +// NewHomeTimelineParamsWithContext creates a new HomeTimelineParams object +// with the ability to set a context for a request. +func NewHomeTimelineParamsWithContext(ctx context.Context) *HomeTimelineParams { + return &HomeTimelineParams{ + Context: ctx, + } +} + +// NewHomeTimelineParamsWithHTTPClient creates a new HomeTimelineParams object +// with the ability to set a custom HTTPClient for a request. +func NewHomeTimelineParamsWithHTTPClient(client *http.Client) *HomeTimelineParams { + return &HomeTimelineParams{ + HTTPClient: client, + } +} + +/* +HomeTimelineParams contains all the parameters to send to the API endpoint + + for the home timeline operation. + + Typically these are written to a http.Request. +*/ +type HomeTimelineParams struct { + + /* Limit. + + Number of statuses to return. + + Default: 20 + */ + Limit *int64 + + /* Local. + + Show only statuses posted by local accounts. + */ + Local *bool + + /* MaxID. + + Return only statuses *OLDER* than the given max status ID. The status with the specified ID will not be included in the response. + */ + MaxID *string + + /* MinID. + + Return only statuses *immediately newer* than the given since status ID. The status with the specified ID will not be included in the response. + */ + MinID *string + + /* SinceID. + + Return only statuses *newer* than the given since status ID. The status with the specified ID will not be included in the response. + */ + SinceID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the home timeline params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HomeTimelineParams) WithDefaults() *HomeTimelineParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the home timeline params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HomeTimelineParams) SetDefaults() { + var ( + limitDefault = int64(20) + + localDefault = bool(false) + ) + + val := HomeTimelineParams{ + Limit: &limitDefault, + Local: &localDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the home timeline params +func (o *HomeTimelineParams) WithTimeout(timeout time.Duration) *HomeTimelineParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the home timeline params +func (o *HomeTimelineParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the home timeline params +func (o *HomeTimelineParams) WithContext(ctx context.Context) *HomeTimelineParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the home timeline params +func (o *HomeTimelineParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the home timeline params +func (o *HomeTimelineParams) WithHTTPClient(client *http.Client) *HomeTimelineParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the home timeline params +func (o *HomeTimelineParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the home timeline params +func (o *HomeTimelineParams) WithLimit(limit *int64) *HomeTimelineParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the home timeline params +func (o *HomeTimelineParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithLocal adds the local to the home timeline params +func (o *HomeTimelineParams) WithLocal(local *bool) *HomeTimelineParams { + o.SetLocal(local) + return o +} + +// SetLocal adds the local to the home timeline params +func (o *HomeTimelineParams) SetLocal(local *bool) { + o.Local = local +} + +// WithMaxID adds the maxID to the home timeline params +func (o *HomeTimelineParams) WithMaxID(maxID *string) *HomeTimelineParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the home timeline params +func (o *HomeTimelineParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the home timeline params +func (o *HomeTimelineParams) WithMinID(minID *string) *HomeTimelineParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the home timeline params +func (o *HomeTimelineParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the home timeline params +func (o *HomeTimelineParams) WithSinceID(sinceID *string) *HomeTimelineParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the home timeline params +func (o *HomeTimelineParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WriteToRequest writes these params to a swagger request +func (o *HomeTimelineParams) 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.Local != nil { + + // query param local + var qrLocal bool + + if o.Local != nil { + qrLocal = *o.Local + } + qLocal := swag.FormatBool(qrLocal) + if qLocal != "" { + + if err := r.SetQueryParam("local", qLocal); err != nil { + return err + } + } + } + + if o.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if o.SinceID != nil { + + // query param since_id + var qrSinceID string + + if o.SinceID != nil { + qrSinceID = *o.SinceID + } + qSinceID := qrSinceID + if qSinceID != "" { + + if err := r.SetQueryParam("since_id", qSinceID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/home_timeline_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/home_timeline_responses.go new file mode 100644 index 0000000..6dc2b05 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/home_timeline_responses.go @@ -0,0 +1,240 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timelines + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// HomeTimelineReader is a Reader for the HomeTimeline structure. +type HomeTimelineReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HomeTimelineReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHomeTimelineOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewHomeTimelineBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewHomeTimelineUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/timelines/home] homeTimeline", response, response.Code()) + } +} + +// NewHomeTimelineOK creates a HomeTimelineOK with default headers values +func NewHomeTimelineOK() *HomeTimelineOK { + return &HomeTimelineOK{} +} + +/* +HomeTimelineOK describes a response with status code 200, with default header values. + +Array of statuses. +*/ +type HomeTimelineOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Status +} + +// IsSuccess returns true when this home timeline o k response has a 2xx status code +func (o *HomeTimelineOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this home timeline o k response has a 3xx status code +func (o *HomeTimelineOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this home timeline o k response has a 4xx status code +func (o *HomeTimelineOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this home timeline o k response has a 5xx status code +func (o *HomeTimelineOK) IsServerError() bool { + return false +} + +// IsCode returns true when this home timeline o k response a status code equal to that given +func (o *HomeTimelineOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the home timeline o k response +func (o *HomeTimelineOK) Code() int { + return 200 +} + +func (o *HomeTimelineOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/timelines/home][%d] homeTimelineOK %s", 200, payload) +} + +func (o *HomeTimelineOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/timelines/home][%d] homeTimelineOK %s", 200, payload) +} + +func (o *HomeTimelineOK) GetPayload() []*models.Status { + return o.Payload +} + +func (o *HomeTimelineOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewHomeTimelineBadRequest creates a HomeTimelineBadRequest with default headers values +func NewHomeTimelineBadRequest() *HomeTimelineBadRequest { + return &HomeTimelineBadRequest{} +} + +/* +HomeTimelineBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type HomeTimelineBadRequest struct { +} + +// IsSuccess returns true when this home timeline bad request response has a 2xx status code +func (o *HomeTimelineBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this home timeline bad request response has a 3xx status code +func (o *HomeTimelineBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this home timeline bad request response has a 4xx status code +func (o *HomeTimelineBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this home timeline bad request response has a 5xx status code +func (o *HomeTimelineBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this home timeline bad request response a status code equal to that given +func (o *HomeTimelineBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the home timeline bad request response +func (o *HomeTimelineBadRequest) Code() int { + return 400 +} + +func (o *HomeTimelineBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/timelines/home][%d] homeTimelineBadRequest", 400) +} + +func (o *HomeTimelineBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/timelines/home][%d] homeTimelineBadRequest", 400) +} + +func (o *HomeTimelineBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHomeTimelineUnauthorized creates a HomeTimelineUnauthorized with default headers values +func NewHomeTimelineUnauthorized() *HomeTimelineUnauthorized { + return &HomeTimelineUnauthorized{} +} + +/* +HomeTimelineUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type HomeTimelineUnauthorized struct { +} + +// IsSuccess returns true when this home timeline unauthorized response has a 2xx status code +func (o *HomeTimelineUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this home timeline unauthorized response has a 3xx status code +func (o *HomeTimelineUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this home timeline unauthorized response has a 4xx status code +func (o *HomeTimelineUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this home timeline unauthorized response has a 5xx status code +func (o *HomeTimelineUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this home timeline unauthorized response a status code equal to that given +func (o *HomeTimelineUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the home timeline unauthorized response +func (o *HomeTimelineUnauthorized) Code() int { + return 401 +} + +func (o *HomeTimelineUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/timelines/home][%d] homeTimelineUnauthorized", 401) +} + +func (o *HomeTimelineUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/timelines/home][%d] homeTimelineUnauthorized", 401) +} + +func (o *HomeTimelineUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/list_timeline_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/list_timeline_parameters.go new file mode 100644 index 0000000..b01b033 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/list_timeline_parameters.go @@ -0,0 +1,301 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timelines + +// 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" +) + +// NewListTimelineParams creates a new ListTimelineParams 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 NewListTimelineParams() *ListTimelineParams { + return &ListTimelineParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListTimelineParamsWithTimeout creates a new ListTimelineParams object +// with the ability to set a timeout on a request. +func NewListTimelineParamsWithTimeout(timeout time.Duration) *ListTimelineParams { + return &ListTimelineParams{ + timeout: timeout, + } +} + +// NewListTimelineParamsWithContext creates a new ListTimelineParams object +// with the ability to set a context for a request. +func NewListTimelineParamsWithContext(ctx context.Context) *ListTimelineParams { + return &ListTimelineParams{ + Context: ctx, + } +} + +// NewListTimelineParamsWithHTTPClient creates a new ListTimelineParams object +// with the ability to set a custom HTTPClient for a request. +func NewListTimelineParamsWithHTTPClient(client *http.Client) *ListTimelineParams { + return &ListTimelineParams{ + HTTPClient: client, + } +} + +/* +ListTimelineParams contains all the parameters to send to the API endpoint + + for the list timeline operation. + + Typically these are written to a http.Request. +*/ +type ListTimelineParams struct { + + /* ID. + + ID of the list + */ + ID string + + /* Limit. + + Number of statuses to return. + + Default: 20 + */ + Limit *int64 + + /* MaxID. + + Return only statuses *OLDER* than the given max status ID. The status with the specified ID will not be included in the response. + */ + MaxID *string + + /* MinID. + + Return only statuses *NEWER* than the given since status ID. The status with the specified ID will not be included in the response. + */ + MinID *string + + /* SinceID. + + Return only statuses *NEWER* than the given since status ID. The status with the specified ID will not be included in the response. + */ + SinceID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list timeline params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListTimelineParams) WithDefaults() *ListTimelineParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list timeline params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListTimelineParams) SetDefaults() { + var ( + limitDefault = int64(20) + ) + + val := ListTimelineParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the list timeline params +func (o *ListTimelineParams) WithTimeout(timeout time.Duration) *ListTimelineParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list timeline params +func (o *ListTimelineParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list timeline params +func (o *ListTimelineParams) WithContext(ctx context.Context) *ListTimelineParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list timeline params +func (o *ListTimelineParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list timeline params +func (o *ListTimelineParams) WithHTTPClient(client *http.Client) *ListTimelineParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list timeline params +func (o *ListTimelineParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the list timeline params +func (o *ListTimelineParams) WithID(id string) *ListTimelineParams { + o.SetID(id) + return o +} + +// SetID adds the id to the list timeline params +func (o *ListTimelineParams) SetID(id string) { + o.ID = id +} + +// WithLimit adds the limit to the list timeline params +func (o *ListTimelineParams) WithLimit(limit *int64) *ListTimelineParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the list timeline params +func (o *ListTimelineParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the list timeline params +func (o *ListTimelineParams) WithMaxID(maxID *string) *ListTimelineParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the list timeline params +func (o *ListTimelineParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the list timeline params +func (o *ListTimelineParams) WithMinID(minID *string) *ListTimelineParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the list timeline params +func (o *ListTimelineParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the list timeline params +func (o *ListTimelineParams) WithSinceID(sinceID *string) *ListTimelineParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the list timeline params +func (o *ListTimelineParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListTimelineParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); 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.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if o.SinceID != nil { + + // query param since_id + var qrSinceID string + + if o.SinceID != nil { + qrSinceID = *o.SinceID + } + qSinceID := qrSinceID + if qSinceID != "" { + + if err := r.SetQueryParam("since_id", qSinceID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/list_timeline_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/list_timeline_responses.go new file mode 100644 index 0000000..ca26ab7 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/list_timeline_responses.go @@ -0,0 +1,240 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timelines + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ListTimelineReader is a Reader for the ListTimeline structure. +type ListTimelineReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListTimelineReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListTimelineOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewListTimelineBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewListTimelineUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/timelines/list/{id}] listTimeline", response, response.Code()) + } +} + +// NewListTimelineOK creates a ListTimelineOK with default headers values +func NewListTimelineOK() *ListTimelineOK { + return &ListTimelineOK{} +} + +/* +ListTimelineOK describes a response with status code 200, with default header values. + +Array of statuses. +*/ +type ListTimelineOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Status +} + +// IsSuccess returns true when this list timeline o k response has a 2xx status code +func (o *ListTimelineOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list timeline o k response has a 3xx status code +func (o *ListTimelineOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list timeline o k response has a 4xx status code +func (o *ListTimelineOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list timeline o k response has a 5xx status code +func (o *ListTimelineOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list timeline o k response a status code equal to that given +func (o *ListTimelineOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list timeline o k response +func (o *ListTimelineOK) Code() int { + return 200 +} + +func (o *ListTimelineOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/timelines/list/{id}][%d] listTimelineOK %s", 200, payload) +} + +func (o *ListTimelineOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/timelines/list/{id}][%d] listTimelineOK %s", 200, payload) +} + +func (o *ListTimelineOK) GetPayload() []*models.Status { + return o.Payload +} + +func (o *ListTimelineOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListTimelineBadRequest creates a ListTimelineBadRequest with default headers values +func NewListTimelineBadRequest() *ListTimelineBadRequest { + return &ListTimelineBadRequest{} +} + +/* +ListTimelineBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ListTimelineBadRequest struct { +} + +// IsSuccess returns true when this list timeline bad request response has a 2xx status code +func (o *ListTimelineBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list timeline bad request response has a 3xx status code +func (o *ListTimelineBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list timeline bad request response has a 4xx status code +func (o *ListTimelineBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this list timeline bad request response has a 5xx status code +func (o *ListTimelineBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this list timeline bad request response a status code equal to that given +func (o *ListTimelineBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the list timeline bad request response +func (o *ListTimelineBadRequest) Code() int { + return 400 +} + +func (o *ListTimelineBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/timelines/list/{id}][%d] listTimelineBadRequest", 400) +} + +func (o *ListTimelineBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/timelines/list/{id}][%d] listTimelineBadRequest", 400) +} + +func (o *ListTimelineBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListTimelineUnauthorized creates a ListTimelineUnauthorized with default headers values +func NewListTimelineUnauthorized() *ListTimelineUnauthorized { + return &ListTimelineUnauthorized{} +} + +/* +ListTimelineUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ListTimelineUnauthorized struct { +} + +// IsSuccess returns true when this list timeline unauthorized response has a 2xx status code +func (o *ListTimelineUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list timeline unauthorized response has a 3xx status code +func (o *ListTimelineUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list timeline unauthorized response has a 4xx status code +func (o *ListTimelineUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this list timeline unauthorized response has a 5xx status code +func (o *ListTimelineUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this list timeline unauthorized response a status code equal to that given +func (o *ListTimelineUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the list timeline unauthorized response +func (o *ListTimelineUnauthorized) Code() int { + return 401 +} + +func (o *ListTimelineUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/timelines/list/{id}][%d] listTimelineUnauthorized", 401) +} + +func (o *ListTimelineUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/timelines/list/{id}][%d] listTimelineUnauthorized", 401) +} + +func (o *ListTimelineUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/public_timeline_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/public_timeline_parameters.go new file mode 100644 index 0000000..5f92648 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/public_timeline_parameters.go @@ -0,0 +1,316 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timelines + +// 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" +) + +// NewPublicTimelineParams creates a new PublicTimelineParams 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 NewPublicTimelineParams() *PublicTimelineParams { + return &PublicTimelineParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPublicTimelineParamsWithTimeout creates a new PublicTimelineParams object +// with the ability to set a timeout on a request. +func NewPublicTimelineParamsWithTimeout(timeout time.Duration) *PublicTimelineParams { + return &PublicTimelineParams{ + timeout: timeout, + } +} + +// NewPublicTimelineParamsWithContext creates a new PublicTimelineParams object +// with the ability to set a context for a request. +func NewPublicTimelineParamsWithContext(ctx context.Context) *PublicTimelineParams { + return &PublicTimelineParams{ + Context: ctx, + } +} + +// NewPublicTimelineParamsWithHTTPClient creates a new PublicTimelineParams object +// with the ability to set a custom HTTPClient for a request. +func NewPublicTimelineParamsWithHTTPClient(client *http.Client) *PublicTimelineParams { + return &PublicTimelineParams{ + HTTPClient: client, + } +} + +/* +PublicTimelineParams contains all the parameters to send to the API endpoint + + for the public timeline operation. + + Typically these are written to a http.Request. +*/ +type PublicTimelineParams struct { + + /* Limit. + + Number of statuses to return. + + Default: 20 + */ + Limit *int64 + + /* Local. + + Show only statuses posted by local accounts. + */ + Local *bool + + /* MaxID. + + Return only statuses *OLDER* than the given max status ID. The status with the specified ID will not be included in the response. + */ + MaxID *string + + /* MinID. + + Return only statuses *NEWER* than the given since status ID. The status with the specified ID will not be included in the response. + */ + MinID *string + + /* SinceID. + + Return only statuses *NEWER* than the given since status ID. The status with the specified ID will not be included in the response. + */ + SinceID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the public timeline params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PublicTimelineParams) WithDefaults() *PublicTimelineParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the public timeline params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PublicTimelineParams) SetDefaults() { + var ( + limitDefault = int64(20) + + localDefault = bool(false) + ) + + val := PublicTimelineParams{ + Limit: &limitDefault, + Local: &localDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the public timeline params +func (o *PublicTimelineParams) WithTimeout(timeout time.Duration) *PublicTimelineParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the public timeline params +func (o *PublicTimelineParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the public timeline params +func (o *PublicTimelineParams) WithContext(ctx context.Context) *PublicTimelineParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the public timeline params +func (o *PublicTimelineParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the public timeline params +func (o *PublicTimelineParams) WithHTTPClient(client *http.Client) *PublicTimelineParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the public timeline params +func (o *PublicTimelineParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the public timeline params +func (o *PublicTimelineParams) WithLimit(limit *int64) *PublicTimelineParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the public timeline params +func (o *PublicTimelineParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithLocal adds the local to the public timeline params +func (o *PublicTimelineParams) WithLocal(local *bool) *PublicTimelineParams { + o.SetLocal(local) + return o +} + +// SetLocal adds the local to the public timeline params +func (o *PublicTimelineParams) SetLocal(local *bool) { + o.Local = local +} + +// WithMaxID adds the maxID to the public timeline params +func (o *PublicTimelineParams) WithMaxID(maxID *string) *PublicTimelineParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the public timeline params +func (o *PublicTimelineParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the public timeline params +func (o *PublicTimelineParams) WithMinID(minID *string) *PublicTimelineParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the public timeline params +func (o *PublicTimelineParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the public timeline params +func (o *PublicTimelineParams) WithSinceID(sinceID *string) *PublicTimelineParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the public timeline params +func (o *PublicTimelineParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PublicTimelineParams) 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.Local != nil { + + // query param local + var qrLocal bool + + if o.Local != nil { + qrLocal = *o.Local + } + qLocal := swag.FormatBool(qrLocal) + if qLocal != "" { + + if err := r.SetQueryParam("local", qLocal); err != nil { + return err + } + } + } + + if o.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if o.SinceID != nil { + + // query param since_id + var qrSinceID string + + if o.SinceID != nil { + qrSinceID = *o.SinceID + } + qSinceID := qrSinceID + if qSinceID != "" { + + if err := r.SetQueryParam("since_id", qSinceID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/public_timeline_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/public_timeline_responses.go new file mode 100644 index 0000000..e1e336c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/public_timeline_responses.go @@ -0,0 +1,240 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timelines + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// PublicTimelineReader is a Reader for the PublicTimeline structure. +type PublicTimelineReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PublicTimelineReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPublicTimelineOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPublicTimelineBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPublicTimelineUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/timelines/public] publicTimeline", response, response.Code()) + } +} + +// NewPublicTimelineOK creates a PublicTimelineOK with default headers values +func NewPublicTimelineOK() *PublicTimelineOK { + return &PublicTimelineOK{} +} + +/* +PublicTimelineOK describes a response with status code 200, with default header values. + +Array of statuses. +*/ +type PublicTimelineOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Status +} + +// IsSuccess returns true when this public timeline o k response has a 2xx status code +func (o *PublicTimelineOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this public timeline o k response has a 3xx status code +func (o *PublicTimelineOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this public timeline o k response has a 4xx status code +func (o *PublicTimelineOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this public timeline o k response has a 5xx status code +func (o *PublicTimelineOK) IsServerError() bool { + return false +} + +// IsCode returns true when this public timeline o k response a status code equal to that given +func (o *PublicTimelineOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the public timeline o k response +func (o *PublicTimelineOK) Code() int { + return 200 +} + +func (o *PublicTimelineOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/timelines/public][%d] publicTimelineOK %s", 200, payload) +} + +func (o *PublicTimelineOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/timelines/public][%d] publicTimelineOK %s", 200, payload) +} + +func (o *PublicTimelineOK) GetPayload() []*models.Status { + return o.Payload +} + +func (o *PublicTimelineOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPublicTimelineBadRequest creates a PublicTimelineBadRequest with default headers values +func NewPublicTimelineBadRequest() *PublicTimelineBadRequest { + return &PublicTimelineBadRequest{} +} + +/* +PublicTimelineBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type PublicTimelineBadRequest struct { +} + +// IsSuccess returns true when this public timeline bad request response has a 2xx status code +func (o *PublicTimelineBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this public timeline bad request response has a 3xx status code +func (o *PublicTimelineBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this public timeline bad request response has a 4xx status code +func (o *PublicTimelineBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this public timeline bad request response has a 5xx status code +func (o *PublicTimelineBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this public timeline bad request response a status code equal to that given +func (o *PublicTimelineBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the public timeline bad request response +func (o *PublicTimelineBadRequest) Code() int { + return 400 +} + +func (o *PublicTimelineBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/timelines/public][%d] publicTimelineBadRequest", 400) +} + +func (o *PublicTimelineBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/timelines/public][%d] publicTimelineBadRequest", 400) +} + +func (o *PublicTimelineBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPublicTimelineUnauthorized creates a PublicTimelineUnauthorized with default headers values +func NewPublicTimelineUnauthorized() *PublicTimelineUnauthorized { + return &PublicTimelineUnauthorized{} +} + +/* +PublicTimelineUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type PublicTimelineUnauthorized struct { +} + +// IsSuccess returns true when this public timeline unauthorized response has a 2xx status code +func (o *PublicTimelineUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this public timeline unauthorized response has a 3xx status code +func (o *PublicTimelineUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this public timeline unauthorized response has a 4xx status code +func (o *PublicTimelineUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this public timeline unauthorized response has a 5xx status code +func (o *PublicTimelineUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this public timeline unauthorized response a status code equal to that given +func (o *PublicTimelineUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the public timeline unauthorized response +func (o *PublicTimelineUnauthorized) Code() int { + return 401 +} + +func (o *PublicTimelineUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/timelines/public][%d] publicTimelineUnauthorized", 401) +} + +func (o *PublicTimelineUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/timelines/public][%d] publicTimelineUnauthorized", 401) +} + +func (o *PublicTimelineUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/tag_timeline_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/tag_timeline_parameters.go new file mode 100644 index 0000000..f25f2a1 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/tag_timeline_parameters.go @@ -0,0 +1,301 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timelines + +// 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" +) + +// NewTagTimelineParams creates a new TagTimelineParams 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 NewTagTimelineParams() *TagTimelineParams { + return &TagTimelineParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewTagTimelineParamsWithTimeout creates a new TagTimelineParams object +// with the ability to set a timeout on a request. +func NewTagTimelineParamsWithTimeout(timeout time.Duration) *TagTimelineParams { + return &TagTimelineParams{ + timeout: timeout, + } +} + +// NewTagTimelineParamsWithContext creates a new TagTimelineParams object +// with the ability to set a context for a request. +func NewTagTimelineParamsWithContext(ctx context.Context) *TagTimelineParams { + return &TagTimelineParams{ + Context: ctx, + } +} + +// NewTagTimelineParamsWithHTTPClient creates a new TagTimelineParams object +// with the ability to set a custom HTTPClient for a request. +func NewTagTimelineParamsWithHTTPClient(client *http.Client) *TagTimelineParams { + return &TagTimelineParams{ + HTTPClient: client, + } +} + +/* +TagTimelineParams contains all the parameters to send to the API endpoint + + for the tag timeline operation. + + Typically these are written to a http.Request. +*/ +type TagTimelineParams struct { + + /* Limit. + + Number of statuses to return. + + Default: 20 + */ + Limit *int64 + + /* MaxID. + + Return only statuses *OLDER* than the given max status ID. The status with the specified ID will not be included in the response. + */ + MaxID *string + + /* MinID. + + Return only statuses *immediately newer* than the given since status ID. The status with the specified ID will not be included in the response. + */ + MinID *string + + /* SinceID. + + Return only statuses *newer* than the given since status ID. The status with the specified ID will not be included in the response. + */ + SinceID *string + + /* TagName. + + Name of the tag + */ + TagName string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the tag timeline params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TagTimelineParams) WithDefaults() *TagTimelineParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tag timeline params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TagTimelineParams) SetDefaults() { + var ( + limitDefault = int64(20) + ) + + val := TagTimelineParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the tag timeline params +func (o *TagTimelineParams) WithTimeout(timeout time.Duration) *TagTimelineParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the tag timeline params +func (o *TagTimelineParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the tag timeline params +func (o *TagTimelineParams) WithContext(ctx context.Context) *TagTimelineParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the tag timeline params +func (o *TagTimelineParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the tag timeline params +func (o *TagTimelineParams) WithHTTPClient(client *http.Client) *TagTimelineParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the tag timeline params +func (o *TagTimelineParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the tag timeline params +func (o *TagTimelineParams) WithLimit(limit *int64) *TagTimelineParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the tag timeline params +func (o *TagTimelineParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the tag timeline params +func (o *TagTimelineParams) WithMaxID(maxID *string) *TagTimelineParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the tag timeline params +func (o *TagTimelineParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the tag timeline params +func (o *TagTimelineParams) WithMinID(minID *string) *TagTimelineParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the tag timeline params +func (o *TagTimelineParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the tag timeline params +func (o *TagTimelineParams) WithSinceID(sinceID *string) *TagTimelineParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the tag timeline params +func (o *TagTimelineParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WithTagName adds the tagName to the tag timeline params +func (o *TagTimelineParams) WithTagName(tagName string) *TagTimelineParams { + o.SetTagName(tagName) + return o +} + +// SetTagName adds the tagName to the tag timeline params +func (o *TagTimelineParams) SetTagName(tagName string) { + o.TagName = tagName +} + +// WriteToRequest writes these params to a swagger request +func (o *TagTimelineParams) 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.MaxID != nil { + + // query param max_id + var qrMaxID string + + if o.MaxID != nil { + qrMaxID = *o.MaxID + } + qMaxID := qrMaxID + if qMaxID != "" { + + if err := r.SetQueryParam("max_id", qMaxID); err != nil { + return err + } + } + } + + if o.MinID != nil { + + // query param min_id + var qrMinID string + + if o.MinID != nil { + qrMinID = *o.MinID + } + qMinID := qrMinID + if qMinID != "" { + + if err := r.SetQueryParam("min_id", qMinID); err != nil { + return err + } + } + } + + if o.SinceID != nil { + + // query param since_id + var qrSinceID string + + if o.SinceID != nil { + qrSinceID = *o.SinceID + } + qSinceID := qrSinceID + if qSinceID != "" { + + if err := r.SetQueryParam("since_id", qSinceID); err != nil { + return err + } + } + } + + // path param tag_name + if err := r.SetPathParam("tag_name", o.TagName); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/tag_timeline_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/tag_timeline_responses.go new file mode 100644 index 0000000..85f8799 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/tag_timeline_responses.go @@ -0,0 +1,240 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timelines + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// TagTimelineReader is a Reader for the TagTimeline structure. +type TagTimelineReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *TagTimelineReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewTagTimelineOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewTagTimelineBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewTagTimelineUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/timelines/tag/{tag_name}] tagTimeline", response, response.Code()) + } +} + +// NewTagTimelineOK creates a TagTimelineOK with default headers values +func NewTagTimelineOK() *TagTimelineOK { + return &TagTimelineOK{} +} + +/* +TagTimelineOK describes a response with status code 200, with default header values. + +Array of statuses. +*/ +type TagTimelineOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Status +} + +// IsSuccess returns true when this tag timeline o k response has a 2xx status code +func (o *TagTimelineOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this tag timeline o k response has a 3xx status code +func (o *TagTimelineOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this tag timeline o k response has a 4xx status code +func (o *TagTimelineOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this tag timeline o k response has a 5xx status code +func (o *TagTimelineOK) IsServerError() bool { + return false +} + +// IsCode returns true when this tag timeline o k response a status code equal to that given +func (o *TagTimelineOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the tag timeline o k response +func (o *TagTimelineOK) Code() int { + return 200 +} + +func (o *TagTimelineOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/timelines/tag/{tag_name}][%d] tagTimelineOK %s", 200, payload) +} + +func (o *TagTimelineOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/timelines/tag/{tag_name}][%d] tagTimelineOK %s", 200, payload) +} + +func (o *TagTimelineOK) GetPayload() []*models.Status { + return o.Payload +} + +func (o *TagTimelineOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewTagTimelineBadRequest creates a TagTimelineBadRequest with default headers values +func NewTagTimelineBadRequest() *TagTimelineBadRequest { + return &TagTimelineBadRequest{} +} + +/* +TagTimelineBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type TagTimelineBadRequest struct { +} + +// IsSuccess returns true when this tag timeline bad request response has a 2xx status code +func (o *TagTimelineBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this tag timeline bad request response has a 3xx status code +func (o *TagTimelineBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this tag timeline bad request response has a 4xx status code +func (o *TagTimelineBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this tag timeline bad request response has a 5xx status code +func (o *TagTimelineBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this tag timeline bad request response a status code equal to that given +func (o *TagTimelineBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the tag timeline bad request response +func (o *TagTimelineBadRequest) Code() int { + return 400 +} + +func (o *TagTimelineBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/timelines/tag/{tag_name}][%d] tagTimelineBadRequest", 400) +} + +func (o *TagTimelineBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/timelines/tag/{tag_name}][%d] tagTimelineBadRequest", 400) +} + +func (o *TagTimelineBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTagTimelineUnauthorized creates a TagTimelineUnauthorized with default headers values +func NewTagTimelineUnauthorized() *TagTimelineUnauthorized { + return &TagTimelineUnauthorized{} +} + +/* +TagTimelineUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type TagTimelineUnauthorized struct { +} + +// IsSuccess returns true when this tag timeline unauthorized response has a 2xx status code +func (o *TagTimelineUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this tag timeline unauthorized response has a 3xx status code +func (o *TagTimelineUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this tag timeline unauthorized response has a 4xx status code +func (o *TagTimelineUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this tag timeline unauthorized response has a 5xx status code +func (o *TagTimelineUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this tag timeline unauthorized response a status code equal to that given +func (o *TagTimelineUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the tag timeline unauthorized response +func (o *TagTimelineUnauthorized) Code() int { + return 401 +} + +func (o *TagTimelineUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/timelines/tag/{tag_name}][%d] tagTimelineUnauthorized", 401) +} + +func (o *TagTimelineUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/timelines/tag/{tag_name}][%d] tagTimelineUnauthorized", 401) +} + +func (o *TagTimelineUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/timelines_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/timelines_client.go new file mode 100644 index 0000000..6ee741a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/timelines/timelines_client.go @@ -0,0 +1,269 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timelines + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new timelines API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new timelines API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new timelines API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for timelines API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + HomeTimeline(params *HomeTimelineParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HomeTimelineOK, error) + + ListTimeline(params *ListTimelineParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListTimelineOK, error) + + PublicTimeline(params *PublicTimelineParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PublicTimelineOK, error) + + TagTimeline(params *TagTimelineParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TagTimelineOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + HomeTimeline sees statuses posts by accounts you follow + + The statuses will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer). + +The returned Link header can be used to generate the previous and next queries when scrolling up or down a timeline. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) HomeTimeline(params *HomeTimelineParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HomeTimelineOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHomeTimelineParams() + } + op := &runtime.ClientOperation{ + ID: "homeTimeline", + Method: "GET", + PathPattern: "/api/v1/timelines/home", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &HomeTimelineReader{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.(*HomeTimelineOK) + 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 homeTimeline: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ListTimeline sees statuses posts from the given list timeline + + The statuses will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer). + +The returned Link header can be used to generate the previous and next queries when scrolling up or down a timeline. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) ListTimeline(params *ListTimelineParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListTimelineOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListTimelineParams() + } + op := &runtime.ClientOperation{ + ID: "listTimeline", + Method: "GET", + PathPattern: "/api/v1/timelines/list/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ListTimelineReader{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.(*ListTimelineOK) + 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 listTimeline: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PublicTimeline sees public statuses posts that your instance is aware of + + The statuses will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer). + +The returned Link header can be used to generate the previous and next queries when scrolling up or down a timeline. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) PublicTimeline(params *PublicTimelineParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PublicTimelineOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPublicTimelineParams() + } + op := &runtime.ClientOperation{ + ID: "publicTimeline", + Method: "GET", + PathPattern: "/api/v1/timelines/public", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PublicTimelineReader{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.(*PublicTimelineOK) + 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 publicTimeline: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + TagTimeline sees public statuses that use the given hashtag case insensitive + + The statuses will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer). + +The returned Link header can be used to generate the previous and next queries when scrolling up or down a timeline. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) TagTimeline(params *TagTimelineParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TagTimelineOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewTagTimelineParams() + } + op := &runtime.ClientOperation{ + ID: "tagTimeline", + Method: "GET", + PathPattern: "/api/v1/timelines/tag/{tag_name}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &TagTimelineReader{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.(*TagTimelineOK) + 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 tagTimeline: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/get_user_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/get_user_parameters.go new file mode 100644 index 0000000..31920e4 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/get_user_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// 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" +) + +// NewGetUserParams creates a new GetUserParams 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 NewGetUserParams() *GetUserParams { + return &GetUserParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetUserParamsWithTimeout creates a new GetUserParams object +// with the ability to set a timeout on a request. +func NewGetUserParamsWithTimeout(timeout time.Duration) *GetUserParams { + return &GetUserParams{ + timeout: timeout, + } +} + +// NewGetUserParamsWithContext creates a new GetUserParams object +// with the ability to set a context for a request. +func NewGetUserParamsWithContext(ctx context.Context) *GetUserParams { + return &GetUserParams{ + Context: ctx, + } +} + +// NewGetUserParamsWithHTTPClient creates a new GetUserParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetUserParamsWithHTTPClient(client *http.Client) *GetUserParams { + return &GetUserParams{ + HTTPClient: client, + } +} + +/* +GetUserParams contains all the parameters to send to the API endpoint + + for the get user operation. + + Typically these are written to a http.Request. +*/ +type GetUserParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get user params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUserParams) WithDefaults() *GetUserParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get user params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUserParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get user params +func (o *GetUserParams) WithTimeout(timeout time.Duration) *GetUserParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get user params +func (o *GetUserParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get user params +func (o *GetUserParams) WithContext(ctx context.Context) *GetUserParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get user params +func (o *GetUserParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get user params +func (o *GetUserParams) WithHTTPClient(client *http.Client) *GetUserParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get user params +func (o *GetUserParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetUserParams) 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/get_user_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/get_user_responses.go new file mode 100644 index 0000000..c810c34 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/get_user_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// GetUserReader is a Reader for the GetUser structure. +type GetUserReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetUserOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewGetUserBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewGetUserUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewGetUserForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewGetUserNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewGetUserInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/user] getUser", response, response.Code()) + } +} + +// NewGetUserOK creates a GetUserOK with default headers values +func NewGetUserOK() *GetUserOK { + return &GetUserOK{} +} + +/* +GetUserOK describes a response with status code 200, with default header values. + +The requested user. +*/ +type GetUserOK struct { + Payload *models.User +} + +// IsSuccess returns true when this get user o k response has a 2xx status code +func (o *GetUserOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get user o k response has a 3xx status code +func (o *GetUserOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get user o k response has a 4xx status code +func (o *GetUserOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get user o k response has a 5xx status code +func (o *GetUserOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get user o k response a status code equal to that given +func (o *GetUserOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get user o k response +func (o *GetUserOK) Code() int { + return 200 +} + +func (o *GetUserOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/user][%d] getUserOK %s", 200, payload) +} + +func (o *GetUserOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/user][%d] getUserOK %s", 200, payload) +} + +func (o *GetUserOK) GetPayload() *models.User { + return o.Payload +} + +func (o *GetUserOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.User) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetUserBadRequest creates a GetUserBadRequest with default headers values +func NewGetUserBadRequest() *GetUserBadRequest { + return &GetUserBadRequest{} +} + +/* +GetUserBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type GetUserBadRequest struct { +} + +// IsSuccess returns true when this get user bad request response has a 2xx status code +func (o *GetUserBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get user bad request response has a 3xx status code +func (o *GetUserBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get user bad request response has a 4xx status code +func (o *GetUserBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this get user bad request response has a 5xx status code +func (o *GetUserBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this get user bad request response a status code equal to that given +func (o *GetUserBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the get user bad request response +func (o *GetUserBadRequest) Code() int { + return 400 +} + +func (o *GetUserBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/user][%d] getUserBadRequest", 400) +} + +func (o *GetUserBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/user][%d] getUserBadRequest", 400) +} + +func (o *GetUserBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetUserUnauthorized creates a GetUserUnauthorized with default headers values +func NewGetUserUnauthorized() *GetUserUnauthorized { + return &GetUserUnauthorized{} +} + +/* +GetUserUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type GetUserUnauthorized struct { +} + +// IsSuccess returns true when this get user unauthorized response has a 2xx status code +func (o *GetUserUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get user unauthorized response has a 3xx status code +func (o *GetUserUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get user unauthorized response has a 4xx status code +func (o *GetUserUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this get user unauthorized response has a 5xx status code +func (o *GetUserUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this get user unauthorized response a status code equal to that given +func (o *GetUserUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the get user unauthorized response +func (o *GetUserUnauthorized) Code() int { + return 401 +} + +func (o *GetUserUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/user][%d] getUserUnauthorized", 401) +} + +func (o *GetUserUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/user][%d] getUserUnauthorized", 401) +} + +func (o *GetUserUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetUserForbidden creates a GetUserForbidden with default headers values +func NewGetUserForbidden() *GetUserForbidden { + return &GetUserForbidden{} +} + +/* +GetUserForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type GetUserForbidden struct { +} + +// IsSuccess returns true when this get user forbidden response has a 2xx status code +func (o *GetUserForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get user forbidden response has a 3xx status code +func (o *GetUserForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get user forbidden response has a 4xx status code +func (o *GetUserForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this get user forbidden response has a 5xx status code +func (o *GetUserForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this get user forbidden response a status code equal to that given +func (o *GetUserForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the get user forbidden response +func (o *GetUserForbidden) Code() int { + return 403 +} + +func (o *GetUserForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/user][%d] getUserForbidden", 403) +} + +func (o *GetUserForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/user][%d] getUserForbidden", 403) +} + +func (o *GetUserForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetUserNotAcceptable creates a GetUserNotAcceptable with default headers values +func NewGetUserNotAcceptable() *GetUserNotAcceptable { + return &GetUserNotAcceptable{} +} + +/* +GetUserNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type GetUserNotAcceptable struct { +} + +// IsSuccess returns true when this get user not acceptable response has a 2xx status code +func (o *GetUserNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get user not acceptable response has a 3xx status code +func (o *GetUserNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get user not acceptable response has a 4xx status code +func (o *GetUserNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this get user not acceptable response has a 5xx status code +func (o *GetUserNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this get user not acceptable response a status code equal to that given +func (o *GetUserNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the get user not acceptable response +func (o *GetUserNotAcceptable) Code() int { + return 406 +} + +func (o *GetUserNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/user][%d] getUserNotAcceptable", 406) +} + +func (o *GetUserNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/user][%d] getUserNotAcceptable", 406) +} + +func (o *GetUserNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetUserInternalServerError creates a GetUserInternalServerError with default headers values +func NewGetUserInternalServerError() *GetUserInternalServerError { + return &GetUserInternalServerError{} +} + +/* +GetUserInternalServerError describes a response with status code 500, with default header values. + +internal error +*/ +type GetUserInternalServerError struct { +} + +// IsSuccess returns true when this get user internal server error response has a 2xx status code +func (o *GetUserInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get user internal server error response has a 3xx status code +func (o *GetUserInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get user internal server error response has a 4xx status code +func (o *GetUserInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this get user internal server error response has a 5xx status code +func (o *GetUserInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this get user internal server error response a status code equal to that given +func (o *GetUserInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the get user internal server error response +func (o *GetUserInternalServerError) Code() int { + return 500 +} + +func (o *GetUserInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/user][%d] getUserInternalServerError", 500) +} + +func (o *GetUserInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/user][%d] getUserInternalServerError", 500) +} + +func (o *GetUserInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/user_client.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/user_client.go new file mode 100644 index 0000000..30367b7 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/user_client.go @@ -0,0 +1,221 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new user API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new user API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new user API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for user API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded". +func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} +} + +// WithContentTypeApplicationXML sets the Content-Type header to "application/xml". +func WithContentTypeApplicationXML(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/xml"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + GetUser(params *GetUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUserOK, error) + + UserEmailChange(params *UserEmailChangeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserEmailChangeAccepted, error) + + UserPasswordChange(params *UserPasswordChangeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserPasswordChangeOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +GetUser gets your own user model +*/ +func (a *Client) GetUser(params *GetUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUserOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetUserParams() + } + op := &runtime.ClientOperation{ + ID: "getUser", + Method: "GET", + PathPattern: "/api/v1/user", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetUserReader{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.(*GetUserOK) + 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 getUser: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +UserEmailChange requests changing the email address of authenticated user +*/ +func (a *Client) UserEmailChange(params *UserEmailChangeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserEmailChangeAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUserEmailChangeParams() + } + op := &runtime.ClientOperation{ + ID: "userEmailChange", + Method: "POST", + PathPattern: "/api/v1/user/email_change", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &UserEmailChangeReader{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.(*UserEmailChangeAccepted) + 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 userEmailChange: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + UserPasswordChange changes the password of authenticated user + + The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'. + +The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'. +*/ +func (a *Client) UserPasswordChange(params *UserPasswordChangeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserPasswordChangeOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUserPasswordChangeParams() + } + op := &runtime.ClientOperation{ + ID: "userPasswordChange", + Method: "POST", + PathPattern: "/api/v1/user/password_change", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &UserPasswordChangeReader{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.(*UserPasswordChangeOK) + 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 userPasswordChange: 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 +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/user_email_change_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/user_email_change_parameters.go new file mode 100644 index 0000000..0809a4a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/user_email_change_parameters.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// 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" +) + +// NewUserEmailChangeParams creates a new UserEmailChangeParams 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 NewUserEmailChangeParams() *UserEmailChangeParams { + return &UserEmailChangeParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUserEmailChangeParamsWithTimeout creates a new UserEmailChangeParams object +// with the ability to set a timeout on a request. +func NewUserEmailChangeParamsWithTimeout(timeout time.Duration) *UserEmailChangeParams { + return &UserEmailChangeParams{ + timeout: timeout, + } +} + +// NewUserEmailChangeParamsWithContext creates a new UserEmailChangeParams object +// with the ability to set a context for a request. +func NewUserEmailChangeParamsWithContext(ctx context.Context) *UserEmailChangeParams { + return &UserEmailChangeParams{ + Context: ctx, + } +} + +// NewUserEmailChangeParamsWithHTTPClient creates a new UserEmailChangeParams object +// with the ability to set a custom HTTPClient for a request. +func NewUserEmailChangeParamsWithHTTPClient(client *http.Client) *UserEmailChangeParams { + return &UserEmailChangeParams{ + HTTPClient: client, + } +} + +/* +UserEmailChangeParams contains all the parameters to send to the API endpoint + + for the user email change operation. + + Typically these are written to a http.Request. +*/ +type UserEmailChangeParams struct { + + /* NewEmail. + + Desired new email address. + */ + NewEmail string + + /* Password. + + User's current password, for verification. + */ + Password string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the user email change params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserEmailChangeParams) WithDefaults() *UserEmailChangeParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the user email change params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserEmailChangeParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the user email change params +func (o *UserEmailChangeParams) WithTimeout(timeout time.Duration) *UserEmailChangeParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the user email change params +func (o *UserEmailChangeParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the user email change params +func (o *UserEmailChangeParams) WithContext(ctx context.Context) *UserEmailChangeParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the user email change params +func (o *UserEmailChangeParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the user email change params +func (o *UserEmailChangeParams) WithHTTPClient(client *http.Client) *UserEmailChangeParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the user email change params +func (o *UserEmailChangeParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNewEmail adds the newEmail to the user email change params +func (o *UserEmailChangeParams) WithNewEmail(newEmail string) *UserEmailChangeParams { + o.SetNewEmail(newEmail) + return o +} + +// SetNewEmail adds the newEmail to the user email change params +func (o *UserEmailChangeParams) SetNewEmail(newEmail string) { + o.NewEmail = newEmail +} + +// WithPassword adds the password to the user email change params +func (o *UserEmailChangeParams) WithPassword(password string) *UserEmailChangeParams { + o.SetPassword(password) + return o +} + +// SetPassword adds the password to the user email change params +func (o *UserEmailChangeParams) SetPassword(password string) { + o.Password = password +} + +// WriteToRequest writes these params to a swagger request +func (o *UserEmailChangeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param new_email + frNewEmail := o.NewEmail + fNewEmail := frNewEmail + if fNewEmail != "" { + if err := r.SetFormParam("new_email", fNewEmail); err != nil { + return err + } + } + + // form param password + frPassword := o.Password + fPassword := frPassword + if fPassword != "" { + if err := r.SetFormParam("password", fPassword); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/user_email_change_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/user_email_change_responses.go new file mode 100644 index 0000000..15ed8a5 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/user_email_change_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// 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" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// UserEmailChangeReader is a Reader for the UserEmailChange structure. +type UserEmailChangeReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UserEmailChangeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewUserEmailChangeAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewUserEmailChangeBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewUserEmailChangeUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewUserEmailChangeForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewUserEmailChangeNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewUserEmailChangeConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewUserEmailChangeInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/user/email_change] userEmailChange", response, response.Code()) + } +} + +// NewUserEmailChangeAccepted creates a UserEmailChangeAccepted with default headers values +func NewUserEmailChangeAccepted() *UserEmailChangeAccepted { + return &UserEmailChangeAccepted{} +} + +/* +UserEmailChangeAccepted describes a response with status code 202, with default header values. + +Accepted: email change is processing; check your inbox to confirm new address. +*/ +type UserEmailChangeAccepted struct { + Payload *models.User +} + +// IsSuccess returns true when this user email change accepted response has a 2xx status code +func (o *UserEmailChangeAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this user email change accepted response has a 3xx status code +func (o *UserEmailChangeAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user email change accepted response has a 4xx status code +func (o *UserEmailChangeAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this user email change accepted response has a 5xx status code +func (o *UserEmailChangeAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this user email change accepted response a status code equal to that given +func (o *UserEmailChangeAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the user email change accepted response +func (o *UserEmailChangeAccepted) Code() int { + return 202 +} + +func (o *UserEmailChangeAccepted) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeAccepted %s", 202, payload) +} + +func (o *UserEmailChangeAccepted) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeAccepted %s", 202, payload) +} + +func (o *UserEmailChangeAccepted) GetPayload() *models.User { + return o.Payload +} + +func (o *UserEmailChangeAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.User) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUserEmailChangeBadRequest creates a UserEmailChangeBadRequest with default headers values +func NewUserEmailChangeBadRequest() *UserEmailChangeBadRequest { + return &UserEmailChangeBadRequest{} +} + +/* +UserEmailChangeBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type UserEmailChangeBadRequest struct { +} + +// IsSuccess returns true when this user email change bad request response has a 2xx status code +func (o *UserEmailChangeBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user email change bad request response has a 3xx status code +func (o *UserEmailChangeBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user email change bad request response has a 4xx status code +func (o *UserEmailChangeBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this user email change bad request response has a 5xx status code +func (o *UserEmailChangeBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this user email change bad request response a status code equal to that given +func (o *UserEmailChangeBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the user email change bad request response +func (o *UserEmailChangeBadRequest) Code() int { + return 400 +} + +func (o *UserEmailChangeBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeBadRequest", 400) +} + +func (o *UserEmailChangeBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeBadRequest", 400) +} + +func (o *UserEmailChangeBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserEmailChangeUnauthorized creates a UserEmailChangeUnauthorized with default headers values +func NewUserEmailChangeUnauthorized() *UserEmailChangeUnauthorized { + return &UserEmailChangeUnauthorized{} +} + +/* +UserEmailChangeUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type UserEmailChangeUnauthorized struct { +} + +// IsSuccess returns true when this user email change unauthorized response has a 2xx status code +func (o *UserEmailChangeUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user email change unauthorized response has a 3xx status code +func (o *UserEmailChangeUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user email change unauthorized response has a 4xx status code +func (o *UserEmailChangeUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this user email change unauthorized response has a 5xx status code +func (o *UserEmailChangeUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this user email change unauthorized response a status code equal to that given +func (o *UserEmailChangeUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the user email change unauthorized response +func (o *UserEmailChangeUnauthorized) Code() int { + return 401 +} + +func (o *UserEmailChangeUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeUnauthorized", 401) +} + +func (o *UserEmailChangeUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeUnauthorized", 401) +} + +func (o *UserEmailChangeUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserEmailChangeForbidden creates a UserEmailChangeForbidden with default headers values +func NewUserEmailChangeForbidden() *UserEmailChangeForbidden { + return &UserEmailChangeForbidden{} +} + +/* +UserEmailChangeForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type UserEmailChangeForbidden struct { +} + +// IsSuccess returns true when this user email change forbidden response has a 2xx status code +func (o *UserEmailChangeForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user email change forbidden response has a 3xx status code +func (o *UserEmailChangeForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user email change forbidden response has a 4xx status code +func (o *UserEmailChangeForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this user email change forbidden response has a 5xx status code +func (o *UserEmailChangeForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this user email change forbidden response a status code equal to that given +func (o *UserEmailChangeForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the user email change forbidden response +func (o *UserEmailChangeForbidden) Code() int { + return 403 +} + +func (o *UserEmailChangeForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeForbidden", 403) +} + +func (o *UserEmailChangeForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeForbidden", 403) +} + +func (o *UserEmailChangeForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserEmailChangeNotAcceptable creates a UserEmailChangeNotAcceptable with default headers values +func NewUserEmailChangeNotAcceptable() *UserEmailChangeNotAcceptable { + return &UserEmailChangeNotAcceptable{} +} + +/* +UserEmailChangeNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type UserEmailChangeNotAcceptable struct { +} + +// IsSuccess returns true when this user email change not acceptable response has a 2xx status code +func (o *UserEmailChangeNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user email change not acceptable response has a 3xx status code +func (o *UserEmailChangeNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user email change not acceptable response has a 4xx status code +func (o *UserEmailChangeNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this user email change not acceptable response has a 5xx status code +func (o *UserEmailChangeNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this user email change not acceptable response a status code equal to that given +func (o *UserEmailChangeNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the user email change not acceptable response +func (o *UserEmailChangeNotAcceptable) Code() int { + return 406 +} + +func (o *UserEmailChangeNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeNotAcceptable", 406) +} + +func (o *UserEmailChangeNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeNotAcceptable", 406) +} + +func (o *UserEmailChangeNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserEmailChangeConflict creates a UserEmailChangeConflict with default headers values +func NewUserEmailChangeConflict() *UserEmailChangeConflict { + return &UserEmailChangeConflict{} +} + +/* +UserEmailChangeConflict describes a response with status code 409, with default header values. + +Conflict: desired email address already in use +*/ +type UserEmailChangeConflict struct { +} + +// IsSuccess returns true when this user email change conflict response has a 2xx status code +func (o *UserEmailChangeConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user email change conflict response has a 3xx status code +func (o *UserEmailChangeConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user email change conflict response has a 4xx status code +func (o *UserEmailChangeConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this user email change conflict response has a 5xx status code +func (o *UserEmailChangeConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this user email change conflict response a status code equal to that given +func (o *UserEmailChangeConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the user email change conflict response +func (o *UserEmailChangeConflict) Code() int { + return 409 +} + +func (o *UserEmailChangeConflict) Error() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeConflict", 409) +} + +func (o *UserEmailChangeConflict) String() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeConflict", 409) +} + +func (o *UserEmailChangeConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserEmailChangeInternalServerError creates a UserEmailChangeInternalServerError with default headers values +func NewUserEmailChangeInternalServerError() *UserEmailChangeInternalServerError { + return &UserEmailChangeInternalServerError{} +} + +/* +UserEmailChangeInternalServerError describes a response with status code 500, with default header values. + +internal error +*/ +type UserEmailChangeInternalServerError struct { +} + +// IsSuccess returns true when this user email change internal server error response has a 2xx status code +func (o *UserEmailChangeInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user email change internal server error response has a 3xx status code +func (o *UserEmailChangeInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user email change internal server error response has a 4xx status code +func (o *UserEmailChangeInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this user email change internal server error response has a 5xx status code +func (o *UserEmailChangeInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this user email change internal server error response a status code equal to that given +func (o *UserEmailChangeInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the user email change internal server error response +func (o *UserEmailChangeInternalServerError) Code() int { + return 500 +} + +func (o *UserEmailChangeInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeInternalServerError", 500) +} + +func (o *UserEmailChangeInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeInternalServerError", 500) +} + +func (o *UserEmailChangeInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/user_password_change_parameters.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/user_password_change_parameters.go new file mode 100644 index 0000000..c88a43a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/user_password_change_parameters.go @@ -0,0 +1,183 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// 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" +) + +// NewUserPasswordChangeParams creates a new UserPasswordChangeParams 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 NewUserPasswordChangeParams() *UserPasswordChangeParams { + return &UserPasswordChangeParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUserPasswordChangeParamsWithTimeout creates a new UserPasswordChangeParams object +// with the ability to set a timeout on a request. +func NewUserPasswordChangeParamsWithTimeout(timeout time.Duration) *UserPasswordChangeParams { + return &UserPasswordChangeParams{ + timeout: timeout, + } +} + +// NewUserPasswordChangeParamsWithContext creates a new UserPasswordChangeParams object +// with the ability to set a context for a request. +func NewUserPasswordChangeParamsWithContext(ctx context.Context) *UserPasswordChangeParams { + return &UserPasswordChangeParams{ + Context: ctx, + } +} + +// NewUserPasswordChangeParamsWithHTTPClient creates a new UserPasswordChangeParams object +// with the ability to set a custom HTTPClient for a request. +func NewUserPasswordChangeParamsWithHTTPClient(client *http.Client) *UserPasswordChangeParams { + return &UserPasswordChangeParams{ + HTTPClient: client, + } +} + +/* +UserPasswordChangeParams contains all the parameters to send to the API endpoint + + for the user password change operation. + + Typically these are written to a http.Request. +*/ +type UserPasswordChangeParams struct { + + /* NewPassword. + + Desired new password. + If the password does not have high enough entropy, it will be rejected. + See https://github.com/wagslane/go-password-validator + */ + NewPassword string + + /* OldPassword. + + User's previous password. + */ + OldPassword string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the user password change params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserPasswordChangeParams) WithDefaults() *UserPasswordChangeParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the user password change params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserPasswordChangeParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the user password change params +func (o *UserPasswordChangeParams) WithTimeout(timeout time.Duration) *UserPasswordChangeParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the user password change params +func (o *UserPasswordChangeParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the user password change params +func (o *UserPasswordChangeParams) WithContext(ctx context.Context) *UserPasswordChangeParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the user password change params +func (o *UserPasswordChangeParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the user password change params +func (o *UserPasswordChangeParams) WithHTTPClient(client *http.Client) *UserPasswordChangeParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the user password change params +func (o *UserPasswordChangeParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNewPassword adds the newPassword to the user password change params +func (o *UserPasswordChangeParams) WithNewPassword(newPassword string) *UserPasswordChangeParams { + o.SetNewPassword(newPassword) + return o +} + +// SetNewPassword adds the newPassword to the user password change params +func (o *UserPasswordChangeParams) SetNewPassword(newPassword string) { + o.NewPassword = newPassword +} + +// WithOldPassword adds the oldPassword to the user password change params +func (o *UserPasswordChangeParams) WithOldPassword(oldPassword string) *UserPasswordChangeParams { + o.SetOldPassword(oldPassword) + return o +} + +// SetOldPassword adds the oldPassword to the user password change params +func (o *UserPasswordChangeParams) SetOldPassword(oldPassword string) { + o.OldPassword = oldPassword +} + +// WriteToRequest writes these params to a swagger request +func (o *UserPasswordChangeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param new_password + frNewPassword := o.NewPassword + fNewPassword := frNewPassword + if fNewPassword != "" { + if err := r.SetFormParam("new_password", fNewPassword); err != nil { + return err + } + } + + // form param old_password + frOldPassword := o.OldPassword + fOldPassword := frOldPassword + if fOldPassword != "" { + if err := r.SetFormParam("old_password", fOldPassword); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/user_password_change_responses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/user_password_change_responses.go new file mode 100644 index 0000000..22203bd --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/client/user/user_password_change_responses.go @@ -0,0 +1,460 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// 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" +) + +// UserPasswordChangeReader is a Reader for the UserPasswordChange structure. +type UserPasswordChangeReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UserPasswordChangeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUserPasswordChangeOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewUserPasswordChangeBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewUserPasswordChangeUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewUserPasswordChangeForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewUserPasswordChangeNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewUserPasswordChangeUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewUserPasswordChangeInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/user/password_change] userPasswordChange", response, response.Code()) + } +} + +// NewUserPasswordChangeOK creates a UserPasswordChangeOK with default headers values +func NewUserPasswordChangeOK() *UserPasswordChangeOK { + return &UserPasswordChangeOK{} +} + +/* +UserPasswordChangeOK describes a response with status code 200, with default header values. + +Change successful +*/ +type UserPasswordChangeOK struct { +} + +// IsSuccess returns true when this user password change o k response has a 2xx status code +func (o *UserPasswordChangeOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this user password change o k response has a 3xx status code +func (o *UserPasswordChangeOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user password change o k response has a 4xx status code +func (o *UserPasswordChangeOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this user password change o k response has a 5xx status code +func (o *UserPasswordChangeOK) IsServerError() bool { + return false +} + +// IsCode returns true when this user password change o k response a status code equal to that given +func (o *UserPasswordChangeOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the user password change o k response +func (o *UserPasswordChangeOK) Code() int { + return 200 +} + +func (o *UserPasswordChangeOK) Error() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeOK", 200) +} + +func (o *UserPasswordChangeOK) String() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeOK", 200) +} + +func (o *UserPasswordChangeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserPasswordChangeBadRequest creates a UserPasswordChangeBadRequest with default headers values +func NewUserPasswordChangeBadRequest() *UserPasswordChangeBadRequest { + return &UserPasswordChangeBadRequest{} +} + +/* +UserPasswordChangeBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type UserPasswordChangeBadRequest struct { +} + +// IsSuccess returns true when this user password change bad request response has a 2xx status code +func (o *UserPasswordChangeBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user password change bad request response has a 3xx status code +func (o *UserPasswordChangeBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user password change bad request response has a 4xx status code +func (o *UserPasswordChangeBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this user password change bad request response has a 5xx status code +func (o *UserPasswordChangeBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this user password change bad request response a status code equal to that given +func (o *UserPasswordChangeBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the user password change bad request response +func (o *UserPasswordChangeBadRequest) Code() int { + return 400 +} + +func (o *UserPasswordChangeBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeBadRequest", 400) +} + +func (o *UserPasswordChangeBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeBadRequest", 400) +} + +func (o *UserPasswordChangeBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserPasswordChangeUnauthorized creates a UserPasswordChangeUnauthorized with default headers values +func NewUserPasswordChangeUnauthorized() *UserPasswordChangeUnauthorized { + return &UserPasswordChangeUnauthorized{} +} + +/* +UserPasswordChangeUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type UserPasswordChangeUnauthorized struct { +} + +// IsSuccess returns true when this user password change unauthorized response has a 2xx status code +func (o *UserPasswordChangeUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user password change unauthorized response has a 3xx status code +func (o *UserPasswordChangeUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user password change unauthorized response has a 4xx status code +func (o *UserPasswordChangeUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this user password change unauthorized response has a 5xx status code +func (o *UserPasswordChangeUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this user password change unauthorized response a status code equal to that given +func (o *UserPasswordChangeUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the user password change unauthorized response +func (o *UserPasswordChangeUnauthorized) Code() int { + return 401 +} + +func (o *UserPasswordChangeUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeUnauthorized", 401) +} + +func (o *UserPasswordChangeUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeUnauthorized", 401) +} + +func (o *UserPasswordChangeUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserPasswordChangeForbidden creates a UserPasswordChangeForbidden with default headers values +func NewUserPasswordChangeForbidden() *UserPasswordChangeForbidden { + return &UserPasswordChangeForbidden{} +} + +/* +UserPasswordChangeForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type UserPasswordChangeForbidden struct { +} + +// IsSuccess returns true when this user password change forbidden response has a 2xx status code +func (o *UserPasswordChangeForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user password change forbidden response has a 3xx status code +func (o *UserPasswordChangeForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user password change forbidden response has a 4xx status code +func (o *UserPasswordChangeForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this user password change forbidden response has a 5xx status code +func (o *UserPasswordChangeForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this user password change forbidden response a status code equal to that given +func (o *UserPasswordChangeForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the user password change forbidden response +func (o *UserPasswordChangeForbidden) Code() int { + return 403 +} + +func (o *UserPasswordChangeForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeForbidden", 403) +} + +func (o *UserPasswordChangeForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeForbidden", 403) +} + +func (o *UserPasswordChangeForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserPasswordChangeNotAcceptable creates a UserPasswordChangeNotAcceptable with default headers values +func NewUserPasswordChangeNotAcceptable() *UserPasswordChangeNotAcceptable { + return &UserPasswordChangeNotAcceptable{} +} + +/* +UserPasswordChangeNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type UserPasswordChangeNotAcceptable struct { +} + +// IsSuccess returns true when this user password change not acceptable response has a 2xx status code +func (o *UserPasswordChangeNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user password change not acceptable response has a 3xx status code +func (o *UserPasswordChangeNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user password change not acceptable response has a 4xx status code +func (o *UserPasswordChangeNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this user password change not acceptable response has a 5xx status code +func (o *UserPasswordChangeNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this user password change not acceptable response a status code equal to that given +func (o *UserPasswordChangeNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the user password change not acceptable response +func (o *UserPasswordChangeNotAcceptable) Code() int { + return 406 +} + +func (o *UserPasswordChangeNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeNotAcceptable", 406) +} + +func (o *UserPasswordChangeNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeNotAcceptable", 406) +} + +func (o *UserPasswordChangeNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserPasswordChangeUnprocessableEntity creates a UserPasswordChangeUnprocessableEntity with default headers values +func NewUserPasswordChangeUnprocessableEntity() *UserPasswordChangeUnprocessableEntity { + return &UserPasswordChangeUnprocessableEntity{} +} + +/* +UserPasswordChangeUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable request because instance is running with OIDC backend +*/ +type UserPasswordChangeUnprocessableEntity struct { +} + +// IsSuccess returns true when this user password change unprocessable entity response has a 2xx status code +func (o *UserPasswordChangeUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user password change unprocessable entity response has a 3xx status code +func (o *UserPasswordChangeUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user password change unprocessable entity response has a 4xx status code +func (o *UserPasswordChangeUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this user password change unprocessable entity response has a 5xx status code +func (o *UserPasswordChangeUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this user password change unprocessable entity response a status code equal to that given +func (o *UserPasswordChangeUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the user password change unprocessable entity response +func (o *UserPasswordChangeUnprocessableEntity) Code() int { + return 422 +} + +func (o *UserPasswordChangeUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeUnprocessableEntity", 422) +} + +func (o *UserPasswordChangeUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeUnprocessableEntity", 422) +} + +func (o *UserPasswordChangeUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserPasswordChangeInternalServerError creates a UserPasswordChangeInternalServerError with default headers values +func NewUserPasswordChangeInternalServerError() *UserPasswordChangeInternalServerError { + return &UserPasswordChangeInternalServerError{} +} + +/* +UserPasswordChangeInternalServerError describes a response with status code 500, with default header values. + +internal error +*/ +type UserPasswordChangeInternalServerError struct { +} + +// IsSuccess returns true when this user password change internal server error response has a 2xx status code +func (o *UserPasswordChangeInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user password change internal server error response has a 3xx status code +func (o *UserPasswordChangeInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user password change internal server error response has a 4xx status code +func (o *UserPasswordChangeInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this user password change internal server error response has a 5xx status code +func (o *UserPasswordChangeInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this user password change internal server error response a status code equal to that given +func (o *UserPasswordChangeInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the user password change internal server error response +func (o *UserPasswordChangeInternalServerError) Code() int { + return 500 +} + +func (o *UserPasswordChangeInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeInternalServerError", 500) +} + +func (o *UserPasswordChangeInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeInternalServerError", 500) +} + +func (o *UserPasswordChangeInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/account.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/account.go new file mode 100644 index 0000000..4f0c420 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/account.go @@ -0,0 +1,433 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Account Account models a fediverse account. +// +// The modelled account can be either a remote account, or one on this instance. +// +// swagger:model Account +type Account struct { + + // The account URI as discovered via webfinger. + // Equal to username for local users, or username@domain for remote users. + // Example: some_user@example.org + Acct string `json:"acct,omitempty"` + + // Web location of the account's avatar. + // Example: https://example.org/media/some_user/avatar/original/avatar.jpeg + Avatar string `json:"avatar,omitempty"` + + // Description of this account's avatar, for alt text. + // Example: A cute drawing of a smiling sloth. + AvatarDescription string `json:"avatar_description,omitempty"` + + // Web location of a static version of the account's avatar. + // Only relevant when the account's main avatar is a video or a gif. + // Example: https://example.org/media/some_user/avatar/static/avatar.png + AvatarStatic string `json:"avatar_static,omitempty"` + + // Account identifies as a bot. + Bot bool `json:"bot,omitempty"` + + // When the account was created (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + CreatedAt string `json:"created_at,omitempty"` + + // CustomCSS to include when rendering this account's profile or statuses. + CustomCSS string `json:"custom_css,omitempty"` + + // Account has opted into discovery features. + Discoverable bool `json:"discoverable,omitempty"` + + // The account's display name. + // Example: big jeff (he/him) + DisplayName string `json:"display_name,omitempty"` + + // Array of custom emojis used in this account's note or display name. + // Empty for blocked accounts. + Emojis []*Emoji `json:"emojis"` + + // Account has enabled RSS feed. + // Key/value omitted if false. + EnableRSS bool `json:"enable_rss,omitempty"` + + // Additional metadata attached to this account's profile. + // Empty for blocked accounts. + Fields []*Field `json:"fields"` + + // Number of accounts following this account, according to our instance. + FollowersCount int64 `json:"followers_count,omitempty"` + + // Number of account's followed by this account, according to our instance. + FollowingCount int64 `json:"following_count,omitempty"` + + // Web location of the account's header image. + // Example: https://example.org/media/some_user/header/original/header.jpeg + Header string `json:"header,omitempty"` + + // Description of this account's header, for alt text. + // Example: A sunlit field with purple flowers. + HeaderDescription string `json:"header_description,omitempty"` + + // Web location of a static version of the account's header. + // Only relevant when the account's main header is a video or a gif. + // Example: https://example.org/media/some_user/header/static/header.png + HeaderStatic string `json:"header_static,omitempty"` + + // Account has opted to hide their followers/following collections. + // Key/value omitted if false. + HideCollections bool `json:"hide_collections,omitempty"` + + // The account id. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + ID string `json:"id,omitempty"` + + // When the account's most recent status was posted (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + LastStatusAt string `json:"last_status_at,omitempty"` + + // Account manually approves follow requests. + Locked bool `json:"locked,omitempty"` + + // Bio/description of this account. + Note string `json:"note,omitempty"` + + // Number of statuses posted by this account, according to our instance. + StatusesCount int64 `json:"statuses_count,omitempty"` + + // Account has been suspended by our instance. + Suspended bool `json:"suspended,omitempty"` + + // Filename of user-selected CSS theme to include when rendering this account's profile or statuses. Eg., `blurple-light.css`. + Theme string `json:"theme,omitempty"` + + // Web location of the account's profile page. + // Example: https://example.org/@some_user + URL string `json:"url,omitempty"` + + // The username of the account, not including domain. + // Example: some_user + Username string `json:"username,omitempty"` + + // moved + Moved *Account `json:"moved,omitempty"` + + // role + Role *AccountRole `json:"role,omitempty"` + + // source + Source *Source `json:"source,omitempty"` +} + +// Validate validates this account +func (m *Account) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEmojis(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFields(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMoved(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRole(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSource(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Account) validateEmojis(formats strfmt.Registry) error { + if swag.IsZero(m.Emojis) { // not required + return nil + } + + for i := 0; i < len(m.Emojis); i++ { + if swag.IsZero(m.Emojis[i]) { // not required + continue + } + + if m.Emojis[i] != nil { + if err := m.Emojis[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Account) validateFields(formats strfmt.Registry) error { + if swag.IsZero(m.Fields) { // not required + return nil + } + + for i := 0; i < len(m.Fields); i++ { + if swag.IsZero(m.Fields[i]) { // not required + continue + } + + if m.Fields[i] != nil { + if err := m.Fields[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("fields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Account) validateMoved(formats strfmt.Registry) error { + if swag.IsZero(m.Moved) { // not required + return nil + } + + if m.Moved != nil { + if err := m.Moved.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("moved") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("moved") + } + return err + } + } + + return nil +} + +func (m *Account) validateRole(formats strfmt.Registry) error { + if swag.IsZero(m.Role) { // not required + return nil + } + + if m.Role != nil { + if err := m.Role.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +func (m *Account) validateSource(formats strfmt.Registry) error { + if swag.IsZero(m.Source) { // not required + return nil + } + + if m.Source != nil { + if err := m.Source.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +// ContextValidate validate this account based on the context it is used +func (m *Account) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEmojis(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFields(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMoved(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRole(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSource(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Account) contextValidateEmojis(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Emojis); i++ { + + if m.Emojis[i] != nil { + + if swag.IsZero(m.Emojis[i]) { // not required + return nil + } + + if err := m.Emojis[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Account) contextValidateFields(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Fields); i++ { + + if m.Fields[i] != nil { + + if swag.IsZero(m.Fields[i]) { // not required + return nil + } + + if err := m.Fields[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("fields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Account) contextValidateMoved(ctx context.Context, formats strfmt.Registry) error { + + if m.Moved != nil { + + if swag.IsZero(m.Moved) { // not required + return nil + } + + if err := m.Moved.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("moved") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("moved") + } + return err + } + } + + return nil +} + +func (m *Account) contextValidateRole(ctx context.Context, formats strfmt.Registry) error { + + if m.Role != nil { + + if swag.IsZero(m.Role) { // not required + return nil + } + + if err := m.Role.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +func (m *Account) contextValidateSource(ctx context.Context, formats strfmt.Registry) error { + + if m.Source != nil { + + if swag.IsZero(m.Source) { // not required + return nil + } + + if err := m.Source.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Account) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Account) UnmarshalBinary(b []byte) error { + var res Account + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/account_role.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/account_role.go new file mode 100644 index 0000000..6020d6d --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/account_role.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// AccountRole AccountRole models the role of an account. +// +// swagger:model AccountRole +type AccountRole struct { + + // name + Name string `json:"name,omitempty"` +} + +// Validate validates this account role +func (m *AccountRole) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this account role based on context it is used +func (m *AccountRole) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *AccountRole) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AccountRole) UnmarshalBinary(b []byte) error { + var res AccountRole + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/admin_account_info.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/admin_account_info.go new file mode 100644 index 0000000..6476605 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/admin_account_info.go @@ -0,0 +1,223 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// AdminAccountInfo AdminAccountInfo models the admin view of an account's details. +// +// swagger:model AdminAccountInfo +type AdminAccountInfo struct { + + // Whether the account is currently approved. + Approved bool `json:"approved,omitempty"` + + // Whether the account has confirmed their email address. + Confirmed bool `json:"confirmed,omitempty"` + + // When the account was first discovered. (ISO 8601 Datetime) + // Example: 2021-07-30T09:20:25+00:00 + CreatedAt string `json:"created_at,omitempty"` + + // The ID of the application that created this account. + CreatedByApplicationID string `json:"created_by_application_id,omitempty"` + + // Whether the account is currently disabled. + Disabled bool `json:"disabled,omitempty"` + + // The domain of the account. + // Null for local accounts. + // Example: example.org + Domain string `json:"domain,omitempty"` + + // The email address associated with the account. + // Empty string for remote accounts or accounts with + // no known email address. + // Example: someone@somewhere.com + Email string `json:"email,omitempty"` + + // The ID of the account in the database. + // Example: 01GQ4PHNT622DQ9X95XQX4KKNR + ID string `json:"id,omitempty"` + + // The IP address last used to login to this account. + // Null if not known. + // Example: 192.0.2.1 + IP string `json:"ip,omitempty"` + + // All known IP addresses associated with this account. + // NOT IMPLEMENTED (will always be empty array). + // Example: [] + IPs []interface{} `json:"ips"` + + // The reason given when signing up. + // Null if no reason / remote account. + // Example: Pleaaaaaaaaaaaaaaase!! + InviteRequest string `json:"invite_request,omitempty"` + + // The ID of the account that invited this user + InvitedByAccountID string `json:"invited_by_account_id,omitempty"` + + // The locale of the account. (ISO 639 Part 1 two-letter language code) + // Example: en + Locale string `json:"locale,omitempty"` + + // Whether the account is currently silenced + Silenced bool `json:"silenced,omitempty"` + + // Whether the account is currently suspended. + Suspended bool `json:"suspended,omitempty"` + + // The username of the account. + // Example: dril + Username string `json:"username,omitempty"` + + // account + Account *Account `json:"account,omitempty"` + + // role + Role *AccountRole `json:"role,omitempty"` +} + +// Validate validates this admin account info +func (m *AdminAccountInfo) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRole(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AdminAccountInfo) validateAccount(formats strfmt.Registry) error { + if swag.IsZero(m.Account) { // not required + return nil + } + + if m.Account != nil { + if err := m.Account.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *AdminAccountInfo) validateRole(formats strfmt.Registry) error { + if swag.IsZero(m.Role) { // not required + return nil + } + + if m.Role != nil { + if err := m.Role.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +// ContextValidate validate this admin account info based on the context it is used +func (m *AdminAccountInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRole(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AdminAccountInfo) contextValidateAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.Account != nil { + + if swag.IsZero(m.Account) { // not required + return nil + } + + if err := m.Account.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *AdminAccountInfo) contextValidateRole(ctx context.Context, formats strfmt.Registry) error { + + if m.Role != nil { + + if swag.IsZero(m.Role) { // not required + return nil + } + + if err := m.Role.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *AdminAccountInfo) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AdminAccountInfo) UnmarshalBinary(b []byte) error { + var res AdminAccountInfo + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/admin_action_response.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/admin_action_response.go new file mode 100644 index 0000000..dbcd36d --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/admin_action_response.go @@ -0,0 +1,52 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// AdminActionResponse AdminActionResponse models the server +// response to an admin action. +// +// swagger:model AdminActionResponse +type AdminActionResponse struct { + + // Internal ID of the action. + // Example: 01H9QG6TZ9W5P0402VFRVM17TH + ActionID string `json:"action_id,omitempty"` +} + +// Validate validates this admin action response +func (m *AdminActionResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this admin action response based on context it is used +func (m *AdminActionResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *AdminActionResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AdminActionResponse) UnmarshalBinary(b []byte) error { + var res AdminActionResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/admin_emoji.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/admin_emoji.go new file mode 100644 index 0000000..66f29ae --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/admin_emoji.go @@ -0,0 +1,95 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// AdminEmoji AdminEmoji models the admin view of a custom emoji. +// +// swagger:model AdminEmoji +type AdminEmoji struct { + + // Used for sorting custom emoji in the picker. + // Example: blobcats + Category string `json:"category,omitempty"` + + // The MIME content type of the emoji. + // Example: image/png + ContentType string `json:"content_type,omitempty"` + + // True if this emoji has been disabled by an admin action. + // Example: false + Disabled bool `json:"disabled,omitempty"` + + // The domain from which the emoji originated. Only defined for remote domains, otherwise key will not be set. + // Example: example.org + Domain string `json:"domain,omitempty"` + + // The ID of the emoji. + // Example: 01GEM7SFDZ7GZNRXFVZ3X4E4N1 + ID string `json:"id,omitempty"` + + // The name of the custom emoji. + // Example: blobcat_uwu + Shortcode string `json:"shortcode,omitempty"` + + // A link to a static copy of the custom emoji. + // Example: https://example.org/fileserver/emojis/blogcat_uwu.png + StaticURL string `json:"static_url,omitempty"` + + // The total file size taken up by the emoji in bytes, including static and animated versions. + // Example: 69420 + TotalFileSize int64 `json:"total_file_size,omitempty"` + + // The ActivityPub URI of the emoji. + // Example: https://example.org/emojis/016T5Q3SQKBT337DAKVSKNXXW1 + URI string `json:"uri,omitempty"` + + // Web URL of the custom emoji. + // Example: https://example.org/fileserver/emojis/blogcat_uwu.gif + URL string `json:"url,omitempty"` + + // Time when the emoji image was last updated. + // Example: 2022-10-05T09:21:26.419Z + UpdatedAt string `json:"updated_at,omitempty"` + + // Emoji is visible in the emoji picker of the instance. + // Example: true + VisibleInPicker bool `json:"visible_in_picker,omitempty"` +} + +// Validate validates this admin emoji +func (m *AdminEmoji) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this admin emoji based on context it is used +func (m *AdminEmoji) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *AdminEmoji) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AdminEmoji) UnmarshalBinary(b []byte) error { + var res AdminEmoji + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/admin_report.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/admin_report.go new file mode 100644 index 0000000..b483c03 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/admin_report.go @@ -0,0 +1,428 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// AdminReport AdminReport models the admin view of a report. +// +// swagger:model AdminReport +type AdminReport struct { + + // Whether an action has been taken by an admin in response to this report. + // Example: false + ActionTaken bool `json:"action_taken,omitempty"` + + // If an action was taken, at what time was this done? (ISO 8601 Datetime) + // Will be null if not set / no action yet taken. + // Example: 2021-07-30T09:20:25+00:00 + ActionTakenAt string `json:"action_taken_at,omitempty"` + + // If an action was taken, what comment was made by the admin on the taken action? + // Will be null if not set / no action yet taken. + // Example: Account was suspended. + ActionTakenComment string `json:"action_taken_comment,omitempty"` + + // Under what category was this report created? + // Example: spam + Category string `json:"category,omitempty"` + + // Comment submitted when the report was created. + // Will be empty if no comment was submitted. + // Example: This person has been harassing me. + Comment string `json:"comment,omitempty"` + + // The date when this report was created (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + CreatedAt string `json:"created_at,omitempty"` + + // Bool to indicate that report should be federated to remote instance. + // Example: true + Forwarded bool `json:"forwarded,omitempty"` + + // ID of the report. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + ID string `json:"id,omitempty"` + + // Array of rules that were broken according to this report. + // Will be empty if no rule IDs were submitted with the report. + Rules []*InstanceRule `json:"rules"` + + // Array of statuses that were submitted along with this report. + // Will be empty if no status IDs were submitted with the report. + Statuses []*Status `json:"statuses"` + + // Time of last action on this report (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + UpdatedAt string `json:"updated_at,omitempty"` + + // account + Account *AdminAccountInfo `json:"account,omitempty"` + + // action taken by account + ActionTakenByAccount *AdminAccountInfo `json:"action_taken_by_account,omitempty"` + + // assigned account + AssignedAccount *AdminAccountInfo `json:"assigned_account,omitempty"` + + // target account + TargetAccount *AdminAccountInfo `json:"target_account,omitempty"` +} + +// Validate validates this admin report +func (m *AdminReport) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRules(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatuses(formats); err != nil { + res = append(res, err) + } + + if err := m.validateAccount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateActionTakenByAccount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateAssignedAccount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTargetAccount(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AdminReport) validateRules(formats strfmt.Registry) error { + if swag.IsZero(m.Rules) { // not required + return nil + } + + for i := 0; i < len(m.Rules); i++ { + if swag.IsZero(m.Rules[i]) { // not required + continue + } + + if m.Rules[i] != nil { + if err := m.Rules[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AdminReport) validateStatuses(formats strfmt.Registry) error { + if swag.IsZero(m.Statuses) { // not required + return nil + } + + for i := 0; i < len(m.Statuses); i++ { + if swag.IsZero(m.Statuses[i]) { // not required + continue + } + + if m.Statuses[i] != nil { + if err := m.Statuses[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("statuses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("statuses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AdminReport) validateAccount(formats strfmt.Registry) error { + if swag.IsZero(m.Account) { // not required + return nil + } + + if m.Account != nil { + if err := m.Account.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *AdminReport) validateActionTakenByAccount(formats strfmt.Registry) error { + if swag.IsZero(m.ActionTakenByAccount) { // not required + return nil + } + + if m.ActionTakenByAccount != nil { + if err := m.ActionTakenByAccount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("action_taken_by_account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("action_taken_by_account") + } + return err + } + } + + return nil +} + +func (m *AdminReport) validateAssignedAccount(formats strfmt.Registry) error { + if swag.IsZero(m.AssignedAccount) { // not required + return nil + } + + if m.AssignedAccount != nil { + if err := m.AssignedAccount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("assigned_account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("assigned_account") + } + return err + } + } + + return nil +} + +func (m *AdminReport) validateTargetAccount(formats strfmt.Registry) error { + if swag.IsZero(m.TargetAccount) { // not required + return nil + } + + if m.TargetAccount != nil { + if err := m.TargetAccount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("target_account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("target_account") + } + return err + } + } + + return nil +} + +// ContextValidate validate this admin report based on the context it is used +func (m *AdminReport) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRules(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatuses(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateActionTakenByAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateAssignedAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTargetAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AdminReport) contextValidateRules(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Rules); i++ { + + if m.Rules[i] != nil { + + if swag.IsZero(m.Rules[i]) { // not required + return nil + } + + if err := m.Rules[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AdminReport) contextValidateStatuses(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Statuses); i++ { + + if m.Statuses[i] != nil { + + if swag.IsZero(m.Statuses[i]) { // not required + return nil + } + + if err := m.Statuses[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("statuses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("statuses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AdminReport) contextValidateAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.Account != nil { + + if swag.IsZero(m.Account) { // not required + return nil + } + + if err := m.Account.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *AdminReport) contextValidateActionTakenByAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.ActionTakenByAccount != nil { + + if swag.IsZero(m.ActionTakenByAccount) { // not required + return nil + } + + if err := m.ActionTakenByAccount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("action_taken_by_account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("action_taken_by_account") + } + return err + } + } + + return nil +} + +func (m *AdminReport) contextValidateAssignedAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.AssignedAccount != nil { + + if swag.IsZero(m.AssignedAccount) { // not required + return nil + } + + if err := m.AssignedAccount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("assigned_account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("assigned_account") + } + return err + } + } + + return nil +} + +func (m *AdminReport) contextValidateTargetAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.TargetAccount != nil { + + if swag.IsZero(m.TargetAccount) { // not required + return nil + } + + if err := m.TargetAccount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("target_account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("target_account") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *AdminReport) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AdminReport) UnmarshalBinary(b []byte) error { + var res AdminReport + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/application.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/application.go new file mode 100644 index 0000000..73cf1ca --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/application.go @@ -0,0 +1,72 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Application Application models an api application. +// +// swagger:model Application +type Application struct { + + // Client ID associated with this application. + ClientID string `json:"client_id,omitempty"` + + // Client secret associated with this application. + ClientSecret string `json:"client_secret,omitempty"` + + // The ID of the application. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + ID string `json:"id,omitempty"` + + // The name of the application. + // Example: Tusky + Name string `json:"name,omitempty"` + + // Post-authorization redirect URI for the application (OAuth2). + // Example: https://example.org/callback?some=query + RedirectURI string `json:"redirect_uri,omitempty"` + + // Push API key for this application. + VapidKey string `json:"vapid_key,omitempty"` + + // The website associated with the application (url) + // Example: https://tusky.app + Website string `json:"website,omitempty"` +} + +// Validate validates this application +func (m *Application) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this application based on context it is used +func (m *Application) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Application) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Application) UnmarshalBinary(b []byte) error { + var res Application + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/attachment.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/attachment.go new file mode 100644 index 0000000..ff49da6 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/attachment.go @@ -0,0 +1,147 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Attachment Attachment models a media attachment. +// +// swagger:model Attachment +type Attachment struct { + + // A hash computed by the BlurHash algorithm, for generating colorful preview thumbnails when media has not been downloaded yet. + // See https://github.com/woltapp/blurhash + Blurhash string `json:"blurhash,omitempty"` + + // Alt text that describes what is in the media attachment. + // Example: This is a picture of a kitten. + Description string `json:"description,omitempty"` + + // The ID of the attachment. + // Example: 01FC31DZT1AYWDZ8XTCRWRBYRK + ID string `json:"id,omitempty"` + + // The location of a scaled-down preview of the attachment on the remote server. + // Only defined for instances other than our own. + // Example: https://some-other-server.org/attachments/small/ahhhhh.jpeg + PreviewRemoteURL string `json:"preview_remote_url,omitempty"` + + // The location of a scaled-down preview of the attachment. + // Example: https://example.org/fileserver/some_id/attachments/some_id/small/attachment.jpeg + PreviewURL string `json:"preview_url,omitempty"` + + // The location of the full-size original attachment on the remote server. + // Only defined for instances other than our own. + // Example: https://some-other-server.org/attachments/original/ahhhhh.jpeg + RemoteURL string `json:"remote_url,omitempty"` + + // A shorter URL for the attachment. + // In our case, we just give the URL again since we don't create smaller URLs. + TextURL string `json:"text_url,omitempty"` + + // The type of the attachment. + // Example: image + Type string `json:"type,omitempty"` + + // The location of the original full-size attachment. + // Example: https://example.org/fileserver/some_id/attachments/some_id/original/attachment.jpeg + URL string `json:"url,omitempty"` + + // meta + Meta *MediaMeta `json:"meta,omitempty"` +} + +// Validate validates this attachment +func (m *Attachment) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMeta(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Attachment) validateMeta(formats strfmt.Registry) error { + if swag.IsZero(m.Meta) { // not required + return nil + } + + if m.Meta != nil { + if err := m.Meta.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("meta") + } + return err + } + } + + return nil +} + +// ContextValidate validate this attachment based on the context it is used +func (m *Attachment) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMeta(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Attachment) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + + if swag.IsZero(m.Meta) { // not required + return nil + } + + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("meta") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Attachment) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Attachment) UnmarshalBinary(b []byte) error { + var res Attachment + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/card.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/card.go new file mode 100644 index 0000000..1e0be9e --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/card.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Card Card represents a rich preview card that is generated using OpenGraph tags from a URL. +// +// swagger:model Card +type Card struct { + + // The author of the original resource. + // Example: weewee@buzzfeed.com + AuthorName string `json:"author_name,omitempty"` + + // A link to the author of the original resource. + // Example: https://buzzfeed.com/authors/weewee + AuthorURL string `json:"author_url,omitempty"` + + // A hash computed by the BlurHash algorithm, for generating colorful preview thumbnails when media has not been downloaded yet. + Blurhash string `json:"blurhash,omitempty"` + + // Description of preview. + // Example: Is water wet? We're not sure. In this article, we ask an expert... + Description string `json:"description,omitempty"` + + // Used for photo embeds, instead of custom html. + EmbedURL string `json:"embed_url,omitempty"` + + // HTML to be used for generating the preview card. + HTML string `json:"html,omitempty"` + + // Height of preview, in pixels. + Height int64 `json:"height,omitempty"` + + // Preview thumbnail. + // Example: https://example.org/fileserver/preview/thumb.jpg + Image string `json:"image,omitempty"` + + // The provider of the original resource. + // Example: Buzzfeed + ProviderName string `json:"provider_name,omitempty"` + + // A link to the provider of the original resource. + // Example: https://buzzfeed.com + ProviderURL string `json:"provider_url,omitempty"` + + // Title of linked resource. + // Example: Buzzfeed - Is Water Wet? + Title string `json:"title,omitempty"` + + // The type of the preview card. + // Example: link + Type string `json:"type,omitempty"` + + // Location of linked resource. + // Example: https://buzzfeed.com/some/fuckin/buzzfeed/article + URL string `json:"url,omitempty"` + + // Width of preview, in pixels. + Width int64 `json:"width,omitempty"` +} + +// Validate validates this card +func (m *Card) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this card based on context it is used +func (m *Card) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Card) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Card) UnmarshalBinary(b []byte) error { + var res Card + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/conversation.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/conversation.go new file mode 100644 index 0000000..1b18f88 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/conversation.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Conversation Conversation represents a conversation +// with "direct message" visibility. +// +// swagger:model Conversation +type Conversation struct { + + // Participants in the conversation. + Accounts []*Account `json:"accounts"` + + // Local database ID of the conversation. + ID string `json:"id,omitempty"` + + // Is the conversation currently marked as unread? + Unread bool `json:"unread,omitempty"` + + // last status + LastStatus *Status `json:"last_status,omitempty"` +} + +// Validate validates this conversation +func (m *Conversation) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccounts(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLastStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Conversation) validateAccounts(formats strfmt.Registry) error { + if swag.IsZero(m.Accounts) { // not required + return nil + } + + for i := 0; i < len(m.Accounts); i++ { + if swag.IsZero(m.Accounts[i]) { // not required + continue + } + + if m.Accounts[i] != nil { + if err := m.Accounts[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("accounts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("accounts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Conversation) validateLastStatus(formats strfmt.Registry) error { + if swag.IsZero(m.LastStatus) { // not required + return nil + } + + if m.LastStatus != nil { + if err := m.LastStatus.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("last_status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("last_status") + } + return err + } + } + + return nil +} + +// ContextValidate validate this conversation based on the context it is used +func (m *Conversation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccounts(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateLastStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Conversation) contextValidateAccounts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Accounts); i++ { + + if m.Accounts[i] != nil { + + if swag.IsZero(m.Accounts[i]) { // not required + return nil + } + + if err := m.Accounts[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("accounts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("accounts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Conversation) contextValidateLastStatus(ctx context.Context, formats strfmt.Registry) error { + + if m.LastStatus != nil { + + if swag.IsZero(m.LastStatus) { // not required + return nil + } + + if err := m.LastStatus.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("last_status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("last_status") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Conversation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Conversation) UnmarshalBinary(b []byte) error { + var res Conversation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/debug_a_p_url_response.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/debug_a_p_url_response.go new file mode 100644 index 0000000..a23eefb --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/debug_a_p_url_response.go @@ -0,0 +1,65 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// DebugAPURLResponse DebugAPUrlResponse provides detailed debug +// information for an AP URL dereference request. +// +// swagger:model DebugAPUrlResponse +type DebugAPURLResponse struct { + + // HTTP headers used in the outgoing request. + RequestHeaders map[string][]string `json:"request_headers,omitempty"` + + // Remote AP URL that was requested. + RequestURL string `json:"request_url,omitempty"` + + // Body returned from the remote instance. + // Will be stringified bytes; may be JSON, + // may be an error, may be both! + ResponseBody string `json:"response_body,omitempty"` + + // HTTP response code returned from the remote instance. + ResponseCode int64 `json:"response_code,omitempty"` + + // HTTP headers returned from the remote instance. + ResponseHeaders map[string][]string `json:"response_headers,omitempty"` +} + +// Validate validates this debug a p Url response +func (m *DebugAPURLResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this debug a p Url response based on context it is used +func (m *DebugAPURLResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *DebugAPURLResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DebugAPURLResponse) UnmarshalBinary(b []byte) error { + var res DebugAPURLResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/default_policies.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/default_policies.go new file mode 100644 index 0000000..d07a417 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/default_policies.go @@ -0,0 +1,262 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// DefaultPolicies Default interaction policies to use for new statuses by requesting account. +// +// swagger:model DefaultPolicies +type DefaultPolicies struct { + + // direct + Direct *InteractionPolicy `json:"direct,omitempty"` + + // private + Private *InteractionPolicy `json:"private,omitempty"` + + // public + Public *InteractionPolicy `json:"public,omitempty"` + + // unlisted + Unlisted *InteractionPolicy `json:"unlisted,omitempty"` +} + +// Validate validates this default policies +func (m *DefaultPolicies) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDirect(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePrivate(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePublic(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUnlisted(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DefaultPolicies) validateDirect(formats strfmt.Registry) error { + if swag.IsZero(m.Direct) { // not required + return nil + } + + if m.Direct != nil { + if err := m.Direct.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("direct") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("direct") + } + return err + } + } + + return nil +} + +func (m *DefaultPolicies) validatePrivate(formats strfmt.Registry) error { + if swag.IsZero(m.Private) { // not required + return nil + } + + if m.Private != nil { + if err := m.Private.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("private") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("private") + } + return err + } + } + + return nil +} + +func (m *DefaultPolicies) validatePublic(formats strfmt.Registry) error { + if swag.IsZero(m.Public) { // not required + return nil + } + + if m.Public != nil { + if err := m.Public.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("public") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("public") + } + return err + } + } + + return nil +} + +func (m *DefaultPolicies) validateUnlisted(formats strfmt.Registry) error { + if swag.IsZero(m.Unlisted) { // not required + return nil + } + + if m.Unlisted != nil { + if err := m.Unlisted.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("unlisted") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("unlisted") + } + return err + } + } + + return nil +} + +// ContextValidate validate this default policies based on the context it is used +func (m *DefaultPolicies) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDirect(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePrivate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePublic(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUnlisted(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DefaultPolicies) contextValidateDirect(ctx context.Context, formats strfmt.Registry) error { + + if m.Direct != nil { + + if swag.IsZero(m.Direct) { // not required + return nil + } + + if err := m.Direct.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("direct") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("direct") + } + return err + } + } + + return nil +} + +func (m *DefaultPolicies) contextValidatePrivate(ctx context.Context, formats strfmt.Registry) error { + + if m.Private != nil { + + if swag.IsZero(m.Private) { // not required + return nil + } + + if err := m.Private.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("private") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("private") + } + return err + } + } + + return nil +} + +func (m *DefaultPolicies) contextValidatePublic(ctx context.Context, formats strfmt.Registry) error { + + if m.Public != nil { + + if swag.IsZero(m.Public) { // not required + return nil + } + + if err := m.Public.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("public") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("public") + } + return err + } + } + + return nil +} + +func (m *DefaultPolicies) contextValidateUnlisted(ctx context.Context, formats strfmt.Registry) error { + + if m.Unlisted != nil { + + if swag.IsZero(m.Unlisted) { // not required + return nil + } + + if err := m.Unlisted.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("unlisted") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("unlisted") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *DefaultPolicies) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DefaultPolicies) UnmarshalBinary(b []byte) error { + var res DefaultPolicies + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/domain.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/domain.go new file mode 100644 index 0000000..8d9ec88 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/domain.go @@ -0,0 +1,63 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Domain Domain represents a remote domain +// +// swagger:model Domain +type Domain struct { + + // The hostname of the domain. + // Example: example.org + Domain string `json:"domain,omitempty"` + + // If the domain is blocked, what's the publicly-stated reason for the block. + // Example: they smell + PublicComment string `json:"public_comment,omitempty"` + + // Time at which this domain was silenced. Key will not be present on open domains. + // Example: 2021-07-30T09:20:25+00:00 + SilencedAt string `json:"silenced_at,omitempty"` + + // Time at which this domain was suspended. Key will not be present on open domains. + // Example: 2021-07-30T09:20:25+00:00 + SuspendedAt string `json:"suspended_at,omitempty"` +} + +// Validate validates this domain +func (m *Domain) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this domain based on context it is used +func (m *Domain) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Domain) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Domain) UnmarshalBinary(b []byte) error { + var res Domain + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/domain_permission.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/domain_permission.go new file mode 100644 index 0000000..f2af5f3 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/domain_permission.go @@ -0,0 +1,108 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// DomainPermission DomainPermission represents a permission applied to one domain (explicit block/allow). +// +// swagger:model DomainPermission +type DomainPermission struct { + + // Time at which the permission entry was created (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + CreatedAt string `json:"created_at,omitempty"` + + // ID of the account that created this domain permission entry. + // Example: 01FBW2758ZB6PBR200YPDDJK4C + CreatedBy string `json:"created_by,omitempty"` + + // The hostname of the domain. + // Example: example.org + Domain string `json:"domain,omitempty"` + + // The ID of the domain permission entry. + // Example: 01FBW21XJA09XYX51KV5JVBW0F + // Read Only: true + ID string `json:"id,omitempty"` + + // Obfuscate the domain name when serving this domain permission entry publicly. + // Example: false + Obfuscate bool `json:"obfuscate,omitempty"` + + // Private comment for this permission entry, visible to this instance's admins only. + // Example: they are poopoo + PrivateComment string `json:"private_comment,omitempty"` + + // If the domain is blocked, what's the publicly-stated reason for the block. + // Example: they smell + PublicComment string `json:"public_comment,omitempty"` + + // Time at which this domain was silenced. Key will not be present on open domains. + // Example: 2021-07-30T09:20:25+00:00 + SilencedAt string `json:"silenced_at,omitempty"` + + // If applicable, the ID of the subscription that caused this domain permission entry to be created. + // Example: 01FBW25TF5J67JW3HFHZCSD23K + SubscriptionID string `json:"subscription_id,omitempty"` + + // Time at which this domain was suspended. Key will not be present on open domains. + // Example: 2021-07-30T09:20:25+00:00 + SuspendedAt string `json:"suspended_at,omitempty"` +} + +// Validate validates this domain permission +func (m *DomainPermission) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validate this domain permission based on the context it is used +func (m *DomainPermission) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateID(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DomainPermission) contextValidateID(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "id", "body", string(m.ID)); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *DomainPermission) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DomainPermission) UnmarshalBinary(b []byte) error { + var res DomainPermission + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/emoji.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/emoji.go new file mode 100644 index 0000000..94a2a61 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/emoji.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Emoji Emoji represents a custom emoji. +// +// swagger:model Emoji +type Emoji struct { + + // Used for sorting custom emoji in the picker. + // Example: blobcats + Category string `json:"category,omitempty"` + + // The name of the custom emoji. + // Example: blobcat_uwu + Shortcode string `json:"shortcode,omitempty"` + + // A link to a static copy of the custom emoji. + // Example: https://example.org/fileserver/emojis/blogcat_uwu.png + StaticURL string `json:"static_url,omitempty"` + + // Web URL of the custom emoji. + // Example: https://example.org/fileserver/emojis/blogcat_uwu.gif + URL string `json:"url,omitempty"` + + // Emoji is visible in the emoji picker of the instance. + // Example: true + VisibleInPicker bool `json:"visible_in_picker,omitempty"` +} + +// Validate validates this emoji +func (m *Emoji) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this emoji based on context it is used +func (m *Emoji) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Emoji) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Emoji) UnmarshalBinary(b []byte) error { + var res Emoji + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/emoji_category.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/emoji_category.go new file mode 100644 index 0000000..ce6138f --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/emoji_category.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// EmojiCategory EmojiCategory represents a custom emoji category. +// +// swagger:model EmojiCategory +type EmojiCategory struct { + + // The ID of the custom emoji category. + ID string `json:"id,omitempty"` + + // The name of the custom emoji category. + Name string `json:"name,omitempty"` +} + +// Validate validates this emoji category +func (m *EmojiCategory) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this emoji category based on context it is used +func (m *EmojiCategory) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *EmojiCategory) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *EmojiCategory) UnmarshalBinary(b []byte) error { + var res EmojiCategory + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/field.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/field.go new file mode 100644 index 0000000..4ed8336 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/field.go @@ -0,0 +1,59 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Field Field represents a name/value pair to display on an account's profile. +// +// swagger:model Field +type Field struct { + + // The key/name of this field. + // Example: pronouns + Name string `json:"name,omitempty"` + + // The value of this field. + // Example: they/them + Value string `json:"value,omitempty"` + + // If this field has been verified, when did this occur? (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + VerifiedAt string `json:"verified_at,omitempty"` +} + +// Validate validates this field +func (m *Field) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this field based on context it is used +func (m *Field) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Field) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Field) UnmarshalBinary(b []byte) error { + var res Field + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_action.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_action.go new file mode 100644 index 0000000..b0c3545 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_action.go @@ -0,0 +1,27 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" +) + +// FilterAction FilterAction is the action to apply to statuses matching a filter. +// +// swagger:model FilterAction +type FilterAction string + +// Validate validates this filter action +func (m FilterAction) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this filter action based on context it is used +func (m FilterAction) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_context.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_context.go new file mode 100644 index 0000000..0c7c840 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_context.go @@ -0,0 +1,29 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" +) + +// FilterContext FilterContext represents the context in which to apply a filter. +// +// v1 and v2 filter APIs use the same set of contexts. +// +// swagger:model FilterContext +type FilterContext string + +// Validate validates this filter context +func (m FilterContext) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this filter context based on context it is used +func (m FilterContext) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_keyword.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_keyword.go new file mode 100644 index 0000000..951a4a7 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_keyword.go @@ -0,0 +1,58 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// FilterKeyword FilterKeyword represents text to filter within a v2 filter. +// +// swagger:model FilterKeyword +type FilterKeyword struct { + + // The ID of the filter keyword entry in the database. + ID string `json:"id,omitempty"` + + // The text to be filtered. + // Example: fnord + Keyword string `json:"keyword,omitempty"` + + // Should the filter keyword consider word boundaries? + // Example: true + WholeWord bool `json:"whole_word,omitempty"` +} + +// Validate validates this filter keyword +func (m *FilterKeyword) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this filter keyword based on context it is used +func (m *FilterKeyword) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *FilterKeyword) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *FilterKeyword) UnmarshalBinary(b []byte) error { + var res FilterKeyword + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_result.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_result.go new file mode 100644 index 0000000..883abe2 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_result.go @@ -0,0 +1,115 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// FilterResult FilterResult is returned along with a filtered status to explain why it was filtered. +// +// swagger:model FilterResult +type FilterResult struct { + + // The keywords within the filter that were matched. + KeywordMatches []string `json:"keyword_matches"` + + // The status IDs within the filter that were matched. + StatusMatches []string `json:"status_matches"` + + // filter + Filter *FilterV2 `json:"filter,omitempty"` +} + +// Validate validates this filter result +func (m *FilterResult) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateFilter(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *FilterResult) validateFilter(formats strfmt.Registry) error { + if swag.IsZero(m.Filter) { // not required + return nil + } + + if m.Filter != nil { + if err := m.Filter.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("filter") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("filter") + } + return err + } + } + + return nil +} + +// ContextValidate validate this filter result based on the context it is used +func (m *FilterResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFilter(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *FilterResult) contextValidateFilter(ctx context.Context, formats strfmt.Registry) error { + + if m.Filter != nil { + + if swag.IsZero(m.Filter) { // not required + return nil + } + + if err := m.Filter.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("filter") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("filter") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *FilterResult) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *FilterResult) UnmarshalBinary(b []byte) error { + var res FilterResult + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_status.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_status.go new file mode 100644 index 0000000..5578893 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_status.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// FilterStatus FilterStatus represents a single status to filter within a v2 filter. +// +// swagger:model FilterStatus +type FilterStatus struct { + + // The ID of the filter status entry in the database. + ID string `json:"id,omitempty"` + + // The status ID to be filtered. + StatusID string `json:"phrase,omitempty"` +} + +// Validate validates this filter status +func (m *FilterStatus) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this filter status based on context it is used +func (m *FilterStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *FilterStatus) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *FilterStatus) UnmarshalBinary(b []byte) error { + var res FilterStatus + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_v1.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_v1.go new file mode 100644 index 0000000..400bc28 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_v1.go @@ -0,0 +1,154 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// FilterV1 FilterV1 represents a user-defined filter for determining which statuses should not be shown to the user. +// +// Note that v1 filters are mapped to v2 filters and v2 filter keywords internally. +// If whole_word is true, client app should do: +// Define ‘word constituent character’ for your app. In the official implementation, it’s [A-Za-z0-9_] in JavaScript, and [[:word:]] in Ruby. +// Ruby uses the POSIX character class (Letter | Mark | Decimal_Number | Connector_Punctuation). +// If the phrase starts with a word character, and if the previous character before matched range is a word character, its matched range should be treated to not match. +// If the phrase ends with a word character, and if the next character after matched range is a word character, its matched range should be treated to not match. +// Please check app/javascript/mastodon/selectors/index.js and app/lib/feed_manager.rb in the Mastodon source code for more details. +// +// swagger:model FilterV1 +type FilterV1 struct { + + // The contexts in which the filter should be applied. + // Example: ["home","public"] + // Min Items: 1 + // Unique: true + Context []FilterContext `json:"context"` + + // When the filter should no longer be applied. Null if the filter does not expire. + // Example: 2024-02-01T02:57:49Z + ExpiresAt string `json:"expires_at,omitempty"` + + // The ID of the filter in the database. + ID string `json:"id,omitempty"` + + // Should matching entities be removed from the user's timelines/views, instead of hidden? + // Example: false + Irreversible bool `json:"irreversible,omitempty"` + + // The text to be filtered. + // Example: fnord + Phrase string `json:"phrase,omitempty"` + + // Should the filter consider word boundaries? + // Example: true + WholeWord bool `json:"whole_word,omitempty"` +} + +// Validate validates this filter v1 +func (m *FilterV1) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateContext(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *FilterV1) validateContext(formats strfmt.Registry) error { + if swag.IsZero(m.Context) { // not required + return nil + } + + iContextSize := int64(len(m.Context)) + + if err := validate.MinItems("context", "body", iContextSize, 1); err != nil { + return err + } + + if err := validate.UniqueItems("context", "body", m.Context); err != nil { + return err + } + + for i := 0; i < len(m.Context); i++ { + + if err := m.Context[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("context" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("context" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +// ContextValidate validate this filter v1 based on the context it is used +func (m *FilterV1) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateContext(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *FilterV1) contextValidateContext(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Context); i++ { + + if swag.IsZero(m.Context[i]) { // not required + return nil + } + + if err := m.Context[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("context" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("context" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *FilterV1) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *FilterV1) UnmarshalBinary(b []byte) error { + var res FilterV1 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_v2.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_v2.go new file mode 100644 index 0000000..9733aff --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/filter_v2.go @@ -0,0 +1,310 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// FilterV2 FilterV2 represents a user-defined filter for determining which statuses should not be shown to the user. +// +// v2 filters have names and can include multiple phrases and status IDs to filter. +// +// swagger:model FilterV2 +type FilterV2 struct { + + // The contexts in which the filter should be applied. + // Example: ["home","public"] + // Min Items: 1 + // Unique: true + Context []FilterContext `json:"context"` + + // When the filter should no longer be applied. Null if the filter does not expire. + // Example: 2024-02-01T02:57:49Z + ExpiresAt string `json:"expires_at,omitempty"` + + // The ID of the filter in the database. + ID string `json:"id,omitempty"` + + // The keywords grouped under this filter. + Keywords []*FilterKeyword `json:"keywords"` + + // The statuses grouped under this filter. + Statuses []*FilterStatus `json:"statuses"` + + // The name of the filter. + // Example: Linux Words + Title string `json:"title,omitempty"` + + // filter action + FilterAction FilterAction `json:"filter_action,omitempty"` +} + +// Validate validates this filter v2 +func (m *FilterV2) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateContext(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKeywords(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatuses(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFilterAction(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *FilterV2) validateContext(formats strfmt.Registry) error { + if swag.IsZero(m.Context) { // not required + return nil + } + + iContextSize := int64(len(m.Context)) + + if err := validate.MinItems("context", "body", iContextSize, 1); err != nil { + return err + } + + if err := validate.UniqueItems("context", "body", m.Context); err != nil { + return err + } + + for i := 0; i < len(m.Context); i++ { + + if err := m.Context[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("context" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("context" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +func (m *FilterV2) validateKeywords(formats strfmt.Registry) error { + if swag.IsZero(m.Keywords) { // not required + return nil + } + + for i := 0; i < len(m.Keywords); i++ { + if swag.IsZero(m.Keywords[i]) { // not required + continue + } + + if m.Keywords[i] != nil { + if err := m.Keywords[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keywords" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keywords" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *FilterV2) validateStatuses(formats strfmt.Registry) error { + if swag.IsZero(m.Statuses) { // not required + return nil + } + + for i := 0; i < len(m.Statuses); i++ { + if swag.IsZero(m.Statuses[i]) { // not required + continue + } + + if m.Statuses[i] != nil { + if err := m.Statuses[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("statuses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("statuses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *FilterV2) validateFilterAction(formats strfmt.Registry) error { + if swag.IsZero(m.FilterAction) { // not required + return nil + } + + if err := m.FilterAction.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("filter_action") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("filter_action") + } + return err + } + + return nil +} + +// ContextValidate validate this filter v2 based on the context it is used +func (m *FilterV2) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateContext(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeywords(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatuses(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFilterAction(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *FilterV2) contextValidateContext(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Context); i++ { + + if swag.IsZero(m.Context[i]) { // not required + return nil + } + + if err := m.Context[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("context" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("context" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +func (m *FilterV2) contextValidateKeywords(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Keywords); i++ { + + if m.Keywords[i] != nil { + + if swag.IsZero(m.Keywords[i]) { // not required + return nil + } + + if err := m.Keywords[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keywords" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keywords" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *FilterV2) contextValidateStatuses(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Statuses); i++ { + + if m.Statuses[i] != nil { + + if swag.IsZero(m.Statuses[i]) { // not required + return nil + } + + if err := m.Statuses[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("statuses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("statuses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *FilterV2) contextValidateFilterAction(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.FilterAction) { // not required + return nil + } + + if err := m.FilterAction.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("filter_action") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("filter_action") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *FilterV2) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *FilterV2) UnmarshalBinary(b []byte) error { + var res FilterV2 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/header_filter.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/header_filter.go new file mode 100644 index 0000000..d73b718 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/header_filter.go @@ -0,0 +1,116 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// HeaderFilter HeaderFilter represents a regex value filter applied to one particular HTTP header (allow / block). +// +// swagger:model HeaderFilter +type HeaderFilter struct { + + // Time at which the header filter was created (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + // Read Only: true + CreatedAt string `json:"created_at,omitempty"` + + // The ID of the admin account that created this header filter. + // Example: 01FBW2758ZB6PBR200YPDDJK4C + // Read Only: true + CreatedBy string `json:"created_by,omitempty"` + + // The HTTP header to match against. + // Example: User-Agent + Header string `json:"header,omitempty"` + + // The ID of the header filter. + // Example: 01FBW21XJA09XYX51KV5JVBW0F + // Read Only: true + ID string `json:"id,omitempty"` + + // The header value matching regular expression. + // Example: .*Firefox.* + Regex string `json:"regex,omitempty"` +} + +// Validate validates this header filter +func (m *HeaderFilter) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validate this header filter based on the context it is used +func (m *HeaderFilter) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCreatedAt(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCreatedBy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateID(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HeaderFilter) contextValidateCreatedAt(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "created_at", "body", string(m.CreatedAt)); err != nil { + return err + } + + return nil +} + +func (m *HeaderFilter) contextValidateCreatedBy(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "created_by", "body", string(m.CreatedBy)); err != nil { + return err + } + + return nil +} + +func (m *HeaderFilter) contextValidateID(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "id", "body", string(m.ID)); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HeaderFilter) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HeaderFilter) UnmarshalBinary(b []byte) error { + var res HeaderFilter + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/host_meta.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/host_meta.go new file mode 100644 index 0000000..6e64627 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/host_meta.go @@ -0,0 +1,129 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HostMeta HostMeta represents a hostmeta document. +// +// See: https://www.rfc-editor.org/rfc/rfc6415.html#section-3 +// +// swagger:model HostMeta +type HostMeta struct { + + // link + Link []*Link `json:"Link"` + + // XML n s + XMLNS string `json:"XMLNS,omitempty"` + + // XML name + XMLName interface{} `json:"XMLName,omitempty"` +} + +// Validate validates this host meta +func (m *HostMeta) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLink(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostMeta) validateLink(formats strfmt.Registry) error { + if swag.IsZero(m.Link) { // not required + return nil + } + + for i := 0; i < len(m.Link); i++ { + if swag.IsZero(m.Link[i]) { // not required + continue + } + + if m.Link[i] != nil { + if err := m.Link[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Link" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Link" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this host meta based on the context it is used +func (m *HostMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLink(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostMeta) contextValidateLink(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Link); i++ { + + if m.Link[i] != nil { + + if swag.IsZero(m.Link[i]) { // not required + return nil + } + + if err := m.Link[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Link" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Link" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HostMeta) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HostMeta) UnmarshalBinary(b []byte) error { + var res HostMeta + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_configuration_accounts.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_configuration_accounts.go new file mode 100644 index 0000000..3f9430a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_configuration_accounts.go @@ -0,0 +1,59 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceConfigurationAccounts InstanceConfigurationAccounts models instance account config parameters. +// +// swagger:model InstanceConfigurationAccounts +type InstanceConfigurationAccounts struct { + + // Whether or not accounts on this instance are allowed to upload custom CSS for profiles and statuses. + // Example: false + AllowCustomCSS bool `json:"allow_custom_css,omitempty"` + + // The maximum number of featured tags allowed for each account. + // Currently not implemented, so this is hardcoded to 10. + MaxFeaturedTags int64 `json:"max_featured_tags,omitempty"` + + // The maximum number of profile fields allowed for each account. + // Currently not configurable, so this is hardcoded to 6. (https://github.com/superseriousbusiness/gotosocial/issues/1876) + MaxProfileFields int64 `json:"max_profile_fields,omitempty"` +} + +// Validate validates this instance configuration accounts +func (m *InstanceConfigurationAccounts) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance configuration accounts based on context it is used +func (m *InstanceConfigurationAccounts) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceConfigurationAccounts) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceConfigurationAccounts) UnmarshalBinary(b []byte) error { + var res InstanceConfigurationAccounts + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_configuration_emojis.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_configuration_emojis.go new file mode 100644 index 0000000..192664c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_configuration_emojis.go @@ -0,0 +1,51 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceConfigurationEmojis InstanceConfigurationEmojis models instance emoji config parameters. +// +// swagger:model InstanceConfigurationEmojis +type InstanceConfigurationEmojis struct { + + // Max allowed emoji image size in bytes. + // Example: 51200 + EmojiSizeLimit int64 `json:"emoji_size_limit,omitempty"` +} + +// Validate validates this instance configuration emojis +func (m *InstanceConfigurationEmojis) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance configuration emojis based on context it is used +func (m *InstanceConfigurationEmojis) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceConfigurationEmojis) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceConfigurationEmojis) UnmarshalBinary(b []byte) error { + var res InstanceConfigurationEmojis + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_configuration_media_attachments.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_configuration_media_attachments.go new file mode 100644 index 0000000..9c0d713 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_configuration_media_attachments.go @@ -0,0 +1,77 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceConfigurationMediaAttachments InstanceConfigurationMediaAttachments models instance media attachment config parameters. +// +// swagger:model InstanceConfigurationMediaAttachments +type InstanceConfigurationMediaAttachments struct { + + // Max allowed image size in pixels as height*width. + // + // GtS doesn't set a limit on this, but for compatibility + // we give Mastodon's 4096x4096px value here. + // Example: 16777216 + ImageMatrixLimit int64 `json:"image_matrix_limit,omitempty"` + + // Max allowed image size in bytes + // Example: 2097152 + ImageSizeLimit int64 `json:"image_size_limit,omitempty"` + + // List of mime types that it's possible to upload to this instance. + // Example: ["image/jpeg","image/gif"] + SupportedMimeTypes []string `json:"supported_mime_types"` + + // Max allowed video frame rate. + // Example: 60 + VideoFrameRateLimit int64 `json:"video_frame_rate_limit,omitempty"` + + // Max allowed video size in pixels as height*width. + // + // GtS doesn't set a limit on this, but for compatibility + // we give Mastodon's 4096x4096px value here. + // Example: 16777216 + VideoMatrixLimit int64 `json:"video_matrix_limit,omitempty"` + + // Max allowed video size in bytes + // Example: 10485760 + VideoSizeLimit int64 `json:"video_size_limit,omitempty"` +} + +// Validate validates this instance configuration media attachments +func (m *InstanceConfigurationMediaAttachments) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance configuration media attachments based on context it is used +func (m *InstanceConfigurationMediaAttachments) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceConfigurationMediaAttachments) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceConfigurationMediaAttachments) UnmarshalBinary(b []byte) error { + var res InstanceConfigurationMediaAttachments + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_configuration_polls.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_configuration_polls.go new file mode 100644 index 0000000..5362ebb --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_configuration_polls.go @@ -0,0 +1,63 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceConfigurationPolls InstanceConfigurationPolls models instance poll config parameters. +// +// swagger:model InstanceConfigurationPolls +type InstanceConfigurationPolls struct { + + // Number of characters allowed per option in the poll. + // Example: 50 + MaxCharactersPerOption int64 `json:"max_characters_per_option,omitempty"` + + // Maximum expiration time of the poll in seconds. + // Example: 2629746 + MaxExpiration int64 `json:"max_expiration,omitempty"` + + // Number of options permitted in a poll on this instance. + // Example: 4 + MaxOptions int64 `json:"max_options,omitempty"` + + // Minimum expiration time of the poll in seconds. + // Example: 300 + MinExpiration int64 `json:"min_expiration,omitempty"` +} + +// Validate validates this instance configuration polls +func (m *InstanceConfigurationPolls) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance configuration polls based on context it is used +func (m *InstanceConfigurationPolls) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceConfigurationPolls) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceConfigurationPolls) UnmarshalBinary(b []byte) error { + var res InstanceConfigurationPolls + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_configuration_statuses.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_configuration_statuses.go new file mode 100644 index 0000000..f64019f --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_configuration_statuses.go @@ -0,0 +1,63 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceConfigurationStatuses InstanceConfigurationStatuses models instance status config parameters. +// +// swagger:model InstanceConfigurationStatuses +type InstanceConfigurationStatuses struct { + + // Amount of characters clients should assume a url takes up. + // Example: 25 + CharactersReservedPerURL int64 `json:"characters_reserved_per_url,omitempty"` + + // Maximum allowed length of a post on this instance, in characters. + // Example: 5000 + MaxCharacters int64 `json:"max_characters,omitempty"` + + // Max number of attachments allowed on a status. + // Example: 4 + MaxMediaAttachments int64 `json:"max_media_attachments,omitempty"` + + // List of mime types that it's possible to use for statuses on this instance. + // Example: ["text/plain","text/markdown"] + SupportedMimeTypes []string `json:"supported_mime_types"` +} + +// Validate validates this instance configuration statuses +func (m *InstanceConfigurationStatuses) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance configuration statuses based on context it is used +func (m *InstanceConfigurationStatuses) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceConfigurationStatuses) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceConfigurationStatuses) UnmarshalBinary(b []byte) error { + var res InstanceConfigurationStatuses + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_rule.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_rule.go new file mode 100644 index 0000000..10cbe54 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_rule.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceRule InstanceRule represents a single instance rule. +// +// swagger:model InstanceRule +type InstanceRule struct { + + // ID + ID string `json:"id,omitempty"` + + // text + Text string `json:"text,omitempty"` +} + +// Validate validates this instance rule +func (m *InstanceRule) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance rule based on context it is used +func (m *InstanceRule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceRule) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceRule) UnmarshalBinary(b []byte) error { + var res InstanceRule + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v1.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v1.go new file mode 100644 index 0000000..5ecb922 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v1.go @@ -0,0 +1,373 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV1 InstanceV1 models information about this instance. +// +// swagger:model InstanceV1 +type InstanceV1 struct { + + // The domain of accounts on this instance. + // This will not necessarily be the same as + // simply the Host part of the URI. + // Example: example.org + AccountDomain string `json:"account_domain,omitempty"` + + // New account registrations require admin approval. + ApprovalRequired bool `json:"approval_required,omitempty"` + + // Whether or not instance is running in DEBUG mode. Omitted if false. + Debug bool `json:"debug,omitempty"` + + // Description of the instance. + // + // Should be HTML formatted, but might be plaintext. + // + // This should be displayed on the 'about' page for an instance. + Description string `json:"description,omitempty"` + + // Raw (unparsed) version of description. + DescriptionText string `json:"description_text,omitempty"` + + // An email address that may be used for inquiries. + // Example: admin@example.org + Email string `json:"email,omitempty"` + + // Invites are enabled on this instance. + InvitesEnabled bool `json:"invites_enabled,omitempty"` + + // Primary language of the instance. + // Example: ["en"] + Languages []string `json:"languages"` + + // Maximum allowed length of a post on this instance, in characters. + // + // This is provided for compatibility with Tusky and other apps. + // Example: 5000 + MaxTootChars uint64 `json:"max_toot_chars,omitempty"` + + // New account registrations are enabled on this instance. + Registrations bool `json:"registrations,omitempty"` + + // An itemized list of rules for this instance. + Rules []*InstanceRule `json:"rules"` + + // A shorter description of the instance. + // + // Should be HTML formatted, but might be plaintext. + // + // This should be displayed on the instance splash/landing page. + ShortDescription string `json:"short_description,omitempty"` + + // Raw (unparsed) version of short description. + ShortDescriptionText string `json:"short_description_text,omitempty"` + + // Statistics about the instance: number of posts, accounts, etc. + // Values are pointers because we don't want to skip 0 values when + // rendering stats via web templates. + Stats map[string]int64 `json:"stats,omitempty"` + + // Terms and conditions for accounts on this instance. + Terms string `json:"terms,omitempty"` + + // Raw (unparsed) version of terms. + TermsRaw string `json:"terms_text,omitempty"` + + // URL of the instance avatar/banner image. + // Example: https://example.org/files/instance/thumbnail.jpeg + Thumbnail string `json:"thumbnail,omitempty"` + + // Description of the instance thumbnail. + // Example: picture of a cute lil' friendly sloth + ThumbnailDescription string `json:"thumbnail_description,omitempty"` + + // URL of the static instance avatar/banner image. + // Example: https://example.org/files/instance/static/thumbnail.webp + ThumbnailStatic string `json:"thumbnail_static,omitempty"` + + // MIME type of the static instance thumbnail. + // Example: image/webp + ThumbnailStaticType string `json:"thumbnail_static_type,omitempty"` + + // MIME type of the instance thumbnail. + // Example: image/png + ThumbnailType string `json:"thumbnail_type,omitempty"` + + // The title of the instance. + // Example: GoToSocial Example Instance + Title string `json:"title,omitempty"` + + // The URI of the instance. + // Example: https://gts.example.org + URI string `json:"uri,omitempty"` + + // The version of GoToSocial installed on the instance. + // + // This will contain at least a semantic version number. + // + // It may also contain, after a space, the short git commit ID of the running software. + // Example: 0.1.1 cb85f65 + Version string `json:"version,omitempty"` + + // configuration + Configuration *InstanceV1Configuration `json:"configuration,omitempty"` + + // contact account + ContactAccount *Account `json:"contact_account,omitempty"` + + // urls + Urls *InstanceV1URLs `json:"urls,omitempty"` +} + +// Validate validates this instance v1 +func (m *InstanceV1) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRules(formats); err != nil { + res = append(res, err) + } + + if err := m.validateConfiguration(formats); err != nil { + res = append(res, err) + } + + if err := m.validateContactAccount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUrls(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV1) validateRules(formats strfmt.Registry) error { + if swag.IsZero(m.Rules) { // not required + return nil + } + + for i := 0; i < len(m.Rules); i++ { + if swag.IsZero(m.Rules[i]) { // not required + continue + } + + if m.Rules[i] != nil { + if err := m.Rules[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *InstanceV1) validateConfiguration(formats strfmt.Registry) error { + if swag.IsZero(m.Configuration) { // not required + return nil + } + + if m.Configuration != nil { + if err := m.Configuration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("configuration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("configuration") + } + return err + } + } + + return nil +} + +func (m *InstanceV1) validateContactAccount(formats strfmt.Registry) error { + if swag.IsZero(m.ContactAccount) { // not required + return nil + } + + if m.ContactAccount != nil { + if err := m.ContactAccount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("contact_account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("contact_account") + } + return err + } + } + + return nil +} + +func (m *InstanceV1) validateUrls(formats strfmt.Registry) error { + if swag.IsZero(m.Urls) { // not required + return nil + } + + if m.Urls != nil { + if err := m.Urls.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("urls") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("urls") + } + return err + } + } + + return nil +} + +// ContextValidate validate this instance v1 based on the context it is used +func (m *InstanceV1) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRules(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateConfiguration(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateContactAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUrls(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV1) contextValidateRules(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Rules); i++ { + + if m.Rules[i] != nil { + + if swag.IsZero(m.Rules[i]) { // not required + return nil + } + + if err := m.Rules[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *InstanceV1) contextValidateConfiguration(ctx context.Context, formats strfmt.Registry) error { + + if m.Configuration != nil { + + if swag.IsZero(m.Configuration) { // not required + return nil + } + + if err := m.Configuration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("configuration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("configuration") + } + return err + } + } + + return nil +} + +func (m *InstanceV1) contextValidateContactAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.ContactAccount != nil { + + if swag.IsZero(m.ContactAccount) { // not required + return nil + } + + if err := m.ContactAccount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("contact_account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("contact_account") + } + return err + } + } + + return nil +} + +func (m *InstanceV1) contextValidateUrls(ctx context.Context, formats strfmt.Registry) error { + + if m.Urls != nil { + + if swag.IsZero(m.Urls) { // not required + return nil + } + + if err := m.Urls.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("urls") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("urls") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV1) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV1) UnmarshalBinary(b []byte) error { + var res InstanceV1 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v1_configuration.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v1_configuration.go new file mode 100644 index 0000000..24875b0 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v1_configuration.go @@ -0,0 +1,316 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV1Configuration InstanceV1Configuration models instance configuration parameters. +// +// swagger:model InstanceV1Configuration +type InstanceV1Configuration struct { + + // True if instance is running with OIDC as auth/identity backend, else omitted. + OIDCEnabled bool `json:"oidc_enabled,omitempty"` + + // accounts + Accounts *InstanceConfigurationAccounts `json:"accounts,omitempty"` + + // emojis + Emojis *InstanceConfigurationEmojis `json:"emojis,omitempty"` + + // media attachments + MediaAttachments *InstanceConfigurationMediaAttachments `json:"media_attachments,omitempty"` + + // polls + Polls *InstanceConfigurationPolls `json:"polls,omitempty"` + + // statuses + Statuses *InstanceConfigurationStatuses `json:"statuses,omitempty"` +} + +// Validate validates this instance v1 configuration +func (m *InstanceV1Configuration) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccounts(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEmojis(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMediaAttachments(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePolls(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatuses(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV1Configuration) validateAccounts(formats strfmt.Registry) error { + if swag.IsZero(m.Accounts) { // not required + return nil + } + + if m.Accounts != nil { + if err := m.Accounts.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("accounts") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("accounts") + } + return err + } + } + + return nil +} + +func (m *InstanceV1Configuration) validateEmojis(formats strfmt.Registry) error { + if swag.IsZero(m.Emojis) { // not required + return nil + } + + if m.Emojis != nil { + if err := m.Emojis.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis") + } + return err + } + } + + return nil +} + +func (m *InstanceV1Configuration) validateMediaAttachments(formats strfmt.Registry) error { + if swag.IsZero(m.MediaAttachments) { // not required + return nil + } + + if m.MediaAttachments != nil { + if err := m.MediaAttachments.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("media_attachments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("media_attachments") + } + return err + } + } + + return nil +} + +func (m *InstanceV1Configuration) validatePolls(formats strfmt.Registry) error { + if swag.IsZero(m.Polls) { // not required + return nil + } + + if m.Polls != nil { + if err := m.Polls.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("polls") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("polls") + } + return err + } + } + + return nil +} + +func (m *InstanceV1Configuration) validateStatuses(formats strfmt.Registry) error { + if swag.IsZero(m.Statuses) { // not required + return nil + } + + if m.Statuses != nil { + if err := m.Statuses.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("statuses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("statuses") + } + return err + } + } + + return nil +} + +// ContextValidate validate this instance v1 configuration based on the context it is used +func (m *InstanceV1Configuration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccounts(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateEmojis(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMediaAttachments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePolls(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatuses(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV1Configuration) contextValidateAccounts(ctx context.Context, formats strfmt.Registry) error { + + if m.Accounts != nil { + + if swag.IsZero(m.Accounts) { // not required + return nil + } + + if err := m.Accounts.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("accounts") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("accounts") + } + return err + } + } + + return nil +} + +func (m *InstanceV1Configuration) contextValidateEmojis(ctx context.Context, formats strfmt.Registry) error { + + if m.Emojis != nil { + + if swag.IsZero(m.Emojis) { // not required + return nil + } + + if err := m.Emojis.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis") + } + return err + } + } + + return nil +} + +func (m *InstanceV1Configuration) contextValidateMediaAttachments(ctx context.Context, formats strfmt.Registry) error { + + if m.MediaAttachments != nil { + + if swag.IsZero(m.MediaAttachments) { // not required + return nil + } + + if err := m.MediaAttachments.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("media_attachments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("media_attachments") + } + return err + } + } + + return nil +} + +func (m *InstanceV1Configuration) contextValidatePolls(ctx context.Context, formats strfmt.Registry) error { + + if m.Polls != nil { + + if swag.IsZero(m.Polls) { // not required + return nil + } + + if err := m.Polls.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("polls") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("polls") + } + return err + } + } + + return nil +} + +func (m *InstanceV1Configuration) contextValidateStatuses(ctx context.Context, formats strfmt.Registry) error { + + if m.Statuses != nil { + + if swag.IsZero(m.Statuses) { // not required + return nil + } + + if err := m.Statuses.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("statuses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("statuses") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV1Configuration) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV1Configuration) UnmarshalBinary(b []byte) error { + var res InstanceV1Configuration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v1_u_r_ls.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v1_u_r_ls.go new file mode 100644 index 0000000..6917194 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v1_u_r_ls.go @@ -0,0 +1,51 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV1URLs InstanceV1URLs models instance-relevant URLs for client application consumption. +// +// swagger:model InstanceV1URLs +type InstanceV1URLs struct { + + // Websockets address for status and notification streaming. + // Example: wss://example.org + StreamingAPI string `json:"streaming_api,omitempty"` +} + +// Validate validates this instance v1 u r ls +func (m *InstanceV1URLs) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance v1 u r ls based on context it is used +func (m *InstanceV1URLs) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV1URLs) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV1URLs) UnmarshalBinary(b []byte) error { + var res InstanceV1URLs + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2.go new file mode 100644 index 0000000..e56bcfe --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2.go @@ -0,0 +1,425 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV2 InstanceV2 models information about this instance. +// +// swagger:model InstanceV2 +type InstanceV2 struct { + + // The domain of accounts on this instance. + // This will not necessarily be the same as + // domain. + // Example: example.org + AccountDomain string `json:"account_domain,omitempty"` + + // Whether or not instance is running in DEBUG mode. Omitted if false. + Debug bool `json:"debug,omitempty"` + + // Description of the instance. + // + // Should be HTML formatted, but might be plaintext. + // + // This should be displayed on the 'about' page for an instance. + Description string `json:"description,omitempty"` + + // Raw (unparsed) version of description. + DescriptionText string `json:"description_text,omitempty"` + + // The domain of the instance. + // Example: gts.example.org + Domain string `json:"domain,omitempty"` + + // Primary languages of the instance + moderators/admins. + // Example: ["en"] + Languages []string `json:"languages"` + + // An itemized list of rules for this instance. + Rules []*InstanceRule `json:"rules"` + + // The URL for the source code of the software running on this instance, in keeping with AGPL license requirements. + // Example: https://github.com/superseriousbusiness/gotosocial + SourceURL string `json:"source_url,omitempty"` + + // Terms and conditions for accounts on this instance. + Terms string `json:"terms,omitempty"` + + // Raw (unparsed) version of terms. + TermsText string `json:"terms_text,omitempty"` + + // The title of the instance. + // Example: GoToSocial Example Instance + Title string `json:"title,omitempty"` + + // The version of GoToSocial installed on the instance. + // + // This will contain at least a semantic version number. + // + // It may also contain, after a space, the short git commit ID of the running software. + // Example: 0.1.1 cb85f65 + Version string `json:"version,omitempty"` + + // configuration + Configuration *InstanceV2Configuration `json:"configuration,omitempty"` + + // contact + Contact *InstanceV2Contact `json:"contact,omitempty"` + + // registrations + Registrations *InstanceV2Registrations `json:"registrations,omitempty"` + + // thumbnail + Thumbnail *InstanceV2Thumbnail `json:"thumbnail,omitempty"` + + // usage + Usage *InstanceV2Usage `json:"usage,omitempty"` +} + +// Validate validates this instance v2 +func (m *InstanceV2) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRules(formats); err != nil { + res = append(res, err) + } + + if err := m.validateConfiguration(formats); err != nil { + res = append(res, err) + } + + if err := m.validateContact(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRegistrations(formats); err != nil { + res = append(res, err) + } + + if err := m.validateThumbnail(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUsage(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV2) validateRules(formats strfmt.Registry) error { + if swag.IsZero(m.Rules) { // not required + return nil + } + + for i := 0; i < len(m.Rules); i++ { + if swag.IsZero(m.Rules[i]) { // not required + continue + } + + if m.Rules[i] != nil { + if err := m.Rules[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *InstanceV2) validateConfiguration(formats strfmt.Registry) error { + if swag.IsZero(m.Configuration) { // not required + return nil + } + + if m.Configuration != nil { + if err := m.Configuration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("configuration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("configuration") + } + return err + } + } + + return nil +} + +func (m *InstanceV2) validateContact(formats strfmt.Registry) error { + if swag.IsZero(m.Contact) { // not required + return nil + } + + if m.Contact != nil { + if err := m.Contact.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("contact") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("contact") + } + return err + } + } + + return nil +} + +func (m *InstanceV2) validateRegistrations(formats strfmt.Registry) error { + if swag.IsZero(m.Registrations) { // not required + return nil + } + + if m.Registrations != nil { + if err := m.Registrations.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("registrations") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("registrations") + } + return err + } + } + + return nil +} + +func (m *InstanceV2) validateThumbnail(formats strfmt.Registry) error { + if swag.IsZero(m.Thumbnail) { // not required + return nil + } + + if m.Thumbnail != nil { + if err := m.Thumbnail.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("thumbnail") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("thumbnail") + } + return err + } + } + + return nil +} + +func (m *InstanceV2) validateUsage(formats strfmt.Registry) error { + if swag.IsZero(m.Usage) { // not required + return nil + } + + if m.Usage != nil { + if err := m.Usage.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("usage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("usage") + } + return err + } + } + + return nil +} + +// ContextValidate validate this instance v2 based on the context it is used +func (m *InstanceV2) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRules(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateConfiguration(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateContact(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRegistrations(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateThumbnail(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUsage(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV2) contextValidateRules(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Rules); i++ { + + if m.Rules[i] != nil { + + if swag.IsZero(m.Rules[i]) { // not required + return nil + } + + if err := m.Rules[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *InstanceV2) contextValidateConfiguration(ctx context.Context, formats strfmt.Registry) error { + + if m.Configuration != nil { + + if swag.IsZero(m.Configuration) { // not required + return nil + } + + if err := m.Configuration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("configuration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("configuration") + } + return err + } + } + + return nil +} + +func (m *InstanceV2) contextValidateContact(ctx context.Context, formats strfmt.Registry) error { + + if m.Contact != nil { + + if swag.IsZero(m.Contact) { // not required + return nil + } + + if err := m.Contact.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("contact") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("contact") + } + return err + } + } + + return nil +} + +func (m *InstanceV2) contextValidateRegistrations(ctx context.Context, formats strfmt.Registry) error { + + if m.Registrations != nil { + + if swag.IsZero(m.Registrations) { // not required + return nil + } + + if err := m.Registrations.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("registrations") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("registrations") + } + return err + } + } + + return nil +} + +func (m *InstanceV2) contextValidateThumbnail(ctx context.Context, formats strfmt.Registry) error { + + if m.Thumbnail != nil { + + if swag.IsZero(m.Thumbnail) { // not required + return nil + } + + if err := m.Thumbnail.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("thumbnail") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("thumbnail") + } + return err + } + } + + return nil +} + +func (m *InstanceV2) contextValidateUsage(ctx context.Context, formats strfmt.Registry) error { + + if m.Usage != nil { + + if swag.IsZero(m.Usage) { // not required + return nil + } + + if err := m.Usage.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("usage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("usage") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV2) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV2) UnmarshalBinary(b []byte) error { + var res InstanceV2 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_configuration.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_configuration.go new file mode 100644 index 0000000..9e05189 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_configuration.go @@ -0,0 +1,418 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV2Configuration Configured values and limits for this instance. +// +// swagger:model InstanceV2Configuration +type InstanceV2Configuration struct { + + // True if instance is running with OIDC as auth/identity backend, else omitted. + OIDCEnabled bool `json:"oidc_enabled,omitempty"` + + // accounts + Accounts *InstanceConfigurationAccounts `json:"accounts,omitempty"` + + // emojis + Emojis *InstanceConfigurationEmojis `json:"emojis,omitempty"` + + // media attachments + MediaAttachments *InstanceConfigurationMediaAttachments `json:"media_attachments,omitempty"` + + // polls + Polls *InstanceConfigurationPolls `json:"polls,omitempty"` + + // statuses + Statuses *InstanceConfigurationStatuses `json:"statuses,omitempty"` + + // translation + Translation *InstanceV2ConfigurationTranslation `json:"translation,omitempty"` + + // urls + Urls *InstanceV2URLs `json:"urls,omitempty"` +} + +// Validate validates this instance v2 configuration +func (m *InstanceV2Configuration) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccounts(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEmojis(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMediaAttachments(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePolls(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatuses(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTranslation(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUrls(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV2Configuration) validateAccounts(formats strfmt.Registry) error { + if swag.IsZero(m.Accounts) { // not required + return nil + } + + if m.Accounts != nil { + if err := m.Accounts.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("accounts") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("accounts") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) validateEmojis(formats strfmt.Registry) error { + if swag.IsZero(m.Emojis) { // not required + return nil + } + + if m.Emojis != nil { + if err := m.Emojis.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) validateMediaAttachments(formats strfmt.Registry) error { + if swag.IsZero(m.MediaAttachments) { // not required + return nil + } + + if m.MediaAttachments != nil { + if err := m.MediaAttachments.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("media_attachments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("media_attachments") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) validatePolls(formats strfmt.Registry) error { + if swag.IsZero(m.Polls) { // not required + return nil + } + + if m.Polls != nil { + if err := m.Polls.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("polls") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("polls") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) validateStatuses(formats strfmt.Registry) error { + if swag.IsZero(m.Statuses) { // not required + return nil + } + + if m.Statuses != nil { + if err := m.Statuses.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("statuses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("statuses") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) validateTranslation(formats strfmt.Registry) error { + if swag.IsZero(m.Translation) { // not required + return nil + } + + if m.Translation != nil { + if err := m.Translation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("translation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("translation") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) validateUrls(formats strfmt.Registry) error { + if swag.IsZero(m.Urls) { // not required + return nil + } + + if m.Urls != nil { + if err := m.Urls.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("urls") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("urls") + } + return err + } + } + + return nil +} + +// ContextValidate validate this instance v2 configuration based on the context it is used +func (m *InstanceV2Configuration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccounts(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateEmojis(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMediaAttachments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePolls(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatuses(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTranslation(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUrls(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV2Configuration) contextValidateAccounts(ctx context.Context, formats strfmt.Registry) error { + + if m.Accounts != nil { + + if swag.IsZero(m.Accounts) { // not required + return nil + } + + if err := m.Accounts.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("accounts") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("accounts") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) contextValidateEmojis(ctx context.Context, formats strfmt.Registry) error { + + if m.Emojis != nil { + + if swag.IsZero(m.Emojis) { // not required + return nil + } + + if err := m.Emojis.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) contextValidateMediaAttachments(ctx context.Context, formats strfmt.Registry) error { + + if m.MediaAttachments != nil { + + if swag.IsZero(m.MediaAttachments) { // not required + return nil + } + + if err := m.MediaAttachments.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("media_attachments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("media_attachments") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) contextValidatePolls(ctx context.Context, formats strfmt.Registry) error { + + if m.Polls != nil { + + if swag.IsZero(m.Polls) { // not required + return nil + } + + if err := m.Polls.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("polls") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("polls") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) contextValidateStatuses(ctx context.Context, formats strfmt.Registry) error { + + if m.Statuses != nil { + + if swag.IsZero(m.Statuses) { // not required + return nil + } + + if err := m.Statuses.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("statuses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("statuses") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) contextValidateTranslation(ctx context.Context, formats strfmt.Registry) error { + + if m.Translation != nil { + + if swag.IsZero(m.Translation) { // not required + return nil + } + + if err := m.Translation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("translation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("translation") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) contextValidateUrls(ctx context.Context, formats strfmt.Registry) error { + + if m.Urls != nil { + + if swag.IsZero(m.Urls) { // not required + return nil + } + + if err := m.Urls.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("urls") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("urls") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV2Configuration) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV2Configuration) UnmarshalBinary(b []byte) error { + var res InstanceV2Configuration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_configuration_translation.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_configuration_translation.go new file mode 100644 index 0000000..5cefd7b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_configuration_translation.go @@ -0,0 +1,51 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV2ConfigurationTranslation Hints related to translation. +// +// swagger:model InstanceV2ConfigurationTranslation +type InstanceV2ConfigurationTranslation struct { + + // Whether the Translations API is available on this instance. + // Not implemented so this value is always false. + Enabled bool `json:"enabled,omitempty"` +} + +// Validate validates this instance v2 configuration translation +func (m *InstanceV2ConfigurationTranslation) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance v2 configuration translation based on context it is used +func (m *InstanceV2ConfigurationTranslation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV2ConfigurationTranslation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV2ConfigurationTranslation) UnmarshalBinary(b []byte) error { + var res InstanceV2ConfigurationTranslation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_contact.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_contact.go new file mode 100644 index 0000000..ae8316c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_contact.go @@ -0,0 +1,114 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV2Contact Hints related to contacting a representative of the instance. +// +// swagger:model InstanceV2Contact +type InstanceV2Contact struct { + + // An email address that can be messaged regarding inquiries or issues. + // Empty string if no email address set. + // Example: someone@example.org + Email string `json:"email,omitempty"` + + // account + Account *Account `json:"account,omitempty"` +} + +// Validate validates this instance v2 contact +func (m *InstanceV2Contact) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccount(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV2Contact) validateAccount(formats strfmt.Registry) error { + if swag.IsZero(m.Account) { // not required + return nil + } + + if m.Account != nil { + if err := m.Account.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +// ContextValidate validate this instance v2 contact based on the context it is used +func (m *InstanceV2Contact) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV2Contact) contextValidateAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.Account != nil { + + if swag.IsZero(m.Account) { // not required + return nil + } + + if err := m.Account.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV2Contact) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV2Contact) UnmarshalBinary(b []byte) error { + var res InstanceV2Contact + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_registrations.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_registrations.go new file mode 100644 index 0000000..8694cf8 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_registrations.go @@ -0,0 +1,60 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV2Registrations Information about registering for this instance. +// +// swagger:model InstanceV2Registrations +type InstanceV2Registrations struct { + + // Whether registrations require moderator approval. + // Example: true + ApprovalRequired bool `json:"approval_required,omitempty"` + + // Whether registrations are enabled. + // Example: false + Enabled bool `json:"enabled,omitempty"` + + // A custom message (html string) to be shown when registrations are closed. + // Value will be null if no message is set. + // Example: \u003cp\u003eRegistrations are currently closed on example.org because of spam bots!\u003c/p\u003e + Message string `json:"message,omitempty"` +} + +// Validate validates this instance v2 registrations +func (m *InstanceV2Registrations) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance v2 registrations based on context it is used +func (m *InstanceV2Registrations) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV2Registrations) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV2Registrations) UnmarshalBinary(b []byte) error { + var res InstanceV2Registrations + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_thumbnail.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_thumbnail.go new file mode 100644 index 0000000..9b25964 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_thumbnail.go @@ -0,0 +1,137 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV2Thumbnail An image used to represent this instance. +// +// swagger:model InstanceV2Thumbnail +type InstanceV2Thumbnail struct { + + // A hash computed by the BlurHash algorithm, for generating colorful preview thumbnails when media has not been downloaded yet. + // Key/value not set if no blurhash available. + // Example: UeKUpFxuo~R%0nW;WCnhF6RjaJt757oJodS$ + Blurhash string `json:"blurhash,omitempty"` + + // Description of the instance thumbnail. + // Key/value not set if no description available. + // Example: picture of a cute lil' friendly sloth + Description string `json:"thumbnail_description,omitempty"` + + // MIME type of the instance thumbnail. + // Key/value not set if thumbnail image type unknown. + // Example: image/png + StaticType string `json:"thumbnail_static_type,omitempty"` + + // StaticURL version of the thumbnail image. + // Example: https://example.org/fileserver/01BPSX2MKCRVMD4YN4D71G9CP5/attachment/static/01H88X0KQ2DFYYDSWYP93VDJZA.webp + StaticURL string `json:"static_url,omitempty"` + + // MIME type of the instance thumbnail. + // Key/value not set if thumbnail image type unknown. + // Example: image/png + Type string `json:"thumbnail_type,omitempty"` + + // The URL for the thumbnail image. + // Example: https://example.org/fileserver/01BPSX2MKCRVMD4YN4D71G9CP5/attachment/original/01H88X0KQ2DFYYDSWYP93VDJZA.png + URL string `json:"url,omitempty"` + + // versions + Versions *InstanceV2ThumbnailVersions `json:"versions,omitempty"` +} + +// Validate validates this instance v2 thumbnail +func (m *InstanceV2Thumbnail) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVersions(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV2Thumbnail) validateVersions(formats strfmt.Registry) error { + if swag.IsZero(m.Versions) { // not required + return nil + } + + if m.Versions != nil { + if err := m.Versions.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("versions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("versions") + } + return err + } + } + + return nil +} + +// ContextValidate validate this instance v2 thumbnail based on the context it is used +func (m *InstanceV2Thumbnail) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVersions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV2Thumbnail) contextValidateVersions(ctx context.Context, formats strfmt.Registry) error { + + if m.Versions != nil { + + if swag.IsZero(m.Versions) { // not required + return nil + } + + if err := m.Versions.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("versions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("versions") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV2Thumbnail) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV2Thumbnail) UnmarshalBinary(b []byte) error { + var res InstanceV2Thumbnail + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_thumbnail_versions.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_thumbnail_versions.go new file mode 100644 index 0000000..81b1e69 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_thumbnail_versions.go @@ -0,0 +1,55 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV2ThumbnailVersions Links to scaled resolution images, for high DPI screens. +// +// swagger:model InstanceV2ThumbnailVersions +type InstanceV2ThumbnailVersions struct { + + // The URL for the thumbnail image at 1x resolution. + // Key/value not set if scaled versions not available. + Size1URL string `json:"@1x,omitempty"` + + // The URL for the thumbnail image at 2x resolution. + // Key/value not set if scaled versions not available. + Size2URL string `json:"@2x,omitempty"` +} + +// Validate validates this instance v2 thumbnail versions +func (m *InstanceV2ThumbnailVersions) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance v2 thumbnail versions based on context it is used +func (m *InstanceV2ThumbnailVersions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV2ThumbnailVersions) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV2ThumbnailVersions) UnmarshalBinary(b []byte) error { + var res InstanceV2ThumbnailVersions + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_u_r_ls.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_u_r_ls.go new file mode 100644 index 0000000..69ecc41 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_u_r_ls.go @@ -0,0 +1,51 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV2URLs InstanceV2URLs models instance-relevant URLs for client application consumption. +// +// swagger:model InstanceV2URLs +type InstanceV2URLs struct { + + // Websockets address for status and notification streaming. + // Example: wss://example.org + Streaming string `json:"streaming,omitempty"` +} + +// Validate validates this instance v2 u r ls +func (m *InstanceV2URLs) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance v2 u r ls based on context it is used +func (m *InstanceV2URLs) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV2URLs) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV2URLs) UnmarshalBinary(b []byte) error { + var res InstanceV2URLs + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_usage.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_usage.go new file mode 100644 index 0000000..767744e --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_usage.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV2Usage Usage data for this instance. +// +// swagger:model InstanceV2Usage +type InstanceV2Usage struct { + + // users + Users *InstanceV2Users `json:"users,omitempty"` +} + +// Validate validates this instance v2 usage +func (m *InstanceV2Usage) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateUsers(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV2Usage) validateUsers(formats strfmt.Registry) error { + if swag.IsZero(m.Users) { // not required + return nil + } + + if m.Users != nil { + if err := m.Users.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("users") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("users") + } + return err + } + } + + return nil +} + +// ContextValidate validate this instance v2 usage based on the context it is used +func (m *InstanceV2Usage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUsers(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV2Usage) contextValidateUsers(ctx context.Context, formats strfmt.Registry) error { + + if m.Users != nil { + + if swag.IsZero(m.Users) { // not required + return nil + } + + if err := m.Users.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("users") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("users") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV2Usage) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV2Usage) UnmarshalBinary(b []byte) error { + var res InstanceV2Usage + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_users.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_users.go new file mode 100644 index 0000000..c7fddd6 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/instance_v2_users.go @@ -0,0 +1,52 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV2Users Usage data related to users on this instance. +// +// swagger:model InstanceV2Users +type InstanceV2Users struct { + + // The number of active users in the past 4 weeks. + // Currently not implemented: will always be 0. + // Example: 0 + ActiveMonth int64 `json:"active_month,omitempty"` +} + +// Validate validates this instance v2 users +func (m *InstanceV2Users) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance v2 users based on context it is used +func (m *InstanceV2Users) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV2Users) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV2Users) UnmarshalBinary(b []byte) error { + var res InstanceV2Users + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/interaction_policy.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/interaction_policy.go new file mode 100644 index 0000000..a9f971b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/interaction_policy.go @@ -0,0 +1,211 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InteractionPolicy Interaction policy of a status. +// +// swagger:model InteractionPolicy +type InteractionPolicy struct { + + // can favourite + CanFavourite *PolicyRules `json:"can_favourite,omitempty"` + + // can reblog + CanReblog *PolicyRules `json:"can_reblog,omitempty"` + + // can reply + CanReply *PolicyRules `json:"can_reply,omitempty"` +} + +// Validate validates this interaction policy +func (m *InteractionPolicy) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCanFavourite(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCanReblog(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCanReply(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InteractionPolicy) validateCanFavourite(formats strfmt.Registry) error { + if swag.IsZero(m.CanFavourite) { // not required + return nil + } + + if m.CanFavourite != nil { + if err := m.CanFavourite.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("can_favourite") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("can_favourite") + } + return err + } + } + + return nil +} + +func (m *InteractionPolicy) validateCanReblog(formats strfmt.Registry) error { + if swag.IsZero(m.CanReblog) { // not required + return nil + } + + if m.CanReblog != nil { + if err := m.CanReblog.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("can_reblog") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("can_reblog") + } + return err + } + } + + return nil +} + +func (m *InteractionPolicy) validateCanReply(formats strfmt.Registry) error { + if swag.IsZero(m.CanReply) { // not required + return nil + } + + if m.CanReply != nil { + if err := m.CanReply.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("can_reply") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("can_reply") + } + return err + } + } + + return nil +} + +// ContextValidate validate this interaction policy based on the context it is used +func (m *InteractionPolicy) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCanFavourite(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCanReblog(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCanReply(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InteractionPolicy) contextValidateCanFavourite(ctx context.Context, formats strfmt.Registry) error { + + if m.CanFavourite != nil { + + if swag.IsZero(m.CanFavourite) { // not required + return nil + } + + if err := m.CanFavourite.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("can_favourite") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("can_favourite") + } + return err + } + } + + return nil +} + +func (m *InteractionPolicy) contextValidateCanReblog(ctx context.Context, formats strfmt.Registry) error { + + if m.CanReblog != nil { + + if swag.IsZero(m.CanReblog) { // not required + return nil + } + + if err := m.CanReblog.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("can_reblog") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("can_reblog") + } + return err + } + } + + return nil +} + +func (m *InteractionPolicy) contextValidateCanReply(ctx context.Context, formats strfmt.Registry) error { + + if m.CanReply != nil { + + if swag.IsZero(m.CanReply) { // not required + return nil + } + + if err := m.CanReply.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("can_reply") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("can_reply") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InteractionPolicy) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InteractionPolicy) UnmarshalBinary(b []byte) error { + var res InteractionPolicy + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/link.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/link.go new file mode 100644 index 0000000..307ba7d --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/link.go @@ -0,0 +1,61 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Link Link represents one 'link' in a slice of links returned from a lookup request. +// +// See https://webfinger.net/ and https://www.rfc-editor.org/rfc/rfc6415.html#section-3.1 +// +// swagger:model Link +type Link struct { + + // href + Href string `json:"href,omitempty"` + + // rel + Rel string `json:"rel,omitempty"` + + // template + Template string `json:"template,omitempty"` + + // type + Type string `json:"type,omitempty"` +} + +// Validate validates this link +func (m *Link) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this link based on context it is used +func (m *Link) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Link) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Link) UnmarshalBinary(b []byte) error { + var res Link + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/list.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/list.go new file mode 100644 index 0000000..205b8b1 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/list.go @@ -0,0 +1,59 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// List List represents a user-created list of accounts that the user follows. +// +// swagger:model List +type List struct { + + // The ID of the list. + ID string `json:"id,omitempty"` + + // RepliesPolicy for this list. + // followed = Show replies to any followed user + // list = Show replies to members of the list + // none = Show replies to no one + RepliesPolicy string `json:"replies_policy,omitempty"` + + // The user-defined title of the list. + Title string `json:"title,omitempty"` +} + +// Validate validates this list +func (m *List) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this list based on context it is used +func (m *List) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *List) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *List) UnmarshalBinary(b []byte) error { + var res List + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/marker.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/marker.go new file mode 100644 index 0000000..26dc075 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/marker.go @@ -0,0 +1,160 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Marker Marker represents the last read position within a user's timelines. +// +// swagger:model Marker +type Marker struct { + + // home + Home *TimelineMarker `json:"home,omitempty"` + + // notifications + Notifications *TimelineMarker `json:"notifications,omitempty"` +} + +// Validate validates this marker +func (m *Marker) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHome(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNotifications(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Marker) validateHome(formats strfmt.Registry) error { + if swag.IsZero(m.Home) { // not required + return nil + } + + if m.Home != nil { + if err := m.Home.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("home") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("home") + } + return err + } + } + + return nil +} + +func (m *Marker) validateNotifications(formats strfmt.Registry) error { + if swag.IsZero(m.Notifications) { // not required + return nil + } + + if m.Notifications != nil { + if err := m.Notifications.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("notifications") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("notifications") + } + return err + } + } + + return nil +} + +// ContextValidate validate this marker based on the context it is used +func (m *Marker) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateHome(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateNotifications(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Marker) contextValidateHome(ctx context.Context, formats strfmt.Registry) error { + + if m.Home != nil { + + if swag.IsZero(m.Home) { // not required + return nil + } + + if err := m.Home.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("home") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("home") + } + return err + } + } + + return nil +} + +func (m *Marker) contextValidateNotifications(ctx context.Context, formats strfmt.Registry) error { + + if m.Notifications != nil { + + if swag.IsZero(m.Notifications) { // not required + return nil + } + + if err := m.Notifications.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("notifications") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("notifications") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Marker) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Marker) UnmarshalBinary(b []byte) error { + var res Marker + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/media_dimensions.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/media_dimensions.go new file mode 100644 index 0000000..d5c9354 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/media_dimensions.go @@ -0,0 +1,81 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// MediaDimensions MediaDimensions models detailed properties of a piece of media. +// +// swagger:model MediaDimensions +type MediaDimensions struct { + + // Aspect ratio of the media. + // Equal to width / height. + // Example: 1.777777778 + Aspect float32 `json:"aspect,omitempty"` + + // Bitrate of the media in bits per second. + // Example: 1000000 + Bitrate int64 `json:"bitrate,omitempty"` + + // Duration of the media in seconds. + // Only set for video and audio. + // Example: 5.43 + Duration float32 `json:"duration,omitempty"` + + // Framerate of the media. + // Only set for video and gifs. + // Example: 30 + FrameRate string `json:"frame_rate,omitempty"` + + // Height of the media in pixels. + // Not set for audio. + // Example: 1080 + Height int64 `json:"height,omitempty"` + + // Size of the media, in the format `[width]x[height]`. + // Not set for audio. + // Example: 1920x1080 + Size string `json:"size,omitempty"` + + // Width of the media in pixels. + // Not set for audio. + // Example: 1920 + Width int64 `json:"width,omitempty"` +} + +// Validate validates this media dimensions +func (m *MediaDimensions) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this media dimensions based on context it is used +func (m *MediaDimensions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *MediaDimensions) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MediaDimensions) UnmarshalBinary(b []byte) error { + var res MediaDimensions + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/media_focus.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/media_focus.go new file mode 100644 index 0000000..00b77ac --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/media_focus.go @@ -0,0 +1,55 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// MediaFocus MediaFocus models the focal point of a piece of media. +// +// swagger:model MediaFocus +type MediaFocus struct { + + // x position of the focus + // should be between -1 and 1 + X float32 `json:"x,omitempty"` + + // y position of the focus + // should be between -1 and 1 + Y float32 `json:"y,omitempty"` +} + +// Validate validates this media focus +func (m *MediaFocus) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this media focus based on context it is used +func (m *MediaFocus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *MediaFocus) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MediaFocus) UnmarshalBinary(b []byte) error { + var res MediaFocus + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/media_meta.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/media_meta.go new file mode 100644 index 0000000..15257e3 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/media_meta.go @@ -0,0 +1,213 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// MediaMeta MediaMeta models media metadata. +// +// This can be metadata about an image, an audio file, video, etc. +// +// swagger:model MediaMeta +type MediaMeta struct { + + // focus + Focus *MediaFocus `json:"focus,omitempty"` + + // original + Original *MediaDimensions `json:"original,omitempty"` + + // small + Small *MediaDimensions `json:"small,omitempty"` +} + +// Validate validates this media meta +func (m *MediaMeta) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateFocus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOriginal(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSmall(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MediaMeta) validateFocus(formats strfmt.Registry) error { + if swag.IsZero(m.Focus) { // not required + return nil + } + + if m.Focus != nil { + if err := m.Focus.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("focus") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("focus") + } + return err + } + } + + return nil +} + +func (m *MediaMeta) validateOriginal(formats strfmt.Registry) error { + if swag.IsZero(m.Original) { // not required + return nil + } + + if m.Original != nil { + if err := m.Original.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("original") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("original") + } + return err + } + } + + return nil +} + +func (m *MediaMeta) validateSmall(formats strfmt.Registry) error { + if swag.IsZero(m.Small) { // not required + return nil + } + + if m.Small != nil { + if err := m.Small.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("small") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("small") + } + return err + } + } + + return nil +} + +// ContextValidate validate this media meta based on the context it is used +func (m *MediaMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFocus(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOriginal(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSmall(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MediaMeta) contextValidateFocus(ctx context.Context, formats strfmt.Registry) error { + + if m.Focus != nil { + + if swag.IsZero(m.Focus) { // not required + return nil + } + + if err := m.Focus.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("focus") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("focus") + } + return err + } + } + + return nil +} + +func (m *MediaMeta) contextValidateOriginal(ctx context.Context, formats strfmt.Registry) error { + + if m.Original != nil { + + if swag.IsZero(m.Original) { // not required + return nil + } + + if err := m.Original.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("original") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("original") + } + return err + } + } + + return nil +} + +func (m *MediaMeta) contextValidateSmall(ctx context.Context, formats strfmt.Registry) error { + + if m.Small != nil { + + if swag.IsZero(m.Small) { // not required + return nil + } + + if err := m.Small.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("small") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("small") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *MediaMeta) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MediaMeta) UnmarshalBinary(b []byte) error { + var res MediaMeta + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/mention.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/mention.go new file mode 100644 index 0000000..d1ea81a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/mention.go @@ -0,0 +1,64 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Mention Mention represents a mention of another account. +// +// swagger:model Mention +type Mention struct { + + // The account URI as discovered via webfinger. + // Equal to username for local users, or username@domain for remote users. + // Example: some_user@example.org + Acct string `json:"acct,omitempty"` + + // The ID of the mentioned account. + // Example: 01FBYJHQWQZAVWFRK9PDYTKGMB + ID string `json:"id,omitempty"` + + // The web URL of the mentioned account's profile. + // Example: https://example.org/@some_user + URL string `json:"url,omitempty"` + + // The username of the mentioned account. + // Example: some_user + Username string `json:"username,omitempty"` +} + +// Validate validates this mention +func (m *Mention) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this mention based on context it is used +func (m *Mention) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Mention) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Mention) UnmarshalBinary(b []byte) error { + var res Mention + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/muted_account.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/muted_account.go new file mode 100644 index 0000000..71ae0d2 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/muted_account.go @@ -0,0 +1,436 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// MutedAccount MutedAccount extends Account with a field used only by the muted user list. +// +// swagger:model MutedAccount +type MutedAccount struct { + + // The account URI as discovered via webfinger. + // Equal to username for local users, or username@domain for remote users. + // Example: some_user@example.org + Acct string `json:"acct,omitempty"` + + // Web location of the account's avatar. + // Example: https://example.org/media/some_user/avatar/original/avatar.jpeg + Avatar string `json:"avatar,omitempty"` + + // Description of this account's avatar, for alt text. + // Example: A cute drawing of a smiling sloth. + AvatarDescription string `json:"avatar_description,omitempty"` + + // Web location of a static version of the account's avatar. + // Only relevant when the account's main avatar is a video or a gif. + // Example: https://example.org/media/some_user/avatar/static/avatar.png + AvatarStatic string `json:"avatar_static,omitempty"` + + // Account identifies as a bot. + Bot bool `json:"bot,omitempty"` + + // When the account was created (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + CreatedAt string `json:"created_at,omitempty"` + + // CustomCSS to include when rendering this account's profile or statuses. + CustomCSS string `json:"custom_css,omitempty"` + + // Account has opted into discovery features. + Discoverable bool `json:"discoverable,omitempty"` + + // The account's display name. + // Example: big jeff (he/him) + DisplayName string `json:"display_name,omitempty"` + + // Array of custom emojis used in this account's note or display name. + // Empty for blocked accounts. + Emojis []*Emoji `json:"emojis"` + + // Account has enabled RSS feed. + // Key/value omitted if false. + EnableRSS bool `json:"enable_rss,omitempty"` + + // Additional metadata attached to this account's profile. + // Empty for blocked accounts. + Fields []*Field `json:"fields"` + + // Number of accounts following this account, according to our instance. + FollowersCount int64 `json:"followers_count,omitempty"` + + // Number of account's followed by this account, according to our instance. + FollowingCount int64 `json:"following_count,omitempty"` + + // Web location of the account's header image. + // Example: https://example.org/media/some_user/header/original/header.jpeg + Header string `json:"header,omitempty"` + + // Description of this account's header, for alt text. + // Example: A sunlit field with purple flowers. + HeaderDescription string `json:"header_description,omitempty"` + + // Web location of a static version of the account's header. + // Only relevant when the account's main header is a video or a gif. + // Example: https://example.org/media/some_user/header/static/header.png + HeaderStatic string `json:"header_static,omitempty"` + + // Account has opted to hide their followers/following collections. + // Key/value omitted if false. + HideCollections bool `json:"hide_collections,omitempty"` + + // The account id. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + ID string `json:"id,omitempty"` + + // When the account's most recent status was posted (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + LastStatusAt string `json:"last_status_at,omitempty"` + + // Account manually approves follow requests. + Locked bool `json:"locked,omitempty"` + + // If this account has been muted, when will the mute expire (ISO 8601 Datetime). + // If the mute is indefinite, this will be null. + // Example: 2021-07-30T09:20:25+00:00 + MuteExpiresAt string `json:"mute_expires_at,omitempty"` + + // Bio/description of this account. + Note string `json:"note,omitempty"` + + // Number of statuses posted by this account, according to our instance. + StatusesCount int64 `json:"statuses_count,omitempty"` + + // Account has been suspended by our instance. + Suspended bool `json:"suspended,omitempty"` + + // Filename of user-selected CSS theme to include when rendering this account's profile or statuses. Eg., `blurple-light.css`. + Theme string `json:"theme,omitempty"` + + // Web location of the account's profile page. + // Example: https://example.org/@some_user + URL string `json:"url,omitempty"` + + // The username of the account, not including domain. + // Example: some_user + Username string `json:"username,omitempty"` + + // moved + Moved *Account `json:"moved,omitempty"` + + // role + Role *AccountRole `json:"role,omitempty"` + + // source + Source *Source `json:"source,omitempty"` +} + +// Validate validates this muted account +func (m *MutedAccount) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEmojis(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFields(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMoved(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRole(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSource(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MutedAccount) validateEmojis(formats strfmt.Registry) error { + if swag.IsZero(m.Emojis) { // not required + return nil + } + + for i := 0; i < len(m.Emojis); i++ { + if swag.IsZero(m.Emojis[i]) { // not required + continue + } + + if m.Emojis[i] != nil { + if err := m.Emojis[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *MutedAccount) validateFields(formats strfmt.Registry) error { + if swag.IsZero(m.Fields) { // not required + return nil + } + + for i := 0; i < len(m.Fields); i++ { + if swag.IsZero(m.Fields[i]) { // not required + continue + } + + if m.Fields[i] != nil { + if err := m.Fields[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("fields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *MutedAccount) validateMoved(formats strfmt.Registry) error { + if swag.IsZero(m.Moved) { // not required + return nil + } + + if m.Moved != nil { + if err := m.Moved.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("moved") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("moved") + } + return err + } + } + + return nil +} + +func (m *MutedAccount) validateRole(formats strfmt.Registry) error { + if swag.IsZero(m.Role) { // not required + return nil + } + + if m.Role != nil { + if err := m.Role.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +func (m *MutedAccount) validateSource(formats strfmt.Registry) error { + if swag.IsZero(m.Source) { // not required + return nil + } + + if m.Source != nil { + if err := m.Source.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +// ContextValidate validate this muted account based on the context it is used +func (m *MutedAccount) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEmojis(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFields(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMoved(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRole(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSource(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MutedAccount) contextValidateEmojis(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Emojis); i++ { + + if m.Emojis[i] != nil { + + if swag.IsZero(m.Emojis[i]) { // not required + return nil + } + + if err := m.Emojis[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *MutedAccount) contextValidateFields(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Fields); i++ { + + if m.Fields[i] != nil { + + if swag.IsZero(m.Fields[i]) { // not required + return nil + } + + if err := m.Fields[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("fields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *MutedAccount) contextValidateMoved(ctx context.Context, formats strfmt.Registry) error { + + if m.Moved != nil { + + if swag.IsZero(m.Moved) { // not required + return nil + } + + if err := m.Moved.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("moved") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("moved") + } + return err + } + } + + return nil +} + +func (m *MutedAccount) contextValidateRole(ctx context.Context, formats strfmt.Registry) error { + + if m.Role != nil { + + if swag.IsZero(m.Role) { // not required + return nil + } + + if err := m.Role.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +func (m *MutedAccount) contextValidateSource(ctx context.Context, formats strfmt.Registry) error { + + if m.Source != nil { + + if swag.IsZero(m.Source) { // not required + return nil + } + + if err := m.Source.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *MutedAccount) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MutedAccount) UnmarshalBinary(b []byte) error { + var res MutedAccount + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/node_info_services.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/node_info_services.go new file mode 100644 index 0000000..c3d85a2 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/node_info_services.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NodeInfoServices NodeInfoServices represents inbound and outbound services that this node offers connections to. +// +// swagger:model NodeInfoServices +type NodeInfoServices struct { + + // inbound + Inbound []string `json:"inbound"` + + // outbound + Outbound []string `json:"outbound"` +} + +// Validate validates this node info services +func (m *NodeInfoServices) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this node info services based on context it is used +func (m *NodeInfoServices) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NodeInfoServices) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NodeInfoServices) UnmarshalBinary(b []byte) error { + var res NodeInfoServices + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/node_info_software.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/node_info_software.go new file mode 100644 index 0000000..9413171 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/node_info_software.go @@ -0,0 +1,55 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NodeInfoSoftware NodeInfoSoftware represents the name and version number of the software of this node. +// +// swagger:model NodeInfoSoftware +type NodeInfoSoftware struct { + + // name + // Example: gotosocial + Name string `json:"name,omitempty"` + + // version + // Example: 0.1.2 1234567 + Version string `json:"version,omitempty"` +} + +// Validate validates this node info software +func (m *NodeInfoSoftware) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this node info software based on context it is used +func (m *NodeInfoSoftware) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NodeInfoSoftware) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NodeInfoSoftware) UnmarshalBinary(b []byte) error { + var res NodeInfoSoftware + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/node_info_usage.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/node_info_usage.go new file mode 100644 index 0000000..f29fd32 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/node_info_usage.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NodeInfoUsage NodeInfoUsage represents usage information about this server, such as number of users. +// +// swagger:model NodeInfoUsage +type NodeInfoUsage struct { + + // local posts + LocalPosts int64 `json:"localPosts,omitempty"` + + // users + Users *NodeInfoUsers `json:"users,omitempty"` +} + +// Validate validates this node info usage +func (m *NodeInfoUsage) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateUsers(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NodeInfoUsage) validateUsers(formats strfmt.Registry) error { + if swag.IsZero(m.Users) { // not required + return nil + } + + if m.Users != nil { + if err := m.Users.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("users") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("users") + } + return err + } + } + + return nil +} + +// ContextValidate validate this node info usage based on the context it is used +func (m *NodeInfoUsage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUsers(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NodeInfoUsage) contextValidateUsers(ctx context.Context, formats strfmt.Registry) error { + + if m.Users != nil { + + if swag.IsZero(m.Users) { // not required + return nil + } + + if err := m.Users.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("users") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("users") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NodeInfoUsage) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NodeInfoUsage) UnmarshalBinary(b []byte) error { + var res NodeInfoUsage + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/node_info_users.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/node_info_users.go new file mode 100644 index 0000000..c2f53e6 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/node_info_users.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NodeInfoUsers NodeInfoUsers represents aggregate information about the users on the server. +// +// swagger:model NodeInfoUsers +type NodeInfoUsers struct { + + // total + Total int64 `json:"total,omitempty"` +} + +// Validate validates this node info users +func (m *NodeInfoUsers) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this node info users based on context it is used +func (m *NodeInfoUsers) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NodeInfoUsers) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NodeInfoUsers) UnmarshalBinary(b []byte) error { + var res NodeInfoUsers + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/nodeinfo.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/nodeinfo.go new file mode 100644 index 0000000..ffaea38 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/nodeinfo.go @@ -0,0 +1,227 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Nodeinfo Nodeinfo represents a version 2.1 or version 2.0 nodeinfo schema. +// +// See: https://nodeinfo.diaspora.software/schema.html +// +// swagger:model Nodeinfo +type Nodeinfo struct { + + // Free form key value pairs for software specific values. Clients should not rely on any specific key present. + Metadata map[string]interface{} `json:"metadata,omitempty"` + + // Whether this server allows open self-registration. + // Example: false + OpenRegistrations bool `json:"openRegistrations,omitempty"` + + // The protocols supported on this server. + Protocols []string `json:"protocols"` + + // The schema version + // Example: 2.0 + Version string `json:"version,omitempty"` + + // services + Services *NodeInfoServices `json:"services,omitempty"` + + // software + Software *NodeInfoSoftware `json:"software,omitempty"` + + // usage + Usage *NodeInfoUsage `json:"usage,omitempty"` +} + +// Validate validates this nodeinfo +func (m *Nodeinfo) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateServices(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSoftware(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUsage(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Nodeinfo) validateServices(formats strfmt.Registry) error { + if swag.IsZero(m.Services) { // not required + return nil + } + + if m.Services != nil { + if err := m.Services.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("services") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("services") + } + return err + } + } + + return nil +} + +func (m *Nodeinfo) validateSoftware(formats strfmt.Registry) error { + if swag.IsZero(m.Software) { // not required + return nil + } + + if m.Software != nil { + if err := m.Software.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("software") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("software") + } + return err + } + } + + return nil +} + +func (m *Nodeinfo) validateUsage(formats strfmt.Registry) error { + if swag.IsZero(m.Usage) { // not required + return nil + } + + if m.Usage != nil { + if err := m.Usage.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("usage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("usage") + } + return err + } + } + + return nil +} + +// ContextValidate validate this nodeinfo based on the context it is used +func (m *Nodeinfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateServices(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSoftware(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUsage(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Nodeinfo) contextValidateServices(ctx context.Context, formats strfmt.Registry) error { + + if m.Services != nil { + + if swag.IsZero(m.Services) { // not required + return nil + } + + if err := m.Services.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("services") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("services") + } + return err + } + } + + return nil +} + +func (m *Nodeinfo) contextValidateSoftware(ctx context.Context, formats strfmt.Registry) error { + + if m.Software != nil { + + if swag.IsZero(m.Software) { // not required + return nil + } + + if err := m.Software.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("software") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("software") + } + return err + } + } + + return nil +} + +func (m *Nodeinfo) contextValidateUsage(ctx context.Context, formats strfmt.Registry) error { + + if m.Usage != nil { + + if swag.IsZero(m.Usage) { // not required + return nil + } + + if err := m.Usage.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("usage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("usage") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Nodeinfo) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Nodeinfo) UnmarshalBinary(b []byte) error { + var res Nodeinfo + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/notification.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/notification.go new file mode 100644 index 0000000..f3f94ea --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/notification.go @@ -0,0 +1,177 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Notification Notification represents a notification of an event relevant to the user. +// +// swagger:model Notification +type Notification struct { + + // The timestamp of the notification (ISO 8601 Datetime) + CreatedAt string `json:"created_at,omitempty"` + + // The id of the notification in the database. + ID string `json:"id,omitempty"` + + // The type of event that resulted in the notification. + // follow = Someone followed you. `account` will be set. + // follow_request = Someone requested to follow you. `account` will be set. + // mention = Someone mentioned you in their status. `status` will be set. `account` will be set. + // reblog = Someone boosted one of your statuses. `status` will be set. `account` will be set. + // favourite = Someone favourited one of your statuses. `status` will be set. `account` will be set. + // poll = A poll you have voted in or created has ended. `status` will be set. `account` will be set. + // status = Someone you enabled notifications for has posted a status. `status` will be set. `account` will be set. + // admin.sign_up = Someone has signed up for a new account on the instance. `account` will be set. + Type string `json:"type,omitempty"` + + // account + Account *Account `json:"account,omitempty"` + + // status + Status *Status `json:"status,omitempty"` +} + +// Validate validates this notification +func (m *Notification) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Notification) validateAccount(formats strfmt.Registry) error { + if swag.IsZero(m.Account) { // not required + return nil + } + + if m.Account != nil { + if err := m.Account.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *Notification) validateStatus(formats strfmt.Registry) error { + if swag.IsZero(m.Status) { // not required + return nil + } + + if m.Status != nil { + if err := m.Status.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + } + + return nil +} + +// ContextValidate validate this notification based on the context it is used +func (m *Notification) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Notification) contextValidateAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.Account != nil { + + if swag.IsZero(m.Account) { // not required + return nil + } + + if err := m.Account.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *Notification) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { + + if m.Status != nil { + + if swag.IsZero(m.Status) { // not required + return nil + } + + if err := m.Status.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Notification) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Notification) UnmarshalBinary(b []byte) error { + var res Notification + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/policy_rules.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/policy_rules.go new file mode 100644 index 0000000..4449b07 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/policy_rules.go @@ -0,0 +1,167 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PolicyRules Rules for one interaction type. +// +// swagger:model PolicyRules +type PolicyRules struct { + + // Policy entries for accounts that can always do this type of interaction. + Always []PolicyValue `json:"always"` + + // Policy entries for accounts that require approval to do this type of interaction. + WithApproval []PolicyValue `json:"with_approval"` +} + +// Validate validates this policy rules +func (m *PolicyRules) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAlways(formats); err != nil { + res = append(res, err) + } + + if err := m.validateWithApproval(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PolicyRules) validateAlways(formats strfmt.Registry) error { + if swag.IsZero(m.Always) { // not required + return nil + } + + for i := 0; i < len(m.Always); i++ { + + if err := m.Always[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("always" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("always" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +func (m *PolicyRules) validateWithApproval(formats strfmt.Registry) error { + if swag.IsZero(m.WithApproval) { // not required + return nil + } + + for i := 0; i < len(m.WithApproval); i++ { + + if err := m.WithApproval[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("with_approval" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("with_approval" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +// ContextValidate validate this policy rules based on the context it is used +func (m *PolicyRules) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAlways(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateWithApproval(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PolicyRules) contextValidateAlways(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Always); i++ { + + if swag.IsZero(m.Always[i]) { // not required + return nil + } + + if err := m.Always[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("always" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("always" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +func (m *PolicyRules) contextValidateWithApproval(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.WithApproval); i++ { + + if swag.IsZero(m.WithApproval[i]) { // not required + return nil + } + + if err := m.WithApproval[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("with_approval" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("with_approval" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PolicyRules) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PolicyRules) UnmarshalBinary(b []byte) error { + var res PolicyRules + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/policy_value.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/policy_value.go new file mode 100644 index 0000000..ee7aa6a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/policy_value.go @@ -0,0 +1,39 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" +) + +// PolicyValue One interaction policy entry for a status. +// +// It can be EITHER one of the internal keywords listed below, OR a full-fledged ActivityPub URI of an Actor, like "https://example.org/users/some_user". +// +// Internal keywords: +// +// public - Public, aka anyone who can see the status according to its visibility level. +// followers - Followers of the status author. +// following - People followed by the status author. +// mutuals - Mutual follows of the status author (reserved, unused). +// mentioned - Accounts mentioned in, or replied-to by, the status. +// author - The status author themself. +// me - If request was made with an authorized user, "me" represents the user who made the request and is now looking at this interaction policy. +// +// swagger:model PolicyValue +type PolicyValue string + +// Validate validates this policy value +func (m PolicyValue) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this policy value based on context it is used +func (m PolicyValue) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/poll.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/poll.go new file mode 100644 index 0000000..b18f84b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/poll.go @@ -0,0 +1,213 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Poll Poll represents a poll attached to a status. +// +// swagger:model Poll +type Poll struct { + + // Custom emoji to be used for rendering poll options. + Emojis []*Emoji `json:"emojis"` + + // Is the poll currently expired? + Expired bool `json:"expired,omitempty"` + + // When the poll ends. (ISO 8601 Datetime). + ExpiresAt string `json:"expires_at,omitempty"` + + // The ID of the poll in the database. + // Example: 01FBYKMD1KBMJ0W6JF1YZ3VY5D + ID string `json:"id,omitempty"` + + // Does the poll allow multiple-choice answers? + Multiple bool `json:"multiple,omitempty"` + + // Possible answers for the poll. + Options []*PollOption `json:"options"` + + // When called with a user token, which options has the authorized + // user chosen? Contains an array of index values for options. + // + // Omitted when no user token provided. + OwnVotes []int64 `json:"own_votes"` + + // When called with a user token, has the authorized user voted? + // + // Omitted when no user token provided. + Voted bool `json:"voted,omitempty"` + + // How many unique accounts have voted on a multiple-choice poll. + VotersCount int64 `json:"voters_count,omitempty"` + + // How many votes have been received. + VotesCount int64 `json:"votes_count,omitempty"` +} + +// Validate validates this poll +func (m *Poll) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEmojis(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOptions(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Poll) validateEmojis(formats strfmt.Registry) error { + if swag.IsZero(m.Emojis) { // not required + return nil + } + + for i := 0; i < len(m.Emojis); i++ { + if swag.IsZero(m.Emojis[i]) { // not required + continue + } + + if m.Emojis[i] != nil { + if err := m.Emojis[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Poll) validateOptions(formats strfmt.Registry) error { + if swag.IsZero(m.Options) { // not required + return nil + } + + for i := 0; i < len(m.Options); i++ { + if swag.IsZero(m.Options[i]) { // not required + continue + } + + if m.Options[i] != nil { + if err := m.Options[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("options" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("options" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this poll based on the context it is used +func (m *Poll) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEmojis(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOptions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Poll) contextValidateEmojis(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Emojis); i++ { + + if m.Emojis[i] != nil { + + if swag.IsZero(m.Emojis[i]) { // not required + return nil + } + + if err := m.Emojis[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Poll) contextValidateOptions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Options); i++ { + + if m.Options[i] != nil { + + if swag.IsZero(m.Options[i]) { // not required + return nil + } + + if err := m.Options[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("options" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("options" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Poll) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Poll) UnmarshalBinary(b []byte) error { + var res Poll + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/poll_option.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/poll_option.go new file mode 100644 index 0000000..711a969 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/poll_option.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PollOption PollOption represents the current vote counts for different poll options. +// +// swagger:model PollOption +type PollOption struct { + + // The text value of the poll option. String. + Title string `json:"title,omitempty"` + + // The number of received votes for this option. + VotesCount int64 `json:"votes_count,omitempty"` +} + +// Validate validates this poll option +func (m *PollOption) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this poll option based on context it is used +func (m *PollOption) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PollOption) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PollOption) UnmarshalBinary(b []byte) error { + var res PollOption + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/relationship.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/relationship.go new file mode 100644 index 0000000..775bbe8 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/relationship.go @@ -0,0 +1,90 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Relationship Relationship represents a relationship between accounts. +// +// swagger:model Relationship +type Relationship struct { + + // This account is blocking you. + BlockedBy bool `json:"blocked_by,omitempty"` + + // You are blocking this account. + Blocking bool `json:"blocking,omitempty"` + + // You are blocking this account's domain. + DomainBlocking bool `json:"domain_blocking,omitempty"` + + // You are featuring this account on your profile. + Endorsed bool `json:"endorsed,omitempty"` + + // This account follows you. + FollowedBy bool `json:"followed_by,omitempty"` + + // You are following this account. + Following bool `json:"following,omitempty"` + + // The account id. + // Example: 01FBW9XGEP7G6K88VY4S9MPE1R + ID string `json:"id,omitempty"` + + // You are muting this account. + Muting bool `json:"muting,omitempty"` + + // You are muting notifications from this account. + MutingNotifications bool `json:"muting_notifications,omitempty"` + + // Your note on this account. + Note string `json:"note,omitempty"` + + // You are seeing notifications when this account posts. + Notifying bool `json:"notifying,omitempty"` + + // You have requested to follow this account, and the request is pending. + Requested bool `json:"requested,omitempty"` + + // This account has requested to follow you, and the request is pending. + RequestedBy bool `json:"requested_by,omitempty"` + + // You are seeing reblogs/boosts from this account in your home timeline. + ShowingReblogs bool `json:"showing_reblogs,omitempty"` +} + +// Validate validates this relationship +func (m *Relationship) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this relationship based on context it is used +func (m *Relationship) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Relationship) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Relationship) UnmarshalBinary(b []byte) error { + var res Relationship + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/report.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/report.go new file mode 100644 index 0000000..5b405fb --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/report.go @@ -0,0 +1,154 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Report Report models a moderation report submitted to the instance, either via the client API or via the federated API. +// +// swagger:model Report +type Report struct { + + // Whether an action has been taken by an admin in response to this report. + // Example: false + ActionTaken bool `json:"action_taken,omitempty"` + + // If an action was taken, at what time was this done? (ISO 8601 Datetime) + // Will be null if not set / no action yet taken. + // Example: 2021-07-30T09:20:25+00:00 + ActionTakenAt string `json:"action_taken_at,omitempty"` + + // If an action was taken, what comment was made by the admin on the taken action? + // Will be null if not set / no action yet taken. + // Example: Account was suspended. + ActionTakenComment string `json:"action_taken_comment,omitempty"` + + // Under what category was this report created? + // Example: spam + Category string `json:"category,omitempty"` + + // Comment submitted when the report was created. + // Will be empty if no comment was submitted. + // Example: This person has been harassing me. + Comment string `json:"comment,omitempty"` + + // The date when this report was created (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + CreatedAt string `json:"created_at,omitempty"` + + // Bool to indicate that report should be federated to remote instance. + // Example: true + Forwarded bool `json:"forwarded,omitempty"` + + // ID of the report. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + ID string `json:"id,omitempty"` + + // Array of rule IDs that were submitted along with this report. + // Will be empty if no rule IDs were submitted. + // Example: ["01GPBN5YDY6JKBWE44H7YQBDCQ","01GPBN65PDWSBPWVDD0SQCFFY3"] + RuleIDs []string `json:"rule_ids"` + + // Array of IDs of statuses that were submitted along with this report. + // Will be empty if no status IDs were submitted. + // Example: ["01GPBN5YDY6JKBWE44H7YQBDCQ","01GPBN65PDWSBPWVDD0SQCFFY3"] + StatusIDs []string `json:"status_ids"` + + // target account + TargetAccount *Account `json:"target_account,omitempty"` +} + +// Validate validates this report +func (m *Report) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTargetAccount(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Report) validateTargetAccount(formats strfmt.Registry) error { + if swag.IsZero(m.TargetAccount) { // not required + return nil + } + + if m.TargetAccount != nil { + if err := m.TargetAccount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("target_account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("target_account") + } + return err + } + } + + return nil +} + +// ContextValidate validate this report based on the context it is used +func (m *Report) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTargetAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Report) contextValidateTargetAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.TargetAccount != nil { + + if swag.IsZero(m.TargetAccount) { // not required + return nil + } + + if err := m.TargetAccount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("target_account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("target_account") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Report) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Report) UnmarshalBinary(b []byte) error { + var res Report + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/search_result.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/search_result.go new file mode 100644 index 0000000..f8ebaf6 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/search_result.go @@ -0,0 +1,186 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// SearchResult SearchResult models a search result. +// +// swagger:model SearchResult +type SearchResult struct { + + // accounts + Accounts []*Account `json:"accounts"` + + // Slice of strings if api v1, slice of tags if api v2. + Hashtags []interface{} `json:"hashtags"` + + // statuses + Statuses []*Status `json:"statuses"` +} + +// Validate validates this search result +func (m *SearchResult) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccounts(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatuses(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SearchResult) validateAccounts(formats strfmt.Registry) error { + if swag.IsZero(m.Accounts) { // not required + return nil + } + + for i := 0; i < len(m.Accounts); i++ { + if swag.IsZero(m.Accounts[i]) { // not required + continue + } + + if m.Accounts[i] != nil { + if err := m.Accounts[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("accounts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("accounts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *SearchResult) validateStatuses(formats strfmt.Registry) error { + if swag.IsZero(m.Statuses) { // not required + return nil + } + + for i := 0; i < len(m.Statuses); i++ { + if swag.IsZero(m.Statuses[i]) { // not required + continue + } + + if m.Statuses[i] != nil { + if err := m.Statuses[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("statuses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("statuses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this search result based on the context it is used +func (m *SearchResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccounts(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatuses(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SearchResult) contextValidateAccounts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Accounts); i++ { + + if m.Accounts[i] != nil { + + if swag.IsZero(m.Accounts[i]) { // not required + return nil + } + + if err := m.Accounts[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("accounts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("accounts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *SearchResult) contextValidateStatuses(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Statuses); i++ { + + if m.Statuses[i] != nil { + + if swag.IsZero(m.Statuses[i]) { // not required + return nil + } + + if err := m.Statuses[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("statuses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("statuses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *SearchResult) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SearchResult) UnmarshalBinary(b []byte) error { + var res SearchResult + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/source.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/source.go new file mode 100644 index 0000000..2e5e72a --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/source.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Source Source represents display or publishing preferences of user's own account. +// +// Returned as an additional entity when verifying and updated credentials, as an attribute of Account. +// +// swagger:model Source +type Source struct { + + // This account is aliased to / also known as accounts at the + // given ActivityPub URIs. To set this, use `/api/v1/accounts/alias`. + // + // Omitted from json if empty / not set. + AlsoKnownAsURIs []string `json:"also_known_as_uris"` + + // Metadata about the account. + Fields []*Field `json:"fields"` + + // The number of pending follow requests. + FollowRequestsCount int64 `json:"follow_requests_count,omitempty"` + + // The default posting language for new statuses. + Language string `json:"language,omitempty"` + + // Profile bio. + Note string `json:"note,omitempty"` + + // The default post privacy to be used for new statuses. + // public = Public post + // unlisted = Unlisted post + // private = Followers-only post + // direct = Direct post + Privacy string `json:"privacy,omitempty"` + + // Whether new statuses should be marked sensitive by default. + Sensitive bool `json:"sensitive,omitempty"` + + // The default posting content type for new statuses. + StatusContentType string `json:"status_content_type,omitempty"` +} + +// Validate validates this source +func (m *Source) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateFields(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Source) validateFields(formats strfmt.Registry) error { + if swag.IsZero(m.Fields) { // not required + return nil + } + + for i := 0; i < len(m.Fields); i++ { + if swag.IsZero(m.Fields[i]) { // not required + continue + } + + if m.Fields[i] != nil { + if err := m.Fields[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("fields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this source based on the context it is used +func (m *Source) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFields(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Source) contextValidateFields(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Fields); i++ { + + if m.Fields[i] != nil { + + if swag.IsZero(m.Fields[i]) { // not required + return nil + } + + if err := m.Fields[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("fields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Source) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Source) UnmarshalBinary(b []byte) error { + var res Source + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/status.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/status.go new file mode 100644 index 0000000..80f3af1 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/status.go @@ -0,0 +1,749 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Status Status models a status or post. +// +// swagger:model Status +type Status struct { + + // This status has been bookmarked by the account viewing it. + Bookmarked bool `json:"bookmarked,omitempty"` + + // The content of this status. Should be HTML, but might also be plaintext in some cases. + // Example: \u003cp\u003eHey this is a status!\u003c/p\u003e + Content string `json:"content,omitempty"` + + // The date when this status was created (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + CreatedAt string `json:"created_at,omitempty"` + + // Custom emoji to be used when rendering status content. + Emojis []*Emoji `json:"emojis"` + + // This status has been favourited by the account viewing it. + Favourited bool `json:"favourited,omitempty"` + + // Number of favourites/likes this status has received, according to our instance. + FavouritesCount int64 `json:"favourites_count,omitempty"` + + // A list of filters that matched this status and why they matched, if there are any such filters. + Filtered []*FilterResult `json:"filtered"` + + // ID of the status. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + ID string `json:"id,omitempty"` + + // ID of the account being replied to. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + InReplyToAccountID string `json:"in_reply_to_account_id,omitempty"` + + // ID of the status being replied to. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + InReplyToID string `json:"in_reply_to_id,omitempty"` + + // Primary language of this status (ISO 639 Part 1 two-letter language code). + // Will be null if language is not known. + // Example: en + Language string `json:"language,omitempty"` + + // Media that is attached to this status. + MediaAttachments []*Attachment `json:"media_attachments"` + + // Mentions of users within the status content. + Mentions []*Mention `json:"mentions"` + + // Replies to this status have been muted by the account viewing it. + Muted bool `json:"muted,omitempty"` + + // This status has been pinned by the account viewing it (only relevant for your own statuses). + Pinned bool `json:"pinned,omitempty"` + + // This status has been boosted/reblogged by the account viewing it. + Reblogged bool `json:"reblogged,omitempty"` + + // Number of times this status has been boosted/reblogged, according to our instance. + ReblogsCount int64 `json:"reblogs_count,omitempty"` + + // Number of replies to this status, according to our instance. + RepliesCount int64 `json:"replies_count,omitempty"` + + // Status contains sensitive content. + // Example: false + Sensitive bool `json:"sensitive,omitempty"` + + // Subject, summary, or content warning for the status. + // Example: warning nsfw + SpoilerText string `json:"spoiler_text,omitempty"` + + // Hashtags used within the status content. + Tags []*Tag `json:"tags"` + + // Plain-text source of a status. Returned instead of content when status is deleted, + // so the user may redraft from the source text without the client having to reverse-engineer + // the original text from the HTML content. + Text string `json:"text,omitempty"` + + // ActivityPub URI of the status. Equivalent to the status's activitypub ID. + // Example: https://example.org/users/some_user/statuses/01FBVD42CQ3ZEEVMW180SBX03B + URI string `json:"uri,omitempty"` + + // The status's publicly available web URL. This link will only work if the visibility of the status is 'public'. + // Example: https://example.org/@some_user/statuses/01FBVD42CQ3ZEEVMW180SBX03B + URL string `json:"url,omitempty"` + + // Visibility of this status. + // Example: unlisted + Visibility string `json:"visibility,omitempty"` + + // account + Account *Account `json:"account,omitempty"` + + // application + Application *Application `json:"application,omitempty"` + + // card + Card *Card `json:"card,omitempty"` + + // interaction policy + InteractionPolicy *InteractionPolicy `json:"interaction_policy,omitempty"` + + // poll + Poll *Poll `json:"poll,omitempty"` + + // reblog + Reblog *StatusReblogged `json:"reblog,omitempty"` +} + +// Validate validates this status +func (m *Status) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEmojis(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFiltered(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMediaAttachments(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMentions(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTags(formats); err != nil { + res = append(res, err) + } + + if err := m.validateAccount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateApplication(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCard(formats); err != nil { + res = append(res, err) + } + + if err := m.validateInteractionPolicy(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePoll(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReblog(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Status) validateEmojis(formats strfmt.Registry) error { + if swag.IsZero(m.Emojis) { // not required + return nil + } + + for i := 0; i < len(m.Emojis); i++ { + if swag.IsZero(m.Emojis[i]) { // not required + continue + } + + if m.Emojis[i] != nil { + if err := m.Emojis[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Status) validateFiltered(formats strfmt.Registry) error { + if swag.IsZero(m.Filtered) { // not required + return nil + } + + for i := 0; i < len(m.Filtered); i++ { + if swag.IsZero(m.Filtered[i]) { // not required + continue + } + + if m.Filtered[i] != nil { + if err := m.Filtered[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("filtered" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("filtered" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Status) validateMediaAttachments(formats strfmt.Registry) error { + if swag.IsZero(m.MediaAttachments) { // not required + return nil + } + + for i := 0; i < len(m.MediaAttachments); i++ { + if swag.IsZero(m.MediaAttachments[i]) { // not required + continue + } + + if m.MediaAttachments[i] != nil { + if err := m.MediaAttachments[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Status) validateMentions(formats strfmt.Registry) error { + if swag.IsZero(m.Mentions) { // not required + return nil + } + + for i := 0; i < len(m.Mentions); i++ { + if swag.IsZero(m.Mentions[i]) { // not required + continue + } + + if m.Mentions[i] != nil { + if err := m.Mentions[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("mentions" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("mentions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Status) validateTags(formats strfmt.Registry) error { + if swag.IsZero(m.Tags) { // not required + return nil + } + + for i := 0; i < len(m.Tags); i++ { + if swag.IsZero(m.Tags[i]) { // not required + continue + } + + if m.Tags[i] != nil { + if err := m.Tags[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tags" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tags" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Status) validateAccount(formats strfmt.Registry) error { + if swag.IsZero(m.Account) { // not required + return nil + } + + if m.Account != nil { + if err := m.Account.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *Status) validateApplication(formats strfmt.Registry) error { + if swag.IsZero(m.Application) { // not required + return nil + } + + if m.Application != nil { + if err := m.Application.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("application") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("application") + } + return err + } + } + + return nil +} + +func (m *Status) validateCard(formats strfmt.Registry) error { + if swag.IsZero(m.Card) { // not required + return nil + } + + if m.Card != nil { + if err := m.Card.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("card") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("card") + } + return err + } + } + + return nil +} + +func (m *Status) validateInteractionPolicy(formats strfmt.Registry) error { + if swag.IsZero(m.InteractionPolicy) { // not required + return nil + } + + if m.InteractionPolicy != nil { + if err := m.InteractionPolicy.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("interaction_policy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("interaction_policy") + } + return err + } + } + + return nil +} + +func (m *Status) validatePoll(formats strfmt.Registry) error { + if swag.IsZero(m.Poll) { // not required + return nil + } + + if m.Poll != nil { + if err := m.Poll.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("poll") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("poll") + } + return err + } + } + + return nil +} + +func (m *Status) validateReblog(formats strfmt.Registry) error { + if swag.IsZero(m.Reblog) { // not required + return nil + } + + if m.Reblog != nil { + if err := m.Reblog.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("reblog") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("reblog") + } + return err + } + } + + return nil +} + +// ContextValidate validate this status based on the context it is used +func (m *Status) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEmojis(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFiltered(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMediaAttachments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMentions(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTags(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateApplication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCard(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateInteractionPolicy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePoll(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateReblog(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Status) contextValidateEmojis(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Emojis); i++ { + + if m.Emojis[i] != nil { + + if swag.IsZero(m.Emojis[i]) { // not required + return nil + } + + if err := m.Emojis[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Status) contextValidateFiltered(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Filtered); i++ { + + if m.Filtered[i] != nil { + + if swag.IsZero(m.Filtered[i]) { // not required + return nil + } + + if err := m.Filtered[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("filtered" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("filtered" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Status) contextValidateMediaAttachments(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MediaAttachments); i++ { + + if m.MediaAttachments[i] != nil { + + if swag.IsZero(m.MediaAttachments[i]) { // not required + return nil + } + + if err := m.MediaAttachments[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Status) contextValidateMentions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Mentions); i++ { + + if m.Mentions[i] != nil { + + if swag.IsZero(m.Mentions[i]) { // not required + return nil + } + + if err := m.Mentions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("mentions" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("mentions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Status) contextValidateTags(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Tags); i++ { + + if m.Tags[i] != nil { + + if swag.IsZero(m.Tags[i]) { // not required + return nil + } + + if err := m.Tags[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tags" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tags" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Status) contextValidateAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.Account != nil { + + if swag.IsZero(m.Account) { // not required + return nil + } + + if err := m.Account.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *Status) contextValidateApplication(ctx context.Context, formats strfmt.Registry) error { + + if m.Application != nil { + + if swag.IsZero(m.Application) { // not required + return nil + } + + if err := m.Application.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("application") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("application") + } + return err + } + } + + return nil +} + +func (m *Status) contextValidateCard(ctx context.Context, formats strfmt.Registry) error { + + if m.Card != nil { + + if swag.IsZero(m.Card) { // not required + return nil + } + + if err := m.Card.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("card") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("card") + } + return err + } + } + + return nil +} + +func (m *Status) contextValidateInteractionPolicy(ctx context.Context, formats strfmt.Registry) error { + + if m.InteractionPolicy != nil { + + if swag.IsZero(m.InteractionPolicy) { // not required + return nil + } + + if err := m.InteractionPolicy.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("interaction_policy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("interaction_policy") + } + return err + } + } + + return nil +} + +func (m *Status) contextValidatePoll(ctx context.Context, formats strfmt.Registry) error { + + if m.Poll != nil { + + if swag.IsZero(m.Poll) { // not required + return nil + } + + if err := m.Poll.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("poll") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("poll") + } + return err + } + } + + return nil +} + +func (m *Status) contextValidateReblog(ctx context.Context, formats strfmt.Registry) error { + + if m.Reblog != nil { + + if swag.IsZero(m.Reblog) { // not required + return nil + } + + if err := m.Reblog.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("reblog") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("reblog") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Status) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Status) UnmarshalBinary(b []byte) error { + var res Status + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/status_edit.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/status_edit.go new file mode 100644 index 0000000..5c7db83 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/status_edit.go @@ -0,0 +1,303 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// StatusEdit StatusEdit represents one historical revision of a status, containing +// partial information about the state of the status at that revision. +// +// swagger:model StatusEdit +type StatusEdit struct { + + // The content of this status at this revision. + // Should be HTML, but might also be plaintext in some cases. + // Example: \u003cp\u003eHey this is a status!\u003c/p\u003e + Content string `json:"content,omitempty"` + + // The date when this revision was created (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + CreatedAt string `json:"created_at,omitempty"` + + // Custom emoji to be used when rendering status content. + Emojis []*Emoji `json:"emojis"` + + // Media that is attached to this status. + MediaAttachments []*Attachment `json:"media_attachments"` + + // Status marked sensitive at this revision. + // Example: false + Sensitive bool `json:"sensitive,omitempty"` + + // Subject, summary, or content warning for the status at this revision. + // Example: warning nsfw + SpoilerText string `json:"spoiler_text,omitempty"` + + // account + Account *Account `json:"account,omitempty"` + + // poll + Poll *Poll `json:"poll,omitempty"` +} + +// Validate validates this status edit +func (m *StatusEdit) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEmojis(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMediaAttachments(formats); err != nil { + res = append(res, err) + } + + if err := m.validateAccount(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePoll(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StatusEdit) validateEmojis(formats strfmt.Registry) error { + if swag.IsZero(m.Emojis) { // not required + return nil + } + + for i := 0; i < len(m.Emojis); i++ { + if swag.IsZero(m.Emojis[i]) { // not required + continue + } + + if m.Emojis[i] != nil { + if err := m.Emojis[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusEdit) validateMediaAttachments(formats strfmt.Registry) error { + if swag.IsZero(m.MediaAttachments) { // not required + return nil + } + + for i := 0; i < len(m.MediaAttachments); i++ { + if swag.IsZero(m.MediaAttachments[i]) { // not required + continue + } + + if m.MediaAttachments[i] != nil { + if err := m.MediaAttachments[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusEdit) validateAccount(formats strfmt.Registry) error { + if swag.IsZero(m.Account) { // not required + return nil + } + + if m.Account != nil { + if err := m.Account.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *StatusEdit) validatePoll(formats strfmt.Registry) error { + if swag.IsZero(m.Poll) { // not required + return nil + } + + if m.Poll != nil { + if err := m.Poll.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("poll") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("poll") + } + return err + } + } + + return nil +} + +// ContextValidate validate this status edit based on the context it is used +func (m *StatusEdit) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEmojis(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMediaAttachments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePoll(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StatusEdit) contextValidateEmojis(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Emojis); i++ { + + if m.Emojis[i] != nil { + + if swag.IsZero(m.Emojis[i]) { // not required + return nil + } + + if err := m.Emojis[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusEdit) contextValidateMediaAttachments(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MediaAttachments); i++ { + + if m.MediaAttachments[i] != nil { + + if swag.IsZero(m.MediaAttachments[i]) { // not required + return nil + } + + if err := m.MediaAttachments[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusEdit) contextValidateAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.Account != nil { + + if swag.IsZero(m.Account) { // not required + return nil + } + + if err := m.Account.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *StatusEdit) contextValidatePoll(ctx context.Context, formats strfmt.Registry) error { + + if m.Poll != nil { + + if swag.IsZero(m.Poll) { // not required + return nil + } + + if err := m.Poll.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("poll") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("poll") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *StatusEdit) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *StatusEdit) UnmarshalBinary(b []byte) error { + var res StatusEdit + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/status_reblogged.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/status_reblogged.go new file mode 100644 index 0000000..c8863a6 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/status_reblogged.go @@ -0,0 +1,749 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// StatusReblogged StatusReblogged represents a reblogged status. +// +// swagger:model StatusReblogged +type StatusReblogged struct { + + // This status has been bookmarked by the account viewing it. + Bookmarked bool `json:"bookmarked,omitempty"` + + // The content of this status. Should be HTML, but might also be plaintext in some cases. + // Example: \u003cp\u003eHey this is a status!\u003c/p\u003e + Content string `json:"content,omitempty"` + + // The date when this status was created (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + CreatedAt string `json:"created_at,omitempty"` + + // Custom emoji to be used when rendering status content. + Emojis []*Emoji `json:"emojis"` + + // This status has been favourited by the account viewing it. + Favourited bool `json:"favourited,omitempty"` + + // Number of favourites/likes this status has received, according to our instance. + FavouritesCount int64 `json:"favourites_count,omitempty"` + + // A list of filters that matched this status and why they matched, if there are any such filters. + Filtered []*FilterResult `json:"filtered"` + + // ID of the status. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + ID string `json:"id,omitempty"` + + // ID of the account being replied to. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + InReplyToAccountID string `json:"in_reply_to_account_id,omitempty"` + + // ID of the status being replied to. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + InReplyToID string `json:"in_reply_to_id,omitempty"` + + // Primary language of this status (ISO 639 Part 1 two-letter language code). + // Will be null if language is not known. + // Example: en + Language string `json:"language,omitempty"` + + // Media that is attached to this status. + MediaAttachments []*Attachment `json:"media_attachments"` + + // Mentions of users within the status content. + Mentions []*Mention `json:"mentions"` + + // Replies to this status have been muted by the account viewing it. + Muted bool `json:"muted,omitempty"` + + // This status has been pinned by the account viewing it (only relevant for your own statuses). + Pinned bool `json:"pinned,omitempty"` + + // This status has been boosted/reblogged by the account viewing it. + Reblogged bool `json:"reblogged,omitempty"` + + // Number of times this status has been boosted/reblogged, according to our instance. + ReblogsCount int64 `json:"reblogs_count,omitempty"` + + // Number of replies to this status, according to our instance. + RepliesCount int64 `json:"replies_count,omitempty"` + + // Status contains sensitive content. + // Example: false + Sensitive bool `json:"sensitive,omitempty"` + + // Subject, summary, or content warning for the status. + // Example: warning nsfw + SpoilerText string `json:"spoiler_text,omitempty"` + + // Hashtags used within the status content. + Tags []*Tag `json:"tags"` + + // Plain-text source of a status. Returned instead of content when status is deleted, + // so the user may redraft from the source text without the client having to reverse-engineer + // the original text from the HTML content. + Text string `json:"text,omitempty"` + + // ActivityPub URI of the status. Equivalent to the status's activitypub ID. + // Example: https://example.org/users/some_user/statuses/01FBVD42CQ3ZEEVMW180SBX03B + URI string `json:"uri,omitempty"` + + // The status's publicly available web URL. This link will only work if the visibility of the status is 'public'. + // Example: https://example.org/@some_user/statuses/01FBVD42CQ3ZEEVMW180SBX03B + URL string `json:"url,omitempty"` + + // Visibility of this status. + // Example: unlisted + Visibility string `json:"visibility,omitempty"` + + // account + Account *Account `json:"account,omitempty"` + + // application + Application *Application `json:"application,omitempty"` + + // card + Card *Card `json:"card,omitempty"` + + // interaction policy + InteractionPolicy *InteractionPolicy `json:"interaction_policy,omitempty"` + + // poll + Poll *Poll `json:"poll,omitempty"` + + // reblog + Reblog *StatusReblogged `json:"reblog,omitempty"` +} + +// Validate validates this status reblogged +func (m *StatusReblogged) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEmojis(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFiltered(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMediaAttachments(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMentions(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTags(formats); err != nil { + res = append(res, err) + } + + if err := m.validateAccount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateApplication(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCard(formats); err != nil { + res = append(res, err) + } + + if err := m.validateInteractionPolicy(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePoll(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReblog(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StatusReblogged) validateEmojis(formats strfmt.Registry) error { + if swag.IsZero(m.Emojis) { // not required + return nil + } + + for i := 0; i < len(m.Emojis); i++ { + if swag.IsZero(m.Emojis[i]) { // not required + continue + } + + if m.Emojis[i] != nil { + if err := m.Emojis[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusReblogged) validateFiltered(formats strfmt.Registry) error { + if swag.IsZero(m.Filtered) { // not required + return nil + } + + for i := 0; i < len(m.Filtered); i++ { + if swag.IsZero(m.Filtered[i]) { // not required + continue + } + + if m.Filtered[i] != nil { + if err := m.Filtered[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("filtered" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("filtered" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusReblogged) validateMediaAttachments(formats strfmt.Registry) error { + if swag.IsZero(m.MediaAttachments) { // not required + return nil + } + + for i := 0; i < len(m.MediaAttachments); i++ { + if swag.IsZero(m.MediaAttachments[i]) { // not required + continue + } + + if m.MediaAttachments[i] != nil { + if err := m.MediaAttachments[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusReblogged) validateMentions(formats strfmt.Registry) error { + if swag.IsZero(m.Mentions) { // not required + return nil + } + + for i := 0; i < len(m.Mentions); i++ { + if swag.IsZero(m.Mentions[i]) { // not required + continue + } + + if m.Mentions[i] != nil { + if err := m.Mentions[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("mentions" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("mentions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusReblogged) validateTags(formats strfmt.Registry) error { + if swag.IsZero(m.Tags) { // not required + return nil + } + + for i := 0; i < len(m.Tags); i++ { + if swag.IsZero(m.Tags[i]) { // not required + continue + } + + if m.Tags[i] != nil { + if err := m.Tags[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tags" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tags" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusReblogged) validateAccount(formats strfmt.Registry) error { + if swag.IsZero(m.Account) { // not required + return nil + } + + if m.Account != nil { + if err := m.Account.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *StatusReblogged) validateApplication(formats strfmt.Registry) error { + if swag.IsZero(m.Application) { // not required + return nil + } + + if m.Application != nil { + if err := m.Application.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("application") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("application") + } + return err + } + } + + return nil +} + +func (m *StatusReblogged) validateCard(formats strfmt.Registry) error { + if swag.IsZero(m.Card) { // not required + return nil + } + + if m.Card != nil { + if err := m.Card.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("card") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("card") + } + return err + } + } + + return nil +} + +func (m *StatusReblogged) validateInteractionPolicy(formats strfmt.Registry) error { + if swag.IsZero(m.InteractionPolicy) { // not required + return nil + } + + if m.InteractionPolicy != nil { + if err := m.InteractionPolicy.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("interaction_policy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("interaction_policy") + } + return err + } + } + + return nil +} + +func (m *StatusReblogged) validatePoll(formats strfmt.Registry) error { + if swag.IsZero(m.Poll) { // not required + return nil + } + + if m.Poll != nil { + if err := m.Poll.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("poll") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("poll") + } + return err + } + } + + return nil +} + +func (m *StatusReblogged) validateReblog(formats strfmt.Registry) error { + if swag.IsZero(m.Reblog) { // not required + return nil + } + + if m.Reblog != nil { + if err := m.Reblog.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("reblog") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("reblog") + } + return err + } + } + + return nil +} + +// ContextValidate validate this status reblogged based on the context it is used +func (m *StatusReblogged) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEmojis(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFiltered(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMediaAttachments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMentions(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTags(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateApplication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCard(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateInteractionPolicy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePoll(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateReblog(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StatusReblogged) contextValidateEmojis(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Emojis); i++ { + + if m.Emojis[i] != nil { + + if swag.IsZero(m.Emojis[i]) { // not required + return nil + } + + if err := m.Emojis[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusReblogged) contextValidateFiltered(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Filtered); i++ { + + if m.Filtered[i] != nil { + + if swag.IsZero(m.Filtered[i]) { // not required + return nil + } + + if err := m.Filtered[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("filtered" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("filtered" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusReblogged) contextValidateMediaAttachments(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MediaAttachments); i++ { + + if m.MediaAttachments[i] != nil { + + if swag.IsZero(m.MediaAttachments[i]) { // not required + return nil + } + + if err := m.MediaAttachments[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusReblogged) contextValidateMentions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Mentions); i++ { + + if m.Mentions[i] != nil { + + if swag.IsZero(m.Mentions[i]) { // not required + return nil + } + + if err := m.Mentions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("mentions" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("mentions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusReblogged) contextValidateTags(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Tags); i++ { + + if m.Tags[i] != nil { + + if swag.IsZero(m.Tags[i]) { // not required + return nil + } + + if err := m.Tags[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tags" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tags" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusReblogged) contextValidateAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.Account != nil { + + if swag.IsZero(m.Account) { // not required + return nil + } + + if err := m.Account.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *StatusReblogged) contextValidateApplication(ctx context.Context, formats strfmt.Registry) error { + + if m.Application != nil { + + if swag.IsZero(m.Application) { // not required + return nil + } + + if err := m.Application.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("application") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("application") + } + return err + } + } + + return nil +} + +func (m *StatusReblogged) contextValidateCard(ctx context.Context, formats strfmt.Registry) error { + + if m.Card != nil { + + if swag.IsZero(m.Card) { // not required + return nil + } + + if err := m.Card.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("card") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("card") + } + return err + } + } + + return nil +} + +func (m *StatusReblogged) contextValidateInteractionPolicy(ctx context.Context, formats strfmt.Registry) error { + + if m.InteractionPolicy != nil { + + if swag.IsZero(m.InteractionPolicy) { // not required + return nil + } + + if err := m.InteractionPolicy.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("interaction_policy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("interaction_policy") + } + return err + } + } + + return nil +} + +func (m *StatusReblogged) contextValidatePoll(ctx context.Context, formats strfmt.Registry) error { + + if m.Poll != nil { + + if swag.IsZero(m.Poll) { // not required + return nil + } + + if err := m.Poll.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("poll") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("poll") + } + return err + } + } + + return nil +} + +func (m *StatusReblogged) contextValidateReblog(ctx context.Context, formats strfmt.Registry) error { + + if m.Reblog != nil { + + if swag.IsZero(m.Reblog) { // not required + return nil + } + + if err := m.Reblog.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("reblog") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("reblog") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *StatusReblogged) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *StatusReblogged) UnmarshalBinary(b []byte) error { + var res StatusReblogged + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/status_source.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/status_source.go new file mode 100644 index 0000000..7186b10 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/status_source.go @@ -0,0 +1,58 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// StatusSource StatusSource represents the source text of a +// status as submitted to the API when it was created. +// +// swagger:model StatusSource +type StatusSource struct { + + // ID of the status. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + ID string `json:"id,omitempty"` + + // Plain-text version of spoiler text. + SpoilerText string `json:"spoiler_text,omitempty"` + + // Plain-text source of a status. + Text string `json:"text,omitempty"` +} + +// Validate validates this status source +func (m *StatusSource) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this status source based on context it is used +func (m *StatusSource) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *StatusSource) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *StatusSource) UnmarshalBinary(b []byte) error { + var res StatusSource + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/swagger_collection.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/swagger_collection.go new file mode 100644 index 0000000..3d14a6d --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/swagger_collection.go @@ -0,0 +1,174 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// SwaggerCollection SwaggerCollection represents an ActivityPub Collection. +// +// swagger:model SwaggerCollection +type SwaggerCollection struct { + + // ActivityStreams JSON-LD context. + // A string or an array of strings, or more + // complex nested items. + // Example: https://www.w3.org/ns/activitystreams + Context interface{} `json:"@context,omitempty"` + + // ActivityStreams ID. + // Example: https://example.org/users/some_user/statuses/106717595988259568/replies + ID string `json:"id,omitempty"` + + // ActivityStreams type. + // Example: Collection + Type string `json:"type,omitempty"` + + // first + First *SwaggerCollectionPage `json:"first,omitempty"` + + // last + Last *SwaggerCollectionPage `json:"last,omitempty"` +} + +// Validate validates this swagger collection +func (m *SwaggerCollection) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateFirst(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLast(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SwaggerCollection) validateFirst(formats strfmt.Registry) error { + if swag.IsZero(m.First) { // not required + return nil + } + + if m.First != nil { + if err := m.First.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("first") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("first") + } + return err + } + } + + return nil +} + +func (m *SwaggerCollection) validateLast(formats strfmt.Registry) error { + if swag.IsZero(m.Last) { // not required + return nil + } + + if m.Last != nil { + if err := m.Last.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("last") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("last") + } + return err + } + } + + return nil +} + +// ContextValidate validate this swagger collection based on the context it is used +func (m *SwaggerCollection) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFirst(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateLast(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SwaggerCollection) contextValidateFirst(ctx context.Context, formats strfmt.Registry) error { + + if m.First != nil { + + if swag.IsZero(m.First) { // not required + return nil + } + + if err := m.First.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("first") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("first") + } + return err + } + } + + return nil +} + +func (m *SwaggerCollection) contextValidateLast(ctx context.Context, formats strfmt.Registry) error { + + if m.Last != nil { + + if swag.IsZero(m.Last) { // not required + return nil + } + + if err := m.Last.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("last") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("last") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *SwaggerCollection) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SwaggerCollection) UnmarshalBinary(b []byte) error { + var res SwaggerCollection + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/swagger_collection_page.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/swagger_collection_page.go new file mode 100644 index 0000000..aac783c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/swagger_collection_page.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// SwaggerCollectionPage SwaggerCollectionPage represents one page of a collection. +// +// swagger:model SwaggerCollectionPage +type SwaggerCollectionPage struct { + + // ActivityStreams ID. + // Example: https://example.org/users/some_user/statuses/106717595988259568/replies?page=true + ID string `json:"id,omitempty"` + + // Items on this page. + // Example: ["https://example.org/users/some_other_user/statuses/086417595981111564","https://another.example.com/users/another_user/statuses/01FCN8XDV3YG7B4R42QA6YQZ9R"] + Items []string `json:"items"` + + // Link to the next page. + // Example: https://example.org/users/some_user/statuses/106717595988259568/replies?only_other_accounts=true\u0026page=true + Next string `json:"next,omitempty"` + + // Collection this page belongs to. + // Example: https://example.org/users/some_user/statuses/106717595988259568/replies + PartOf string `json:"partOf,omitempty"` + + // ActivityStreams type. + // Example: CollectionPage + Type string `json:"type,omitempty"` +} + +// Validate validates this swagger collection page +func (m *SwaggerCollectionPage) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this swagger collection page based on context it is used +func (m *SwaggerCollectionPage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SwaggerCollectionPage) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SwaggerCollectionPage) UnmarshalBinary(b []byte) error { + var res SwaggerCollectionPage + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/swagger_featured_collection.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/swagger_featured_collection.go new file mode 100644 index 0000000..8037174 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/swagger_featured_collection.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// SwaggerFeaturedCollection SwaggerFeaturedCollection represents an ActivityPub OrderedCollection. +// +// swagger:model SwaggerFeaturedCollection +type SwaggerFeaturedCollection struct { + + // ActivityStreams JSON-LD context. + // A string or an array of strings, or more + // complex nested items. + // Example: https://www.w3.org/ns/activitystreams + Context interface{} `json:"@context,omitempty"` + + // ActivityStreams ID. + // Example: https://example.org/users/some_user/collections/featured + ID string `json:"id,omitempty"` + + // List of status URIs. + // Example: ["https://example.org/users/some_user/statuses/01GSZ0F7Q8SJKNRF777GJD271R","https://example.org/users/some_user/statuses/01GSZ0G012CBQ7TEKX689S3QRE"] + Items []string `json:"items"` + + // Number of items in this collection. + // Example: 2 + TotalItems int64 `json:"TotalItems,omitempty"` + + // ActivityStreams type. + // Example: OrderedCollection + Type string `json:"type,omitempty"` +} + +// Validate validates this swagger featured collection +func (m *SwaggerFeaturedCollection) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this swagger featured collection based on context it is used +func (m *SwaggerFeaturedCollection) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SwaggerFeaturedCollection) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SwaggerFeaturedCollection) UnmarshalBinary(b []byte) error { + var res SwaggerFeaturedCollection + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/tag.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/tag.go new file mode 100644 index 0000000..5e9426b --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/tag.go @@ -0,0 +1,60 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Tag Tag represents a hashtag used within the content of a status. +// +// swagger:model Tag +type Tag struct { + + // History of this hashtag's usage. + // Currently just a stub, if provided will always be an empty array. + // Example: [] + History []interface{} `json:"history"` + + // The value of the hashtag after the # sign. + // Example: helloworld + Name string `json:"name,omitempty"` + + // Web link to the hashtag. + // Example: https://example.org/tags/helloworld + URL string `json:"url,omitempty"` +} + +// Validate validates this tag +func (m *Tag) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this tag based on context it is used +func (m *Tag) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Tag) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Tag) UnmarshalBinary(b []byte) error { + var res Tag + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/theme.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/theme.go new file mode 100644 index 0000000..a0e1b9c --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/theme.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Theme Theme represents one user-selectable preset CSS theme. +// +// swagger:model Theme +type Theme struct { + + // User-facing description of this theme. + Description string `json:"description,omitempty"` + + // FileName of this theme in the themes directory. + FileName string `json:"file_name,omitempty"` + + // User-facing title of this theme. + Title string `json:"title,omitempty"` +} + +// Validate validates this theme +func (m *Theme) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this theme based on context it is used +func (m *Theme) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Theme) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Theme) UnmarshalBinary(b []byte) error { + var res Theme + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/thread_context.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/thread_context.go new file mode 100644 index 0000000..4a90c0f --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/thread_context.go @@ -0,0 +1,184 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// ThreadContext ThreadContext models the tree or +// "thread" around a given status. +// +// swagger:model ThreadContext +type ThreadContext struct { + + // Parents in the thread. + Ancestors []*Status `json:"ancestors"` + + // Children in the thread. + Descendants []*Status `json:"descendants"` +} + +// Validate validates this thread context +func (m *ThreadContext) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAncestors(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDescendants(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ThreadContext) validateAncestors(formats strfmt.Registry) error { + if swag.IsZero(m.Ancestors) { // not required + return nil + } + + for i := 0; i < len(m.Ancestors); i++ { + if swag.IsZero(m.Ancestors[i]) { // not required + continue + } + + if m.Ancestors[i] != nil { + if err := m.Ancestors[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ancestors" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ancestors" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ThreadContext) validateDescendants(formats strfmt.Registry) error { + if swag.IsZero(m.Descendants) { // not required + return nil + } + + for i := 0; i < len(m.Descendants); i++ { + if swag.IsZero(m.Descendants[i]) { // not required + continue + } + + if m.Descendants[i] != nil { + if err := m.Descendants[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("descendants" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("descendants" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this thread context based on the context it is used +func (m *ThreadContext) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAncestors(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDescendants(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ThreadContext) contextValidateAncestors(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Ancestors); i++ { + + if m.Ancestors[i] != nil { + + if swag.IsZero(m.Ancestors[i]) { // not required + return nil + } + + if err := m.Ancestors[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ancestors" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ancestors" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ThreadContext) contextValidateDescendants(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Descendants); i++ { + + if m.Descendants[i] != nil { + + if swag.IsZero(m.Descendants[i]) { // not required + return nil + } + + if err := m.Descendants[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("descendants" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("descendants" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ThreadContext) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ThreadContext) UnmarshalBinary(b []byte) error { + var res ThreadContext + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/timeline_marker.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/timeline_marker.go new file mode 100644 index 0000000..6ba5e43 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/timeline_marker.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TimelineMarker TimelineMarker contains information about a user's progress through a specific timeline. +// +// swagger:model TimelineMarker +type TimelineMarker struct { + + // The ID of the most recently viewed entity. + LastReadID string `json:"last_read_id,omitempty"` + + // The timestamp of when the marker was set (ISO 8601 Datetime) + UpdatedAt string `json:"updated_at,omitempty"` + + // Used for locking to prevent write conflicts. + Version int64 `json:"version,omitempty"` +} + +// Validate validates this timeline marker +func (m *TimelineMarker) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this timeline marker based on context it is used +func (m *TimelineMarker) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TimelineMarker) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TimelineMarker) UnmarshalBinary(b []byte) error { + var res TimelineMarker + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/token.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/token.go new file mode 100644 index 0000000..64168f4 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/token.go @@ -0,0 +1,62 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Token Token represents an OAuth token used for authenticating with the GoToSocial API and performing actions. +// +// swagger:model Token +type Token struct { + + // Access token used for authorization. + AccessToken string `json:"access_token,omitempty"` + + // When the OAuth token was generated (UNIX timestamp seconds). + // Example: 1627644520 + CreatedAt int64 `json:"created_at,omitempty"` + + // OAuth scopes granted by this token, space-separated. + // Example: read write admin + Scope string `json:"scope,omitempty"` + + // OAuth token type. Will always be 'Bearer'. + // Example: bearer + TokenType string `json:"token_type,omitempty"` +} + +// Validate validates this token +func (m *Token) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this token based on context it is used +func (m *Token) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Token) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Token) UnmarshalBinary(b []byte) error { + var res Token + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/user.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/user.go new file mode 100644 index 0000000..1965170 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/user.go @@ -0,0 +1,99 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// User User models fields relevant to one user. +// +// swagger:model User +type User struct { + + // User is an admin. + // Example: false + Admin bool `json:"admin,omitempty"` + + // User was approved by an admin. + // Example: true + Approved bool `json:"approved,omitempty"` + + // Time when the last "please confirm your email address" email was sent, if at all. (ISO 8601 Datetime) + // Example: 2021-07-30T09:20:25+00:00 + ConfirmationSentAt string `json:"confirmation_sent_at,omitempty"` + + // Time at which the email given in the `email` field was confirmed, if at all. (ISO 8601 Datetime) + // Example: 2021-07-30T09:20:25+00:00 + ConfirmedAt string `json:"confirmed_at,omitempty"` + + // Time this user was created. (ISO 8601 Datetime) + // Example: 2021-07-30T09:20:25+00:00 + CreatedAt string `json:"created_at,omitempty"` + + // User's account is disabled. + // Example: false + Disabled bool `json:"disabled,omitempty"` + + // Confirmed email address of this user, if set. + // Example: someone@example.org + Email string `json:"email,omitempty"` + + // Database ID of this user. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + ID string `json:"id,omitempty"` + + // Time at which this user was last emailed, if at all. (ISO 8601 Datetime) + // Example: 2021-07-30T09:20:25+00:00 + LastEmailedAt string `json:"last_emailed_at,omitempty"` + + // User is a moderator. + // Example: false + Moderator bool `json:"moderator,omitempty"` + + // Reason for sign-up, if provided. + // Example: Please! Pretty please! + Reason string `json:"reason,omitempty"` + + // Time when the last "please reset your password" email was sent, if at all. (ISO 8601 Datetime) + // Example: 2021-07-30T09:20:25+00:00 + ResetPasswordSentAt string `json:"reset_password_sent_at,omitempty"` + + // Unconfirmed email address of this user, if set. + // Example: someone.else@somewhere.else.example.org + UnconfirmedEmail string `json:"unconfirmed_email,omitempty"` +} + +// Validate validates this user +func (m *User) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this user based on context it is used +func (m *User) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *User) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *User) UnmarshalBinary(b []byte) error { + var res User + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/git.coopcloud.tech/decentral1se/gtslib/models/well_known_response.go b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/well_known_response.go new file mode 100644 index 0000000..3cd0a53 --- /dev/null +++ b/vendor/git.coopcloud.tech/decentral1se/gtslib/models/well_known_response.go @@ -0,0 +1,130 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// WellKnownResponse WellKnownResponse represents the response to either a webfinger request for an 'acct' resource, or a request to nodeinfo. +// For example, it would be returned from https://example.org/.well-known/webfinger?resource=acct:some_username@example.org +// +// See https://webfinger.net/ +// +// swagger:model WellKnownResponse +type WellKnownResponse struct { + + // aliases + Aliases []string `json:"aliases"` + + // links + Links []*Link `json:"links"` + + // subject + Subject string `json:"subject,omitempty"` +} + +// Validate validates this well known response +func (m *WellKnownResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLinks(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *WellKnownResponse) validateLinks(formats strfmt.Registry) error { + if swag.IsZero(m.Links) { // not required + return nil + } + + for i := 0; i < len(m.Links); i++ { + if swag.IsZero(m.Links[i]) { // not required + continue + } + + if m.Links[i] != nil { + if err := m.Links[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("links" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("links" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this well known response based on the context it is used +func (m *WellKnownResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLinks(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *WellKnownResponse) contextValidateLinks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Links); i++ { + + if m.Links[i] != nil { + + if swag.IsZero(m.Links[i]) { // not required + return nil + } + + if err := m.Links[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("links" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("links" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *WellKnownResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *WellKnownResponse) UnmarshalBinary(b []byte) error { + var res WellKnownResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/adrg/xdg/CODE_OF_CONDUCT.md b/vendor/github.com/adrg/xdg/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..75349e5 --- /dev/null +++ b/vendor/github.com/adrg/xdg/CODE_OF_CONDUCT.md @@ -0,0 +1,77 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, +body size, disability, ethnicity, sex characteristics, gender identity and +expression, level of experience, education, socio-economic status, nationality, +personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behaviour that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behaviour by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behaviour and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behaviour. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviour that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behaviour may be +reported by contacting the project team at adrg@epistack.com. All complaints +will be reviewed and investigated and will result in a response that is deemed +necessary and appropriate to the circumstances. The project team is obligated to +maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 1.4, available at +https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/vendor/github.com/adrg/xdg/CONTRIBUTING.md b/vendor/github.com/adrg/xdg/CONTRIBUTING.md new file mode 100644 index 0000000..006f146 --- /dev/null +++ b/vendor/github.com/adrg/xdg/CONTRIBUTING.md @@ -0,0 +1,135 @@ +# Contributing to this project + +Contributions in the form of pull requests, issues or just general feedback, +are always welcome. Please take a moment to review this document in order to +make the contribution process easy and effective for everyone involved. + +Following these guidelines helps to communicate that you respect the time of +the developers managing and developing this open source project. In return, +they should reciprocate that respect in addressing your issue or assessing +patches and features. + +## Using the issue tracker + +The issue tracker is the preferred channel for [bug reports](#bugs), +[features requests](#features) and [submitting pull +requests](#pull-requests), but please respect the following restrictions: + +* Please **do not** use the issue tracker for personal support requests (use + [Stack Overflow](http://stackoverflow.com) or IRC). +* Please **do not** derail or troll issues. Keep the discussion on topic and + respect the opinions of others. + + +## Bug reports + +A bug is a _demonstrable problem_ that is caused by the code in the repository. +Good bug reports are extremely helpful - thank you! + +Guidelines for bug reports: + +1. **Use the GitHub issue search** — check if the issue has already been + reported. +2. **Check if the issue has been fixed** — try to reproduce it using the + latest `master` or development branch in the repository. +3. **Isolate the problem** — create a reduced test case. + +A good bug report shouldn't leave others needing to chase you up for more +information. Please try to be as detailed as possible in your report. What is +your environment? What steps will reproduce the issue? What browser(s) and OS +experience the problem? What would you expect to be the outcome? All these +details will help people to fix any potential bugs. + +Example: + +> Short and descriptive example bug report title +> +> A summary of the issue and the browser/OS environment in which it occurs. If +> suitable, include the steps required to reproduce the bug. +> +> 1. This is the first step +> 2. This is the second step +> 3. Further steps, etc. +> +> `` - a link to the reduced test case +> +> Any other information you want to share that is relevant to the issue being +> reported. This might include the lines of code that you have identified as +> causing the bug, and potential solutions (and your opinions on their +> merits). + + + +## Feature requests + +Feature requests are welcome. But take a moment to find out whether your idea +fits with the scope and aims of the project. It's up to *you* to make a strong +case to convince the project's developers of the merits of this feature. Please +provide as much detail and context as possible. + + + +## Pull requests + +Good pull requests - patches, improvements, new features - are a fantastic +help. They should remain focused in scope and avoid containing unrelated +commits. + +**Please ask first** before embarking on any significant pull request (e.g. +implementing features, refactoring code, porting to a different language), +otherwise you risk spending a lot of time working on something that the +project's developers might not want to merge into the project. + +Please adhere to the coding conventions used throughout a project (indentation, +accurate comments, etc.) and any other requirements (such as test coverage). + +Follow this process if you'd like your work considered for inclusion in the +project: + +1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork, + and configure the remotes: + + ```bash + # Clone your fork of the repo into the current directory + git clone https://github.com// + # Navigate to the newly cloned directory + cd + # Assign the original repo to a remote called "upstream" + git remote add upstream https://github.com// + ``` + +2. If you cloned a while ago, get the latest changes from upstream: + + ```bash + git checkout + git pull upstream + ``` + +3. Create a new topic branch (off the main project development branch) to + contain your feature, change, or fix: + + ```bash + git checkout -b + ``` + +4. Commit your changes in logical chunks and use descriptive commit messages. + Use [interactive rebase](https://help.github.com/articles/interactive-rebase) + to tidy up your commits before making them public. + +5. Locally merge (or rebase) the upstream development branch into your topic branch: + + ```bash + git pull [--rebase] upstream + ``` + +6. Push your topic branch up to your fork: + + ```bash + git push origin + ``` + +7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) + with a clear title and description. + +**IMPORTANT**: By submitting a patch, you agree to allow the project owner to +license your work under the same license as that used by the project. diff --git a/vendor/github.com/adrg/xdg/LICENSE b/vendor/github.com/adrg/xdg/LICENSE new file mode 100644 index 0000000..7307e1b --- /dev/null +++ b/vendor/github.com/adrg/xdg/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Adrian-George Bostan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/github.com/adrg/xdg/README.md b/vendor/github.com/adrg/xdg/README.md new file mode 100644 index 0000000..4a452de --- /dev/null +++ b/vendor/github.com/adrg/xdg/README.md @@ -0,0 +1,294 @@ +

+
+ xdg logo +
+

+ +

Go implementation of the XDG Base Directory Specification and XDG user directories.

+ +

+ + Tests status + + + Code coverage + + + pkg.go.dev documentation + + + MIT license + +
+ + Go report card + + + Awesome Go + + + GitHub contributors + + + GitHub open issues + + + Buy me a coffee + +

+ +Provides an implementation of the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html). +The specification defines a set of standard paths for storing application files, +including data and configuration files. For portability and flexibility reasons, +applications should use the XDG defined locations instead of hardcoding paths. +The package also includes the locations of well known [user directories](https://wiki.archlinux.org/index.php/XDG_user_directories), as well as +other common directories such as fonts and applications. + +The current implementation supports **most flavors of Unix**, **Windows**, **macOS** and **Plan 9**. +On Windows, where XDG environment variables are not usually set, the package uses [Known Folders](https://docs.microsoft.com/en-us/windows/win32/shell/known-folders) +as defaults. Therefore, appropriate locations are used for common [folders](https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid) which may have been redirected. + +See usage [examples](#usage) below. Full documentation can be found at https://pkg.go.dev/github.com/adrg/xdg. + +## Installation + go get github.com/adrg/xdg + +## Default locations + +The package defines sensible defaults for XDG variables which are empty or not +present in the environment. + +- On Unix-like operating systems, XDG environment variables are typically defined. +Appropriate default locations are used for the environment variables which are not set. +- On Windows, XDG environment variables are usually not set. If that is the case, +the package relies on the appropriate [Known Folders](https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid). +Sensible fallback locations are used for the folders which are not set. + +### XDG Base Directory + +
+ Unix-like operating systems +
+ +| |

Unix

|

macOS

|

Plan 9

| +| :------------------------------------------------------------: | :-----------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------: | +| XDG_DATA_HOME | ~/.local/share | ~/Library/Application Support | $home/lib | +| XDG_DATA_DIRS | /usr/local/share
/usr/share | /Library/Application Support | /lib | +| XDG_CONFIG_HOME | ~/.config | ~/Library/Application Support | $home/lib | +| XDG_CONFIG_DIRS | /etc/xdg | ~/Library/Preferences
/Library/Application Support
/Library/Preferences | /lib | +| XDG_STATE_HOME | ~/.local/state | ~/Library/Application Support | $home/lib/state | +| XDG_CACHE_HOME | ~/.cache | ~/Library/Caches | $home/lib/cache | +| XDG_RUNTIME_DIR | /run/user/UID | ~/Library/Application Support | /tmp | + +
+ +
+ Microsoft Windows +
+ +| |

Known Folder(s)

|

Fallback(s)

| +| :------------------------------------------------------------: | :---------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------: | +| XDG_DATA_HOME | LocalAppData | %LOCALAPPDATA% | +| XDG_DATA_DIRS | RoamingAppData
ProgramData | %APPADATA%
%ProgramData% | +| XDG_CONFIG_HOME | LocalAppData | %LOCALAPPDATA% | +| XDG_CONFIG_DIRS | ProgramData
RoamingAppData | %ProgramData%
%APPDATA% | +| XDG_STATE_HOME | LocalAppData | %LOCALAPPDATA% | +| XDG_CACHE_HOME | LocalAppData\cache | %LOCALAPPDATA%\cache | +| XDG_RUNTIME_DIR | LocalAppData | %LOCALAPPDATA% | + +
+ +### XDG user directories + +XDG user directories environment variables are usually **not** set on most +operating systems. However, if they are present in the environment, they take +precedence. Appropriate fallback locations are used for the environment +variables which are not set. + +- On Unix-like operating systems (except macOS and Plan 9), the package reads the [user-dirs.dirs](https://man.archlinux.org/man/user-dirs.dirs.5.en) config file. +- On Windows, the package uses the appropriate [Known Folders](https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid). + +Lastly, default locations are used for any user directories which are not set, +as shown in the following tables. + +
+ Unix-like operating systems +
+ +| |

Unix

|

macOS

|

Plan 9

| +| :--------------------------------------------------------------: | :-------------------------------------------------------------------------: | :---------------------------------------------------------------------------: | :---------------------------------------------------------------------------: | +| XDG_DESKTOP_DIR | ~/Desktop | ~/Desktop | $home/desktop | +| XDG_DOWNLOAD_DIR | ~/Downloads | ~/Downloads | $home/downloads | +| XDG_DOCUMENTS_DIR | ~/Documents | ~/Documents | $home/documents | +| XDG_MUSIC_DIR | ~/Music | ~/Music | $home/music | +| XDG_PICTURES_DIR | ~/Pictures | ~/Pictures | $home/pictures | +| XDG_VIDEOS_DIR | ~/Videos | ~/Movies | $home/videos | +| XDG_TEMPLATES_DIR | ~/Templates | ~/Templates | $home/templates | +| XDG_PUBLICSHARE_DIR | ~/Public | ~/Public | $home/public | + +
+ +
+ Microsoft Windows +
+ +| |

Known Folder(s)

|

Fallback(s)

| +| :--------------------------------------------------------------: | :-----------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------: | +| XDG_DESKTOP_DIR | Desktop | %USERPROFILE%\Desktop | +| XDG_DOWNLOAD_DIR | Downloads | %USERPROFILE%\Downloads | +| XDG_DOCUMENTS_DIR | Documents | %USERPROFILE%\Documents | +| XDG_MUSIC_DIR | Music | %USERPROFILE%\Music | +| XDG_PICTURES_DIR | Pictures | %USERPROFILE%\Pictures | +| XDG_VIDEOS_DIR | Videos | %USERPROFILE%\Videos | +| XDG_TEMPLATES_DIR | Templates | %APPDATA%\Microsoft\Windows\Templates | +| XDG_PUBLICSHARE_DIR | Public | %PUBLIC% | + +
+ +### Other directories + +
+ Unix-like operating systems +
+ +| |

Unix

|

macOS

|

Plan 9

| +| :-----------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------: | +| Home | $HOME | $HOME | $home | +| Applications | $XDG_DATA_HOME/applications
~/.local/share/applications
/usr/local/share/applications
/usr/share/applications
$XDG_DATA_DIRS/applications | /Applications | $home/bin
/bin | +| Fonts | $XDG_DATA_HOME/fonts
~/.fonts
~/.local/share/fonts
/usr/local/share/fonts
/usr/share/fonts
$XDG_DATA_DIRS/fonts | ~/Library/Fonts
/Library/Fonts
/System/Library/Fonts
/Network/Library/Fonts | $home/lib/font
/lib/font | + +
+ +
+ Microsoft Windows +
+ +| |

Known Folder(s)

|

Fallback(s)

| +| :-----------------------------------------------------------: | :--------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------: | +| Home | Profile | %USERPROFILE% | +| Applications | Programs
CommonPrograms | %APPDATA%\Microsoft\Windows\Start Menu\Programs
%ProgramData%\Microsoft\Windows\Start Menu\Programs | +| Fonts | Fonts | %SystemRoot%\Fonts
%LOCALAPPDATA%\Microsoft\Windows\Fonts | + +
+ +## Usage + +#### XDG Base Directory + +```go +package main + +import ( + "log" + + "github.com/adrg/xdg" +) + +func main() { + // XDG Base Directory paths. + log.Println("Home data directory:", xdg.DataHome) + log.Println("Data directories:", xdg.DataDirs) + log.Println("Home config directory:", xdg.ConfigHome) + log.Println("Config directories:", xdg.ConfigDirs) + log.Println("Home state directory:", xdg.StateHome) + log.Println("Cache directory:", xdg.CacheHome) + log.Println("Runtime directory:", xdg.RuntimeDir) + + // Other common directories. + log.Println("Home directory:", xdg.Home) + log.Println("Application directories:", xdg.ApplicationDirs) + log.Println("Font directories:", xdg.FontDirs) + + // Obtain a suitable location for application config files. + // ConfigFile takes one parameter which must contain the name of the file, + // but it can also contain a set of parent directories. If the directories + // don't exist, they will be created relative to the base config directory. + configFilePath, err := xdg.ConfigFile("appname/config.yaml") + if err != nil { + log.Fatal(err) + } + log.Println("Save the config file at:", configFilePath) + + // For other types of application files use: + // xdg.DataFile() + // xdg.StateFile() + // xdg.CacheFile() + // xdg.RuntimeFile() + + // Finding application config files. + // SearchConfigFile takes one parameter which must contain the name of + // the file, but it can also contain a set of parent directories relative + // to the config search paths (xdg.ConfigHome and xdg.ConfigDirs). + configFilePath, err = xdg.SearchConfigFile("appname/config.yaml") + if err != nil { + log.Fatal(err) + } + log.Println("Config file was found at:", configFilePath) + + // For other types of application files use: + // xdg.SearchDataFile() + // xdg.SearchStateFile() + // xdg.SearchCacheFile() + // xdg.SearchRuntimeFile() +} +``` + +#### XDG user directories + +```go +package main + +import ( + "log" + + "github.com/adrg/xdg" +) + +func main() { + // XDG user directories. + log.Println("Desktop directory:", xdg.UserDirs.Desktop) + log.Println("Download directory:", xdg.UserDirs.Download) + log.Println("Documents directory:", xdg.UserDirs.Documents) + log.Println("Music directory:", xdg.UserDirs.Music) + log.Println("Pictures directory:", xdg.UserDirs.Pictures) + log.Println("Videos directory:", xdg.UserDirs.Videos) + log.Println("Templates directory:", xdg.UserDirs.Templates) + log.Println("Public directory:", xdg.UserDirs.PublicShare) +} +``` + +## Stargazers over time + +[![Stargazers over time](https://starchart.cc/adrg/xdg.svg)](https://starchart.cc/adrg/xdg) + +## Contributing + +Contributions in the form of pull requests, issues or just general feedback, +are always welcome. +See [CONTRIBUTING.MD](CONTRIBUTING.md). + +**Contributors**: +[adrg](https://github.com/adrg), +[wichert](https://github.com/wichert), +[bouncepaw](https://github.com/bouncepaw), +[gabriel-vasile](https://github.com/gabriel-vasile), +[KalleDK](https://github.com/KalleDK), +[nvkv](https://github.com/nvkv), +[djdv](https://github.com/djdv), +[rrjjvv](https://github.com/rrjjvv), +[GreyXor](https://github.com/GreyXor), +[Rican7](https://github.com/Rican7). + +## References + +For more information see: +* [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) +* [XDG user directories](https://wiki.archlinux.org/index.php/XDG_user_directories) +* [Windows Known Folders](https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid) + +## License + +Copyright (c) 2014 Adrian-George Bostan. + +This project is licensed under the [MIT license](https://opensource.org/licenses/MIT). +See [LICENSE](LICENSE) for more details. diff --git a/vendor/github.com/adrg/xdg/base_dirs.go b/vendor/github.com/adrg/xdg/base_dirs.go new file mode 100644 index 0000000..a8a3fd5 --- /dev/null +++ b/vendor/github.com/adrg/xdg/base_dirs.go @@ -0,0 +1,68 @@ +package xdg + +import "github.com/adrg/xdg/internal/pathutil" + +// XDG Base Directory environment variables. +const ( + envDataHome = "XDG_DATA_HOME" + envDataDirs = "XDG_DATA_DIRS" + envConfigHome = "XDG_CONFIG_HOME" + envConfigDirs = "XDG_CONFIG_DIRS" + envStateHome = "XDG_STATE_HOME" + envCacheHome = "XDG_CACHE_HOME" + envRuntimeDir = "XDG_RUNTIME_DIR" +) + +type baseDirectories struct { + dataHome string + data []string + configHome string + config []string + stateHome string + cacheHome string + runtime string + + // Non-standard directories. + fonts []string + applications []string +} + +func (bd baseDirectories) dataFile(relPath string) (string, error) { + return pathutil.Create(relPath, append([]string{bd.dataHome}, bd.data...)) +} + +func (bd baseDirectories) configFile(relPath string) (string, error) { + return pathutil.Create(relPath, append([]string{bd.configHome}, bd.config...)) +} + +func (bd baseDirectories) stateFile(relPath string) (string, error) { + return pathutil.Create(relPath, []string{bd.stateHome}) +} + +func (bd baseDirectories) cacheFile(relPath string) (string, error) { + return pathutil.Create(relPath, []string{bd.cacheHome}) +} + +func (bd baseDirectories) runtimeFile(relPath string) (string, error) { + return pathutil.Create(relPath, []string{bd.runtime}) +} + +func (bd baseDirectories) searchDataFile(relPath string) (string, error) { + return pathutil.Search(relPath, append([]string{bd.dataHome}, bd.data...)) +} + +func (bd baseDirectories) searchConfigFile(relPath string) (string, error) { + return pathutil.Search(relPath, append([]string{bd.configHome}, bd.config...)) +} + +func (bd baseDirectories) searchStateFile(relPath string) (string, error) { + return pathutil.Search(relPath, []string{bd.stateHome}) +} + +func (bd baseDirectories) searchCacheFile(relPath string) (string, error) { + return pathutil.Search(relPath, []string{bd.cacheHome}) +} + +func (bd baseDirectories) searchRuntimeFile(relPath string) (string, error) { + return pathutil.Search(relPath, []string{bd.runtime}) +} diff --git a/vendor/github.com/adrg/xdg/codecov.yml b/vendor/github.com/adrg/xdg/codecov.yml new file mode 100644 index 0000000..54ee338 --- /dev/null +++ b/vendor/github.com/adrg/xdg/codecov.yml @@ -0,0 +1,11 @@ +coverage: + status: + project: + default: + target: 90% + threshold: 1% + patch: + default: + target: 100% +ignore: + - "paths_plan9.go" diff --git a/vendor/github.com/adrg/xdg/doc.go b/vendor/github.com/adrg/xdg/doc.go new file mode 100644 index 0000000..7dfa973 --- /dev/null +++ b/vendor/github.com/adrg/xdg/doc.go @@ -0,0 +1,101 @@ +/* +Package xdg provides an implementation of the XDG Base Directory Specification. +The specification defines a set of standard paths for storing application files +including data and configuration files. For portability and flexibility reasons, +applications should use the XDG defined locations instead of hardcoding paths. +The package also includes the locations of well known user directories. + +The current implementation supports most flavors of Unix, Windows, Mac OS and Plan 9. + + For more information regarding the XDG Base Directory Specification see: + https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html + + For more information regarding the XDG user directories see: + https://wiki.archlinux.org/index.php/XDG_user_directories + + For more information regarding the Windows Known Folders see: + https://docs.microsoft.com/en-us/windows/win32/shell/known-folders + +# Usage + +XDG Base Directory + + package main + + import ( + "log" + + "github.com/adrg/xdg" + ) + + func main() { + // XDG Base Directory paths. + log.Println("Home data directory:", xdg.DataHome) + log.Println("Data directories:", xdg.DataDirs) + log.Println("Home config directory:", xdg.ConfigHome) + log.Println("Config directories:", xdg.ConfigDirs) + log.Println("Home state directory:", xdg.StateHome) + log.Println("Cache directory:", xdg.CacheHome) + log.Println("Runtime directory:", xdg.RuntimeDir) + + // Other common directories. + log.Println("Home directory:", xdg.Home) + log.Println("Application directories:", xdg.ApplicationDirs) + log.Println("Font directories:", xdg.FontDirs) + + // Obtain a suitable location for application config files. + // ConfigFile takes one parameter which must contain the name of the file, + // but it can also contain a set of parent directories. If the directories + // don't exist, they will be created relative to the base config directory. + configFilePath, err := xdg.ConfigFile("appname/config.yaml") + if err != nil { + log.Fatal(err) + } + log.Println("Save the config file at:", configFilePath) + + // For other types of application files use: + // xdg.DataFile() + // xdg.StateFile() + // xdg.CacheFile() + // xdg.RuntimeFile() + + // Finding application config files. + // SearchConfigFile takes one parameter which must contain the name of + // the file, but it can also contain a set of parent directories relative + // to the config search paths (xdg.ConfigHome and xdg.ConfigDirs). + configFilePath, err = xdg.SearchConfigFile("appname/config.yaml") + if err != nil { + log.Fatal(err) + } + log.Println("Config file was found at:", configFilePath) + + // For other types of application files use: + // xdg.SearchDataFile() + // xdg.SearchStateFile() + // xdg.SearchCacheFile() + // xdg.SearchRuntimeFile() + } + +XDG user directories + + package main + + import ( + "log" + + "github.com/adrg/xdg" + ) + + func main() { + // XDG user directories. + log.Println("Desktop directory:", xdg.UserDirs.Desktop) + log.Println("Download directory:", xdg.UserDirs.Download) + log.Println("Documents directory:", xdg.UserDirs.Documents) + log.Println("Music directory:", xdg.UserDirs.Music) + log.Println("Pictures directory:", xdg.UserDirs.Pictures) + log.Println("Videos directory:", xdg.UserDirs.Videos) + log.Println("Templates directory:", xdg.UserDirs.Templates) + log.Println("Public directory:", xdg.UserDirs.PublicShare) + } +*/ +package xdg diff --git a/vendor/github.com/adrg/xdg/internal/pathutil/pathutil.go b/vendor/github.com/adrg/xdg/internal/pathutil/pathutil.go new file mode 100644 index 0000000..554eda6 --- /dev/null +++ b/vendor/github.com/adrg/xdg/internal/pathutil/pathutil.go @@ -0,0 +1,117 @@ +package pathutil + +import ( + "fmt" + "os" + "path/filepath" + "strings" +) + +// Unique eliminates the duplicate paths from the provided slice and returns +// the result. The paths are expanded using the `ExpandHome` function and only +// absolute paths are kept. The items in the output slice are in the order in +// which they occur in the input slice. +func Unique(paths []string) []string { + var ( + uniq []string + registry = map[string]struct{}{} + ) + + for _, p := range paths { + if p = ExpandHome(p); p != "" && filepath.IsAbs(p) { + if _, ok := registry[p]; ok { + continue + } + + registry[p] = struct{}{} + uniq = append(uniq, p) + } + } + + return uniq +} + +// First returns the first absolute path from the provided slice. +// The paths in the input slice are expanded using the `ExpandHome` function. +func First(paths []string) string { + for _, p := range paths { + if p = ExpandHome(p); p != "" && filepath.IsAbs(p) { + return p + } + } + + return "" +} + +// Create returns a suitable location relative to which the file with the +// specified `name` can be written. The first path from the provided `paths` +// slice which is successfully created (or already exists) is used as a base +// path for the file. The `name` parameter should contain the name of the file +// which is going to be written in the location returned by this function, but +// it can also contain a set of parent directories, which will be created +// relative to the selected parent path. +func Create(name string, paths []string) (string, error) { + searchedPaths := make([]string, 0, len(paths)) + + for _, p := range paths { + p = filepath.Join(p, name) + + dir := filepath.Dir(p) + if Exists(dir) { + return p, nil + } + if err := os.MkdirAll(dir, os.ModeDir|0o700); err == nil { + return p, nil + } + + searchedPaths = append(searchedPaths, dir) + } + + return "", fmt.Errorf("could not create any of the following paths: %s", + strings.Join(searchedPaths, ", ")) +} + +// Search searches for the file with the specified `name` in the provided +// slice of `paths`. The `name` parameter must contain the name of the file, +// but it can also contain a set of parent directories. +func Search(name string, paths []string) (string, error) { + searchedPaths := make([]string, 0, len(paths)) + + for _, p := range paths { + p = filepath.Join(p, name) + if Exists(p) { + return p, nil + } + + searchedPaths = append(searchedPaths, filepath.Dir(p)) + } + + return "", fmt.Errorf("could not locate `%s` in any of the following paths: %s", + filepath.Base(name), strings.Join(searchedPaths, ", ")) +} + +// EnvPath returns the value of the environment variable with the specified +// `name` if it is an absolute path, or the first absolute fallback path. +// All paths are expanded using the `ExpandHome` function. +func EnvPath(name string, fallbackPaths ...string) string { + dir := ExpandHome(os.Getenv(name)) + if dir != "" && filepath.IsAbs(dir) { + return dir + } + + return First(fallbackPaths) +} + +// EnvPathList reads the value of the environment variable with the specified +// `name` and attempts to extract a list of absolute paths from it. If there +// are none, a list of absolute fallback paths is returned instead. Duplicate +// paths are removed from the returned slice. All paths are expanded using the +// `ExpandHome` function. +func EnvPathList(name string, fallbackPaths ...string) []string { + dirs := Unique(filepath.SplitList(os.Getenv(name))) + if len(dirs) != 0 { + return dirs + } + + return Unique(fallbackPaths) +} diff --git a/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_plan9.go b/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_plan9.go new file mode 100644 index 0000000..a6e378a --- /dev/null +++ b/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_plan9.go @@ -0,0 +1,40 @@ +package pathutil + +import ( + "errors" + "io/fs" + "os" + "path/filepath" + "strings" +) + +// UserHomeDir returns the home directory of the current user. +func UserHomeDir() string { + if home := os.Getenv("home"); home != "" { + return home + } + + return "/" +} + +// Exists returns true if the specified path exists. +func Exists(path string) bool { + _, err := os.Stat(path) + return err == nil || errors.Is(err, fs.ErrExist) +} + +// ExpandHome substitutes `~` and `$home` at the start of the specified `path`. +func ExpandHome(path string) string { + home := UserHomeDir() + if path == "" || home == "" { + return path + } + if path[0] == '~' { + return filepath.Join(home, path[1:]) + } + if strings.HasPrefix(path, "$home") { + return filepath.Join(home, path[5:]) + } + + return path +} diff --git a/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_unix.go b/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_unix.go new file mode 100644 index 0000000..3114a8c --- /dev/null +++ b/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_unix.go @@ -0,0 +1,42 @@ +//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || nacl || linux || netbsd || openbsd || solaris + +package pathutil + +import ( + "errors" + "io/fs" + "os" + "path/filepath" + "strings" +) + +// UserHomeDir returns the home directory of the current user. +func UserHomeDir() string { + if home := os.Getenv("HOME"); home != "" { + return home + } + + return "/" +} + +// Exists returns true if the specified path exists. +func Exists(path string) bool { + _, err := os.Stat(path) + return err == nil || errors.Is(err, fs.ErrExist) +} + +// ExpandHome substitutes `~` and `$HOME` at the start of the specified `path`. +func ExpandHome(path string) string { + home := UserHomeDir() + if path == "" || home == "" { + return path + } + if path[0] == '~' { + return filepath.Join(home, path[1:]) + } + if strings.HasPrefix(path, "$HOME") { + return filepath.Join(home, path[5:]) + } + + return path +} diff --git a/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_windows.go b/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_windows.go new file mode 100644 index 0000000..5b18155 --- /dev/null +++ b/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_windows.go @@ -0,0 +1,71 @@ +package pathutil + +import ( + "errors" + "io/fs" + "os" + "path/filepath" + "strings" + + "golang.org/x/sys/windows" +) + +// UserHomeDir returns the home directory of the current user. +func UserHomeDir() string { + return KnownFolder(windows.FOLDERID_Profile, []string{"USERPROFILE"}, nil) +} + +// Exists returns true if the specified path exists. +func Exists(path string) bool { + fi, err := os.Lstat(path) + if fi != nil && fi.Mode()&os.ModeSymlink != 0 { + _, err = filepath.EvalSymlinks(path) + } + + return err == nil || errors.Is(err, fs.ErrExist) +} + +// ExpandHome substitutes `%USERPROFILE%` at the start of the specified `path`. +func ExpandHome(path string) string { + home := UserHomeDir() + if path == "" || home == "" { + return path + } + if strings.HasPrefix(path, `%USERPROFILE%`) { + return filepath.Join(home, path[13:]) + } + + return path +} + +// KnownFolder returns the location of the folder with the specified ID. +// If that fails, the folder location is determined by reading the provided +// environment variables (the first non-empty read value is returned). +// If that fails as well, the first non-empty fallback is returned. +// If all of the above fails, the function returns an empty string. +func KnownFolder(id *windows.KNOWNFOLDERID, envVars []string, fallbacks []string) string { + if id != nil { + flags := []uint32{windows.KF_FLAG_DEFAULT, windows.KF_FLAG_DEFAULT_PATH} + for _, flag := range flags { + p, _ := windows.KnownFolderPath(id, flag|windows.KF_FLAG_DONT_VERIFY) + if p != "" { + return p + } + } + } + + for _, envVar := range envVars { + p := os.Getenv(envVar) + if p != "" { + return p + } + } + + for _, fallback := range fallbacks { + if fallback != "" { + return fallback + } + } + + return "" +} diff --git a/vendor/github.com/adrg/xdg/internal/userdirs/config_unix.go b/vendor/github.com/adrg/xdg/internal/userdirs/config_unix.go new file mode 100644 index 0000000..ac7efb9 --- /dev/null +++ b/vendor/github.com/adrg/xdg/internal/userdirs/config_unix.go @@ -0,0 +1,82 @@ +//go:build aix || dragonfly || freebsd || (js && wasm) || nacl || linux || netbsd || openbsd || solaris + +package userdirs + +import ( + "bufio" + "io" + "os" + "strings" + + "github.com/adrg/xdg/internal/pathutil" +) + +// ParseConfigFile parses the user directories config file at the +// specified location. +func ParseConfigFile(name string) (*Directories, error) { + f, err := os.Open(name) + if err != nil { + return nil, err + } + defer f.Close() + + return ParseConfig(f) +} + +// ParseConfig parses the user directories config file contained in +// the provided reader. +func ParseConfig(r io.Reader) (*Directories, error) { + dirs := &Directories{} + fieldsMap := map[string]*string{ + EnvDesktopDir: &dirs.Desktop, + EnvDownloadDir: &dirs.Download, + EnvDocumentsDir: &dirs.Documents, + EnvMusicDir: &dirs.Music, + EnvPicturesDir: &dirs.Pictures, + EnvVideosDir: &dirs.Videos, + EnvTemplatesDir: &dirs.Templates, + EnvPublicShareDir: &dirs.PublicShare, + } + + scanner := bufio.NewScanner(r) + for scanner.Scan() { + line := strings.TrimSpace(scanner.Text()) + if len(line) == 0 || line[0] == '#' { + continue + } + if !strings.HasPrefix(line, "XDG_") { + continue + } + + parts := strings.Split(line, "=") + if len(parts) < 2 { + continue + } + + // Parse key. + field, ok := fieldsMap[strings.TrimSpace(parts[0])] + if !ok { + continue + } + + // Parse value. + runes := []rune(strings.TrimSpace(parts[1])) + + lenRunes := len(runes) + if lenRunes <= 2 || runes[0] != '"' { + continue + } + + for i := 1; i < lenRunes; i++ { + if runes[i] == '"' { + *field = pathutil.ExpandHome(string(runes[1:i])) + break + } + } + } + if err := scanner.Err(); err != nil { + return nil, err + } + + return dirs, nil +} diff --git a/vendor/github.com/adrg/xdg/internal/userdirs/userdirs.go b/vendor/github.com/adrg/xdg/internal/userdirs/userdirs.go new file mode 100644 index 0000000..b3c30cf --- /dev/null +++ b/vendor/github.com/adrg/xdg/internal/userdirs/userdirs.go @@ -0,0 +1,40 @@ +package userdirs + +// XDG user directories environment variables. +const ( + EnvDesktopDir = "XDG_DESKTOP_DIR" + EnvDownloadDir = "XDG_DOWNLOAD_DIR" + EnvDocumentsDir = "XDG_DOCUMENTS_DIR" + EnvMusicDir = "XDG_MUSIC_DIR" + EnvPicturesDir = "XDG_PICTURES_DIR" + EnvVideosDir = "XDG_VIDEOS_DIR" + EnvTemplatesDir = "XDG_TEMPLATES_DIR" + EnvPublicShareDir = "XDG_PUBLICSHARE_DIR" +) + +// Directories defines the locations of well known user directories. +type Directories struct { + // Desktop defines the location of the user's desktop directory. + Desktop string + + // Download defines a suitable location for user downloaded files. + Download string + + // Documents defines a suitable location for user document files. + Documents string + + // Music defines a suitable location for user audio files. + Music string + + // Pictures defines a suitable location for user image files. + Pictures string + + // VideosDir defines a suitable location for user video files. + Videos string + + // Templates defines a suitable location for user template files. + Templates string + + // PublicShare defines a suitable location for user shared files. + PublicShare string +} diff --git a/vendor/github.com/adrg/xdg/paths_darwin.go b/vendor/github.com/adrg/xdg/paths_darwin.go new file mode 100644 index 0000000..ccf903b --- /dev/null +++ b/vendor/github.com/adrg/xdg/paths_darwin.go @@ -0,0 +1,54 @@ +package xdg + +import ( + "path/filepath" + + "github.com/adrg/xdg/internal/pathutil" + "github.com/adrg/xdg/internal/userdirs" +) + +func initDirs(home string) { + initBaseDirs(home) + initUserDirs(home) +} + +func initBaseDirs(home string) { + homeAppSupport := filepath.Join(home, "Library", "Application Support") + rootAppSupport := "/Library/Application Support" + + // Initialize standard directories. + baseDirs.dataHome = pathutil.EnvPath(envDataHome, homeAppSupport) + baseDirs.data = pathutil.EnvPathList(envDataDirs, rootAppSupport) + baseDirs.configHome = pathutil.EnvPath(envConfigHome, homeAppSupport) + baseDirs.config = pathutil.EnvPathList(envConfigDirs, + filepath.Join(home, "Library", "Preferences"), + rootAppSupport, + "/Library/Preferences", + ) + baseDirs.stateHome = pathutil.EnvPath(envStateHome, homeAppSupport) + baseDirs.cacheHome = pathutil.EnvPath(envCacheHome, filepath.Join(home, "Library", "Caches")) + baseDirs.runtime = pathutil.EnvPath(envRuntimeDir, homeAppSupport) + + // Initialize non-standard directories. + baseDirs.applications = []string{ + "/Applications", + } + + baseDirs.fonts = []string{ + filepath.Join(home, "Library/Fonts"), + "/Library/Fonts", + "/System/Library/Fonts", + "/Network/Library/Fonts", + } +} + +func initUserDirs(home string) { + UserDirs.Desktop = pathutil.EnvPath(userdirs.EnvDesktopDir, filepath.Join(home, "Desktop")) + UserDirs.Download = pathutil.EnvPath(userdirs.EnvDownloadDir, filepath.Join(home, "Downloads")) + UserDirs.Documents = pathutil.EnvPath(userdirs.EnvDocumentsDir, filepath.Join(home, "Documents")) + UserDirs.Music = pathutil.EnvPath(userdirs.EnvMusicDir, filepath.Join(home, "Music")) + UserDirs.Pictures = pathutil.EnvPath(userdirs.EnvPicturesDir, filepath.Join(home, "Pictures")) + UserDirs.Videos = pathutil.EnvPath(userdirs.EnvVideosDir, filepath.Join(home, "Movies")) + UserDirs.Templates = pathutil.EnvPath(userdirs.EnvTemplatesDir, filepath.Join(home, "Templates")) + UserDirs.PublicShare = pathutil.EnvPath(userdirs.EnvPublicShareDir, filepath.Join(home, "Public")) +} diff --git a/vendor/github.com/adrg/xdg/paths_plan9.go b/vendor/github.com/adrg/xdg/paths_plan9.go new file mode 100644 index 0000000..0cab83c --- /dev/null +++ b/vendor/github.com/adrg/xdg/paths_plan9.go @@ -0,0 +1,49 @@ +package xdg + +import ( + "path/filepath" + + "github.com/adrg/xdg/internal/pathutil" + "github.com/adrg/xdg/internal/userdirs" +) + +func initDirs(home string) { + initBaseDirs(home) + initUserDirs(home) +} + +func initBaseDirs(home string) { + homeLibDir := filepath.Join(home, "lib") + rootLibDir := "/lib" + + // Initialize standard directories. + baseDirs.dataHome = pathutil.EnvPath(envDataHome, homeLibDir) + baseDirs.data = pathutil.EnvPathList(envDataDirs, rootLibDir) + baseDirs.configHome = pathutil.EnvPath(envConfigHome, homeLibDir) + baseDirs.config = pathutil.EnvPathList(envConfigDirs, rootLibDir) + baseDirs.stateHome = pathutil.EnvPath(envStateHome, filepath.Join(homeLibDir, "state")) + baseDirs.cacheHome = pathutil.EnvPath(envCacheHome, filepath.Join(homeLibDir, "cache")) + baseDirs.runtime = pathutil.EnvPath(envRuntimeDir, "/tmp") + + // Initialize non-standard directories. + baseDirs.applications = []string{ + filepath.Join(home, "bin"), + "/bin", + } + + baseDirs.fonts = []string{ + filepath.Join(homeLibDir, "font"), + "/lib/font", + } +} + +func initUserDirs(home string) { + UserDirs.Desktop = pathutil.EnvPath(userdirs.EnvDesktopDir, filepath.Join(home, "desktop")) + UserDirs.Download = pathutil.EnvPath(userdirs.EnvDownloadDir, filepath.Join(home, "downloads")) + UserDirs.Documents = pathutil.EnvPath(userdirs.EnvDocumentsDir, filepath.Join(home, "documents")) + UserDirs.Music = pathutil.EnvPath(userdirs.EnvMusicDir, filepath.Join(home, "music")) + UserDirs.Pictures = pathutil.EnvPath(userdirs.EnvPicturesDir, filepath.Join(home, "pictures")) + UserDirs.Videos = pathutil.EnvPath(userdirs.EnvVideosDir, filepath.Join(home, "videos")) + UserDirs.Templates = pathutil.EnvPath(userdirs.EnvTemplatesDir, filepath.Join(home, "templates")) + UserDirs.PublicShare = pathutil.EnvPath(userdirs.EnvPublicShareDir, filepath.Join(home, "public")) +} diff --git a/vendor/github.com/adrg/xdg/paths_unix.go b/vendor/github.com/adrg/xdg/paths_unix.go new file mode 100644 index 0000000..dd98839 --- /dev/null +++ b/vendor/github.com/adrg/xdg/paths_unix.go @@ -0,0 +1,68 @@ +//go:build aix || dragonfly || freebsd || (js && wasm) || nacl || linux || netbsd || openbsd || solaris + +package xdg + +import ( + "os" + "path/filepath" + "strconv" + + "github.com/adrg/xdg/internal/pathutil" + "github.com/adrg/xdg/internal/userdirs" +) + +func initDirs(home string) { + initBaseDirs(home) + initUserDirs(home, baseDirs.configHome) +} + +func initBaseDirs(home string) { + // Initialize standard directories. + baseDirs.dataHome = pathutil.EnvPath(envDataHome, filepath.Join(home, ".local", "share")) + baseDirs.data = pathutil.EnvPathList(envDataDirs, "/usr/local/share", "/usr/share") + baseDirs.configHome = pathutil.EnvPath(envConfigHome, filepath.Join(home, ".config")) + baseDirs.config = pathutil.EnvPathList(envConfigDirs, "/etc/xdg") + baseDirs.stateHome = pathutil.EnvPath(envStateHome, filepath.Join(home, ".local", "state")) + baseDirs.cacheHome = pathutil.EnvPath(envCacheHome, filepath.Join(home, ".cache")) + baseDirs.runtime = pathutil.EnvPath(envRuntimeDir, filepath.Join("/run/user", strconv.Itoa(os.Getuid()))) + + // Initialize non-standard directories. + appDirs := []string{ + filepath.Join(baseDirs.dataHome, "applications"), + filepath.Join(home, ".local/share/applications"), + "/usr/local/share/applications", + "/usr/share/applications", + } + + fontDirs := []string{ + filepath.Join(baseDirs.dataHome, "fonts"), + filepath.Join(home, ".fonts"), + filepath.Join(home, ".local/share/fonts"), + "/usr/local/share/fonts", + "/usr/share/fonts", + } + + for _, dir := range baseDirs.data { + appDirs = append(appDirs, filepath.Join(dir, "applications")) + fontDirs = append(fontDirs, filepath.Join(dir, "fonts")) + } + + baseDirs.applications = pathutil.Unique(appDirs) + baseDirs.fonts = pathutil.Unique(fontDirs) +} + +func initUserDirs(home, configHome string) { + dirs, err := userdirs.ParseConfigFile(filepath.Join(configHome, "user-dirs.dirs")) + if err != nil { + dirs = &UserDirectories{} + } + + UserDirs.Desktop = pathutil.EnvPath(userdirs.EnvDesktopDir, dirs.Desktop, filepath.Join(home, "Desktop")) + UserDirs.Download = pathutil.EnvPath(userdirs.EnvDownloadDir, dirs.Download, filepath.Join(home, "Downloads")) + UserDirs.Documents = pathutil.EnvPath(userdirs.EnvDocumentsDir, dirs.Documents, filepath.Join(home, "Documents")) + UserDirs.Music = pathutil.EnvPath(userdirs.EnvMusicDir, dirs.Music, filepath.Join(home, "Music")) + UserDirs.Pictures = pathutil.EnvPath(userdirs.EnvPicturesDir, dirs.Pictures, filepath.Join(home, "Pictures")) + UserDirs.Videos = pathutil.EnvPath(userdirs.EnvVideosDir, dirs.Videos, filepath.Join(home, "Videos")) + UserDirs.Templates = pathutil.EnvPath(userdirs.EnvTemplatesDir, dirs.Templates, filepath.Join(home, "Templates")) + UserDirs.PublicShare = pathutil.EnvPath(userdirs.EnvPublicShareDir, dirs.PublicShare, filepath.Join(home, "Public")) +} diff --git a/vendor/github.com/adrg/xdg/paths_windows.go b/vendor/github.com/adrg/xdg/paths_windows.go new file mode 100644 index 0000000..eaac2d3 --- /dev/null +++ b/vendor/github.com/adrg/xdg/paths_windows.go @@ -0,0 +1,161 @@ +package xdg + +import ( + "path/filepath" + + "github.com/adrg/xdg/internal/pathutil" + "github.com/adrg/xdg/internal/userdirs" + "golang.org/x/sys/windows" +) + +func initDirs(home string) { + kf := initKnownFolders(home) + initBaseDirs(home, kf) + initUserDirs(home, kf) +} + +func initBaseDirs(home string, kf *knownFolders) { + // Initialize standard directories. + baseDirs.dataHome = pathutil.EnvPath(envDataHome, kf.localAppData) + baseDirs.data = pathutil.EnvPathList(envDataDirs, kf.roamingAppData, kf.programData) + baseDirs.configHome = pathutil.EnvPath(envConfigHome, kf.localAppData) + baseDirs.config = pathutil.EnvPathList(envConfigDirs, kf.programData, kf.roamingAppData) + baseDirs.stateHome = pathutil.EnvPath(envStateHome, kf.localAppData) + baseDirs.cacheHome = pathutil.EnvPath(envCacheHome, filepath.Join(kf.localAppData, "cache")) + baseDirs.runtime = pathutil.EnvPath(envRuntimeDir, kf.localAppData) + + // Initialize non-standard directories. + baseDirs.applications = []string{ + kf.programs, + kf.commonPrograms, + } + baseDirs.fonts = []string{ + kf.fonts, + filepath.Join(kf.localAppData, "Microsoft", "Windows", "Fonts"), + } +} + +func initUserDirs(home string, kf *knownFolders) { + UserDirs.Desktop = pathutil.EnvPath(userdirs.EnvDesktopDir, kf.desktop) + UserDirs.Download = pathutil.EnvPath(userdirs.EnvDownloadDir, kf.downloads) + UserDirs.Documents = pathutil.EnvPath(userdirs.EnvDocumentsDir, kf.documents) + UserDirs.Music = pathutil.EnvPath(userdirs.EnvMusicDir, kf.music) + UserDirs.Pictures = pathutil.EnvPath(userdirs.EnvPicturesDir, kf.pictures) + UserDirs.Videos = pathutil.EnvPath(userdirs.EnvVideosDir, kf.videos) + UserDirs.Templates = pathutil.EnvPath(userdirs.EnvTemplatesDir, kf.templates) + UserDirs.PublicShare = pathutil.EnvPath(userdirs.EnvPublicShareDir, kf.public) +} + +type knownFolders struct { + systemDrive string + systemRoot string + programData string + userProfile string + userProfiles string + roamingAppData string + localAppData string + desktop string + downloads string + documents string + music string + pictures string + videos string + templates string + public string + fonts string + programs string + commonPrograms string +} + +func initKnownFolders(home string) *knownFolders { + kf := &knownFolders{ + userProfile: home, + } + kf.systemDrive = filepath.VolumeName(pathutil.KnownFolder( + windows.FOLDERID_Windows, + []string{"SystemDrive", "SystemRoot", "windir"}, + []string{home, `C:`}, + )) + string(filepath.Separator) + kf.systemRoot = pathutil.KnownFolder( + windows.FOLDERID_Windows, + []string{"SystemRoot", "windir"}, + []string{filepath.Join(kf.systemDrive, "Windows")}, + ) + kf.programData = pathutil.KnownFolder( + windows.FOLDERID_ProgramData, + []string{"ProgramData", "ALLUSERSPROFILE"}, + []string{filepath.Join(kf.systemDrive, "ProgramData")}, + ) + kf.userProfiles = pathutil.KnownFolder( + windows.FOLDERID_UserProfiles, + nil, + []string{filepath.Join(kf.systemDrive, "Users")}, + ) + kf.roamingAppData = pathutil.KnownFolder( + windows.FOLDERID_RoamingAppData, + []string{"APPDATA"}, + []string{filepath.Join(home, "AppData", "Roaming")}, + ) + kf.localAppData = pathutil.KnownFolder( + windows.FOLDERID_LocalAppData, + []string{"LOCALAPPDATA"}, + []string{filepath.Join(home, "AppData", "Local")}, + ) + kf.desktop = pathutil.KnownFolder( + windows.FOLDERID_Desktop, + nil, + []string{filepath.Join(home, "Desktop")}, + ) + kf.downloads = pathutil.KnownFolder( + windows.FOLDERID_Downloads, + nil, + []string{filepath.Join(home, "Downloads")}, + ) + kf.documents = pathutil.KnownFolder( + windows.FOLDERID_Documents, + nil, + []string{filepath.Join(home, "Documents")}, + ) + kf.music = pathutil.KnownFolder( + windows.FOLDERID_Music, + nil, + []string{filepath.Join(home, "Music")}, + ) + kf.pictures = pathutil.KnownFolder( + windows.FOLDERID_Pictures, + nil, + []string{filepath.Join(home, "Pictures")}, + ) + kf.videos = pathutil.KnownFolder( + windows.FOLDERID_Videos, + nil, + []string{filepath.Join(home, "Videos")}, + ) + kf.templates = pathutil.KnownFolder( + windows.FOLDERID_Templates, + nil, + []string{filepath.Join(kf.roamingAppData, "Microsoft", "Windows", "Templates")}, + ) + kf.public = pathutil.KnownFolder( + windows.FOLDERID_Public, + []string{"PUBLIC"}, + []string{filepath.Join(kf.userProfiles, "Public")}, + ) + kf.fonts = pathutil.KnownFolder( + windows.FOLDERID_Fonts, + nil, + []string{filepath.Join(kf.systemRoot, "Fonts")}, + ) + kf.programs = pathutil.KnownFolder( + windows.FOLDERID_Programs, + nil, + []string{filepath.Join(kf.roamingAppData, "Microsoft", "Windows", "Start Menu", "Programs")}, + ) + kf.commonPrograms = pathutil.KnownFolder( + windows.FOLDERID_CommonPrograms, + nil, + []string{filepath.Join(kf.programData, "Microsoft", "Windows", "Start Menu", "Programs")}, + ) + + return kf +} diff --git a/vendor/github.com/adrg/xdg/xdg.go b/vendor/github.com/adrg/xdg/xdg.go new file mode 100644 index 0000000..32574ce --- /dev/null +++ b/vendor/github.com/adrg/xdg/xdg.go @@ -0,0 +1,201 @@ +package xdg + +import ( + "github.com/adrg/xdg/internal/pathutil" + "github.com/adrg/xdg/internal/userdirs" +) + +// UserDirectories defines the locations of well known user directories. +type UserDirectories = userdirs.Directories + +var ( + // Home contains the path of the user's home directory. + Home string + + // DataHome defines the base directory relative to which user-specific + // data files should be stored. This directory is defined by the + // $XDG_DATA_HOME environment variable. If the variable is not set, + // a default equal to $HOME/.local/share should be used. + DataHome string + + // DataDirs defines the preference-ordered set of base directories to + // search for data files in addition to the DataHome base directory. + // This set of directories is defined by the $XDG_DATA_DIRS environment + // variable. If the variable is not set, the default directories + // to be used are /usr/local/share and /usr/share, in that order. The + // DataHome directory is considered more important than any of the + // directories defined by DataDirs. Therefore, user data files should be + // written relative to the DataHome directory, if possible. + DataDirs []string + + // ConfigHome defines the base directory relative to which user-specific + // configuration files should be written. This directory is defined by + // the $XDG_CONFIG_HOME environment variable. If the variable is + // not set, a default equal to $HOME/.config should be used. + ConfigHome string + + // ConfigDirs defines the preference-ordered set of base directories to + // search for configuration files in addition to the ConfigHome base + // directory. This set of directories is defined by the $XDG_CONFIG_DIRS + // environment variable. If the variable is not set, a default equal + // to /etc/xdg should be used. The ConfigHome directory is considered + // more important than any of the directories defined by ConfigDirs. + // Therefore, user config files should be written relative to the + // ConfigHome directory, if possible. + ConfigDirs []string + + // StateHome defines the base directory relative to which user-specific + // state files should be stored. This directory is defined by the + // $XDG_STATE_HOME environment variable. If the variable is not set, + // a default equal to ~/.local/state should be used. + StateHome string + + // CacheHome defines the base directory relative to which user-specific + // non-essential (cached) data should be written. This directory is + // defined by the $XDG_CACHE_HOME environment variable. If the variable + // is not set, a default equal to $HOME/.cache should be used. + CacheHome string + + // RuntimeDir defines the base directory relative to which user-specific + // non-essential runtime files and other file objects (such as sockets, + // named pipes, etc.) should be stored. This directory is defined by the + // $XDG_RUNTIME_DIR environment variable. If the variable is not set, + // applications should fall back to a replacement directory with similar + // capabilities. Applications should use this directory for communication + // and synchronization purposes and should not place larger files in it, + // since it might reside in runtime memory and cannot necessarily be + // swapped out to disk. + RuntimeDir string + + // UserDirs defines the locations of well known user directories. + UserDirs UserDirectories + + // FontDirs defines the common locations where font files are stored. + FontDirs []string + + // ApplicationDirs defines the common locations of applications. + ApplicationDirs []string + + // baseDirs defines the locations of base directories. + baseDirs baseDirectories +) + +func init() { + Reload() +} + +// Reload refreshes base and user directories by reading the environment. +// Defaults are applied for XDG variables which are empty or not present +// in the environment. +func Reload() { + // Initialize home directory. + Home = pathutil.UserHomeDir() + + // Initialize base and user directories. + initDirs(Home) + + // Set standard directories. + DataHome = baseDirs.dataHome + DataDirs = baseDirs.data + ConfigHome = baseDirs.configHome + ConfigDirs = baseDirs.config + StateHome = baseDirs.stateHome + CacheHome = baseDirs.cacheHome + RuntimeDir = baseDirs.runtime + + // Set non-standard directories. + FontDirs = baseDirs.fonts + ApplicationDirs = baseDirs.applications +} + +// DataFile returns a suitable location for the specified data file. +// The relPath parameter must contain the name of the data file, and +// optionally, a set of parent directories (e.g. appname/app.data). +// If the specified directories do not exist, they will be created relative +// to the base data directory. On failure, an error containing the +// attempted paths is returned. +func DataFile(relPath string) (string, error) { + return baseDirs.dataFile(relPath) +} + +// ConfigFile returns a suitable location for the specified config file. +// The relPath parameter must contain the name of the config file, and +// optionally, a set of parent directories (e.g. appname/app.yaml). +// If the specified directories do not exist, they will be created relative +// to the base config directory. On failure, an error containing the +// attempted paths is returned. +func ConfigFile(relPath string) (string, error) { + return baseDirs.configFile(relPath) +} + +// StateFile returns a suitable location for the specified state file. State +// files are usually volatile data files, not suitable to be stored relative +// to the $XDG_DATA_HOME directory. +// The relPath parameter must contain the name of the state file, and +// optionally, a set of parent directories (e.g. appname/app.state). +// If the specified directories do not exist, they will be created relative +// to the base state directory. On failure, an error containing the +// attempted paths is returned. +func StateFile(relPath string) (string, error) { + return baseDirs.stateFile(relPath) +} + +// CacheFile returns a suitable location for the specified cache file. +// The relPath parameter must contain the name of the cache file, and +// optionally, a set of parent directories (e.g. appname/app.cache). +// If the specified directories do not exist, they will be created relative +// to the base cache directory. On failure, an error containing the +// attempted paths is returned. +func CacheFile(relPath string) (string, error) { + return baseDirs.cacheFile(relPath) +} + +// RuntimeFile returns a suitable location for the specified runtime file. +// The relPath parameter must contain the name of the runtime file, and +// optionally, a set of parent directories (e.g. appname/app.pid). +// If the specified directories do not exist, they will be created relative +// to the base runtime directory. On failure, an error containing the +// attempted paths is returned. +func RuntimeFile(relPath string) (string, error) { + return baseDirs.runtimeFile(relPath) +} + +// SearchDataFile searches for specified file in the data search paths. +// The relPath parameter must contain the name of the data file, and +// optionally, a set of parent directories (e.g. appname/app.data). If the +// file cannot be found, an error specifying the searched paths is returned. +func SearchDataFile(relPath string) (string, error) { + return baseDirs.searchDataFile(relPath) +} + +// SearchConfigFile searches for the specified file in config search paths. +// The relPath parameter must contain the name of the config file, and +// optionally, a set of parent directories (e.g. appname/app.yaml). If the +// file cannot be found, an error specifying the searched paths is returned. +func SearchConfigFile(relPath string) (string, error) { + return baseDirs.searchConfigFile(relPath) +} + +// SearchStateFile searches for the specified file in the state search path. +// The relPath parameter must contain the name of the state file, and +// optionally, a set of parent directories (e.g. appname/app.state). If the +// file cannot be found, an error specifying the searched path is returned. +func SearchStateFile(relPath string) (string, error) { + return baseDirs.searchStateFile(relPath) +} + +// SearchCacheFile searches for the specified file in the cache search path. +// The relPath parameter must contain the name of the cache file, and +// optionally, a set of parent directories (e.g. appname/app.cache). If the +// file cannot be found, an error specifying the searched path is returned. +func SearchCacheFile(relPath string) (string, error) { + return baseDirs.searchCacheFile(relPath) +} + +// SearchRuntimeFile searches for the specified file in the runtime search path. +// The relPath parameter must contain the name of the runtime file, and +// optionally, a set of parent directories (e.g. appname/app.pid). If the +// file cannot be found, an error specifying the searched path is returned. +func SearchRuntimeFile(relPath string) (string, error) { + return baseDirs.searchRuntimeFile(relPath) +} diff --git a/vendor/github.com/alessio/shellescape/.gitignore b/vendor/github.com/alessio/shellescape/.gitignore new file mode 100644 index 0000000..4ba7c2d --- /dev/null +++ b/vendor/github.com/alessio/shellescape/.gitignore @@ -0,0 +1,28 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof + +.idea/ + +escargs diff --git a/vendor/github.com/alessio/shellescape/.golangci.yml b/vendor/github.com/alessio/shellescape/.golangci.yml new file mode 100644 index 0000000..836dabb --- /dev/null +++ b/vendor/github.com/alessio/shellescape/.golangci.yml @@ -0,0 +1,59 @@ +# run: +# # timeout for analysis, e.g. 30s, 5m, default is 1m +# timeout: 5m + +linters: + disable-all: true + enable: + - bodyclose + - dogsled + - goconst + - gocritic + - gofmt + - goimports + - gosec + - gosimple + - govet + - ineffassign + - misspell + - prealloc + - exportloopref + - revive + - staticcheck + - stylecheck + - typecheck + - unconvert + - unparam + - unused + - misspell + - wsl + +issues: + exclude-rules: + - text: "Use of weak random number generator" + linters: + - gosec + - text: "comment on exported var" + linters: + - golint + - text: "don't use an underscore in package name" + linters: + - golint + - text: "ST1003:" + linters: + - stylecheck + # FIXME: Disabled until golangci-lint updates stylecheck with this fix: + # https://github.com/dominikh/go-tools/issues/389 + - text: "ST1016:" + linters: + - stylecheck + +linters-settings: + dogsled: + max-blank-identifiers: 3 + maligned: + # print struct with more effective memory layout or not, false by default + suggest-new: true + +run: + tests: false diff --git a/vendor/github.com/alessio/shellescape/.goreleaser.yml b/vendor/github.com/alessio/shellescape/.goreleaser.yml new file mode 100644 index 0000000..0915eb8 --- /dev/null +++ b/vendor/github.com/alessio/shellescape/.goreleaser.yml @@ -0,0 +1,54 @@ +# This is an example goreleaser.yaml file with some sane defaults. +# Make sure to check the documentation at http://goreleaser.com +before: + hooks: + # You may remove this if you don't use go modules. + - go mod download + # you may remove this if you don't need go generate + - go generate ./... +builds: + - env: + - CGO_ENABLED=0 + - >- + {{- if eq .Os "darwin" }} + {{- if eq .Arch "amd64"}}CC=o64-clang{{- end }} + {{- if eq .Arch "arm64"}}CC=aarch64-apple-darwin20.2-clang{{- end }} + {{- end }} + {{- if eq .Os "windows" }} + {{- if eq .Arch "amd64" }}CC=x86_64-w64-mingw32-gcc{{- end }} + {{- end }} + main: ./cmd/escargs + goos: + - linux + - windows + - darwin + - freebsd + goarch: + - amd64 + - arm64 + - arm + goarm: + - 6 + - 7 + goamd64: + - v2 + - v3 + ignore: + - goos: darwin + goarch: 386 + - goos: linux + goarch: arm + goarm: 7 + - goarm: mips64 + - gomips: hardfloat + - goamd64: v4 +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' diff --git a/vendor/github.com/alessio/shellescape/AUTHORS b/vendor/github.com/alessio/shellescape/AUTHORS new file mode 100644 index 0000000..4a647a6 --- /dev/null +++ b/vendor/github.com/alessio/shellescape/AUTHORS @@ -0,0 +1 @@ +Alessio Treglia diff --git a/vendor/github.com/alessio/shellescape/CODE_OF_CONDUCT.md b/vendor/github.com/alessio/shellescape/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..e8eda60 --- /dev/null +++ b/vendor/github.com/alessio/shellescape/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at alessio@debian.org. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/vendor/github.com/alessio/shellescape/LICENSE b/vendor/github.com/alessio/shellescape/LICENSE new file mode 100644 index 0000000..9f76067 --- /dev/null +++ b/vendor/github.com/alessio/shellescape/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Alessio Treglia + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/alessio/shellescape/README.md b/vendor/github.com/alessio/shellescape/README.md new file mode 100644 index 0000000..910bb25 --- /dev/null +++ b/vendor/github.com/alessio/shellescape/README.md @@ -0,0 +1,61 @@ +![Build](https://github.com/alessio/shellescape/workflows/Build/badge.svg) +[![GoDoc](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/alessio/shellescape?tab=overview) +[![sourcegraph](https://sourcegraph.com/github.com/alessio/shellescape/-/badge.svg)](https://sourcegraph.com/github.com/alessio/shellescape) +[![codecov](https://codecov.io/gh/alessio/shellescape/branch/master/graph/badge.svg)](https://codecov.io/gh/alessio/shellescape) +[![Coverage](https://gocover.io/_badge/github.com/alessio/shellescape)](https://gocover.io/github.com/alessio/shellescape) +[![Go Report Card](https://goreportcard.com/badge/github.com/alessio/shellescape)](https://goreportcard.com/report/github.com/alessio/shellescape) + +# shellescape +Escape arbitrary strings for safe use as command line arguments. +## Contents of the package + +This package provides the `shellescape.Quote()` function that returns a +shell-escaped copy of a string. This functionality could be helpful +in those cases where it is known that the output of a Go program will +be appended to/used in the context of shell programs' command line arguments. + +This work was inspired by the Python original package +[shellescape](https://pypi.python.org/pypi/shellescape). + +## Usage + +The following snippet shows a typical unsafe idiom: + +```go +package main + +import ( + "fmt" + "os" +) + +func main() { + fmt.Printf("ls -l %s\n", os.Args[1]) +} +``` +_[See in Go Playground](https://play.golang.org/p/Wj2WoUfH_d)_ + +Especially when creating pipeline of commands which might end up being +executed by a shell interpreter, it is particularly unsafe to not +escape arguments. + +`shellescape.Quote()` comes in handy and to safely escape strings: + +```go +package main + +import ( + "fmt" + "os" + + "gopkg.in/alessio/shellescape.v1" +) + +func main() { + fmt.Printf("ls -l %s\n", shellescape.Quote(os.Args[1])) +} +``` +_[See in Go Playground](https://play.golang.org/p/HJ_CXgSrmp)_ + +## The escargs utility +__escargs__ reads lines from the standard input and prints shell-escaped versions. Unlinke __xargs__, blank lines on the standard input are not discarded. diff --git a/vendor/github.com/alessio/shellescape/shellescape.go b/vendor/github.com/alessio/shellescape/shellescape.go new file mode 100644 index 0000000..dc34a55 --- /dev/null +++ b/vendor/github.com/alessio/shellescape/shellescape.go @@ -0,0 +1,66 @@ +/* +Package shellescape provides the shellescape.Quote to escape arbitrary +strings for a safe use as command line arguments in the most common +POSIX shells. + +The original Python package which this work was inspired by can be found +at https://pypi.python.org/pypi/shellescape. +*/ +package shellescape // "import gopkg.in/alessio/shellescape.v1" + +/* +The functionality provided by shellescape.Quote could be helpful +in those cases where it is known that the output of a Go program will +be appended to/used in the context of shell programs' command line arguments. +*/ + +import ( + "regexp" + "strings" + "unicode" +) + +var pattern *regexp.Regexp + +func init() { + pattern = regexp.MustCompile(`[^\w@%+=:,./-]`) +} + +// Quote returns a shell-escaped version of the string s. The returned value +// is a string that can safely be used as one token in a shell command line. +func Quote(s string) string { + if len(s) == 0 { + return "''" + } + + if pattern.MatchString(s) { + return "'" + strings.ReplaceAll(s, "'", "'\"'\"'") + "'" + } + + return s +} + +// QuoteCommand returns a shell-escaped version of the slice of strings. +// The returned value is a string that can safely be used as shell command arguments. +func QuoteCommand(args []string) string { + l := make([]string, len(args)) + + for i, s := range args { + l[i] = Quote(s) + } + + return strings.Join(l, " ") +} + +// StripUnsafe remove non-printable runes, e.g. control characters in +// a string that is meant for consumption by terminals that support +// control characters. +func StripUnsafe(s string) string { + return strings.Map(func(r rune) rune { + if unicode.IsPrint(r) { + return r + } + + return -1 + }, s) +} diff --git a/vendor/github.com/asaskevich/govalidator/.gitignore b/vendor/github.com/asaskevich/govalidator/.gitignore new file mode 100644 index 0000000..8d69a94 --- /dev/null +++ b/vendor/github.com/asaskevich/govalidator/.gitignore @@ -0,0 +1,15 @@ +bin/ +.idea/ +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + diff --git a/vendor/github.com/asaskevich/govalidator/.travis.yml b/vendor/github.com/asaskevich/govalidator/.travis.yml new file mode 100644 index 0000000..bb83c66 --- /dev/null +++ b/vendor/github.com/asaskevich/govalidator/.travis.yml @@ -0,0 +1,12 @@ +language: go +dist: xenial +go: + - '1.10' + - '1.11' + - '1.12' + - '1.13' + - 'tip' + +script: + - go test -coverpkg=./... -coverprofile=coverage.info -timeout=5s + - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/asaskevich/govalidator/CODE_OF_CONDUCT.md b/vendor/github.com/asaskevich/govalidator/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..4b462b0 --- /dev/null +++ b/vendor/github.com/asaskevich/govalidator/CODE_OF_CONDUCT.md @@ -0,0 +1,43 @@ +# Contributor Code of Conduct + +This project adheres to [The Code Manifesto](http://codemanifesto.com) +as its guidelines for contributor interactions. + +## The Code Manifesto + +We want to work in an ecosystem that empowers developers to reach their +potential — one that encourages growth and effective collaboration. A space +that is safe for all. + +A space such as this benefits everyone that participates in it. It encourages +new developers to enter our field. It is through discussion and collaboration +that we grow, and through growth that we improve. + +In the effort to create such a place, we hold to these values: + +1. **Discrimination limits us.** This includes discrimination on the basis of + race, gender, sexual orientation, gender identity, age, nationality, + technology and any other arbitrary exclusion of a group of people. +2. **Boundaries honor us.** Your comfort levels are not everyone’s comfort + levels. Remember that, and if brought to your attention, heed it. +3. **We are our biggest assets.** None of us were born masters of our trade. + Each of us has been helped along the way. Return that favor, when and where + you can. +4. **We are resources for the future.** As an extension of #3, share what you + know. Make yourself a resource to help those that come after you. +5. **Respect defines us.** Treat others as you wish to be treated. Make your + discussions, criticisms and debates from a position of respectfulness. Ask + yourself, is it true? Is it necessary? Is it constructive? Anything less is + unacceptable. +6. **Reactions require grace.** Angry responses are valid, but abusive language + and vindictive actions are toxic. When something happens that offends you, + handle it assertively, but be respectful. Escalate reasonably, and try to + allow the offender an opportunity to explain themselves, and possibly + correct the issue. +7. **Opinions are just that: opinions.** Each and every one of us, due to our + background and upbringing, have varying opinions. That is perfectly + acceptable. Remember this: if you respect your own opinions, you should + respect the opinions of others. +8. **To err is human.** You might not intend it, but mistakes do happen and + contribute to build experience. Tolerate honest mistakes, and don't + hesitate to apologize if you make one yourself. diff --git a/vendor/github.com/asaskevich/govalidator/CONTRIBUTING.md b/vendor/github.com/asaskevich/govalidator/CONTRIBUTING.md new file mode 100644 index 0000000..7ed268a --- /dev/null +++ b/vendor/github.com/asaskevich/govalidator/CONTRIBUTING.md @@ -0,0 +1,63 @@ +#### Support +If you do have a contribution to the package, feel free to create a Pull Request or an Issue. + +#### What to contribute +If you don't know what to do, there are some features and functions that need to be done + +- [ ] Refactor code +- [ ] Edit docs and [README](https://github.com/asaskevich/govalidator/README.md): spellcheck, grammar and typo check +- [ ] Create actual list of contributors and projects that currently using this package +- [ ] Resolve [issues and bugs](https://github.com/asaskevich/govalidator/issues) +- [ ] Update actual [list of functions](https://github.com/asaskevich/govalidator#list-of-functions) +- [ ] Update [list of validators](https://github.com/asaskevich/govalidator#validatestruct-2) that available for `ValidateStruct` and add new +- [ ] Implement new validators: `IsFQDN`, `IsIMEI`, `IsPostalCode`, `IsISIN`, `IsISRC` etc +- [x] Implement [validation by maps](https://github.com/asaskevich/govalidator/issues/224) +- [ ] Implement fuzzing testing +- [ ] Implement some struct/map/array utilities +- [ ] Implement map/array validation +- [ ] Implement benchmarking +- [ ] Implement batch of examples +- [ ] Look at forks for new features and fixes + +#### Advice +Feel free to create what you want, but keep in mind when you implement new features: +- Code must be clear and readable, names of variables/constants clearly describes what they are doing +- Public functions must be documented and described in source file and added to README.md to the list of available functions +- There are must be unit-tests for any new functions and improvements + +## Financial contributions + +We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/govalidator). +Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed. + + +## Credits + + +### Contributors + +Thank you to all the people who have already contributed to govalidator! + + + +### Backers + +Thank you to all our backers! [[Become a backer](https://opencollective.com/govalidator#backer)] + + + + +### Sponsors + +Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor](https://opencollective.com/govalidator#sponsor)) + + + + + + + + + + + \ No newline at end of file diff --git a/vendor/github.com/asaskevich/govalidator/LICENSE b/vendor/github.com/asaskevich/govalidator/LICENSE new file mode 100644 index 0000000..cacba91 --- /dev/null +++ b/vendor/github.com/asaskevich/govalidator/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2020 Alex Saskevich + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/asaskevich/govalidator/README.md b/vendor/github.com/asaskevich/govalidator/README.md new file mode 100644 index 0000000..2c3fc35 --- /dev/null +++ b/vendor/github.com/asaskevich/govalidator/README.md @@ -0,0 +1,622 @@ +govalidator +=========== +[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/asaskevich/govalidator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![GoDoc](https://godoc.org/github.com/asaskevich/govalidator?status.png)](https://godoc.org/github.com/asaskevich/govalidator) +[![Build Status](https://travis-ci.org/asaskevich/govalidator.svg?branch=master)](https://travis-ci.org/asaskevich/govalidator) +[![Coverage](https://codecov.io/gh/asaskevich/govalidator/branch/master/graph/badge.svg)](https://codecov.io/gh/asaskevich/govalidator) [![Go Report Card](https://goreportcard.com/badge/github.com/asaskevich/govalidator)](https://goreportcard.com/report/github.com/asaskevich/govalidator) [![GoSearch](http://go-search.org/badge?id=github.com%2Fasaskevich%2Fgovalidator)](http://go-search.org/view?id=github.com%2Fasaskevich%2Fgovalidator) [![Backers on Open Collective](https://opencollective.com/govalidator/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/govalidator/sponsors/badge.svg)](#sponsors) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fasaskevich%2Fgovalidator.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fasaskevich%2Fgovalidator?ref=badge_shield) + +A package of validators and sanitizers for strings, structs and collections. Based on [validator.js](https://github.com/chriso/validator.js). + +#### Installation +Make sure that Go is installed on your computer. +Type the following command in your terminal: + + go get github.com/asaskevich/govalidator + +or you can get specified release of the package with `gopkg.in`: + + go get gopkg.in/asaskevich/govalidator.v10 + +After it the package is ready to use. + + +#### Import package in your project +Add following line in your `*.go` file: +```go +import "github.com/asaskevich/govalidator" +``` +If you are unhappy to use long `govalidator`, you can do something like this: +```go +import ( + valid "github.com/asaskevich/govalidator" +) +``` + +#### Activate behavior to require all fields have a validation tag by default +`SetFieldsRequiredByDefault` causes validation to fail when struct fields do not include validations or are not explicitly marked as exempt (using `valid:"-"` or `valid:"email,optional"`). A good place to activate this is a package init function or the main() function. + +`SetNilPtrAllowedByRequired` causes validation to pass when struct fields marked by `required` are set to nil. This is disabled by default for consistency, but some packages that need to be able to determine between `nil` and `zero value` state can use this. If disabled, both `nil` and `zero` values cause validation errors. + +```go +import "github.com/asaskevich/govalidator" + +func init() { + govalidator.SetFieldsRequiredByDefault(true) +} +``` + +Here's some code to explain it: +```go +// this struct definition will fail govalidator.ValidateStruct() (and the field values do not matter): +type exampleStruct struct { + Name string `` + Email string `valid:"email"` +} + +// this, however, will only fail when Email is empty or an invalid email address: +type exampleStruct2 struct { + Name string `valid:"-"` + Email string `valid:"email"` +} + +// lastly, this will only fail when Email is an invalid email address but not when it's empty: +type exampleStruct2 struct { + Name string `valid:"-"` + Email string `valid:"email,optional"` +} +``` + +#### Recent breaking changes (see [#123](https://github.com/asaskevich/govalidator/pull/123)) +##### Custom validator function signature +A context was added as the second parameter, for structs this is the object being validated – this makes dependent validation possible. +```go +import "github.com/asaskevich/govalidator" + +// old signature +func(i interface{}) bool + +// new signature +func(i interface{}, o interface{}) bool +``` + +##### Adding a custom validator +This was changed to prevent data races when accessing custom validators. +```go +import "github.com/asaskevich/govalidator" + +// before +govalidator.CustomTypeTagMap["customByteArrayValidator"] = func(i interface{}, o interface{}) bool { + // ... +} + +// after +govalidator.CustomTypeTagMap.Set("customByteArrayValidator", func(i interface{}, o interface{}) bool { + // ... +}) +``` + +#### List of functions: +```go +func Abs(value float64) float64 +func BlackList(str, chars string) string +func ByteLength(str string, params ...string) bool +func CamelCaseToUnderscore(str string) string +func Contains(str, substring string) bool +func Count(array []interface{}, iterator ConditionIterator) int +func Each(array []interface{}, iterator Iterator) +func ErrorByField(e error, field string) string +func ErrorsByField(e error) map[string]string +func Filter(array []interface{}, iterator ConditionIterator) []interface{} +func Find(array []interface{}, iterator ConditionIterator) interface{} +func GetLine(s string, index int) (string, error) +func GetLines(s string) []string +func HasLowerCase(str string) bool +func HasUpperCase(str string) bool +func HasWhitespace(str string) bool +func HasWhitespaceOnly(str string) bool +func InRange(value interface{}, left interface{}, right interface{}) bool +func InRangeFloat32(value, left, right float32) bool +func InRangeFloat64(value, left, right float64) bool +func InRangeInt(value, left, right interface{}) bool +func IsASCII(str string) bool +func IsAlpha(str string) bool +func IsAlphanumeric(str string) bool +func IsBase64(str string) bool +func IsByteLength(str string, min, max int) bool +func IsCIDR(str string) bool +func IsCRC32(str string) bool +func IsCRC32b(str string) bool +func IsCreditCard(str string) bool +func IsDNSName(str string) bool +func IsDataURI(str string) bool +func IsDialString(str string) bool +func IsDivisibleBy(str, num string) bool +func IsEmail(str string) bool +func IsExistingEmail(email string) bool +func IsFilePath(str string) (bool, int) +func IsFloat(str string) bool +func IsFullWidth(str string) bool +func IsHalfWidth(str string) bool +func IsHash(str string, algorithm string) bool +func IsHexadecimal(str string) bool +func IsHexcolor(str string) bool +func IsHost(str string) bool +func IsIP(str string) bool +func IsIPv4(str string) bool +func IsIPv6(str string) bool +func IsISBN(str string, version int) bool +func IsISBN10(str string) bool +func IsISBN13(str string) bool +func IsISO3166Alpha2(str string) bool +func IsISO3166Alpha3(str string) bool +func IsISO4217(str string) bool +func IsISO693Alpha2(str string) bool +func IsISO693Alpha3b(str string) bool +func IsIn(str string, params ...string) bool +func IsInRaw(str string, params ...string) bool +func IsInt(str string) bool +func IsJSON(str string) bool +func IsLatitude(str string) bool +func IsLongitude(str string) bool +func IsLowerCase(str string) bool +func IsMAC(str string) bool +func IsMD4(str string) bool +func IsMD5(str string) bool +func IsMagnetURI(str string) bool +func IsMongoID(str string) bool +func IsMultibyte(str string) bool +func IsNatural(value float64) bool +func IsNegative(value float64) bool +func IsNonNegative(value float64) bool +func IsNonPositive(value float64) bool +func IsNotNull(str string) bool +func IsNull(str string) bool +func IsNumeric(str string) bool +func IsPort(str string) bool +func IsPositive(value float64) bool +func IsPrintableASCII(str string) bool +func IsRFC3339(str string) bool +func IsRFC3339WithoutZone(str string) bool +func IsRGBcolor(str string) bool +func IsRegex(str string) bool +func IsRequestURI(rawurl string) bool +func IsRequestURL(rawurl string) bool +func IsRipeMD128(str string) bool +func IsRipeMD160(str string) bool +func IsRsaPub(str string, params ...string) bool +func IsRsaPublicKey(str string, keylen int) bool +func IsSHA1(str string) bool +func IsSHA256(str string) bool +func IsSHA384(str string) bool +func IsSHA512(str string) bool +func IsSSN(str string) bool +func IsSemver(str string) bool +func IsTiger128(str string) bool +func IsTiger160(str string) bool +func IsTiger192(str string) bool +func IsTime(str string, format string) bool +func IsType(v interface{}, params ...string) bool +func IsURL(str string) bool +func IsUTFDigit(str string) bool +func IsUTFLetter(str string) bool +func IsUTFLetterNumeric(str string) bool +func IsUTFNumeric(str string) bool +func IsUUID(str string) bool +func IsUUIDv3(str string) bool +func IsUUIDv4(str string) bool +func IsUUIDv5(str string) bool +func IsULID(str string) bool +func IsUnixTime(str string) bool +func IsUpperCase(str string) bool +func IsVariableWidth(str string) bool +func IsWhole(value float64) bool +func LeftTrim(str, chars string) string +func Map(array []interface{}, iterator ResultIterator) []interface{} +func Matches(str, pattern string) bool +func MaxStringLength(str string, params ...string) bool +func MinStringLength(str string, params ...string) bool +func NormalizeEmail(str string) (string, error) +func PadBoth(str string, padStr string, padLen int) string +func PadLeft(str string, padStr string, padLen int) string +func PadRight(str string, padStr string, padLen int) string +func PrependPathToErrors(err error, path string) error +func Range(str string, params ...string) bool +func RemoveTags(s string) string +func ReplacePattern(str, pattern, replace string) string +func Reverse(s string) string +func RightTrim(str, chars string) string +func RuneLength(str string, params ...string) bool +func SafeFileName(str string) string +func SetFieldsRequiredByDefault(value bool) +func SetNilPtrAllowedByRequired(value bool) +func Sign(value float64) float64 +func StringLength(str string, params ...string) bool +func StringMatches(s string, params ...string) bool +func StripLow(str string, keepNewLines bool) string +func ToBoolean(str string) (bool, error) +func ToFloat(str string) (float64, error) +func ToInt(value interface{}) (res int64, err error) +func ToJSON(obj interface{}) (string, error) +func ToString(obj interface{}) string +func Trim(str, chars string) string +func Truncate(str string, length int, ending string) string +func TruncatingErrorf(str string, args ...interface{}) error +func UnderscoreToCamelCase(s string) string +func ValidateMap(inputMap map[string]interface{}, validationMap map[string]interface{}) (bool, error) +func ValidateStruct(s interface{}) (bool, error) +func WhiteList(str, chars string) string +type ConditionIterator +type CustomTypeValidator +type Error +func (e Error) Error() string +type Errors +func (es Errors) Error() string +func (es Errors) Errors() []error +type ISO3166Entry +type ISO693Entry +type InterfaceParamValidator +type Iterator +type ParamValidator +type ResultIterator +type UnsupportedTypeError +func (e *UnsupportedTypeError) Error() string +type Validator +``` + +#### Examples +###### IsURL +```go +println(govalidator.IsURL(`http://user@pass:domain.com/path/page`)) +``` +###### IsType +```go +println(govalidator.IsType("Bob", "string")) +println(govalidator.IsType(1, "int")) +i := 1 +println(govalidator.IsType(&i, "*int")) +``` + +IsType can be used through the tag `type` which is essential for map validation: +```go +type User struct { + Name string `valid:"type(string)"` + Age int `valid:"type(int)"` + Meta interface{} `valid:"type(string)"` +} +result, err := govalidator.ValidateStruct(User{"Bob", 20, "meta"}) +if err != nil { + println("error: " + err.Error()) +} +println(result) +``` +###### ToString +```go +type User struct { + FirstName string + LastName string +} + +str := govalidator.ToString(&User{"John", "Juan"}) +println(str) +``` +###### Each, Map, Filter, Count for slices +Each iterates over the slice/array and calls Iterator for every item +```go +data := []interface{}{1, 2, 3, 4, 5} +var fn govalidator.Iterator = func(value interface{}, index int) { + println(value.(int)) +} +govalidator.Each(data, fn) +``` +```go +data := []interface{}{1, 2, 3, 4, 5} +var fn govalidator.ResultIterator = func(value interface{}, index int) interface{} { + return value.(int) * 3 +} +_ = govalidator.Map(data, fn) // result = []interface{}{1, 6, 9, 12, 15} +``` +```go +data := []interface{}{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} +var fn govalidator.ConditionIterator = func(value interface{}, index int) bool { + return value.(int)%2 == 0 +} +_ = govalidator.Filter(data, fn) // result = []interface{}{2, 4, 6, 8, 10} +_ = govalidator.Count(data, fn) // result = 5 +``` +###### ValidateStruct [#2](https://github.com/asaskevich/govalidator/pull/2) +If you want to validate structs, you can use tag `valid` for any field in your structure. All validators used with this field in one tag are separated by comma. If you want to skip validation, place `-` in your tag. If you need a validator that is not on the list below, you can add it like this: +```go +govalidator.TagMap["duck"] = govalidator.Validator(func(str string) bool { + return str == "duck" +}) +``` +For completely custom validators (interface-based), see below. + +Here is a list of available validators for struct fields (validator - used function): +```go +"email": IsEmail, +"url": IsURL, +"dialstring": IsDialString, +"requrl": IsRequestURL, +"requri": IsRequestURI, +"alpha": IsAlpha, +"utfletter": IsUTFLetter, +"alphanum": IsAlphanumeric, +"utfletternum": IsUTFLetterNumeric, +"numeric": IsNumeric, +"utfnumeric": IsUTFNumeric, +"utfdigit": IsUTFDigit, +"hexadecimal": IsHexadecimal, +"hexcolor": IsHexcolor, +"rgbcolor": IsRGBcolor, +"lowercase": IsLowerCase, +"uppercase": IsUpperCase, +"int": IsInt, +"float": IsFloat, +"null": IsNull, +"uuid": IsUUID, +"uuidv3": IsUUIDv3, +"uuidv4": IsUUIDv4, +"uuidv5": IsUUIDv5, +"creditcard": IsCreditCard, +"isbn10": IsISBN10, +"isbn13": IsISBN13, +"json": IsJSON, +"multibyte": IsMultibyte, +"ascii": IsASCII, +"printableascii": IsPrintableASCII, +"fullwidth": IsFullWidth, +"halfwidth": IsHalfWidth, +"variablewidth": IsVariableWidth, +"base64": IsBase64, +"datauri": IsDataURI, +"ip": IsIP, +"port": IsPort, +"ipv4": IsIPv4, +"ipv6": IsIPv6, +"dns": IsDNSName, +"host": IsHost, +"mac": IsMAC, +"latitude": IsLatitude, +"longitude": IsLongitude, +"ssn": IsSSN, +"semver": IsSemver, +"rfc3339": IsRFC3339, +"rfc3339WithoutZone": IsRFC3339WithoutZone, +"ISO3166Alpha2": IsISO3166Alpha2, +"ISO3166Alpha3": IsISO3166Alpha3, +"ulid": IsULID, +``` +Validators with parameters + +```go +"range(min|max)": Range, +"length(min|max)": ByteLength, +"runelength(min|max)": RuneLength, +"stringlength(min|max)": StringLength, +"matches(pattern)": StringMatches, +"in(string1|string2|...|stringN)": IsIn, +"rsapub(keylength)" : IsRsaPub, +"minstringlength(int): MinStringLength, +"maxstringlength(int): MaxStringLength, +``` +Validators with parameters for any type + +```go +"type(type)": IsType, +``` + +And here is small example of usage: +```go +type Post struct { + Title string `valid:"alphanum,required"` + Message string `valid:"duck,ascii"` + Message2 string `valid:"animal(dog)"` + AuthorIP string `valid:"ipv4"` + Date string `valid:"-"` +} +post := &Post{ + Title: "My Example Post", + Message: "duck", + Message2: "dog", + AuthorIP: "123.234.54.3", +} + +// Add your own struct validation tags +govalidator.TagMap["duck"] = govalidator.Validator(func(str string) bool { + return str == "duck" +}) + +// Add your own struct validation tags with parameter +govalidator.ParamTagMap["animal"] = govalidator.ParamValidator(func(str string, params ...string) bool { + species := params[0] + return str == species +}) +govalidator.ParamTagRegexMap["animal"] = regexp.MustCompile("^animal\\((\\w+)\\)$") + +result, err := govalidator.ValidateStruct(post) +if err != nil { + println("error: " + err.Error()) +} +println(result) +``` +###### ValidateMap [#2](https://github.com/asaskevich/govalidator/pull/338) +If you want to validate maps, you can use the map to be validated and a validation map that contain the same tags used in ValidateStruct, both maps have to be in the form `map[string]interface{}` + +So here is small example of usage: +```go +var mapTemplate = map[string]interface{}{ + "name":"required,alpha", + "family":"required,alpha", + "email":"required,email", + "cell-phone":"numeric", + "address":map[string]interface{}{ + "line1":"required,alphanum", + "line2":"alphanum", + "postal-code":"numeric", + }, +} + +var inputMap = map[string]interface{}{ + "name":"Bob", + "family":"Smith", + "email":"foo@bar.baz", + "address":map[string]interface{}{ + "line1":"", + "line2":"", + "postal-code":"", + }, +} + +result, err := govalidator.ValidateMap(inputMap, mapTemplate) +if err != nil { + println("error: " + err.Error()) +} +println(result) +``` + +###### WhiteList +```go +// Remove all characters from string ignoring characters between "a" and "z" +println(govalidator.WhiteList("a3a43a5a4a3a2a23a4a5a4a3a4", "a-z") == "aaaaaaaaaaaa") +``` + +###### Custom validation functions +Custom validation using your own domain specific validators is also available - here's an example of how to use it: +```go +import "github.com/asaskevich/govalidator" + +type CustomByteArray [6]byte // custom types are supported and can be validated + +type StructWithCustomByteArray struct { + ID CustomByteArray `valid:"customByteArrayValidator,customMinLengthValidator"` // multiple custom validators are possible as well and will be evaluated in sequence + Email string `valid:"email"` + CustomMinLength int `valid:"-"` +} + +govalidator.CustomTypeTagMap.Set("customByteArrayValidator", func(i interface{}, context interface{}) bool { + switch v := context.(type) { // you can type switch on the context interface being validated + case StructWithCustomByteArray: + // you can check and validate against some other field in the context, + // return early or not validate against the context at all – your choice + case SomeOtherType: + // ... + default: + // expecting some other type? Throw/panic here or continue + } + + switch v := i.(type) { // type switch on the struct field being validated + case CustomByteArray: + for _, e := range v { // this validator checks that the byte array is not empty, i.e. not all zeroes + if e != 0 { + return true + } + } + } + return false +}) +govalidator.CustomTypeTagMap.Set("customMinLengthValidator", func(i interface{}, context interface{}) bool { + switch v := context.(type) { // this validates a field against the value in another field, i.e. dependent validation + case StructWithCustomByteArray: + return len(v.ID) >= v.CustomMinLength + } + return false +}) +``` + +###### Loop over Error() +By default .Error() returns all errors in a single String. To access each error you can do this: +```go + if err != nil { + errs := err.(govalidator.Errors).Errors() + for _, e := range errs { + fmt.Println(e.Error()) + } + } +``` + +###### Custom error messages +Custom error messages are supported via annotations by adding the `~` separator - here's an example of how to use it: +```go +type Ticket struct { + Id int64 `json:"id"` + FirstName string `json:"firstname" valid:"required~First name is blank"` +} +``` + +#### Notes +Documentation is available here: [godoc.org](https://godoc.org/github.com/asaskevich/govalidator). +Full information about code coverage is also available here: [govalidator on gocover.io](http://gocover.io/github.com/asaskevich/govalidator). + +#### Support +If you do have a contribution to the package, feel free to create a Pull Request or an Issue. + +#### What to contribute +If you don't know what to do, there are some features and functions that need to be done + +- [ ] Refactor code +- [ ] Edit docs and [README](https://github.com/asaskevich/govalidator/README.md): spellcheck, grammar and typo check +- [ ] Create actual list of contributors and projects that currently using this package +- [ ] Resolve [issues and bugs](https://github.com/asaskevich/govalidator/issues) +- [ ] Update actual [list of functions](https://github.com/asaskevich/govalidator#list-of-functions) +- [ ] Update [list of validators](https://github.com/asaskevich/govalidator#validatestruct-2) that available for `ValidateStruct` and add new +- [ ] Implement new validators: `IsFQDN`, `IsIMEI`, `IsPostalCode`, `IsISIN`, `IsISRC` etc +- [x] Implement [validation by maps](https://github.com/asaskevich/govalidator/issues/224) +- [ ] Implement fuzzing testing +- [ ] Implement some struct/map/array utilities +- [ ] Implement map/array validation +- [ ] Implement benchmarking +- [ ] Implement batch of examples +- [ ] Look at forks for new features and fixes + +#### Advice +Feel free to create what you want, but keep in mind when you implement new features: +- Code must be clear and readable, names of variables/constants clearly describes what they are doing +- Public functions must be documented and described in source file and added to README.md to the list of available functions +- There are must be unit-tests for any new functions and improvements + +## Credits +### Contributors + +This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]. + +#### Special thanks to [contributors](https://github.com/asaskevich/govalidator/graphs/contributors) +* [Daniel Lohse](https://github.com/annismckenzie) +* [Attila Oláh](https://github.com/attilaolah) +* [Daniel Korner](https://github.com/Dadie) +* [Steven Wilkin](https://github.com/stevenwilkin) +* [Deiwin Sarjas](https://github.com/deiwin) +* [Noah Shibley](https://github.com/slugmobile) +* [Nathan Davies](https://github.com/nathj07) +* [Matt Sanford](https://github.com/mzsanford) +* [Simon ccl1115](https://github.com/ccl1115) + + + + +### Backers + +Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/govalidator#backer)] + + + + +### Sponsors + +Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/govalidator#sponsor)] + + + + + + + + + + + + + + + +## License +[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fasaskevich%2Fgovalidator.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fasaskevich%2Fgovalidator?ref=badge_large) diff --git a/vendor/github.com/asaskevich/govalidator/arrays.go b/vendor/github.com/asaskevich/govalidator/arrays.go new file mode 100644 index 0000000..3e1da7c --- /dev/null +++ b/vendor/github.com/asaskevich/govalidator/arrays.go @@ -0,0 +1,87 @@ +package govalidator + +// Iterator is the function that accepts element of slice/array and its index +type Iterator func(interface{}, int) + +// ResultIterator is the function that accepts element of slice/array and its index and returns any result +type ResultIterator func(interface{}, int) interface{} + +// ConditionIterator is the function that accepts element of slice/array and its index and returns boolean +type ConditionIterator func(interface{}, int) bool + +// ReduceIterator is the function that accepts two element of slice/array and returns result of merging those values +type ReduceIterator func(interface{}, interface{}) interface{} + +// Some validates that any item of array corresponds to ConditionIterator. Returns boolean. +func Some(array []interface{}, iterator ConditionIterator) bool { + res := false + for index, data := range array { + res = res || iterator(data, index) + } + return res +} + +// Every validates that every item of array corresponds to ConditionIterator. Returns boolean. +func Every(array []interface{}, iterator ConditionIterator) bool { + res := true + for index, data := range array { + res = res && iterator(data, index) + } + return res +} + +// Reduce boils down a list of values into a single value by ReduceIterator +func Reduce(array []interface{}, iterator ReduceIterator, initialValue interface{}) interface{} { + for _, data := range array { + initialValue = iterator(initialValue, data) + } + return initialValue +} + +// Each iterates over the slice and apply Iterator to every item +func Each(array []interface{}, iterator Iterator) { + for index, data := range array { + iterator(data, index) + } +} + +// Map iterates over the slice and apply ResultIterator to every item. Returns new slice as a result. +func Map(array []interface{}, iterator ResultIterator) []interface{} { + var result = make([]interface{}, len(array)) + for index, data := range array { + result[index] = iterator(data, index) + } + return result +} + +// Find iterates over the slice and apply ConditionIterator to every item. Returns first item that meet ConditionIterator or nil otherwise. +func Find(array []interface{}, iterator ConditionIterator) interface{} { + for index, data := range array { + if iterator(data, index) { + return data + } + } + return nil +} + +// Filter iterates over the slice and apply ConditionIterator to every item. Returns new slice. +func Filter(array []interface{}, iterator ConditionIterator) []interface{} { + var result = make([]interface{}, 0) + for index, data := range array { + if iterator(data, index) { + result = append(result, data) + } + } + return result +} + +// Count iterates over the slice and apply ConditionIterator to every item. Returns count of items that meets ConditionIterator. +func Count(array []interface{}, iterator ConditionIterator) int { + count := 0 + for index, data := range array { + if iterator(data, index) { + count = count + 1 + } + } + return count +} diff --git a/vendor/github.com/asaskevich/govalidator/converter.go b/vendor/github.com/asaskevich/govalidator/converter.go new file mode 100644 index 0000000..d68e990 --- /dev/null +++ b/vendor/github.com/asaskevich/govalidator/converter.go @@ -0,0 +1,81 @@ +package govalidator + +import ( + "encoding/json" + "fmt" + "reflect" + "strconv" +) + +// ToString convert the input to a string. +func ToString(obj interface{}) string { + res := fmt.Sprintf("%v", obj) + return res +} + +// ToJSON convert the input to a valid JSON string +func ToJSON(obj interface{}) (string, error) { + res, err := json.Marshal(obj) + if err != nil { + res = []byte("") + } + return string(res), err +} + +// ToFloat convert the input string to a float, or 0.0 if the input is not a float. +func ToFloat(value interface{}) (res float64, err error) { + val := reflect.ValueOf(value) + + switch value.(type) { + case int, int8, int16, int32, int64: + res = float64(val.Int()) + case uint, uint8, uint16, uint32, uint64: + res = float64(val.Uint()) + case float32, float64: + res = val.Float() + case string: + res, err = strconv.ParseFloat(val.String(), 64) + if err != nil { + res = 0 + } + default: + err = fmt.Errorf("ToInt: unknown interface type %T", value) + res = 0 + } + + return +} + +// ToInt convert the input string or any int type to an integer type 64, or 0 if the input is not an integer. +func ToInt(value interface{}) (res int64, err error) { + val := reflect.ValueOf(value) + + switch value.(type) { + case int, int8, int16, int32, int64: + res = val.Int() + case uint, uint8, uint16, uint32, uint64: + res = int64(val.Uint()) + case float32, float64: + res = int64(val.Float()) + case string: + if IsInt(val.String()) { + res, err = strconv.ParseInt(val.String(), 0, 64) + if err != nil { + res = 0 + } + } else { + err = fmt.Errorf("ToInt: invalid numeric format %g", value) + res = 0 + } + default: + err = fmt.Errorf("ToInt: unknown interface type %T", value) + res = 0 + } + + return +} + +// ToBoolean convert the input string to a boolean. +func ToBoolean(str string) (bool, error) { + return strconv.ParseBool(str) +} diff --git a/vendor/github.com/asaskevich/govalidator/doc.go b/vendor/github.com/asaskevich/govalidator/doc.go new file mode 100644 index 0000000..55dce62 --- /dev/null +++ b/vendor/github.com/asaskevich/govalidator/doc.go @@ -0,0 +1,3 @@ +package govalidator + +// A package of validators and sanitizers for strings, structures and collections. diff --git a/vendor/github.com/asaskevich/govalidator/error.go b/vendor/github.com/asaskevich/govalidator/error.go new file mode 100644 index 0000000..1da2336 --- /dev/null +++ b/vendor/github.com/asaskevich/govalidator/error.go @@ -0,0 +1,47 @@ +package govalidator + +import ( + "sort" + "strings" +) + +// Errors is an array of multiple errors and conforms to the error interface. +type Errors []error + +// Errors returns itself. +func (es Errors) Errors() []error { + return es +} + +func (es Errors) Error() string { + var errs []string + for _, e := range es { + errs = append(errs, e.Error()) + } + sort.Strings(errs) + return strings.Join(errs, ";") +} + +// Error encapsulates a name, an error and whether there's a custom error message or not. +type Error struct { + Name string + Err error + CustomErrorMessageExists bool + + // Validator indicates the name of the validator that failed + Validator string + Path []string +} + +func (e Error) Error() string { + if e.CustomErrorMessageExists { + return e.Err.Error() + } + + errName := e.Name + if len(e.Path) > 0 { + errName = strings.Join(append(e.Path, e.Name), ".") + } + + return errName + ": " + e.Err.Error() +} diff --git a/vendor/github.com/asaskevich/govalidator/numerics.go b/vendor/github.com/asaskevich/govalidator/numerics.go new file mode 100644 index 0000000..5041d9e --- /dev/null +++ b/vendor/github.com/asaskevich/govalidator/numerics.go @@ -0,0 +1,100 @@ +package govalidator + +import ( + "math" +) + +// Abs returns absolute value of number +func Abs(value float64) float64 { + return math.Abs(value) +} + +// Sign returns signum of number: 1 in case of value > 0, -1 in case of value < 0, 0 otherwise +func Sign(value float64) float64 { + if value > 0 { + return 1 + } else if value < 0 { + return -1 + } else { + return 0 + } +} + +// IsNegative returns true if value < 0 +func IsNegative(value float64) bool { + return value < 0 +} + +// IsPositive returns true if value > 0 +func IsPositive(value float64) bool { + return value > 0 +} + +// IsNonNegative returns true if value >= 0 +func IsNonNegative(value float64) bool { + return value >= 0 +} + +// IsNonPositive returns true if value <= 0 +func IsNonPositive(value float64) bool { + return value <= 0 +} + +// InRangeInt returns true if value lies between left and right border +func InRangeInt(value, left, right interface{}) bool { + value64, _ := ToInt(value) + left64, _ := ToInt(left) + right64, _ := ToInt(right) + if left64 > right64 { + left64, right64 = right64, left64 + } + return value64 >= left64 && value64 <= right64 +} + +// InRangeFloat32 returns true if value lies between left and right border +func InRangeFloat32(value, left, right float32) bool { + if left > right { + left, right = right, left + } + return value >= left && value <= right +} + +// InRangeFloat64 returns true if value lies between left and right border +func InRangeFloat64(value, left, right float64) bool { + if left > right { + left, right = right, left + } + return value >= left && value <= right +} + +// InRange returns true if value lies between left and right border, generic type to handle int, float32, float64 and string. +// All types must the same type. +// False if value doesn't lie in range or if it incompatible or not comparable +func InRange(value interface{}, left interface{}, right interface{}) bool { + switch value.(type) { + case int: + intValue, _ := ToInt(value) + intLeft, _ := ToInt(left) + intRight, _ := ToInt(right) + return InRangeInt(intValue, intLeft, intRight) + case float32, float64: + intValue, _ := ToFloat(value) + intLeft, _ := ToFloat(left) + intRight, _ := ToFloat(right) + return InRangeFloat64(intValue, intLeft, intRight) + case string: + return value.(string) >= left.(string) && value.(string) <= right.(string) + default: + return false + } +} + +// IsWhole returns true if value is whole number +func IsWhole(value float64) bool { + return math.Remainder(value, 1) == 0 +} + +// IsNatural returns true if value is natural number (positive and whole) +func IsNatural(value float64) bool { + return IsWhole(value) && IsPositive(value) +} diff --git a/vendor/github.com/asaskevich/govalidator/patterns.go b/vendor/github.com/asaskevich/govalidator/patterns.go new file mode 100644 index 0000000..bafc376 --- /dev/null +++ b/vendor/github.com/asaskevich/govalidator/patterns.go @@ -0,0 +1,113 @@ +package govalidator + +import "regexp" + +// Basic regular expressions for validating strings +const ( + Email string = "^(((([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+(\\.([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])([a-zA-Z]|\\d|-|\\.|_|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.)+(([a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(([a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])([a-zA-Z]|\\d|-|_|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*([a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.?$" + CreditCard string = "^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11}|6[27][0-9]{14})$" + ISBN10 string = "^(?:[0-9]{9}X|[0-9]{10})$" + ISBN13 string = "^(?:[0-9]{13})$" + UUID3 string = "^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$" + UUID4 string = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" + UUID5 string = "^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" + UUID string = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" + Alpha string = "^[a-zA-Z]+$" + Alphanumeric string = "^[a-zA-Z0-9]+$" + Numeric string = "^[0-9]+$" + Int string = "^(?:[-+]?(?:0|[1-9][0-9]*))$" + Float string = "^(?:[-+]?(?:[0-9]+))?(?:\\.[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$" + Hexadecimal string = "^[0-9a-fA-F]+$" + Hexcolor string = "^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$" + RGBcolor string = "^rgb\\(\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*\\)$" + ASCII string = "^[\x00-\x7F]+$" + Multibyte string = "[^\x00-\x7F]" + FullWidth string = "[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]" + HalfWidth string = "[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]" + Base64 string = "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=|[A-Za-z0-9+\\/]{4})$" + PrintableASCII string = "^[\x20-\x7E]+$" + DataURI string = "^data:.+\\/(.+);base64$" + MagnetURI string = "^magnet:\\?xt=urn:[a-zA-Z0-9]+:[a-zA-Z0-9]{32,40}&dn=.+&tr=.+$" + Latitude string = "^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?)$" + Longitude string = "^[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$" + DNSName string = `^([a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62}){1}(\.[a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62})*[\._]?$` + IP string = `(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))` + URLSchema string = `((ftp|tcp|udp|wss?|https?):\/\/)` + URLUsername string = `(\S+(:\S*)?@)` + URLPath string = `((\/|\?|#)[^\s]*)` + URLPort string = `(:(\d{1,5}))` + URLIP string = `([1-9]\d?|1\d\d|2[01]\d|22[0-3]|24\d|25[0-5])(\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])){2}(?:\.([0-9]\d?|1\d\d|2[0-4]\d|25[0-5]))` + URLSubdomain string = `((www\.)|([a-zA-Z0-9]+([-_\.]?[a-zA-Z0-9])*[a-zA-Z0-9]\.[a-zA-Z0-9]+))` + URL = `^` + URLSchema + `?` + URLUsername + `?` + `((` + URLIP + `|(\[` + IP + `\])|(([a-zA-Z0-9]([a-zA-Z0-9-_]+)?[a-zA-Z0-9]([-\.][a-zA-Z0-9]+)*)|(` + URLSubdomain + `?))?(([a-zA-Z\x{00a1}-\x{ffff}0-9]+-?-?)*[a-zA-Z\x{00a1}-\x{ffff}0-9]+)(?:\.([a-zA-Z\x{00a1}-\x{ffff}]{1,}))?))\.?` + URLPort + `?` + URLPath + `?$` + SSN string = `^\d{3}[- ]?\d{2}[- ]?\d{4}$` + WinPath string = `^[a-zA-Z]:\\(?:[^\\/:*?"<>|\r\n]+\\)*[^\\/:*?"<>|\r\n]*$` + UnixPath string = `^(/[^/\x00]*)+/?$` + WinARPath string = `^(?:(?:[a-zA-Z]:|\\\\[a-z0-9_.$●-]+\\[a-z0-9_.$●-]+)\\|\\?[^\\/:*?"<>|\r\n]+\\?)(?:[^\\/:*?"<>|\r\n]+\\)*[^\\/:*?"<>|\r\n]*$` + UnixARPath string = `^((\.{0,2}/)?([^/\x00]*))+/?$` + Semver string = "^v?(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$" + tagName string = "valid" + hasLowerCase string = ".*[[:lower:]]" + hasUpperCase string = ".*[[:upper:]]" + hasWhitespace string = ".*[[:space:]]" + hasWhitespaceOnly string = "^[[:space:]]+$" + IMEI string = "^[0-9a-f]{14}$|^\\d{15}$|^\\d{18}$" + IMSI string = "^\\d{14,15}$" + E164 string = `^\+?[1-9]\d{1,14}$` +) + +// Used by IsFilePath func +const ( + // Unknown is unresolved OS type + Unknown = iota + // Win is Windows type + Win + // Unix is *nix OS types + Unix +) + +var ( + userRegexp = regexp.MustCompile("^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~.-]+$") + hostRegexp = regexp.MustCompile("^[^\\s]+\\.[^\\s]+$") + userDotRegexp = regexp.MustCompile("(^[.]{1})|([.]{1}$)|([.]{2,})") + rxEmail = regexp.MustCompile(Email) + rxCreditCard = regexp.MustCompile(CreditCard) + rxISBN10 = regexp.MustCompile(ISBN10) + rxISBN13 = regexp.MustCompile(ISBN13) + rxUUID3 = regexp.MustCompile(UUID3) + rxUUID4 = regexp.MustCompile(UUID4) + rxUUID5 = regexp.MustCompile(UUID5) + rxUUID = regexp.MustCompile(UUID) + rxAlpha = regexp.MustCompile(Alpha) + rxAlphanumeric = regexp.MustCompile(Alphanumeric) + rxNumeric = regexp.MustCompile(Numeric) + rxInt = regexp.MustCompile(Int) + rxFloat = regexp.MustCompile(Float) + rxHexadecimal = regexp.MustCompile(Hexadecimal) + rxHexcolor = regexp.MustCompile(Hexcolor) + rxRGBcolor = regexp.MustCompile(RGBcolor) + rxASCII = regexp.MustCompile(ASCII) + rxPrintableASCII = regexp.MustCompile(PrintableASCII) + rxMultibyte = regexp.MustCompile(Multibyte) + rxFullWidth = regexp.MustCompile(FullWidth) + rxHalfWidth = regexp.MustCompile(HalfWidth) + rxBase64 = regexp.MustCompile(Base64) + rxDataURI = regexp.MustCompile(DataURI) + rxMagnetURI = regexp.MustCompile(MagnetURI) + rxLatitude = regexp.MustCompile(Latitude) + rxLongitude = regexp.MustCompile(Longitude) + rxDNSName = regexp.MustCompile(DNSName) + rxURL = regexp.MustCompile(URL) + rxSSN = regexp.MustCompile(SSN) + rxWinPath = regexp.MustCompile(WinPath) + rxUnixPath = regexp.MustCompile(UnixPath) + rxARWinPath = regexp.MustCompile(WinARPath) + rxARUnixPath = regexp.MustCompile(UnixARPath) + rxSemver = regexp.MustCompile(Semver) + rxHasLowerCase = regexp.MustCompile(hasLowerCase) + rxHasUpperCase = regexp.MustCompile(hasUpperCase) + rxHasWhitespace = regexp.MustCompile(hasWhitespace) + rxHasWhitespaceOnly = regexp.MustCompile(hasWhitespaceOnly) + rxIMEI = regexp.MustCompile(IMEI) + rxIMSI = regexp.MustCompile(IMSI) + rxE164 = regexp.MustCompile(E164) +) diff --git a/vendor/github.com/asaskevich/govalidator/types.go b/vendor/github.com/asaskevich/govalidator/types.go new file mode 100644 index 0000000..e846711 --- /dev/null +++ b/vendor/github.com/asaskevich/govalidator/types.go @@ -0,0 +1,656 @@ +package govalidator + +import ( + "reflect" + "regexp" + "sort" + "sync" +) + +// Validator is a wrapper for a validator function that returns bool and accepts string. +type Validator func(str string) bool + +// CustomTypeValidator is a wrapper for validator functions that returns bool and accepts any type. +// The second parameter should be the context (in the case of validating a struct: the whole object being validated). +type CustomTypeValidator func(i interface{}, o interface{}) bool + +// ParamValidator is a wrapper for validator functions that accept additional parameters. +type ParamValidator func(str string, params ...string) bool + +// InterfaceParamValidator is a wrapper for functions that accept variants parameters for an interface value +type InterfaceParamValidator func(in interface{}, params ...string) bool +type tagOptionsMap map[string]tagOption + +func (t tagOptionsMap) orderedKeys() []string { + var keys []string + for k := range t { + keys = append(keys, k) + } + + sort.Slice(keys, func(a, b int) bool { + return t[keys[a]].order < t[keys[b]].order + }) + + return keys +} + +type tagOption struct { + name string + customErrorMessage string + order int +} + +// UnsupportedTypeError is a wrapper for reflect.Type +type UnsupportedTypeError struct { + Type reflect.Type +} + +// stringValues is a slice of reflect.Value holding *reflect.StringValue. +// It implements the methods to sort by string. +type stringValues []reflect.Value + +// InterfaceParamTagMap is a map of functions accept variants parameters for an interface value +var InterfaceParamTagMap = map[string]InterfaceParamValidator{ + "type": IsType, +} + +// InterfaceParamTagRegexMap maps interface param tags to their respective regexes. +var InterfaceParamTagRegexMap = map[string]*regexp.Regexp{ + "type": regexp.MustCompile(`^type\((.*)\)$`), +} + +// ParamTagMap is a map of functions accept variants parameters +var ParamTagMap = map[string]ParamValidator{ + "length": ByteLength, + "range": Range, + "runelength": RuneLength, + "stringlength": StringLength, + "matches": StringMatches, + "in": IsInRaw, + "rsapub": IsRsaPub, + "minstringlength": MinStringLength, + "maxstringlength": MaxStringLength, +} + +// ParamTagRegexMap maps param tags to their respective regexes. +var ParamTagRegexMap = map[string]*regexp.Regexp{ + "range": regexp.MustCompile("^range\\((\\d+)\\|(\\d+)\\)$"), + "length": regexp.MustCompile("^length\\((\\d+)\\|(\\d+)\\)$"), + "runelength": regexp.MustCompile("^runelength\\((\\d+)\\|(\\d+)\\)$"), + "stringlength": regexp.MustCompile("^stringlength\\((\\d+)\\|(\\d+)\\)$"), + "in": regexp.MustCompile(`^in\((.*)\)`), + "matches": regexp.MustCompile(`^matches\((.+)\)$`), + "rsapub": regexp.MustCompile("^rsapub\\((\\d+)\\)$"), + "minstringlength": regexp.MustCompile("^minstringlength\\((\\d+)\\)$"), + "maxstringlength": regexp.MustCompile("^maxstringlength\\((\\d+)\\)$"), +} + +type customTypeTagMap struct { + validators map[string]CustomTypeValidator + + sync.RWMutex +} + +func (tm *customTypeTagMap) Get(name string) (CustomTypeValidator, bool) { + tm.RLock() + defer tm.RUnlock() + v, ok := tm.validators[name] + return v, ok +} + +func (tm *customTypeTagMap) Set(name string, ctv CustomTypeValidator) { + tm.Lock() + defer tm.Unlock() + tm.validators[name] = ctv +} + +// CustomTypeTagMap is a map of functions that can be used as tags for ValidateStruct function. +// Use this to validate compound or custom types that need to be handled as a whole, e.g. +// `type UUID [16]byte` (this would be handled as an array of bytes). +var CustomTypeTagMap = &customTypeTagMap{validators: make(map[string]CustomTypeValidator)} + +// TagMap is a map of functions, that can be used as tags for ValidateStruct function. +var TagMap = map[string]Validator{ + "email": IsEmail, + "url": IsURL, + "dialstring": IsDialString, + "requrl": IsRequestURL, + "requri": IsRequestURI, + "alpha": IsAlpha, + "utfletter": IsUTFLetter, + "alphanum": IsAlphanumeric, + "utfletternum": IsUTFLetterNumeric, + "numeric": IsNumeric, + "utfnumeric": IsUTFNumeric, + "utfdigit": IsUTFDigit, + "hexadecimal": IsHexadecimal, + "hexcolor": IsHexcolor, + "rgbcolor": IsRGBcolor, + "lowercase": IsLowerCase, + "uppercase": IsUpperCase, + "int": IsInt, + "float": IsFloat, + "null": IsNull, + "notnull": IsNotNull, + "uuid": IsUUID, + "uuidv3": IsUUIDv3, + "uuidv4": IsUUIDv4, + "uuidv5": IsUUIDv5, + "creditcard": IsCreditCard, + "isbn10": IsISBN10, + "isbn13": IsISBN13, + "json": IsJSON, + "multibyte": IsMultibyte, + "ascii": IsASCII, + "printableascii": IsPrintableASCII, + "fullwidth": IsFullWidth, + "halfwidth": IsHalfWidth, + "variablewidth": IsVariableWidth, + "base64": IsBase64, + "datauri": IsDataURI, + "ip": IsIP, + "port": IsPort, + "ipv4": IsIPv4, + "ipv6": IsIPv6, + "dns": IsDNSName, + "host": IsHost, + "mac": IsMAC, + "latitude": IsLatitude, + "longitude": IsLongitude, + "ssn": IsSSN, + "semver": IsSemver, + "rfc3339": IsRFC3339, + "rfc3339WithoutZone": IsRFC3339WithoutZone, + "ISO3166Alpha2": IsISO3166Alpha2, + "ISO3166Alpha3": IsISO3166Alpha3, + "ISO4217": IsISO4217, + "IMEI": IsIMEI, + "ulid": IsULID, +} + +// ISO3166Entry stores country codes +type ISO3166Entry struct { + EnglishShortName string + FrenchShortName string + Alpha2Code string + Alpha3Code string + Numeric string +} + +// ISO3166List based on https://www.iso.org/obp/ui/#search/code/ Code Type "Officially Assigned Codes" +var ISO3166List = []ISO3166Entry{ + {"Afghanistan", "Afghanistan (l')", "AF", "AFG", "004"}, + {"Albania", "Albanie (l')", "AL", "ALB", "008"}, + {"Antarctica", "Antarctique (l')", "AQ", "ATA", "010"}, + {"Algeria", "Algérie (l')", "DZ", "DZA", "012"}, + {"American Samoa", "Samoa américaines (les)", "AS", "ASM", "016"}, + {"Andorra", "Andorre (l')", "AD", "AND", "020"}, + {"Angola", "Angola (l')", "AO", "AGO", "024"}, + {"Antigua and Barbuda", "Antigua-et-Barbuda", "AG", "ATG", "028"}, + {"Azerbaijan", "Azerbaïdjan (l')", "AZ", "AZE", "031"}, + {"Argentina", "Argentine (l')", "AR", "ARG", "032"}, + {"Australia", "Australie (l')", "AU", "AUS", "036"}, + {"Austria", "Autriche (l')", "AT", "AUT", "040"}, + {"Bahamas (the)", "Bahamas (les)", "BS", "BHS", "044"}, + {"Bahrain", "Bahreïn", "BH", "BHR", "048"}, + {"Bangladesh", "Bangladesh (le)", "BD", "BGD", "050"}, + {"Armenia", "Arménie (l')", "AM", "ARM", "051"}, + {"Barbados", "Barbade (la)", "BB", "BRB", "052"}, + {"Belgium", "Belgique (la)", "BE", "BEL", "056"}, + {"Bermuda", "Bermudes (les)", "BM", "BMU", "060"}, + {"Bhutan", "Bhoutan (le)", "BT", "BTN", "064"}, + {"Bolivia (Plurinational State of)", "Bolivie (État plurinational de)", "BO", "BOL", "068"}, + {"Bosnia and Herzegovina", "Bosnie-Herzégovine (la)", "BA", "BIH", "070"}, + {"Botswana", "Botswana (le)", "BW", "BWA", "072"}, + {"Bouvet Island", "Bouvet (l'Île)", "BV", "BVT", "074"}, + {"Brazil", "Brésil (le)", "BR", "BRA", "076"}, + {"Belize", "Belize (le)", "BZ", "BLZ", "084"}, + {"British Indian Ocean Territory (the)", "Indien (le Territoire britannique de l'océan)", "IO", "IOT", "086"}, + {"Solomon Islands", "Salomon (Îles)", "SB", "SLB", "090"}, + {"Virgin Islands (British)", "Vierges britanniques (les Îles)", "VG", "VGB", "092"}, + {"Brunei Darussalam", "Brunéi Darussalam (le)", "BN", "BRN", "096"}, + {"Bulgaria", "Bulgarie (la)", "BG", "BGR", "100"}, + {"Myanmar", "Myanmar (le)", "MM", "MMR", "104"}, + {"Burundi", "Burundi (le)", "BI", "BDI", "108"}, + {"Belarus", "Bélarus (le)", "BY", "BLR", "112"}, + {"Cambodia", "Cambodge (le)", "KH", "KHM", "116"}, + {"Cameroon", "Cameroun (le)", "CM", "CMR", "120"}, + {"Canada", "Canada (le)", "CA", "CAN", "124"}, + {"Cabo Verde", "Cabo Verde", "CV", "CPV", "132"}, + {"Cayman Islands (the)", "Caïmans (les Îles)", "KY", "CYM", "136"}, + {"Central African Republic (the)", "République centrafricaine (la)", "CF", "CAF", "140"}, + {"Sri Lanka", "Sri Lanka", "LK", "LKA", "144"}, + {"Chad", "Tchad (le)", "TD", "TCD", "148"}, + {"Chile", "Chili (le)", "CL", "CHL", "152"}, + {"China", "Chine (la)", "CN", "CHN", "156"}, + {"Taiwan (Province of China)", "Taïwan (Province de Chine)", "TW", "TWN", "158"}, + {"Christmas Island", "Christmas (l'Île)", "CX", "CXR", "162"}, + {"Cocos (Keeling) Islands (the)", "Cocos (les Îles)/ Keeling (les Îles)", "CC", "CCK", "166"}, + {"Colombia", "Colombie (la)", "CO", "COL", "170"}, + {"Comoros (the)", "Comores (les)", "KM", "COM", "174"}, + {"Mayotte", "Mayotte", "YT", "MYT", "175"}, + {"Congo (the)", "Congo (le)", "CG", "COG", "178"}, + {"Congo (the Democratic Republic of the)", "Congo (la République démocratique du)", "CD", "COD", "180"}, + {"Cook Islands (the)", "Cook (les Îles)", "CK", "COK", "184"}, + {"Costa Rica", "Costa Rica (le)", "CR", "CRI", "188"}, + {"Croatia", "Croatie (la)", "HR", "HRV", "191"}, + {"Cuba", "Cuba", "CU", "CUB", "192"}, + {"Cyprus", "Chypre", "CY", "CYP", "196"}, + {"Czech Republic (the)", "tchèque (la République)", "CZ", "CZE", "203"}, + {"Benin", "Bénin (le)", "BJ", "BEN", "204"}, + {"Denmark", "Danemark (le)", "DK", "DNK", "208"}, + {"Dominica", "Dominique (la)", "DM", "DMA", "212"}, + {"Dominican Republic (the)", "dominicaine (la République)", "DO", "DOM", "214"}, + {"Ecuador", "Équateur (l')", "EC", "ECU", "218"}, + {"El Salvador", "El Salvador", "SV", "SLV", "222"}, + {"Equatorial Guinea", "Guinée équatoriale (la)", "GQ", "GNQ", "226"}, + {"Ethiopia", "Éthiopie (l')", "ET", "ETH", "231"}, + {"Eritrea", "Érythrée (l')", "ER", "ERI", "232"}, + {"Estonia", "Estonie (l')", "EE", "EST", "233"}, + {"Faroe Islands (the)", "Féroé (les Îles)", "FO", "FRO", "234"}, + {"Falkland Islands (the) [Malvinas]", "Falkland (les Îles)/Malouines (les Îles)", "FK", "FLK", "238"}, + {"South Georgia and the South Sandwich Islands", "Géorgie du Sud-et-les Îles Sandwich du Sud (la)", "GS", "SGS", "239"}, + {"Fiji", "Fidji (les)", "FJ", "FJI", "242"}, + {"Finland", "Finlande (la)", "FI", "FIN", "246"}, + {"Åland Islands", "Åland(les Îles)", "AX", "ALA", "248"}, + {"France", "France (la)", "FR", "FRA", "250"}, + {"French Guiana", "Guyane française (la )", "GF", "GUF", "254"}, + {"French Polynesia", "Polynésie française (la)", "PF", "PYF", "258"}, + {"French Southern Territories (the)", "Terres australes françaises (les)", "TF", "ATF", "260"}, + {"Djibouti", "Djibouti", "DJ", "DJI", "262"}, + {"Gabon", "Gabon (le)", "GA", "GAB", "266"}, + {"Georgia", "Géorgie (la)", "GE", "GEO", "268"}, + {"Gambia (the)", "Gambie (la)", "GM", "GMB", "270"}, + {"Palestine, State of", "Palestine, État de", "PS", "PSE", "275"}, + {"Germany", "Allemagne (l')", "DE", "DEU", "276"}, + {"Ghana", "Ghana (le)", "GH", "GHA", "288"}, + {"Gibraltar", "Gibraltar", "GI", "GIB", "292"}, + {"Kiribati", "Kiribati", "KI", "KIR", "296"}, + {"Greece", "Grèce (la)", "GR", "GRC", "300"}, + {"Greenland", "Groenland (le)", "GL", "GRL", "304"}, + {"Grenada", "Grenade (la)", "GD", "GRD", "308"}, + {"Guadeloupe", "Guadeloupe (la)", "GP", "GLP", "312"}, + {"Guam", "Guam", "GU", "GUM", "316"}, + {"Guatemala", "Guatemala (le)", "GT", "GTM", "320"}, + {"Guinea", "Guinée (la)", "GN", "GIN", "324"}, + {"Guyana", "Guyana (le)", "GY", "GUY", "328"}, + {"Haiti", "Haïti", "HT", "HTI", "332"}, + {"Heard Island and McDonald Islands", "Heard-et-Îles MacDonald (l'Île)", "HM", "HMD", "334"}, + {"Holy See (the)", "Saint-Siège (le)", "VA", "VAT", "336"}, + {"Honduras", "Honduras (le)", "HN", "HND", "340"}, + {"Hong Kong", "Hong Kong", "HK", "HKG", "344"}, + {"Hungary", "Hongrie (la)", "HU", "HUN", "348"}, + {"Iceland", "Islande (l')", "IS", "ISL", "352"}, + {"India", "Inde (l')", "IN", "IND", "356"}, + {"Indonesia", "Indonésie (l')", "ID", "IDN", "360"}, + {"Iran (Islamic Republic of)", "Iran (République Islamique d')", "IR", "IRN", "364"}, + {"Iraq", "Iraq (l')", "IQ", "IRQ", "368"}, + {"Ireland", "Irlande (l')", "IE", "IRL", "372"}, + {"Israel", "Israël", "IL", "ISR", "376"}, + {"Italy", "Italie (l')", "IT", "ITA", "380"}, + {"Côte d'Ivoire", "Côte d'Ivoire (la)", "CI", "CIV", "384"}, + {"Jamaica", "Jamaïque (la)", "JM", "JAM", "388"}, + {"Japan", "Japon (le)", "JP", "JPN", "392"}, + {"Kazakhstan", "Kazakhstan (le)", "KZ", "KAZ", "398"}, + {"Jordan", "Jordanie (la)", "JO", "JOR", "400"}, + {"Kenya", "Kenya (le)", "KE", "KEN", "404"}, + {"Korea (the Democratic People's Republic of)", "Corée (la République populaire démocratique de)", "KP", "PRK", "408"}, + {"Korea (the Republic of)", "Corée (la République de)", "KR", "KOR", "410"}, + {"Kuwait", "Koweït (le)", "KW", "KWT", "414"}, + {"Kyrgyzstan", "Kirghizistan (le)", "KG", "KGZ", "417"}, + {"Lao People's Democratic Republic (the)", "Lao, République démocratique populaire", "LA", "LAO", "418"}, + {"Lebanon", "Liban (le)", "LB", "LBN", "422"}, + {"Lesotho", "Lesotho (le)", "LS", "LSO", "426"}, + {"Latvia", "Lettonie (la)", "LV", "LVA", "428"}, + {"Liberia", "Libéria (le)", "LR", "LBR", "430"}, + {"Libya", "Libye (la)", "LY", "LBY", "434"}, + {"Liechtenstein", "Liechtenstein (le)", "LI", "LIE", "438"}, + {"Lithuania", "Lituanie (la)", "LT", "LTU", "440"}, + {"Luxembourg", "Luxembourg (le)", "LU", "LUX", "442"}, + {"Macao", "Macao", "MO", "MAC", "446"}, + {"Madagascar", "Madagascar", "MG", "MDG", "450"}, + {"Malawi", "Malawi (le)", "MW", "MWI", "454"}, + {"Malaysia", "Malaisie (la)", "MY", "MYS", "458"}, + {"Maldives", "Maldives (les)", "MV", "MDV", "462"}, + {"Mali", "Mali (le)", "ML", "MLI", "466"}, + {"Malta", "Malte", "MT", "MLT", "470"}, + {"Martinique", "Martinique (la)", "MQ", "MTQ", "474"}, + {"Mauritania", "Mauritanie (la)", "MR", "MRT", "478"}, + {"Mauritius", "Maurice", "MU", "MUS", "480"}, + {"Mexico", "Mexique (le)", "MX", "MEX", "484"}, + {"Monaco", "Monaco", "MC", "MCO", "492"}, + {"Mongolia", "Mongolie (la)", "MN", "MNG", "496"}, + {"Moldova (the Republic of)", "Moldova , République de", "MD", "MDA", "498"}, + {"Montenegro", "Monténégro (le)", "ME", "MNE", "499"}, + {"Montserrat", "Montserrat", "MS", "MSR", "500"}, + {"Morocco", "Maroc (le)", "MA", "MAR", "504"}, + {"Mozambique", "Mozambique (le)", "MZ", "MOZ", "508"}, + {"Oman", "Oman", "OM", "OMN", "512"}, + {"Namibia", "Namibie (la)", "NA", "NAM", "516"}, + {"Nauru", "Nauru", "NR", "NRU", "520"}, + {"Nepal", "Népal (le)", "NP", "NPL", "524"}, + {"Netherlands (the)", "Pays-Bas (les)", "NL", "NLD", "528"}, + {"Curaçao", "Curaçao", "CW", "CUW", "531"}, + {"Aruba", "Aruba", "AW", "ABW", "533"}, + {"Sint Maarten (Dutch part)", "Saint-Martin (partie néerlandaise)", "SX", "SXM", "534"}, + {"Bonaire, Sint Eustatius and Saba", "Bonaire, Saint-Eustache et Saba", "BQ", "BES", "535"}, + {"New Caledonia", "Nouvelle-Calédonie (la)", "NC", "NCL", "540"}, + {"Vanuatu", "Vanuatu (le)", "VU", "VUT", "548"}, + {"New Zealand", "Nouvelle-Zélande (la)", "NZ", "NZL", "554"}, + {"Nicaragua", "Nicaragua (le)", "NI", "NIC", "558"}, + {"Niger (the)", "Niger (le)", "NE", "NER", "562"}, + {"Nigeria", "Nigéria (le)", "NG", "NGA", "566"}, + {"Niue", "Niue", "NU", "NIU", "570"}, + {"Norfolk Island", "Norfolk (l'Île)", "NF", "NFK", "574"}, + {"Norway", "Norvège (la)", "NO", "NOR", "578"}, + {"Northern Mariana Islands (the)", "Mariannes du Nord (les Îles)", "MP", "MNP", "580"}, + {"United States Minor Outlying Islands (the)", "Îles mineures éloignées des États-Unis (les)", "UM", "UMI", "581"}, + {"Micronesia (Federated States of)", "Micronésie (États fédérés de)", "FM", "FSM", "583"}, + {"Marshall Islands (the)", "Marshall (Îles)", "MH", "MHL", "584"}, + {"Palau", "Palaos (les)", "PW", "PLW", "585"}, + {"Pakistan", "Pakistan (le)", "PK", "PAK", "586"}, + {"Panama", "Panama (le)", "PA", "PAN", "591"}, + {"Papua New Guinea", "Papouasie-Nouvelle-Guinée (la)", "PG", "PNG", "598"}, + {"Paraguay", "Paraguay (le)", "PY", "PRY", "600"}, + {"Peru", "Pérou (le)", "PE", "PER", "604"}, + {"Philippines (the)", "Philippines (les)", "PH", "PHL", "608"}, + {"Pitcairn", "Pitcairn", "PN", "PCN", "612"}, + {"Poland", "Pologne (la)", "PL", "POL", "616"}, + {"Portugal", "Portugal (le)", "PT", "PRT", "620"}, + {"Guinea-Bissau", "Guinée-Bissau (la)", "GW", "GNB", "624"}, + {"Timor-Leste", "Timor-Leste (le)", "TL", "TLS", "626"}, + {"Puerto Rico", "Porto Rico", "PR", "PRI", "630"}, + {"Qatar", "Qatar (le)", "QA", "QAT", "634"}, + {"Réunion", "Réunion (La)", "RE", "REU", "638"}, + {"Romania", "Roumanie (la)", "RO", "ROU", "642"}, + {"Russian Federation (the)", "Russie (la Fédération de)", "RU", "RUS", "643"}, + {"Rwanda", "Rwanda (le)", "RW", "RWA", "646"}, + {"Saint Barthélemy", "Saint-Barthélemy", "BL", "BLM", "652"}, + {"Saint Helena, Ascension and Tristan da Cunha", "Sainte-Hélène, Ascension et Tristan da Cunha", "SH", "SHN", "654"}, + {"Saint Kitts and Nevis", "Saint-Kitts-et-Nevis", "KN", "KNA", "659"}, + {"Anguilla", "Anguilla", "AI", "AIA", "660"}, + {"Saint Lucia", "Sainte-Lucie", "LC", "LCA", "662"}, + {"Saint Martin (French part)", "Saint-Martin (partie française)", "MF", "MAF", "663"}, + {"Saint Pierre and Miquelon", "Saint-Pierre-et-Miquelon", "PM", "SPM", "666"}, + {"Saint Vincent and the Grenadines", "Saint-Vincent-et-les Grenadines", "VC", "VCT", "670"}, + {"San Marino", "Saint-Marin", "SM", "SMR", "674"}, + {"Sao Tome and Principe", "Sao Tomé-et-Principe", "ST", "STP", "678"}, + {"Saudi Arabia", "Arabie saoudite (l')", "SA", "SAU", "682"}, + {"Senegal", "Sénégal (le)", "SN", "SEN", "686"}, + {"Serbia", "Serbie (la)", "RS", "SRB", "688"}, + {"Seychelles", "Seychelles (les)", "SC", "SYC", "690"}, + {"Sierra Leone", "Sierra Leone (la)", "SL", "SLE", "694"}, + {"Singapore", "Singapour", "SG", "SGP", "702"}, + {"Slovakia", "Slovaquie (la)", "SK", "SVK", "703"}, + {"Viet Nam", "Viet Nam (le)", "VN", "VNM", "704"}, + {"Slovenia", "Slovénie (la)", "SI", "SVN", "705"}, + {"Somalia", "Somalie (la)", "SO", "SOM", "706"}, + {"South Africa", "Afrique du Sud (l')", "ZA", "ZAF", "710"}, + {"Zimbabwe", "Zimbabwe (le)", "ZW", "ZWE", "716"}, + {"Spain", "Espagne (l')", "ES", "ESP", "724"}, + {"South Sudan", "Soudan du Sud (le)", "SS", "SSD", "728"}, + {"Sudan (the)", "Soudan (le)", "SD", "SDN", "729"}, + {"Western Sahara*", "Sahara occidental (le)*", "EH", "ESH", "732"}, + {"Suriname", "Suriname (le)", "SR", "SUR", "740"}, + {"Svalbard and Jan Mayen", "Svalbard et l'Île Jan Mayen (le)", "SJ", "SJM", "744"}, + {"Swaziland", "Swaziland (le)", "SZ", "SWZ", "748"}, + {"Sweden", "Suède (la)", "SE", "SWE", "752"}, + {"Switzerland", "Suisse (la)", "CH", "CHE", "756"}, + {"Syrian Arab Republic", "République arabe syrienne (la)", "SY", "SYR", "760"}, + {"Tajikistan", "Tadjikistan (le)", "TJ", "TJK", "762"}, + {"Thailand", "Thaïlande (la)", "TH", "THA", "764"}, + {"Togo", "Togo (le)", "TG", "TGO", "768"}, + {"Tokelau", "Tokelau (les)", "TK", "TKL", "772"}, + {"Tonga", "Tonga (les)", "TO", "TON", "776"}, + {"Trinidad and Tobago", "Trinité-et-Tobago (la)", "TT", "TTO", "780"}, + {"United Arab Emirates (the)", "Émirats arabes unis (les)", "AE", "ARE", "784"}, + {"Tunisia", "Tunisie (la)", "TN", "TUN", "788"}, + {"Turkey", "Turquie (la)", "TR", "TUR", "792"}, + {"Turkmenistan", "Turkménistan (le)", "TM", "TKM", "795"}, + {"Turks and Caicos Islands (the)", "Turks-et-Caïcos (les Îles)", "TC", "TCA", "796"}, + {"Tuvalu", "Tuvalu (les)", "TV", "TUV", "798"}, + {"Uganda", "Ouganda (l')", "UG", "UGA", "800"}, + {"Ukraine", "Ukraine (l')", "UA", "UKR", "804"}, + {"Macedonia (the former Yugoslav Republic of)", "Macédoine (l'ex‑République yougoslave de)", "MK", "MKD", "807"}, + {"Egypt", "Égypte (l')", "EG", "EGY", "818"}, + {"United Kingdom of Great Britain and Northern Ireland (the)", "Royaume-Uni de Grande-Bretagne et d'Irlande du Nord (le)", "GB", "GBR", "826"}, + {"Guernsey", "Guernesey", "GG", "GGY", "831"}, + {"Jersey", "Jersey", "JE", "JEY", "832"}, + {"Isle of Man", "Île de Man", "IM", "IMN", "833"}, + {"Tanzania, United Republic of", "Tanzanie, République-Unie de", "TZ", "TZA", "834"}, + {"United States of America (the)", "États-Unis d'Amérique (les)", "US", "USA", "840"}, + {"Virgin Islands (U.S.)", "Vierges des États-Unis (les Îles)", "VI", "VIR", "850"}, + {"Burkina Faso", "Burkina Faso (le)", "BF", "BFA", "854"}, + {"Uruguay", "Uruguay (l')", "UY", "URY", "858"}, + {"Uzbekistan", "Ouzbékistan (l')", "UZ", "UZB", "860"}, + {"Venezuela (Bolivarian Republic of)", "Venezuela (République bolivarienne du)", "VE", "VEN", "862"}, + {"Wallis and Futuna", "Wallis-et-Futuna", "WF", "WLF", "876"}, + {"Samoa", "Samoa (le)", "WS", "WSM", "882"}, + {"Yemen", "Yémen (le)", "YE", "YEM", "887"}, + {"Zambia", "Zambie (la)", "ZM", "ZMB", "894"}, +} + +// ISO4217List is the list of ISO currency codes +var ISO4217List = []string{ + "AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", + "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BOV", "BRL", "BSD", "BTN", "BWP", "BYN", "BZD", + "CAD", "CDF", "CHE", "CHF", "CHW", "CLF", "CLP", "CNY", "COP", "COU", "CRC", "CUC", "CUP", "CVE", "CZK", + "DJF", "DKK", "DOP", "DZD", + "EGP", "ERN", "ETB", "EUR", + "FJD", "FKP", + "GBP", "GEL", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", + "HKD", "HNL", "HRK", "HTG", "HUF", + "IDR", "ILS", "INR", "IQD", "IRR", "ISK", + "JMD", "JOD", "JPY", + "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT", + "LAK", "LBP", "LKR", "LRD", "LSL", "LYD", + "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MXV", "MYR", "MZN", + "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", + "OMR", + "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", + "QAR", + "RON", "RSD", "RUB", "RWF", + "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLL", "SOS", "SRD", "SSP", "STD", "STN", "SVC", "SYP", "SZL", + "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", + "UAH", "UGX", "USD", "USN", "UYI", "UYU", "UYW", "UZS", + "VEF", "VES", "VND", "VUV", + "WST", + "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XOF", "XPD", "XPF", "XPT", "XSU", "XTS", "XUA", "XXX", + "YER", + "ZAR", "ZMW", "ZWL", +} + +// ISO693Entry stores ISO language codes +type ISO693Entry struct { + Alpha3bCode string + Alpha2Code string + English string +} + +// ISO693List based on http://data.okfn.org/data/core/language-codes/r/language-codes-3b2.json +var ISO693List = []ISO693Entry{ + {Alpha3bCode: "aar", Alpha2Code: "aa", English: "Afar"}, + {Alpha3bCode: "abk", Alpha2Code: "ab", English: "Abkhazian"}, + {Alpha3bCode: "afr", Alpha2Code: "af", English: "Afrikaans"}, + {Alpha3bCode: "aka", Alpha2Code: "ak", English: "Akan"}, + {Alpha3bCode: "alb", Alpha2Code: "sq", English: "Albanian"}, + {Alpha3bCode: "amh", Alpha2Code: "am", English: "Amharic"}, + {Alpha3bCode: "ara", Alpha2Code: "ar", English: "Arabic"}, + {Alpha3bCode: "arg", Alpha2Code: "an", English: "Aragonese"}, + {Alpha3bCode: "arm", Alpha2Code: "hy", English: "Armenian"}, + {Alpha3bCode: "asm", Alpha2Code: "as", English: "Assamese"}, + {Alpha3bCode: "ava", Alpha2Code: "av", English: "Avaric"}, + {Alpha3bCode: "ave", Alpha2Code: "ae", English: "Avestan"}, + {Alpha3bCode: "aym", Alpha2Code: "ay", English: "Aymara"}, + {Alpha3bCode: "aze", Alpha2Code: "az", English: "Azerbaijani"}, + {Alpha3bCode: "bak", Alpha2Code: "ba", English: "Bashkir"}, + {Alpha3bCode: "bam", Alpha2Code: "bm", English: "Bambara"}, + {Alpha3bCode: "baq", Alpha2Code: "eu", English: "Basque"}, + {Alpha3bCode: "bel", Alpha2Code: "be", English: "Belarusian"}, + {Alpha3bCode: "ben", Alpha2Code: "bn", English: "Bengali"}, + {Alpha3bCode: "bih", Alpha2Code: "bh", English: "Bihari languages"}, + {Alpha3bCode: "bis", Alpha2Code: "bi", English: "Bislama"}, + {Alpha3bCode: "bos", Alpha2Code: "bs", English: "Bosnian"}, + {Alpha3bCode: "bre", Alpha2Code: "br", English: "Breton"}, + {Alpha3bCode: "bul", Alpha2Code: "bg", English: "Bulgarian"}, + {Alpha3bCode: "bur", Alpha2Code: "my", English: "Burmese"}, + {Alpha3bCode: "cat", Alpha2Code: "ca", English: "Catalan; Valencian"}, + {Alpha3bCode: "cha", Alpha2Code: "ch", English: "Chamorro"}, + {Alpha3bCode: "che", Alpha2Code: "ce", English: "Chechen"}, + {Alpha3bCode: "chi", Alpha2Code: "zh", English: "Chinese"}, + {Alpha3bCode: "chu", Alpha2Code: "cu", English: "Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic"}, + {Alpha3bCode: "chv", Alpha2Code: "cv", English: "Chuvash"}, + {Alpha3bCode: "cor", Alpha2Code: "kw", English: "Cornish"}, + {Alpha3bCode: "cos", Alpha2Code: "co", English: "Corsican"}, + {Alpha3bCode: "cre", Alpha2Code: "cr", English: "Cree"}, + {Alpha3bCode: "cze", Alpha2Code: "cs", English: "Czech"}, + {Alpha3bCode: "dan", Alpha2Code: "da", English: "Danish"}, + {Alpha3bCode: "div", Alpha2Code: "dv", English: "Divehi; Dhivehi; Maldivian"}, + {Alpha3bCode: "dut", Alpha2Code: "nl", English: "Dutch; Flemish"}, + {Alpha3bCode: "dzo", Alpha2Code: "dz", English: "Dzongkha"}, + {Alpha3bCode: "eng", Alpha2Code: "en", English: "English"}, + {Alpha3bCode: "epo", Alpha2Code: "eo", English: "Esperanto"}, + {Alpha3bCode: "est", Alpha2Code: "et", English: "Estonian"}, + {Alpha3bCode: "ewe", Alpha2Code: "ee", English: "Ewe"}, + {Alpha3bCode: "fao", Alpha2Code: "fo", English: "Faroese"}, + {Alpha3bCode: "fij", Alpha2Code: "fj", English: "Fijian"}, + {Alpha3bCode: "fin", Alpha2Code: "fi", English: "Finnish"}, + {Alpha3bCode: "fre", Alpha2Code: "fr", English: "French"}, + {Alpha3bCode: "fry", Alpha2Code: "fy", English: "Western Frisian"}, + {Alpha3bCode: "ful", Alpha2Code: "ff", English: "Fulah"}, + {Alpha3bCode: "geo", Alpha2Code: "ka", English: "Georgian"}, + {Alpha3bCode: "ger", Alpha2Code: "de", English: "German"}, + {Alpha3bCode: "gla", Alpha2Code: "gd", English: "Gaelic; Scottish Gaelic"}, + {Alpha3bCode: "gle", Alpha2Code: "ga", English: "Irish"}, + {Alpha3bCode: "glg", Alpha2Code: "gl", English: "Galician"}, + {Alpha3bCode: "glv", Alpha2Code: "gv", English: "Manx"}, + {Alpha3bCode: "gre", Alpha2Code: "el", English: "Greek, Modern (1453-)"}, + {Alpha3bCode: "grn", Alpha2Code: "gn", English: "Guarani"}, + {Alpha3bCode: "guj", Alpha2Code: "gu", English: "Gujarati"}, + {Alpha3bCode: "hat", Alpha2Code: "ht", English: "Haitian; Haitian Creole"}, + {Alpha3bCode: "hau", Alpha2Code: "ha", English: "Hausa"}, + {Alpha3bCode: "heb", Alpha2Code: "he", English: "Hebrew"}, + {Alpha3bCode: "her", Alpha2Code: "hz", English: "Herero"}, + {Alpha3bCode: "hin", Alpha2Code: "hi", English: "Hindi"}, + {Alpha3bCode: "hmo", Alpha2Code: "ho", English: "Hiri Motu"}, + {Alpha3bCode: "hrv", Alpha2Code: "hr", English: "Croatian"}, + {Alpha3bCode: "hun", Alpha2Code: "hu", English: "Hungarian"}, + {Alpha3bCode: "ibo", Alpha2Code: "ig", English: "Igbo"}, + {Alpha3bCode: "ice", Alpha2Code: "is", English: "Icelandic"}, + {Alpha3bCode: "ido", Alpha2Code: "io", English: "Ido"}, + {Alpha3bCode: "iii", Alpha2Code: "ii", English: "Sichuan Yi; Nuosu"}, + {Alpha3bCode: "iku", Alpha2Code: "iu", English: "Inuktitut"}, + {Alpha3bCode: "ile", Alpha2Code: "ie", English: "Interlingue; Occidental"}, + {Alpha3bCode: "ina", Alpha2Code: "ia", English: "Interlingua (International Auxiliary Language Association)"}, + {Alpha3bCode: "ind", Alpha2Code: "id", English: "Indonesian"}, + {Alpha3bCode: "ipk", Alpha2Code: "ik", English: "Inupiaq"}, + {Alpha3bCode: "ita", Alpha2Code: "it", English: "Italian"}, + {Alpha3bCode: "jav", Alpha2Code: "jv", English: "Javanese"}, + {Alpha3bCode: "jpn", Alpha2Code: "ja", English: "Japanese"}, + {Alpha3bCode: "kal", Alpha2Code: "kl", English: "Kalaallisut; Greenlandic"}, + {Alpha3bCode: "kan", Alpha2Code: "kn", English: "Kannada"}, + {Alpha3bCode: "kas", Alpha2Code: "ks", English: "Kashmiri"}, + {Alpha3bCode: "kau", Alpha2Code: "kr", English: "Kanuri"}, + {Alpha3bCode: "kaz", Alpha2Code: "kk", English: "Kazakh"}, + {Alpha3bCode: "khm", Alpha2Code: "km", English: "Central Khmer"}, + {Alpha3bCode: "kik", Alpha2Code: "ki", English: "Kikuyu; Gikuyu"}, + {Alpha3bCode: "kin", Alpha2Code: "rw", English: "Kinyarwanda"}, + {Alpha3bCode: "kir", Alpha2Code: "ky", English: "Kirghiz; Kyrgyz"}, + {Alpha3bCode: "kom", Alpha2Code: "kv", English: "Komi"}, + {Alpha3bCode: "kon", Alpha2Code: "kg", English: "Kongo"}, + {Alpha3bCode: "kor", Alpha2Code: "ko", English: "Korean"}, + {Alpha3bCode: "kua", Alpha2Code: "kj", English: "Kuanyama; Kwanyama"}, + {Alpha3bCode: "kur", Alpha2Code: "ku", English: "Kurdish"}, + {Alpha3bCode: "lao", Alpha2Code: "lo", English: "Lao"}, + {Alpha3bCode: "lat", Alpha2Code: "la", English: "Latin"}, + {Alpha3bCode: "lav", Alpha2Code: "lv", English: "Latvian"}, + {Alpha3bCode: "lim", Alpha2Code: "li", English: "Limburgan; Limburger; Limburgish"}, + {Alpha3bCode: "lin", Alpha2Code: "ln", English: "Lingala"}, + {Alpha3bCode: "lit", Alpha2Code: "lt", English: "Lithuanian"}, + {Alpha3bCode: "ltz", Alpha2Code: "lb", English: "Luxembourgish; Letzeburgesch"}, + {Alpha3bCode: "lub", Alpha2Code: "lu", English: "Luba-Katanga"}, + {Alpha3bCode: "lug", Alpha2Code: "lg", English: "Ganda"}, + {Alpha3bCode: "mac", Alpha2Code: "mk", English: "Macedonian"}, + {Alpha3bCode: "mah", Alpha2Code: "mh", English: "Marshallese"}, + {Alpha3bCode: "mal", Alpha2Code: "ml", English: "Malayalam"}, + {Alpha3bCode: "mao", Alpha2Code: "mi", English: "Maori"}, + {Alpha3bCode: "mar", Alpha2Code: "mr", English: "Marathi"}, + {Alpha3bCode: "may", Alpha2Code: "ms", English: "Malay"}, + {Alpha3bCode: "mlg", Alpha2Code: "mg", English: "Malagasy"}, + {Alpha3bCode: "mlt", Alpha2Code: "mt", English: "Maltese"}, + {Alpha3bCode: "mon", Alpha2Code: "mn", English: "Mongolian"}, + {Alpha3bCode: "nau", Alpha2Code: "na", English: "Nauru"}, + {Alpha3bCode: "nav", Alpha2Code: "nv", English: "Navajo; Navaho"}, + {Alpha3bCode: "nbl", Alpha2Code: "nr", English: "Ndebele, South; South Ndebele"}, + {Alpha3bCode: "nde", Alpha2Code: "nd", English: "Ndebele, North; North Ndebele"}, + {Alpha3bCode: "ndo", Alpha2Code: "ng", English: "Ndonga"}, + {Alpha3bCode: "nep", Alpha2Code: "ne", English: "Nepali"}, + {Alpha3bCode: "nno", Alpha2Code: "nn", English: "Norwegian Nynorsk; Nynorsk, Norwegian"}, + {Alpha3bCode: "nob", Alpha2Code: "nb", English: "Bokmål, Norwegian; Norwegian Bokmål"}, + {Alpha3bCode: "nor", Alpha2Code: "no", English: "Norwegian"}, + {Alpha3bCode: "nya", Alpha2Code: "ny", English: "Chichewa; Chewa; Nyanja"}, + {Alpha3bCode: "oci", Alpha2Code: "oc", English: "Occitan (post 1500); Provençal"}, + {Alpha3bCode: "oji", Alpha2Code: "oj", English: "Ojibwa"}, + {Alpha3bCode: "ori", Alpha2Code: "or", English: "Oriya"}, + {Alpha3bCode: "orm", Alpha2Code: "om", English: "Oromo"}, + {Alpha3bCode: "oss", Alpha2Code: "os", English: "Ossetian; Ossetic"}, + {Alpha3bCode: "pan", Alpha2Code: "pa", English: "Panjabi; Punjabi"}, + {Alpha3bCode: "per", Alpha2Code: "fa", English: "Persian"}, + {Alpha3bCode: "pli", Alpha2Code: "pi", English: "Pali"}, + {Alpha3bCode: "pol", Alpha2Code: "pl", English: "Polish"}, + {Alpha3bCode: "por", Alpha2Code: "pt", English: "Portuguese"}, + {Alpha3bCode: "pus", Alpha2Code: "ps", English: "Pushto; Pashto"}, + {Alpha3bCode: "que", Alpha2Code: "qu", English: "Quechua"}, + {Alpha3bCode: "roh", Alpha2Code: "rm", English: "Romansh"}, + {Alpha3bCode: "rum", Alpha2Code: "ro", English: "Romanian; Moldavian; Moldovan"}, + {Alpha3bCode: "run", Alpha2Code: "rn", English: "Rundi"}, + {Alpha3bCode: "rus", Alpha2Code: "ru", English: "Russian"}, + {Alpha3bCode: "sag", Alpha2Code: "sg", English: "Sango"}, + {Alpha3bCode: "san", Alpha2Code: "sa", English: "Sanskrit"}, + {Alpha3bCode: "sin", Alpha2Code: "si", English: "Sinhala; Sinhalese"}, + {Alpha3bCode: "slo", Alpha2Code: "sk", English: "Slovak"}, + {Alpha3bCode: "slv", Alpha2Code: "sl", English: "Slovenian"}, + {Alpha3bCode: "sme", Alpha2Code: "se", English: "Northern Sami"}, + {Alpha3bCode: "smo", Alpha2Code: "sm", English: "Samoan"}, + {Alpha3bCode: "sna", Alpha2Code: "sn", English: "Shona"}, + {Alpha3bCode: "snd", Alpha2Code: "sd", English: "Sindhi"}, + {Alpha3bCode: "som", Alpha2Code: "so", English: "Somali"}, + {Alpha3bCode: "sot", Alpha2Code: "st", English: "Sotho, Southern"}, + {Alpha3bCode: "spa", Alpha2Code: "es", English: "Spanish; Castilian"}, + {Alpha3bCode: "srd", Alpha2Code: "sc", English: "Sardinian"}, + {Alpha3bCode: "srp", Alpha2Code: "sr", English: "Serbian"}, + {Alpha3bCode: "ssw", Alpha2Code: "ss", English: "Swati"}, + {Alpha3bCode: "sun", Alpha2Code: "su", English: "Sundanese"}, + {Alpha3bCode: "swa", Alpha2Code: "sw", English: "Swahili"}, + {Alpha3bCode: "swe", Alpha2Code: "sv", English: "Swedish"}, + {Alpha3bCode: "tah", Alpha2Code: "ty", English: "Tahitian"}, + {Alpha3bCode: "tam", Alpha2Code: "ta", English: "Tamil"}, + {Alpha3bCode: "tat", Alpha2Code: "tt", English: "Tatar"}, + {Alpha3bCode: "tel", Alpha2Code: "te", English: "Telugu"}, + {Alpha3bCode: "tgk", Alpha2Code: "tg", English: "Tajik"}, + {Alpha3bCode: "tgl", Alpha2Code: "tl", English: "Tagalog"}, + {Alpha3bCode: "tha", Alpha2Code: "th", English: "Thai"}, + {Alpha3bCode: "tib", Alpha2Code: "bo", English: "Tibetan"}, + {Alpha3bCode: "tir", Alpha2Code: "ti", English: "Tigrinya"}, + {Alpha3bCode: "ton", Alpha2Code: "to", English: "Tonga (Tonga Islands)"}, + {Alpha3bCode: "tsn", Alpha2Code: "tn", English: "Tswana"}, + {Alpha3bCode: "tso", Alpha2Code: "ts", English: "Tsonga"}, + {Alpha3bCode: "tuk", Alpha2Code: "tk", English: "Turkmen"}, + {Alpha3bCode: "tur", Alpha2Code: "tr", English: "Turkish"}, + {Alpha3bCode: "twi", Alpha2Code: "tw", English: "Twi"}, + {Alpha3bCode: "uig", Alpha2Code: "ug", English: "Uighur; Uyghur"}, + {Alpha3bCode: "ukr", Alpha2Code: "uk", English: "Ukrainian"}, + {Alpha3bCode: "urd", Alpha2Code: "ur", English: "Urdu"}, + {Alpha3bCode: "uzb", Alpha2Code: "uz", English: "Uzbek"}, + {Alpha3bCode: "ven", Alpha2Code: "ve", English: "Venda"}, + {Alpha3bCode: "vie", Alpha2Code: "vi", English: "Vietnamese"}, + {Alpha3bCode: "vol", Alpha2Code: "vo", English: "Volapük"}, + {Alpha3bCode: "wel", Alpha2Code: "cy", English: "Welsh"}, + {Alpha3bCode: "wln", Alpha2Code: "wa", English: "Walloon"}, + {Alpha3bCode: "wol", Alpha2Code: "wo", English: "Wolof"}, + {Alpha3bCode: "xho", Alpha2Code: "xh", English: "Xhosa"}, + {Alpha3bCode: "yid", Alpha2Code: "yi", English: "Yiddish"}, + {Alpha3bCode: "yor", Alpha2Code: "yo", English: "Yoruba"}, + {Alpha3bCode: "zha", Alpha2Code: "za", English: "Zhuang; Chuang"}, + {Alpha3bCode: "zul", Alpha2Code: "zu", English: "Zulu"}, +} diff --git a/vendor/github.com/asaskevich/govalidator/utils.go b/vendor/github.com/asaskevich/govalidator/utils.go new file mode 100644 index 0000000..f4c30f8 --- /dev/null +++ b/vendor/github.com/asaskevich/govalidator/utils.go @@ -0,0 +1,270 @@ +package govalidator + +import ( + "errors" + "fmt" + "html" + "math" + "path" + "regexp" + "strings" + "unicode" + "unicode/utf8" +) + +// Contains checks if the string contains the substring. +func Contains(str, substring string) bool { + return strings.Contains(str, substring) +} + +// Matches checks if string matches the pattern (pattern is regular expression) +// In case of error return false +func Matches(str, pattern string) bool { + match, _ := regexp.MatchString(pattern, str) + return match +} + +// LeftTrim trims characters from the left side of the input. +// If second argument is empty, it will remove leading spaces. +func LeftTrim(str, chars string) string { + if chars == "" { + return strings.TrimLeftFunc(str, unicode.IsSpace) + } + r, _ := regexp.Compile("^[" + chars + "]+") + return r.ReplaceAllString(str, "") +} + +// RightTrim trims characters from the right side of the input. +// If second argument is empty, it will remove trailing spaces. +func RightTrim(str, chars string) string { + if chars == "" { + return strings.TrimRightFunc(str, unicode.IsSpace) + } + r, _ := regexp.Compile("[" + chars + "]+$") + return r.ReplaceAllString(str, "") +} + +// Trim trims characters from both sides of the input. +// If second argument is empty, it will remove spaces. +func Trim(str, chars string) string { + return LeftTrim(RightTrim(str, chars), chars) +} + +// WhiteList removes characters that do not appear in the whitelist. +func WhiteList(str, chars string) string { + pattern := "[^" + chars + "]+" + r, _ := regexp.Compile(pattern) + return r.ReplaceAllString(str, "") +} + +// BlackList removes characters that appear in the blacklist. +func BlackList(str, chars string) string { + pattern := "[" + chars + "]+" + r, _ := regexp.Compile(pattern) + return r.ReplaceAllString(str, "") +} + +// StripLow removes characters with a numerical value < 32 and 127, mostly control characters. +// If keep_new_lines is true, newline characters are preserved (\n and \r, hex 0xA and 0xD). +func StripLow(str string, keepNewLines bool) string { + chars := "" + if keepNewLines { + chars = "\x00-\x09\x0B\x0C\x0E-\x1F\x7F" + } else { + chars = "\x00-\x1F\x7F" + } + return BlackList(str, chars) +} + +// ReplacePattern replaces regular expression pattern in string +func ReplacePattern(str, pattern, replace string) string { + r, _ := regexp.Compile(pattern) + return r.ReplaceAllString(str, replace) +} + +// Escape replaces <, >, & and " with HTML entities. +var Escape = html.EscapeString + +func addSegment(inrune, segment []rune) []rune { + if len(segment) == 0 { + return inrune + } + if len(inrune) != 0 { + inrune = append(inrune, '_') + } + inrune = append(inrune, segment...) + return inrune +} + +// UnderscoreToCamelCase converts from underscore separated form to camel case form. +// Ex.: my_func => MyFunc +func UnderscoreToCamelCase(s string) string { + return strings.Replace(strings.Title(strings.Replace(strings.ToLower(s), "_", " ", -1)), " ", "", -1) +} + +// CamelCaseToUnderscore converts from camel case form to underscore separated form. +// Ex.: MyFunc => my_func +func CamelCaseToUnderscore(str string) string { + var output []rune + var segment []rune + for _, r := range str { + + // not treat number as separate segment + if !unicode.IsLower(r) && string(r) != "_" && !unicode.IsNumber(r) { + output = addSegment(output, segment) + segment = nil + } + segment = append(segment, unicode.ToLower(r)) + } + output = addSegment(output, segment) + return string(output) +} + +// Reverse returns reversed string +func Reverse(s string) string { + r := []rune(s) + for i, j := 0, len(r)-1; i < j; i, j = i+1, j-1 { + r[i], r[j] = r[j], r[i] + } + return string(r) +} + +// GetLines splits string by "\n" and return array of lines +func GetLines(s string) []string { + return strings.Split(s, "\n") +} + +// GetLine returns specified line of multiline string +func GetLine(s string, index int) (string, error) { + lines := GetLines(s) + if index < 0 || index >= len(lines) { + return "", errors.New("line index out of bounds") + } + return lines[index], nil +} + +// RemoveTags removes all tags from HTML string +func RemoveTags(s string) string { + return ReplacePattern(s, "<[^>]*>", "") +} + +// SafeFileName returns safe string that can be used in file names +func SafeFileName(str string) string { + name := strings.ToLower(str) + name = path.Clean(path.Base(name)) + name = strings.Trim(name, " ") + separators, err := regexp.Compile(`[ &_=+:]`) + if err == nil { + name = separators.ReplaceAllString(name, "-") + } + legal, err := regexp.Compile(`[^[:alnum:]-.]`) + if err == nil { + name = legal.ReplaceAllString(name, "") + } + for strings.Contains(name, "--") { + name = strings.Replace(name, "--", "-", -1) + } + return name +} + +// NormalizeEmail canonicalize an email address. +// The local part of the email address is lowercased for all domains; the hostname is always lowercased and +// the local part of the email address is always lowercased for hosts that are known to be case-insensitive (currently only GMail). +// Normalization follows special rules for known providers: currently, GMail addresses have dots removed in the local part and +// are stripped of tags (e.g. some.one+tag@gmail.com becomes someone@gmail.com) and all @googlemail.com addresses are +// normalized to @gmail.com. +func NormalizeEmail(str string) (string, error) { + if !IsEmail(str) { + return "", fmt.Errorf("%s is not an email", str) + } + parts := strings.Split(str, "@") + parts[0] = strings.ToLower(parts[0]) + parts[1] = strings.ToLower(parts[1]) + if parts[1] == "gmail.com" || parts[1] == "googlemail.com" { + parts[1] = "gmail.com" + parts[0] = strings.Split(ReplacePattern(parts[0], `\.`, ""), "+")[0] + } + return strings.Join(parts, "@"), nil +} + +// Truncate a string to the closest length without breaking words. +func Truncate(str string, length int, ending string) string { + var aftstr, befstr string + if len(str) > length { + words := strings.Fields(str) + before, present := 0, 0 + for i := range words { + befstr = aftstr + before = present + aftstr = aftstr + words[i] + " " + present = len(aftstr) + if present > length && i != 0 { + if (length - before) < (present - length) { + return Trim(befstr, " /\\.,\"'#!?&@+-") + ending + } + return Trim(aftstr, " /\\.,\"'#!?&@+-") + ending + } + } + } + + return str +} + +// PadLeft pads left side of a string if size of string is less then indicated pad length +func PadLeft(str string, padStr string, padLen int) string { + return buildPadStr(str, padStr, padLen, true, false) +} + +// PadRight pads right side of a string if size of string is less then indicated pad length +func PadRight(str string, padStr string, padLen int) string { + return buildPadStr(str, padStr, padLen, false, true) +} + +// PadBoth pads both sides of a string if size of string is less then indicated pad length +func PadBoth(str string, padStr string, padLen int) string { + return buildPadStr(str, padStr, padLen, true, true) +} + +// PadString either left, right or both sides. +// Note that padding string can be unicode and more then one character +func buildPadStr(str string, padStr string, padLen int, padLeft bool, padRight bool) string { + + // When padded length is less then the current string size + if padLen < utf8.RuneCountInString(str) { + return str + } + + padLen -= utf8.RuneCountInString(str) + + targetLen := padLen + + targetLenLeft := targetLen + targetLenRight := targetLen + if padLeft && padRight { + targetLenLeft = padLen / 2 + targetLenRight = padLen - targetLenLeft + } + + strToRepeatLen := utf8.RuneCountInString(padStr) + + repeatTimes := int(math.Ceil(float64(targetLen) / float64(strToRepeatLen))) + repeatedString := strings.Repeat(padStr, repeatTimes) + + leftSide := "" + if padLeft { + leftSide = repeatedString[0:targetLenLeft] + } + + rightSide := "" + if padRight { + rightSide = repeatedString[0:targetLenRight] + } + + return leftSide + str + rightSide +} + +// TruncatingErrorf removes extra args from fmt.Errorf if not formatted in the str object +func TruncatingErrorf(str string, args ...interface{}) error { + n := strings.Count(str, "%s") + return fmt.Errorf(str, args[:n]...) +} diff --git a/vendor/github.com/asaskevich/govalidator/validator.go b/vendor/github.com/asaskevich/govalidator/validator.go new file mode 100644 index 0000000..4779e82 --- /dev/null +++ b/vendor/github.com/asaskevich/govalidator/validator.go @@ -0,0 +1,1776 @@ +// Package govalidator is package of validators and sanitizers for strings, structs and collections. +package govalidator + +import ( + "bytes" + "crypto/rsa" + "crypto/x509" + "encoding/base64" + "encoding/json" + "encoding/pem" + "fmt" + "io/ioutil" + "net" + "net/url" + "reflect" + "regexp" + "sort" + "strconv" + "strings" + "time" + "unicode" + "unicode/utf8" +) + +var ( + fieldsRequiredByDefault bool + nilPtrAllowedByRequired = false + notNumberRegexp = regexp.MustCompile("[^0-9]+") + whiteSpacesAndMinus = regexp.MustCompile(`[\s-]+`) + paramsRegexp = regexp.MustCompile(`\(.*\)$`) +) + +const maxURLRuneCount = 2083 +const minURLRuneCount = 3 +const rfc3339WithoutZone = "2006-01-02T15:04:05" + +// SetFieldsRequiredByDefault causes validation to fail when struct fields +// do not include validations or are not explicitly marked as exempt (using `valid:"-"` or `valid:"email,optional"`). +// This struct definition will fail govalidator.ValidateStruct() (and the field values do not matter): +// +// type exampleStruct struct { +// Name string `` +// Email string `valid:"email"` +// +// This, however, will only fail when Email is empty or an invalid email address: +// +// type exampleStruct2 struct { +// Name string `valid:"-"` +// Email string `valid:"email"` +// +// Lastly, this will only fail when Email is an invalid email address but not when it's empty: +// +// type exampleStruct2 struct { +// Name string `valid:"-"` +// Email string `valid:"email,optional"` +func SetFieldsRequiredByDefault(value bool) { + fieldsRequiredByDefault = value +} + +// SetNilPtrAllowedByRequired causes validation to pass for nil ptrs when a field is set to required. +// The validation will still reject ptr fields in their zero value state. Example with this enabled: +// +// type exampleStruct struct { +// Name *string `valid:"required"` +// +// With `Name` set to "", this will be considered invalid input and will cause a validation error. +// With `Name` set to nil, this will be considered valid by validation. +// By default this is disabled. +func SetNilPtrAllowedByRequired(value bool) { + nilPtrAllowedByRequired = value +} + +// IsEmail checks if the string is an email. +func IsEmail(str string) bool { + // TODO uppercase letters are not supported + return rxEmail.MatchString(str) +} + +// IsExistingEmail checks if the string is an email of existing domain +func IsExistingEmail(email string) bool { + + if len(email) < 6 || len(email) > 254 { + return false + } + at := strings.LastIndex(email, "@") + if at <= 0 || at > len(email)-3 { + return false + } + user := email[:at] + host := email[at+1:] + if len(user) > 64 { + return false + } + switch host { + case "localhost", "example.com": + return true + } + if userDotRegexp.MatchString(user) || !userRegexp.MatchString(user) || !hostRegexp.MatchString(host) { + return false + } + if _, err := net.LookupMX(host); err != nil { + if _, err := net.LookupIP(host); err != nil { + return false + } + } + + return true +} + +// IsURL checks if the string is an URL. +func IsURL(str string) bool { + if str == "" || utf8.RuneCountInString(str) >= maxURLRuneCount || len(str) <= minURLRuneCount || strings.HasPrefix(str, ".") { + return false + } + strTemp := str + if strings.Contains(str, ":") && !strings.Contains(str, "://") { + // support no indicated urlscheme but with colon for port number + // http:// is appended so url.Parse will succeed, strTemp used so it does not impact rxURL.MatchString + strTemp = "http://" + str + } + u, err := url.Parse(strTemp) + if err != nil { + return false + } + if strings.HasPrefix(u.Host, ".") { + return false + } + if u.Host == "" && (u.Path != "" && !strings.Contains(u.Path, ".")) { + return false + } + return rxURL.MatchString(str) +} + +// IsRequestURL checks if the string rawurl, assuming +// it was received in an HTTP request, is a valid +// URL confirm to RFC 3986 +func IsRequestURL(rawurl string) bool { + url, err := url.ParseRequestURI(rawurl) + if err != nil { + return false //Couldn't even parse the rawurl + } + if len(url.Scheme) == 0 { + return false //No Scheme found + } + return true +} + +// IsRequestURI checks if the string rawurl, assuming +// it was received in an HTTP request, is an +// absolute URI or an absolute path. +func IsRequestURI(rawurl string) bool { + _, err := url.ParseRequestURI(rawurl) + return err == nil +} + +// IsAlpha checks if the string contains only letters (a-zA-Z). Empty string is valid. +func IsAlpha(str string) bool { + if IsNull(str) { + return true + } + return rxAlpha.MatchString(str) +} + +// IsUTFLetter checks if the string contains only unicode letter characters. +// Similar to IsAlpha but for all languages. Empty string is valid. +func IsUTFLetter(str string) bool { + if IsNull(str) { + return true + } + + for _, c := range str { + if !unicode.IsLetter(c) { + return false + } + } + return true + +} + +// IsAlphanumeric checks if the string contains only letters and numbers. Empty string is valid. +func IsAlphanumeric(str string) bool { + if IsNull(str) { + return true + } + return rxAlphanumeric.MatchString(str) +} + +// IsUTFLetterNumeric checks if the string contains only unicode letters and numbers. Empty string is valid. +func IsUTFLetterNumeric(str string) bool { + if IsNull(str) { + return true + } + for _, c := range str { + if !unicode.IsLetter(c) && !unicode.IsNumber(c) { //letters && numbers are ok + return false + } + } + return true + +} + +// IsNumeric checks if the string contains only numbers. Empty string is valid. +func IsNumeric(str string) bool { + if IsNull(str) { + return true + } + return rxNumeric.MatchString(str) +} + +// IsUTFNumeric checks if the string contains only unicode numbers of any kind. +// Numbers can be 0-9 but also Fractions ¾,Roman Ⅸ and Hangzhou 〩. Empty string is valid. +func IsUTFNumeric(str string) bool { + if IsNull(str) { + return true + } + if strings.IndexAny(str, "+-") > 0 { + return false + } + if len(str) > 1 { + str = strings.TrimPrefix(str, "-") + str = strings.TrimPrefix(str, "+") + } + for _, c := range str { + if !unicode.IsNumber(c) { //numbers && minus sign are ok + return false + } + } + return true + +} + +// IsUTFDigit checks if the string contains only unicode radix-10 decimal digits. Empty string is valid. +func IsUTFDigit(str string) bool { + if IsNull(str) { + return true + } + if strings.IndexAny(str, "+-") > 0 { + return false + } + if len(str) > 1 { + str = strings.TrimPrefix(str, "-") + str = strings.TrimPrefix(str, "+") + } + for _, c := range str { + if !unicode.IsDigit(c) { //digits && minus sign are ok + return false + } + } + return true + +} + +// IsHexadecimal checks if the string is a hexadecimal number. +func IsHexadecimal(str string) bool { + return rxHexadecimal.MatchString(str) +} + +// IsHexcolor checks if the string is a hexadecimal color. +func IsHexcolor(str string) bool { + return rxHexcolor.MatchString(str) +} + +// IsRGBcolor checks if the string is a valid RGB color in form rgb(RRR, GGG, BBB). +func IsRGBcolor(str string) bool { + return rxRGBcolor.MatchString(str) +} + +// IsLowerCase checks if the string is lowercase. Empty string is valid. +func IsLowerCase(str string) bool { + if IsNull(str) { + return true + } + return str == strings.ToLower(str) +} + +// IsUpperCase checks if the string is uppercase. Empty string is valid. +func IsUpperCase(str string) bool { + if IsNull(str) { + return true + } + return str == strings.ToUpper(str) +} + +// HasLowerCase checks if the string contains at least 1 lowercase. Empty string is valid. +func HasLowerCase(str string) bool { + if IsNull(str) { + return true + } + return rxHasLowerCase.MatchString(str) +} + +// HasUpperCase checks if the string contains as least 1 uppercase. Empty string is valid. +func HasUpperCase(str string) bool { + if IsNull(str) { + return true + } + return rxHasUpperCase.MatchString(str) +} + +// IsInt checks if the string is an integer. Empty string is valid. +func IsInt(str string) bool { + if IsNull(str) { + return true + } + return rxInt.MatchString(str) +} + +// IsFloat checks if the string is a float. +func IsFloat(str string) bool { + return str != "" && rxFloat.MatchString(str) +} + +// IsDivisibleBy checks if the string is a number that's divisible by another. +// If second argument is not valid integer or zero, it's return false. +// Otherwise, if first argument is not valid integer or zero, it's return true (Invalid string converts to zero). +func IsDivisibleBy(str, num string) bool { + f, _ := ToFloat(str) + p := int64(f) + q, _ := ToInt(num) + if q == 0 { + return false + } + return (p == 0) || (p%q == 0) +} + +// IsNull checks if the string is null. +func IsNull(str string) bool { + return len(str) == 0 +} + +// IsNotNull checks if the string is not null. +func IsNotNull(str string) bool { + return !IsNull(str) +} + +// HasWhitespaceOnly checks the string only contains whitespace +func HasWhitespaceOnly(str string) bool { + return len(str) > 0 && rxHasWhitespaceOnly.MatchString(str) +} + +// HasWhitespace checks if the string contains any whitespace +func HasWhitespace(str string) bool { + return len(str) > 0 && rxHasWhitespace.MatchString(str) +} + +// IsByteLength checks if the string's length (in bytes) falls in a range. +func IsByteLength(str string, min, max int) bool { + return len(str) >= min && len(str) <= max +} + +// IsUUIDv3 checks if the string is a UUID version 3. +func IsUUIDv3(str string) bool { + return rxUUID3.MatchString(str) +} + +// IsUUIDv4 checks if the string is a UUID version 4. +func IsUUIDv4(str string) bool { + return rxUUID4.MatchString(str) +} + +// IsUUIDv5 checks if the string is a UUID version 5. +func IsUUIDv5(str string) bool { + return rxUUID5.MatchString(str) +} + +// IsUUID checks if the string is a UUID (version 3, 4 or 5). +func IsUUID(str string) bool { + return rxUUID.MatchString(str) +} + +// Byte to index table for O(1) lookups when unmarshaling. +// We use 0xFF as sentinel value for invalid indexes. +var ulidDec = [...]byte{ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x01, + 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, + 0x0F, 0x10, 0x11, 0xFF, 0x12, 0x13, 0xFF, 0x14, 0x15, 0xFF, + 0x16, 0x17, 0x18, 0x19, 0x1A, 0xFF, 0x1B, 0x1C, 0x1D, 0x1E, + 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0x0B, 0x0C, + 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0xFF, 0x12, 0x13, 0xFF, 0x14, + 0x15, 0xFF, 0x16, 0x17, 0x18, 0x19, 0x1A, 0xFF, 0x1B, 0x1C, + 0x1D, 0x1E, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, +} + +// EncodedSize is the length of a text encoded ULID. +const ulidEncodedSize = 26 + +// IsULID checks if the string is a ULID. +// +// Implementation got from: +// +// https://github.com/oklog/ulid (Apache-2.0 License) +func IsULID(str string) bool { + // Check if a base32 encoded ULID is the right length. + if len(str) != ulidEncodedSize { + return false + } + + // Check if all the characters in a base32 encoded ULID are part of the + // expected base32 character set. + if ulidDec[str[0]] == 0xFF || + ulidDec[str[1]] == 0xFF || + ulidDec[str[2]] == 0xFF || + ulidDec[str[3]] == 0xFF || + ulidDec[str[4]] == 0xFF || + ulidDec[str[5]] == 0xFF || + ulidDec[str[6]] == 0xFF || + ulidDec[str[7]] == 0xFF || + ulidDec[str[8]] == 0xFF || + ulidDec[str[9]] == 0xFF || + ulidDec[str[10]] == 0xFF || + ulidDec[str[11]] == 0xFF || + ulidDec[str[12]] == 0xFF || + ulidDec[str[13]] == 0xFF || + ulidDec[str[14]] == 0xFF || + ulidDec[str[15]] == 0xFF || + ulidDec[str[16]] == 0xFF || + ulidDec[str[17]] == 0xFF || + ulidDec[str[18]] == 0xFF || + ulidDec[str[19]] == 0xFF || + ulidDec[str[20]] == 0xFF || + ulidDec[str[21]] == 0xFF || + ulidDec[str[22]] == 0xFF || + ulidDec[str[23]] == 0xFF || + ulidDec[str[24]] == 0xFF || + ulidDec[str[25]] == 0xFF { + return false + } + + // Check if the first character in a base32 encoded ULID will overflow. This + // happens because the base32 representation encodes 130 bits, while the + // ULID is only 128 bits. + // + // See https://github.com/oklog/ulid/issues/9 for details. + if str[0] > '7' { + return false + } + return true +} + +// IsCreditCard checks if the string is a credit card. +func IsCreditCard(str string) bool { + sanitized := whiteSpacesAndMinus.ReplaceAllString(str, "") + if !rxCreditCard.MatchString(sanitized) { + return false + } + + number, _ := ToInt(sanitized) + number, lastDigit := number/10, number%10 + + var sum int64 + for i := 0; number > 0; i++ { + digit := number % 10 + + if i%2 == 0 { + digit *= 2 + if digit > 9 { + digit -= 9 + } + } + + sum += digit + number = number / 10 + } + + return (sum+lastDigit)%10 == 0 +} + +// IsISBN10 checks if the string is an ISBN version 10. +func IsISBN10(str string) bool { + return IsISBN(str, 10) +} + +// IsISBN13 checks if the string is an ISBN version 13. +func IsISBN13(str string) bool { + return IsISBN(str, 13) +} + +// IsISBN checks if the string is an ISBN (version 10 or 13). +// If version value is not equal to 10 or 13, it will be checks both variants. +func IsISBN(str string, version int) bool { + sanitized := whiteSpacesAndMinus.ReplaceAllString(str, "") + var checksum int32 + var i int32 + if version == 10 { + if !rxISBN10.MatchString(sanitized) { + return false + } + for i = 0; i < 9; i++ { + checksum += (i + 1) * int32(sanitized[i]-'0') + } + if sanitized[9] == 'X' { + checksum += 10 * 10 + } else { + checksum += 10 * int32(sanitized[9]-'0') + } + if checksum%11 == 0 { + return true + } + return false + } else if version == 13 { + if !rxISBN13.MatchString(sanitized) { + return false + } + factor := []int32{1, 3} + for i = 0; i < 12; i++ { + checksum += factor[i%2] * int32(sanitized[i]-'0') + } + return (int32(sanitized[12]-'0'))-((10-(checksum%10))%10) == 0 + } + return IsISBN(str, 10) || IsISBN(str, 13) +} + +// IsJSON checks if the string is valid JSON (note: uses json.Unmarshal). +func IsJSON(str string) bool { + var js json.RawMessage + return json.Unmarshal([]byte(str), &js) == nil +} + +// IsMultibyte checks if the string contains one or more multibyte chars. Empty string is valid. +func IsMultibyte(str string) bool { + if IsNull(str) { + return true + } + return rxMultibyte.MatchString(str) +} + +// IsASCII checks if the string contains ASCII chars only. Empty string is valid. +func IsASCII(str string) bool { + if IsNull(str) { + return true + } + return rxASCII.MatchString(str) +} + +// IsPrintableASCII checks if the string contains printable ASCII chars only. Empty string is valid. +func IsPrintableASCII(str string) bool { + if IsNull(str) { + return true + } + return rxPrintableASCII.MatchString(str) +} + +// IsFullWidth checks if the string contains any full-width chars. Empty string is valid. +func IsFullWidth(str string) bool { + if IsNull(str) { + return true + } + return rxFullWidth.MatchString(str) +} + +// IsHalfWidth checks if the string contains any half-width chars. Empty string is valid. +func IsHalfWidth(str string) bool { + if IsNull(str) { + return true + } + return rxHalfWidth.MatchString(str) +} + +// IsVariableWidth checks if the string contains a mixture of full and half-width chars. Empty string is valid. +func IsVariableWidth(str string) bool { + if IsNull(str) { + return true + } + return rxHalfWidth.MatchString(str) && rxFullWidth.MatchString(str) +} + +// IsBase64 checks if a string is base64 encoded. +func IsBase64(str string) bool { + return rxBase64.MatchString(str) +} + +// IsFilePath checks is a string is Win or Unix file path and returns it's type. +func IsFilePath(str string) (bool, int) { + if rxWinPath.MatchString(str) { + //check windows path limit see: + // http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx#maxpath + if len(str[3:]) > 32767 { + return false, Win + } + return true, Win + } else if rxUnixPath.MatchString(str) { + return true, Unix + } + return false, Unknown +} + +// IsWinFilePath checks both relative & absolute paths in Windows +func IsWinFilePath(str string) bool { + if rxARWinPath.MatchString(str) { + //check windows path limit see: + // http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx#maxpath + if len(str[3:]) > 32767 { + return false + } + return true + } + return false +} + +// IsUnixFilePath checks both relative & absolute paths in Unix +func IsUnixFilePath(str string) bool { + if rxARUnixPath.MatchString(str) { + return true + } + return false +} + +// IsDataURI checks if a string is base64 encoded data URI such as an image +func IsDataURI(str string) bool { + dataURI := strings.Split(str, ",") + if !rxDataURI.MatchString(dataURI[0]) { + return false + } + return IsBase64(dataURI[1]) +} + +// IsMagnetURI checks if a string is valid magnet URI +func IsMagnetURI(str string) bool { + return rxMagnetURI.MatchString(str) +} + +// IsISO3166Alpha2 checks if a string is valid two-letter country code +func IsISO3166Alpha2(str string) bool { + for _, entry := range ISO3166List { + if str == entry.Alpha2Code { + return true + } + } + return false +} + +// IsISO3166Alpha3 checks if a string is valid three-letter country code +func IsISO3166Alpha3(str string) bool { + for _, entry := range ISO3166List { + if str == entry.Alpha3Code { + return true + } + } + return false +} + +// IsISO693Alpha2 checks if a string is valid two-letter language code +func IsISO693Alpha2(str string) bool { + for _, entry := range ISO693List { + if str == entry.Alpha2Code { + return true + } + } + return false +} + +// IsISO693Alpha3b checks if a string is valid three-letter language code +func IsISO693Alpha3b(str string) bool { + for _, entry := range ISO693List { + if str == entry.Alpha3bCode { + return true + } + } + return false +} + +// IsDNSName will validate the given string as a DNS name +func IsDNSName(str string) bool { + if str == "" || len(strings.Replace(str, ".", "", -1)) > 255 { + // constraints already violated + return false + } + return !IsIP(str) && rxDNSName.MatchString(str) +} + +// IsHash checks if a string is a hash of type algorithm. +// Algorithm is one of ['md4', 'md5', 'sha1', 'sha256', 'sha384', 'sha512', 'ripemd128', 'ripemd160', 'tiger128', 'tiger160', 'tiger192', 'crc32', 'crc32b'] +func IsHash(str string, algorithm string) bool { + var len string + algo := strings.ToLower(algorithm) + + if algo == "crc32" || algo == "crc32b" { + len = "8" + } else if algo == "md5" || algo == "md4" || algo == "ripemd128" || algo == "tiger128" { + len = "32" + } else if algo == "sha1" || algo == "ripemd160" || algo == "tiger160" { + len = "40" + } else if algo == "tiger192" { + len = "48" + } else if algo == "sha3-224" { + len = "56" + } else if algo == "sha256" || algo == "sha3-256" { + len = "64" + } else if algo == "sha384" || algo == "sha3-384" { + len = "96" + } else if algo == "sha512" || algo == "sha3-512" { + len = "128" + } else { + return false + } + + return Matches(str, "^[a-f0-9]{"+len+"}$") +} + +// IsSHA3224 checks is a string is a SHA3-224 hash. Alias for `IsHash(str, "sha3-224")` +func IsSHA3224(str string) bool { + return IsHash(str, "sha3-224") +} + +// IsSHA3256 checks is a string is a SHA3-256 hash. Alias for `IsHash(str, "sha3-256")` +func IsSHA3256(str string) bool { + return IsHash(str, "sha3-256") +} + +// IsSHA3384 checks is a string is a SHA3-384 hash. Alias for `IsHash(str, "sha3-384")` +func IsSHA3384(str string) bool { + return IsHash(str, "sha3-384") +} + +// IsSHA3512 checks is a string is a SHA3-512 hash. Alias for `IsHash(str, "sha3-512")` +func IsSHA3512(str string) bool { + return IsHash(str, "sha3-512") +} + +// IsSHA512 checks is a string is a SHA512 hash. Alias for `IsHash(str, "sha512")` +func IsSHA512(str string) bool { + return IsHash(str, "sha512") +} + +// IsSHA384 checks is a string is a SHA384 hash. Alias for `IsHash(str, "sha384")` +func IsSHA384(str string) bool { + return IsHash(str, "sha384") +} + +// IsSHA256 checks is a string is a SHA256 hash. Alias for `IsHash(str, "sha256")` +func IsSHA256(str string) bool { + return IsHash(str, "sha256") +} + +// IsTiger192 checks is a string is a Tiger192 hash. Alias for `IsHash(str, "tiger192")` +func IsTiger192(str string) bool { + return IsHash(str, "tiger192") +} + +// IsTiger160 checks is a string is a Tiger160 hash. Alias for `IsHash(str, "tiger160")` +func IsTiger160(str string) bool { + return IsHash(str, "tiger160") +} + +// IsRipeMD160 checks is a string is a RipeMD160 hash. Alias for `IsHash(str, "ripemd160")` +func IsRipeMD160(str string) bool { + return IsHash(str, "ripemd160") +} + +// IsSHA1 checks is a string is a SHA-1 hash. Alias for `IsHash(str, "sha1")` +func IsSHA1(str string) bool { + return IsHash(str, "sha1") +} + +// IsTiger128 checks is a string is a Tiger128 hash. Alias for `IsHash(str, "tiger128")` +func IsTiger128(str string) bool { + return IsHash(str, "tiger128") +} + +// IsRipeMD128 checks is a string is a RipeMD128 hash. Alias for `IsHash(str, "ripemd128")` +func IsRipeMD128(str string) bool { + return IsHash(str, "ripemd128") +} + +// IsCRC32 checks is a string is a CRC32 hash. Alias for `IsHash(str, "crc32")` +func IsCRC32(str string) bool { + return IsHash(str, "crc32") +} + +// IsCRC32b checks is a string is a CRC32b hash. Alias for `IsHash(str, "crc32b")` +func IsCRC32b(str string) bool { + return IsHash(str, "crc32b") +} + +// IsMD5 checks is a string is a MD5 hash. Alias for `IsHash(str, "md5")` +func IsMD5(str string) bool { + return IsHash(str, "md5") +} + +// IsMD4 checks is a string is a MD4 hash. Alias for `IsHash(str, "md4")` +func IsMD4(str string) bool { + return IsHash(str, "md4") +} + +// IsDialString validates the given string for usage with the various Dial() functions +func IsDialString(str string) bool { + if h, p, err := net.SplitHostPort(str); err == nil && h != "" && p != "" && (IsDNSName(h) || IsIP(h)) && IsPort(p) { + return true + } + + return false +} + +// IsIP checks if a string is either IP version 4 or 6. Alias for `net.ParseIP` +func IsIP(str string) bool { + return net.ParseIP(str) != nil +} + +// IsPort checks if a string represents a valid port +func IsPort(str string) bool { + if i, err := strconv.Atoi(str); err == nil && i > 0 && i < 65536 { + return true + } + return false +} + +// IsIPv4 checks if the string is an IP version 4. +func IsIPv4(str string) bool { + ip := net.ParseIP(str) + return ip != nil && strings.Contains(str, ".") +} + +// IsIPv6 checks if the string is an IP version 6. +func IsIPv6(str string) bool { + ip := net.ParseIP(str) + return ip != nil && strings.Contains(str, ":") +} + +// IsCIDR checks if the string is an valid CIDR notiation (IPV4 & IPV6) +func IsCIDR(str string) bool { + _, _, err := net.ParseCIDR(str) + return err == nil +} + +// IsMAC checks if a string is valid MAC address. +// Possible MAC formats: +// 01:23:45:67:89:ab +// 01:23:45:67:89:ab:cd:ef +// 01-23-45-67-89-ab +// 01-23-45-67-89-ab-cd-ef +// 0123.4567.89ab +// 0123.4567.89ab.cdef +func IsMAC(str string) bool { + _, err := net.ParseMAC(str) + return err == nil +} + +// IsHost checks if the string is a valid IP (both v4 and v6) or a valid DNS name +func IsHost(str string) bool { + return IsIP(str) || IsDNSName(str) +} + +// IsMongoID checks if the string is a valid hex-encoded representation of a MongoDB ObjectId. +func IsMongoID(str string) bool { + return rxHexadecimal.MatchString(str) && (len(str) == 24) +} + +// IsLatitude checks if a string is valid latitude. +func IsLatitude(str string) bool { + return rxLatitude.MatchString(str) +} + +// IsLongitude checks if a string is valid longitude. +func IsLongitude(str string) bool { + return rxLongitude.MatchString(str) +} + +// IsIMEI checks if a string is valid IMEI +func IsIMEI(str string) bool { + return rxIMEI.MatchString(str) +} + +// IsIMSI checks if a string is valid IMSI +func IsIMSI(str string) bool { + if !rxIMSI.MatchString(str) { + return false + } + + mcc, err := strconv.ParseInt(str[0:3], 10, 32) + if err != nil { + return false + } + + switch mcc { + case 202, 204, 206, 208, 212, 213, 214, 216, 218, 219: + case 220, 221, 222, 226, 228, 230, 231, 232, 234, 235: + case 238, 240, 242, 244, 246, 247, 248, 250, 255, 257: + case 259, 260, 262, 266, 268, 270, 272, 274, 276, 278: + case 280, 282, 283, 284, 286, 288, 289, 290, 292, 293: + case 294, 295, 297, 302, 308, 310, 311, 312, 313, 314: + case 315, 316, 330, 332, 334, 338, 340, 342, 344, 346: + case 348, 350, 352, 354, 356, 358, 360, 362, 363, 364: + case 365, 366, 368, 370, 372, 374, 376, 400, 401, 402: + case 404, 405, 406, 410, 412, 413, 414, 415, 416, 417: + case 418, 419, 420, 421, 422, 424, 425, 426, 427, 428: + case 429, 430, 431, 432, 434, 436, 437, 438, 440, 441: + case 450, 452, 454, 455, 456, 457, 460, 461, 466, 467: + case 470, 472, 502, 505, 510, 514, 515, 520, 525, 528: + case 530, 536, 537, 539, 540, 541, 542, 543, 544, 545: + case 546, 547, 548, 549, 550, 551, 552, 553, 554, 555: + case 602, 603, 604, 605, 606, 607, 608, 609, 610, 611: + case 612, 613, 614, 615, 616, 617, 618, 619, 620, 621: + case 622, 623, 624, 625, 626, 627, 628, 629, 630, 631: + case 632, 633, 634, 635, 636, 637, 638, 639, 640, 641: + case 642, 643, 645, 646, 647, 648, 649, 650, 651, 652: + case 653, 654, 655, 657, 658, 659, 702, 704, 706, 708: + case 710, 712, 714, 716, 722, 724, 730, 732, 734, 736: + case 738, 740, 742, 744, 746, 748, 750, 995: + return true + default: + return false + } + return true +} + +// IsRsaPublicKey checks if a string is valid public key with provided length +func IsRsaPublicKey(str string, keylen int) bool { + bb := bytes.NewBufferString(str) + pemBytes, err := ioutil.ReadAll(bb) + if err != nil { + return false + } + block, _ := pem.Decode(pemBytes) + if block != nil && block.Type != "PUBLIC KEY" { + return false + } + var der []byte + + if block != nil { + der = block.Bytes + } else { + der, err = base64.StdEncoding.DecodeString(str) + if err != nil { + return false + } + } + + key, err := x509.ParsePKIXPublicKey(der) + if err != nil { + return false + } + pubkey, ok := key.(*rsa.PublicKey) + if !ok { + return false + } + bitlen := len(pubkey.N.Bytes()) * 8 + return bitlen == int(keylen) +} + +// IsRegex checks if a give string is a valid regex with RE2 syntax or not +func IsRegex(str string) bool { + if _, err := regexp.Compile(str); err == nil { + return true + } + return false +} + +func toJSONName(tag string) string { + if tag == "" { + return "" + } + + // JSON name always comes first. If there's no options then split[0] is + // JSON name, if JSON name is not set, then split[0] is an empty string. + split := strings.SplitN(tag, ",", 2) + + name := split[0] + + // However it is possible that the field is skipped when + // (de-)serializing from/to JSON, in which case assume that there is no + // tag name to use + if name == "-" { + return "" + } + return name +} + +func prependPathToErrors(err error, path string) error { + switch err2 := err.(type) { + case Error: + err2.Path = append([]string{path}, err2.Path...) + return err2 + case Errors: + errors := err2.Errors() + for i, err3 := range errors { + errors[i] = prependPathToErrors(err3, path) + } + return err2 + } + return err +} + +// ValidateArray performs validation according to condition iterator that validates every element of the array +func ValidateArray(array []interface{}, iterator ConditionIterator) bool { + return Every(array, iterator) +} + +// ValidateMap use validation map for fields. +// result will be equal to `false` if there are any errors. +// s is the map containing the data to be validated. +// m is the validation map in the form: +// +// map[string]interface{}{"name":"required,alpha","address":map[string]interface{}{"line1":"required,alphanum"}} +func ValidateMap(s map[string]interface{}, m map[string]interface{}) (bool, error) { + if s == nil { + return true, nil + } + result := true + var err error + var errs Errors + var index int + val := reflect.ValueOf(s) + for key, value := range s { + presentResult := true + validator, ok := m[key] + if !ok { + presentResult = false + var err error + err = fmt.Errorf("all map keys has to be present in the validation map; got %s", key) + err = prependPathToErrors(err, key) + errs = append(errs, err) + } + valueField := reflect.ValueOf(value) + mapResult := true + typeResult := true + structResult := true + resultField := true + switch subValidator := validator.(type) { + case map[string]interface{}: + var err error + if v, ok := value.(map[string]interface{}); !ok { + mapResult = false + err = fmt.Errorf("map validator has to be for the map type only; got %s", valueField.Type().String()) + err = prependPathToErrors(err, key) + errs = append(errs, err) + } else { + mapResult, err = ValidateMap(v, subValidator) + if err != nil { + mapResult = false + err = prependPathToErrors(err, key) + errs = append(errs, err) + } + } + case string: + if (valueField.Kind() == reflect.Struct || + (valueField.Kind() == reflect.Ptr && valueField.Elem().Kind() == reflect.Struct)) && + subValidator != "-" { + var err error + structResult, err = ValidateStruct(valueField.Interface()) + if err != nil { + err = prependPathToErrors(err, key) + errs = append(errs, err) + } + } + resultField, err = typeCheck(valueField, reflect.StructField{ + Name: key, + PkgPath: "", + Type: val.Type(), + Tag: reflect.StructTag(fmt.Sprintf("%s:%q", tagName, subValidator)), + Offset: 0, + Index: []int{index}, + Anonymous: false, + }, val, nil) + if err != nil { + errs = append(errs, err) + } + case nil: + // already handlerd when checked before + default: + typeResult = false + err = fmt.Errorf("map validator has to be either map[string]interface{} or string; got %s", valueField.Type().String()) + err = prependPathToErrors(err, key) + errs = append(errs, err) + } + result = result && presentResult && typeResult && resultField && structResult && mapResult + index++ + } + // checks required keys + requiredResult := true + for key, value := range m { + if schema, ok := value.(string); ok { + tags := parseTagIntoMap(schema) + if required, ok := tags["required"]; ok { + if _, ok := s[key]; !ok { + requiredResult = false + if required.customErrorMessage != "" { + err = Error{key, fmt.Errorf(required.customErrorMessage), true, "required", []string{}} + } else { + err = Error{key, fmt.Errorf("required field missing"), false, "required", []string{}} + } + errs = append(errs, err) + } + } + } + } + + if len(errs) > 0 { + err = errs + } + return result && requiredResult, err +} + +// ValidateStruct use tags for fields. +// result will be equal to `false` if there are any errors. +// todo currently there is no guarantee that errors will be returned in predictable order (tests may to fail) +func ValidateStruct(s interface{}) (bool, error) { + if s == nil { + return true, nil + } + result := true + var err error + val := reflect.ValueOf(s) + if val.Kind() == reflect.Interface || val.Kind() == reflect.Ptr { + val = val.Elem() + } + // we only accept structs + if val.Kind() != reflect.Struct { + return false, fmt.Errorf("function only accepts structs; got %s", val.Kind()) + } + var errs Errors + for i := 0; i < val.NumField(); i++ { + valueField := val.Field(i) + typeField := val.Type().Field(i) + if typeField.PkgPath != "" { + continue // Private field + } + structResult := true + if valueField.Kind() == reflect.Interface { + valueField = valueField.Elem() + } + if (valueField.Kind() == reflect.Struct || + (valueField.Kind() == reflect.Ptr && valueField.Elem().Kind() == reflect.Struct)) && + typeField.Tag.Get(tagName) != "-" { + var err error + structResult, err = ValidateStruct(valueField.Interface()) + if err != nil { + err = prependPathToErrors(err, typeField.Name) + errs = append(errs, err) + } + } + resultField, err2 := typeCheck(valueField, typeField, val, nil) + if err2 != nil { + + // Replace structure name with JSON name if there is a tag on the variable + jsonTag := toJSONName(typeField.Tag.Get("json")) + if jsonTag != "" { + switch jsonError := err2.(type) { + case Error: + jsonError.Name = jsonTag + err2 = jsonError + case Errors: + for i2, err3 := range jsonError { + switch customErr := err3.(type) { + case Error: + customErr.Name = jsonTag + jsonError[i2] = customErr + } + } + + err2 = jsonError + } + } + + errs = append(errs, err2) + } + result = result && resultField && structResult + } + if len(errs) > 0 { + err = errs + } + return result, err +} + +// ValidateStructAsync performs async validation of the struct and returns results through the channels +func ValidateStructAsync(s interface{}) (<-chan bool, <-chan error) { + res := make(chan bool) + errors := make(chan error) + + go func() { + defer close(res) + defer close(errors) + + isValid, isFailed := ValidateStruct(s) + + res <- isValid + errors <- isFailed + }() + + return res, errors +} + +// ValidateMapAsync performs async validation of the map and returns results through the channels +func ValidateMapAsync(s map[string]interface{}, m map[string]interface{}) (<-chan bool, <-chan error) { + res := make(chan bool) + errors := make(chan error) + + go func() { + defer close(res) + defer close(errors) + + isValid, isFailed := ValidateMap(s, m) + + res <- isValid + errors <- isFailed + }() + + return res, errors +} + +// parseTagIntoMap parses a struct tag `valid:required~Some error message,length(2|3)` into map[string]string{"required": "Some error message", "length(2|3)": ""} +func parseTagIntoMap(tag string) tagOptionsMap { + optionsMap := make(tagOptionsMap) + options := strings.Split(tag, ",") + + for i, option := range options { + option = strings.TrimSpace(option) + + validationOptions := strings.Split(option, "~") + if !isValidTag(validationOptions[0]) { + continue + } + if len(validationOptions) == 2 { + optionsMap[validationOptions[0]] = tagOption{validationOptions[0], validationOptions[1], i} + } else { + optionsMap[validationOptions[0]] = tagOption{validationOptions[0], "", i} + } + } + return optionsMap +} + +func isValidTag(s string) bool { + if s == "" { + return false + } + for _, c := range s { + switch { + case strings.ContainsRune("\\'\"!#$%&()*+-./:<=>?@[]^_{|}~ ", c): + // Backslash and quote chars are reserved, but + // otherwise any punctuation chars are allowed + // in a tag name. + default: + if !unicode.IsLetter(c) && !unicode.IsDigit(c) { + return false + } + } + } + return true +} + +// IsSSN will validate the given string as a U.S. Social Security Number +func IsSSN(str string) bool { + if str == "" || len(str) != 11 { + return false + } + return rxSSN.MatchString(str) +} + +// IsSemver checks if string is valid semantic version +func IsSemver(str string) bool { + return rxSemver.MatchString(str) +} + +// IsType checks if interface is of some type +func IsType(v interface{}, params ...string) bool { + if len(params) == 1 { + typ := params[0] + return strings.Replace(reflect.TypeOf(v).String(), " ", "", -1) == strings.Replace(typ, " ", "", -1) + } + return false +} + +// IsTime checks if string is valid according to given format +func IsTime(str string, format string) bool { + _, err := time.Parse(format, str) + return err == nil +} + +// IsUnixTime checks if string is valid unix timestamp value +func IsUnixTime(str string) bool { + if _, err := strconv.Atoi(str); err == nil { + return true + } + return false +} + +// IsRFC3339 checks if string is valid timestamp value according to RFC3339 +func IsRFC3339(str string) bool { + return IsTime(str, time.RFC3339) +} + +// IsRFC3339WithoutZone checks if string is valid timestamp value according to RFC3339 which excludes the timezone. +func IsRFC3339WithoutZone(str string) bool { + return IsTime(str, rfc3339WithoutZone) +} + +// IsISO4217 checks if string is valid ISO currency code +func IsISO4217(str string) bool { + for _, currency := range ISO4217List { + if str == currency { + return true + } + } + + return false +} + +// ByteLength checks string's length +func ByteLength(str string, params ...string) bool { + if len(params) == 2 { + min, _ := ToInt(params[0]) + max, _ := ToInt(params[1]) + return len(str) >= int(min) && len(str) <= int(max) + } + + return false +} + +// RuneLength checks string's length +// Alias for StringLength +func RuneLength(str string, params ...string) bool { + return StringLength(str, params...) +} + +// IsRsaPub checks whether string is valid RSA key +// Alias for IsRsaPublicKey +func IsRsaPub(str string, params ...string) bool { + if len(params) == 1 { + len, _ := ToInt(params[0]) + return IsRsaPublicKey(str, int(len)) + } + + return false +} + +// StringMatches checks if a string matches a given pattern. +func StringMatches(s string, params ...string) bool { + if len(params) == 1 { + pattern := params[0] + return Matches(s, pattern) + } + return false +} + +// StringLength checks string's length (including multi byte strings) +func StringLength(str string, params ...string) bool { + + if len(params) == 2 { + strLength := utf8.RuneCountInString(str) + min, _ := ToInt(params[0]) + max, _ := ToInt(params[1]) + return strLength >= int(min) && strLength <= int(max) + } + + return false +} + +// MinStringLength checks string's minimum length (including multi byte strings) +func MinStringLength(str string, params ...string) bool { + + if len(params) == 1 { + strLength := utf8.RuneCountInString(str) + min, _ := ToInt(params[0]) + return strLength >= int(min) + } + + return false +} + +// MaxStringLength checks string's maximum length (including multi byte strings) +func MaxStringLength(str string, params ...string) bool { + + if len(params) == 1 { + strLength := utf8.RuneCountInString(str) + max, _ := ToInt(params[0]) + return strLength <= int(max) + } + + return false +} + +// Range checks string's length +func Range(str string, params ...string) bool { + if len(params) == 2 { + value, _ := ToFloat(str) + min, _ := ToFloat(params[0]) + max, _ := ToFloat(params[1]) + return InRange(value, min, max) + } + + return false +} + +// IsInRaw checks if string is in list of allowed values +func IsInRaw(str string, params ...string) bool { + if len(params) == 1 { + rawParams := params[0] + + parsedParams := strings.Split(rawParams, "|") + + return IsIn(str, parsedParams...) + } + + return false +} + +// IsIn checks if string str is a member of the set of strings params +func IsIn(str string, params ...string) bool { + for _, param := range params { + if str == param { + return true + } + } + + return false +} + +func checkRequired(v reflect.Value, t reflect.StructField, options tagOptionsMap) (bool, error) { + if nilPtrAllowedByRequired { + k := v.Kind() + if (k == reflect.Ptr || k == reflect.Interface) && v.IsNil() { + return true, nil + } + } + + if requiredOption, isRequired := options["required"]; isRequired { + if len(requiredOption.customErrorMessage) > 0 { + return false, Error{t.Name, fmt.Errorf(requiredOption.customErrorMessage), true, "required", []string{}} + } + return false, Error{t.Name, fmt.Errorf("non zero value required"), false, "required", []string{}} + } else if _, isOptional := options["optional"]; fieldsRequiredByDefault && !isOptional { + return false, Error{t.Name, fmt.Errorf("Missing required field"), false, "required", []string{}} + } + // not required and empty is valid + return true, nil +} + +func typeCheck(v reflect.Value, t reflect.StructField, o reflect.Value, options tagOptionsMap) (isValid bool, resultErr error) { + if !v.IsValid() { + return false, nil + } + + tag := t.Tag.Get(tagName) + + // checks if the field should be ignored + switch tag { + case "": + if v.Kind() != reflect.Slice && v.Kind() != reflect.Map { + if !fieldsRequiredByDefault { + return true, nil + } + return false, Error{t.Name, fmt.Errorf("All fields are required to at least have one validation defined"), false, "required", []string{}} + } + case "-": + return true, nil + } + + isRootType := false + if options == nil { + isRootType = true + options = parseTagIntoMap(tag) + } + + if isEmptyValue(v) { + // an empty value is not validated, checks only required + isValid, resultErr = checkRequired(v, t, options) + for key := range options { + delete(options, key) + } + return isValid, resultErr + } + + var customTypeErrors Errors + optionsOrder := options.orderedKeys() + for _, validatorName := range optionsOrder { + validatorStruct := options[validatorName] + if validatefunc, ok := CustomTypeTagMap.Get(validatorName); ok { + delete(options, validatorName) + + if result := validatefunc(v.Interface(), o.Interface()); !result { + if len(validatorStruct.customErrorMessage) > 0 { + customTypeErrors = append(customTypeErrors, Error{Name: t.Name, Err: TruncatingErrorf(validatorStruct.customErrorMessage, fmt.Sprint(v), validatorName), CustomErrorMessageExists: true, Validator: stripParams(validatorName)}) + continue + } + customTypeErrors = append(customTypeErrors, Error{Name: t.Name, Err: fmt.Errorf("%s does not validate as %s", fmt.Sprint(v), validatorName), CustomErrorMessageExists: false, Validator: stripParams(validatorName)}) + } + } + } + + if len(customTypeErrors.Errors()) > 0 { + return false, customTypeErrors + } + + if isRootType { + // Ensure that we've checked the value by all specified validators before report that the value is valid + defer func() { + delete(options, "optional") + delete(options, "required") + + if isValid && resultErr == nil && len(options) != 0 { + optionsOrder := options.orderedKeys() + for _, validator := range optionsOrder { + isValid = false + resultErr = Error{t.Name, fmt.Errorf( + "The following validator is invalid or can't be applied to the field: %q", validator), false, stripParams(validator), []string{}} + return + } + } + }() + } + + for _, validatorSpec := range optionsOrder { + validatorStruct := options[validatorSpec] + var negate bool + validator := validatorSpec + customMsgExists := len(validatorStruct.customErrorMessage) > 0 + + // checks whether the tag looks like '!something' or 'something' + if validator[0] == '!' { + validator = validator[1:] + negate = true + } + + // checks for interface param validators + for key, value := range InterfaceParamTagRegexMap { + ps := value.FindStringSubmatch(validator) + if len(ps) == 0 { + continue + } + + validatefunc, ok := InterfaceParamTagMap[key] + if !ok { + continue + } + + delete(options, validatorSpec) + + field := fmt.Sprint(v) + if result := validatefunc(v.Interface(), ps[1:]...); (!result && !negate) || (result && negate) { + if customMsgExists { + return false, Error{t.Name, TruncatingErrorf(validatorStruct.customErrorMessage, field, validator), customMsgExists, stripParams(validatorSpec), []string{}} + } + if negate { + return false, Error{t.Name, fmt.Errorf("%s does validate as %s", field, validator), customMsgExists, stripParams(validatorSpec), []string{}} + } + return false, Error{t.Name, fmt.Errorf("%s does not validate as %s", field, validator), customMsgExists, stripParams(validatorSpec), []string{}} + } + } + } + + switch v.Kind() { + case reflect.Bool, + reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, + reflect.Float32, reflect.Float64, + reflect.String: + // for each tag option checks the map of validator functions + for _, validatorSpec := range optionsOrder { + validatorStruct := options[validatorSpec] + var negate bool + validator := validatorSpec + customMsgExists := len(validatorStruct.customErrorMessage) > 0 + + // checks whether the tag looks like '!something' or 'something' + if validator[0] == '!' { + validator = validator[1:] + negate = true + } + + // checks for param validators + for key, value := range ParamTagRegexMap { + ps := value.FindStringSubmatch(validator) + if len(ps) == 0 { + continue + } + + validatefunc, ok := ParamTagMap[key] + if !ok { + continue + } + + delete(options, validatorSpec) + + switch v.Kind() { + case reflect.String, + reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, + reflect.Float32, reflect.Float64: + + field := fmt.Sprint(v) // make value into string, then validate with regex + if result := validatefunc(field, ps[1:]...); (!result && !negate) || (result && negate) { + if customMsgExists { + return false, Error{t.Name, TruncatingErrorf(validatorStruct.customErrorMessage, field, validator), customMsgExists, stripParams(validatorSpec), []string{}} + } + if negate { + return false, Error{t.Name, fmt.Errorf("%s does validate as %s", field, validator), customMsgExists, stripParams(validatorSpec), []string{}} + } + return false, Error{t.Name, fmt.Errorf("%s does not validate as %s", field, validator), customMsgExists, stripParams(validatorSpec), []string{}} + } + default: + // type not yet supported, fail + return false, Error{t.Name, fmt.Errorf("Validator %s doesn't support kind %s", validator, v.Kind()), false, stripParams(validatorSpec), []string{}} + } + } + + if validatefunc, ok := TagMap[validator]; ok { + delete(options, validatorSpec) + + switch v.Kind() { + case reflect.String, + reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, + reflect.Float32, reflect.Float64: + field := fmt.Sprint(v) // make value into string, then validate with regex + if result := validatefunc(field); !result && !negate || result && negate { + if customMsgExists { + return false, Error{t.Name, TruncatingErrorf(validatorStruct.customErrorMessage, field, validator), customMsgExists, stripParams(validatorSpec), []string{}} + } + if negate { + return false, Error{t.Name, fmt.Errorf("%s does validate as %s", field, validator), customMsgExists, stripParams(validatorSpec), []string{}} + } + return false, Error{t.Name, fmt.Errorf("%s does not validate as %s", field, validator), customMsgExists, stripParams(validatorSpec), []string{}} + } + default: + //Not Yet Supported Types (Fail here!) + err := fmt.Errorf("Validator %s doesn't support kind %s for value %v", validator, v.Kind(), v) + return false, Error{t.Name, err, false, stripParams(validatorSpec), []string{}} + } + } + } + return true, nil + case reflect.Map: + if v.Type().Key().Kind() != reflect.String { + return false, &UnsupportedTypeError{v.Type()} + } + var sv stringValues + sv = v.MapKeys() + sort.Sort(sv) + result := true + for i, k := range sv { + var resultItem bool + var err error + if v.MapIndex(k).Kind() != reflect.Struct { + resultItem, err = typeCheck(v.MapIndex(k), t, o, options) + if err != nil { + return false, err + } + } else { + resultItem, err = ValidateStruct(v.MapIndex(k).Interface()) + if err != nil { + err = prependPathToErrors(err, t.Name+"."+sv[i].Interface().(string)) + return false, err + } + } + result = result && resultItem + } + return result, nil + case reflect.Slice, reflect.Array: + result := true + for i := 0; i < v.Len(); i++ { + var resultItem bool + var err error + if v.Index(i).Kind() != reflect.Struct { + resultItem, err = typeCheck(v.Index(i), t, o, options) + if err != nil { + return false, err + } + } else { + resultItem, err = ValidateStruct(v.Index(i).Interface()) + if err != nil { + err = prependPathToErrors(err, t.Name+"."+strconv.Itoa(i)) + return false, err + } + } + result = result && resultItem + } + return result, nil + case reflect.Interface: + // If the value is an interface then encode its element + if v.IsNil() { + return true, nil + } + return ValidateStruct(v.Interface()) + case reflect.Ptr: + // If the value is a pointer then checks its element + if v.IsNil() { + return true, nil + } + return typeCheck(v.Elem(), t, o, options) + case reflect.Struct: + return true, nil + default: + return false, &UnsupportedTypeError{v.Type()} + } +} + +func stripParams(validatorString string) string { + return paramsRegexp.ReplaceAllString(validatorString, "") +} + +// isEmptyValue checks whether value empty or not +func isEmptyValue(v reflect.Value) bool { + switch v.Kind() { + case reflect.String, reflect.Array: + return v.Len() == 0 + case reflect.Map, reflect.Slice: + return v.Len() == 0 || v.IsNil() + case reflect.Bool: + return !v.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Interface, reflect.Ptr: + return v.IsNil() + } + + return reflect.DeepEqual(v.Interface(), reflect.Zero(v.Type()).Interface()) +} + +// ErrorByField returns error for specified field of the struct +// validated by ValidateStruct or empty string if there are no errors +// or this field doesn't exists or doesn't have any errors. +func ErrorByField(e error, field string) string { + if e == nil { + return "" + } + return ErrorsByField(e)[field] +} + +// ErrorsByField returns map of errors of the struct validated +// by ValidateStruct or empty map if there are no errors. +func ErrorsByField(e error) map[string]string { + m := make(map[string]string) + if e == nil { + return m + } + // prototype for ValidateStruct + + switch e := e.(type) { + case Error: + m[e.Name] = e.Err.Error() + case Errors: + for _, item := range e.Errors() { + n := ErrorsByField(item) + for k, v := range n { + m[k] = v + } + } + } + + return m +} + +// Error returns string equivalent for reflect.Type +func (e *UnsupportedTypeError) Error() string { + return "validator: unsupported type: " + e.Type.String() +} + +func (sv stringValues) Len() int { return len(sv) } +func (sv stringValues) Swap(i, j int) { sv[i], sv[j] = sv[j], sv[i] } +func (sv stringValues) Less(i, j int) bool { return sv.get(i) < sv.get(j) } +func (sv stringValues) get(i int) string { return sv[i].String() } + +func IsE164(str string) bool { + return rxE164.MatchString(str) +} diff --git a/vendor/github.com/asaskevich/govalidator/wercker.yml b/vendor/github.com/asaskevich/govalidator/wercker.yml new file mode 100644 index 0000000..bc5f7b0 --- /dev/null +++ b/vendor/github.com/asaskevich/govalidator/wercker.yml @@ -0,0 +1,15 @@ +box: golang +build: + steps: + - setup-go-workspace + + - script: + name: go get + code: | + go version + go get -t ./... + + - script: + name: go test + code: | + go test -race -v ./... diff --git a/vendor/github.com/danieljoos/wincred/.gitattributes b/vendor/github.com/danieljoos/wincred/.gitattributes new file mode 100644 index 0000000..d207b18 --- /dev/null +++ b/vendor/github.com/danieljoos/wincred/.gitattributes @@ -0,0 +1 @@ +*.go text eol=lf diff --git a/vendor/github.com/danieljoos/wincred/.gitignore b/vendor/github.com/danieljoos/wincred/.gitignore new file mode 100644 index 0000000..6142c06 --- /dev/null +++ b/vendor/github.com/danieljoos/wincred/.gitignore @@ -0,0 +1,25 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test + +coverage.txt diff --git a/vendor/github.com/danieljoos/wincred/LICENSE b/vendor/github.com/danieljoos/wincred/LICENSE new file mode 100644 index 0000000..2f436f1 --- /dev/null +++ b/vendor/github.com/danieljoos/wincred/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Daniel Joos + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/danieljoos/wincred/README.md b/vendor/github.com/danieljoos/wincred/README.md new file mode 100644 index 0000000..8a879b0 --- /dev/null +++ b/vendor/github.com/danieljoos/wincred/README.md @@ -0,0 +1,145 @@ +wincred +======= + +Go wrapper around the Windows Credential Manager API functions. + +[![GitHub release](https://img.shields.io/github/release/danieljoos/wincred.svg?style=flat-square)](https://github.com/danieljoos/wincred/releases/latest) +[![Test Status](https://img.shields.io/github/actions/workflow/status/danieljoos/wincred/test.yml?label=test&logo=github&style=flat-square)](https://github.com/danieljoos/wincred/actions?query=workflow%3Atest) +[![Go Report Card](https://goreportcard.com/badge/github.com/danieljoos/wincred)](https://goreportcard.com/report/github.com/danieljoos/wincred) +[![Codecov](https://img.shields.io/codecov/c/github/danieljoos/wincred?logo=codecov&style=flat-square)](https://codecov.io/gh/danieljoos/wincred) +[![PkgGoDev](https://img.shields.io/badge/go.dev-docs-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/danieljoos/wincred) + +Installation +------------ + +```Go +go get github.com/danieljoos/wincred +``` + + +Usage +----- + +See the following examples: + +### Create and store a new generic credential object +```Go +package main + +import ( + "fmt" + "github.com/danieljoos/wincred" +) + +func main() { + cred := wincred.NewGenericCredential("myGoApplication") + cred.CredentialBlob = []byte("my secret") + err := cred.Write() + + if err != nil { + fmt.Println(err) + } +} +``` + +### Retrieve a credential object +```Go +package main + +import ( + "fmt" + "github.com/danieljoos/wincred" +) + +func main() { + cred, err := wincred.GetGenericCredential("myGoApplication") + if err == nil { + fmt.Println(string(cred.CredentialBlob)) + } +} +``` + +### Remove a credential object +```Go +package main + +import ( + "fmt" + "github.com/danieljoos/wincred" +) + +func main() { + cred, err := wincred.GetGenericCredential("myGoApplication") + if err != nil { + fmt.Println(err) + return + } + cred.Delete() +} +``` + +### List all available credentials +```Go +package main + +import ( + "fmt" + "github.com/danieljoos/wincred" +) + +func main() { + creds, err := wincred.List() + if err != nil { + fmt.Println(err) + return + } + for i := range(creds) { + fmt.Println(creds[i].TargetName) + } +} +``` + +Hints +----- + +### Encoding + +The credential objects simply store byte arrays without specific meaning or encoding. +For sharing between different applications, it might make sense to apply an explicit string encoding - for example **UTF-16 LE** (used nearly everywhere in the Win32 API). + +```Go +package main + +import ( + "fmt" + "os" + + "github.com/danieljoos/wincred" + "golang.org/x/text/encoding/unicode" + "golang.org/x/text/transform" +) + +func main() { + cred := wincred.NewGenericCredential("myGoApplication") + + encoder := unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM).NewEncoder() + blob, _, err := transform.Bytes(encoder, []byte("mysecret")) + if err != nil { + fmt.Println(err) + os.Exit(1) + } + + cred.CredentialBlob = blob + err = cred.Write() + + if err != nil { + fmt.Println(err) + os.Exit(1) + } +} + +``` + +### Limitations + +The size of a credential blob is limited to **2560 Bytes** by the Windows API. diff --git a/vendor/github.com/danieljoos/wincred/conversion.go b/vendor/github.com/danieljoos/wincred/conversion.go new file mode 100644 index 0000000..fae1df0 --- /dev/null +++ b/vendor/github.com/danieljoos/wincred/conversion.go @@ -0,0 +1,117 @@ +//go:build windows +// +build windows + +package wincred + +import ( + "encoding/binary" + "reflect" + "time" + "unsafe" + + syscall "golang.org/x/sys/windows" +) + +// utf16ToByte creates a byte array from a given UTF 16 char array. +func utf16ToByte(wstr []uint16) (result []byte) { + result = make([]byte, len(wstr)*2) + for i := range wstr { + binary.LittleEndian.PutUint16(result[(i*2):(i*2)+2], wstr[i]) + } + return +} + +// utf16FromString creates a UTF16 char array from a string. +func utf16FromString(str string) []uint16 { + res, err := syscall.UTF16FromString(str) + if err != nil { + return []uint16{} + } + return res +} + +// goBytes copies the given C byte array to a Go byte array (see `C.GoBytes`). +// This function avoids having cgo as dependency. +func goBytes(src uintptr, len uint32) []byte { + if src == uintptr(0) { + return []byte{} + } + rv := make([]byte, len) + copy(rv, *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{ + Data: src, + Len: int(len), + Cap: int(len), + }))) + return rv +} + +// Convert the given CREDENTIAL struct to a more usable structure +func sysToCredential(cred *sysCREDENTIAL) (result *Credential) { + if cred == nil { + return nil + } + result = new(Credential) + result.Comment = syscall.UTF16PtrToString(cred.Comment) + result.TargetName = syscall.UTF16PtrToString(cred.TargetName) + result.TargetAlias = syscall.UTF16PtrToString(cred.TargetAlias) + result.UserName = syscall.UTF16PtrToString(cred.UserName) + result.LastWritten = time.Unix(0, cred.LastWritten.Nanoseconds()) + result.Persist = CredentialPersistence(cred.Persist) + result.CredentialBlob = goBytes(cred.CredentialBlob, cred.CredentialBlobSize) + result.Attributes = make([]CredentialAttribute, cred.AttributeCount) + attrSlice := *(*[]sysCREDENTIAL_ATTRIBUTE)(unsafe.Pointer(&reflect.SliceHeader{ + Data: cred.Attributes, + Len: int(cred.AttributeCount), + Cap: int(cred.AttributeCount), + })) + for i, attr := range attrSlice { + resultAttr := &result.Attributes[i] + resultAttr.Keyword = syscall.UTF16PtrToString(attr.Keyword) + resultAttr.Value = goBytes(attr.Value, attr.ValueSize) + } + return result +} + +// Convert the given Credential object back to a CREDENTIAL struct, which can be used for calling the +// Windows APIs +func sysFromCredential(cred *Credential) (result *sysCREDENTIAL) { + if cred == nil { + return nil + } + result = new(sysCREDENTIAL) + result.Flags = 0 + result.Type = 0 + result.TargetName, _ = syscall.UTF16PtrFromString(cred.TargetName) + result.Comment, _ = syscall.UTF16PtrFromString(cred.Comment) + result.LastWritten = syscall.NsecToFiletime(cred.LastWritten.UnixNano()) + result.CredentialBlobSize = uint32(len(cred.CredentialBlob)) + if len(cred.CredentialBlob) > 0 { + result.CredentialBlob = uintptr(unsafe.Pointer(&cred.CredentialBlob[0])) + } else { + result.CredentialBlob = 0 + } + result.Persist = uint32(cred.Persist) + result.AttributeCount = uint32(len(cred.Attributes)) + attributes := make([]sysCREDENTIAL_ATTRIBUTE, len(cred.Attributes)) + if len(attributes) > 0 { + result.Attributes = uintptr(unsafe.Pointer(&attributes[0])) + } else { + result.Attributes = 0 + } + for i := range cred.Attributes { + inAttr := &cred.Attributes[i] + outAttr := &attributes[i] + outAttr.Keyword, _ = syscall.UTF16PtrFromString(inAttr.Keyword) + outAttr.Flags = 0 + outAttr.ValueSize = uint32(len(inAttr.Value)) + if len(inAttr.Value) > 0 { + outAttr.Value = uintptr(unsafe.Pointer(&inAttr.Value[0])) + } else { + outAttr.Value = 0 + } + } + result.TargetAlias, _ = syscall.UTF16PtrFromString(cred.TargetAlias) + result.UserName, _ = syscall.UTF16PtrFromString(cred.UserName) + + return +} diff --git a/vendor/github.com/danieljoos/wincred/conversion_unsupported.go b/vendor/github.com/danieljoos/wincred/conversion_unsupported.go new file mode 100644 index 0000000..715c447 --- /dev/null +++ b/vendor/github.com/danieljoos/wincred/conversion_unsupported.go @@ -0,0 +1,12 @@ +//go:build !windows +// +build !windows + +package wincred + +func utf16ToByte(...interface{}) []byte { + return nil +} + +func utf16FromString(...interface{}) []uint16 { + return nil +} diff --git a/vendor/github.com/danieljoos/wincred/sys.go b/vendor/github.com/danieljoos/wincred/sys.go new file mode 100644 index 0000000..fb8a6ac --- /dev/null +++ b/vendor/github.com/danieljoos/wincred/sys.go @@ -0,0 +1,148 @@ +//go:build windows +// +build windows + +package wincred + +import ( + "reflect" + "syscall" + "unsafe" + + "golang.org/x/sys/windows" +) + +var ( + modadvapi32 = windows.NewLazySystemDLL("advapi32.dll") + procCredRead = modadvapi32.NewProc("CredReadW") + procCredWrite proc = modadvapi32.NewProc("CredWriteW") + procCredDelete proc = modadvapi32.NewProc("CredDeleteW") + procCredFree proc = modadvapi32.NewProc("CredFree") + procCredEnumerate = modadvapi32.NewProc("CredEnumerateW") +) + +// Interface for syscall.Proc: helps testing +type proc interface { + Call(a ...uintptr) (r1, r2 uintptr, lastErr error) +} + +// https://docs.microsoft.com/en-us/windows/desktop/api/wincred/ns-wincred-_credentialw +type sysCREDENTIAL struct { + Flags uint32 + Type uint32 + TargetName *uint16 + Comment *uint16 + LastWritten windows.Filetime + CredentialBlobSize uint32 + CredentialBlob uintptr + Persist uint32 + AttributeCount uint32 + Attributes uintptr + TargetAlias *uint16 + UserName *uint16 +} + +// https://docs.microsoft.com/en-us/windows/desktop/api/wincred/ns-wincred-_credential_attributew +type sysCREDENTIAL_ATTRIBUTE struct { + Keyword *uint16 + Flags uint32 + ValueSize uint32 + Value uintptr +} + +// https://docs.microsoft.com/en-us/windows/desktop/api/wincred/ns-wincred-_credentialw +type sysCRED_TYPE uint32 + +const ( + sysCRED_TYPE_GENERIC sysCRED_TYPE = 0x1 + sysCRED_TYPE_DOMAIN_PASSWORD sysCRED_TYPE = 0x2 + sysCRED_TYPE_DOMAIN_CERTIFICATE sysCRED_TYPE = 0x3 + sysCRED_TYPE_DOMAIN_VISIBLE_PASSWORD sysCRED_TYPE = 0x4 + sysCRED_TYPE_GENERIC_CERTIFICATE sysCRED_TYPE = 0x5 + sysCRED_TYPE_DOMAIN_EXTENDED sysCRED_TYPE = 0x6 + + // https://docs.microsoft.com/en-us/windows/desktop/Debug/system-error-codes + sysERROR_NOT_FOUND = windows.Errno(1168) + sysERROR_INVALID_PARAMETER = windows.Errno(87) + sysERROR_BAD_USERNAME = windows.Errno(2202) +) + +// https://docs.microsoft.com/en-us/windows/desktop/api/wincred/nf-wincred-credreadw +func sysCredRead(targetName string, typ sysCRED_TYPE) (*Credential, error) { + var pcred *sysCREDENTIAL + targetNamePtr, _ := windows.UTF16PtrFromString(targetName) + ret, _, err := syscall.SyscallN( + procCredRead.Addr(), + uintptr(unsafe.Pointer(targetNamePtr)), + uintptr(typ), + 0, + uintptr(unsafe.Pointer(&pcred)), + ) + if ret == 0 { + return nil, err + } + defer procCredFree.Call(uintptr(unsafe.Pointer(pcred))) + + return sysToCredential(pcred), nil +} + +// https://docs.microsoft.com/en-us/windows/desktop/api/wincred/nf-wincred-credwritew +func sysCredWrite(cred *Credential, typ sysCRED_TYPE) error { + ncred := sysFromCredential(cred) + ncred.Type = uint32(typ) + ret, _, err := procCredWrite.Call( + uintptr(unsafe.Pointer(ncred)), + 0, + ) + if ret == 0 { + return err + } + + return nil +} + +// https://docs.microsoft.com/en-us/windows/desktop/api/wincred/nf-wincred-creddeletew +func sysCredDelete(cred *Credential, typ sysCRED_TYPE) error { + targetNamePtr, _ := windows.UTF16PtrFromString(cred.TargetName) + ret, _, err := procCredDelete.Call( + uintptr(unsafe.Pointer(targetNamePtr)), + uintptr(typ), + 0, + ) + if ret == 0 { + return err + } + + return nil +} + +// https://docs.microsoft.com/en-us/windows/desktop/api/wincred/nf-wincred-credenumeratew +func sysCredEnumerate(filter string, all bool) ([]*Credential, error) { + var count int + var pcreds uintptr + var filterPtr *uint16 + if !all { + filterPtr, _ = windows.UTF16PtrFromString(filter) + } + ret, _, err := syscall.SyscallN( + procCredEnumerate.Addr(), + uintptr(unsafe.Pointer(filterPtr)), + 0, + uintptr(unsafe.Pointer(&count)), + uintptr(unsafe.Pointer(&pcreds)), + ) + if ret == 0 { + return nil, err + } + defer procCredFree.Call(pcreds) + credsSlice := *(*[]*sysCREDENTIAL)(unsafe.Pointer(&reflect.SliceHeader{ + Data: pcreds, + Len: count, + Cap: count, + })) + creds := make([]*Credential, count, count) + for i, cred := range credsSlice { + creds[i] = sysToCredential(cred) + } + + return creds, nil +} diff --git a/vendor/github.com/danieljoos/wincred/sys_unsupported.go b/vendor/github.com/danieljoos/wincred/sys_unsupported.go new file mode 100644 index 0000000..746639a --- /dev/null +++ b/vendor/github.com/danieljoos/wincred/sys_unsupported.go @@ -0,0 +1,38 @@ +//go:build !windows +// +build !windows + +package wincred + +import ( + "errors" + "syscall" +) + +const ( + sysCRED_TYPE_GENERIC = 0 + sysCRED_TYPE_DOMAIN_PASSWORD = 0 + sysCRED_TYPE_DOMAIN_CERTIFICATE = 0 + sysCRED_TYPE_DOMAIN_VISIBLE_PASSWORD = 0 + sysCRED_TYPE_GENERIC_CERTIFICATE = 0 + sysCRED_TYPE_DOMAIN_EXTENDED = 0 + + sysERROR_NOT_FOUND = syscall.Errno(1) + sysERROR_INVALID_PARAMETER = syscall.Errno(1) + sysERROR_BAD_USERNAME = syscall.Errno(1) +) + +func sysCredRead(...interface{}) (*Credential, error) { + return nil, errors.New("Operation not supported") +} + +func sysCredWrite(...interface{}) error { + return errors.New("Operation not supported") +} + +func sysCredDelete(...interface{}) error { + return errors.New("Operation not supported") +} + +func sysCredEnumerate(...interface{}) ([]*Credential, error) { + return nil, errors.New("Operation not supported") +} diff --git a/vendor/github.com/danieljoos/wincred/types.go b/vendor/github.com/danieljoos/wincred/types.go new file mode 100644 index 0000000..28debc9 --- /dev/null +++ b/vendor/github.com/danieljoos/wincred/types.go @@ -0,0 +1,69 @@ +package wincred + +import ( + "time" +) + +// CredentialPersistence describes one of three persistence modes of a credential. +// A detailed description of the available modes can be found on +// Docs: https://docs.microsoft.com/en-us/windows/desktop/api/wincred/ns-wincred-_credentialw +type CredentialPersistence uint32 + +const ( + // PersistSession indicates that the credential only persists for the life + // of the current Windows login session. Such a credential is not visible in + // any other logon session, even from the same user. + PersistSession CredentialPersistence = 0x1 + + // PersistLocalMachine indicates that the credential persists for this and + // all subsequent logon sessions on this local machine/computer. It is + // however not visible for logon sessions of this user on a different + // machine. + PersistLocalMachine CredentialPersistence = 0x2 + + // PersistEnterprise indicates that the credential persists for this and all + // subsequent logon sessions for this user. It is also visible for logon + // sessions on different computers. + PersistEnterprise CredentialPersistence = 0x3 +) + +// CredentialAttribute represents an application-specific attribute of a credential. +type CredentialAttribute struct { + Keyword string + Value []byte +} + +// Credential is the basic credential structure. +// A credential is identified by its target name. +// The actual credential secret is available in the CredentialBlob field. +type Credential struct { + TargetName string + Comment string + LastWritten time.Time + CredentialBlob []byte + Attributes []CredentialAttribute + TargetAlias string + UserName string + Persist CredentialPersistence +} + +// GenericCredential holds a credential for generic usage. +// It is typically defined and used by applications that need to manage user +// secrets. +// +// More information about the available kinds of credentials of the Windows +// Credential Management API can be found on Docs: +// https://docs.microsoft.com/en-us/windows/desktop/SecAuthN/kinds-of-credentials +type GenericCredential struct { + Credential +} + +// DomainPassword holds a domain credential that is typically used by the +// operating system for user logon. +// +// More information about the available kinds of credentials of the Windows +// Credential Management API can be found on Docs: +// https://docs.microsoft.com/en-us/windows/desktop/SecAuthN/kinds-of-credentials +type DomainPassword struct { + Credential +} diff --git a/vendor/github.com/danieljoos/wincred/wincred.go b/vendor/github.com/danieljoos/wincred/wincred.go new file mode 100644 index 0000000..5632ee9 --- /dev/null +++ b/vendor/github.com/danieljoos/wincred/wincred.go @@ -0,0 +1,114 @@ +// Package wincred provides primitives for accessing the Windows Credentials Management API. +// This includes functions for retrieval, listing and storage of credentials as well as Go structures for convenient access to the credential data. +// +// A more detailed description of Windows Credentials Management can be found on +// Docs: https://docs.microsoft.com/en-us/windows/desktop/SecAuthN/credentials-management +package wincred + +import "errors" + +const ( + // ErrElementNotFound is the error that is returned if a requested element cannot be found. + // This error constant can be used to check if a credential could not be found. + ErrElementNotFound = sysERROR_NOT_FOUND + + // ErrInvalidParameter is the error that is returned for invalid parameters. + // This error constant can be used to check if the given function parameters were invalid. + // For example when trying to create a new generic credential with an empty target name. + ErrInvalidParameter = sysERROR_INVALID_PARAMETER + + // ErrBadUsername is returned when the credential's username is invalid. + ErrBadUsername = sysERROR_BAD_USERNAME +) + +// GetGenericCredential fetches the generic credential with the given name from Windows credential manager. +// It returns nil and an error if the credential could not be found or an error occurred. +func GetGenericCredential(targetName string) (*GenericCredential, error) { + cred, err := sysCredRead(targetName, sysCRED_TYPE_GENERIC) + if cred != nil { + return &GenericCredential{Credential: *cred}, err + } + return nil, err +} + +// NewGenericCredential creates a new generic credential object with the given name. +// The persist mode of the newly created object is set to a default value that indicates local-machine-wide storage. +// The credential object is NOT yet persisted to the Windows credential vault. +func NewGenericCredential(targetName string) (result *GenericCredential) { + result = new(GenericCredential) + result.TargetName = targetName + result.Persist = PersistLocalMachine + return +} + +// Write persists the generic credential object to Windows credential manager. +func (t *GenericCredential) Write() (err error) { + err = sysCredWrite(&t.Credential, sysCRED_TYPE_GENERIC) + return +} + +// Delete removes the credential object from Windows credential manager. +func (t *GenericCredential) Delete() (err error) { + err = sysCredDelete(&t.Credential, sysCRED_TYPE_GENERIC) + return +} + +// GetDomainPassword fetches the domain-password credential with the given target host name from Windows credential manager. +// It returns nil and an error if the credential could not be found or an error occurred. +func GetDomainPassword(targetName string) (*DomainPassword, error) { + cred, err := sysCredRead(targetName, sysCRED_TYPE_DOMAIN_PASSWORD) + if cred != nil { + return &DomainPassword{Credential: *cred}, err + } + return nil, err +} + +// NewDomainPassword creates a new domain-password credential used for login to the given target host name. +// The persist mode of the newly created object is set to a default value that indicates local-machine-wide storage. +// The credential object is NOT yet persisted to the Windows credential vault. +func NewDomainPassword(targetName string) (result *DomainPassword) { + result = new(DomainPassword) + result.TargetName = targetName + result.Persist = PersistLocalMachine + return +} + +// Write persists the domain-password credential to Windows credential manager. +func (t *DomainPassword) Write() (err error) { + err = sysCredWrite(&t.Credential, sysCRED_TYPE_DOMAIN_PASSWORD) + return +} + +// Delete removes the domain-password credential from Windows credential manager. +func (t *DomainPassword) Delete() (err error) { + err = sysCredDelete(&t.Credential, sysCRED_TYPE_DOMAIN_PASSWORD) + return +} + +// SetPassword sets the CredentialBlob field of a domain password credential to the given string. +func (t *DomainPassword) SetPassword(pw string) { + t.CredentialBlob = utf16ToByte(utf16FromString(pw)) +} + +// List retrieves all credentials of the Credentials store. +func List() ([]*Credential, error) { + creds, err := sysCredEnumerate("", true) + if err != nil && errors.Is(err, ErrElementNotFound) { + // Ignore ERROR_NOT_FOUND and return an empty list instead + creds = []*Credential{} + err = nil + } + return creds, err +} + +// FilteredList retrieves the list of credentials from the Credentials store that match the given filter. +// The filter string defines the prefix followed by an asterisk for the `TargetName` attribute of the credentials. +func FilteredList(filter string) ([]*Credential, error) { + creds, err := sysCredEnumerate(filter, false) + if err != nil && errors.Is(err, ErrElementNotFound) { + // Ignore ERROR_NOT_FOUND and return an empty list instead + creds = []*Credential{} + err = nil + } + return creds, err +} diff --git a/vendor/github.com/go-logr/logr/.golangci.yaml b/vendor/github.com/go-logr/logr/.golangci.yaml new file mode 100644 index 0000000..0cffafa --- /dev/null +++ b/vendor/github.com/go-logr/logr/.golangci.yaml @@ -0,0 +1,26 @@ +run: + timeout: 1m + tests: true + +linters: + disable-all: true + enable: + - asciicheck + - errcheck + - forcetypeassert + - gocritic + - gofmt + - goimports + - gosimple + - govet + - ineffassign + - misspell + - revive + - staticcheck + - typecheck + - unused + +issues: + exclude-use-default: false + max-issues-per-linter: 0 + max-same-issues: 10 diff --git a/vendor/github.com/go-logr/logr/CHANGELOG.md b/vendor/github.com/go-logr/logr/CHANGELOG.md new file mode 100644 index 0000000..c356960 --- /dev/null +++ b/vendor/github.com/go-logr/logr/CHANGELOG.md @@ -0,0 +1,6 @@ +# CHANGELOG + +## v1.0.0-rc1 + +This is the first logged release. Major changes (including breaking changes) +have occurred since earlier tags. diff --git a/vendor/github.com/go-logr/logr/CONTRIBUTING.md b/vendor/github.com/go-logr/logr/CONTRIBUTING.md new file mode 100644 index 0000000..5d37e29 --- /dev/null +++ b/vendor/github.com/go-logr/logr/CONTRIBUTING.md @@ -0,0 +1,17 @@ +# Contributing + +Logr is open to pull-requests, provided they fit within the intended scope of +the project. Specifically, this library aims to be VERY small and minimalist, +with no external dependencies. + +## Compatibility + +This project intends to follow [semantic versioning](http://semver.org) and +is very strict about compatibility. Any proposed changes MUST follow those +rules. + +## Performance + +As a logging library, logr must be as light-weight as possible. Any proposed +code change must include results of running the [benchmark](./benchmark) +before and after the change. diff --git a/vendor/github.com/go-logr/logr/LICENSE b/vendor/github.com/go-logr/logr/LICENSE new file mode 100644 index 0000000..8dada3e --- /dev/null +++ b/vendor/github.com/go-logr/logr/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-logr/logr/README.md b/vendor/github.com/go-logr/logr/README.md new file mode 100644 index 0000000..7c7f0c6 --- /dev/null +++ b/vendor/github.com/go-logr/logr/README.md @@ -0,0 +1,407 @@ +# A minimal logging API for Go + +[![Go Reference](https://pkg.go.dev/badge/github.com/go-logr/logr.svg)](https://pkg.go.dev/github.com/go-logr/logr) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-logr/logr)](https://goreportcard.com/report/github.com/go-logr/logr) +[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/go-logr/logr/badge)](https://securityscorecards.dev/viewer/?platform=github.com&org=go-logr&repo=logr) + +logr offers an(other) opinion on how Go programs and libraries can do logging +without becoming coupled to a particular logging implementation. This is not +an implementation of logging - it is an API. In fact it is two APIs with two +different sets of users. + +The `Logger` type is intended for application and library authors. It provides +a relatively small API which can be used everywhere you want to emit logs. It +defers the actual act of writing logs (to files, to stdout, or whatever) to the +`LogSink` interface. + +The `LogSink` interface is intended for logging library implementers. It is a +pure interface which can be implemented by logging frameworks to provide the actual logging +functionality. + +This decoupling allows application and library developers to write code in +terms of `logr.Logger` (which has very low dependency fan-out) while the +implementation of logging is managed "up stack" (e.g. in or near `main()`.) +Application developers can then switch out implementations as necessary. + +Many people assert that libraries should not be logging, and as such efforts +like this are pointless. Those people are welcome to convince the authors of +the tens-of-thousands of libraries that *DO* write logs that they are all +wrong. In the meantime, logr takes a more practical approach. + +## Typical usage + +Somewhere, early in an application's life, it will make a decision about which +logging library (implementation) it actually wants to use. Something like: + +``` + func main() { + // ... other setup code ... + + // Create the "root" logger. We have chosen the "logimpl" implementation, + // which takes some initial parameters and returns a logr.Logger. + logger := logimpl.New(param1, param2) + + // ... other setup code ... +``` + +Most apps will call into other libraries, create structures to govern the flow, +etc. The `logr.Logger` object can be passed to these other libraries, stored +in structs, or even used as a package-global variable, if needed. For example: + +``` + app := createTheAppObject(logger) + app.Run() +``` + +Outside of this early setup, no other packages need to know about the choice of +implementation. They write logs in terms of the `logr.Logger` that they +received: + +``` + type appObject struct { + // ... other fields ... + logger logr.Logger + // ... other fields ... + } + + func (app *appObject) Run() { + app.logger.Info("starting up", "timestamp", time.Now()) + + // ... app code ... +``` + +## Background + +If the Go standard library had defined an interface for logging, this project +probably would not be needed. Alas, here we are. + +When the Go developers started developing such an interface with +[slog](https://github.com/golang/go/issues/56345), they adopted some of the +logr design but also left out some parts and changed others: + +| Feature | logr | slog | +|---------|------|------| +| High-level API | `Logger` (passed by value) | `Logger` (passed by [pointer](https://github.com/golang/go/issues/59126)) | +| Low-level API | `LogSink` | `Handler` | +| Stack unwinding | done by `LogSink` | done by `Logger` | +| Skipping helper functions | `WithCallDepth`, `WithCallStackHelper` | [not supported by Logger](https://github.com/golang/go/issues/59145) | +| Generating a value for logging on demand | `Marshaler` | `LogValuer` | +| Log levels | >= 0, higher meaning "less important" | positive and negative, with 0 for "info" and higher meaning "more important" | +| Error log entries | always logged, don't have a verbosity level | normal log entries with level >= `LevelError` | +| Passing logger via context | `NewContext`, `FromContext` | no API | +| Adding a name to a logger | `WithName` | no API | +| Modify verbosity of log entries in a call chain | `V` | no API | +| Grouping of key/value pairs | not supported | `WithGroup`, `GroupValue` | +| Pass context for extracting additional values | no API | API variants like `InfoCtx` | + +The high-level slog API is explicitly meant to be one of many different APIs +that can be layered on top of a shared `slog.Handler`. logr is one such +alternative API, with [interoperability](#slog-interoperability) provided by +some conversion functions. + +### Inspiration + +Before you consider this package, please read [this blog post by the +inimitable Dave Cheney][warning-makes-no-sense]. We really appreciate what +he has to say, and it largely aligns with our own experiences. + +### Differences from Dave's ideas + +The main differences are: + +1. Dave basically proposes doing away with the notion of a logging API in favor +of `fmt.Printf()`. We disagree, especially when you consider things like output +locations, timestamps, file and line decorations, and structured logging. This +package restricts the logging API to just 2 types of logs: info and error. + +Info logs are things you want to tell the user which are not errors. Error +logs are, well, errors. If your code receives an `error` from a subordinate +function call and is logging that `error` *and not returning it*, use error +logs. + +2. Verbosity-levels on info logs. This gives developers a chance to indicate +arbitrary grades of importance for info logs, without assigning names with +semantic meaning such as "warning", "trace", and "debug." Superficially this +may feel very similar, but the primary difference is the lack of semantics. +Because verbosity is a numerical value, it's safe to assume that an app running +with higher verbosity means more (and less important) logs will be generated. + +## Implementations (non-exhaustive) + +There are implementations for the following logging libraries: + +- **a function** (can bridge to non-structured libraries): [funcr](https://github.com/go-logr/logr/tree/master/funcr) +- **a testing.T** (for use in Go tests, with JSON-like output): [testr](https://github.com/go-logr/logr/tree/master/testr) +- **github.com/google/glog**: [glogr](https://github.com/go-logr/glogr) +- **k8s.io/klog** (for Kubernetes): [klogr](https://git.k8s.io/klog/klogr) +- **a testing.T** (with klog-like text output): [ktesting](https://git.k8s.io/klog/ktesting) +- **go.uber.org/zap**: [zapr](https://github.com/go-logr/zapr) +- **log** (the Go standard library logger): [stdr](https://github.com/go-logr/stdr) +- **github.com/sirupsen/logrus**: [logrusr](https://github.com/bombsimon/logrusr) +- **github.com/wojas/genericr**: [genericr](https://github.com/wojas/genericr) (makes it easy to implement your own backend) +- **logfmt** (Heroku style [logging](https://www.brandur.org/logfmt)): [logfmtr](https://github.com/iand/logfmtr) +- **github.com/rs/zerolog**: [zerologr](https://github.com/go-logr/zerologr) +- **github.com/go-kit/log**: [gokitlogr](https://github.com/tonglil/gokitlogr) (also compatible with github.com/go-kit/kit/log since v0.12.0) +- **bytes.Buffer** (writing to a buffer): [bufrlogr](https://github.com/tonglil/buflogr) (useful for ensuring values were logged, like during testing) + +## slog interoperability + +Interoperability goes both ways, using the `logr.Logger` API with a `slog.Handler` +and using the `slog.Logger` API with a `logr.LogSink`. `FromSlogHandler` and +`ToSlogHandler` convert between a `logr.Logger` and a `slog.Handler`. +As usual, `slog.New` can be used to wrap such a `slog.Handler` in the high-level +slog API. + +### Using a `logr.LogSink` as backend for slog + +Ideally, a logr sink implementation should support both logr and slog by +implementing both the normal logr interface(s) and `SlogSink`. Because +of a conflict in the parameters of the common `Enabled` method, it is [not +possible to implement both slog.Handler and logr.Sink in the same +type](https://github.com/golang/go/issues/59110). + +If both are supported, log calls can go from the high-level APIs to the backend +without the need to convert parameters. `FromSlogHandler` and `ToSlogHandler` can +convert back and forth without adding additional wrappers, with one exception: +when `Logger.V` was used to adjust the verbosity for a `slog.Handler`, then +`ToSlogHandler` has to use a wrapper which adjusts the verbosity for future +log calls. + +Such an implementation should also support values that implement specific +interfaces from both packages for logging (`logr.Marshaler`, `slog.LogValuer`, +`slog.GroupValue`). logr does not convert those. + +Not supporting slog has several drawbacks: +- Recording source code locations works correctly if the handler gets called + through `slog.Logger`, but may be wrong in other cases. That's because a + `logr.Sink` does its own stack unwinding instead of using the program counter + provided by the high-level API. +- slog levels <= 0 can be mapped to logr levels by negating the level without a + loss of information. But all slog levels > 0 (e.g. `slog.LevelWarning` as + used by `slog.Logger.Warn`) must be mapped to 0 before calling the sink + because logr does not support "more important than info" levels. +- The slog group concept is supported by prefixing each key in a key/value + pair with the group names, separated by a dot. For structured output like + JSON it would be better to group the key/value pairs inside an object. +- Special slog values and interfaces don't work as expected. +- The overhead is likely to be higher. + +These drawbacks are severe enough that applications using a mixture of slog and +logr should switch to a different backend. + +### Using a `slog.Handler` as backend for logr + +Using a plain `slog.Handler` without support for logr works better than the +other direction: +- All logr verbosity levels can be mapped 1:1 to their corresponding slog level + by negating them. +- Stack unwinding is done by the `SlogSink` and the resulting program + counter is passed to the `slog.Handler`. +- Names added via `Logger.WithName` are gathered and recorded in an additional + attribute with `logger` as key and the names separated by slash as value. +- `Logger.Error` is turned into a log record with `slog.LevelError` as level + and an additional attribute with `err` as key, if an error was provided. + +The main drawback is that `logr.Marshaler` will not be supported. Types should +ideally support both `logr.Marshaler` and `slog.Valuer`. If compatibility +with logr implementations without slog support is not important, then +`slog.Valuer` is sufficient. + +### Context support for slog + +Storing a logger in a `context.Context` is not supported by +slog. `NewContextWithSlogLogger` and `FromContextAsSlogLogger` can be +used to fill this gap. They store and retrieve a `slog.Logger` pointer +under the same context key that is also used by `NewContext` and +`FromContext` for `logr.Logger` value. + +When `NewContextWithSlogLogger` is followed by `FromContext`, the latter will +automatically convert the `slog.Logger` to a +`logr.Logger`. `FromContextAsSlogLogger` does the same for the other direction. + +With this approach, binaries which use either slog or logr are as efficient as +possible with no unnecessary allocations. This is also why the API stores a +`slog.Logger` pointer: when storing a `slog.Handler`, creating a `slog.Logger` +on retrieval would need to allocate one. + +The downside is that switching back and forth needs more allocations. Because +logr is the API that is already in use by different packages, in particular +Kubernetes, the recommendation is to use the `logr.Logger` API in code which +uses contextual logging. + +An alternative to adding values to a logger and storing that logger in the +context is to store the values in the context and to configure a logging +backend to extract those values when emitting log entries. This only works when +log calls are passed the context, which is not supported by the logr API. + +With the slog API, it is possible, but not +required. https://github.com/veqryn/slog-context is a package for slog which +provides additional support code for this approach. It also contains wrappers +for the context functions in logr, so developers who prefer to not use the logr +APIs directly can use those instead and the resulting code will still be +interoperable with logr. + +## FAQ + +### Conceptual + +#### Why structured logging? + +- **Structured logs are more easily queryable**: Since you've got + key-value pairs, it's much easier to query your structured logs for + particular values by filtering on the contents of a particular key -- + think searching request logs for error codes, Kubernetes reconcilers for + the name and namespace of the reconciled object, etc. + +- **Structured logging makes it easier to have cross-referenceable logs**: + Similarly to searchability, if you maintain conventions around your + keys, it becomes easy to gather all log lines related to a particular + concept. + +- **Structured logs allow better dimensions of filtering**: if you have + structure to your logs, you've got more precise control over how much + information is logged -- you might choose in a particular configuration + to log certain keys but not others, only log lines where a certain key + matches a certain value, etc., instead of just having v-levels and names + to key off of. + +- **Structured logs better represent structured data**: sometimes, the + data that you want to log is inherently structured (think tuple-link + objects.) Structured logs allow you to preserve that structure when + outputting. + +#### Why V-levels? + +**V-levels give operators an easy way to control the chattiness of log +operations**. V-levels provide a way for a given package to distinguish +the relative importance or verbosity of a given log message. Then, if +a particular logger or package is logging too many messages, the user +of the package can simply change the v-levels for that library. + +#### Why not named levels, like Info/Warning/Error? + +Read [Dave Cheney's post][warning-makes-no-sense]. Then read [Differences +from Dave's ideas](#differences-from-daves-ideas). + +#### Why not allow format strings, too? + +**Format strings negate many of the benefits of structured logs**: + +- They're not easily searchable without resorting to fuzzy searching, + regular expressions, etc. + +- They don't store structured data well, since contents are flattened into + a string. + +- They're not cross-referenceable. + +- They don't compress easily, since the message is not constant. + +(Unless you turn positional parameters into key-value pairs with numerical +keys, at which point you've gotten key-value logging with meaningless +keys.) + +### Practical + +#### Why key-value pairs, and not a map? + +Key-value pairs are *much* easier to optimize, especially around +allocations. Zap (a structured logger that inspired logr's interface) has +[performance measurements](https://github.com/uber-go/zap#performance) +that show this quite nicely. + +While the interface ends up being a little less obvious, you get +potentially better performance, plus avoid making users type +`map[string]string{}` every time they want to log. + +#### What if my V-levels differ between libraries? + +That's fine. Control your V-levels on a per-logger basis, and use the +`WithName` method to pass different loggers to different libraries. + +Generally, you should take care to ensure that you have relatively +consistent V-levels within a given logger, however, as this makes deciding +on what verbosity of logs to request easier. + +#### But I really want to use a format string! + +That's not actually a question. Assuming your question is "how do +I convert my mental model of logging with format strings to logging with +constant messages": + +1. Figure out what the error actually is, as you'd write in a TL;DR style, + and use that as a message. + +2. For every place you'd write a format specifier, look to the word before + it, and add that as a key value pair. + +For instance, consider the following examples (all taken from spots in the +Kubernetes codebase): + +- `klog.V(4).Infof("Client is returning errors: code %v, error %v", + responseCode, err)` becomes `logger.Error(err, "client returned an + error", "code", responseCode)` + +- `klog.V(4).Infof("Got a Retry-After %ds response for attempt %d to %v", + seconds, retries, url)` becomes `logger.V(4).Info("got a retry-after + response when requesting url", "attempt", retries, "after + seconds", seconds, "url", url)` + +If you *really* must use a format string, use it in a key's value, and +call `fmt.Sprintf` yourself. For instance: `log.Printf("unable to +reflect over type %T")` becomes `logger.Info("unable to reflect over +type", "type", fmt.Sprintf("%T"))`. In general though, the cases where +this is necessary should be few and far between. + +#### How do I choose my V-levels? + +This is basically the only hard constraint: increase V-levels to denote +more verbose or more debug-y logs. + +Otherwise, you can start out with `0` as "you always want to see this", +`1` as "common logging that you might *possibly* want to turn off", and +`10` as "I would like to performance-test your log collection stack." + +Then gradually choose levels in between as you need them, working your way +down from 10 (for debug and trace style logs) and up from 1 (for chattier +info-type logs). For reference, slog pre-defines -4 for debug logs +(corresponds to 4 in logr), which matches what is +[recommended for Kubernetes](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md#what-method-to-use). + +#### How do I choose my keys? + +Keys are fairly flexible, and can hold more or less any string +value. For best compatibility with implementations and consistency +with existing code in other projects, there are a few conventions you +should consider. + +- Make your keys human-readable. +- Constant keys are generally a good idea. +- Be consistent across your codebase. +- Keys should naturally match parts of the message string. +- Use lower case for simple keys and + [lowerCamelCase](https://en.wiktionary.org/wiki/lowerCamelCase) for + more complex ones. Kubernetes is one example of a project that has + [adopted that + convention](https://github.com/kubernetes/community/blob/HEAD/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#name-arguments). + +While key names are mostly unrestricted (and spaces are acceptable), +it's generally a good idea to stick to printable ascii characters, or at +least match the general character set of your log lines. + +#### Why should keys be constant values? + +The point of structured logging is to make later log processing easier. Your +keys are, effectively, the schema of each log message. If you use different +keys across instances of the same log line, you will make your structured logs +much harder to use. `Sprintf()` is for values, not for keys! + +#### Why is this not a pure interface? + +The Logger type is implemented as a struct in order to allow the Go compiler to +optimize things like high-V `Info` logs that are not triggered. Not all of +these implementations are implemented yet, but this structure was suggested as +a way to ensure they *can* be implemented. All of the real work is behind the +`LogSink` interface. + +[warning-makes-no-sense]: http://dave.cheney.net/2015/11/05/lets-talk-about-logging diff --git a/vendor/github.com/go-logr/logr/SECURITY.md b/vendor/github.com/go-logr/logr/SECURITY.md new file mode 100644 index 0000000..1ca756f --- /dev/null +++ b/vendor/github.com/go-logr/logr/SECURITY.md @@ -0,0 +1,18 @@ +# Security Policy + +If you have discovered a security vulnerability in this project, please report it +privately. **Do not disclose it as a public issue.** This gives us time to work with you +to fix the issue before public exposure, reducing the chance that the exploit will be +used before a patch is released. + +You may submit the report in the following ways: + +- send an email to go-logr-security@googlegroups.com +- send us a [private vulnerability report](https://github.com/go-logr/logr/security/advisories/new) + +Please provide the following information in your report: + +- A description of the vulnerability and its impact +- How to reproduce the issue + +We ask that you give us 90 days to work on a fix before public exposure. diff --git a/vendor/github.com/go-logr/logr/context.go b/vendor/github.com/go-logr/logr/context.go new file mode 100644 index 0000000..de8bcc3 --- /dev/null +++ b/vendor/github.com/go-logr/logr/context.go @@ -0,0 +1,33 @@ +/* +Copyright 2023 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +// contextKey is how we find Loggers in a context.Context. With Go < 1.21, +// the value is always a Logger value. With Go >= 1.21, the value can be a +// Logger value or a slog.Logger pointer. +type contextKey struct{} + +// notFoundError exists to carry an IsNotFound method. +type notFoundError struct{} + +func (notFoundError) Error() string { + return "no logr.Logger was present" +} + +func (notFoundError) IsNotFound() bool { + return true +} diff --git a/vendor/github.com/go-logr/logr/context_noslog.go b/vendor/github.com/go-logr/logr/context_noslog.go new file mode 100644 index 0000000..f012f9a --- /dev/null +++ b/vendor/github.com/go-logr/logr/context_noslog.go @@ -0,0 +1,49 @@ +//go:build !go1.21 +// +build !go1.21 + +/* +Copyright 2019 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +import ( + "context" +) + +// FromContext returns a Logger from ctx or an error if no Logger is found. +func FromContext(ctx context.Context) (Logger, error) { + if v, ok := ctx.Value(contextKey{}).(Logger); ok { + return v, nil + } + + return Logger{}, notFoundError{} +} + +// FromContextOrDiscard returns a Logger from ctx. If no Logger is found, this +// returns a Logger that discards all log messages. +func FromContextOrDiscard(ctx context.Context) Logger { + if v, ok := ctx.Value(contextKey{}).(Logger); ok { + return v + } + + return Discard() +} + +// NewContext returns a new Context, derived from ctx, which carries the +// provided Logger. +func NewContext(ctx context.Context, logger Logger) context.Context { + return context.WithValue(ctx, contextKey{}, logger) +} diff --git a/vendor/github.com/go-logr/logr/context_slog.go b/vendor/github.com/go-logr/logr/context_slog.go new file mode 100644 index 0000000..065ef0b --- /dev/null +++ b/vendor/github.com/go-logr/logr/context_slog.go @@ -0,0 +1,83 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2019 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +import ( + "context" + "fmt" + "log/slog" +) + +// FromContext returns a Logger from ctx or an error if no Logger is found. +func FromContext(ctx context.Context) (Logger, error) { + v := ctx.Value(contextKey{}) + if v == nil { + return Logger{}, notFoundError{} + } + + switch v := v.(type) { + case Logger: + return v, nil + case *slog.Logger: + return FromSlogHandler(v.Handler()), nil + default: + // Not reached. + panic(fmt.Sprintf("unexpected value type for logr context key: %T", v)) + } +} + +// FromContextAsSlogLogger returns a slog.Logger from ctx or nil if no such Logger is found. +func FromContextAsSlogLogger(ctx context.Context) *slog.Logger { + v := ctx.Value(contextKey{}) + if v == nil { + return nil + } + + switch v := v.(type) { + case Logger: + return slog.New(ToSlogHandler(v)) + case *slog.Logger: + return v + default: + // Not reached. + panic(fmt.Sprintf("unexpected value type for logr context key: %T", v)) + } +} + +// FromContextOrDiscard returns a Logger from ctx. If no Logger is found, this +// returns a Logger that discards all log messages. +func FromContextOrDiscard(ctx context.Context) Logger { + if logger, err := FromContext(ctx); err == nil { + return logger + } + return Discard() +} + +// NewContext returns a new Context, derived from ctx, which carries the +// provided Logger. +func NewContext(ctx context.Context, logger Logger) context.Context { + return context.WithValue(ctx, contextKey{}, logger) +} + +// NewContextWithSlogLogger returns a new Context, derived from ctx, which carries the +// provided slog.Logger. +func NewContextWithSlogLogger(ctx context.Context, logger *slog.Logger) context.Context { + return context.WithValue(ctx, contextKey{}, logger) +} diff --git a/vendor/github.com/go-logr/logr/discard.go b/vendor/github.com/go-logr/logr/discard.go new file mode 100644 index 0000000..99fe8be --- /dev/null +++ b/vendor/github.com/go-logr/logr/discard.go @@ -0,0 +1,24 @@ +/* +Copyright 2020 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +// Discard returns a Logger that discards all messages logged to it. It can be +// used whenever the caller is not interested in the logs. Logger instances +// produced by this function always compare as equal. +func Discard() Logger { + return New(nil) +} diff --git a/vendor/github.com/go-logr/logr/funcr/funcr.go b/vendor/github.com/go-logr/logr/funcr/funcr.go new file mode 100644 index 0000000..30568e7 --- /dev/null +++ b/vendor/github.com/go-logr/logr/funcr/funcr.go @@ -0,0 +1,914 @@ +/* +Copyright 2021 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package funcr implements formatting of structured log messages and +// optionally captures the call site and timestamp. +// +// The simplest way to use it is via its implementation of a +// github.com/go-logr/logr.LogSink with output through an arbitrary +// "write" function. See New and NewJSON for details. +// +// # Custom LogSinks +// +// For users who need more control, a funcr.Formatter can be embedded inside +// your own custom LogSink implementation. This is useful when the LogSink +// needs to implement additional methods, for example. +// +// # Formatting +// +// This will respect logr.Marshaler, fmt.Stringer, and error interfaces for +// values which are being logged. When rendering a struct, funcr will use Go's +// standard JSON tags (all except "string"). +package funcr + +import ( + "bytes" + "encoding" + "encoding/json" + "fmt" + "path/filepath" + "reflect" + "runtime" + "strconv" + "strings" + "time" + + "github.com/go-logr/logr" +) + +// New returns a logr.Logger which is implemented by an arbitrary function. +func New(fn func(prefix, args string), opts Options) logr.Logger { + return logr.New(newSink(fn, NewFormatter(opts))) +} + +// NewJSON returns a logr.Logger which is implemented by an arbitrary function +// and produces JSON output. +func NewJSON(fn func(obj string), opts Options) logr.Logger { + fnWrapper := func(_, obj string) { + fn(obj) + } + return logr.New(newSink(fnWrapper, NewFormatterJSON(opts))) +} + +// Underlier exposes access to the underlying logging function. Since +// callers only have a logr.Logger, they have to know which +// implementation is in use, so this interface is less of an +// abstraction and more of a way to test type conversion. +type Underlier interface { + GetUnderlying() func(prefix, args string) +} + +func newSink(fn func(prefix, args string), formatter Formatter) logr.LogSink { + l := &fnlogger{ + Formatter: formatter, + write: fn, + } + // For skipping fnlogger.Info and fnlogger.Error. + l.Formatter.AddCallDepth(1) + return l +} + +// Options carries parameters which influence the way logs are generated. +type Options struct { + // LogCaller tells funcr to add a "caller" key to some or all log lines. + // This has some overhead, so some users might not want it. + LogCaller MessageClass + + // LogCallerFunc tells funcr to also log the calling function name. This + // has no effect if caller logging is not enabled (see Options.LogCaller). + LogCallerFunc bool + + // LogTimestamp tells funcr to add a "ts" key to log lines. This has some + // overhead, so some users might not want it. + LogTimestamp bool + + // TimestampFormat tells funcr how to render timestamps when LogTimestamp + // is enabled. If not specified, a default format will be used. For more + // details, see docs for Go's time.Layout. + TimestampFormat string + + // LogInfoLevel tells funcr what key to use to log the info level. + // If not specified, the info level will be logged as "level". + // If this is set to "", the info level will not be logged at all. + LogInfoLevel *string + + // Verbosity tells funcr which V logs to produce. Higher values enable + // more logs. Info logs at or below this level will be written, while logs + // above this level will be discarded. + Verbosity int + + // RenderBuiltinsHook allows users to mutate the list of key-value pairs + // while a log line is being rendered. The kvList argument follows logr + // conventions - each pair of slice elements is comprised of a string key + // and an arbitrary value (verified and sanitized before calling this + // hook). The value returned must follow the same conventions. This hook + // can be used to audit or modify logged data. For example, you might want + // to prefix all of funcr's built-in keys with some string. This hook is + // only called for built-in (provided by funcr itself) key-value pairs. + // Equivalent hooks are offered for key-value pairs saved via + // logr.Logger.WithValues or Formatter.AddValues (see RenderValuesHook) and + // for user-provided pairs (see RenderArgsHook). + RenderBuiltinsHook func(kvList []any) []any + + // RenderValuesHook is the same as RenderBuiltinsHook, except that it is + // only called for key-value pairs saved via logr.Logger.WithValues. See + // RenderBuiltinsHook for more details. + RenderValuesHook func(kvList []any) []any + + // RenderArgsHook is the same as RenderBuiltinsHook, except that it is only + // called for key-value pairs passed directly to Info and Error. See + // RenderBuiltinsHook for more details. + RenderArgsHook func(kvList []any) []any + + // MaxLogDepth tells funcr how many levels of nested fields (e.g. a struct + // that contains a struct, etc.) it may log. Every time it finds a struct, + // slice, array, or map the depth is increased by one. When the maximum is + // reached, the value will be converted to a string indicating that the max + // depth has been exceeded. If this field is not specified, a default + // value will be used. + MaxLogDepth int +} + +// MessageClass indicates which category or categories of messages to consider. +type MessageClass int + +const ( + // None ignores all message classes. + None MessageClass = iota + // All considers all message classes. + All + // Info only considers info messages. + Info + // Error only considers error messages. + Error +) + +// fnlogger inherits some of its LogSink implementation from Formatter +// and just needs to add some glue code. +type fnlogger struct { + Formatter + write func(prefix, args string) +} + +func (l fnlogger) WithName(name string) logr.LogSink { + l.Formatter.AddName(name) + return &l +} + +func (l fnlogger) WithValues(kvList ...any) logr.LogSink { + l.Formatter.AddValues(kvList) + return &l +} + +func (l fnlogger) WithCallDepth(depth int) logr.LogSink { + l.Formatter.AddCallDepth(depth) + return &l +} + +func (l fnlogger) Info(level int, msg string, kvList ...any) { + prefix, args := l.FormatInfo(level, msg, kvList) + l.write(prefix, args) +} + +func (l fnlogger) Error(err error, msg string, kvList ...any) { + prefix, args := l.FormatError(err, msg, kvList) + l.write(prefix, args) +} + +func (l fnlogger) GetUnderlying() func(prefix, args string) { + return l.write +} + +// Assert conformance to the interfaces. +var _ logr.LogSink = &fnlogger{} +var _ logr.CallDepthLogSink = &fnlogger{} +var _ Underlier = &fnlogger{} + +// NewFormatter constructs a Formatter which emits a JSON-like key=value format. +func NewFormatter(opts Options) Formatter { + return newFormatter(opts, outputKeyValue) +} + +// NewFormatterJSON constructs a Formatter which emits strict JSON. +func NewFormatterJSON(opts Options) Formatter { + return newFormatter(opts, outputJSON) +} + +// Defaults for Options. +const defaultTimestampFormat = "2006-01-02 15:04:05.000000" +const defaultMaxLogDepth = 16 + +func newFormatter(opts Options, outfmt outputFormat) Formatter { + if opts.TimestampFormat == "" { + opts.TimestampFormat = defaultTimestampFormat + } + if opts.MaxLogDepth == 0 { + opts.MaxLogDepth = defaultMaxLogDepth + } + if opts.LogInfoLevel == nil { + opts.LogInfoLevel = new(string) + *opts.LogInfoLevel = "level" + } + f := Formatter{ + outputFormat: outfmt, + prefix: "", + values: nil, + depth: 0, + opts: &opts, + } + return f +} + +// Formatter is an opaque struct which can be embedded in a LogSink +// implementation. It should be constructed with NewFormatter. Some of +// its methods directly implement logr.LogSink. +type Formatter struct { + outputFormat outputFormat + prefix string + values []any + valuesStr string + depth int + opts *Options + groupName string // for slog groups + groups []groupDef +} + +// outputFormat indicates which outputFormat to use. +type outputFormat int + +const ( + // outputKeyValue emits a JSON-like key=value format, but not strict JSON. + outputKeyValue outputFormat = iota + // outputJSON emits strict JSON. + outputJSON +) + +// groupDef represents a saved group. The values may be empty, but we don't +// know if we need to render the group until the final record is rendered. +type groupDef struct { + name string + values string +} + +// PseudoStruct is a list of key-value pairs that gets logged as a struct. +type PseudoStruct []any + +// render produces a log line, ready to use. +func (f Formatter) render(builtins, args []any) string { + // Empirically bytes.Buffer is faster than strings.Builder for this. + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + + if f.outputFormat == outputJSON { + buf.WriteByte('{') // for the whole record + } + + // Render builtins + vals := builtins + if hook := f.opts.RenderBuiltinsHook; hook != nil { + vals = hook(f.sanitize(vals)) + } + f.flatten(buf, vals, false) // keys are ours, no need to escape + continuing := len(builtins) > 0 + + // Turn the inner-most group into a string + argsStr := func() string { + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + + vals = args + if hook := f.opts.RenderArgsHook; hook != nil { + vals = hook(f.sanitize(vals)) + } + f.flatten(buf, vals, true) // escape user-provided keys + + return buf.String() + }() + + // Render the stack of groups from the inside out. + bodyStr := f.renderGroup(f.groupName, f.valuesStr, argsStr) + for i := len(f.groups) - 1; i >= 0; i-- { + grp := &f.groups[i] + if grp.values == "" && bodyStr == "" { + // no contents, so we must elide the whole group + continue + } + bodyStr = f.renderGroup(grp.name, grp.values, bodyStr) + } + + if bodyStr != "" { + if continuing { + buf.WriteByte(f.comma()) + } + buf.WriteString(bodyStr) + } + + if f.outputFormat == outputJSON { + buf.WriteByte('}') // for the whole record + } + + return buf.String() +} + +// renderGroup returns a string representation of the named group with rendered +// values and args. If the name is empty, this will return the values and args, +// joined. If the name is not empty, this will return a single key-value pair, +// where the value is a grouping of the values and args. If the values and +// args are both empty, this will return an empty string, even if the name was +// specified. +func (f Formatter) renderGroup(name string, values string, args string) string { + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + + needClosingBrace := false + if name != "" && (values != "" || args != "") { + buf.WriteString(f.quoted(name, true)) // escape user-provided keys + buf.WriteByte(f.colon()) + buf.WriteByte('{') + needClosingBrace = true + } + + continuing := false + if values != "" { + buf.WriteString(values) + continuing = true + } + + if args != "" { + if continuing { + buf.WriteByte(f.comma()) + } + buf.WriteString(args) + } + + if needClosingBrace { + buf.WriteByte('}') + } + + return buf.String() +} + +// flatten renders a list of key-value pairs into a buffer. If escapeKeys is +// true, the keys are assumed to have non-JSON-compatible characters in them +// and must be evaluated for escapes. +// +// This function returns a potentially modified version of kvList, which +// ensures that there is a value for every key (adding a value if needed) and +// that each key is a string (substituting a key if needed). +func (f Formatter) flatten(buf *bytes.Buffer, kvList []any, escapeKeys bool) []any { + // This logic overlaps with sanitize() but saves one type-cast per key, + // which can be measurable. + if len(kvList)%2 != 0 { + kvList = append(kvList, noValue) + } + copied := false + for i := 0; i < len(kvList); i += 2 { + k, ok := kvList[i].(string) + if !ok { + if !copied { + newList := make([]any, len(kvList)) + copy(newList, kvList) + kvList = newList + copied = true + } + k = f.nonStringKey(kvList[i]) + kvList[i] = k + } + v := kvList[i+1] + + if i > 0 { + if f.outputFormat == outputJSON { + buf.WriteByte(f.comma()) + } else { + // In theory the format could be something we don't understand. In + // practice, we control it, so it won't be. + buf.WriteByte(' ') + } + } + + buf.WriteString(f.quoted(k, escapeKeys)) + buf.WriteByte(f.colon()) + buf.WriteString(f.pretty(v)) + } + return kvList +} + +func (f Formatter) quoted(str string, escape bool) string { + if escape { + return prettyString(str) + } + // this is faster + return `"` + str + `"` +} + +func (f Formatter) comma() byte { + if f.outputFormat == outputJSON { + return ',' + } + return ' ' +} + +func (f Formatter) colon() byte { + if f.outputFormat == outputJSON { + return ':' + } + return '=' +} + +func (f Formatter) pretty(value any) string { + return f.prettyWithFlags(value, 0, 0) +} + +const ( + flagRawStruct = 0x1 // do not print braces on structs +) + +// TODO: This is not fast. Most of the overhead goes here. +func (f Formatter) prettyWithFlags(value any, flags uint32, depth int) string { + if depth > f.opts.MaxLogDepth { + return `""` + } + + // Handle types that take full control of logging. + if v, ok := value.(logr.Marshaler); ok { + // Replace the value with what the type wants to get logged. + // That then gets handled below via reflection. + value = invokeMarshaler(v) + } + + // Handle types that want to format themselves. + switch v := value.(type) { + case fmt.Stringer: + value = invokeStringer(v) + case error: + value = invokeError(v) + } + + // Handling the most common types without reflect is a small perf win. + switch v := value.(type) { + case bool: + return strconv.FormatBool(v) + case string: + return prettyString(v) + case int: + return strconv.FormatInt(int64(v), 10) + case int8: + return strconv.FormatInt(int64(v), 10) + case int16: + return strconv.FormatInt(int64(v), 10) + case int32: + return strconv.FormatInt(int64(v), 10) + case int64: + return strconv.FormatInt(int64(v), 10) + case uint: + return strconv.FormatUint(uint64(v), 10) + case uint8: + return strconv.FormatUint(uint64(v), 10) + case uint16: + return strconv.FormatUint(uint64(v), 10) + case uint32: + return strconv.FormatUint(uint64(v), 10) + case uint64: + return strconv.FormatUint(v, 10) + case uintptr: + return strconv.FormatUint(uint64(v), 10) + case float32: + return strconv.FormatFloat(float64(v), 'f', -1, 32) + case float64: + return strconv.FormatFloat(v, 'f', -1, 64) + case complex64: + return `"` + strconv.FormatComplex(complex128(v), 'f', -1, 64) + `"` + case complex128: + return `"` + strconv.FormatComplex(v, 'f', -1, 128) + `"` + case PseudoStruct: + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + v = f.sanitize(v) + if flags&flagRawStruct == 0 { + buf.WriteByte('{') + } + for i := 0; i < len(v); i += 2 { + if i > 0 { + buf.WriteByte(f.comma()) + } + k, _ := v[i].(string) // sanitize() above means no need to check success + // arbitrary keys might need escaping + buf.WriteString(prettyString(k)) + buf.WriteByte(f.colon()) + buf.WriteString(f.prettyWithFlags(v[i+1], 0, depth+1)) + } + if flags&flagRawStruct == 0 { + buf.WriteByte('}') + } + return buf.String() + } + + buf := bytes.NewBuffer(make([]byte, 0, 256)) + t := reflect.TypeOf(value) + if t == nil { + return "null" + } + v := reflect.ValueOf(value) + switch t.Kind() { + case reflect.Bool: + return strconv.FormatBool(v.Bool()) + case reflect.String: + return prettyString(v.String()) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return strconv.FormatInt(int64(v.Int()), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return strconv.FormatUint(uint64(v.Uint()), 10) + case reflect.Float32: + return strconv.FormatFloat(float64(v.Float()), 'f', -1, 32) + case reflect.Float64: + return strconv.FormatFloat(v.Float(), 'f', -1, 64) + case reflect.Complex64: + return `"` + strconv.FormatComplex(complex128(v.Complex()), 'f', -1, 64) + `"` + case reflect.Complex128: + return `"` + strconv.FormatComplex(v.Complex(), 'f', -1, 128) + `"` + case reflect.Struct: + if flags&flagRawStruct == 0 { + buf.WriteByte('{') + } + printComma := false // testing i>0 is not enough because of JSON omitted fields + for i := 0; i < t.NumField(); i++ { + fld := t.Field(i) + if fld.PkgPath != "" { + // reflect says this field is only defined for non-exported fields. + continue + } + if !v.Field(i).CanInterface() { + // reflect isn't clear exactly what this means, but we can't use it. + continue + } + name := "" + omitempty := false + if tag, found := fld.Tag.Lookup("json"); found { + if tag == "-" { + continue + } + if comma := strings.Index(tag, ","); comma != -1 { + if n := tag[:comma]; n != "" { + name = n + } + rest := tag[comma:] + if strings.Contains(rest, ",omitempty,") || strings.HasSuffix(rest, ",omitempty") { + omitempty = true + } + } else { + name = tag + } + } + if omitempty && isEmpty(v.Field(i)) { + continue + } + if printComma { + buf.WriteByte(f.comma()) + } + printComma = true // if we got here, we are rendering a field + if fld.Anonymous && fld.Type.Kind() == reflect.Struct && name == "" { + buf.WriteString(f.prettyWithFlags(v.Field(i).Interface(), flags|flagRawStruct, depth+1)) + continue + } + if name == "" { + name = fld.Name + } + // field names can't contain characters which need escaping + buf.WriteString(f.quoted(name, false)) + buf.WriteByte(f.colon()) + buf.WriteString(f.prettyWithFlags(v.Field(i).Interface(), 0, depth+1)) + } + if flags&flagRawStruct == 0 { + buf.WriteByte('}') + } + return buf.String() + case reflect.Slice, reflect.Array: + // If this is outputing as JSON make sure this isn't really a json.RawMessage. + // If so just emit "as-is" and don't pretty it as that will just print + // it as [X,Y,Z,...] which isn't terribly useful vs the string form you really want. + if f.outputFormat == outputJSON { + if rm, ok := value.(json.RawMessage); ok { + // If it's empty make sure we emit an empty value as the array style would below. + if len(rm) > 0 { + buf.Write(rm) + } else { + buf.WriteString("null") + } + return buf.String() + } + } + buf.WriteByte('[') + for i := 0; i < v.Len(); i++ { + if i > 0 { + buf.WriteByte(f.comma()) + } + e := v.Index(i) + buf.WriteString(f.prettyWithFlags(e.Interface(), 0, depth+1)) + } + buf.WriteByte(']') + return buf.String() + case reflect.Map: + buf.WriteByte('{') + // This does not sort the map keys, for best perf. + it := v.MapRange() + i := 0 + for it.Next() { + if i > 0 { + buf.WriteByte(f.comma()) + } + // If a map key supports TextMarshaler, use it. + keystr := "" + if m, ok := it.Key().Interface().(encoding.TextMarshaler); ok { + txt, err := m.MarshalText() + if err != nil { + keystr = fmt.Sprintf("", err.Error()) + } else { + keystr = string(txt) + } + keystr = prettyString(keystr) + } else { + // prettyWithFlags will produce already-escaped values + keystr = f.prettyWithFlags(it.Key().Interface(), 0, depth+1) + if t.Key().Kind() != reflect.String { + // JSON only does string keys. Unlike Go's standard JSON, we'll + // convert just about anything to a string. + keystr = prettyString(keystr) + } + } + buf.WriteString(keystr) + buf.WriteByte(f.colon()) + buf.WriteString(f.prettyWithFlags(it.Value().Interface(), 0, depth+1)) + i++ + } + buf.WriteByte('}') + return buf.String() + case reflect.Ptr, reflect.Interface: + if v.IsNil() { + return "null" + } + return f.prettyWithFlags(v.Elem().Interface(), 0, depth) + } + return fmt.Sprintf(`""`, t.Kind().String()) +} + +func prettyString(s string) string { + // Avoid escaping (which does allocations) if we can. + if needsEscape(s) { + return strconv.Quote(s) + } + b := bytes.NewBuffer(make([]byte, 0, 1024)) + b.WriteByte('"') + b.WriteString(s) + b.WriteByte('"') + return b.String() +} + +// needsEscape determines whether the input string needs to be escaped or not, +// without doing any allocations. +func needsEscape(s string) bool { + for _, r := range s { + if !strconv.IsPrint(r) || r == '\\' || r == '"' { + return true + } + } + return false +} + +func isEmpty(v reflect.Value) bool { + switch v.Kind() { + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + return v.Len() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Complex64, reflect.Complex128: + return v.Complex() == 0 + case reflect.Interface, reflect.Ptr: + return v.IsNil() + } + return false +} + +func invokeMarshaler(m logr.Marshaler) (ret any) { + defer func() { + if r := recover(); r != nil { + ret = fmt.Sprintf("", r) + } + }() + return m.MarshalLog() +} + +func invokeStringer(s fmt.Stringer) (ret string) { + defer func() { + if r := recover(); r != nil { + ret = fmt.Sprintf("", r) + } + }() + return s.String() +} + +func invokeError(e error) (ret string) { + defer func() { + if r := recover(); r != nil { + ret = fmt.Sprintf("", r) + } + }() + return e.Error() +} + +// Caller represents the original call site for a log line, after considering +// logr.Logger.WithCallDepth and logr.Logger.WithCallStackHelper. The File and +// Line fields will always be provided, while the Func field is optional. +// Users can set the render hook fields in Options to examine logged key-value +// pairs, one of which will be {"caller", Caller} if the Options.LogCaller +// field is enabled for the given MessageClass. +type Caller struct { + // File is the basename of the file for this call site. + File string `json:"file"` + // Line is the line number in the file for this call site. + Line int `json:"line"` + // Func is the function name for this call site, or empty if + // Options.LogCallerFunc is not enabled. + Func string `json:"function,omitempty"` +} + +func (f Formatter) caller() Caller { + // +1 for this frame, +1 for Info/Error. + pc, file, line, ok := runtime.Caller(f.depth + 2) + if !ok { + return Caller{"", 0, ""} + } + fn := "" + if f.opts.LogCallerFunc { + if fp := runtime.FuncForPC(pc); fp != nil { + fn = fp.Name() + } + } + + return Caller{filepath.Base(file), line, fn} +} + +const noValue = "" + +func (f Formatter) nonStringKey(v any) string { + return fmt.Sprintf("", f.snippet(v)) +} + +// snippet produces a short snippet string of an arbitrary value. +func (f Formatter) snippet(v any) string { + const snipLen = 16 + + snip := f.pretty(v) + if len(snip) > snipLen { + snip = snip[:snipLen] + } + return snip +} + +// sanitize ensures that a list of key-value pairs has a value for every key +// (adding a value if needed) and that each key is a string (substituting a key +// if needed). +func (f Formatter) sanitize(kvList []any) []any { + if len(kvList)%2 != 0 { + kvList = append(kvList, noValue) + } + for i := 0; i < len(kvList); i += 2 { + _, ok := kvList[i].(string) + if !ok { + kvList[i] = f.nonStringKey(kvList[i]) + } + } + return kvList +} + +// startGroup opens a new group scope (basically a sub-struct), which locks all +// the current saved values and starts them anew. This is needed to satisfy +// slog. +func (f *Formatter) startGroup(name string) { + // Unnamed groups are just inlined. + if name == "" { + return + } + + n := len(f.groups) + f.groups = append(f.groups[:n:n], groupDef{f.groupName, f.valuesStr}) + + // Start collecting new values. + f.groupName = name + f.valuesStr = "" + f.values = nil +} + +// Init configures this Formatter from runtime info, such as the call depth +// imposed by logr itself. +// Note that this receiver is a pointer, so depth can be saved. +func (f *Formatter) Init(info logr.RuntimeInfo) { + f.depth += info.CallDepth +} + +// Enabled checks whether an info message at the given level should be logged. +func (f Formatter) Enabled(level int) bool { + return level <= f.opts.Verbosity +} + +// GetDepth returns the current depth of this Formatter. This is useful for +// implementations which do their own caller attribution. +func (f Formatter) GetDepth() int { + return f.depth +} + +// FormatInfo renders an Info log message into strings. The prefix will be +// empty when no names were set (via AddNames), or when the output is +// configured for JSON. +func (f Formatter) FormatInfo(level int, msg string, kvList []any) (prefix, argsStr string) { + args := make([]any, 0, 64) // using a constant here impacts perf + prefix = f.prefix + if f.outputFormat == outputJSON { + args = append(args, "logger", prefix) + prefix = "" + } + if f.opts.LogTimestamp { + args = append(args, "ts", time.Now().Format(f.opts.TimestampFormat)) + } + if policy := f.opts.LogCaller; policy == All || policy == Info { + args = append(args, "caller", f.caller()) + } + if key := *f.opts.LogInfoLevel; key != "" { + args = append(args, key, level) + } + args = append(args, "msg", msg) + return prefix, f.render(args, kvList) +} + +// FormatError renders an Error log message into strings. The prefix will be +// empty when no names were set (via AddNames), or when the output is +// configured for JSON. +func (f Formatter) FormatError(err error, msg string, kvList []any) (prefix, argsStr string) { + args := make([]any, 0, 64) // using a constant here impacts perf + prefix = f.prefix + if f.outputFormat == outputJSON { + args = append(args, "logger", prefix) + prefix = "" + } + if f.opts.LogTimestamp { + args = append(args, "ts", time.Now().Format(f.opts.TimestampFormat)) + } + if policy := f.opts.LogCaller; policy == All || policy == Error { + args = append(args, "caller", f.caller()) + } + args = append(args, "msg", msg) + var loggableErr any + if err != nil { + loggableErr = err.Error() + } + args = append(args, "error", loggableErr) + return prefix, f.render(args, kvList) +} + +// AddName appends the specified name. funcr uses '/' characters to separate +// name elements. Callers should not pass '/' in the provided name string, but +// this library does not actually enforce that. +func (f *Formatter) AddName(name string) { + if len(f.prefix) > 0 { + f.prefix += "/" + } + f.prefix += name +} + +// AddValues adds key-value pairs to the set of saved values to be logged with +// each log line. +func (f *Formatter) AddValues(kvList []any) { + // Three slice args forces a copy. + n := len(f.values) + f.values = append(f.values[:n:n], kvList...) + + vals := f.values + if hook := f.opts.RenderValuesHook; hook != nil { + vals = hook(f.sanitize(vals)) + } + + // Pre-render values, so we don't have to do it on each Info/Error call. + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + f.flatten(buf, vals, true) // escape user-provided keys + f.valuesStr = buf.String() +} + +// AddCallDepth increases the number of stack-frames to skip when attributing +// the log line to a file and line. +func (f *Formatter) AddCallDepth(depth int) { + f.depth += depth +} diff --git a/vendor/github.com/go-logr/logr/funcr/slogsink.go b/vendor/github.com/go-logr/logr/funcr/slogsink.go new file mode 100644 index 0000000..7bd8476 --- /dev/null +++ b/vendor/github.com/go-logr/logr/funcr/slogsink.go @@ -0,0 +1,105 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2023 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package funcr + +import ( + "context" + "log/slog" + + "github.com/go-logr/logr" +) + +var _ logr.SlogSink = &fnlogger{} + +const extraSlogSinkDepth = 3 // 2 for slog, 1 for SlogSink + +func (l fnlogger) Handle(_ context.Context, record slog.Record) error { + kvList := make([]any, 0, 2*record.NumAttrs()) + record.Attrs(func(attr slog.Attr) bool { + kvList = attrToKVs(attr, kvList) + return true + }) + + if record.Level >= slog.LevelError { + l.WithCallDepth(extraSlogSinkDepth).Error(nil, record.Message, kvList...) + } else { + level := l.levelFromSlog(record.Level) + l.WithCallDepth(extraSlogSinkDepth).Info(level, record.Message, kvList...) + } + return nil +} + +func (l fnlogger) WithAttrs(attrs []slog.Attr) logr.SlogSink { + kvList := make([]any, 0, 2*len(attrs)) + for _, attr := range attrs { + kvList = attrToKVs(attr, kvList) + } + l.AddValues(kvList) + return &l +} + +func (l fnlogger) WithGroup(name string) logr.SlogSink { + l.startGroup(name) + return &l +} + +// attrToKVs appends a slog.Attr to a logr-style kvList. It handle slog Groups +// and other details of slog. +func attrToKVs(attr slog.Attr, kvList []any) []any { + attrVal := attr.Value.Resolve() + if attrVal.Kind() == slog.KindGroup { + groupVal := attrVal.Group() + grpKVs := make([]any, 0, 2*len(groupVal)) + for _, attr := range groupVal { + grpKVs = attrToKVs(attr, grpKVs) + } + if attr.Key == "" { + // slog says we have to inline these + kvList = append(kvList, grpKVs...) + } else { + kvList = append(kvList, attr.Key, PseudoStruct(grpKVs)) + } + } else if attr.Key != "" { + kvList = append(kvList, attr.Key, attrVal.Any()) + } + + return kvList +} + +// levelFromSlog adjusts the level by the logger's verbosity and negates it. +// It ensures that the result is >= 0. This is necessary because the result is +// passed to a LogSink and that API did not historically document whether +// levels could be negative or what that meant. +// +// Some example usage: +// +// logrV0 := getMyLogger() +// logrV2 := logrV0.V(2) +// slogV2 := slog.New(logr.ToSlogHandler(logrV2)) +// slogV2.Debug("msg") // =~ logrV2.V(4) =~ logrV0.V(6) +// slogV2.Info("msg") // =~ logrV2.V(0) =~ logrV0.V(2) +// slogv2.Warn("msg") // =~ logrV2.V(-4) =~ logrV0.V(0) +func (l fnlogger) levelFromSlog(level slog.Level) int { + result := -level + if result < 0 { + result = 0 // because LogSink doesn't expect negative V levels + } + return int(result) +} diff --git a/vendor/github.com/go-logr/logr/logr.go b/vendor/github.com/go-logr/logr/logr.go new file mode 100644 index 0000000..b4428e1 --- /dev/null +++ b/vendor/github.com/go-logr/logr/logr.go @@ -0,0 +1,520 @@ +/* +Copyright 2019 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This design derives from Dave Cheney's blog: +// http://dave.cheney.net/2015/11/05/lets-talk-about-logging + +// Package logr defines a general-purpose logging API and abstract interfaces +// to back that API. Packages in the Go ecosystem can depend on this package, +// while callers can implement logging with whatever backend is appropriate. +// +// # Usage +// +// Logging is done using a Logger instance. Logger is a concrete type with +// methods, which defers the actual logging to a LogSink interface. The main +// methods of Logger are Info() and Error(). Arguments to Info() and Error() +// are key/value pairs rather than printf-style formatted strings, emphasizing +// "structured logging". +// +// With Go's standard log package, we might write: +// +// log.Printf("setting target value %s", targetValue) +// +// With logr's structured logging, we'd write: +// +// logger.Info("setting target", "value", targetValue) +// +// Errors are much the same. Instead of: +// +// log.Printf("failed to open the pod bay door for user %s: %v", user, err) +// +// We'd write: +// +// logger.Error(err, "failed to open the pod bay door", "user", user) +// +// Info() and Error() are very similar, but they are separate methods so that +// LogSink implementations can choose to do things like attach additional +// information (such as stack traces) on calls to Error(). Error() messages are +// always logged, regardless of the current verbosity. If there is no error +// instance available, passing nil is valid. +// +// # Verbosity +// +// Often we want to log information only when the application in "verbose +// mode". To write log lines that are more verbose, Logger has a V() method. +// The higher the V-level of a log line, the less critical it is considered. +// Log-lines with V-levels that are not enabled (as per the LogSink) will not +// be written. Level V(0) is the default, and logger.V(0).Info() has the same +// meaning as logger.Info(). Negative V-levels have the same meaning as V(0). +// Error messages do not have a verbosity level and are always logged. +// +// Where we might have written: +// +// if flVerbose >= 2 { +// log.Printf("an unusual thing happened") +// } +// +// We can write: +// +// logger.V(2).Info("an unusual thing happened") +// +// # Logger Names +// +// Logger instances can have name strings so that all messages logged through +// that instance have additional context. For example, you might want to add +// a subsystem name: +// +// logger.WithName("compactor").Info("started", "time", time.Now()) +// +// The WithName() method returns a new Logger, which can be passed to +// constructors or other functions for further use. Repeated use of WithName() +// will accumulate name "segments". These name segments will be joined in some +// way by the LogSink implementation. It is strongly recommended that name +// segments contain simple identifiers (letters, digits, and hyphen), and do +// not contain characters that could muddle the log output or confuse the +// joining operation (e.g. whitespace, commas, periods, slashes, brackets, +// quotes, etc). +// +// # Saved Values +// +// Logger instances can store any number of key/value pairs, which will be +// logged alongside all messages logged through that instance. For example, +// you might want to create a Logger instance per managed object: +// +// With the standard log package, we might write: +// +// log.Printf("decided to set field foo to value %q for object %s/%s", +// targetValue, object.Namespace, object.Name) +// +// With logr we'd write: +// +// // Elsewhere: set up the logger to log the object name. +// obj.logger = mainLogger.WithValues( +// "name", obj.name, "namespace", obj.namespace) +// +// // later on... +// obj.logger.Info("setting foo", "value", targetValue) +// +// # Best Practices +// +// Logger has very few hard rules, with the goal that LogSink implementations +// might have a lot of freedom to differentiate. There are, however, some +// things to consider. +// +// The log message consists of a constant message attached to the log line. +// This should generally be a simple description of what's occurring, and should +// never be a format string. Variable information can then be attached using +// named values. +// +// Keys are arbitrary strings, but should generally be constant values. Values +// may be any Go value, but how the value is formatted is determined by the +// LogSink implementation. +// +// Logger instances are meant to be passed around by value. Code that receives +// such a value can call its methods without having to check whether the +// instance is ready for use. +// +// The zero logger (= Logger{}) is identical to Discard() and discards all log +// entries. Code that receives a Logger by value can simply call it, the methods +// will never crash. For cases where passing a logger is optional, a pointer to Logger +// should be used. +// +// # Key Naming Conventions +// +// Keys are not strictly required to conform to any specification or regex, but +// it is recommended that they: +// - be human-readable and meaningful (not auto-generated or simple ordinals) +// - be constant (not dependent on input data) +// - contain only printable characters +// - not contain whitespace or punctuation +// - use lower case for simple keys and lowerCamelCase for more complex ones +// +// These guidelines help ensure that log data is processed properly regardless +// of the log implementation. For example, log implementations will try to +// output JSON data or will store data for later database (e.g. SQL) queries. +// +// While users are generally free to use key names of their choice, it's +// generally best to avoid using the following keys, as they're frequently used +// by implementations: +// - "caller": the calling information (file/line) of a particular log line +// - "error": the underlying error value in the `Error` method +// - "level": the log level +// - "logger": the name of the associated logger +// - "msg": the log message +// - "stacktrace": the stack trace associated with a particular log line or +// error (often from the `Error` message) +// - "ts": the timestamp for a log line +// +// Implementations are encouraged to make use of these keys to represent the +// above concepts, when necessary (for example, in a pure-JSON output form, it +// would be necessary to represent at least message and timestamp as ordinary +// named values). +// +// # Break Glass +// +// Implementations may choose to give callers access to the underlying +// logging implementation. The recommended pattern for this is: +// +// // Underlier exposes access to the underlying logging implementation. +// // Since callers only have a logr.Logger, they have to know which +// // implementation is in use, so this interface is less of an abstraction +// // and more of way to test type conversion. +// type Underlier interface { +// GetUnderlying() +// } +// +// Logger grants access to the sink to enable type assertions like this: +// +// func DoSomethingWithImpl(log logr.Logger) { +// if underlier, ok := log.GetSink().(impl.Underlier); ok { +// implLogger := underlier.GetUnderlying() +// ... +// } +// } +// +// Custom `With*` functions can be implemented by copying the complete +// Logger struct and replacing the sink in the copy: +// +// // WithFooBar changes the foobar parameter in the log sink and returns a +// // new logger with that modified sink. It does nothing for loggers where +// // the sink doesn't support that parameter. +// func WithFoobar(log logr.Logger, foobar int) logr.Logger { +// if foobarLogSink, ok := log.GetSink().(FoobarSink); ok { +// log = log.WithSink(foobarLogSink.WithFooBar(foobar)) +// } +// return log +// } +// +// Don't use New to construct a new Logger with a LogSink retrieved from an +// existing Logger. Source code attribution might not work correctly and +// unexported fields in Logger get lost. +// +// Beware that the same LogSink instance may be shared by different logger +// instances. Calling functions that modify the LogSink will affect all of +// those. +package logr + +// New returns a new Logger instance. This is primarily used by libraries +// implementing LogSink, rather than end users. Passing a nil sink will create +// a Logger which discards all log lines. +func New(sink LogSink) Logger { + logger := Logger{} + logger.setSink(sink) + if sink != nil { + sink.Init(runtimeInfo) + } + return logger +} + +// setSink stores the sink and updates any related fields. It mutates the +// logger and thus is only safe to use for loggers that are not currently being +// used concurrently. +func (l *Logger) setSink(sink LogSink) { + l.sink = sink +} + +// GetSink returns the stored sink. +func (l Logger) GetSink() LogSink { + return l.sink +} + +// WithSink returns a copy of the logger with the new sink. +func (l Logger) WithSink(sink LogSink) Logger { + l.setSink(sink) + return l +} + +// Logger is an interface to an abstract logging implementation. This is a +// concrete type for performance reasons, but all the real work is passed on to +// a LogSink. Implementations of LogSink should provide their own constructors +// that return Logger, not LogSink. +// +// The underlying sink can be accessed through GetSink and be modified through +// WithSink. This enables the implementation of custom extensions (see "Break +// Glass" in the package documentation). Normally the sink should be used only +// indirectly. +type Logger struct { + sink LogSink + level int +} + +// Enabled tests whether this Logger is enabled. For example, commandline +// flags might be used to set the logging verbosity and disable some info logs. +func (l Logger) Enabled() bool { + // Some implementations of LogSink look at the caller in Enabled (e.g. + // different verbosity levels per package or file), but we only pass one + // CallDepth in (via Init). This means that all calls from Logger to the + // LogSink's Enabled, Info, and Error methods must have the same number of + // frames. In other words, Logger methods can't call other Logger methods + // which call these LogSink methods unless we do it the same in all paths. + return l.sink != nil && l.sink.Enabled(l.level) +} + +// Info logs a non-error message with the given key/value pairs as context. +// +// The msg argument should be used to add some constant description to the log +// line. The key/value pairs can then be used to add additional variable +// information. The key/value pairs must alternate string keys and arbitrary +// values. +func (l Logger) Info(msg string, keysAndValues ...any) { + if l.sink == nil { + return + } + if l.sink.Enabled(l.level) { // see comment in Enabled + if withHelper, ok := l.sink.(CallStackHelperLogSink); ok { + withHelper.GetCallStackHelper()() + } + l.sink.Info(l.level, msg, keysAndValues...) + } +} + +// Error logs an error, with the given message and key/value pairs as context. +// It functions similarly to Info, but may have unique behavior, and should be +// preferred for logging errors (see the package documentations for more +// information). The log message will always be emitted, regardless of +// verbosity level. +// +// The msg argument should be used to add context to any underlying error, +// while the err argument should be used to attach the actual error that +// triggered this log line, if present. The err parameter is optional +// and nil may be passed instead of an error instance. +func (l Logger) Error(err error, msg string, keysAndValues ...any) { + if l.sink == nil { + return + } + if withHelper, ok := l.sink.(CallStackHelperLogSink); ok { + withHelper.GetCallStackHelper()() + } + l.sink.Error(err, msg, keysAndValues...) +} + +// V returns a new Logger instance for a specific verbosity level, relative to +// this Logger. In other words, V-levels are additive. A higher verbosity +// level means a log message is less important. Negative V-levels are treated +// as 0. +func (l Logger) V(level int) Logger { + if l.sink == nil { + return l + } + if level < 0 { + level = 0 + } + l.level += level + return l +} + +// GetV returns the verbosity level of the logger. If the logger's LogSink is +// nil as in the Discard logger, this will always return 0. +func (l Logger) GetV() int { + // 0 if l.sink nil because of the if check in V above. + return l.level +} + +// WithValues returns a new Logger instance with additional key/value pairs. +// See Info for documentation on how key/value pairs work. +func (l Logger) WithValues(keysAndValues ...any) Logger { + if l.sink == nil { + return l + } + l.setSink(l.sink.WithValues(keysAndValues...)) + return l +} + +// WithName returns a new Logger instance with the specified name element added +// to the Logger's name. Successive calls with WithName append additional +// suffixes to the Logger's name. It's strongly recommended that name segments +// contain only letters, digits, and hyphens (see the package documentation for +// more information). +func (l Logger) WithName(name string) Logger { + if l.sink == nil { + return l + } + l.setSink(l.sink.WithName(name)) + return l +} + +// WithCallDepth returns a Logger instance that offsets the call stack by the +// specified number of frames when logging call site information, if possible. +// This is useful for users who have helper functions between the "real" call +// site and the actual calls to Logger methods. If depth is 0 the attribution +// should be to the direct caller of this function. If depth is 1 the +// attribution should skip 1 call frame, and so on. Successive calls to this +// are additive. +// +// If the underlying log implementation supports a WithCallDepth(int) method, +// it will be called and the result returned. If the implementation does not +// support CallDepthLogSink, the original Logger will be returned. +// +// To skip one level, WithCallStackHelper() should be used instead of +// WithCallDepth(1) because it works with implementions that support the +// CallDepthLogSink and/or CallStackHelperLogSink interfaces. +func (l Logger) WithCallDepth(depth int) Logger { + if l.sink == nil { + return l + } + if withCallDepth, ok := l.sink.(CallDepthLogSink); ok { + l.setSink(withCallDepth.WithCallDepth(depth)) + } + return l +} + +// WithCallStackHelper returns a new Logger instance that skips the direct +// caller when logging call site information, if possible. This is useful for +// users who have helper functions between the "real" call site and the actual +// calls to Logger methods and want to support loggers which depend on marking +// each individual helper function, like loggers based on testing.T. +// +// In addition to using that new logger instance, callers also must call the +// returned function. +// +// If the underlying log implementation supports a WithCallDepth(int) method, +// WithCallDepth(1) will be called to produce a new logger. If it supports a +// WithCallStackHelper() method, that will be also called. If the +// implementation does not support either of these, the original Logger will be +// returned. +func (l Logger) WithCallStackHelper() (func(), Logger) { + if l.sink == nil { + return func() {}, l + } + var helper func() + if withCallDepth, ok := l.sink.(CallDepthLogSink); ok { + l.setSink(withCallDepth.WithCallDepth(1)) + } + if withHelper, ok := l.sink.(CallStackHelperLogSink); ok { + helper = withHelper.GetCallStackHelper() + } else { + helper = func() {} + } + return helper, l +} + +// IsZero returns true if this logger is an uninitialized zero value +func (l Logger) IsZero() bool { + return l.sink == nil +} + +// RuntimeInfo holds information that the logr "core" library knows which +// LogSinks might want to know. +type RuntimeInfo struct { + // CallDepth is the number of call frames the logr library adds between the + // end-user and the LogSink. LogSink implementations which choose to print + // the original logging site (e.g. file & line) should climb this many + // additional frames to find it. + CallDepth int +} + +// runtimeInfo is a static global. It must not be changed at run time. +var runtimeInfo = RuntimeInfo{ + CallDepth: 1, +} + +// LogSink represents a logging implementation. End-users will generally not +// interact with this type. +type LogSink interface { + // Init receives optional information about the logr library for LogSink + // implementations that need it. + Init(info RuntimeInfo) + + // Enabled tests whether this LogSink is enabled at the specified V-level. + // For example, commandline flags might be used to set the logging + // verbosity and disable some info logs. + Enabled(level int) bool + + // Info logs a non-error message with the given key/value pairs as context. + // The level argument is provided for optional logging. This method will + // only be called when Enabled(level) is true. See Logger.Info for more + // details. + Info(level int, msg string, keysAndValues ...any) + + // Error logs an error, with the given message and key/value pairs as + // context. See Logger.Error for more details. + Error(err error, msg string, keysAndValues ...any) + + // WithValues returns a new LogSink with additional key/value pairs. See + // Logger.WithValues for more details. + WithValues(keysAndValues ...any) LogSink + + // WithName returns a new LogSink with the specified name appended. See + // Logger.WithName for more details. + WithName(name string) LogSink +} + +// CallDepthLogSink represents a LogSink that knows how to climb the call stack +// to identify the original call site and can offset the depth by a specified +// number of frames. This is useful for users who have helper functions +// between the "real" call site and the actual calls to Logger methods. +// Implementations that log information about the call site (such as file, +// function, or line) would otherwise log information about the intermediate +// helper functions. +// +// This is an optional interface and implementations are not required to +// support it. +type CallDepthLogSink interface { + // WithCallDepth returns a LogSink that will offset the call + // stack by the specified number of frames when logging call + // site information. + // + // If depth is 0, the LogSink should skip exactly the number + // of call frames defined in RuntimeInfo.CallDepth when Info + // or Error are called, i.e. the attribution should be to the + // direct caller of Logger.Info or Logger.Error. + // + // If depth is 1 the attribution should skip 1 call frame, and so on. + // Successive calls to this are additive. + WithCallDepth(depth int) LogSink +} + +// CallStackHelperLogSink represents a LogSink that knows how to climb +// the call stack to identify the original call site and can skip +// intermediate helper functions if they mark themselves as +// helper. Go's testing package uses that approach. +// +// This is useful for users who have helper functions between the +// "real" call site and the actual calls to Logger methods. +// Implementations that log information about the call site (such as +// file, function, or line) would otherwise log information about the +// intermediate helper functions. +// +// This is an optional interface and implementations are not required +// to support it. Implementations that choose to support this must not +// simply implement it as WithCallDepth(1), because +// Logger.WithCallStackHelper will call both methods if they are +// present. This should only be implemented for LogSinks that actually +// need it, as with testing.T. +type CallStackHelperLogSink interface { + // GetCallStackHelper returns a function that must be called + // to mark the direct caller as helper function when logging + // call site information. + GetCallStackHelper() func() +} + +// Marshaler is an optional interface that logged values may choose to +// implement. Loggers with structured output, such as JSON, should +// log the object return by the MarshalLog method instead of the +// original value. +type Marshaler interface { + // MarshalLog can be used to: + // - ensure that structs are not logged as strings when the original + // value has a String method: return a different type without a + // String method + // - select which fields of a complex type should get logged: + // return a simpler struct with fewer fields + // - log unexported fields: return a different struct + // with exported fields + // + // It may return any value of any type. + MarshalLog() any +} diff --git a/vendor/github.com/go-logr/logr/sloghandler.go b/vendor/github.com/go-logr/logr/sloghandler.go new file mode 100644 index 0000000..82d1ba4 --- /dev/null +++ b/vendor/github.com/go-logr/logr/sloghandler.go @@ -0,0 +1,192 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2023 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +import ( + "context" + "log/slog" +) + +type slogHandler struct { + // May be nil, in which case all logs get discarded. + sink LogSink + // Non-nil if sink is non-nil and implements SlogSink. + slogSink SlogSink + + // groupPrefix collects values from WithGroup calls. It gets added as + // prefix to value keys when handling a log record. + groupPrefix string + + // levelBias can be set when constructing the handler to influence the + // slog.Level of log records. A positive levelBias reduces the + // slog.Level value. slog has no API to influence this value after the + // handler got created, so it can only be set indirectly through + // Logger.V. + levelBias slog.Level +} + +var _ slog.Handler = &slogHandler{} + +// groupSeparator is used to concatenate WithGroup names and attribute keys. +const groupSeparator = "." + +// GetLevel is used for black box unit testing. +func (l *slogHandler) GetLevel() slog.Level { + return l.levelBias +} + +func (l *slogHandler) Enabled(_ context.Context, level slog.Level) bool { + return l.sink != nil && (level >= slog.LevelError || l.sink.Enabled(l.levelFromSlog(level))) +} + +func (l *slogHandler) Handle(ctx context.Context, record slog.Record) error { + if l.slogSink != nil { + // Only adjust verbosity level of log entries < slog.LevelError. + if record.Level < slog.LevelError { + record.Level -= l.levelBias + } + return l.slogSink.Handle(ctx, record) + } + + // No need to check for nil sink here because Handle will only be called + // when Enabled returned true. + + kvList := make([]any, 0, 2*record.NumAttrs()) + record.Attrs(func(attr slog.Attr) bool { + kvList = attrToKVs(attr, l.groupPrefix, kvList) + return true + }) + if record.Level >= slog.LevelError { + l.sinkWithCallDepth().Error(nil, record.Message, kvList...) + } else { + level := l.levelFromSlog(record.Level) + l.sinkWithCallDepth().Info(level, record.Message, kvList...) + } + return nil +} + +// sinkWithCallDepth adjusts the stack unwinding so that when Error or Info +// are called by Handle, code in slog gets skipped. +// +// This offset currently (Go 1.21.0) works for calls through +// slog.New(ToSlogHandler(...)). There's no guarantee that the call +// chain won't change. Wrapping the handler will also break unwinding. It's +// still better than not adjusting at all.... +// +// This cannot be done when constructing the handler because FromSlogHandler needs +// access to the original sink without this adjustment. A second copy would +// work, but then WithAttrs would have to be called for both of them. +func (l *slogHandler) sinkWithCallDepth() LogSink { + if sink, ok := l.sink.(CallDepthLogSink); ok { + return sink.WithCallDepth(2) + } + return l.sink +} + +func (l *slogHandler) WithAttrs(attrs []slog.Attr) slog.Handler { + if l.sink == nil || len(attrs) == 0 { + return l + } + + clone := *l + if l.slogSink != nil { + clone.slogSink = l.slogSink.WithAttrs(attrs) + clone.sink = clone.slogSink + } else { + kvList := make([]any, 0, 2*len(attrs)) + for _, attr := range attrs { + kvList = attrToKVs(attr, l.groupPrefix, kvList) + } + clone.sink = l.sink.WithValues(kvList...) + } + return &clone +} + +func (l *slogHandler) WithGroup(name string) slog.Handler { + if l.sink == nil { + return l + } + if name == "" { + // slog says to inline empty groups + return l + } + clone := *l + if l.slogSink != nil { + clone.slogSink = l.slogSink.WithGroup(name) + clone.sink = clone.slogSink + } else { + clone.groupPrefix = addPrefix(clone.groupPrefix, name) + } + return &clone +} + +// attrToKVs appends a slog.Attr to a logr-style kvList. It handle slog Groups +// and other details of slog. +func attrToKVs(attr slog.Attr, groupPrefix string, kvList []any) []any { + attrVal := attr.Value.Resolve() + if attrVal.Kind() == slog.KindGroup { + groupVal := attrVal.Group() + grpKVs := make([]any, 0, 2*len(groupVal)) + prefix := groupPrefix + if attr.Key != "" { + prefix = addPrefix(groupPrefix, attr.Key) + } + for _, attr := range groupVal { + grpKVs = attrToKVs(attr, prefix, grpKVs) + } + kvList = append(kvList, grpKVs...) + } else if attr.Key != "" { + kvList = append(kvList, addPrefix(groupPrefix, attr.Key), attrVal.Any()) + } + + return kvList +} + +func addPrefix(prefix, name string) string { + if prefix == "" { + return name + } + if name == "" { + return prefix + } + return prefix + groupSeparator + name +} + +// levelFromSlog adjusts the level by the logger's verbosity and negates it. +// It ensures that the result is >= 0. This is necessary because the result is +// passed to a LogSink and that API did not historically document whether +// levels could be negative or what that meant. +// +// Some example usage: +// +// logrV0 := getMyLogger() +// logrV2 := logrV0.V(2) +// slogV2 := slog.New(logr.ToSlogHandler(logrV2)) +// slogV2.Debug("msg") // =~ logrV2.V(4) =~ logrV0.V(6) +// slogV2.Info("msg") // =~ logrV2.V(0) =~ logrV0.V(2) +// slogv2.Warn("msg") // =~ logrV2.V(-4) =~ logrV0.V(0) +func (l *slogHandler) levelFromSlog(level slog.Level) int { + result := -level + result += l.levelBias // in case the original Logger had a V level + if result < 0 { + result = 0 // because LogSink doesn't expect negative V levels + } + return int(result) +} diff --git a/vendor/github.com/go-logr/logr/slogr.go b/vendor/github.com/go-logr/logr/slogr.go new file mode 100644 index 0000000..28a83d0 --- /dev/null +++ b/vendor/github.com/go-logr/logr/slogr.go @@ -0,0 +1,100 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2023 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +import ( + "context" + "log/slog" +) + +// FromSlogHandler returns a Logger which writes to the slog.Handler. +// +// The logr verbosity level is mapped to slog levels such that V(0) becomes +// slog.LevelInfo and V(4) becomes slog.LevelDebug. +func FromSlogHandler(handler slog.Handler) Logger { + if handler, ok := handler.(*slogHandler); ok { + if handler.sink == nil { + return Discard() + } + return New(handler.sink).V(int(handler.levelBias)) + } + return New(&slogSink{handler: handler}) +} + +// ToSlogHandler returns a slog.Handler which writes to the same sink as the Logger. +// +// The returned logger writes all records with level >= slog.LevelError as +// error log entries with LogSink.Error, regardless of the verbosity level of +// the Logger: +// +// logger := +// slog.New(ToSlogHandler(logger.V(10))).Error(...) -> logSink.Error(...) +// +// The level of all other records gets reduced by the verbosity +// level of the Logger and the result is negated. If it happens +// to be negative, then it gets replaced by zero because a LogSink +// is not expected to handled negative levels: +// +// slog.New(ToSlogHandler(logger)).Debug(...) -> logger.GetSink().Info(level=4, ...) +// slog.New(ToSlogHandler(logger)).Warning(...) -> logger.GetSink().Info(level=0, ...) +// slog.New(ToSlogHandler(logger)).Info(...) -> logger.GetSink().Info(level=0, ...) +// slog.New(ToSlogHandler(logger.V(4))).Info(...) -> logger.GetSink().Info(level=4, ...) +func ToSlogHandler(logger Logger) slog.Handler { + if sink, ok := logger.GetSink().(*slogSink); ok && logger.GetV() == 0 { + return sink.handler + } + + handler := &slogHandler{sink: logger.GetSink(), levelBias: slog.Level(logger.GetV())} + if slogSink, ok := handler.sink.(SlogSink); ok { + handler.slogSink = slogSink + } + return handler +} + +// SlogSink is an optional interface that a LogSink can implement to support +// logging through the slog.Logger or slog.Handler APIs better. It then should +// also support special slog values like slog.Group. When used as a +// slog.Handler, the advantages are: +// +// - stack unwinding gets avoided in favor of logging the pre-recorded PC, +// as intended by slog +// - proper grouping of key/value pairs via WithGroup +// - verbosity levels > slog.LevelInfo can be recorded +// - less overhead +// +// Both APIs (Logger and slog.Logger/Handler) then are supported equally +// well. Developers can pick whatever API suits them better and/or mix +// packages which use either API in the same binary with a common logging +// implementation. +// +// This interface is necessary because the type implementing the LogSink +// interface cannot also implement the slog.Handler interface due to the +// different prototype of the common Enabled method. +// +// An implementation could support both interfaces in two different types, but then +// additional interfaces would be needed to convert between those types in FromSlogHandler +// and ToSlogHandler. +type SlogSink interface { + LogSink + + Handle(ctx context.Context, record slog.Record) error + WithAttrs(attrs []slog.Attr) SlogSink + WithGroup(name string) SlogSink +} diff --git a/vendor/github.com/go-logr/logr/slogsink.go b/vendor/github.com/go-logr/logr/slogsink.go new file mode 100644 index 0000000..4060fcb --- /dev/null +++ b/vendor/github.com/go-logr/logr/slogsink.go @@ -0,0 +1,120 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2023 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package logr + +import ( + "context" + "log/slog" + "runtime" + "time" +) + +var ( + _ LogSink = &slogSink{} + _ CallDepthLogSink = &slogSink{} + _ Underlier = &slogSink{} +) + +// Underlier is implemented by the LogSink returned by NewFromLogHandler. +type Underlier interface { + // GetUnderlying returns the Handler used by the LogSink. + GetUnderlying() slog.Handler +} + +const ( + // nameKey is used to log the `WithName` values as an additional attribute. + nameKey = "logger" + + // errKey is used to log the error parameter of Error as an additional attribute. + errKey = "err" +) + +type slogSink struct { + callDepth int + name string + handler slog.Handler +} + +func (l *slogSink) Init(info RuntimeInfo) { + l.callDepth = info.CallDepth +} + +func (l *slogSink) GetUnderlying() slog.Handler { + return l.handler +} + +func (l *slogSink) WithCallDepth(depth int) LogSink { + newLogger := *l + newLogger.callDepth += depth + return &newLogger +} + +func (l *slogSink) Enabled(level int) bool { + return l.handler.Enabled(context.Background(), slog.Level(-level)) +} + +func (l *slogSink) Info(level int, msg string, kvList ...interface{}) { + l.log(nil, msg, slog.Level(-level), kvList...) +} + +func (l *slogSink) Error(err error, msg string, kvList ...interface{}) { + l.log(err, msg, slog.LevelError, kvList...) +} + +func (l *slogSink) log(err error, msg string, level slog.Level, kvList ...interface{}) { + var pcs [1]uintptr + // skip runtime.Callers, this function, Info/Error, and all helper functions above that. + runtime.Callers(3+l.callDepth, pcs[:]) + + record := slog.NewRecord(time.Now(), level, msg, pcs[0]) + if l.name != "" { + record.AddAttrs(slog.String(nameKey, l.name)) + } + if err != nil { + record.AddAttrs(slog.Any(errKey, err)) + } + record.Add(kvList...) + _ = l.handler.Handle(context.Background(), record) +} + +func (l slogSink) WithName(name string) LogSink { + if l.name != "" { + l.name += "/" + } + l.name += name + return &l +} + +func (l slogSink) WithValues(kvList ...interface{}) LogSink { + l.handler = l.handler.WithAttrs(kvListToAttrs(kvList...)) + return &l +} + +func kvListToAttrs(kvList ...interface{}) []slog.Attr { + // We don't need the record itself, only its Add method. + record := slog.NewRecord(time.Time{}, 0, "", 0) + record.Add(kvList...) + attrs := make([]slog.Attr, 0, record.NumAttrs()) + record.Attrs(func(attr slog.Attr) bool { + attrs = append(attrs, attr) + return true + }) + return attrs +} diff --git a/vendor/github.com/go-logr/stdr/LICENSE b/vendor/github.com/go-logr/stdr/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/vendor/github.com/go-logr/stdr/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-logr/stdr/README.md b/vendor/github.com/go-logr/stdr/README.md new file mode 100644 index 0000000..5158667 --- /dev/null +++ b/vendor/github.com/go-logr/stdr/README.md @@ -0,0 +1,6 @@ +# Minimal Go logging using logr and Go's standard library + +[![Go Reference](https://pkg.go.dev/badge/github.com/go-logr/stdr.svg)](https://pkg.go.dev/github.com/go-logr/stdr) + +This package implements the [logr interface](https://github.com/go-logr/logr) +in terms of Go's standard log package(https://pkg.go.dev/log). diff --git a/vendor/github.com/go-logr/stdr/stdr.go b/vendor/github.com/go-logr/stdr/stdr.go new file mode 100644 index 0000000..93a8aab --- /dev/null +++ b/vendor/github.com/go-logr/stdr/stdr.go @@ -0,0 +1,170 @@ +/* +Copyright 2019 The logr Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package stdr implements github.com/go-logr/logr.Logger in terms of +// Go's standard log package. +package stdr + +import ( + "log" + "os" + + "github.com/go-logr/logr" + "github.com/go-logr/logr/funcr" +) + +// The global verbosity level. See SetVerbosity(). +var globalVerbosity int + +// SetVerbosity sets the global level against which all info logs will be +// compared. If this is greater than or equal to the "V" of the logger, the +// message will be logged. A higher value here means more logs will be written. +// The previous verbosity value is returned. This is not concurrent-safe - +// callers must be sure to call it from only one goroutine. +func SetVerbosity(v int) int { + old := globalVerbosity + globalVerbosity = v + return old +} + +// New returns a logr.Logger which is implemented by Go's standard log package, +// or something like it. If std is nil, this will use a default logger +// instead. +// +// Example: stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile))) +func New(std StdLogger) logr.Logger { + return NewWithOptions(std, Options{}) +} + +// NewWithOptions returns a logr.Logger which is implemented by Go's standard +// log package, or something like it. See New for details. +func NewWithOptions(std StdLogger, opts Options) logr.Logger { + if std == nil { + // Go's log.Default() is only available in 1.16 and higher. + std = log.New(os.Stderr, "", log.LstdFlags) + } + + if opts.Depth < 0 { + opts.Depth = 0 + } + + fopts := funcr.Options{ + LogCaller: funcr.MessageClass(opts.LogCaller), + } + + sl := &logger{ + Formatter: funcr.NewFormatter(fopts), + std: std, + } + + // For skipping our own logger.Info/Error. + sl.Formatter.AddCallDepth(1 + opts.Depth) + + return logr.New(sl) +} + +// Options carries parameters which influence the way logs are generated. +type Options struct { + // Depth biases the assumed number of call frames to the "true" caller. + // This is useful when the calling code calls a function which then calls + // stdr (e.g. a logging shim to another API). Values less than zero will + // be treated as zero. + Depth int + + // LogCaller tells stdr to add a "caller" key to some or all log lines. + // Go's log package has options to log this natively, too. + LogCaller MessageClass + + // TODO: add an option to log the date/time +} + +// MessageClass indicates which category or categories of messages to consider. +type MessageClass int + +const ( + // None ignores all message classes. + None MessageClass = iota + // All considers all message classes. + All + // Info only considers info messages. + Info + // Error only considers error messages. + Error +) + +// StdLogger is the subset of the Go stdlib log.Logger API that is needed for +// this adapter. +type StdLogger interface { + // Output is the same as log.Output and log.Logger.Output. + Output(calldepth int, logline string) error +} + +type logger struct { + funcr.Formatter + std StdLogger +} + +var _ logr.LogSink = &logger{} +var _ logr.CallDepthLogSink = &logger{} + +func (l logger) Enabled(level int) bool { + return globalVerbosity >= level +} + +func (l logger) Info(level int, msg string, kvList ...interface{}) { + prefix, args := l.FormatInfo(level, msg, kvList) + if prefix != "" { + args = prefix + ": " + args + } + _ = l.std.Output(l.Formatter.GetDepth()+1, args) +} + +func (l logger) Error(err error, msg string, kvList ...interface{}) { + prefix, args := l.FormatError(err, msg, kvList) + if prefix != "" { + args = prefix + ": " + args + } + _ = l.std.Output(l.Formatter.GetDepth()+1, args) +} + +func (l logger) WithName(name string) logr.LogSink { + l.Formatter.AddName(name) + return &l +} + +func (l logger) WithValues(kvList ...interface{}) logr.LogSink { + l.Formatter.AddValues(kvList) + return &l +} + +func (l logger) WithCallDepth(depth int) logr.LogSink { + l.Formatter.AddCallDepth(depth) + return &l +} + +// Underlier exposes access to the underlying logging implementation. Since +// callers only have a logr.Logger, they have to know which implementation is +// in use, so this interface is less of an abstraction and more of way to test +// type conversion. +type Underlier interface { + GetUnderlying() StdLogger +} + +// GetUnderlying returns the StdLogger underneath this logger. Since StdLogger +// is itself an interface, the result may or may not be a Go log.Logger. +func (l logger) GetUnderlying() StdLogger { + return l.std +} diff --git a/vendor/github.com/go-openapi/analysis/.codecov.yml b/vendor/github.com/go-openapi/analysis/.codecov.yml new file mode 100644 index 0000000..841c428 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/.codecov.yml @@ -0,0 +1,5 @@ +coverage: + status: + patch: + default: + target: 80% diff --git a/vendor/github.com/go-openapi/analysis/.gitattributes b/vendor/github.com/go-openapi/analysis/.gitattributes new file mode 100644 index 0000000..d020be8 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/.gitattributes @@ -0,0 +1,2 @@ +*.go text eol=lf + diff --git a/vendor/github.com/go-openapi/analysis/.gitignore b/vendor/github.com/go-openapi/analysis/.gitignore new file mode 100644 index 0000000..87c3bd3 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/.gitignore @@ -0,0 +1,5 @@ +secrets.yml +coverage.out +coverage.txt +*.cov +.idea diff --git a/vendor/github.com/go-openapi/analysis/.golangci.yml b/vendor/github.com/go-openapi/analysis/.golangci.yml new file mode 100644 index 0000000..22f8d21 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/.golangci.yml @@ -0,0 +1,61 @@ +linters-settings: + govet: + check-shadowing: true + golint: + min-confidence: 0 + gocyclo: + min-complexity: 45 + maligned: + suggest-new: true + dupl: + threshold: 200 + goconst: + min-len: 2 + min-occurrences: 3 + +linters: + enable-all: true + disable: + - maligned + - unparam + - lll + - gochecknoinits + - gochecknoglobals + - funlen + - godox + - gocognit + - whitespace + - wsl + - wrapcheck + - testpackage + - nlreturn + - gomnd + - exhaustivestruct + - goerr113 + - errorlint + - nestif + - godot + - gofumpt + - paralleltest + - tparallel + - thelper + - ifshort + - exhaustruct + - varnamelen + - gci + - depguard + - errchkjson + - inamedparam + - nonamedreturns + - musttag + - ireturn + - forcetypeassert + - cyclop + # deprecated linters + - deadcode + - interfacer + - scopelint + - varcheck + - structcheck + - golint + - nosnakecase diff --git a/vendor/github.com/go-openapi/analysis/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/analysis/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..9322b06 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at ivan+abuse@flanders.co.nz. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/go-openapi/analysis/LICENSE b/vendor/github.com/go-openapi/analysis/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-openapi/analysis/README.md b/vendor/github.com/go-openapi/analysis/README.md new file mode 100644 index 0000000..e005d4b --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/README.md @@ -0,0 +1,27 @@ +# OpenAPI analysis [![Build Status](https://github.com/go-openapi/analysis/actions/workflows/go-test.yml/badge.svg)](https://github.com/go-openapi/analysis/actions?query=workflow%3A"go+test") [![codecov](https://codecov.io/gh/go-openapi/analysis/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/analysis) + +[![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) +[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/analysis/master/LICENSE) +[![Go Reference](https://pkg.go.dev/badge/github.com/go-openapi/analysis.svg)](https://pkg.go.dev/github.com/go-openapi/analysis) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/analysis)](https://goreportcard.com/report/github.com/go-openapi/analysis) + + +A foundational library to analyze an OAI specification document for easier reasoning about the content. + +## What's inside? + +* An analyzer providing methods to walk the functional content of a specification +* A spec flattener producing a self-contained document bundle, while preserving `$ref`s +* A spec merger ("mixin") to merge several spec documents into a primary spec +* A spec "fixer" ensuring that response descriptions are non empty + +[Documentation](https://pkg.go.dev/github.com/go-openapi/analysis) + +## FAQ + +* Does this library support OpenAPI 3? + +> No. +> This package currently only supports OpenAPI 2.0 (aka Swagger 2.0). +> There is no plan to make it evolve toward supporting OpenAPI 3.x. +> This [discussion thread](https://github.com/go-openapi/spec/issues/21) relates the full story. diff --git a/vendor/github.com/go-openapi/analysis/analyzer.go b/vendor/github.com/go-openapi/analysis/analyzer.go new file mode 100644 index 0000000..c17aee1 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/analyzer.go @@ -0,0 +1,1064 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package analysis + +import ( + "fmt" + slashpath "path" + "strconv" + "strings" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/spec" + "github.com/go-openapi/swag" +) + +type referenceAnalysis struct { + schemas map[string]spec.Ref + responses map[string]spec.Ref + parameters map[string]spec.Ref + items map[string]spec.Ref + headerItems map[string]spec.Ref + parameterItems map[string]spec.Ref + allRefs map[string]spec.Ref + pathItems map[string]spec.Ref +} + +func (r *referenceAnalysis) addRef(key string, ref spec.Ref) { + r.allRefs["#"+key] = ref +} + +func (r *referenceAnalysis) addItemsRef(key string, items *spec.Items, location string) { + r.items["#"+key] = items.Ref + r.addRef(key, items.Ref) + if location == "header" { + // NOTE: in swagger 2.0, headers and parameters (but not body param schemas) are simple schemas + // and $ref are not supported here. However it is possible to analyze this. + r.headerItems["#"+key] = items.Ref + } else { + r.parameterItems["#"+key] = items.Ref + } +} + +func (r *referenceAnalysis) addSchemaRef(key string, ref SchemaRef) { + r.schemas["#"+key] = ref.Schema.Ref + r.addRef(key, ref.Schema.Ref) +} + +func (r *referenceAnalysis) addResponseRef(key string, resp *spec.Response) { + r.responses["#"+key] = resp.Ref + r.addRef(key, resp.Ref) +} + +func (r *referenceAnalysis) addParamRef(key string, param *spec.Parameter) { + r.parameters["#"+key] = param.Ref + r.addRef(key, param.Ref) +} + +func (r *referenceAnalysis) addPathItemRef(key string, pathItem *spec.PathItem) { + r.pathItems["#"+key] = pathItem.Ref + r.addRef(key, pathItem.Ref) +} + +type patternAnalysis struct { + parameters map[string]string + headers map[string]string + items map[string]string + schemas map[string]string + allPatterns map[string]string +} + +func (p *patternAnalysis) addPattern(key, pattern string) { + p.allPatterns["#"+key] = pattern +} + +func (p *patternAnalysis) addParameterPattern(key, pattern string) { + p.parameters["#"+key] = pattern + p.addPattern(key, pattern) +} + +func (p *patternAnalysis) addHeaderPattern(key, pattern string) { + p.headers["#"+key] = pattern + p.addPattern(key, pattern) +} + +func (p *patternAnalysis) addItemsPattern(key, pattern string) { + p.items["#"+key] = pattern + p.addPattern(key, pattern) +} + +func (p *patternAnalysis) addSchemaPattern(key, pattern string) { + p.schemas["#"+key] = pattern + p.addPattern(key, pattern) +} + +type enumAnalysis struct { + parameters map[string][]interface{} + headers map[string][]interface{} + items map[string][]interface{} + schemas map[string][]interface{} + allEnums map[string][]interface{} +} + +func (p *enumAnalysis) addEnum(key string, enum []interface{}) { + p.allEnums["#"+key] = enum +} + +func (p *enumAnalysis) addParameterEnum(key string, enum []interface{}) { + p.parameters["#"+key] = enum + p.addEnum(key, enum) +} + +func (p *enumAnalysis) addHeaderEnum(key string, enum []interface{}) { + p.headers["#"+key] = enum + p.addEnum(key, enum) +} + +func (p *enumAnalysis) addItemsEnum(key string, enum []interface{}) { + p.items["#"+key] = enum + p.addEnum(key, enum) +} + +func (p *enumAnalysis) addSchemaEnum(key string, enum []interface{}) { + p.schemas["#"+key] = enum + p.addEnum(key, enum) +} + +// New takes a swagger spec object and returns an analyzed spec document. +// The analyzed document contains a number of indices that make it easier to +// reason about semantics of a swagger specification for use in code generation +// or validation etc. +func New(doc *spec.Swagger) *Spec { + a := &Spec{ + spec: doc, + references: referenceAnalysis{}, + patterns: patternAnalysis{}, + enums: enumAnalysis{}, + } + a.reset() + a.initialize() + + return a +} + +// Spec is an analyzed specification object. It takes a swagger spec object and turns it into a registry +// with a bunch of utility methods to act on the information in the spec. +type Spec struct { + spec *spec.Swagger + consumes map[string]struct{} + produces map[string]struct{} + authSchemes map[string]struct{} + operations map[string]map[string]*spec.Operation + references referenceAnalysis + patterns patternAnalysis + enums enumAnalysis + allSchemas map[string]SchemaRef + allOfs map[string]SchemaRef +} + +func (s *Spec) reset() { + s.consumes = make(map[string]struct{}, 150) + s.produces = make(map[string]struct{}, 150) + s.authSchemes = make(map[string]struct{}, 150) + s.operations = make(map[string]map[string]*spec.Operation, 150) + s.allSchemas = make(map[string]SchemaRef, 150) + s.allOfs = make(map[string]SchemaRef, 150) + s.references.schemas = make(map[string]spec.Ref, 150) + s.references.pathItems = make(map[string]spec.Ref, 150) + s.references.responses = make(map[string]spec.Ref, 150) + s.references.parameters = make(map[string]spec.Ref, 150) + s.references.items = make(map[string]spec.Ref, 150) + s.references.headerItems = make(map[string]spec.Ref, 150) + s.references.parameterItems = make(map[string]spec.Ref, 150) + s.references.allRefs = make(map[string]spec.Ref, 150) + s.patterns.parameters = make(map[string]string, 150) + s.patterns.headers = make(map[string]string, 150) + s.patterns.items = make(map[string]string, 150) + s.patterns.schemas = make(map[string]string, 150) + s.patterns.allPatterns = make(map[string]string, 150) + s.enums.parameters = make(map[string][]interface{}, 150) + s.enums.headers = make(map[string][]interface{}, 150) + s.enums.items = make(map[string][]interface{}, 150) + s.enums.schemas = make(map[string][]interface{}, 150) + s.enums.allEnums = make(map[string][]interface{}, 150) +} + +func (s *Spec) reload() { + s.reset() + s.initialize() +} + +func (s *Spec) initialize() { + for _, c := range s.spec.Consumes { + s.consumes[c] = struct{}{} + } + for _, c := range s.spec.Produces { + s.produces[c] = struct{}{} + } + for _, ss := range s.spec.Security { + for k := range ss { + s.authSchemes[k] = struct{}{} + } + } + for path, pathItem := range s.AllPaths() { + s.analyzeOperations(path, &pathItem) //#nosec + } + + for name, parameter := range s.spec.Parameters { + refPref := slashpath.Join("/parameters", jsonpointer.Escape(name)) + if parameter.Items != nil { + s.analyzeItems("items", parameter.Items, refPref, "parameter") + } + if parameter.In == "body" && parameter.Schema != nil { + s.analyzeSchema("schema", parameter.Schema, refPref) + } + if parameter.Pattern != "" { + s.patterns.addParameterPattern(refPref, parameter.Pattern) + } + if len(parameter.Enum) > 0 { + s.enums.addParameterEnum(refPref, parameter.Enum) + } + } + + for name, response := range s.spec.Responses { + refPref := slashpath.Join("/responses", jsonpointer.Escape(name)) + for k, v := range response.Headers { + hRefPref := slashpath.Join(refPref, "headers", k) + if v.Items != nil { + s.analyzeItems("items", v.Items, hRefPref, "header") + } + if v.Pattern != "" { + s.patterns.addHeaderPattern(hRefPref, v.Pattern) + } + if len(v.Enum) > 0 { + s.enums.addHeaderEnum(hRefPref, v.Enum) + } + } + if response.Schema != nil { + s.analyzeSchema("schema", response.Schema, refPref) + } + } + + for name := range s.spec.Definitions { + schema := s.spec.Definitions[name] + s.analyzeSchema(name, &schema, "/definitions") + } + // TODO: after analyzing all things and flattening schemas etc + // resolve all the collected references to their final representations + // best put in a separate method because this could get expensive +} + +func (s *Spec) analyzeOperations(path string, pi *spec.PathItem) { + // TODO: resolve refs here? + // Currently, operations declared via pathItem $ref are known only after expansion + op := pi + if pi.Ref.String() != "" { + key := slashpath.Join("/paths", jsonpointer.Escape(path)) + s.references.addPathItemRef(key, pi) + } + s.analyzeOperation("GET", path, op.Get) + s.analyzeOperation("PUT", path, op.Put) + s.analyzeOperation("POST", path, op.Post) + s.analyzeOperation("PATCH", path, op.Patch) + s.analyzeOperation("DELETE", path, op.Delete) + s.analyzeOperation("HEAD", path, op.Head) + s.analyzeOperation("OPTIONS", path, op.Options) + for i, param := range op.Parameters { + refPref := slashpath.Join("/paths", jsonpointer.Escape(path), "parameters", strconv.Itoa(i)) + if param.Ref.String() != "" { + s.references.addParamRef(refPref, ¶m) //#nosec + } + if param.Pattern != "" { + s.patterns.addParameterPattern(refPref, param.Pattern) + } + if len(param.Enum) > 0 { + s.enums.addParameterEnum(refPref, param.Enum) + } + if param.Items != nil { + s.analyzeItems("items", param.Items, refPref, "parameter") + } + if param.Schema != nil { + s.analyzeSchema("schema", param.Schema, refPref) + } + } +} + +func (s *Spec) analyzeItems(name string, items *spec.Items, prefix, location string) { + if items == nil { + return + } + refPref := slashpath.Join(prefix, name) + s.analyzeItems(name, items.Items, refPref, location) + if items.Ref.String() != "" { + s.references.addItemsRef(refPref, items, location) + } + if items.Pattern != "" { + s.patterns.addItemsPattern(refPref, items.Pattern) + } + if len(items.Enum) > 0 { + s.enums.addItemsEnum(refPref, items.Enum) + } +} + +func (s *Spec) analyzeParameter(prefix string, i int, param spec.Parameter) { + refPref := slashpath.Join(prefix, "parameters", strconv.Itoa(i)) + if param.Ref.String() != "" { + s.references.addParamRef(refPref, ¶m) //#nosec + } + + if param.Pattern != "" { + s.patterns.addParameterPattern(refPref, param.Pattern) + } + + if len(param.Enum) > 0 { + s.enums.addParameterEnum(refPref, param.Enum) + } + + s.analyzeItems("items", param.Items, refPref, "parameter") + if param.In == "body" && param.Schema != nil { + s.analyzeSchema("schema", param.Schema, refPref) + } +} + +func (s *Spec) analyzeOperation(method, path string, op *spec.Operation) { + if op == nil { + return + } + + for _, c := range op.Consumes { + s.consumes[c] = struct{}{} + } + + for _, c := range op.Produces { + s.produces[c] = struct{}{} + } + + for _, ss := range op.Security { + for k := range ss { + s.authSchemes[k] = struct{}{} + } + } + + if _, ok := s.operations[method]; !ok { + s.operations[method] = make(map[string]*spec.Operation) + } + + s.operations[method][path] = op + prefix := slashpath.Join("/paths", jsonpointer.Escape(path), strings.ToLower(method)) + for i, param := range op.Parameters { + s.analyzeParameter(prefix, i, param) + } + + if op.Responses == nil { + return + } + + if op.Responses.Default != nil { + s.analyzeDefaultResponse(prefix, op.Responses.Default) + } + + for k, res := range op.Responses.StatusCodeResponses { + s.analyzeResponse(prefix, k, res) + } +} + +func (s *Spec) analyzeDefaultResponse(prefix string, res *spec.Response) { + refPref := slashpath.Join(prefix, "responses", "default") + if res.Ref.String() != "" { + s.references.addResponseRef(refPref, res) + } + + for k, v := range res.Headers { + hRefPref := slashpath.Join(refPref, "headers", k) + s.analyzeItems("items", v.Items, hRefPref, "header") + if v.Pattern != "" { + s.patterns.addHeaderPattern(hRefPref, v.Pattern) + } + } + + if res.Schema != nil { + s.analyzeSchema("schema", res.Schema, refPref) + } +} + +func (s *Spec) analyzeResponse(prefix string, k int, res spec.Response) { + refPref := slashpath.Join(prefix, "responses", strconv.Itoa(k)) + if res.Ref.String() != "" { + s.references.addResponseRef(refPref, &res) //#nosec + } + + for k, v := range res.Headers { + hRefPref := slashpath.Join(refPref, "headers", k) + s.analyzeItems("items", v.Items, hRefPref, "header") + if v.Pattern != "" { + s.patterns.addHeaderPattern(hRefPref, v.Pattern) + } + + if len(v.Enum) > 0 { + s.enums.addHeaderEnum(hRefPref, v.Enum) + } + } + + if res.Schema != nil { + s.analyzeSchema("schema", res.Schema, refPref) + } +} + +func (s *Spec) analyzeSchema(name string, schema *spec.Schema, prefix string) { + refURI := slashpath.Join(prefix, jsonpointer.Escape(name)) + schRef := SchemaRef{ + Name: name, + Schema: schema, + Ref: spec.MustCreateRef("#" + refURI), + TopLevel: prefix == "/definitions", + } + + s.allSchemas["#"+refURI] = schRef + + if schema.Ref.String() != "" { + s.references.addSchemaRef(refURI, schRef) + } + + if schema.Pattern != "" { + s.patterns.addSchemaPattern(refURI, schema.Pattern) + } + + if len(schema.Enum) > 0 { + s.enums.addSchemaEnum(refURI, schema.Enum) + } + + for k, v := range schema.Definitions { + v := v + s.analyzeSchema(k, &v, slashpath.Join(refURI, "definitions")) + } + + for k, v := range schema.Properties { + v := v + s.analyzeSchema(k, &v, slashpath.Join(refURI, "properties")) + } + + for k, v := range schema.PatternProperties { + v := v + // NOTE: swagger 2.0 does not support PatternProperties. + // However it is possible to analyze this in a schema + s.analyzeSchema(k, &v, slashpath.Join(refURI, "patternProperties")) + } + + for i := range schema.AllOf { + v := &schema.AllOf[i] + s.analyzeSchema(strconv.Itoa(i), v, slashpath.Join(refURI, "allOf")) + } + + if len(schema.AllOf) > 0 { + s.allOfs["#"+refURI] = schRef + } + + for i := range schema.AnyOf { + v := &schema.AnyOf[i] + // NOTE: swagger 2.0 does not support anyOf constructs. + // However it is possible to analyze this in a schema + s.analyzeSchema(strconv.Itoa(i), v, slashpath.Join(refURI, "anyOf")) + } + + for i := range schema.OneOf { + v := &schema.OneOf[i] + // NOTE: swagger 2.0 does not support oneOf constructs. + // However it is possible to analyze this in a schema + s.analyzeSchema(strconv.Itoa(i), v, slashpath.Join(refURI, "oneOf")) + } + + if schema.Not != nil { + // NOTE: swagger 2.0 does not support "not" constructs. + // However it is possible to analyze this in a schema + s.analyzeSchema("not", schema.Not, refURI) + } + + if schema.AdditionalProperties != nil && schema.AdditionalProperties.Schema != nil { + s.analyzeSchema("additionalProperties", schema.AdditionalProperties.Schema, refURI) + } + + if schema.AdditionalItems != nil && schema.AdditionalItems.Schema != nil { + // NOTE: swagger 2.0 does not support AdditionalItems. + // However it is possible to analyze this in a schema + s.analyzeSchema("additionalItems", schema.AdditionalItems.Schema, refURI) + } + + if schema.Items != nil { + if schema.Items.Schema != nil { + s.analyzeSchema("items", schema.Items.Schema, refURI) + } + + for i := range schema.Items.Schemas { + sch := &schema.Items.Schemas[i] + s.analyzeSchema(strconv.Itoa(i), sch, slashpath.Join(refURI, "items")) + } + } +} + +// SecurityRequirement is a representation of a security requirement for an operation +type SecurityRequirement struct { + Name string + Scopes []string +} + +// SecurityRequirementsFor gets the security requirements for the operation +func (s *Spec) SecurityRequirementsFor(operation *spec.Operation) [][]SecurityRequirement { + if s.spec.Security == nil && operation.Security == nil { + return nil + } + + schemes := s.spec.Security + if operation.Security != nil { + schemes = operation.Security + } + + result := [][]SecurityRequirement{} + for _, scheme := range schemes { + if len(scheme) == 0 { + // append a zero object for anonymous + result = append(result, []SecurityRequirement{{}}) + + continue + } + + var reqs []SecurityRequirement + for k, v := range scheme { + if v == nil { + v = []string{} + } + reqs = append(reqs, SecurityRequirement{Name: k, Scopes: v}) + } + + result = append(result, reqs) + } + + return result +} + +// SecurityDefinitionsForRequirements gets the matching security definitions for a set of requirements +func (s *Spec) SecurityDefinitionsForRequirements(requirements []SecurityRequirement) map[string]spec.SecurityScheme { + result := make(map[string]spec.SecurityScheme) + + for _, v := range requirements { + if definition, ok := s.spec.SecurityDefinitions[v.Name]; ok { + if definition != nil { + result[v.Name] = *definition + } + } + } + + return result +} + +// SecurityDefinitionsFor gets the matching security definitions for a set of requirements +func (s *Spec) SecurityDefinitionsFor(operation *spec.Operation) map[string]spec.SecurityScheme { + requirements := s.SecurityRequirementsFor(operation) + if len(requirements) == 0 { + return nil + } + + result := make(map[string]spec.SecurityScheme) + for _, reqs := range requirements { + for _, v := range reqs { + if v.Name == "" { + // optional requirement + continue + } + + if _, ok := result[v.Name]; ok { + // duplicate requirement + continue + } + + if definition, ok := s.spec.SecurityDefinitions[v.Name]; ok { + if definition != nil { + result[v.Name] = *definition + } + } + } + } + + return result +} + +// ConsumesFor gets the mediatypes for the operation +func (s *Spec) ConsumesFor(operation *spec.Operation) []string { + if len(operation.Consumes) == 0 { + cons := make(map[string]struct{}, len(s.spec.Consumes)) + for _, k := range s.spec.Consumes { + cons[k] = struct{}{} + } + + return s.structMapKeys(cons) + } + + cons := make(map[string]struct{}, len(operation.Consumes)) + for _, c := range operation.Consumes { + cons[c] = struct{}{} + } + + return s.structMapKeys(cons) +} + +// ProducesFor gets the mediatypes for the operation +func (s *Spec) ProducesFor(operation *spec.Operation) []string { + if len(operation.Produces) == 0 { + prod := make(map[string]struct{}, len(s.spec.Produces)) + for _, k := range s.spec.Produces { + prod[k] = struct{}{} + } + + return s.structMapKeys(prod) + } + + prod := make(map[string]struct{}, len(operation.Produces)) + for _, c := range operation.Produces { + prod[c] = struct{}{} + } + + return s.structMapKeys(prod) +} + +func mapKeyFromParam(param *spec.Parameter) string { + return fmt.Sprintf("%s#%s", param.In, fieldNameFromParam(param)) +} + +func fieldNameFromParam(param *spec.Parameter) string { + // TODO: this should be x-go-name + if nm, ok := param.Extensions.GetString("go-name"); ok { + return nm + } + + return swag.ToGoName(param.Name) +} + +// ErrorOnParamFunc is a callback function to be invoked +// whenever an error is encountered while resolving references +// on parameters. +// +// This function takes as input the spec.Parameter which triggered the +// error and the error itself. +// +// If the callback function returns false, the calling function should bail. +// +// If it returns true, the calling function should continue evaluating parameters. +// A nil ErrorOnParamFunc must be evaluated as equivalent to panic(). +type ErrorOnParamFunc func(spec.Parameter, error) bool + +func (s *Spec) paramsAsMap(parameters []spec.Parameter, res map[string]spec.Parameter, callmeOnError ErrorOnParamFunc) { + for _, param := range parameters { + pr := param + if pr.Ref.String() == "" { + res[mapKeyFromParam(&pr)] = pr + + continue + } + + // resolve $ref + if callmeOnError == nil { + callmeOnError = func(_ spec.Parameter, err error) bool { + panic(err) + } + } + + obj, _, err := pr.Ref.GetPointer().Get(s.spec) + if err != nil { + if callmeOnError(param, fmt.Errorf("invalid reference: %q", pr.Ref.String())) { + continue + } + + break + } + + objAsParam, ok := obj.(spec.Parameter) + if !ok { + if callmeOnError(param, fmt.Errorf("resolved reference is not a parameter: %q", pr.Ref.String())) { + continue + } + + break + } + + pr = objAsParam + res[mapKeyFromParam(&pr)] = pr + } +} + +// ParametersFor the specified operation id. +// +// Assumes parameters properly resolve references if any and that +// such references actually resolve to a parameter object. +// Otherwise, panics. +func (s *Spec) ParametersFor(operationID string) []spec.Parameter { + return s.SafeParametersFor(operationID, nil) +} + +// SafeParametersFor the specified operation id. +// +// Does not assume parameters properly resolve references or that +// such references actually resolve to a parameter object. +// +// Upon error, invoke a ErrorOnParamFunc callback with the erroneous +// parameters. If the callback is set to nil, panics upon errors. +func (s *Spec) SafeParametersFor(operationID string, callmeOnError ErrorOnParamFunc) []spec.Parameter { + gatherParams := func(pi *spec.PathItem, op *spec.Operation) []spec.Parameter { + bag := make(map[string]spec.Parameter) + s.paramsAsMap(pi.Parameters, bag, callmeOnError) + s.paramsAsMap(op.Parameters, bag, callmeOnError) + + var res []spec.Parameter + for _, v := range bag { + res = append(res, v) + } + + return res + } + + for _, pi := range s.spec.Paths.Paths { + if pi.Get != nil && pi.Get.ID == operationID { + return gatherParams(&pi, pi.Get) //#nosec + } + if pi.Head != nil && pi.Head.ID == operationID { + return gatherParams(&pi, pi.Head) //#nosec + } + if pi.Options != nil && pi.Options.ID == operationID { + return gatherParams(&pi, pi.Options) //#nosec + } + if pi.Post != nil && pi.Post.ID == operationID { + return gatherParams(&pi, pi.Post) //#nosec + } + if pi.Patch != nil && pi.Patch.ID == operationID { + return gatherParams(&pi, pi.Patch) //#nosec + } + if pi.Put != nil && pi.Put.ID == operationID { + return gatherParams(&pi, pi.Put) //#nosec + } + if pi.Delete != nil && pi.Delete.ID == operationID { + return gatherParams(&pi, pi.Delete) //#nosec + } + } + + return nil +} + +// ParamsFor the specified method and path. Aggregates them with the defaults etc, so it's all the params that +// apply for the method and path. +// +// Assumes parameters properly resolve references if any and that +// such references actually resolve to a parameter object. +// Otherwise, panics. +func (s *Spec) ParamsFor(method, path string) map[string]spec.Parameter { + return s.SafeParamsFor(method, path, nil) +} + +// SafeParamsFor the specified method and path. Aggregates them with the defaults etc, so it's all the params that +// apply for the method and path. +// +// Does not assume parameters properly resolve references or that +// such references actually resolve to a parameter object. +// +// Upon error, invoke a ErrorOnParamFunc callback with the erroneous +// parameters. If the callback is set to nil, panics upon errors. +func (s *Spec) SafeParamsFor(method, path string, callmeOnError ErrorOnParamFunc) map[string]spec.Parameter { + res := make(map[string]spec.Parameter) + if pi, ok := s.spec.Paths.Paths[path]; ok { + s.paramsAsMap(pi.Parameters, res, callmeOnError) + s.paramsAsMap(s.operations[strings.ToUpper(method)][path].Parameters, res, callmeOnError) + } + + return res +} + +// OperationForName gets the operation for the given id +func (s *Spec) OperationForName(operationID string) (string, string, *spec.Operation, bool) { + for method, pathItem := range s.operations { + for path, op := range pathItem { + if operationID == op.ID { + return method, path, op, true + } + } + } + + return "", "", nil, false +} + +// OperationFor the given method and path +func (s *Spec) OperationFor(method, path string) (*spec.Operation, bool) { + if mp, ok := s.operations[strings.ToUpper(method)]; ok { + op, fn := mp[path] + + return op, fn + } + + return nil, false +} + +// Operations gathers all the operations specified in the spec document +func (s *Spec) Operations() map[string]map[string]*spec.Operation { + return s.operations +} + +func (s *Spec) structMapKeys(mp map[string]struct{}) []string { + if len(mp) == 0 { + return nil + } + + result := make([]string, 0, len(mp)) + for k := range mp { + result = append(result, k) + } + + return result +} + +// AllPaths returns all the paths in the swagger spec +func (s *Spec) AllPaths() map[string]spec.PathItem { + if s.spec == nil || s.spec.Paths == nil { + return nil + } + + return s.spec.Paths.Paths +} + +// OperationIDs gets all the operation ids based on method an dpath +func (s *Spec) OperationIDs() []string { + if len(s.operations) == 0 { + return nil + } + + result := make([]string, 0, len(s.operations)) + for method, v := range s.operations { + for p, o := range v { + if o.ID != "" { + result = append(result, o.ID) + } else { + result = append(result, fmt.Sprintf("%s %s", strings.ToUpper(method), p)) + } + } + } + + return result +} + +// OperationMethodPaths gets all the operation ids based on method an dpath +func (s *Spec) OperationMethodPaths() []string { + if len(s.operations) == 0 { + return nil + } + + result := make([]string, 0, len(s.operations)) + for method, v := range s.operations { + for p := range v { + result = append(result, fmt.Sprintf("%s %s", strings.ToUpper(method), p)) + } + } + + return result +} + +// RequiredConsumes gets all the distinct consumes that are specified in the specification document +func (s *Spec) RequiredConsumes() []string { + return s.structMapKeys(s.consumes) +} + +// RequiredProduces gets all the distinct produces that are specified in the specification document +func (s *Spec) RequiredProduces() []string { + return s.structMapKeys(s.produces) +} + +// RequiredSecuritySchemes gets all the distinct security schemes that are specified in the swagger spec +func (s *Spec) RequiredSecuritySchemes() []string { + return s.structMapKeys(s.authSchemes) +} + +// SchemaRef is a reference to a schema +type SchemaRef struct { + Name string + Ref spec.Ref + Schema *spec.Schema + TopLevel bool +} + +// SchemasWithAllOf returns schema references to all schemas that are defined +// with an allOf key +func (s *Spec) SchemasWithAllOf() (result []SchemaRef) { + for _, v := range s.allOfs { + result = append(result, v) + } + + return +} + +// AllDefinitions returns schema references for all the definitions that were discovered +func (s *Spec) AllDefinitions() (result []SchemaRef) { + for _, v := range s.allSchemas { + result = append(result, v) + } + + return +} + +// AllDefinitionReferences returns json refs for all the discovered schemas +func (s *Spec) AllDefinitionReferences() (result []string) { + for _, v := range s.references.schemas { + result = append(result, v.String()) + } + + return +} + +// AllParameterReferences returns json refs for all the discovered parameters +func (s *Spec) AllParameterReferences() (result []string) { + for _, v := range s.references.parameters { + result = append(result, v.String()) + } + + return +} + +// AllResponseReferences returns json refs for all the discovered responses +func (s *Spec) AllResponseReferences() (result []string) { + for _, v := range s.references.responses { + result = append(result, v.String()) + } + + return +} + +// AllPathItemReferences returns the references for all the items +func (s *Spec) AllPathItemReferences() (result []string) { + for _, v := range s.references.pathItems { + result = append(result, v.String()) + } + + return +} + +// AllItemsReferences returns the references for all the items in simple schemas (parameters or headers). +// +// NOTE: since Swagger 2.0 forbids $ref in simple params, this should always yield an empty slice for a valid +// Swagger 2.0 spec. +func (s *Spec) AllItemsReferences() (result []string) { + for _, v := range s.references.items { + result = append(result, v.String()) + } + + return +} + +// AllReferences returns all the references found in the document, with possible duplicates +func (s *Spec) AllReferences() (result []string) { + for _, v := range s.references.allRefs { + result = append(result, v.String()) + } + + return +} + +// AllRefs returns all the unique references found in the document +func (s *Spec) AllRefs() (result []spec.Ref) { + set := make(map[string]struct{}) + for _, v := range s.references.allRefs { + a := v.String() + if a == "" { + continue + } + + if _, ok := set[a]; !ok { + set[a] = struct{}{} + result = append(result, v) + } + } + + return +} + +func cloneStringMap(source map[string]string) map[string]string { + res := make(map[string]string, len(source)) + for k, v := range source { + res[k] = v + } + + return res +} + +func cloneEnumMap(source map[string][]interface{}) map[string][]interface{} { + res := make(map[string][]interface{}, len(source)) + for k, v := range source { + res[k] = v + } + + return res +} + +// ParameterPatterns returns all the patterns found in parameters +// the map is cloned to avoid accidental changes +func (s *Spec) ParameterPatterns() map[string]string { + return cloneStringMap(s.patterns.parameters) +} + +// HeaderPatterns returns all the patterns found in response headers +// the map is cloned to avoid accidental changes +func (s *Spec) HeaderPatterns() map[string]string { + return cloneStringMap(s.patterns.headers) +} + +// ItemsPatterns returns all the patterns found in simple array items +// the map is cloned to avoid accidental changes +func (s *Spec) ItemsPatterns() map[string]string { + return cloneStringMap(s.patterns.items) +} + +// SchemaPatterns returns all the patterns found in schemas +// the map is cloned to avoid accidental changes +func (s *Spec) SchemaPatterns() map[string]string { + return cloneStringMap(s.patterns.schemas) +} + +// AllPatterns returns all the patterns found in the spec +// the map is cloned to avoid accidental changes +func (s *Spec) AllPatterns() map[string]string { + return cloneStringMap(s.patterns.allPatterns) +} + +// ParameterEnums returns all the enums found in parameters +// the map is cloned to avoid accidental changes +func (s *Spec) ParameterEnums() map[string][]interface{} { + return cloneEnumMap(s.enums.parameters) +} + +// HeaderEnums returns all the enums found in response headers +// the map is cloned to avoid accidental changes +func (s *Spec) HeaderEnums() map[string][]interface{} { + return cloneEnumMap(s.enums.headers) +} + +// ItemsEnums returns all the enums found in simple array items +// the map is cloned to avoid accidental changes +func (s *Spec) ItemsEnums() map[string][]interface{} { + return cloneEnumMap(s.enums.items) +} + +// SchemaEnums returns all the enums found in schemas +// the map is cloned to avoid accidental changes +func (s *Spec) SchemaEnums() map[string][]interface{} { + return cloneEnumMap(s.enums.schemas) +} + +// AllEnums returns all the enums found in the spec +// the map is cloned to avoid accidental changes +func (s *Spec) AllEnums() map[string][]interface{} { + return cloneEnumMap(s.enums.allEnums) +} diff --git a/vendor/github.com/go-openapi/analysis/debug.go b/vendor/github.com/go-openapi/analysis/debug.go new file mode 100644 index 0000000..33c1570 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/debug.go @@ -0,0 +1,23 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package analysis + +import ( + "os" + + "github.com/go-openapi/analysis/internal/debug" +) + +var debugLog = debug.GetLogger("analysis", os.Getenv("SWAGGER_DEBUG") != "") diff --git a/vendor/github.com/go-openapi/analysis/doc.go b/vendor/github.com/go-openapi/analysis/doc.go new file mode 100644 index 0000000..e8d9f9b --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/doc.go @@ -0,0 +1,43 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package analysis provides methods to work with a Swagger specification document from +package go-openapi/spec. + +## Analyzing a specification + +An analysed specification object (type Spec) provides methods to work with swagger definition. + +## Flattening or expanding a specification + +Flattening a specification bundles all remote $ref in the main spec document. +Depending on flattening options, additional preprocessing may take place: + - full flattening: replacing all inline complex constructs by a named entry in #/definitions + - expand: replace all $ref's in the document by their expanded content + +## Merging several specifications + +Mixin several specifications merges all Swagger constructs, and warns about found conflicts. + +## Fixing a specification + +Unmarshalling a specification with golang json unmarshalling may lead to +some unwanted result on present but empty fields. + +## Analyzing a Swagger schema + +Swagger schemas are analyzed to determine their complexity and qualify their content. +*/ +package analysis diff --git a/vendor/github.com/go-openapi/analysis/fixer.go b/vendor/github.com/go-openapi/analysis/fixer.go new file mode 100644 index 0000000..7c2ca08 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/fixer.go @@ -0,0 +1,79 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package analysis + +import "github.com/go-openapi/spec" + +// FixEmptyResponseDescriptions replaces empty ("") response +// descriptions in the input with "(empty)" to ensure that the +// resulting Swagger is stays valid. The problem appears to arise +// from reading in valid specs that have a explicit response +// description of "" (valid, response.description is required), but +// due to zero values being omitted upon re-serializing (omitempty) we +// lose them unless we stick some chars in there. +func FixEmptyResponseDescriptions(s *spec.Swagger) { + for k, v := range s.Responses { + FixEmptyDesc(&v) //#nosec + s.Responses[k] = v + } + + if s.Paths == nil { + return + } + + for _, v := range s.Paths.Paths { + if v.Get != nil { + FixEmptyDescs(v.Get.Responses) + } + if v.Put != nil { + FixEmptyDescs(v.Put.Responses) + } + if v.Post != nil { + FixEmptyDescs(v.Post.Responses) + } + if v.Delete != nil { + FixEmptyDescs(v.Delete.Responses) + } + if v.Options != nil { + FixEmptyDescs(v.Options.Responses) + } + if v.Head != nil { + FixEmptyDescs(v.Head.Responses) + } + if v.Patch != nil { + FixEmptyDescs(v.Patch.Responses) + } + } +} + +// FixEmptyDescs adds "(empty)" as the description for any Response in +// the given Responses object that doesn't already have one. +func FixEmptyDescs(rs *spec.Responses) { + FixEmptyDesc(rs.Default) + for k, v := range rs.StatusCodeResponses { + FixEmptyDesc(&v) //#nosec + rs.StatusCodeResponses[k] = v + } +} + +// FixEmptyDesc adds "(empty)" as the description to the given +// Response object if it doesn't already have one and isn't a +// ref. No-op on nil input. +func FixEmptyDesc(rs *spec.Response) { + if rs == nil || rs.Description != "" || rs.Ref.Ref.GetURL() != nil { + return + } + rs.Description = "(empty)" +} diff --git a/vendor/github.com/go-openapi/analysis/flatten.go b/vendor/github.com/go-openapi/analysis/flatten.go new file mode 100644 index 0000000..ebedcc9 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/flatten.go @@ -0,0 +1,814 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package analysis + +import ( + "fmt" + "log" + "path" + "sort" + "strings" + + "github.com/go-openapi/analysis/internal/flatten/normalize" + "github.com/go-openapi/analysis/internal/flatten/operations" + "github.com/go-openapi/analysis/internal/flatten/replace" + "github.com/go-openapi/analysis/internal/flatten/schutils" + "github.com/go-openapi/analysis/internal/flatten/sortref" + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/spec" +) + +const definitionsPath = "#/definitions" + +// newRef stores information about refs created during the flattening process +type newRef struct { + key string + newName string + path string + isOAIGen bool + resolved bool + schema *spec.Schema + parents []string +} + +// context stores intermediary results from flatten +type context struct { + newRefs map[string]*newRef + warnings []string + resolved map[string]string +} + +func newContext() *context { + return &context{ + newRefs: make(map[string]*newRef, 150), + warnings: make([]string, 0), + resolved: make(map[string]string, 50), + } +} + +// Flatten an analyzed spec and produce a self-contained spec bundle. +// +// There is a minimal and a full flattening mode. +// +// Minimally flattening a spec means: +// - Expanding parameters, responses, path items, parameter items and header items (references to schemas are left +// unscathed) +// - Importing external (http, file) references so they become internal to the document +// - Moving every JSON pointer to a $ref to a named definition (i.e. the reworked spec does not contain pointers +// like "$ref": "#/definitions/myObject/allOfs/1") +// +// A minimally flattened spec thus guarantees the following properties: +// - all $refs point to a local definition (i.e. '#/definitions/...') +// - definitions are unique +// +// NOTE: arbitrary JSON pointers (other than $refs to top level definitions) are rewritten as definitions if they +// represent a complex schema or express commonality in the spec. +// Otherwise, they are simply expanded. +// Self-referencing JSON pointers cannot resolve to a type and trigger an error. +// +// Minimal flattening is necessary and sufficient for codegen rendering using go-swagger. +// +// Fully flattening a spec means: +// - Moving every complex inline schema to be a definition with an auto-generated name in a depth-first fashion. +// +// By complex, we mean every JSON object with some properties. +// Arrays, when they do not define a tuple, +// or empty objects with or without additionalProperties, are not considered complex and remain inline. +// +// NOTE: rewritten schemas get a vendor extension x-go-gen-location so we know from which part of the spec definitions +// have been created. +// +// Available flattening options: +// - Minimal: stops flattening after minimal $ref processing, leaving schema constructs untouched +// - Expand: expand all $ref's in the document (inoperant if Minimal set to true) +// - Verbose: croaks about name conflicts detected +// - RemoveUnused: removes unused parameters, responses and definitions after expansion/flattening +// +// NOTE: expansion removes all $ref save circular $ref, which remain in place +// +// TODO: additional options +// - ProgagateNameExtensions: ensure that created entries properly follow naming rules when their parent have set a +// x-go-name extension +// - LiftAllOfs: +// - limit the flattening of allOf members when simple objects +// - merge allOf with validation only +// - merge allOf with extensions only +// - ... +func Flatten(opts FlattenOpts) error { + debugLog("FlattenOpts: %#v", opts) + + opts.flattenContext = newContext() + + // 1. Recursively expand responses, parameters, path items and items in simple schemas. + // + // This simplifies the spec and leaves only the $ref's in schema objects. + if err := expand(&opts); err != nil { + return err + } + + // 2. Strip the current document from absolute $ref's that actually a in the root, + // so we can recognize them as proper definitions + // + // In particular, this works around issue go-openapi/spec#76: leading absolute file in $ref is stripped + if err := normalizeRef(&opts); err != nil { + return err + } + + // 3. Optionally remove shared parameters and responses already expanded (now unused). + // + // Operation parameters (i.e. under paths) remain. + if opts.RemoveUnused { + removeUnusedShared(&opts) + } + + // 4. Import all remote references. + if err := importReferences(&opts); err != nil { + return err + } + + // 5. full flattening: rewrite inline schemas (schemas that aren't simple types or arrays or maps) + if !opts.Minimal && !opts.Expand { + if err := nameInlinedSchemas(&opts); err != nil { + return err + } + } + + // 6. Rewrite JSON pointers other than $ref to named definitions + // and attempt to resolve conflicting names whenever possible. + if err := stripPointersAndOAIGen(&opts); err != nil { + return err + } + + // 7. Strip the spec from unused definitions + if opts.RemoveUnused { + removeUnused(&opts) + } + + // 8. Issue warning notifications, if any + opts.croak() + + // TODO: simplify known schema patterns to flat objects with properties + // examples: + // - lift simple allOf object, + // - empty allOf with validation only or extensions only + // - rework allOf arrays + // - rework allOf additionalProperties + + return nil +} + +func expand(opts *FlattenOpts) error { + if err := spec.ExpandSpec(opts.Swagger(), opts.ExpandOpts(!opts.Expand)); err != nil { + return err + } + + opts.Spec.reload() // re-analyze + + return nil +} + +// normalizeRef strips the current file from any absolute file $ref. This works around issue go-openapi/spec#76: +// leading absolute file in $ref is stripped +func normalizeRef(opts *FlattenOpts) error { + debugLog("normalizeRef") + + altered := false + for k, w := range opts.Spec.references.allRefs { + if !strings.HasPrefix(w.String(), opts.BasePath+definitionsPath) { // may be a mix of / and \, depending on OS + continue + } + + altered = true + debugLog("stripping absolute path for: %s", w.String()) + + // strip the base path from definition + if err := replace.UpdateRef(opts.Swagger(), k, + spec.MustCreateRef(path.Join(definitionsPath, path.Base(w.String())))); err != nil { + return err + } + } + + if altered { + opts.Spec.reload() // re-analyze + } + + return nil +} + +func removeUnusedShared(opts *FlattenOpts) { + opts.Swagger().Parameters = nil + opts.Swagger().Responses = nil + + opts.Spec.reload() // re-analyze +} + +func importReferences(opts *FlattenOpts) error { + var ( + imported bool + err error + ) + + for !imported && err == nil { + // iteratively import remote references until none left. + // This inlining deals with name conflicts by introducing auto-generated names ("OAIGen") + imported, err = importExternalReferences(opts) + + opts.Spec.reload() // re-analyze + } + + return err +} + +// nameInlinedSchemas replaces every complex inline construct by a named definition. +func nameInlinedSchemas(opts *FlattenOpts) error { + debugLog("nameInlinedSchemas") + + namer := &InlineSchemaNamer{ + Spec: opts.Swagger(), + Operations: operations.AllOpRefsByRef(opts.Spec, nil), + flattenContext: opts.flattenContext, + opts: opts, + } + + depthFirst := sortref.DepthFirst(opts.Spec.allSchemas) + for _, key := range depthFirst { + sch := opts.Spec.allSchemas[key] + if sch.Schema == nil || sch.Schema.Ref.String() != "" || sch.TopLevel { + continue + } + + asch, err := Schema(SchemaOpts{Schema: sch.Schema, Root: opts.Swagger(), BasePath: opts.BasePath}) + if err != nil { + return fmt.Errorf("schema analysis [%s]: %w", key, err) + } + + if asch.isAnalyzedAsComplex() { // move complex schemas to definitions + if err := namer.Name(key, sch.Schema, asch); err != nil { + return err + } + } + } + + opts.Spec.reload() // re-analyze + + return nil +} + +func removeUnused(opts *FlattenOpts) { + for removeUnusedSinglePass(opts) { + // continue until no unused definition remains + } +} + +func removeUnusedSinglePass(opts *FlattenOpts) (hasRemoved bool) { + expected := make(map[string]struct{}) + for k := range opts.Swagger().Definitions { + expected[path.Join(definitionsPath, jsonpointer.Escape(k))] = struct{}{} + } + + for _, k := range opts.Spec.AllDefinitionReferences() { + delete(expected, k) + } + + for k := range expected { + hasRemoved = true + debugLog("removing unused definition %s", path.Base(k)) + if opts.Verbose { + log.Printf("info: removing unused definition: %s", path.Base(k)) + } + delete(opts.Swagger().Definitions, path.Base(k)) + } + + opts.Spec.reload() // re-analyze + + return hasRemoved +} + +func importKnownRef(entry sortref.RefRevIdx, refStr, newName string, opts *FlattenOpts) error { + // rewrite ref with already resolved external ref (useful for cyclical refs): + // rewrite external refs to local ones + debugLog("resolving known ref [%s] to %s", refStr, newName) + + for _, key := range entry.Keys { + if err := replace.UpdateRef(opts.Swagger(), key, spec.MustCreateRef(path.Join(definitionsPath, newName))); err != nil { + return err + } + } + + return nil +} + +func importNewRef(entry sortref.RefRevIdx, refStr string, opts *FlattenOpts) error { + var ( + isOAIGen bool + newName string + ) + + debugLog("resolving schema from remote $ref [%s]", refStr) + + sch, err := spec.ResolveRefWithBase(opts.Swagger(), &entry.Ref, opts.ExpandOpts(false)) + if err != nil { + return fmt.Errorf("could not resolve schema: %w", err) + } + + // at this stage only $ref analysis matters + partialAnalyzer := &Spec{ + references: referenceAnalysis{}, + patterns: patternAnalysis{}, + enums: enumAnalysis{}, + } + partialAnalyzer.reset() + partialAnalyzer.analyzeSchema("", sch, "/") + + // now rewrite those refs with rebase + for key, ref := range partialAnalyzer.references.allRefs { + if err := replace.UpdateRef(sch, key, spec.MustCreateRef(normalize.RebaseRef(entry.Ref.String(), ref.String()))); err != nil { + return fmt.Errorf("failed to rewrite ref for key %q at %s: %w", key, entry.Ref.String(), err) + } + } + + // generate a unique name - isOAIGen means that a naming conflict was resolved by changing the name + newName, isOAIGen = uniqifyName(opts.Swagger().Definitions, nameFromRef(entry.Ref, opts)) + debugLog("new name for [%s]: %s - with name conflict:%t", strings.Join(entry.Keys, ", "), newName, isOAIGen) + + opts.flattenContext.resolved[refStr] = newName + + // rewrite the external refs to local ones + for _, key := range entry.Keys { + if err := replace.UpdateRef(opts.Swagger(), key, + spec.MustCreateRef(path.Join(definitionsPath, newName))); err != nil { + return err + } + + // keep track of created refs + resolved := false + if _, ok := opts.flattenContext.newRefs[key]; ok { + resolved = opts.flattenContext.newRefs[key].resolved + } + + debugLog("keeping track of ref: %s (%s), resolved: %t", key, newName, resolved) + opts.flattenContext.newRefs[key] = &newRef{ + key: key, + newName: newName, + path: path.Join(definitionsPath, newName), + isOAIGen: isOAIGen, + resolved: resolved, + schema: sch, + } + } + + // add the resolved schema to the definitions + schutils.Save(opts.Swagger(), newName, sch) + + return nil +} + +// importExternalReferences iteratively digs remote references and imports them into the main schema. +// +// At every iteration, new remotes may be found when digging deeper: they are rebased to the current schema before being imported. +// +// This returns true when no more remote references can be found. +func importExternalReferences(opts *FlattenOpts) (bool, error) { + debugLog("importExternalReferences") + + groupedRefs := sortref.ReverseIndex(opts.Spec.references.schemas, opts.BasePath) + sortedRefStr := make([]string, 0, len(groupedRefs)) + if opts.flattenContext == nil { + opts.flattenContext = newContext() + } + + // sort $ref resolution to ensure deterministic name conflict resolution + for refStr := range groupedRefs { + sortedRefStr = append(sortedRefStr, refStr) + } + sort.Strings(sortedRefStr) + + complete := true + + for _, refStr := range sortedRefStr { + entry := groupedRefs[refStr] + if entry.Ref.HasFragmentOnly { + continue + } + + complete = false + + newName := opts.flattenContext.resolved[refStr] + if newName != "" { + if err := importKnownRef(entry, refStr, newName, opts); err != nil { + return false, err + } + + continue + } + + // resolve schemas + if err := importNewRef(entry, refStr, opts); err != nil { + return false, err + } + } + + // maintains ref index entries + for k := range opts.flattenContext.newRefs { + r := opts.flattenContext.newRefs[k] + + // update tracking with resolved schemas + if r.schema.Ref.String() != "" { + ref := spec.MustCreateRef(r.path) + sch, err := spec.ResolveRefWithBase(opts.Swagger(), &ref, opts.ExpandOpts(false)) + if err != nil { + return false, fmt.Errorf("could not resolve schema: %w", err) + } + + r.schema = sch + } + + if r.path == k { + continue + } + + // update tracking with renamed keys: got a cascade of refs + renamed := *r + renamed.key = r.path + opts.flattenContext.newRefs[renamed.path] = &renamed + + // indirect ref + r.newName = path.Base(k) + r.schema = spec.RefSchema(r.path) + r.path = k + r.isOAIGen = strings.Contains(k, "OAIGen") + } + + return complete, nil +} + +// stripPointersAndOAIGen removes anonymous JSON pointers from spec and chain with name conflicts handler. +// This loops until the spec has no such pointer and all name conflicts have been reduced as much as possible. +func stripPointersAndOAIGen(opts *FlattenOpts) error { + // name all JSON pointers to anonymous documents + if err := namePointers(opts); err != nil { + return err + } + + // remove unnecessary OAIGen ref (created when flattening external refs creates name conflicts) + hasIntroducedPointerOrInline, ers := stripOAIGen(opts) + if ers != nil { + return ers + } + + // iterate as pointer or OAIGen resolution may introduce inline schemas or pointers + for hasIntroducedPointerOrInline { + if !opts.Minimal { + opts.Spec.reload() // re-analyze + if err := nameInlinedSchemas(opts); err != nil { + return err + } + } + + if err := namePointers(opts); err != nil { + return err + } + + // restrip and re-analyze + var err error + if hasIntroducedPointerOrInline, err = stripOAIGen(opts); err != nil { + return err + } + } + + return nil +} + +// stripOAIGen strips the spec from unnecessary OAIGen constructs, initially created to dedupe flattened definitions. +// +// A dedupe is deemed unnecessary whenever: +// - the only conflict is with its (single) parent: OAIGen is merged into its parent (reinlining) +// - there is a conflict with multiple parents: merge OAIGen in first parent, the rewrite other parents to point to +// the first parent. +// +// This function returns true whenever it re-inlined a complex schema, so the caller may chose to iterate +// pointer and name resolution again. +func stripOAIGen(opts *FlattenOpts) (bool, error) { + debugLog("stripOAIGen") + replacedWithComplex := false + + // figure out referers of OAIGen definitions (doing it before the ref start mutating) + for _, r := range opts.flattenContext.newRefs { + updateRefParents(opts.Spec.references.allRefs, r) + } + + for k := range opts.flattenContext.newRefs { + r := opts.flattenContext.newRefs[k] + debugLog("newRefs[%s]: isOAIGen: %t, resolved: %t, name: %s, path:%s, #parents: %d, parents: %v, ref: %s", + k, r.isOAIGen, r.resolved, r.newName, r.path, len(r.parents), r.parents, r.schema.Ref.String()) + + if !r.isOAIGen || len(r.parents) == 0 { + continue + } + + hasReplacedWithComplex, err := stripOAIGenForRef(opts, k, r) + if err != nil { + return replacedWithComplex, err + } + + replacedWithComplex = replacedWithComplex || hasReplacedWithComplex + } + + debugLog("replacedWithComplex: %t", replacedWithComplex) + opts.Spec.reload() // re-analyze + + return replacedWithComplex, nil +} + +// updateRefParents updates all parents of an updated $ref +func updateRefParents(allRefs map[string]spec.Ref, r *newRef) { + if !r.isOAIGen || r.resolved { // bail on already resolved entries (avoid looping) + return + } + for k, v := range allRefs { + if r.path != v.String() { + continue + } + + found := false + for _, p := range r.parents { + if p == k { + found = true + + break + } + } + if !found { + r.parents = append(r.parents, k) + } + } +} + +func stripOAIGenForRef(opts *FlattenOpts, k string, r *newRef) (bool, error) { + replacedWithComplex := false + + pr := sortref.TopmostFirst(r.parents) + + // rewrite first parent schema in hierarchical then lexicographical order + debugLog("rewrite first parent %s with schema", pr[0]) + if err := replace.UpdateRefWithSchema(opts.Swagger(), pr[0], r.schema); err != nil { + return false, err + } + + if pa, ok := opts.flattenContext.newRefs[pr[0]]; ok && pa.isOAIGen { + // update parent in ref index entry + debugLog("update parent entry: %s", pr[0]) + pa.schema = r.schema + pa.resolved = false + replacedWithComplex = true + } + + // rewrite other parents to point to first parent + if len(pr) > 1 { + for _, p := range pr[1:] { + replacingRef := spec.MustCreateRef(pr[0]) + + // set complex when replacing ref is an anonymous jsonpointer: further processing may be required + replacedWithComplex = replacedWithComplex || path.Dir(replacingRef.String()) != definitionsPath + debugLog("rewrite parent with ref: %s", replacingRef.String()) + + // NOTE: it is possible at this stage to introduce json pointers (to non-definitions places). + // Those are stripped later on. + if err := replace.UpdateRef(opts.Swagger(), p, replacingRef); err != nil { + return false, err + } + + if pa, ok := opts.flattenContext.newRefs[p]; ok && pa.isOAIGen { + // update parent in ref index + debugLog("update parent entry: %s", p) + pa.schema = r.schema + pa.resolved = false + replacedWithComplex = true + } + } + } + + // remove OAIGen definition + debugLog("removing definition %s", path.Base(r.path)) + delete(opts.Swagger().Definitions, path.Base(r.path)) + + // propagate changes in ref index for keys which have this one as a parent + for kk, value := range opts.flattenContext.newRefs { + if kk == k || !value.isOAIGen || value.resolved { + continue + } + + found := false + newParents := make([]string, 0, len(value.parents)) + for _, parent := range value.parents { + switch { + case parent == r.path: + found = true + parent = pr[0] + case strings.HasPrefix(parent, r.path+"/"): + found = true + parent = path.Join(pr[0], strings.TrimPrefix(parent, r.path)) + } + + newParents = append(newParents, parent) + } + + if found { + value.parents = newParents + } + } + + // mark naming conflict as resolved + debugLog("marking naming conflict resolved for key: %s", r.key) + opts.flattenContext.newRefs[r.key].isOAIGen = false + opts.flattenContext.newRefs[r.key].resolved = true + + // determine if the previous substitution did inline a complex schema + if r.schema != nil && r.schema.Ref.String() == "" { // inline schema + asch, err := Schema(SchemaOpts{Schema: r.schema, Root: opts.Swagger(), BasePath: opts.BasePath}) + if err != nil { + return false, err + } + + debugLog("re-inlined schema: parent: %s, %t", pr[0], asch.isAnalyzedAsComplex()) + replacedWithComplex = replacedWithComplex || !(path.Dir(pr[0]) == definitionsPath) && asch.isAnalyzedAsComplex() + } + + return replacedWithComplex, nil +} + +// namePointers replaces all JSON pointers to anonymous documents by a $ref to a new named definitions. +// +// This is carried on depth-first. Pointers to $refs which are top level definitions are replaced by the $ref itself. +// Pointers to simple types are expanded, unless they express commonality (i.e. several such $ref are used). +func namePointers(opts *FlattenOpts) error { + debugLog("name pointers") + + refsToReplace := make(map[string]SchemaRef, len(opts.Spec.references.schemas)) + for k, ref := range opts.Spec.references.allRefs { + debugLog("name pointers: %q => %#v", k, ref) + if path.Dir(ref.String()) == definitionsPath { + // this a ref to a top-level definition: ok + continue + } + + result, err := replace.DeepestRef(opts.Swagger(), opts.ExpandOpts(false), ref) + if err != nil { + return fmt.Errorf("at %s, %w", k, err) + } + + replacingRef := result.Ref + sch := result.Schema + if opts.flattenContext != nil { + opts.flattenContext.warnings = append(opts.flattenContext.warnings, result.Warnings...) + } + + debugLog("planning pointer to replace at %s: %s, resolved to: %s", k, ref.String(), replacingRef.String()) + refsToReplace[k] = SchemaRef{ + Name: k, // caller + Ref: replacingRef, // called + Schema: sch, + TopLevel: path.Dir(replacingRef.String()) == definitionsPath, + } + } + + depthFirst := sortref.DepthFirst(refsToReplace) + namer := &InlineSchemaNamer{ + Spec: opts.Swagger(), + Operations: operations.AllOpRefsByRef(opts.Spec, nil), + flattenContext: opts.flattenContext, + opts: opts, + } + + for _, key := range depthFirst { + v := refsToReplace[key] + // update current replacement, which may have been updated by previous changes of deeper elements + result, erd := replace.DeepestRef(opts.Swagger(), opts.ExpandOpts(false), v.Ref) + if erd != nil { + return fmt.Errorf("at %s, %w", key, erd) + } + + if opts.flattenContext != nil { + opts.flattenContext.warnings = append(opts.flattenContext.warnings, result.Warnings...) + } + + v.Ref = result.Ref + v.Schema = result.Schema + v.TopLevel = path.Dir(result.Ref.String()) == definitionsPath + debugLog("replacing pointer at %s: resolved to: %s", key, v.Ref.String()) + + if v.TopLevel { + debugLog("replace pointer %s by canonical definition: %s", key, v.Ref.String()) + + // if the schema is a $ref to a top level definition, just rewrite the pointer to this $ref + if err := replace.UpdateRef(opts.Swagger(), key, v.Ref); err != nil { + return err + } + + continue + } + + if err := flattenAnonPointer(key, v, refsToReplace, namer, opts); err != nil { + return err + } + } + + opts.Spec.reload() // re-analyze + + return nil +} + +func flattenAnonPointer(key string, v SchemaRef, refsToReplace map[string]SchemaRef, namer *InlineSchemaNamer, opts *FlattenOpts) error { + // this is a JSON pointer to an anonymous document (internal or external): + // create a definition for this schema when: + // - it is a complex schema + // - or it is pointed by more than one $ref (i.e. expresses commonality) + // otherwise, expand the pointer (single reference to a simple type) + // + // The named definition for this follows the target's key, not the caller's + debugLog("namePointers at %s for %s", key, v.Ref.String()) + + // qualify the expanded schema + asch, ers := Schema(SchemaOpts{Schema: v.Schema, Root: opts.Swagger(), BasePath: opts.BasePath}) + if ers != nil { + return fmt.Errorf("schema analysis [%s]: %w", key, ers) + } + callers := make([]string, 0, 64) + + debugLog("looking for callers") + + an := New(opts.Swagger()) + for k, w := range an.references.allRefs { + r, err := replace.DeepestRef(opts.Swagger(), opts.ExpandOpts(false), w) + if err != nil { + return fmt.Errorf("at %s, %w", key, err) + } + + if opts.flattenContext != nil { + opts.flattenContext.warnings = append(opts.flattenContext.warnings, r.Warnings...) + } + + if r.Ref.String() == v.Ref.String() { + callers = append(callers, k) + } + } + + debugLog("callers for %s: %d", v.Ref.String(), len(callers)) + if len(callers) == 0 { + // has already been updated and resolved + return nil + } + + parts := sortref.KeyParts(v.Ref.String()) + debugLog("number of callers for %s: %d", v.Ref.String(), len(callers)) + + // identifying edge case when the namer did nothing because we point to a non-schema object + // no definition is created and we expand the $ref for all callers + debugLog("decide what to do with the schema pointed to: asch.IsSimpleSchema=%t, len(callers)=%d, parts.IsSharedParam=%t, parts.IsSharedResponse=%t", + asch.IsSimpleSchema, len(callers), parts.IsSharedParam(), parts.IsSharedResponse(), + ) + + if (!asch.IsSimpleSchema || len(callers) > 1) && !parts.IsSharedParam() && !parts.IsSharedResponse() { + debugLog("replace JSON pointer at [%s] by definition: %s", key, v.Ref.String()) + if err := namer.Name(v.Ref.String(), v.Schema, asch); err != nil { + return err + } + + // regular case: we named the $ref as a definition, and we move all callers to this new $ref + for _, caller := range callers { + if caller == key { + continue + } + + // move $ref for next to resolve + debugLog("identified caller of %s at [%s]", v.Ref.String(), caller) + c := refsToReplace[caller] + c.Ref = v.Ref + refsToReplace[caller] = c + } + + return nil + } + + // everything that is a simple schema and not factorizable is expanded + debugLog("expand JSON pointer for key=%s", key) + + if err := replace.UpdateRefWithSchema(opts.Swagger(), key, v.Schema); err != nil { + return err + } + // NOTE: there is no other caller to update + + return nil +} diff --git a/vendor/github.com/go-openapi/analysis/flatten_name.go b/vendor/github.com/go-openapi/analysis/flatten_name.go new file mode 100644 index 0000000..c7d7938 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/flatten_name.go @@ -0,0 +1,308 @@ +package analysis + +import ( + "fmt" + "path" + "sort" + "strings" + + "github.com/go-openapi/analysis/internal/flatten/operations" + "github.com/go-openapi/analysis/internal/flatten/replace" + "github.com/go-openapi/analysis/internal/flatten/schutils" + "github.com/go-openapi/analysis/internal/flatten/sortref" + "github.com/go-openapi/spec" + "github.com/go-openapi/swag" +) + +// InlineSchemaNamer finds a new name for an inlined type +type InlineSchemaNamer struct { + Spec *spec.Swagger + Operations map[string]operations.OpRef + flattenContext *context + opts *FlattenOpts +} + +// Name yields a new name for the inline schema +func (isn *InlineSchemaNamer) Name(key string, schema *spec.Schema, aschema *AnalyzedSchema) error { + debugLog("naming inlined schema at %s", key) + + parts := sortref.KeyParts(key) + for _, name := range namesFromKey(parts, aschema, isn.Operations) { + if name == "" { + continue + } + + // create unique name + mangle := mangler(isn.opts) + newName, isOAIGen := uniqifyName(isn.Spec.Definitions, mangle(name)) + + // clone schema + sch := schutils.Clone(schema) + + // replace values on schema + debugLog("rewriting schema to ref: key=%s with new name: %s", key, newName) + if err := replace.RewriteSchemaToRef(isn.Spec, key, + spec.MustCreateRef(path.Join(definitionsPath, newName))); err != nil { + return fmt.Errorf("error while creating definition %q from inline schema: %w", newName, err) + } + + // rewrite any dependent $ref pointing to this place, + // when not already pointing to a top-level definition. + // + // NOTE: this is important if such referers use arbitrary JSON pointers. + an := New(isn.Spec) + for k, v := range an.references.allRefs { + r, erd := replace.DeepestRef(isn.opts.Swagger(), isn.opts.ExpandOpts(false), v) + if erd != nil { + return fmt.Errorf("at %s, %w", k, erd) + } + + if isn.opts.flattenContext != nil { + isn.opts.flattenContext.warnings = append(isn.opts.flattenContext.warnings, r.Warnings...) + } + + if r.Ref.String() != key && (r.Ref.String() != path.Join(definitionsPath, newName) || path.Dir(v.String()) == definitionsPath) { + continue + } + + debugLog("found a $ref to a rewritten schema: %s points to %s", k, v.String()) + + // rewrite $ref to the new target + if err := replace.UpdateRef(isn.Spec, k, + spec.MustCreateRef(path.Join(definitionsPath, newName))); err != nil { + return err + } + } + + // NOTE: this extension is currently not used by go-swagger (provided for information only) + sch.AddExtension("x-go-gen-location", GenLocation(parts)) + + // save cloned schema to definitions + schutils.Save(isn.Spec, newName, sch) + + // keep track of created refs + if isn.flattenContext == nil { + continue + } + + debugLog("track created ref: key=%s, newName=%s, isOAIGen=%t", key, newName, isOAIGen) + resolved := false + + if _, ok := isn.flattenContext.newRefs[key]; ok { + resolved = isn.flattenContext.newRefs[key].resolved + } + + isn.flattenContext.newRefs[key] = &newRef{ + key: key, + newName: newName, + path: path.Join(definitionsPath, newName), + isOAIGen: isOAIGen, + resolved: resolved, + schema: sch, + } + } + + return nil +} + +// uniqifyName yields a unique name for a definition +func uniqifyName(definitions spec.Definitions, name string) (string, bool) { + isOAIGen := false + if name == "" { + name = "oaiGen" + isOAIGen = true + } + + if len(definitions) == 0 { + return name, isOAIGen + } + + unq := true + for k := range definitions { + if strings.EqualFold(k, name) { + unq = false + + break + } + } + + if unq { + return name, isOAIGen + } + + name += "OAIGen" + isOAIGen = true + var idx int + unique := name + _, known := definitions[unique] + + for known { + idx++ + unique = fmt.Sprintf("%s%d", name, idx) + _, known = definitions[unique] + } + + return unique, isOAIGen +} + +func namesFromKey(parts sortref.SplitKey, aschema *AnalyzedSchema, operations map[string]operations.OpRef) []string { + var ( + baseNames [][]string + startIndex int + ) + + switch { + case parts.IsOperation(): + baseNames, startIndex = namesForOperation(parts, operations) + case parts.IsDefinition(): + baseNames, startIndex = namesForDefinition(parts) + default: + // this a non-standard pointer: build a name by concatenating its parts + baseNames = [][]string{parts} + startIndex = len(baseNames) + 1 + } + + result := make([]string, 0, len(baseNames)) + for _, segments := range baseNames { + nm := parts.BuildName(segments, startIndex, partAdder(aschema)) + if nm == "" { + continue + } + + result = append(result, nm) + } + sort.Strings(result) + + debugLog("names from parts: %v => %v", parts, result) + return result +} + +func namesForParam(parts sortref.SplitKey, operations map[string]operations.OpRef) ([][]string, int) { + var ( + baseNames [][]string + startIndex int + ) + + piref := parts.PathItemRef() + if piref.String() != "" && parts.IsOperationParam() { + if op, ok := operations[piref.String()]; ok { + startIndex = 5 + baseNames = append(baseNames, []string{op.ID, "params", "body"}) + } + } else if parts.IsSharedOperationParam() { + pref := parts.PathRef() + for k, v := range operations { + if strings.HasPrefix(k, pref.String()) { + startIndex = 4 + baseNames = append(baseNames, []string{v.ID, "params", "body"}) + } + } + } + + return baseNames, startIndex +} + +func namesForOperation(parts sortref.SplitKey, operations map[string]operations.OpRef) ([][]string, int) { + var ( + baseNames [][]string + startIndex int + ) + + // params + if parts.IsOperationParam() || parts.IsSharedOperationParam() { + baseNames, startIndex = namesForParam(parts, operations) + } + + // responses + if parts.IsOperationResponse() { + piref := parts.PathItemRef() + if piref.String() != "" { + if op, ok := operations[piref.String()]; ok { + startIndex = 6 + baseNames = append(baseNames, []string{op.ID, parts.ResponseName(), "body"}) + } + } + } + + return baseNames, startIndex +} + +func namesForDefinition(parts sortref.SplitKey) ([][]string, int) { + nm := parts.DefinitionName() + if nm != "" { + return [][]string{{parts.DefinitionName()}}, 2 + } + + return [][]string{}, 0 +} + +// partAdder knows how to interpret a schema when it comes to build a name from parts +func partAdder(aschema *AnalyzedSchema) sortref.PartAdder { + return func(part string) []string { + segments := make([]string, 0, 2) + + if part == "items" || part == "additionalItems" { + if aschema.IsTuple || aschema.IsTupleWithExtra { + segments = append(segments, "tuple") + } else { + segments = append(segments, "items") + } + + if part == "additionalItems" { + segments = append(segments, part) + } + + return segments + } + + segments = append(segments, part) + + return segments + } +} + +func mangler(o *FlattenOpts) func(string) string { + if o.KeepNames { + return func(in string) string { return in } + } + + return swag.ToJSONName +} + +func nameFromRef(ref spec.Ref, o *FlattenOpts) string { + mangle := mangler(o) + + u := ref.GetURL() + if u.Fragment != "" { + return mangle(path.Base(u.Fragment)) + } + + if u.Path != "" { + bn := path.Base(u.Path) + if bn != "" && bn != "/" { + ext := path.Ext(bn) + if ext != "" { + return mangle(bn[:len(bn)-len(ext)]) + } + + return mangle(bn) + } + } + + return mangle(strings.ReplaceAll(u.Host, ".", " ")) +} + +// GenLocation indicates from which section of the specification (models or operations) a definition has been created. +// +// This is reflected in the output spec with a "x-go-gen-location" extension. At the moment, this is provided +// for information only. +func GenLocation(parts sortref.SplitKey) string { + switch { + case parts.IsOperation(): + return "operations" + case parts.IsDefinition(): + return "models" + default: + return "" + } +} diff --git a/vendor/github.com/go-openapi/analysis/flatten_options.go b/vendor/github.com/go-openapi/analysis/flatten_options.go new file mode 100644 index 0000000..c943fe1 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/flatten_options.go @@ -0,0 +1,79 @@ +package analysis + +import ( + "log" + + "github.com/go-openapi/spec" +) + +// FlattenOpts configuration for flattening a swagger specification. +// +// The BasePath parameter is used to locate remote relative $ref found in the specification. +// This path is a file: it points to the location of the root document and may be either a local +// file path or a URL. +// +// If none specified, relative references (e.g. "$ref": "folder/schema.yaml#/definitions/...") +// found in the spec are searched from the current working directory. +type FlattenOpts struct { + Spec *Spec // The analyzed spec to work with + flattenContext *context // Internal context to track flattening activity + + BasePath string // The location of the root document for this spec to resolve relative $ref + + // Flattening options + Expand bool // When true, skip flattening the spec and expand it instead (if Minimal is false) + Minimal bool // When true, do not decompose complex structures such as allOf + Verbose bool // enable some reporting on possible name conflicts detected + RemoveUnused bool // When true, remove unused parameters, responses and definitions after expansion/flattening + ContinueOnError bool // Continue when spec expansion issues are found + KeepNames bool // Do not attempt to jsonify names from references when flattening + + /* Extra keys */ + _ struct{} // require keys +} + +// ExpandOpts creates a spec.ExpandOptions to configure expanding a specification document. +func (f *FlattenOpts) ExpandOpts(skipSchemas bool) *spec.ExpandOptions { + return &spec.ExpandOptions{ + RelativeBase: f.BasePath, + SkipSchemas: skipSchemas, + ContinueOnError: f.ContinueOnError, + } +} + +// Swagger gets the swagger specification for this flatten operation +func (f *FlattenOpts) Swagger() *spec.Swagger { + return f.Spec.spec +} + +// croak logs notifications and warnings about valid, but possibly unwanted constructs resulting +// from flattening a spec +func (f *FlattenOpts) croak() { + if !f.Verbose { + return + } + + reported := make(map[string]bool, len(f.flattenContext.newRefs)) + for _, v := range f.Spec.references.allRefs { + // warns about duplicate handling + for _, r := range f.flattenContext.newRefs { + if r.isOAIGen && r.path == v.String() { + reported[r.newName] = true + } + } + } + + for k := range reported { + log.Printf("warning: duplicate flattened definition name resolved as %s", k) + } + + // warns about possible type mismatches + uniqueMsg := make(map[string]bool) + for _, msg := range f.flattenContext.warnings { + if _, ok := uniqueMsg[msg]; ok { + continue + } + log.Printf("warning: %s", msg) + uniqueMsg[msg] = true + } +} diff --git a/vendor/github.com/go-openapi/analysis/internal/debug/debug.go b/vendor/github.com/go-openapi/analysis/internal/debug/debug.go new file mode 100644 index 0000000..39f55a9 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/internal/debug/debug.go @@ -0,0 +1,41 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package debug + +import ( + "fmt" + "log" + "os" + "path/filepath" + "runtime" +) + +var ( + output = os.Stdout +) + +// GetLogger provides a prefix debug logger +func GetLogger(prefix string, debug bool) func(string, ...interface{}) { + if debug { + logger := log.New(output, prefix+":", log.LstdFlags) + + return func(msg string, args ...interface{}) { + _, file1, pos1, _ := runtime.Caller(1) + logger.Printf("%s:%d: %s", filepath.Base(file1), pos1, fmt.Sprintf(msg, args...)) + } + } + + return func(_ string, _ ...interface{}) {} +} diff --git a/vendor/github.com/go-openapi/analysis/internal/flatten/normalize/normalize.go b/vendor/github.com/go-openapi/analysis/internal/flatten/normalize/normalize.go new file mode 100644 index 0000000..8c9df05 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/internal/flatten/normalize/normalize.go @@ -0,0 +1,87 @@ +package normalize + +import ( + "net/url" + "path" + "path/filepath" + "strings" + + "github.com/go-openapi/spec" +) + +// RebaseRef rebases a remote ref relative to a base ref. +// +// NOTE: does not support JSONschema ID for $ref (we assume we are working with swagger specs here). +// +// NOTE(windows): +// * refs are assumed to have been normalized with drive letter lower cased (from go-openapi/spec) +// * "/ in paths may appear as escape sequences +func RebaseRef(baseRef string, ref string) string { + baseRef, _ = url.PathUnescape(baseRef) + ref, _ = url.PathUnescape(ref) + + if baseRef == "" || baseRef == "." || strings.HasPrefix(baseRef, "#") { + return ref + } + + parts := strings.Split(ref, "#") + + baseParts := strings.Split(baseRef, "#") + baseURL, _ := url.Parse(baseParts[0]) + if strings.HasPrefix(ref, "#") { + if baseURL.Host == "" { + return strings.Join([]string{baseParts[0], parts[1]}, "#") + } + + return strings.Join([]string{baseParts[0], parts[1]}, "#") + } + + refURL, _ := url.Parse(parts[0]) + if refURL.Host != "" || filepath.IsAbs(parts[0]) { + // not rebasing an absolute path + return ref + } + + // there is a relative path + var basePath string + if baseURL.Host != "" { + // when there is a host, standard URI rules apply (with "/") + baseURL.Path = path.Dir(baseURL.Path) + baseURL.Path = path.Join(baseURL.Path, "/"+parts[0]) + + return baseURL.String() + } + + // this is a local relative path + // basePart[0] and parts[0] are local filesystem directories/files + basePath = filepath.Dir(baseParts[0]) + relPath := filepath.Join(basePath, string(filepath.Separator)+parts[0]) + if len(parts) > 1 { + return strings.Join([]string{relPath, parts[1]}, "#") + } + + return relPath +} + +// Path renders absolute path on remote file refs +// +// NOTE(windows): +// * refs are assumed to have been normalized with drive letter lower cased (from go-openapi/spec) +// * "/ in paths may appear as escape sequences +func Path(ref spec.Ref, basePath string) string { + uri, _ := url.PathUnescape(ref.String()) + if ref.HasFragmentOnly || filepath.IsAbs(uri) { + return uri + } + + refURL, _ := url.Parse(uri) + if refURL.Host != "" { + return uri + } + + parts := strings.Split(uri, "#") + // BasePath, parts[0] are local filesystem directories, guaranteed to be absolute at this stage + parts[0] = filepath.Join(filepath.Dir(basePath), parts[0]) + + return strings.Join(parts, "#") +} diff --git a/vendor/github.com/go-openapi/analysis/internal/flatten/operations/operations.go b/vendor/github.com/go-openapi/analysis/internal/flatten/operations/operations.go new file mode 100644 index 0000000..7f3a2b8 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/internal/flatten/operations/operations.go @@ -0,0 +1,90 @@ +package operations + +import ( + "path" + "sort" + "strings" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/spec" + "github.com/go-openapi/swag" +) + +// AllOpRefsByRef returns an index of sortable operations +func AllOpRefsByRef(specDoc Provider, operationIDs []string) map[string]OpRef { + return OpRefsByRef(GatherOperations(specDoc, operationIDs)) +} + +// OpRefsByRef indexes a map of sortable operations +func OpRefsByRef(oprefs map[string]OpRef) map[string]OpRef { + result := make(map[string]OpRef, len(oprefs)) + for _, v := range oprefs { + result[v.Ref.String()] = v + } + + return result +} + +// OpRef is an indexable, sortable operation +type OpRef struct { + Method string + Path string + Key string + ID string + Op *spec.Operation + Ref spec.Ref +} + +// OpRefs is a sortable collection of operations +type OpRefs []OpRef + +func (o OpRefs) Len() int { return len(o) } +func (o OpRefs) Swap(i, j int) { o[i], o[j] = o[j], o[i] } +func (o OpRefs) Less(i, j int) bool { return o[i].Key < o[j].Key } + +// Provider knows how to collect operations from a spec +type Provider interface { + Operations() map[string]map[string]*spec.Operation +} + +// GatherOperations builds a map of sorted operations from a spec +func GatherOperations(specDoc Provider, operationIDs []string) map[string]OpRef { + var oprefs OpRefs + + for method, pathItem := range specDoc.Operations() { + for pth, operation := range pathItem { + vv := *operation + oprefs = append(oprefs, OpRef{ + Key: swag.ToGoName(strings.ToLower(method) + " " + pth), + Method: method, + Path: pth, + ID: vv.ID, + Op: &vv, + Ref: spec.MustCreateRef("#" + path.Join("/paths", jsonpointer.Escape(pth), method)), + }) + } + } + + sort.Sort(oprefs) + + operations := make(map[string]OpRef) + for _, opr := range oprefs { + nm := opr.ID + if nm == "" { + nm = opr.Key + } + + oo, found := operations[nm] + if found && oo.Method != opr.Method && oo.Path != opr.Path { + nm = opr.Key + } + + if len(operationIDs) == 0 || swag.ContainsStrings(operationIDs, opr.ID) || swag.ContainsStrings(operationIDs, nm) { + opr.ID = nm + opr.Op.ID = nm + operations[nm] = opr + } + } + + return operations +} diff --git a/vendor/github.com/go-openapi/analysis/internal/flatten/replace/replace.go b/vendor/github.com/go-openapi/analysis/internal/flatten/replace/replace.go new file mode 100644 index 0000000..c0f43e7 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/internal/flatten/replace/replace.go @@ -0,0 +1,458 @@ +package replace + +import ( + "encoding/json" + "fmt" + "net/url" + "os" + "path" + "strconv" + + "github.com/go-openapi/analysis/internal/debug" + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/spec" +) + +const definitionsPath = "#/definitions" + +var debugLog = debug.GetLogger("analysis/flatten/replace", os.Getenv("SWAGGER_DEBUG") != "") + +// RewriteSchemaToRef replaces a schema with a Ref +func RewriteSchemaToRef(sp *spec.Swagger, key string, ref spec.Ref) error { + debugLog("rewriting schema to ref for %s with %s", key, ref.String()) + _, value, err := getPointerFromKey(sp, key) + if err != nil { + return err + } + + switch refable := value.(type) { + case *spec.Schema: + return rewriteParentRef(sp, key, ref) + + case spec.Schema: + return rewriteParentRef(sp, key, ref) + + case *spec.SchemaOrArray: + if refable.Schema != nil { + refable.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + } + + case *spec.SchemaOrBool: + if refable.Schema != nil { + refable.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + } + case map[string]interface{}: // this happens e.g. if a schema points to an extension unmarshaled as map[string]interface{} + return rewriteParentRef(sp, key, ref) + default: + return fmt.Errorf("no schema with ref found at %s for %T", key, value) + } + + return nil +} + +func rewriteParentRef(sp *spec.Swagger, key string, ref spec.Ref) error { + parent, entry, pvalue, err := getParentFromKey(sp, key) + if err != nil { + return err + } + + debugLog("rewriting holder for %T", pvalue) + switch container := pvalue.(type) { + case spec.Response: + if err := rewriteParentRef(sp, "#"+parent, ref); err != nil { + return err + } + + case *spec.Response: + container.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + case *spec.Responses: + statusCode, err := strconv.Atoi(entry) + if err != nil { + return fmt.Errorf("%s not a number: %w", key[1:], err) + } + resp := container.StatusCodeResponses[statusCode] + resp.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + container.StatusCodeResponses[statusCode] = resp + + case map[string]spec.Response: + resp := container[entry] + resp.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + container[entry] = resp + + case spec.Parameter: + if err := rewriteParentRef(sp, "#"+parent, ref); err != nil { + return err + } + + case map[string]spec.Parameter: + param := container[entry] + param.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + container[entry] = param + + case []spec.Parameter: + idx, err := strconv.Atoi(entry) + if err != nil { + return fmt.Errorf("%s not a number: %w", key[1:], err) + } + param := container[idx] + param.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + container[idx] = param + + case spec.Definitions: + container[entry] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + case map[string]spec.Schema: + container[entry] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + case []spec.Schema: + idx, err := strconv.Atoi(entry) + if err != nil { + return fmt.Errorf("%s not a number: %w", key[1:], err) + } + container[idx] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + case *spec.SchemaOrArray: + // NOTE: this is necessarily an array - otherwise, the parent would be *Schema + idx, err := strconv.Atoi(entry) + if err != nil { + return fmt.Errorf("%s not a number: %w", key[1:], err) + } + container.Schemas[idx] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + case spec.SchemaProperties: + container[entry] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + case *interface{}: + *container = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + // NOTE: can't have case *spec.SchemaOrBool = parent in this case is *Schema + + default: + return fmt.Errorf("unhandled parent schema rewrite %s (%T)", key, pvalue) + } + + return nil +} + +// getPointerFromKey retrieves the content of the JSON pointer "key" +func getPointerFromKey(sp interface{}, key string) (string, interface{}, error) { + switch sp.(type) { + case *spec.Schema: + case *spec.Swagger: + default: + panic("unexpected type used in getPointerFromKey") + } + if key == "#/" { + return "", sp, nil + } + // unescape chars in key, e.g. "{}" from path params + pth, _ := url.PathUnescape(key[1:]) + ptr, err := jsonpointer.New(pth) + if err != nil { + return "", nil, err + } + + value, _, err := ptr.Get(sp) + if err != nil { + debugLog("error when getting key: %s with path: %s", key, pth) + + return "", nil, err + } + + return pth, value, nil +} + +// getParentFromKey retrieves the container of the JSON pointer "key" +func getParentFromKey(sp interface{}, key string) (string, string, interface{}, error) { + switch sp.(type) { + case *spec.Schema: + case *spec.Swagger: + default: + panic("unexpected type used in getPointerFromKey") + } + // unescape chars in key, e.g. "{}" from path params + pth, _ := url.PathUnescape(key[1:]) + + parent, entry := path.Dir(pth), path.Base(pth) + debugLog("getting schema holder at: %s, with entry: %s", parent, entry) + + pptr, err := jsonpointer.New(parent) + if err != nil { + return "", "", nil, err + } + pvalue, _, err := pptr.Get(sp) + if err != nil { + return "", "", nil, fmt.Errorf("can't get parent for %s: %w", parent, err) + } + + return parent, entry, pvalue, nil +} + +// UpdateRef replaces a ref by another one +func UpdateRef(sp interface{}, key string, ref spec.Ref) error { + switch sp.(type) { + case *spec.Schema: + case *spec.Swagger: + default: + panic("unexpected type used in getPointerFromKey") + } + debugLog("updating ref for %s with %s", key, ref.String()) + pth, value, err := getPointerFromKey(sp, key) + if err != nil { + return err + } + + switch refable := value.(type) { + case *spec.Schema: + refable.Ref = ref + case *spec.SchemaOrArray: + if refable.Schema != nil { + refable.Schema.Ref = ref + } + case *spec.SchemaOrBool: + if refable.Schema != nil { + refable.Schema.Ref = ref + } + case spec.Schema: + debugLog("rewriting holder for %T", refable) + _, entry, pvalue, erp := getParentFromKey(sp, key) + if erp != nil { + return err + } + switch container := pvalue.(type) { + case spec.Definitions: + container[entry] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + case map[string]spec.Schema: + container[entry] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + case []spec.Schema: + idx, err := strconv.Atoi(entry) + if err != nil { + return fmt.Errorf("%s not a number: %w", pth, err) + } + container[idx] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + case *spec.SchemaOrArray: + // NOTE: this is necessarily an array - otherwise, the parent would be *Schema + idx, err := strconv.Atoi(entry) + if err != nil { + return fmt.Errorf("%s not a number: %w", pth, err) + } + container.Schemas[idx] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + case spec.SchemaProperties: + container[entry] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + // NOTE: can't have case *spec.SchemaOrBool = parent in this case is *Schema + + default: + return fmt.Errorf("unhandled container type at %s: %T", key, value) + } + + default: + return fmt.Errorf("no schema with ref found at %s for %T", key, value) + } + + return nil +} + +// UpdateRefWithSchema replaces a ref with a schema (i.e. re-inline schema) +func UpdateRefWithSchema(sp *spec.Swagger, key string, sch *spec.Schema) error { + debugLog("updating ref for %s with schema", key) + pth, value, err := getPointerFromKey(sp, key) + if err != nil { + return err + } + + switch refable := value.(type) { + case *spec.Schema: + *refable = *sch + case spec.Schema: + _, entry, pvalue, erp := getParentFromKey(sp, key) + if erp != nil { + return err + } + switch container := pvalue.(type) { + case spec.Definitions: + container[entry] = *sch + + case map[string]spec.Schema: + container[entry] = *sch + + case []spec.Schema: + idx, err := strconv.Atoi(entry) + if err != nil { + return fmt.Errorf("%s not a number: %w", pth, err) + } + container[idx] = *sch + + case *spec.SchemaOrArray: + // NOTE: this is necessarily an array - otherwise, the parent would be *Schema + idx, err := strconv.Atoi(entry) + if err != nil { + return fmt.Errorf("%s not a number: %w", pth, err) + } + container.Schemas[idx] = *sch + + case spec.SchemaProperties: + container[entry] = *sch + + // NOTE: can't have case *spec.SchemaOrBool = parent in this case is *Schema + + default: + return fmt.Errorf("unhandled type for parent of [%s]: %T", key, value) + } + case *spec.SchemaOrArray: + *refable.Schema = *sch + // NOTE: can't have case *spec.SchemaOrBool = parent in this case is *Schema + case *spec.SchemaOrBool: + *refable.Schema = *sch + default: + return fmt.Errorf("no schema with ref found at %s for %T", key, value) + } + + return nil +} + +// DeepestRefResult holds the results from DeepestRef analysis +type DeepestRefResult struct { + Ref spec.Ref + Schema *spec.Schema + Warnings []string +} + +// DeepestRef finds the first definition ref, from a cascade of nested refs which are not definitions. +// - if no definition is found, returns the deepest ref. +// - pointers to external files are expanded +// +// NOTE: all external $ref's are assumed to be already expanded at this stage. +func DeepestRef(sp *spec.Swagger, opts *spec.ExpandOptions, ref spec.Ref) (*DeepestRefResult, error) { + if !ref.HasFragmentOnly { + // we found an external $ref, which is odd at this stage: + // do nothing on external $refs + return &DeepestRefResult{Ref: ref}, nil + } + + currentRef := ref + visited := make(map[string]bool, 64) + warnings := make([]string, 0, 2) + +DOWNREF: + for currentRef.String() != "" { + if path.Dir(currentRef.String()) == definitionsPath { + // this is a top-level definition: stop here and return this ref + return &DeepestRefResult{Ref: currentRef}, nil + } + + if _, beenThere := visited[currentRef.String()]; beenThere { + return nil, + fmt.Errorf("cannot resolve cyclic chain of pointers under %s", currentRef.String()) + } + + visited[currentRef.String()] = true + value, _, err := currentRef.GetPointer().Get(sp) + if err != nil { + return nil, err + } + + switch refable := value.(type) { + case *spec.Schema: + if refable.Ref.String() == "" { + break DOWNREF + } + currentRef = refable.Ref + + case spec.Schema: + if refable.Ref.String() == "" { + break DOWNREF + } + currentRef = refable.Ref + + case *spec.SchemaOrArray: + if refable.Schema == nil || refable.Schema != nil && refable.Schema.Ref.String() == "" { + break DOWNREF + } + currentRef = refable.Schema.Ref + + case *spec.SchemaOrBool: + if refable.Schema == nil || refable.Schema != nil && refable.Schema.Ref.String() == "" { + break DOWNREF + } + currentRef = refable.Schema.Ref + + case spec.Response: + // a pointer points to a schema initially marshalled in responses section... + // Attempt to convert this to a schema. If this fails, the spec is invalid + asJSON, _ := refable.MarshalJSON() + var asSchema spec.Schema + + err := asSchema.UnmarshalJSON(asJSON) + if err != nil { + return nil, + fmt.Errorf("invalid type for resolved JSON pointer %s. Expected a schema a, got: %T (%v)", + currentRef.String(), value, err, + ) + } + warnings = append(warnings, fmt.Sprintf("found $ref %q (response) interpreted as schema", currentRef.String())) + + if asSchema.Ref.String() == "" { + break DOWNREF + } + currentRef = asSchema.Ref + + case spec.Parameter: + // a pointer points to a schema initially marshalled in parameters section... + // Attempt to convert this to a schema. If this fails, the spec is invalid + asJSON, _ := refable.MarshalJSON() + var asSchema spec.Schema + if err := asSchema.UnmarshalJSON(asJSON); err != nil { + return nil, + fmt.Errorf("invalid type for resolved JSON pointer %s. Expected a schema a, got: %T (%v)", + currentRef.String(), value, err, + ) + } + + warnings = append(warnings, fmt.Sprintf("found $ref %q (parameter) interpreted as schema", currentRef.String())) + + if asSchema.Ref.String() == "" { + break DOWNREF + } + currentRef = asSchema.Ref + + default: + // fallback: attempts to resolve the pointer as a schema + if refable == nil { + break DOWNREF + } + + asJSON, _ := json.Marshal(refable) + var asSchema spec.Schema + if err := asSchema.UnmarshalJSON(asJSON); err != nil { + return nil, + fmt.Errorf("unhandled type to resolve JSON pointer %s. Expected a Schema, got: %T (%v)", + currentRef.String(), value, err, + ) + } + warnings = append(warnings, fmt.Sprintf("found $ref %q (%T) interpreted as schema", currentRef.String(), refable)) + + if asSchema.Ref.String() == "" { + break DOWNREF + } + currentRef = asSchema.Ref + } + } + + // assess what schema we're ending with + sch, erv := spec.ResolveRefWithBase(sp, ¤tRef, opts) + if erv != nil { + return nil, erv + } + + if sch == nil { + return nil, fmt.Errorf("no schema found at %s", currentRef.String()) + } + + return &DeepestRefResult{Ref: currentRef, Schema: sch, Warnings: warnings}, nil +} diff --git a/vendor/github.com/go-openapi/analysis/internal/flatten/schutils/flatten_schema.go b/vendor/github.com/go-openapi/analysis/internal/flatten/schutils/flatten_schema.go new file mode 100644 index 0000000..4590236 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/internal/flatten/schutils/flatten_schema.go @@ -0,0 +1,29 @@ +// Package schutils provides tools to save or clone a schema +// when flattening a spec. +package schutils + +import ( + "github.com/go-openapi/spec" + "github.com/go-openapi/swag" +) + +// Save registers a schema as an entry in spec #/definitions +func Save(sp *spec.Swagger, name string, schema *spec.Schema) { + if schema == nil { + return + } + + if sp.Definitions == nil { + sp.Definitions = make(map[string]spec.Schema, 150) + } + + sp.Definitions[name] = *schema +} + +// Clone deep-clones a schema +func Clone(schema *spec.Schema) *spec.Schema { + var sch spec.Schema + _ = swag.FromDynamicJSON(schema, &sch) + + return &sch +} diff --git a/vendor/github.com/go-openapi/analysis/internal/flatten/sortref/keys.go b/vendor/github.com/go-openapi/analysis/internal/flatten/sortref/keys.go new file mode 100644 index 0000000..ac80fc2 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/internal/flatten/sortref/keys.go @@ -0,0 +1,201 @@ +package sortref + +import ( + "net/http" + "path" + "strconv" + "strings" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/spec" +) + +const ( + paths = "paths" + responses = "responses" + parameters = "parameters" + definitions = "definitions" +) + +var ( + ignoredKeys map[string]struct{} + validMethods map[string]struct{} +) + +func init() { + ignoredKeys = map[string]struct{}{ + "schema": {}, + "properties": {}, + "not": {}, + "anyOf": {}, + "oneOf": {}, + } + + validMethods = map[string]struct{}{ + "GET": {}, + "HEAD": {}, + "OPTIONS": {}, + "PATCH": {}, + "POST": {}, + "PUT": {}, + "DELETE": {}, + } +} + +// Key represent a key item constructed from /-separated segments +type Key struct { + Segments int + Key string +} + +// Keys is a sortable collable collection of Keys +type Keys []Key + +func (k Keys) Len() int { return len(k) } +func (k Keys) Swap(i, j int) { k[i], k[j] = k[j], k[i] } +func (k Keys) Less(i, j int) bool { + return k[i].Segments > k[j].Segments || (k[i].Segments == k[j].Segments && k[i].Key < k[j].Key) +} + +// KeyParts construct a SplitKey with all its /-separated segments decomposed. It is sortable. +func KeyParts(key string) SplitKey { + var res []string + for _, part := range strings.Split(key[1:], "/") { + if part != "" { + res = append(res, jsonpointer.Unescape(part)) + } + } + + return res +} + +// SplitKey holds of the parts of a /-separated key, so that their location may be determined. +type SplitKey []string + +// IsDefinition is true when the split key is in the #/definitions section of a spec +func (s SplitKey) IsDefinition() bool { + return len(s) > 1 && s[0] == definitions +} + +// DefinitionName yields the name of the definition +func (s SplitKey) DefinitionName() string { + if !s.IsDefinition() { + return "" + } + + return s[1] +} + +func (s SplitKey) isKeyName(i int) bool { + if i <= 0 { + return false + } + + count := 0 + for idx := i - 1; idx > 0; idx-- { + if s[idx] != "properties" { + break + } + count++ + } + + return count%2 != 0 +} + +// PartAdder know how to construct the components of a new name +type PartAdder func(string) []string + +// BuildName builds a name from segments +func (s SplitKey) BuildName(segments []string, startIndex int, adder PartAdder) string { + for i, part := range s[startIndex:] { + if _, ignored := ignoredKeys[part]; !ignored || s.isKeyName(startIndex+i) { + segments = append(segments, adder(part)...) + } + } + + return strings.Join(segments, " ") +} + +// IsOperation is true when the split key is in the operations section +func (s SplitKey) IsOperation() bool { + return len(s) > 1 && s[0] == paths +} + +// IsSharedOperationParam is true when the split key is in the parameters section of a path +func (s SplitKey) IsSharedOperationParam() bool { + return len(s) > 2 && s[0] == paths && s[2] == parameters +} + +// IsSharedParam is true when the split key is in the #/parameters section of a spec +func (s SplitKey) IsSharedParam() bool { + return len(s) > 1 && s[0] == parameters +} + +// IsOperationParam is true when the split key is in the parameters section of an operation +func (s SplitKey) IsOperationParam() bool { + return len(s) > 3 && s[0] == paths && s[3] == parameters +} + +// IsOperationResponse is true when the split key is in the responses section of an operation +func (s SplitKey) IsOperationResponse() bool { + return len(s) > 3 && s[0] == paths && s[3] == responses +} + +// IsSharedResponse is true when the split key is in the #/responses section of a spec +func (s SplitKey) IsSharedResponse() bool { + return len(s) > 1 && s[0] == responses +} + +// IsDefaultResponse is true when the split key is the default response for an operation +func (s SplitKey) IsDefaultResponse() bool { + return len(s) > 4 && s[0] == paths && s[3] == responses && s[4] == "default" +} + +// IsStatusCodeResponse is true when the split key is an operation response with a status code +func (s SplitKey) IsStatusCodeResponse() bool { + isInt := func() bool { + _, err := strconv.Atoi(s[4]) + + return err == nil + } + + return len(s) > 4 && s[0] == paths && s[3] == responses && isInt() +} + +// ResponseName yields either the status code or "Default" for a response +func (s SplitKey) ResponseName() string { + if s.IsStatusCodeResponse() { + code, _ := strconv.Atoi(s[4]) + + return http.StatusText(code) + } + + if s.IsDefaultResponse() { + return "Default" + } + + return "" +} + +// PathItemRef constructs a $ref object from a split key of the form /{path}/{method} +func (s SplitKey) PathItemRef() spec.Ref { + if len(s) < 3 { + return spec.Ref{} + } + + pth, method := s[1], s[2] + if _, isValidMethod := validMethods[strings.ToUpper(method)]; !isValidMethod && !strings.HasPrefix(method, "x-") { + return spec.Ref{} + } + + return spec.MustCreateRef("#" + path.Join("/", paths, jsonpointer.Escape(pth), strings.ToUpper(method))) +} + +// PathRef constructs a $ref object from a split key of the form /paths/{reference} +func (s SplitKey) PathRef() spec.Ref { + if !s.IsOperation() { + return spec.Ref{} + } + + return spec.MustCreateRef("#" + path.Join("/", paths, jsonpointer.Escape(s[1]))) +} diff --git a/vendor/github.com/go-openapi/analysis/internal/flatten/sortref/sort_ref.go b/vendor/github.com/go-openapi/analysis/internal/flatten/sortref/sort_ref.go new file mode 100644 index 0000000..73243df --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/internal/flatten/sortref/sort_ref.go @@ -0,0 +1,141 @@ +package sortref + +import ( + "reflect" + "sort" + "strings" + + "github.com/go-openapi/analysis/internal/flatten/normalize" + "github.com/go-openapi/spec" +) + +var depthGroupOrder = []string{ + "sharedParam", "sharedResponse", "sharedOpParam", "opParam", "codeResponse", "defaultResponse", "definition", +} + +type mapIterator struct { + len int + mapIter *reflect.MapIter +} + +func (i *mapIterator) Next() bool { + return i.mapIter.Next() +} + +func (i *mapIterator) Len() int { + return i.len +} + +func (i *mapIterator) Key() string { + return i.mapIter.Key().String() +} + +func mustMapIterator(anyMap interface{}) *mapIterator { + val := reflect.ValueOf(anyMap) + + return &mapIterator{mapIter: val.MapRange(), len: val.Len()} +} + +// DepthFirst sorts a map of anything. It groups keys by category +// (shared params, op param, statuscode response, default response, definitions) +// sort groups internally by number of parts in the key and lexical names +// flatten groups into a single list of keys +func DepthFirst(in interface{}) []string { + iterator := mustMapIterator(in) + sorted := make([]string, 0, iterator.Len()) + grouped := make(map[string]Keys, iterator.Len()) + + for iterator.Next() { + k := iterator.Key() + split := KeyParts(k) + var pk string + + if split.IsSharedOperationParam() { + pk = "sharedOpParam" + } + if split.IsOperationParam() { + pk = "opParam" + } + if split.IsStatusCodeResponse() { + pk = "codeResponse" + } + if split.IsDefaultResponse() { + pk = "defaultResponse" + } + if split.IsDefinition() { + pk = "definition" + } + if split.IsSharedParam() { + pk = "sharedParam" + } + if split.IsSharedResponse() { + pk = "sharedResponse" + } + grouped[pk] = append(grouped[pk], Key{Segments: len(split), Key: k}) + } + + for _, pk := range depthGroupOrder { + res := grouped[pk] + sort.Sort(res) + + for _, v := range res { + sorted = append(sorted, v.Key) + } + } + + return sorted +} + +// topMostRefs is able to sort refs by hierarchical then lexicographic order, +// yielding refs ordered breadth-first. +type topmostRefs []string + +func (k topmostRefs) Len() int { return len(k) } +func (k topmostRefs) Swap(i, j int) { k[i], k[j] = k[j], k[i] } +func (k topmostRefs) Less(i, j int) bool { + li, lj := len(strings.Split(k[i], "/")), len(strings.Split(k[j], "/")) + if li == lj { + return k[i] < k[j] + } + + return li < lj +} + +// TopmostFirst sorts references by depth +func TopmostFirst(refs []string) []string { + res := topmostRefs(refs) + sort.Sort(res) + + return res +} + +// RefRevIdx is a reverse index for references +type RefRevIdx struct { + Ref spec.Ref + Keys []string +} + +// ReverseIndex builds a reverse index for references in schemas +func ReverseIndex(schemas map[string]spec.Ref, basePath string) map[string]RefRevIdx { + collected := make(map[string]RefRevIdx) + for key, schRef := range schemas { + // normalize paths before sorting, + // so we get together keys that are from the same external file + normalizedPath := normalize.Path(schRef, basePath) + + entry, ok := collected[normalizedPath] + if ok { + entry.Keys = append(entry.Keys, key) + collected[normalizedPath] = entry + + continue + } + + collected[normalizedPath] = RefRevIdx{ + Ref: schRef, + Keys: []string{key}, + } + } + + return collected +} diff --git a/vendor/github.com/go-openapi/analysis/mixin.go b/vendor/github.com/go-openapi/analysis/mixin.go new file mode 100644 index 0000000..7785a29 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/mixin.go @@ -0,0 +1,515 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package analysis + +import ( + "fmt" + "reflect" + + "github.com/go-openapi/spec" +) + +// Mixin modifies the primary swagger spec by adding the paths and +// definitions from the mixin specs. Top level parameters and +// responses from the mixins are also carried over. Operation id +// collisions are avoided by appending "Mixin" but only if +// needed. +// +// The following parts of primary are subject to merge, filling empty details +// - Info +// - BasePath +// - Host +// - ExternalDocs +// +// Consider calling FixEmptyResponseDescriptions() on the modified primary +// if you read them from storage and they are valid to start with. +// +// Entries in "paths", "definitions", "parameters" and "responses" are +// added to the primary in the order of the given mixins. If the entry +// already exists in primary it is skipped with a warning message. +// +// The count of skipped entries (from collisions) is returned so any +// deviation from the number expected can flag a warning in your build +// scripts. Carefully review the collisions before accepting them; +// consider renaming things if possible. +// +// No key normalization takes place (paths, type defs, +// etc). Ensure they are canonical if your downstream tools do +// key normalization of any form. +// +// Merging schemes (http, https), and consumers/producers do not account for +// collisions. +func Mixin(primary *spec.Swagger, mixins ...*spec.Swagger) []string { + skipped := make([]string, 0, len(mixins)) + opIDs := getOpIDs(primary) + initPrimary(primary) + + for i, m := range mixins { + skipped = append(skipped, mergeSwaggerProps(primary, m)...) + + skipped = append(skipped, mergeConsumes(primary, m)...) + + skipped = append(skipped, mergeProduces(primary, m)...) + + skipped = append(skipped, mergeTags(primary, m)...) + + skipped = append(skipped, mergeSchemes(primary, m)...) + + skipped = append(skipped, mergeSecurityDefinitions(primary, m)...) + + skipped = append(skipped, mergeSecurityRequirements(primary, m)...) + + skipped = append(skipped, mergeDefinitions(primary, m)...) + + // merging paths requires a map of operationIDs to work with + skipped = append(skipped, mergePaths(primary, m, opIDs, i)...) + + skipped = append(skipped, mergeParameters(primary, m)...) + + skipped = append(skipped, mergeResponses(primary, m)...) + } + + return skipped +} + +// getOpIDs extracts all the paths..operationIds from the given +// spec and returns them as the keys in a map with 'true' values. +func getOpIDs(s *spec.Swagger) map[string]bool { + rv := make(map[string]bool) + if s.Paths == nil { + return rv + } + + for _, v := range s.Paths.Paths { + piops := pathItemOps(v) + + for _, op := range piops { + rv[op.ID] = true + } + } + + return rv +} + +func pathItemOps(p spec.PathItem) []*spec.Operation { + var rv []*spec.Operation + rv = appendOp(rv, p.Get) + rv = appendOp(rv, p.Put) + rv = appendOp(rv, p.Post) + rv = appendOp(rv, p.Delete) + rv = appendOp(rv, p.Head) + rv = appendOp(rv, p.Patch) + + return rv +} + +func appendOp(ops []*spec.Operation, op *spec.Operation) []*spec.Operation { + if op == nil { + return ops + } + + return append(ops, op) +} + +func mergeSecurityDefinitions(primary *spec.Swagger, m *spec.Swagger) (skipped []string) { + for k, v := range m.SecurityDefinitions { + if _, exists := primary.SecurityDefinitions[k]; exists { + warn := fmt.Sprintf( + "SecurityDefinitions entry '%v' already exists in primary or higher priority mixin, skipping\n", k) + skipped = append(skipped, warn) + + continue + } + + primary.SecurityDefinitions[k] = v + } + + return +} + +func mergeSecurityRequirements(primary *spec.Swagger, m *spec.Swagger) (skipped []string) { + for _, v := range m.Security { + found := false + for _, vv := range primary.Security { + if reflect.DeepEqual(v, vv) { + found = true + + break + } + } + + if found { + warn := fmt.Sprintf( + "Security requirement: '%v' already exists in primary or higher priority mixin, skipping\n", v) + skipped = append(skipped, warn) + + continue + } + primary.Security = append(primary.Security, v) + } + + return +} + +func mergeDefinitions(primary *spec.Swagger, m *spec.Swagger) (skipped []string) { + for k, v := range m.Definitions { + // assume name collisions represent IDENTICAL type. careful. + if _, exists := primary.Definitions[k]; exists { + warn := fmt.Sprintf( + "definitions entry '%v' already exists in primary or higher priority mixin, skipping\n", k) + skipped = append(skipped, warn) + + continue + } + primary.Definitions[k] = v + } + + return +} + +func mergePaths(primary *spec.Swagger, m *spec.Swagger, opIDs map[string]bool, mixIndex int) (skipped []string) { + if m.Paths != nil { + for k, v := range m.Paths.Paths { + if _, exists := primary.Paths.Paths[k]; exists { + warn := fmt.Sprintf( + "paths entry '%v' already exists in primary or higher priority mixin, skipping\n", k) + skipped = append(skipped, warn) + + continue + } + + // Swagger requires that operationIds be + // unique within a spec. If we find a + // collision we append "Mixin0" to the + // operatoinId we are adding, where 0 is mixin + // index. We assume that operationIds with + // all the proivded specs are already unique. + piops := pathItemOps(v) + for _, piop := range piops { + if opIDs[piop.ID] { + piop.ID = fmt.Sprintf("%v%v%v", piop.ID, "Mixin", mixIndex) + } + opIDs[piop.ID] = true + } + primary.Paths.Paths[k] = v + } + } + + return +} + +func mergeParameters(primary *spec.Swagger, m *spec.Swagger) (skipped []string) { + for k, v := range m.Parameters { + // could try to rename on conflict but would + // have to fix $refs in the mixin. Complain + // for now + if _, exists := primary.Parameters[k]; exists { + warn := fmt.Sprintf( + "top level parameters entry '%v' already exists in primary or higher priority mixin, skipping\n", k) + skipped = append(skipped, warn) + + continue + } + primary.Parameters[k] = v + } + + return +} + +func mergeResponses(primary *spec.Swagger, m *spec.Swagger) (skipped []string) { + for k, v := range m.Responses { + // could try to rename on conflict but would + // have to fix $refs in the mixin. Complain + // for now + if _, exists := primary.Responses[k]; exists { + warn := fmt.Sprintf( + "top level responses entry '%v' already exists in primary or higher priority mixin, skipping\n", k) + skipped = append(skipped, warn) + + continue + } + primary.Responses[k] = v + } + + return skipped +} + +func mergeConsumes(primary *spec.Swagger, m *spec.Swagger) []string { + for _, v := range m.Consumes { + found := false + for _, vv := range primary.Consumes { + if v == vv { + found = true + + break + } + } + + if found { + // no warning here: we just skip it + continue + } + primary.Consumes = append(primary.Consumes, v) + } + + return []string{} +} + +func mergeProduces(primary *spec.Swagger, m *spec.Swagger) []string { + for _, v := range m.Produces { + found := false + for _, vv := range primary.Produces { + if v == vv { + found = true + + break + } + } + + if found { + // no warning here: we just skip it + continue + } + primary.Produces = append(primary.Produces, v) + } + + return []string{} +} + +func mergeTags(primary *spec.Swagger, m *spec.Swagger) (skipped []string) { + for _, v := range m.Tags { + found := false + for _, vv := range primary.Tags { + if v.Name == vv.Name { + found = true + + break + } + } + + if found { + warn := fmt.Sprintf( + "top level tags entry with name '%v' already exists in primary or higher priority mixin, skipping\n", + v.Name, + ) + skipped = append(skipped, warn) + + continue + } + + primary.Tags = append(primary.Tags, v) + } + + return +} + +func mergeSchemes(primary *spec.Swagger, m *spec.Swagger) []string { + for _, v := range m.Schemes { + found := false + for _, vv := range primary.Schemes { + if v == vv { + found = true + + break + } + } + + if found { + // no warning here: we just skip it + continue + } + primary.Schemes = append(primary.Schemes, v) + } + + return []string{} +} + +func mergeSwaggerProps(primary *spec.Swagger, m *spec.Swagger) []string { + var skipped, skippedInfo, skippedDocs []string + + primary.Extensions, skipped = mergeExtensions(primary.Extensions, m.Extensions) + + // merging details in swagger top properties + if primary.Host == "" { + primary.Host = m.Host + } + + if primary.BasePath == "" { + primary.BasePath = m.BasePath + } + + if primary.Info == nil { + primary.Info = m.Info + } else if m.Info != nil { + skippedInfo = mergeInfo(primary.Info, m.Info) + skipped = append(skipped, skippedInfo...) + } + + if primary.ExternalDocs == nil { + primary.ExternalDocs = m.ExternalDocs + } else if m != nil { + skippedDocs = mergeExternalDocs(primary.ExternalDocs, m.ExternalDocs) + skipped = append(skipped, skippedDocs...) + } + + return skipped +} + +//nolint:unparam +func mergeExternalDocs(primary *spec.ExternalDocumentation, m *spec.ExternalDocumentation) []string { + if primary.Description == "" { + primary.Description = m.Description + } + + if primary.URL == "" { + primary.URL = m.URL + } + + return nil +} + +func mergeInfo(primary *spec.Info, m *spec.Info) []string { + var sk, skipped []string + + primary.Extensions, sk = mergeExtensions(primary.Extensions, m.Extensions) + skipped = append(skipped, sk...) + + if primary.Description == "" { + primary.Description = m.Description + } + + if primary.Title == "" { + primary.Description = m.Description + } + + if primary.TermsOfService == "" { + primary.TermsOfService = m.TermsOfService + } + + if primary.Version == "" { + primary.Version = m.Version + } + + if primary.Contact == nil { + primary.Contact = m.Contact + } else if m.Contact != nil { + var csk []string + primary.Contact.Extensions, csk = mergeExtensions(primary.Contact.Extensions, m.Contact.Extensions) + skipped = append(skipped, csk...) + + if primary.Contact.Name == "" { + primary.Contact.Name = m.Contact.Name + } + + if primary.Contact.URL == "" { + primary.Contact.URL = m.Contact.URL + } + + if primary.Contact.Email == "" { + primary.Contact.Email = m.Contact.Email + } + } + + if primary.License == nil { + primary.License = m.License + } else if m.License != nil { + var lsk []string + primary.License.Extensions, lsk = mergeExtensions(primary.License.Extensions, m.License.Extensions) + skipped = append(skipped, lsk...) + + if primary.License.Name == "" { + primary.License.Name = m.License.Name + } + + if primary.License.URL == "" { + primary.License.URL = m.License.URL + } + } + + return skipped +} + +func mergeExtensions(primary spec.Extensions, m spec.Extensions) (result spec.Extensions, skipped []string) { + if primary == nil { + result = m + + return + } + + if m == nil { + result = primary + + return + } + + result = primary + for k, v := range m { + if _, found := primary[k]; found { + skipped = append(skipped, k) + + continue + } + + primary[k] = v + } + + return +} + +func initPrimary(primary *spec.Swagger) { + if primary.SecurityDefinitions == nil { + primary.SecurityDefinitions = make(map[string]*spec.SecurityScheme) + } + + if primary.Security == nil { + primary.Security = make([]map[string][]string, 0, 10) + } + + if primary.Produces == nil { + primary.Produces = make([]string, 0, 10) + } + + if primary.Consumes == nil { + primary.Consumes = make([]string, 0, 10) + } + + if primary.Tags == nil { + primary.Tags = make([]spec.Tag, 0, 10) + } + + if primary.Schemes == nil { + primary.Schemes = make([]string, 0, 10) + } + + if primary.Paths == nil { + primary.Paths = &spec.Paths{Paths: make(map[string]spec.PathItem)} + } + + if primary.Paths.Paths == nil { + primary.Paths.Paths = make(map[string]spec.PathItem) + } + + if primary.Definitions == nil { + primary.Definitions = make(spec.Definitions) + } + + if primary.Parameters == nil { + primary.Parameters = make(map[string]spec.Parameter) + } + + if primary.Responses == nil { + primary.Responses = make(map[string]spec.Response) + } +} diff --git a/vendor/github.com/go-openapi/analysis/schema.go b/vendor/github.com/go-openapi/analysis/schema.go new file mode 100644 index 0000000..ab190db --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/schema.go @@ -0,0 +1,256 @@ +package analysis + +import ( + "errors" + + "github.com/go-openapi/spec" + "github.com/go-openapi/strfmt" +) + +// SchemaOpts configures the schema analyzer +type SchemaOpts struct { + Schema *spec.Schema + Root interface{} + BasePath string + _ struct{} +} + +// Schema analysis, will classify the schema according to known +// patterns. +func Schema(opts SchemaOpts) (*AnalyzedSchema, error) { + if opts.Schema == nil { + return nil, errors.New("no schema to analyze") + } + + a := &AnalyzedSchema{ + schema: opts.Schema, + root: opts.Root, + basePath: opts.BasePath, + } + + a.initializeFlags() + a.inferKnownType() + a.inferEnum() + a.inferBaseType() + + if err := a.inferMap(); err != nil { + return nil, err + } + if err := a.inferArray(); err != nil { + return nil, err + } + + a.inferTuple() + + if err := a.inferFromRef(); err != nil { + return nil, err + } + + a.inferSimpleSchema() + + return a, nil +} + +// AnalyzedSchema indicates what the schema represents +type AnalyzedSchema struct { + schema *spec.Schema + root interface{} + basePath string + + hasProps bool + hasAllOf bool + hasItems bool + hasAdditionalProps bool + hasAdditionalItems bool + hasRef bool + + IsKnownType bool + IsSimpleSchema bool + IsArray bool + IsSimpleArray bool + IsMap bool + IsSimpleMap bool + IsExtendedObject bool + IsTuple bool + IsTupleWithExtra bool + IsBaseType bool + IsEnum bool +} + +// Inherits copies value fields from other onto this schema +func (a *AnalyzedSchema) inherits(other *AnalyzedSchema) { + if other == nil { + return + } + a.hasProps = other.hasProps + a.hasAllOf = other.hasAllOf + a.hasItems = other.hasItems + a.hasAdditionalItems = other.hasAdditionalItems + a.hasAdditionalProps = other.hasAdditionalProps + a.hasRef = other.hasRef + + a.IsKnownType = other.IsKnownType + a.IsSimpleSchema = other.IsSimpleSchema + a.IsArray = other.IsArray + a.IsSimpleArray = other.IsSimpleArray + a.IsMap = other.IsMap + a.IsSimpleMap = other.IsSimpleMap + a.IsExtendedObject = other.IsExtendedObject + a.IsTuple = other.IsTuple + a.IsTupleWithExtra = other.IsTupleWithExtra + a.IsBaseType = other.IsBaseType + a.IsEnum = other.IsEnum +} + +func (a *AnalyzedSchema) inferFromRef() error { + if a.hasRef { + sch := new(spec.Schema) + sch.Ref = a.schema.Ref + err := spec.ExpandSchema(sch, a.root, nil) + if err != nil { + return err + } + rsch, err := Schema(SchemaOpts{ + Schema: sch, + Root: a.root, + BasePath: a.basePath, + }) + if err != nil { + // NOTE(fredbi): currently the only cause for errors is + // unresolved ref. Since spec.ExpandSchema() expands the + // schema recursively, there is no chance to get there, + // until we add more causes for error in this schema analysis. + return err + } + a.inherits(rsch) + } + + return nil +} + +func (a *AnalyzedSchema) inferSimpleSchema() { + a.IsSimpleSchema = a.IsKnownType || a.IsSimpleArray || a.IsSimpleMap +} + +func (a *AnalyzedSchema) inferKnownType() { + tpe := a.schema.Type + format := a.schema.Format + a.IsKnownType = tpe.Contains("boolean") || + tpe.Contains("integer") || + tpe.Contains("number") || + tpe.Contains("string") || + (format != "" && strfmt.Default.ContainsName(format)) || + (a.isObjectType() && !a.hasProps && !a.hasAllOf && !a.hasAdditionalProps && !a.hasAdditionalItems) +} + +func (a *AnalyzedSchema) inferMap() error { + if !a.isObjectType() { + return nil + } + + hasExtra := a.hasProps || a.hasAllOf + a.IsMap = a.hasAdditionalProps && !hasExtra + a.IsExtendedObject = a.hasAdditionalProps && hasExtra + + if !a.IsMap { + return nil + } + + // maps + if a.schema.AdditionalProperties.Schema != nil { + msch, err := Schema(SchemaOpts{ + Schema: a.schema.AdditionalProperties.Schema, + Root: a.root, + BasePath: a.basePath, + }) + if err != nil { + return err + } + a.IsSimpleMap = msch.IsSimpleSchema + } else if a.schema.AdditionalProperties.Allows { + a.IsSimpleMap = true + } + + return nil +} + +func (a *AnalyzedSchema) inferArray() error { + // an array has Items defined as an object schema, otherwise we qualify this JSON array as a tuple + // (yes, even if the Items array contains only one element). + // arrays in JSON schema may be unrestricted (i.e no Items specified). + // Note that arrays in Swagger MUST have Items. Nonetheless, we analyze unrestricted arrays. + // + // NOTE: the spec package misses the distinction between: + // items: [] and items: {}, so we consider both arrays here. + a.IsArray = a.isArrayType() && (a.schema.Items == nil || a.schema.Items.Schemas == nil) + if a.IsArray && a.hasItems { + if a.schema.Items.Schema != nil { + itsch, err := Schema(SchemaOpts{ + Schema: a.schema.Items.Schema, + Root: a.root, + BasePath: a.basePath, + }) + if err != nil { + return err + } + + a.IsSimpleArray = itsch.IsSimpleSchema + } + } + + if a.IsArray && !a.hasItems { + a.IsSimpleArray = true + } + + return nil +} + +func (a *AnalyzedSchema) inferTuple() { + tuple := a.hasItems && a.schema.Items.Schemas != nil + a.IsTuple = tuple && !a.hasAdditionalItems + a.IsTupleWithExtra = tuple && a.hasAdditionalItems +} + +func (a *AnalyzedSchema) inferBaseType() { + if a.isObjectType() { + a.IsBaseType = a.schema.Discriminator != "" + } +} + +func (a *AnalyzedSchema) inferEnum() { + a.IsEnum = len(a.schema.Enum) > 0 +} + +func (a *AnalyzedSchema) initializeFlags() { + a.hasProps = len(a.schema.Properties) > 0 + a.hasAllOf = len(a.schema.AllOf) > 0 + a.hasRef = a.schema.Ref.String() != "" + + a.hasItems = a.schema.Items != nil && + (a.schema.Items.Schema != nil || len(a.schema.Items.Schemas) > 0) + + a.hasAdditionalProps = a.schema.AdditionalProperties != nil && + (a.schema.AdditionalProperties.Schema != nil || a.schema.AdditionalProperties.Allows) + + a.hasAdditionalItems = a.schema.AdditionalItems != nil && + (a.schema.AdditionalItems.Schema != nil || a.schema.AdditionalItems.Allows) +} + +func (a *AnalyzedSchema) isObjectType() bool { + return !a.hasRef && (a.schema.Type == nil || a.schema.Type.Contains("") || a.schema.Type.Contains("object")) +} + +func (a *AnalyzedSchema) isArrayType() bool { + return !a.hasRef && (a.schema.Type != nil && a.schema.Type.Contains("array")) +} + +// isAnalyzedAsComplex determines if an analyzed schema is eligible to flattening (i.e. it is "complex"). +// +// Complex means the schema is any of: +// - a simple type (primitive) +// - an array of something (items are possibly complex ; if this is the case, items will generate a definition) +// - a map of something (additionalProperties are possibly complex ; if this is the case, additionalProperties will +// generate a definition) +func (a *AnalyzedSchema) isAnalyzedAsComplex() bool { + return !a.IsSimpleSchema && !a.IsArray && !a.IsMap +} diff --git a/vendor/github.com/go-openapi/errors/.gitattributes b/vendor/github.com/go-openapi/errors/.gitattributes new file mode 100644 index 0000000..a0717e4 --- /dev/null +++ b/vendor/github.com/go-openapi/errors/.gitattributes @@ -0,0 +1 @@ +*.go text eol=lf \ No newline at end of file diff --git a/vendor/github.com/go-openapi/errors/.gitignore b/vendor/github.com/go-openapi/errors/.gitignore new file mode 100644 index 0000000..dd91ed6 --- /dev/null +++ b/vendor/github.com/go-openapi/errors/.gitignore @@ -0,0 +1,2 @@ +secrets.yml +coverage.out diff --git a/vendor/github.com/go-openapi/errors/.golangci.yml b/vendor/github.com/go-openapi/errors/.golangci.yml new file mode 100644 index 0000000..cf88ead --- /dev/null +++ b/vendor/github.com/go-openapi/errors/.golangci.yml @@ -0,0 +1,62 @@ +linters-settings: + govet: + check-shadowing: true + golint: + min-confidence: 0 + gocyclo: + min-complexity: 45 + maligned: + suggest-new: true + dupl: + threshold: 200 + goconst: + min-len: 2 + min-occurrences: 3 + +linters: + enable-all: true + disable: + - errname # this repo doesn't follow the convention advised by this linter + - maligned + - unparam + - lll + - gochecknoinits + - gochecknoglobals + - funlen + - godox + - gocognit + - whitespace + - wsl + - wrapcheck + - testpackage + - nlreturn + - gomnd + - exhaustivestruct + - goerr113 + - errorlint + - nestif + - godot + - gofumpt + - paralleltest + - tparallel + - thelper + - ifshort + - exhaustruct + - varnamelen + - gci + - depguard + - errchkjson + - inamedparam + - nonamedreturns + - musttag + - ireturn + - forcetypeassert + - cyclop + # deprecated linters + - deadcode + - interfacer + - scopelint + - varcheck + - structcheck + - golint + - nosnakecase diff --git a/vendor/github.com/go-openapi/errors/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/errors/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..9322b06 --- /dev/null +++ b/vendor/github.com/go-openapi/errors/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at ivan+abuse@flanders.co.nz. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/go-openapi/errors/LICENSE b/vendor/github.com/go-openapi/errors/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/vendor/github.com/go-openapi/errors/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-openapi/errors/README.md b/vendor/github.com/go-openapi/errors/README.md new file mode 100644 index 0000000..6d57ea5 --- /dev/null +++ b/vendor/github.com/go-openapi/errors/README.md @@ -0,0 +1,8 @@ +# OpenAPI errors [![Build Status](https://github.com/go-openapi/errors/actions/workflows/go-test.yml/badge.svg)](https://github.com/go-openapi/errors/actions?query=workflow%3A"go+test") [![codecov](https://codecov.io/gh/go-openapi/errors/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/errors) + +[![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) +[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/errors/master/LICENSE) +[![Go Reference](https://pkg.go.dev/badge/github.com/go-openapi/errors.svg)](https://pkg.go.dev/github.com/go-openapi/errors) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/errors)](https://goreportcard.com/report/github.com/go-openapi/errors) + +Shared errors and error interface used throughout the various libraries found in the go-openapi toolkit. diff --git a/vendor/github.com/go-openapi/errors/api.go b/vendor/github.com/go-openapi/errors/api.go new file mode 100644 index 0000000..5320cb9 --- /dev/null +++ b/vendor/github.com/go-openapi/errors/api.go @@ -0,0 +1,192 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package errors + +import ( + "encoding/json" + "fmt" + "net/http" + "reflect" + "strings" +) + +// DefaultHTTPCode is used when the error Code cannot be used as an HTTP code. +var DefaultHTTPCode = http.StatusUnprocessableEntity + +// Error represents a error interface all swagger framework errors implement +type Error interface { + error + Code() int32 +} + +type apiError struct { + code int32 + message string +} + +func (a *apiError) Error() string { + return a.message +} + +func (a *apiError) Code() int32 { + return a.code +} + +// MarshalJSON implements the JSON encoding interface +func (a apiError) MarshalJSON() ([]byte, error) { + return json.Marshal(map[string]interface{}{ + "code": a.code, + "message": a.message, + }) +} + +// New creates a new API error with a code and a message +func New(code int32, message string, args ...interface{}) Error { + if len(args) > 0 { + return &apiError{ + code: code, + message: fmt.Sprintf(message, args...), + } + } + return &apiError{ + code: code, + message: message, + } +} + +// NotFound creates a new not found error +func NotFound(message string, args ...interface{}) Error { + if message == "" { + message = "Not found" + } + return New(http.StatusNotFound, fmt.Sprintf(message, args...)) +} + +// NotImplemented creates a new not implemented error +func NotImplemented(message string) Error { + return New(http.StatusNotImplemented, message) +} + +// MethodNotAllowedError represents an error for when the path matches but the method doesn't +type MethodNotAllowedError struct { + code int32 + Allowed []string + message string +} + +func (m *MethodNotAllowedError) Error() string { + return m.message +} + +// Code the error code +func (m *MethodNotAllowedError) Code() int32 { + return m.code +} + +// MarshalJSON implements the JSON encoding interface +func (m MethodNotAllowedError) MarshalJSON() ([]byte, error) { + return json.Marshal(map[string]interface{}{ + "code": m.code, + "message": m.message, + "allowed": m.Allowed, + }) +} + +func errorAsJSON(err Error) []byte { + //nolint:errchkjson + b, _ := json.Marshal(struct { + Code int32 `json:"code"` + Message string `json:"message"` + }{err.Code(), err.Error()}) + return b +} + +func flattenComposite(errs *CompositeError) *CompositeError { + var res []error + for _, er := range errs.Errors { + switch e := er.(type) { + case *CompositeError: + if e != nil && len(e.Errors) > 0 { + flat := flattenComposite(e) + if len(flat.Errors) > 0 { + res = append(res, flat.Errors...) + } + } + default: + if e != nil { + res = append(res, e) + } + } + } + return CompositeValidationError(res...) +} + +// MethodNotAllowed creates a new method not allowed error +func MethodNotAllowed(requested string, allow []string) Error { + msg := fmt.Sprintf("method %s is not allowed, but [%s] are", requested, strings.Join(allow, ",")) + return &MethodNotAllowedError{ + code: http.StatusMethodNotAllowed, + Allowed: allow, + message: msg, + } +} + +// ServeError implements the http error handler interface +func ServeError(rw http.ResponseWriter, r *http.Request, err error) { + rw.Header().Set("Content-Type", "application/json") + switch e := err.(type) { + case *CompositeError: + er := flattenComposite(e) + // strips composite errors to first element only + if len(er.Errors) > 0 { + ServeError(rw, r, er.Errors[0]) + } else { + // guard against empty CompositeError (invalid construct) + ServeError(rw, r, nil) + } + case *MethodNotAllowedError: + rw.Header().Add("Allow", strings.Join(e.Allowed, ",")) + rw.WriteHeader(asHTTPCode(int(e.Code()))) + if r == nil || r.Method != http.MethodHead { + _, _ = rw.Write(errorAsJSON(e)) + } + case Error: + value := reflect.ValueOf(e) + if value.Kind() == reflect.Ptr && value.IsNil() { + rw.WriteHeader(http.StatusInternalServerError) + _, _ = rw.Write(errorAsJSON(New(http.StatusInternalServerError, "Unknown error"))) + return + } + rw.WriteHeader(asHTTPCode(int(e.Code()))) + if r == nil || r.Method != http.MethodHead { + _, _ = rw.Write(errorAsJSON(e)) + } + case nil: + rw.WriteHeader(http.StatusInternalServerError) + _, _ = rw.Write(errorAsJSON(New(http.StatusInternalServerError, "Unknown error"))) + default: + rw.WriteHeader(http.StatusInternalServerError) + if r == nil || r.Method != http.MethodHead { + _, _ = rw.Write(errorAsJSON(New(http.StatusInternalServerError, err.Error()))) + } + } +} + +func asHTTPCode(input int) int { + if input >= 600 { + return DefaultHTTPCode + } + return input +} diff --git a/vendor/github.com/go-openapi/errors/auth.go b/vendor/github.com/go-openapi/errors/auth.go new file mode 100644 index 0000000..0545b50 --- /dev/null +++ b/vendor/github.com/go-openapi/errors/auth.go @@ -0,0 +1,22 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package errors + +import "net/http" + +// Unauthenticated returns an unauthenticated error +func Unauthenticated(scheme string) Error { + return New(http.StatusUnauthorized, "unauthenticated for %s", scheme) +} diff --git a/vendor/github.com/go-openapi/errors/doc.go b/vendor/github.com/go-openapi/errors/doc.go new file mode 100644 index 0000000..af01190 --- /dev/null +++ b/vendor/github.com/go-openapi/errors/doc.go @@ -0,0 +1,26 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package errors provides an Error interface and several concrete types +implementing this interface to manage API errors and JSON-schema validation +errors. + +A middleware handler ServeError() is provided to serve the errors types +it defines. + +It is used throughout the various go-openapi toolkit libraries +(https://github.com/go-openapi). +*/ +package errors diff --git a/vendor/github.com/go-openapi/errors/headers.go b/vendor/github.com/go-openapi/errors/headers.go new file mode 100644 index 0000000..dfebe8f --- /dev/null +++ b/vendor/github.com/go-openapi/errors/headers.go @@ -0,0 +1,103 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package errors + +import ( + "encoding/json" + "fmt" + "net/http" +) + +// Validation represents a failure of a precondition +type Validation struct { + code int32 + Name string + In string + Value interface{} + message string + Values []interface{} +} + +func (e *Validation) Error() string { + return e.message +} + +// Code the error code +func (e *Validation) Code() int32 { + return e.code +} + +// MarshalJSON implements the JSON encoding interface +func (e Validation) MarshalJSON() ([]byte, error) { + return json.Marshal(map[string]interface{}{ + "code": e.code, + "message": e.message, + "in": e.In, + "name": e.Name, + "value": e.Value, + "values": e.Values, + }) +} + +// ValidateName sets the name for a validation or updates it for a nested property +func (e *Validation) ValidateName(name string) *Validation { + if name != "" { + if e.Name == "" { + e.Name = name + e.message = name + e.message + } else { + e.Name = name + "." + e.Name + e.message = name + "." + e.message + } + } + return e +} + +const ( + contentTypeFail = `unsupported media type %q, only %v are allowed` + responseFormatFail = `unsupported media type requested, only %v are available` +) + +// InvalidContentType error for an invalid content type +func InvalidContentType(value string, allowed []string) *Validation { + values := make([]interface{}, 0, len(allowed)) + for _, v := range allowed { + values = append(values, v) + } + return &Validation{ + code: http.StatusUnsupportedMediaType, + Name: "Content-Type", + In: "header", + Value: value, + Values: values, + message: fmt.Sprintf(contentTypeFail, value, allowed), + } +} + +// InvalidResponseFormat error for an unacceptable response format request +func InvalidResponseFormat(value string, allowed []string) *Validation { + values := make([]interface{}, 0, len(allowed)) + for _, v := range allowed { + values = append(values, v) + } + return &Validation{ + code: http.StatusNotAcceptable, + Name: "Accept", + In: "header", + Value: value, + Values: values, + message: fmt.Sprintf(responseFormatFail, allowed), + } +} diff --git a/vendor/github.com/go-openapi/errors/middleware.go b/vendor/github.com/go-openapi/errors/middleware.go new file mode 100644 index 0000000..963472d --- /dev/null +++ b/vendor/github.com/go-openapi/errors/middleware.go @@ -0,0 +1,50 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package errors + +import ( + "bytes" + "fmt" + "strings" +) + +// APIVerificationFailed is an error that contains all the missing info for a mismatched section +// between the api registrations and the api spec +type APIVerificationFailed struct { + Section string `json:"section,omitempty"` + MissingSpecification []string `json:"missingSpecification,omitempty"` + MissingRegistration []string `json:"missingRegistration,omitempty"` +} + +func (v *APIVerificationFailed) Error() string { + buf := bytes.NewBuffer(nil) + + hasRegMissing := len(v.MissingRegistration) > 0 + hasSpecMissing := len(v.MissingSpecification) > 0 + + if hasRegMissing { + buf.WriteString(fmt.Sprintf("missing [%s] %s registrations", strings.Join(v.MissingRegistration, ", "), v.Section)) + } + + if hasRegMissing && hasSpecMissing { + buf.WriteString("\n") + } + + if hasSpecMissing { + buf.WriteString(fmt.Sprintf("missing from spec file [%s] %s", strings.Join(v.MissingSpecification, ", "), v.Section)) + } + + return buf.String() +} diff --git a/vendor/github.com/go-openapi/errors/parsing.go b/vendor/github.com/go-openapi/errors/parsing.go new file mode 100644 index 0000000..5096e1e --- /dev/null +++ b/vendor/github.com/go-openapi/errors/parsing.go @@ -0,0 +1,78 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package errors + +import ( + "encoding/json" + "fmt" +) + +// ParseError represents a parsing error +type ParseError struct { + code int32 + Name string + In string + Value string + Reason error + message string +} + +func (e *ParseError) Error() string { + return e.message +} + +// Code returns the http status code for this error +func (e *ParseError) Code() int32 { + return e.code +} + +// MarshalJSON implements the JSON encoding interface +func (e ParseError) MarshalJSON() ([]byte, error) { + var reason string + if e.Reason != nil { + reason = e.Reason.Error() + } + return json.Marshal(map[string]interface{}{ + "code": e.code, + "message": e.message, + "in": e.In, + "name": e.Name, + "value": e.Value, + "reason": reason, + }) +} + +const ( + parseErrorTemplContent = `parsing %s %s from %q failed, because %s` + parseErrorTemplContentNoIn = `parsing %s from %q failed, because %s` +) + +// NewParseError creates a new parse error +func NewParseError(name, in, value string, reason error) *ParseError { + var msg string + if in == "" { + msg = fmt.Sprintf(parseErrorTemplContentNoIn, name, value, reason) + } else { + msg = fmt.Sprintf(parseErrorTemplContent, name, in, value, reason) + } + return &ParseError{ + code: 400, + Name: name, + In: in, + Value: value, + Reason: reason, + message: msg, + } +} diff --git a/vendor/github.com/go-openapi/errors/schema.go b/vendor/github.com/go-openapi/errors/schema.go new file mode 100644 index 0000000..cf7ac2e --- /dev/null +++ b/vendor/github.com/go-openapi/errors/schema.go @@ -0,0 +1,615 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package errors + +import ( + "encoding/json" + "fmt" + "strings" +) + +const ( + invalidType = "%s is an invalid type name" + typeFail = "%s in %s must be of type %s" + typeFailWithData = "%s in %s must be of type %s: %q" + typeFailWithError = "%s in %s must be of type %s, because: %s" + requiredFail = "%s in %s is required" + readOnlyFail = "%s in %s is readOnly" + tooLongMessage = "%s in %s should be at most %d chars long" + tooShortMessage = "%s in %s should be at least %d chars long" + patternFail = "%s in %s should match '%s'" + enumFail = "%s in %s should be one of %v" + multipleOfFail = "%s in %s should be a multiple of %v" + maxIncFail = "%s in %s should be less than or equal to %v" + maxExcFail = "%s in %s should be less than %v" + minIncFail = "%s in %s should be greater than or equal to %v" + minExcFail = "%s in %s should be greater than %v" + uniqueFail = "%s in %s shouldn't contain duplicates" + maxItemsFail = "%s in %s should have at most %d items" + minItemsFail = "%s in %s should have at least %d items" + typeFailNoIn = "%s must be of type %s" + typeFailWithDataNoIn = "%s must be of type %s: %q" + typeFailWithErrorNoIn = "%s must be of type %s, because: %s" + requiredFailNoIn = "%s is required" + readOnlyFailNoIn = "%s is readOnly" + tooLongMessageNoIn = "%s should be at most %d chars long" + tooShortMessageNoIn = "%s should be at least %d chars long" + patternFailNoIn = "%s should match '%s'" + enumFailNoIn = "%s should be one of %v" + multipleOfFailNoIn = "%s should be a multiple of %v" + maxIncFailNoIn = "%s should be less than or equal to %v" + maxExcFailNoIn = "%s should be less than %v" + minIncFailNoIn = "%s should be greater than or equal to %v" + minExcFailNoIn = "%s should be greater than %v" + uniqueFailNoIn = "%s shouldn't contain duplicates" + maxItemsFailNoIn = "%s should have at most %d items" + minItemsFailNoIn = "%s should have at least %d items" + noAdditionalItems = "%s in %s can't have additional items" + noAdditionalItemsNoIn = "%s can't have additional items" + tooFewProperties = "%s in %s should have at least %d properties" + tooFewPropertiesNoIn = "%s should have at least %d properties" + tooManyProperties = "%s in %s should have at most %d properties" + tooManyPropertiesNoIn = "%s should have at most %d properties" + unallowedProperty = "%s.%s in %s is a forbidden property" + unallowedPropertyNoIn = "%s.%s is a forbidden property" + failedAllPatternProps = "%s.%s in %s failed all pattern properties" + failedAllPatternPropsNoIn = "%s.%s failed all pattern properties" + multipleOfMustBePositive = "factor MultipleOf declared for %s must be positive: %v" +) + +// All code responses can be used to differentiate errors for different handling +// by the consuming program +const ( + // CompositeErrorCode remains 422 for backwards-compatibility + // and to separate it from validation errors with cause + CompositeErrorCode = 422 + // InvalidTypeCode is used for any subclass of invalid types + InvalidTypeCode = 600 + iota + RequiredFailCode + TooLongFailCode + TooShortFailCode + PatternFailCode + EnumFailCode + MultipleOfFailCode + MaxFailCode + MinFailCode + UniqueFailCode + MaxItemsFailCode + MinItemsFailCode + NoAdditionalItemsCode + TooFewPropertiesCode + TooManyPropertiesCode + UnallowedPropertyCode + FailedAllPatternPropsCode + MultipleOfMustBePositiveCode + ReadOnlyFailCode +) + +// CompositeError is an error that groups several errors together +type CompositeError struct { + Errors []error + code int32 + message string +} + +// Code for this error +func (c *CompositeError) Code() int32 { + return c.code +} + +func (c *CompositeError) Error() string { + if len(c.Errors) > 0 { + msgs := []string{c.message + ":"} + for _, e := range c.Errors { + msgs = append(msgs, e.Error()) + } + return strings.Join(msgs, "\n") + } + return c.message +} + +func (c *CompositeError) Unwrap() []error { + return c.Errors +} + +// MarshalJSON implements the JSON encoding interface +func (c CompositeError) MarshalJSON() ([]byte, error) { + return json.Marshal(map[string]interface{}{ + "code": c.code, + "message": c.message, + "errors": c.Errors, + }) +} + +// CompositeValidationError an error to wrap a bunch of other errors +func CompositeValidationError(errors ...error) *CompositeError { + return &CompositeError{ + code: CompositeErrorCode, + Errors: append(make([]error, 0, len(errors)), errors...), + message: "validation failure list", + } +} + +// ValidateName recursively sets the name for all validations or updates them for nested properties +func (c *CompositeError) ValidateName(name string) *CompositeError { + for i, e := range c.Errors { + if ve, ok := e.(*Validation); ok { + c.Errors[i] = ve.ValidateName(name) + } else if ce, ok := e.(*CompositeError); ok { + c.Errors[i] = ce.ValidateName(name) + } + } + + return c +} + +// FailedAllPatternProperties an error for when the property doesn't match a pattern +func FailedAllPatternProperties(name, in, key string) *Validation { + msg := fmt.Sprintf(failedAllPatternProps, name, key, in) + if in == "" { + msg = fmt.Sprintf(failedAllPatternPropsNoIn, name, key) + } + return &Validation{ + code: FailedAllPatternPropsCode, + Name: name, + In: in, + Value: key, + message: msg, + } +} + +// PropertyNotAllowed an error for when the property doesn't match a pattern +func PropertyNotAllowed(name, in, key string) *Validation { + msg := fmt.Sprintf(unallowedProperty, name, key, in) + if in == "" { + msg = fmt.Sprintf(unallowedPropertyNoIn, name, key) + } + return &Validation{ + code: UnallowedPropertyCode, + Name: name, + In: in, + Value: key, + message: msg, + } +} + +// TooFewProperties an error for an object with too few properties +func TooFewProperties(name, in string, n int64) *Validation { + msg := fmt.Sprintf(tooFewProperties, name, in, n) + if in == "" { + msg = fmt.Sprintf(tooFewPropertiesNoIn, name, n) + } + return &Validation{ + code: TooFewPropertiesCode, + Name: name, + In: in, + Value: n, + message: msg, + } +} + +// TooManyProperties an error for an object with too many properties +func TooManyProperties(name, in string, n int64) *Validation { + msg := fmt.Sprintf(tooManyProperties, name, in, n) + if in == "" { + msg = fmt.Sprintf(tooManyPropertiesNoIn, name, n) + } + return &Validation{ + code: TooManyPropertiesCode, + Name: name, + In: in, + Value: n, + message: msg, + } +} + +// AdditionalItemsNotAllowed an error for invalid additional items +func AdditionalItemsNotAllowed(name, in string) *Validation { + msg := fmt.Sprintf(noAdditionalItems, name, in) + if in == "" { + msg = fmt.Sprintf(noAdditionalItemsNoIn, name) + } + return &Validation{ + code: NoAdditionalItemsCode, + Name: name, + In: in, + message: msg, + } +} + +// InvalidCollectionFormat another flavor of invalid type error +func InvalidCollectionFormat(name, in, format string) *Validation { + return &Validation{ + code: InvalidTypeCode, + Name: name, + In: in, + Value: format, + message: fmt.Sprintf("the collection format %q is not supported for the %s param %q", format, in, name), + } +} + +// InvalidTypeName an error for when the type is invalid +func InvalidTypeName(typeName string) *Validation { + return &Validation{ + code: InvalidTypeCode, + Value: typeName, + message: fmt.Sprintf(invalidType, typeName), + } +} + +// InvalidType creates an error for when the type is invalid +func InvalidType(name, in, typeName string, value interface{}) *Validation { + var message string + + if in != "" { + switch value.(type) { + case string: + message = fmt.Sprintf(typeFailWithData, name, in, typeName, value) + case error: + message = fmt.Sprintf(typeFailWithError, name, in, typeName, value) + default: + message = fmt.Sprintf(typeFail, name, in, typeName) + } + } else { + switch value.(type) { + case string: + message = fmt.Sprintf(typeFailWithDataNoIn, name, typeName, value) + case error: + message = fmt.Sprintf(typeFailWithErrorNoIn, name, typeName, value) + default: + message = fmt.Sprintf(typeFailNoIn, name, typeName) + } + } + + return &Validation{ + code: InvalidTypeCode, + Name: name, + In: in, + Value: value, + message: message, + } + +} + +// DuplicateItems error for when an array contains duplicates +func DuplicateItems(name, in string) *Validation { + msg := fmt.Sprintf(uniqueFail, name, in) + if in == "" { + msg = fmt.Sprintf(uniqueFailNoIn, name) + } + return &Validation{ + code: UniqueFailCode, + Name: name, + In: in, + message: msg, + } +} + +// TooManyItems error for when an array contains too many items +func TooManyItems(name, in string, max int64, value interface{}) *Validation { + msg := fmt.Sprintf(maxItemsFail, name, in, max) + if in == "" { + msg = fmt.Sprintf(maxItemsFailNoIn, name, max) + } + + return &Validation{ + code: MaxItemsFailCode, + Name: name, + In: in, + Value: value, + message: msg, + } +} + +// TooFewItems error for when an array contains too few items +func TooFewItems(name, in string, min int64, value interface{}) *Validation { + msg := fmt.Sprintf(minItemsFail, name, in, min) + if in == "" { + msg = fmt.Sprintf(minItemsFailNoIn, name, min) + } + return &Validation{ + code: MinItemsFailCode, + Name: name, + In: in, + Value: value, + message: msg, + } +} + +// ExceedsMaximumInt error for when maximum validation fails +func ExceedsMaximumInt(name, in string, max int64, exclusive bool, value interface{}) *Validation { + var message string + if in == "" { + m := maxIncFailNoIn + if exclusive { + m = maxExcFailNoIn + } + message = fmt.Sprintf(m, name, max) + } else { + m := maxIncFail + if exclusive { + m = maxExcFail + } + message = fmt.Sprintf(m, name, in, max) + } + return &Validation{ + code: MaxFailCode, + Name: name, + In: in, + Value: value, + message: message, + } +} + +// ExceedsMaximumUint error for when maximum validation fails +func ExceedsMaximumUint(name, in string, max uint64, exclusive bool, value interface{}) *Validation { + var message string + if in == "" { + m := maxIncFailNoIn + if exclusive { + m = maxExcFailNoIn + } + message = fmt.Sprintf(m, name, max) + } else { + m := maxIncFail + if exclusive { + m = maxExcFail + } + message = fmt.Sprintf(m, name, in, max) + } + return &Validation{ + code: MaxFailCode, + Name: name, + In: in, + Value: value, + message: message, + } +} + +// ExceedsMaximum error for when maximum validation fails +func ExceedsMaximum(name, in string, max float64, exclusive bool, value interface{}) *Validation { + var message string + if in == "" { + m := maxIncFailNoIn + if exclusive { + m = maxExcFailNoIn + } + message = fmt.Sprintf(m, name, max) + } else { + m := maxIncFail + if exclusive { + m = maxExcFail + } + message = fmt.Sprintf(m, name, in, max) + } + return &Validation{ + code: MaxFailCode, + Name: name, + In: in, + Value: value, + message: message, + } +} + +// ExceedsMinimumInt error for when minimum validation fails +func ExceedsMinimumInt(name, in string, min int64, exclusive bool, value interface{}) *Validation { + var message string + if in == "" { + m := minIncFailNoIn + if exclusive { + m = minExcFailNoIn + } + message = fmt.Sprintf(m, name, min) + } else { + m := minIncFail + if exclusive { + m = minExcFail + } + message = fmt.Sprintf(m, name, in, min) + } + return &Validation{ + code: MinFailCode, + Name: name, + In: in, + Value: value, + message: message, + } +} + +// ExceedsMinimumUint error for when minimum validation fails +func ExceedsMinimumUint(name, in string, min uint64, exclusive bool, value interface{}) *Validation { + var message string + if in == "" { + m := minIncFailNoIn + if exclusive { + m = minExcFailNoIn + } + message = fmt.Sprintf(m, name, min) + } else { + m := minIncFail + if exclusive { + m = minExcFail + } + message = fmt.Sprintf(m, name, in, min) + } + return &Validation{ + code: MinFailCode, + Name: name, + In: in, + Value: value, + message: message, + } +} + +// ExceedsMinimum error for when minimum validation fails +func ExceedsMinimum(name, in string, min float64, exclusive bool, value interface{}) *Validation { + var message string + if in == "" { + m := minIncFailNoIn + if exclusive { + m = minExcFailNoIn + } + message = fmt.Sprintf(m, name, min) + } else { + m := minIncFail + if exclusive { + m = minExcFail + } + message = fmt.Sprintf(m, name, in, min) + } + return &Validation{ + code: MinFailCode, + Name: name, + In: in, + Value: value, + message: message, + } +} + +// NotMultipleOf error for when multiple of validation fails +func NotMultipleOf(name, in string, multiple, value interface{}) *Validation { + var msg string + if in == "" { + msg = fmt.Sprintf(multipleOfFailNoIn, name, multiple) + } else { + msg = fmt.Sprintf(multipleOfFail, name, in, multiple) + } + return &Validation{ + code: MultipleOfFailCode, + Name: name, + In: in, + Value: value, + message: msg, + } +} + +// EnumFail error for when an enum validation fails +func EnumFail(name, in string, value interface{}, values []interface{}) *Validation { + var msg string + if in == "" { + msg = fmt.Sprintf(enumFailNoIn, name, values) + } else { + msg = fmt.Sprintf(enumFail, name, in, values) + } + + return &Validation{ + code: EnumFailCode, + Name: name, + In: in, + Value: value, + Values: values, + message: msg, + } +} + +// Required error for when a value is missing +func Required(name, in string, value interface{}) *Validation { + var msg string + if in == "" { + msg = fmt.Sprintf(requiredFailNoIn, name) + } else { + msg = fmt.Sprintf(requiredFail, name, in) + } + return &Validation{ + code: RequiredFailCode, + Name: name, + In: in, + Value: value, + message: msg, + } +} + +// ReadOnly error for when a value is present in request +func ReadOnly(name, in string, value interface{}) *Validation { + var msg string + if in == "" { + msg = fmt.Sprintf(readOnlyFailNoIn, name) + } else { + msg = fmt.Sprintf(readOnlyFail, name, in) + } + return &Validation{ + code: ReadOnlyFailCode, + Name: name, + In: in, + Value: value, + message: msg, + } +} + +// TooLong error for when a string is too long +func TooLong(name, in string, max int64, value interface{}) *Validation { + var msg string + if in == "" { + msg = fmt.Sprintf(tooLongMessageNoIn, name, max) + } else { + msg = fmt.Sprintf(tooLongMessage, name, in, max) + } + return &Validation{ + code: TooLongFailCode, + Name: name, + In: in, + Value: value, + message: msg, + } +} + +// TooShort error for when a string is too short +func TooShort(name, in string, min int64, value interface{}) *Validation { + var msg string + if in == "" { + msg = fmt.Sprintf(tooShortMessageNoIn, name, min) + } else { + msg = fmt.Sprintf(tooShortMessage, name, in, min) + } + + return &Validation{ + code: TooShortFailCode, + Name: name, + In: in, + Value: value, + message: msg, + } +} + +// FailedPattern error for when a string fails a regex pattern match +// the pattern that is returned is the ECMA syntax version of the pattern not the golang version. +func FailedPattern(name, in, pattern string, value interface{}) *Validation { + var msg string + if in == "" { + msg = fmt.Sprintf(patternFailNoIn, name, pattern) + } else { + msg = fmt.Sprintf(patternFail, name, in, pattern) + } + + return &Validation{ + code: PatternFailCode, + Name: name, + In: in, + Value: value, + message: msg, + } +} + +// MultipleOfMustBePositive error for when a +// multipleOf factor is negative +func MultipleOfMustBePositive(name, in string, factor interface{}) *Validation { + return &Validation{ + code: MultipleOfMustBePositiveCode, + Name: name, + In: in, + Value: factor, + message: fmt.Sprintf(multipleOfMustBePositive, name, factor), + } +} diff --git a/vendor/github.com/go-openapi/jsonpointer/.editorconfig b/vendor/github.com/go-openapi/jsonpointer/.editorconfig new file mode 100644 index 0000000..3152da6 --- /dev/null +++ b/vendor/github.com/go-openapi/jsonpointer/.editorconfig @@ -0,0 +1,26 @@ +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + +# Set default charset +[*.{js,py,go,scala,rb,java,html,css,less,sass,md}] +charset = utf-8 + +# Tab indentation (no size specified) +[*.go] +indent_style = tab + +[*.md] +trim_trailing_whitespace = false + +# Matches the exact files either package.json or .travis.yml +[{package.json,.travis.yml}] +indent_style = space +indent_size = 2 diff --git a/vendor/github.com/go-openapi/jsonpointer/.gitignore b/vendor/github.com/go-openapi/jsonpointer/.gitignore new file mode 100644 index 0000000..769c244 --- /dev/null +++ b/vendor/github.com/go-openapi/jsonpointer/.gitignore @@ -0,0 +1 @@ +secrets.yml diff --git a/vendor/github.com/go-openapi/jsonpointer/.golangci.yml b/vendor/github.com/go-openapi/jsonpointer/.golangci.yml new file mode 100644 index 0000000..22f8d21 --- /dev/null +++ b/vendor/github.com/go-openapi/jsonpointer/.golangci.yml @@ -0,0 +1,61 @@ +linters-settings: + govet: + check-shadowing: true + golint: + min-confidence: 0 + gocyclo: + min-complexity: 45 + maligned: + suggest-new: true + dupl: + threshold: 200 + goconst: + min-len: 2 + min-occurrences: 3 + +linters: + enable-all: true + disable: + - maligned + - unparam + - lll + - gochecknoinits + - gochecknoglobals + - funlen + - godox + - gocognit + - whitespace + - wsl + - wrapcheck + - testpackage + - nlreturn + - gomnd + - exhaustivestruct + - goerr113 + - errorlint + - nestif + - godot + - gofumpt + - paralleltest + - tparallel + - thelper + - ifshort + - exhaustruct + - varnamelen + - gci + - depguard + - errchkjson + - inamedparam + - nonamedreturns + - musttag + - ireturn + - forcetypeassert + - cyclop + # deprecated linters + - deadcode + - interfacer + - scopelint + - varcheck + - structcheck + - golint + - nosnakecase diff --git a/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..9322b06 --- /dev/null +++ b/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at ivan+abuse@flanders.co.nz. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/go-openapi/jsonpointer/LICENSE b/vendor/github.com/go-openapi/jsonpointer/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/vendor/github.com/go-openapi/jsonpointer/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-openapi/jsonpointer/README.md b/vendor/github.com/go-openapi/jsonpointer/README.md new file mode 100644 index 0000000..0108f1d --- /dev/null +++ b/vendor/github.com/go-openapi/jsonpointer/README.md @@ -0,0 +1,19 @@ +# gojsonpointer [![Build Status](https://github.com/go-openapi/jsonpointer/actions/workflows/go-test.yml/badge.svg)](https://github.com/go-openapi/jsonpointer/actions?query=workflow%3A"go+test") [![codecov](https://codecov.io/gh/go-openapi/jsonpointer/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/jsonpointer) + +[![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) +[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/jsonpointer/master/LICENSE) +[![Go Reference](https://pkg.go.dev/badge/github.com/go-openapi/jsonpointer.svg)](https://pkg.go.dev/github.com/go-openapi/jsonpointer) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/jsonpointer)](https://goreportcard.com/report/github.com/go-openapi/jsonpointer) + +An implementation of JSON Pointer - Go language + +## Status +Completed YES + +Tested YES + +## References +http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07 + +### Note +The 4.Evaluation part of the previous reference, starting with 'If the currently referenced value is a JSON array, the reference token MUST contain either...' is not implemented. diff --git a/vendor/github.com/go-openapi/jsonpointer/pointer.go b/vendor/github.com/go-openapi/jsonpointer/pointer.go new file mode 100644 index 0000000..d970c7c --- /dev/null +++ b/vendor/github.com/go-openapi/jsonpointer/pointer.go @@ -0,0 +1,531 @@ +// Copyright 2013 sigu-399 ( https://github.com/sigu-399 ) +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// author sigu-399 +// author-github https://github.com/sigu-399 +// author-mail sigu.399@gmail.com +// +// repository-name jsonpointer +// repository-desc An implementation of JSON Pointer - Go language +// +// description Main and unique file. +// +// created 25-02-2013 + +package jsonpointer + +import ( + "encoding/json" + "errors" + "fmt" + "reflect" + "strconv" + "strings" + + "github.com/go-openapi/swag" +) + +const ( + emptyPointer = `` + pointerSeparator = `/` + + invalidStart = `JSON pointer must be empty or start with a "` + pointerSeparator + notFound = `Can't find the pointer in the document` +) + +var jsonPointableType = reflect.TypeOf(new(JSONPointable)).Elem() +var jsonSetableType = reflect.TypeOf(new(JSONSetable)).Elem() + +// JSONPointable is an interface for structs to implement when they need to customize the +// json pointer process +type JSONPointable interface { + JSONLookup(string) (any, error) +} + +// JSONSetable is an interface for structs to implement when they need to customize the +// json pointer process +type JSONSetable interface { + JSONSet(string, any) error +} + +// New creates a new json pointer for the given string +func New(jsonPointerString string) (Pointer, error) { + + var p Pointer + err := p.parse(jsonPointerString) + return p, err + +} + +// Pointer the json pointer reprsentation +type Pointer struct { + referenceTokens []string +} + +// "Constructor", parses the given string JSON pointer +func (p *Pointer) parse(jsonPointerString string) error { + + var err error + + if jsonPointerString != emptyPointer { + if !strings.HasPrefix(jsonPointerString, pointerSeparator) { + err = errors.New(invalidStart) + } else { + referenceTokens := strings.Split(jsonPointerString, pointerSeparator) + p.referenceTokens = append(p.referenceTokens, referenceTokens[1:]...) + } + } + + return err +} + +// Get uses the pointer to retrieve a value from a JSON document +func (p *Pointer) Get(document any) (any, reflect.Kind, error) { + return p.get(document, swag.DefaultJSONNameProvider) +} + +// Set uses the pointer to set a value from a JSON document +func (p *Pointer) Set(document any, value any) (any, error) { + return document, p.set(document, value, swag.DefaultJSONNameProvider) +} + +// GetForToken gets a value for a json pointer token 1 level deep +func GetForToken(document any, decodedToken string) (any, reflect.Kind, error) { + return getSingleImpl(document, decodedToken, swag.DefaultJSONNameProvider) +} + +// SetForToken gets a value for a json pointer token 1 level deep +func SetForToken(document any, decodedToken string, value any) (any, error) { + return document, setSingleImpl(document, value, decodedToken, swag.DefaultJSONNameProvider) +} + +func isNil(input any) bool { + if input == nil { + return true + } + + kind := reflect.TypeOf(input).Kind() + switch kind { //nolint:exhaustive + case reflect.Ptr, reflect.Map, reflect.Slice, reflect.Chan: + return reflect.ValueOf(input).IsNil() + default: + return false + } +} + +func getSingleImpl(node any, decodedToken string, nameProvider *swag.NameProvider) (any, reflect.Kind, error) { + rValue := reflect.Indirect(reflect.ValueOf(node)) + kind := rValue.Kind() + if isNil(node) { + return nil, kind, fmt.Errorf("nil value has not field %q", decodedToken) + } + + switch typed := node.(type) { + case JSONPointable: + r, err := typed.JSONLookup(decodedToken) + if err != nil { + return nil, kind, err + } + return r, kind, nil + case *any: // case of a pointer to interface, that is not resolved by reflect.Indirect + return getSingleImpl(*typed, decodedToken, nameProvider) + } + + switch kind { //nolint:exhaustive + case reflect.Struct: + nm, ok := nameProvider.GetGoNameForType(rValue.Type(), decodedToken) + if !ok { + return nil, kind, fmt.Errorf("object has no field %q", decodedToken) + } + fld := rValue.FieldByName(nm) + return fld.Interface(), kind, nil + + case reflect.Map: + kv := reflect.ValueOf(decodedToken) + mv := rValue.MapIndex(kv) + + if mv.IsValid() { + return mv.Interface(), kind, nil + } + return nil, kind, fmt.Errorf("object has no key %q", decodedToken) + + case reflect.Slice: + tokenIndex, err := strconv.Atoi(decodedToken) + if err != nil { + return nil, kind, err + } + sLength := rValue.Len() + if tokenIndex < 0 || tokenIndex >= sLength { + return nil, kind, fmt.Errorf("index out of bounds array[0,%d] index '%d'", sLength-1, tokenIndex) + } + + elem := rValue.Index(tokenIndex) + return elem.Interface(), kind, nil + + default: + return nil, kind, fmt.Errorf("invalid token reference %q", decodedToken) + } + +} + +func setSingleImpl(node, data any, decodedToken string, nameProvider *swag.NameProvider) error { + rValue := reflect.Indirect(reflect.ValueOf(node)) + + if ns, ok := node.(JSONSetable); ok { // pointer impl + return ns.JSONSet(decodedToken, data) + } + + if rValue.Type().Implements(jsonSetableType) { + return node.(JSONSetable).JSONSet(decodedToken, data) + } + + switch rValue.Kind() { //nolint:exhaustive + case reflect.Struct: + nm, ok := nameProvider.GetGoNameForType(rValue.Type(), decodedToken) + if !ok { + return fmt.Errorf("object has no field %q", decodedToken) + } + fld := rValue.FieldByName(nm) + if fld.IsValid() { + fld.Set(reflect.ValueOf(data)) + } + return nil + + case reflect.Map: + kv := reflect.ValueOf(decodedToken) + rValue.SetMapIndex(kv, reflect.ValueOf(data)) + return nil + + case reflect.Slice: + tokenIndex, err := strconv.Atoi(decodedToken) + if err != nil { + return err + } + sLength := rValue.Len() + if tokenIndex < 0 || tokenIndex >= sLength { + return fmt.Errorf("index out of bounds array[0,%d] index '%d'", sLength, tokenIndex) + } + + elem := rValue.Index(tokenIndex) + if !elem.CanSet() { + return fmt.Errorf("can't set slice index %s to %v", decodedToken, data) + } + elem.Set(reflect.ValueOf(data)) + return nil + + default: + return fmt.Errorf("invalid token reference %q", decodedToken) + } + +} + +func (p *Pointer) get(node any, nameProvider *swag.NameProvider) (any, reflect.Kind, error) { + + if nameProvider == nil { + nameProvider = swag.DefaultJSONNameProvider + } + + kind := reflect.Invalid + + // Full document when empty + if len(p.referenceTokens) == 0 { + return node, kind, nil + } + + for _, token := range p.referenceTokens { + + decodedToken := Unescape(token) + + r, knd, err := getSingleImpl(node, decodedToken, nameProvider) + if err != nil { + return nil, knd, err + } + node = r + } + + rValue := reflect.ValueOf(node) + kind = rValue.Kind() + + return node, kind, nil +} + +func (p *Pointer) set(node, data any, nameProvider *swag.NameProvider) error { + knd := reflect.ValueOf(node).Kind() + + if knd != reflect.Ptr && knd != reflect.Struct && knd != reflect.Map && knd != reflect.Slice && knd != reflect.Array { + return errors.New("only structs, pointers, maps and slices are supported for setting values") + } + + if nameProvider == nil { + nameProvider = swag.DefaultJSONNameProvider + } + + // Full document when empty + if len(p.referenceTokens) == 0 { + return nil + } + + lastI := len(p.referenceTokens) - 1 + for i, token := range p.referenceTokens { + isLastToken := i == lastI + decodedToken := Unescape(token) + + if isLastToken { + + return setSingleImpl(node, data, decodedToken, nameProvider) + } + + rValue := reflect.Indirect(reflect.ValueOf(node)) + kind := rValue.Kind() + + if rValue.Type().Implements(jsonPointableType) { + r, err := node.(JSONPointable).JSONLookup(decodedToken) + if err != nil { + return err + } + fld := reflect.ValueOf(r) + if fld.CanAddr() && fld.Kind() != reflect.Interface && fld.Kind() != reflect.Map && fld.Kind() != reflect.Slice && fld.Kind() != reflect.Ptr { + node = fld.Addr().Interface() + continue + } + node = r + continue + } + + switch kind { //nolint:exhaustive + case reflect.Struct: + nm, ok := nameProvider.GetGoNameForType(rValue.Type(), decodedToken) + if !ok { + return fmt.Errorf("object has no field %q", decodedToken) + } + fld := rValue.FieldByName(nm) + if fld.CanAddr() && fld.Kind() != reflect.Interface && fld.Kind() != reflect.Map && fld.Kind() != reflect.Slice && fld.Kind() != reflect.Ptr { + node = fld.Addr().Interface() + continue + } + node = fld.Interface() + + case reflect.Map: + kv := reflect.ValueOf(decodedToken) + mv := rValue.MapIndex(kv) + + if !mv.IsValid() { + return fmt.Errorf("object has no key %q", decodedToken) + } + if mv.CanAddr() && mv.Kind() != reflect.Interface && mv.Kind() != reflect.Map && mv.Kind() != reflect.Slice && mv.Kind() != reflect.Ptr { + node = mv.Addr().Interface() + continue + } + node = mv.Interface() + + case reflect.Slice: + tokenIndex, err := strconv.Atoi(decodedToken) + if err != nil { + return err + } + sLength := rValue.Len() + if tokenIndex < 0 || tokenIndex >= sLength { + return fmt.Errorf("index out of bounds array[0,%d] index '%d'", sLength, tokenIndex) + } + + elem := rValue.Index(tokenIndex) + if elem.CanAddr() && elem.Kind() != reflect.Interface && elem.Kind() != reflect.Map && elem.Kind() != reflect.Slice && elem.Kind() != reflect.Ptr { + node = elem.Addr().Interface() + continue + } + node = elem.Interface() + + default: + return fmt.Errorf("invalid token reference %q", decodedToken) + } + + } + + return nil +} + +// DecodedTokens returns the decoded tokens +func (p *Pointer) DecodedTokens() []string { + result := make([]string, 0, len(p.referenceTokens)) + for _, t := range p.referenceTokens { + result = append(result, Unescape(t)) + } + return result +} + +// IsEmpty returns true if this is an empty json pointer +// this indicates that it points to the root document +func (p *Pointer) IsEmpty() bool { + return len(p.referenceTokens) == 0 +} + +// Pointer to string representation function +func (p *Pointer) String() string { + + if len(p.referenceTokens) == 0 { + return emptyPointer + } + + pointerString := pointerSeparator + strings.Join(p.referenceTokens, pointerSeparator) + + return pointerString +} + +func (p *Pointer) Offset(document string) (int64, error) { + dec := json.NewDecoder(strings.NewReader(document)) + var offset int64 + for _, ttk := range p.DecodedTokens() { + tk, err := dec.Token() + if err != nil { + return 0, err + } + switch tk := tk.(type) { + case json.Delim: + switch tk { + case '{': + offset, err = offsetSingleObject(dec, ttk) + if err != nil { + return 0, err + } + case '[': + offset, err = offsetSingleArray(dec, ttk) + if err != nil { + return 0, err + } + default: + return 0, fmt.Errorf("invalid token %#v", tk) + } + default: + return 0, fmt.Errorf("invalid token %#v", tk) + } + } + return offset, nil +} + +func offsetSingleObject(dec *json.Decoder, decodedToken string) (int64, error) { + for dec.More() { + offset := dec.InputOffset() + tk, err := dec.Token() + if err != nil { + return 0, err + } + switch tk := tk.(type) { + case json.Delim: + switch tk { + case '{': + if err = drainSingle(dec); err != nil { + return 0, err + } + case '[': + if err = drainSingle(dec); err != nil { + return 0, err + } + } + case string: + if tk == decodedToken { + return offset, nil + } + default: + return 0, fmt.Errorf("invalid token %#v", tk) + } + } + return 0, fmt.Errorf("token reference %q not found", decodedToken) +} + +func offsetSingleArray(dec *json.Decoder, decodedToken string) (int64, error) { + idx, err := strconv.Atoi(decodedToken) + if err != nil { + return 0, fmt.Errorf("token reference %q is not a number: %v", decodedToken, err) + } + var i int + for i = 0; i < idx && dec.More(); i++ { + tk, err := dec.Token() + if err != nil { + return 0, err + } + + if delim, isDelim := tk.(json.Delim); isDelim { + switch delim { + case '{': + if err = drainSingle(dec); err != nil { + return 0, err + } + case '[': + if err = drainSingle(dec); err != nil { + return 0, err + } + } + } + } + + if !dec.More() { + return 0, fmt.Errorf("token reference %q not found", decodedToken) + } + return dec.InputOffset(), nil +} + +// drainSingle drains a single level of object or array. +// The decoder has to guarantee the beginning delim (i.e. '{' or '[') has been consumed. +func drainSingle(dec *json.Decoder) error { + for dec.More() { + tk, err := dec.Token() + if err != nil { + return err + } + if delim, isDelim := tk.(json.Delim); isDelim { + switch delim { + case '{': + if err = drainSingle(dec); err != nil { + return err + } + case '[': + if err = drainSingle(dec); err != nil { + return err + } + } + } + } + + // Consumes the ending delim + if _, err := dec.Token(); err != nil { + return err + } + return nil +} + +// Specific JSON pointer encoding here +// ~0 => ~ +// ~1 => / +// ... and vice versa + +const ( + encRefTok0 = `~0` + encRefTok1 = `~1` + decRefTok0 = `~` + decRefTok1 = `/` +) + +// Unescape unescapes a json pointer reference token string to the original representation +func Unescape(token string) string { + step1 := strings.ReplaceAll(token, encRefTok1, decRefTok1) + step2 := strings.ReplaceAll(step1, encRefTok0, decRefTok0) + return step2 +} + +// Escape escapes a pointer reference token string +func Escape(token string) string { + step1 := strings.ReplaceAll(token, decRefTok0, encRefTok0) + step2 := strings.ReplaceAll(step1, decRefTok1, encRefTok1) + return step2 +} diff --git a/vendor/github.com/go-openapi/jsonreference/.gitignore b/vendor/github.com/go-openapi/jsonreference/.gitignore new file mode 100644 index 0000000..769c244 --- /dev/null +++ b/vendor/github.com/go-openapi/jsonreference/.gitignore @@ -0,0 +1 @@ +secrets.yml diff --git a/vendor/github.com/go-openapi/jsonreference/.golangci.yml b/vendor/github.com/go-openapi/jsonreference/.golangci.yml new file mode 100644 index 0000000..22f8d21 --- /dev/null +++ b/vendor/github.com/go-openapi/jsonreference/.golangci.yml @@ -0,0 +1,61 @@ +linters-settings: + govet: + check-shadowing: true + golint: + min-confidence: 0 + gocyclo: + min-complexity: 45 + maligned: + suggest-new: true + dupl: + threshold: 200 + goconst: + min-len: 2 + min-occurrences: 3 + +linters: + enable-all: true + disable: + - maligned + - unparam + - lll + - gochecknoinits + - gochecknoglobals + - funlen + - godox + - gocognit + - whitespace + - wsl + - wrapcheck + - testpackage + - nlreturn + - gomnd + - exhaustivestruct + - goerr113 + - errorlint + - nestif + - godot + - gofumpt + - paralleltest + - tparallel + - thelper + - ifshort + - exhaustruct + - varnamelen + - gci + - depguard + - errchkjson + - inamedparam + - nonamedreturns + - musttag + - ireturn + - forcetypeassert + - cyclop + # deprecated linters + - deadcode + - interfacer + - scopelint + - varcheck + - structcheck + - golint + - nosnakecase diff --git a/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..9322b06 --- /dev/null +++ b/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at ivan+abuse@flanders.co.nz. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/go-openapi/jsonreference/LICENSE b/vendor/github.com/go-openapi/jsonreference/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/vendor/github.com/go-openapi/jsonreference/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-openapi/jsonreference/README.md b/vendor/github.com/go-openapi/jsonreference/README.md new file mode 100644 index 0000000..c7fc204 --- /dev/null +++ b/vendor/github.com/go-openapi/jsonreference/README.md @@ -0,0 +1,19 @@ +# gojsonreference [![Build Status](https://github.com/go-openapi/jsonreference/actions/workflows/go-test.yml/badge.svg)](https://github.com/go-openapi/jsonreference/actions?query=workflow%3A"go+test") [![codecov](https://codecov.io/gh/go-openapi/jsonreference/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/jsonreference) + +[![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) +[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/jsonreference/master/LICENSE) +[![Go Reference](https://pkg.go.dev/badge/github.com/go-openapi/jsonreference.svg)](https://pkg.go.dev/github.com/go-openapi/jsonreference) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/jsonreference)](https://goreportcard.com/report/github.com/go-openapi/jsonreference) + +An implementation of JSON Reference - Go language + +## Status +Feature complete. Stable API + +## Dependencies +* https://github.com/go-openapi/jsonpointer + +## References + +* http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07 +* http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03 diff --git a/vendor/github.com/go-openapi/jsonreference/internal/normalize_url.go b/vendor/github.com/go-openapi/jsonreference/internal/normalize_url.go new file mode 100644 index 0000000..f0610cf --- /dev/null +++ b/vendor/github.com/go-openapi/jsonreference/internal/normalize_url.go @@ -0,0 +1,69 @@ +package internal + +import ( + "net/url" + "regexp" + "strings" +) + +const ( + defaultHTTPPort = ":80" + defaultHTTPSPort = ":443" +) + +// Regular expressions used by the normalizations +var rxPort = regexp.MustCompile(`(:\d+)/?$`) +var rxDupSlashes = regexp.MustCompile(`/{2,}`) + +// NormalizeURL will normalize the specified URL +// This was added to replace a previous call to the no longer maintained purell library: +// The call that was used looked like the following: +// +// url.Parse(purell.NormalizeURL(parsed, purell.FlagsSafe|purell.FlagRemoveDuplicateSlashes)) +// +// To explain all that was included in the call above, purell.FlagsSafe was really just the following: +// - FlagLowercaseScheme +// - FlagLowercaseHost +// - FlagRemoveDefaultPort +// - FlagRemoveDuplicateSlashes (and this was mixed in with the |) +// +// This also normalizes the URL into its urlencoded form by removing RawPath and RawFragment. +func NormalizeURL(u *url.URL) { + lowercaseScheme(u) + lowercaseHost(u) + removeDefaultPort(u) + removeDuplicateSlashes(u) + + u.RawPath = "" + u.RawFragment = "" +} + +func lowercaseScheme(u *url.URL) { + if len(u.Scheme) > 0 { + u.Scheme = strings.ToLower(u.Scheme) + } +} + +func lowercaseHost(u *url.URL) { + if len(u.Host) > 0 { + u.Host = strings.ToLower(u.Host) + } +} + +func removeDefaultPort(u *url.URL) { + if len(u.Host) > 0 { + scheme := strings.ToLower(u.Scheme) + u.Host = rxPort.ReplaceAllStringFunc(u.Host, func(val string) string { + if (scheme == "http" && val == defaultHTTPPort) || (scheme == "https" && val == defaultHTTPSPort) { + return "" + } + return val + }) + } +} + +func removeDuplicateSlashes(u *url.URL) { + if len(u.Path) > 0 { + u.Path = rxDupSlashes.ReplaceAllString(u.Path, "/") + } +} diff --git a/vendor/github.com/go-openapi/jsonreference/reference.go b/vendor/github.com/go-openapi/jsonreference/reference.go new file mode 100644 index 0000000..cfdef03 --- /dev/null +++ b/vendor/github.com/go-openapi/jsonreference/reference.go @@ -0,0 +1,158 @@ +// Copyright 2013 sigu-399 ( https://github.com/sigu-399 ) +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// author sigu-399 +// author-github https://github.com/sigu-399 +// author-mail sigu.399@gmail.com +// +// repository-name jsonreference +// repository-desc An implementation of JSON Reference - Go language +// +// description Main and unique file. +// +// created 26-02-2013 + +package jsonreference + +import ( + "errors" + "net/url" + "strings" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/jsonreference/internal" +) + +const ( + fragmentRune = `#` +) + +// New creates a new reference for the given string +func New(jsonReferenceString string) (Ref, error) { + + var r Ref + err := r.parse(jsonReferenceString) + return r, err + +} + +// MustCreateRef parses the ref string and panics when it's invalid. +// Use the New method for a version that returns an error +func MustCreateRef(ref string) Ref { + r, err := New(ref) + if err != nil { + panic(err) + } + return r +} + +// Ref represents a json reference object +type Ref struct { + referenceURL *url.URL + referencePointer jsonpointer.Pointer + + HasFullURL bool + HasURLPathOnly bool + HasFragmentOnly bool + HasFileScheme bool + HasFullFilePath bool +} + +// GetURL gets the URL for this reference +func (r *Ref) GetURL() *url.URL { + return r.referenceURL +} + +// GetPointer gets the json pointer for this reference +func (r *Ref) GetPointer() *jsonpointer.Pointer { + return &r.referencePointer +} + +// String returns the best version of the url for this reference +func (r *Ref) String() string { + + if r.referenceURL != nil { + return r.referenceURL.String() + } + + if r.HasFragmentOnly { + return fragmentRune + r.referencePointer.String() + } + + return r.referencePointer.String() +} + +// IsRoot returns true if this reference is a root document +func (r *Ref) IsRoot() bool { + return r.referenceURL != nil && + !r.IsCanonical() && + !r.HasURLPathOnly && + r.referenceURL.Fragment == "" +} + +// IsCanonical returns true when this pointer starts with http(s):// or file:// +func (r *Ref) IsCanonical() bool { + return (r.HasFileScheme && r.HasFullFilePath) || (!r.HasFileScheme && r.HasFullURL) +} + +// "Constructor", parses the given string JSON reference +func (r *Ref) parse(jsonReferenceString string) error { + + parsed, err := url.Parse(jsonReferenceString) + if err != nil { + return err + } + + internal.NormalizeURL(parsed) + + r.referenceURL = parsed + refURL := r.referenceURL + + if refURL.Scheme != "" && refURL.Host != "" { + r.HasFullURL = true + } else { + if refURL.Path != "" { + r.HasURLPathOnly = true + } else if refURL.RawQuery == "" && refURL.Fragment != "" { + r.HasFragmentOnly = true + } + } + + r.HasFileScheme = refURL.Scheme == "file" + r.HasFullFilePath = strings.HasPrefix(refURL.Path, "/") + + // invalid json-pointer error means url has no json-pointer fragment. simply ignore error + r.referencePointer, _ = jsonpointer.New(refURL.Fragment) + + return nil +} + +// Inherits creates a new reference from a parent and a child +// If the child cannot inherit from the parent, an error is returned +func (r *Ref) Inherits(child Ref) (*Ref, error) { + childURL := child.GetURL() + parentURL := r.GetURL() + if childURL == nil { + return nil, errors.New("child url is nil") + } + if parentURL == nil { + return &child, nil + } + + ref, err := New(parentURL.ResolveReference(childURL).String()) + if err != nil { + return nil, err + } + return &ref, nil +} diff --git a/vendor/github.com/go-openapi/loads/.editorconfig b/vendor/github.com/go-openapi/loads/.editorconfig new file mode 100644 index 0000000..3152da6 --- /dev/null +++ b/vendor/github.com/go-openapi/loads/.editorconfig @@ -0,0 +1,26 @@ +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + +# Set default charset +[*.{js,py,go,scala,rb,java,html,css,less,sass,md}] +charset = utf-8 + +# Tab indentation (no size specified) +[*.go] +indent_style = tab + +[*.md] +trim_trailing_whitespace = false + +# Matches the exact files either package.json or .travis.yml +[{package.json,.travis.yml}] +indent_style = space +indent_size = 2 diff --git a/vendor/github.com/go-openapi/loads/.gitignore b/vendor/github.com/go-openapi/loads/.gitignore new file mode 100644 index 0000000..e4f15f1 --- /dev/null +++ b/vendor/github.com/go-openapi/loads/.gitignore @@ -0,0 +1,4 @@ +secrets.yml +coverage.out +profile.cov +profile.out diff --git a/vendor/github.com/go-openapi/loads/.golangci.yml b/vendor/github.com/go-openapi/loads/.golangci.yml new file mode 100644 index 0000000..22f8d21 --- /dev/null +++ b/vendor/github.com/go-openapi/loads/.golangci.yml @@ -0,0 +1,61 @@ +linters-settings: + govet: + check-shadowing: true + golint: + min-confidence: 0 + gocyclo: + min-complexity: 45 + maligned: + suggest-new: true + dupl: + threshold: 200 + goconst: + min-len: 2 + min-occurrences: 3 + +linters: + enable-all: true + disable: + - maligned + - unparam + - lll + - gochecknoinits + - gochecknoglobals + - funlen + - godox + - gocognit + - whitespace + - wsl + - wrapcheck + - testpackage + - nlreturn + - gomnd + - exhaustivestruct + - goerr113 + - errorlint + - nestif + - godot + - gofumpt + - paralleltest + - tparallel + - thelper + - ifshort + - exhaustruct + - varnamelen + - gci + - depguard + - errchkjson + - inamedparam + - nonamedreturns + - musttag + - ireturn + - forcetypeassert + - cyclop + # deprecated linters + - deadcode + - interfacer + - scopelint + - varcheck + - structcheck + - golint + - nosnakecase diff --git a/vendor/github.com/go-openapi/loads/.travis.yml b/vendor/github.com/go-openapi/loads/.travis.yml new file mode 100644 index 0000000..cd4a7c3 --- /dev/null +++ b/vendor/github.com/go-openapi/loads/.travis.yml @@ -0,0 +1,25 @@ +after_success: +- bash <(curl -s https://codecov.io/bash) +go: +- 1.16.x +- 1.x +install: +- go get gotest.tools/gotestsum +language: go +arch: +- amd64 +- ppc64le +jobs: + include: + # include linting job, but only for latest go version and amd64 arch + - go: 1.x + arch: amd64 + install: + go get github.com/golangci/golangci-lint/cmd/golangci-lint + script: + - golangci-lint run --new-from-rev master +notifications: + slack: + secure: OxkPwVp35qBTUilgWC8xykSj+sGMcj0h8IIOKD+Rflx2schZVlFfdYdyVBM+s9OqeOfvtuvnR9v1Ye2rPKAvcjWdC4LpRGUsgmItZaI6Um8Aj6+K9udCw5qrtZVfOVmRu8LieH//XznWWKdOultUuniW0MLqw5+II87Gd00RWbCGi0hk0PykHe7uK+PDA2BEbqyZ2WKKYCvfB3j+0nrFOHScXqnh0V05l2E83J4+Sgy1fsPy+1WdX58ZlNBG333ibaC1FS79XvKSmTgKRkx3+YBo97u6ZtUmJa5WZjf2OdLG3KIckGWAv6R5xgxeU31N0Ng8L332w/Edpp2O/M2bZwdnKJ8hJQikXIAQbICbr+lTDzsoNzMdEIYcHpJ5hjPbiUl3Bmd+Jnsjf5McgAZDiWIfpCKZ29tPCEkVwRsOCqkyPRMNMzHHmoja495P5jR+ODS7+J8RFg5xgcnOgpP9D4Wlhztlf5WyZMpkLxTUD+bZq2SRf50HfHFXTkfq22zPl3d1eq0yrLwh/Z/fWKkfb6SyysROL8y6s8u3dpFX1YHSg0BR6i913h4aoZw9B2BG27cafLLTwKYsp2dFo1PWl4O6u9giFJIeqwloZHLKKrwh0cBFhB7RH0I58asxkZpCH6uWjJierahmHe7iS+E6i+9oCHkOZ59hmCYNimIs3hM= +script: +- gotestsum -f short-verbose -- -race -timeout=20m -coverprofile=coverage.txt -covermode=atomic ./... diff --git a/vendor/github.com/go-openapi/loads/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/loads/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..9322b06 --- /dev/null +++ b/vendor/github.com/go-openapi/loads/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at ivan+abuse@flanders.co.nz. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/go-openapi/loads/LICENSE b/vendor/github.com/go-openapi/loads/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/vendor/github.com/go-openapi/loads/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-openapi/loads/README.md b/vendor/github.com/go-openapi/loads/README.md new file mode 100644 index 0000000..f8bd440 --- /dev/null +++ b/vendor/github.com/go-openapi/loads/README.md @@ -0,0 +1,6 @@ +# Loads OAI specs [![Build Status](https://github.com/go-openapi/loads/actions/workflows/go-test.yml/badge.svg)](https://github.com/go-openapi/loads/actions?query=workflow%3A"go+test") [![codecov](https://codecov.io/gh/go-openapi/loads/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/loads) + +[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/loads/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/loads?status.svg)](http://godoc.org/github.com/go-openapi/loads) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/loads)](https://goreportcard.com/report/github.com/go-openapi/loads) + +Loading of OAI specification documents from local or remote locations. Supports JSON and YAML documents. diff --git a/vendor/github.com/go-openapi/loads/doc.go b/vendor/github.com/go-openapi/loads/doc.go new file mode 100644 index 0000000..5bcaef5 --- /dev/null +++ b/vendor/github.com/go-openapi/loads/doc.go @@ -0,0 +1,18 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package loads provides document loading methods for swagger (OAI) specifications. +// +// It is used by other go-openapi packages to load and run analysis on local or remote spec documents. +package loads diff --git a/vendor/github.com/go-openapi/loads/loaders.go b/vendor/github.com/go-openapi/loads/loaders.go new file mode 100644 index 0000000..b2d1e03 --- /dev/null +++ b/vendor/github.com/go-openapi/loads/loaders.go @@ -0,0 +1,133 @@ +package loads + +import ( + "encoding/json" + "errors" + "net/url" + + "github.com/go-openapi/spec" + "github.com/go-openapi/swag" +) + +var ( + // Default chain of loaders, defined at the package level. + // + // By default this matches json and yaml documents. + // + // May be altered with AddLoader(). + loaders *loader +) + +func init() { + jsonLoader := &loader{ + DocLoaderWithMatch: DocLoaderWithMatch{ + Match: func(_ string) bool { + return true + }, + Fn: JSONDoc, + }, + } + + loaders = jsonLoader.WithHead(&loader{ + DocLoaderWithMatch: DocLoaderWithMatch{ + Match: swag.YAMLMatcher, + Fn: swag.YAMLDoc, + }, + }) + + // sets the global default loader for go-openapi/spec + spec.PathLoader = loaders.Load +} + +// DocLoader represents a doc loader type +type DocLoader func(string) (json.RawMessage, error) + +// DocMatcher represents a predicate to check if a loader matches +type DocMatcher func(string) bool + +// DocLoaderWithMatch describes a loading function for a given extension match. +type DocLoaderWithMatch struct { + Fn DocLoader + Match DocMatcher +} + +// NewDocLoaderWithMatch builds a DocLoaderWithMatch to be used in load options +func NewDocLoaderWithMatch(fn DocLoader, matcher DocMatcher) DocLoaderWithMatch { + return DocLoaderWithMatch{ + Fn: fn, + Match: matcher, + } +} + +type loader struct { + DocLoaderWithMatch + Next *loader +} + +// WithHead adds a loader at the head of the current stack +func (l *loader) WithHead(head *loader) *loader { + if head == nil { + return l + } + head.Next = l + return head +} + +// WithNext adds a loader at the trail of the current stack +func (l *loader) WithNext(next *loader) *loader { + l.Next = next + return next +} + +// Load the raw document from path +func (l *loader) Load(path string) (json.RawMessage, error) { + _, erp := url.Parse(path) + if erp != nil { + return nil, erp + } + + lastErr := errors.New("no loader matched") // default error if no match was found + for ldr := l; ldr != nil; ldr = ldr.Next { + if ldr.Match != nil && !ldr.Match(path) { + continue + } + + // try then move to next one if there is an error + b, err := ldr.Fn(path) + if err == nil { + return b, nil + } + + lastErr = err + } + + return nil, lastErr +} + +// JSONDoc loads a json document from either a file or a remote url +func JSONDoc(path string) (json.RawMessage, error) { + data, err := swag.LoadFromFileOrHTTP(path) + if err != nil { + return nil, err + } + return json.RawMessage(data), nil +} + +// AddLoader for a document, executed before other previously set loaders. +// +// This sets the configuration at the package level. +// +// NOTE: +// - this updates the default loader used by github.com/go-openapi/spec +// - since this sets package level globals, you shouln't call this concurrently +func AddLoader(predicate DocMatcher, load DocLoader) { + loaders = loaders.WithHead(&loader{ + DocLoaderWithMatch: DocLoaderWithMatch{ + Match: predicate, + Fn: load, + }, + }) + + // sets the global default loader for go-openapi/spec + spec.PathLoader = loaders.Load +} diff --git a/vendor/github.com/go-openapi/loads/options.go b/vendor/github.com/go-openapi/loads/options.go new file mode 100644 index 0000000..f8305d5 --- /dev/null +++ b/vendor/github.com/go-openapi/loads/options.go @@ -0,0 +1,61 @@ +package loads + +type options struct { + loader *loader +} + +func defaultOptions() *options { + return &options{ + loader: loaders, + } +} + +func loaderFromOptions(options []LoaderOption) *loader { + opts := defaultOptions() + for _, apply := range options { + apply(opts) + } + + return opts.loader +} + +// LoaderOption allows to fine-tune the spec loader behavior +type LoaderOption func(*options) + +// WithDocLoader sets a custom loader for loading specs +func WithDocLoader(l DocLoader) LoaderOption { + return func(opt *options) { + if l == nil { + return + } + opt.loader = &loader{ + DocLoaderWithMatch: DocLoaderWithMatch{ + Fn: l, + }, + } + } +} + +// WithDocLoaderMatches sets a chain of custom loaders for loading specs +// for different extension matches. +// +// Loaders are executed in the order of provided DocLoaderWithMatch'es. +func WithDocLoaderMatches(l ...DocLoaderWithMatch) LoaderOption { + return func(opt *options) { + var final, prev *loader + for _, ldr := range l { + if ldr.Fn == nil { + continue + } + + if prev == nil { + final = &loader{DocLoaderWithMatch: ldr} + prev = final + continue + } + + prev = prev.WithNext(&loader{DocLoaderWithMatch: ldr}) + } + opt.loader = final + } +} diff --git a/vendor/github.com/go-openapi/loads/spec.go b/vendor/github.com/go-openapi/loads/spec.go new file mode 100644 index 0000000..c9039cd --- /dev/null +++ b/vendor/github.com/go-openapi/loads/spec.go @@ -0,0 +1,275 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package loads + +import ( + "bytes" + "encoding/gob" + "encoding/json" + "fmt" + + "github.com/go-openapi/analysis" + "github.com/go-openapi/spec" + "github.com/go-openapi/swag" +) + +func init() { + gob.Register(map[string]interface{}{}) + gob.Register([]interface{}{}) +} + +// Document represents a swagger spec document +type Document struct { + // specAnalyzer + Analyzer *analysis.Spec + spec *spec.Swagger + specFilePath string + origSpec *spec.Swagger + schema *spec.Schema + pathLoader *loader + raw json.RawMessage +} + +// JSONSpec loads a spec from a json document +func JSONSpec(path string, options ...LoaderOption) (*Document, error) { + data, err := JSONDoc(path) + if err != nil { + return nil, err + } + // convert to json + doc, err := Analyzed(data, "", options...) + if err != nil { + return nil, err + } + + doc.specFilePath = path + + return doc, nil +} + +// Embedded returns a Document based on embedded specs. No analysis is required +func Embedded(orig, flat json.RawMessage, options ...LoaderOption) (*Document, error) { + var origSpec, flatSpec spec.Swagger + if err := json.Unmarshal(orig, &origSpec); err != nil { + return nil, err + } + if err := json.Unmarshal(flat, &flatSpec); err != nil { + return nil, err + } + return &Document{ + raw: orig, + origSpec: &origSpec, + spec: &flatSpec, + pathLoader: loaderFromOptions(options), + }, nil +} + +// Spec loads a new spec document from a local or remote path +func Spec(path string, options ...LoaderOption) (*Document, error) { + ldr := loaderFromOptions(options) + + b, err := ldr.Load(path) + if err != nil { + return nil, err + } + + document, err := Analyzed(b, "", options...) + if err != nil { + return nil, err + } + + document.specFilePath = path + document.pathLoader = ldr + + return document, nil +} + +// Analyzed creates a new analyzed spec document for a root json.RawMessage. +func Analyzed(data json.RawMessage, version string, options ...LoaderOption) (*Document, error) { + if version == "" { + version = "2.0" + } + if version != "2.0" { + return nil, fmt.Errorf("spec version %q is not supported", version) + } + + raw, err := trimData(data) // trim blanks, then convert yaml docs into json + if err != nil { + return nil, err + } + + swspec := new(spec.Swagger) + if err = json.Unmarshal(raw, swspec); err != nil { + return nil, err + } + + origsqspec, err := cloneSpec(swspec) + if err != nil { + return nil, err + } + + d := &Document{ + Analyzer: analysis.New(swspec), // NOTE: at this moment, analysis does not follow $refs to documents outside the root doc + schema: spec.MustLoadSwagger20Schema(), + spec: swspec, + raw: raw, + origSpec: origsqspec, + pathLoader: loaderFromOptions(options), + } + + return d, nil +} + +func trimData(in json.RawMessage) (json.RawMessage, error) { + trimmed := bytes.TrimSpace(in) + if len(trimmed) == 0 { + return in, nil + } + + if trimmed[0] == '{' || trimmed[0] == '[' { + return trimmed, nil + } + + // assume yaml doc: convert it to json + yml, err := swag.BytesToYAMLDoc(trimmed) + if err != nil { + return nil, fmt.Errorf("analyzed: %v", err) + } + + d, err := swag.YAMLToJSON(yml) + if err != nil { + return nil, fmt.Errorf("analyzed: %v", err) + } + + return d, nil +} + +// Expanded expands the $ref fields in the spec document and returns a new spec document +func (d *Document) Expanded(options ...*spec.ExpandOptions) (*Document, error) { + swspec := new(spec.Swagger) + if err := json.Unmarshal(d.raw, swspec); err != nil { + return nil, err + } + + var expandOptions *spec.ExpandOptions + if len(options) > 0 { + expandOptions = options[0] + if expandOptions.RelativeBase == "" { + expandOptions.RelativeBase = d.specFilePath + } + } else { + expandOptions = &spec.ExpandOptions{ + RelativeBase: d.specFilePath, + } + } + + if expandOptions.PathLoader == nil { + if d.pathLoader != nil { + // use loader from Document options + expandOptions.PathLoader = d.pathLoader.Load + } else { + // use package level loader + expandOptions.PathLoader = loaders.Load + } + } + + if err := spec.ExpandSpec(swspec, expandOptions); err != nil { + return nil, err + } + + dd := &Document{ + Analyzer: analysis.New(swspec), + spec: swspec, + specFilePath: d.specFilePath, + schema: spec.MustLoadSwagger20Schema(), + raw: d.raw, + origSpec: d.origSpec, + } + return dd, nil +} + +// BasePath the base path for the API specified by this spec +func (d *Document) BasePath() string { + return d.spec.BasePath +} + +// Version returns the version of this spec +func (d *Document) Version() string { + return d.spec.Swagger +} + +// Schema returns the swagger 2.0 schema +func (d *Document) Schema() *spec.Schema { + return d.schema +} + +// Spec returns the swagger spec object model +func (d *Document) Spec() *spec.Swagger { + return d.spec +} + +// Host returns the host for the API +func (d *Document) Host() string { + return d.spec.Host +} + +// Raw returns the raw swagger spec as json bytes +func (d *Document) Raw() json.RawMessage { + return d.raw +} + +// OrigSpec yields the original spec +func (d *Document) OrigSpec() *spec.Swagger { + return d.origSpec +} + +// ResetDefinitions gives a shallow copy with the models reset to the original spec +func (d *Document) ResetDefinitions() *Document { + defs := make(map[string]spec.Schema, len(d.origSpec.Definitions)) + for k, v := range d.origSpec.Definitions { + defs[k] = v + } + + d.spec.Definitions = defs + return d +} + +// Pristine creates a new pristine document instance based on the input data +func (d *Document) Pristine() *Document { + raw, _ := json.Marshal(d.Spec()) + dd, _ := Analyzed(raw, d.Version()) + dd.pathLoader = d.pathLoader + dd.specFilePath = d.specFilePath + + return dd +} + +// SpecFilePath returns the file path of the spec if one is defined +func (d *Document) SpecFilePath() string { + return d.specFilePath +} + +func cloneSpec(src *spec.Swagger) (*spec.Swagger, error) { + var b bytes.Buffer + if err := gob.NewEncoder(&b).Encode(src); err != nil { + return nil, err + } + + var dst spec.Swagger + if err := gob.NewDecoder(&b).Decode(&dst); err != nil { + return nil, err + } + return &dst, nil +} diff --git a/vendor/github.com/go-openapi/runtime/.editorconfig b/vendor/github.com/go-openapi/runtime/.editorconfig new file mode 100644 index 0000000..3152da6 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/.editorconfig @@ -0,0 +1,26 @@ +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + +# Set default charset +[*.{js,py,go,scala,rb,java,html,css,less,sass,md}] +charset = utf-8 + +# Tab indentation (no size specified) +[*.go] +indent_style = tab + +[*.md] +trim_trailing_whitespace = false + +# Matches the exact files either package.json or .travis.yml +[{package.json,.travis.yml}] +indent_style = space +indent_size = 2 diff --git a/vendor/github.com/go-openapi/runtime/.gitattributes b/vendor/github.com/go-openapi/runtime/.gitattributes new file mode 100644 index 0000000..d207b18 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/.gitattributes @@ -0,0 +1 @@ +*.go text eol=lf diff --git a/vendor/github.com/go-openapi/runtime/.gitignore b/vendor/github.com/go-openapi/runtime/.gitignore new file mode 100644 index 0000000..fea8b84 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/.gitignore @@ -0,0 +1,5 @@ +secrets.yml +coverage.out +*.cov +*.out +playground diff --git a/vendor/github.com/go-openapi/runtime/.golangci.yml b/vendor/github.com/go-openapi/runtime/.golangci.yml new file mode 100644 index 0000000..1c75557 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/.golangci.yml @@ -0,0 +1,62 @@ +linters-settings: + govet: + check-shadowing: true + golint: + min-confidence: 0 + gocyclo: + min-complexity: 45 + maligned: + suggest-new: true + dupl: + threshold: 200 + goconst: + min-len: 2 + min-occurrences: 3 + +linters: + enable-all: true + disable: + - nilerr # nilerr crashes on this repo + - maligned + - unparam + - lll + - gochecknoinits + - gochecknoglobals + - funlen + - godox + - gocognit + - whitespace + - wsl + - wrapcheck + - testpackage + - nlreturn + - gomnd + - exhaustivestruct + - goerr113 + - errorlint + - nestif + - godot + - gofumpt + - paralleltest + - tparallel + - thelper + - ifshort + - exhaustruct + - varnamelen + - gci + - depguard + - errchkjson + - inamedparam + - nonamedreturns + - musttag + - ireturn + - forcetypeassert + - cyclop + # deprecated linters + - deadcode + - interfacer + - scopelint + - varcheck + - structcheck + - golint + - nosnakecase diff --git a/vendor/github.com/go-openapi/runtime/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/runtime/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..9322b06 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at ivan+abuse@flanders.co.nz. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/go-openapi/runtime/LICENSE b/vendor/github.com/go-openapi/runtime/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-openapi/runtime/README.md b/vendor/github.com/go-openapi/runtime/README.md new file mode 100644 index 0000000..b07e0ad --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/README.md @@ -0,0 +1,10 @@ +# runtime [![Build Status](https://github.com/go-openapi/runtime/actions/workflows/go-test.yml/badge.svg)](https://github.com/go-openapi/runtime/actions?query=workflow%3A"go+test") [![codecov](https://codecov.io/gh/go-openapi/runtime/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/runtime) + +[![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) +[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/runtime/master/LICENSE) +[![Go Reference](https://pkg.go.dev/badge/github.com/go-openapi/runtime.svg)](https://pkg.go.dev/github.com/go-openapi/runtime) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/runtime)](https://goreportcard.com/report/github.com/go-openapi/runtime) + +# go OpenAPI toolkit runtime + +The runtime component for use in code generation or as untyped usage. diff --git a/vendor/github.com/go-openapi/runtime/bytestream.go b/vendor/github.com/go-openapi/runtime/bytestream.go new file mode 100644 index 0000000..f8fb482 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/bytestream.go @@ -0,0 +1,222 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "bytes" + "encoding" + "errors" + "fmt" + "io" + "reflect" + + "github.com/go-openapi/swag" +) + +func defaultCloser() error { return nil } + +type byteStreamOpt func(opts *byteStreamOpts) + +// ClosesStream when the bytestream consumer or producer is finished +func ClosesStream(opts *byteStreamOpts) { + opts.Close = true +} + +type byteStreamOpts struct { + Close bool +} + +// ByteStreamConsumer creates a consumer for byte streams. +// +// The consumer consumes from a provided reader into the data passed by reference. +// +// Supported output underlying types and interfaces, prioritized in this order: +// - io.ReaderFrom (for maximum control) +// - io.Writer (performs io.Copy) +// - encoding.BinaryUnmarshaler +// - *string +// - *[]byte +func ByteStreamConsumer(opts ...byteStreamOpt) Consumer { + var vals byteStreamOpts + for _, opt := range opts { + opt(&vals) + } + + return ConsumerFunc(func(reader io.Reader, data interface{}) error { + if reader == nil { + return errors.New("ByteStreamConsumer requires a reader") // early exit + } + if data == nil { + return errors.New("nil destination for ByteStreamConsumer") + } + + closer := defaultCloser + if vals.Close { + if cl, isReaderCloser := reader.(io.Closer); isReaderCloser { + closer = cl.Close + } + } + defer func() { + _ = closer() + }() + + if readerFrom, isReaderFrom := data.(io.ReaderFrom); isReaderFrom { + _, err := readerFrom.ReadFrom(reader) + return err + } + + if writer, isDataWriter := data.(io.Writer); isDataWriter { + _, err := io.Copy(writer, reader) + return err + } + + // buffers input before writing to data + var buf bytes.Buffer + _, err := buf.ReadFrom(reader) + if err != nil { + return err + } + b := buf.Bytes() + + switch destinationPointer := data.(type) { + case encoding.BinaryUnmarshaler: + return destinationPointer.UnmarshalBinary(b) + case *any: + switch (*destinationPointer).(type) { + case string: + *destinationPointer = string(b) + + return nil + + case []byte: + *destinationPointer = b + + return nil + } + default: + // check for the underlying type to be pointer to []byte or string, + if ptr := reflect.TypeOf(data); ptr.Kind() != reflect.Ptr { + return errors.New("destination must be a pointer") + } + + v := reflect.Indirect(reflect.ValueOf(data)) + t := v.Type() + + switch { + case t.Kind() == reflect.Slice && t.Elem().Kind() == reflect.Uint8: + v.SetBytes(b) + return nil + + case t.Kind() == reflect.String: + v.SetString(string(b)) + return nil + } + } + + return fmt.Errorf("%v (%T) is not supported by the ByteStreamConsumer, %s", + data, data, "can be resolved by supporting Writer/BinaryUnmarshaler interface") + }) +} + +// ByteStreamProducer creates a producer for byte streams. +// +// The producer takes input data then writes to an output writer (essentially as a pipe). +// +// Supported input underlying types and interfaces, prioritized in this order: +// - io.WriterTo (for maximum control) +// - io.Reader (performs io.Copy). A ReadCloser is closed before exiting. +// - encoding.BinaryMarshaler +// - error (writes as a string) +// - []byte +// - string +// - struct, other slices: writes as JSON +func ByteStreamProducer(opts ...byteStreamOpt) Producer { + var vals byteStreamOpts + for _, opt := range opts { + opt(&vals) + } + + return ProducerFunc(func(writer io.Writer, data interface{}) error { + if writer == nil { + return errors.New("ByteStreamProducer requires a writer") // early exit + } + if data == nil { + return errors.New("nil data for ByteStreamProducer") + } + + closer := defaultCloser + if vals.Close { + if cl, isWriterCloser := writer.(io.Closer); isWriterCloser { + closer = cl.Close + } + } + defer func() { + _ = closer() + }() + + if rc, isDataCloser := data.(io.ReadCloser); isDataCloser { + defer rc.Close() + } + + switch origin := data.(type) { + case io.WriterTo: + _, err := origin.WriteTo(writer) + return err + + case io.Reader: + _, err := io.Copy(writer, origin) + return err + + case encoding.BinaryMarshaler: + bytes, err := origin.MarshalBinary() + if err != nil { + return err + } + + _, err = writer.Write(bytes) + return err + + case error: + _, err := writer.Write([]byte(origin.Error())) + return err + + default: + v := reflect.Indirect(reflect.ValueOf(data)) + t := v.Type() + + switch { + case t.Kind() == reflect.Slice && t.Elem().Kind() == reflect.Uint8: + _, err := writer.Write(v.Bytes()) + return err + + case t.Kind() == reflect.String: + _, err := writer.Write([]byte(v.String())) + return err + + case t.Kind() == reflect.Struct || t.Kind() == reflect.Slice: + b, err := swag.WriteJSON(data) + if err != nil { + return err + } + + _, err = writer.Write(b) + return err + } + } + + return fmt.Errorf("%v (%T) is not supported by the ByteStreamProducer, %s", + data, data, "can be resolved by supporting Reader/BinaryMarshaler interface") + }) +} diff --git a/vendor/github.com/go-openapi/runtime/client/auth_info.go b/vendor/github.com/go-openapi/runtime/client/auth_info.go new file mode 100644 index 0000000..4f26e92 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client/auth_info.go @@ -0,0 +1,77 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "encoding/base64" + + "github.com/go-openapi/strfmt" + + "github.com/go-openapi/runtime" +) + +// PassThroughAuth never manipulates the request +var PassThroughAuth runtime.ClientAuthInfoWriter + +func init() { + PassThroughAuth = runtime.ClientAuthInfoWriterFunc(func(_ runtime.ClientRequest, _ strfmt.Registry) error { return nil }) +} + +// BasicAuth provides a basic auth info writer +func BasicAuth(username, password string) runtime.ClientAuthInfoWriter { + return runtime.ClientAuthInfoWriterFunc(func(r runtime.ClientRequest, _ strfmt.Registry) error { + encoded := base64.StdEncoding.EncodeToString([]byte(username + ":" + password)) + return r.SetHeaderParam(runtime.HeaderAuthorization, "Basic "+encoded) + }) +} + +// APIKeyAuth provides an API key auth info writer +func APIKeyAuth(name, in, value string) runtime.ClientAuthInfoWriter { + if in == "query" { + return runtime.ClientAuthInfoWriterFunc(func(r runtime.ClientRequest, _ strfmt.Registry) error { + return r.SetQueryParam(name, value) + }) + } + + if in == "header" { + return runtime.ClientAuthInfoWriterFunc(func(r runtime.ClientRequest, _ strfmt.Registry) error { + return r.SetHeaderParam(name, value) + }) + } + return nil +} + +// BearerToken provides a header based oauth2 bearer access token auth info writer +func BearerToken(token string) runtime.ClientAuthInfoWriter { + return runtime.ClientAuthInfoWriterFunc(func(r runtime.ClientRequest, _ strfmt.Registry) error { + return r.SetHeaderParam(runtime.HeaderAuthorization, "Bearer "+token) + }) +} + +// Compose combines multiple ClientAuthInfoWriters into a single one. +// Useful when multiple auth headers are needed. +func Compose(auths ...runtime.ClientAuthInfoWriter) runtime.ClientAuthInfoWriter { + return runtime.ClientAuthInfoWriterFunc(func(r runtime.ClientRequest, _ strfmt.Registry) error { + for _, auth := range auths { + if auth == nil { + continue + } + if err := auth.AuthenticateRequest(r, nil); err != nil { + return err + } + } + return nil + }) +} diff --git a/vendor/github.com/go-openapi/runtime/client/keepalive.go b/vendor/github.com/go-openapi/runtime/client/keepalive.go new file mode 100644 index 0000000..7dd6b51 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client/keepalive.go @@ -0,0 +1,54 @@ +package client + +import ( + "io" + "net/http" + "sync/atomic" +) + +// KeepAliveTransport drains the remaining body from a response +// so that go will reuse the TCP connections. +// This is not enabled by default because there are servers where +// the response never gets closed and that would make the code hang forever. +// So instead it's provided as a http client middleware that can be used to override +// any request. +func KeepAliveTransport(rt http.RoundTripper) http.RoundTripper { + return &keepAliveTransport{wrapped: rt} +} + +type keepAliveTransport struct { + wrapped http.RoundTripper +} + +func (k *keepAliveTransport) RoundTrip(r *http.Request) (*http.Response, error) { + resp, err := k.wrapped.RoundTrip(r) + if err != nil { + return resp, err + } + resp.Body = &drainingReadCloser{rdr: resp.Body} + return resp, nil +} + +type drainingReadCloser struct { + rdr io.ReadCloser + seenEOF uint32 +} + +func (d *drainingReadCloser) Read(p []byte) (n int, err error) { + n, err = d.rdr.Read(p) + if err == io.EOF || n == 0 { + atomic.StoreUint32(&d.seenEOF, 1) + } + return +} + +func (d *drainingReadCloser) Close() error { + // drain buffer + if atomic.LoadUint32(&d.seenEOF) != 1 { + // If the reader side (a HTTP server) is misbehaving, it still may send + // some bytes, but the closer ignores them to keep the underling + // connection open. + _, _ = io.Copy(io.Discard, d.rdr) + } + return d.rdr.Close() +} diff --git a/vendor/github.com/go-openapi/runtime/client/opentelemetry.go b/vendor/github.com/go-openapi/runtime/client/opentelemetry.go new file mode 100644 index 0000000..256cd1b --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client/opentelemetry.go @@ -0,0 +1,211 @@ +package client + +import ( + "fmt" + "net/http" + "strings" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/propagation" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + "go.opentelemetry.io/otel/semconv/v1.17.0/httpconv" + "go.opentelemetry.io/otel/trace" +) + +const ( + instrumentationVersion = "1.0.0" + tracerName = "go-openapi" +) + +type config struct { + Tracer trace.Tracer + Propagator propagation.TextMapPropagator + SpanStartOptions []trace.SpanStartOption + SpanNameFormatter func(*runtime.ClientOperation) string + TracerProvider trace.TracerProvider +} + +type OpenTelemetryOpt interface { + apply(*config) +} + +type optionFunc func(*config) + +func (o optionFunc) apply(c *config) { + o(c) +} + +// WithTracerProvider specifies a tracer provider to use for creating a tracer. +// If none is specified, the global provider is used. +func WithTracerProvider(provider trace.TracerProvider) OpenTelemetryOpt { + return optionFunc(func(c *config) { + if provider != nil { + c.TracerProvider = provider + } + }) +} + +// WithPropagators configures specific propagators. If this +// option isn't specified, then the global TextMapPropagator is used. +func WithPropagators(ps propagation.TextMapPropagator) OpenTelemetryOpt { + return optionFunc(func(c *config) { + if ps != nil { + c.Propagator = ps + } + }) +} + +// WithSpanOptions configures an additional set of +// trace.SpanOptions, which are applied to each new span. +func WithSpanOptions(opts ...trace.SpanStartOption) OpenTelemetryOpt { + return optionFunc(func(c *config) { + c.SpanStartOptions = append(c.SpanStartOptions, opts...) + }) +} + +// WithSpanNameFormatter takes a function that will be called on every +// request and the returned string will become the Span Name. +func WithSpanNameFormatter(f func(op *runtime.ClientOperation) string) OpenTelemetryOpt { + return optionFunc(func(c *config) { + c.SpanNameFormatter = f + }) +} + +func defaultTransportFormatter(op *runtime.ClientOperation) string { + if op.ID != "" { + return op.ID + } + + return fmt.Sprintf("%s_%s", strings.ToLower(op.Method), op.PathPattern) +} + +type openTelemetryTransport struct { + transport runtime.ClientTransport + host string + tracer trace.Tracer + config *config +} + +func newOpenTelemetryTransport(transport runtime.ClientTransport, host string, opts []OpenTelemetryOpt) *openTelemetryTransport { + tr := &openTelemetryTransport{ + transport: transport, + host: host, + } + + defaultOpts := []OpenTelemetryOpt{ + WithSpanOptions(trace.WithSpanKind(trace.SpanKindClient)), + WithSpanNameFormatter(defaultTransportFormatter), + WithPropagators(otel.GetTextMapPropagator()), + WithTracerProvider(otel.GetTracerProvider()), + } + + c := newConfig(append(defaultOpts, opts...)...) + tr.config = c + + return tr +} + +func (t *openTelemetryTransport) Submit(op *runtime.ClientOperation) (interface{}, error) { + if op.Context == nil { + return t.transport.Submit(op) + } + + params := op.Params + reader := op.Reader + + var span trace.Span + defer func() { + if span != nil { + span.End() + } + }() + + op.Params = runtime.ClientRequestWriterFunc(func(req runtime.ClientRequest, reg strfmt.Registry) error { + span = t.newOpenTelemetrySpan(op, req.GetHeaderParams()) + return params.WriteToRequest(req, reg) + }) + + op.Reader = runtime.ClientResponseReaderFunc(func(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + if span != nil { + statusCode := response.Code() + // NOTE: this is replaced by semconv.HTTPResponseStatusCode in semconv v1.21 + span.SetAttributes(semconv.HTTPStatusCode(statusCode)) + // NOTE: the conversion from HTTP status code to trace code is no longer available with + // semconv v1.21 + span.SetStatus(httpconv.ServerStatus(statusCode)) + } + + return reader.ReadResponse(response, consumer) + }) + + submit, err := t.transport.Submit(op) + if err != nil && span != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + } + + return submit, err +} + +func (t *openTelemetryTransport) newOpenTelemetrySpan(op *runtime.ClientOperation, header http.Header) trace.Span { + ctx := op.Context + + tracer := t.tracer + if tracer == nil { + if span := trace.SpanFromContext(ctx); span.SpanContext().IsValid() { + tracer = newTracer(span.TracerProvider()) + } else { + tracer = newTracer(otel.GetTracerProvider()) + } + } + + ctx, span := tracer.Start(ctx, t.config.SpanNameFormatter(op), t.config.SpanStartOptions...) + + var scheme string + if len(op.Schemes) > 0 { + scheme = op.Schemes[0] + } + + span.SetAttributes( + attribute.String("net.peer.name", t.host), + attribute.String(string(semconv.HTTPRouteKey), op.PathPattern), + attribute.String(string(semconv.HTTPMethodKey), op.Method), + attribute.String("span.kind", trace.SpanKindClient.String()), + attribute.String("http.scheme", scheme), + ) + + carrier := propagation.HeaderCarrier(header) + t.config.Propagator.Inject(ctx, carrier) + + return span +} + +func newTracer(tp trace.TracerProvider) trace.Tracer { + return tp.Tracer(tracerName, trace.WithInstrumentationVersion(version())) +} + +func newConfig(opts ...OpenTelemetryOpt) *config { + c := &config{ + Propagator: otel.GetTextMapPropagator(), + } + + for _, opt := range opts { + opt.apply(c) + } + + // Tracer is only initialized if manually specified. Otherwise, can be passed with the tracing context. + if c.TracerProvider != nil { + c.Tracer = newTracer(c.TracerProvider) + } + + return c +} + +// Version is the current release version of the go-runtime instrumentation. +func version() string { + return instrumentationVersion +} diff --git a/vendor/github.com/go-openapi/runtime/client/opentracing.go b/vendor/github.com/go-openapi/runtime/client/opentracing.go new file mode 100644 index 0000000..627286d --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client/opentracing.go @@ -0,0 +1,99 @@ +package client + +import ( + "fmt" + "net/http" + + "github.com/go-openapi/strfmt" + "github.com/opentracing/opentracing-go" + "github.com/opentracing/opentracing-go/ext" + "github.com/opentracing/opentracing-go/log" + + "github.com/go-openapi/runtime" +) + +type tracingTransport struct { + transport runtime.ClientTransport + host string + opts []opentracing.StartSpanOption +} + +func newOpenTracingTransport(transport runtime.ClientTransport, host string, opts []opentracing.StartSpanOption, +) runtime.ClientTransport { + return &tracingTransport{ + transport: transport, + host: host, + opts: opts, + } +} + +func (t *tracingTransport) Submit(op *runtime.ClientOperation) (interface{}, error) { + if op.Context == nil { + return t.transport.Submit(op) + } + + params := op.Params + reader := op.Reader + + var span opentracing.Span + defer func() { + if span != nil { + span.Finish() + } + }() + + op.Params = runtime.ClientRequestWriterFunc(func(req runtime.ClientRequest, reg strfmt.Registry) error { + span = createClientSpan(op, req.GetHeaderParams(), t.host, t.opts) + return params.WriteToRequest(req, reg) + }) + + op.Reader = runtime.ClientResponseReaderFunc(func(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + if span != nil { + code := response.Code() + ext.HTTPStatusCode.Set(span, uint16(code)) + if code >= 400 { + ext.Error.Set(span, true) + } + } + return reader.ReadResponse(response, consumer) + }) + + submit, err := t.transport.Submit(op) + if err != nil && span != nil { + ext.Error.Set(span, true) + span.LogFields(log.Error(err)) + } + return submit, err +} + +func createClientSpan(op *runtime.ClientOperation, header http.Header, host string, + opts []opentracing.StartSpanOption) opentracing.Span { + ctx := op.Context + span := opentracing.SpanFromContext(ctx) + + if span != nil { + opts = append(opts, ext.SpanKindRPCClient) + span, _ = opentracing.StartSpanFromContextWithTracer( + ctx, span.Tracer(), operationName(op), opts...) + + ext.Component.Set(span, "go-openapi") + ext.PeerHostname.Set(span, host) + span.SetTag("http.path", op.PathPattern) + ext.HTTPMethod.Set(span, op.Method) + + _ = span.Tracer().Inject( + span.Context(), + opentracing.HTTPHeaders, + opentracing.HTTPHeadersCarrier(header)) + + return span + } + return nil +} + +func operationName(op *runtime.ClientOperation) string { + if op.ID != "" { + return op.ID + } + return fmt.Sprintf("%s_%s", op.Method, op.PathPattern) +} diff --git a/vendor/github.com/go-openapi/runtime/client/request.go b/vendor/github.com/go-openapi/runtime/client/request.go new file mode 100644 index 0000000..c4a891d --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client/request.go @@ -0,0 +1,482 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "bytes" + "context" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/textproto" + "net/url" + "os" + "path" + "path/filepath" + "strings" + "time" + + "github.com/go-openapi/strfmt" + + "github.com/go-openapi/runtime" +) + +// NewRequest creates a new swagger http client request +func newRequest(method, pathPattern string, writer runtime.ClientRequestWriter) *request { + return &request{ + pathPattern: pathPattern, + method: method, + writer: writer, + header: make(http.Header), + query: make(url.Values), + timeout: DefaultTimeout, + getBody: getRequestBuffer, + } +} + +// Request represents a swagger client request. +// +// This Request struct converts to a HTTP request. +// There might be others that convert to other transports. +// There is no error checking here, it is assumed to be used after a spec has been validated. +// so impossible combinations should not arise (hopefully). +// +// The main purpose of this struct is to hide the machinery of adding params to a transport request. +// The generated code only implements what is necessary to turn a param into a valid value for these methods. +type request struct { + pathPattern string + method string + writer runtime.ClientRequestWriter + + pathParams map[string]string + header http.Header + query url.Values + formFields url.Values + fileFields map[string][]runtime.NamedReadCloser + payload interface{} + timeout time.Duration + buf *bytes.Buffer + + getBody func(r *request) []byte +} + +var ( + // ensure interface compliance + _ runtime.ClientRequest = new(request) +) + +func (r *request) isMultipart(mediaType string) bool { + if len(r.fileFields) > 0 { + return true + } + + return runtime.MultipartFormMime == mediaType +} + +// BuildHTTP creates a new http request based on the data from the params +func (r *request) BuildHTTP(mediaType, basePath string, producers map[string]runtime.Producer, registry strfmt.Registry) (*http.Request, error) { + return r.buildHTTP(mediaType, basePath, producers, registry, nil) +} +func escapeQuotes(s string) string { + return strings.NewReplacer("\\", "\\\\", `"`, "\\\"").Replace(s) +} + +func logClose(err error, pw *io.PipeWriter) { + log.Println(err) + closeErr := pw.CloseWithError(err) + if closeErr != nil { + log.Println(closeErr) + } +} + +func (r *request) buildHTTP(mediaType, basePath string, producers map[string]runtime.Producer, registry strfmt.Registry, auth runtime.ClientAuthInfoWriter) (*http.Request, error) { //nolint:gocyclo,maintidx + // build the data + if err := r.writer.WriteToRequest(r, registry); err != nil { + return nil, err + } + + // Our body must be an io.Reader. + // When we create the http.Request, if we pass it a + // bytes.Buffer then it will wrap it in an io.ReadCloser + // and set the content length automatically. + var body io.Reader + var pr *io.PipeReader + var pw *io.PipeWriter + + r.buf = bytes.NewBuffer(nil) + if r.payload != nil || len(r.formFields) > 0 || len(r.fileFields) > 0 { + body = r.buf + if r.isMultipart(mediaType) { + pr, pw = io.Pipe() + body = pr + } + } + + // check if this is a form type request + if len(r.formFields) > 0 || len(r.fileFields) > 0 { + if !r.isMultipart(mediaType) { + r.header.Set(runtime.HeaderContentType, mediaType) + formString := r.formFields.Encode() + r.buf.WriteString(formString) + goto DoneChoosingBodySource + } + + mp := multipart.NewWriter(pw) + r.header.Set(runtime.HeaderContentType, mangleContentType(mediaType, mp.Boundary())) + + go func() { + defer func() { + mp.Close() + pw.Close() + }() + + for fn, v := range r.formFields { + for _, vi := range v { + if err := mp.WriteField(fn, vi); err != nil { + logClose(err, pw) + return + } + } + } + + defer func() { + for _, ff := range r.fileFields { + for _, ffi := range ff { + ffi.Close() + } + } + }() + for fn, f := range r.fileFields { + for _, fi := range f { + var fileContentType string + if p, ok := fi.(interface { + ContentType() string + }); ok { + fileContentType = p.ContentType() + } else { + // Need to read the data so that we can detect the content type + buf := make([]byte, 512) + size, err := fi.Read(buf) + if err != nil && err != io.EOF { + logClose(err, pw) + return + } + fileContentType = http.DetectContentType(buf) + fi = runtime.NamedReader(fi.Name(), io.MultiReader(bytes.NewReader(buf[:size]), fi)) + } + + // Create the MIME headers for the new part + h := make(textproto.MIMEHeader) + h.Set("Content-Disposition", + fmt.Sprintf(`form-data; name="%s"; filename="%s"`, + escapeQuotes(fn), escapeQuotes(filepath.Base(fi.Name())))) + h.Set("Content-Type", fileContentType) + + wrtr, err := mp.CreatePart(h) + if err != nil { + logClose(err, pw) + return + } + if _, err := io.Copy(wrtr, fi); err != nil { + logClose(err, pw) + } + } + } + }() + + goto DoneChoosingBodySource + } + + // if there is payload, use the producer to write the payload, and then + // set the header to the content-type appropriate for the payload produced + if r.payload != nil { + // TODO: infer most appropriate content type based on the producer used, + // and the `consumers` section of the spec/operation + r.header.Set(runtime.HeaderContentType, mediaType) + if rdr, ok := r.payload.(io.ReadCloser); ok { + body = rdr + goto DoneChoosingBodySource + } + + if rdr, ok := r.payload.(io.Reader); ok { + body = rdr + goto DoneChoosingBodySource + } + + producer := producers[mediaType] + if err := producer.Produce(r.buf, r.payload); err != nil { + return nil, err + } + } + +DoneChoosingBodySource: + + if runtime.CanHaveBody(r.method) && body != nil && r.header.Get(runtime.HeaderContentType) == "" { + r.header.Set(runtime.HeaderContentType, mediaType) + } + + if auth != nil { + // If we're not using r.buf as our http.Request's body, + // either the payload is an io.Reader or io.ReadCloser, + // or we're doing a multipart form/file. + // + // In those cases, if the AuthenticateRequest call asks for the body, + // we must read it into a buffer and provide that, then use that buffer + // as the body of our http.Request. + // + // This is done in-line with the GetBody() request rather than ahead + // of time, because there's no way to know if the AuthenticateRequest + // will even ask for the body of the request. + // + // If for some reason the copy fails, there's no way to return that + // error to the GetBody() call, so return it afterwards. + // + // An error from the copy action is prioritized over any error + // from the AuthenticateRequest call, because the mis-read + // body may have interfered with the auth. + // + var copyErr error + if buf, ok := body.(*bytes.Buffer); body != nil && (!ok || buf != r.buf) { + var copied bool + r.getBody = func(r *request) []byte { + if copied { + return getRequestBuffer(r) + } + + defer func() { + copied = true + }() + + if _, copyErr = io.Copy(r.buf, body); copyErr != nil { + return nil + } + + if closer, ok := body.(io.ReadCloser); ok { + if copyErr = closer.Close(); copyErr != nil { + return nil + } + } + + body = r.buf + return getRequestBuffer(r) + } + } + + authErr := auth.AuthenticateRequest(r, registry) + + if copyErr != nil { + return nil, fmt.Errorf("error retrieving the response body: %v", copyErr) + } + + if authErr != nil { + return nil, authErr + } + } + + // In case the basePath or the request pathPattern include static query parameters, + // parse those out before constructing the final path. The parameters themselves + // will be merged with the ones set by the client, with the priority given first to + // the ones set by the client, then the path pattern, and lastly the base path. + basePathURL, err := url.Parse(basePath) + if err != nil { + return nil, err + } + staticQueryParams := basePathURL.Query() + + pathPatternURL, err := url.Parse(r.pathPattern) + if err != nil { + return nil, err + } + for name, values := range pathPatternURL.Query() { + if _, present := staticQueryParams[name]; present { + staticQueryParams.Del(name) + } + for _, value := range values { + staticQueryParams.Add(name, value) + } + } + + // create http request + var reinstateSlash bool + if pathPatternURL.Path != "" && pathPatternURL.Path != "/" && pathPatternURL.Path[len(pathPatternURL.Path)-1] == '/' { + reinstateSlash = true + } + + urlPath := path.Join(basePathURL.Path, pathPatternURL.Path) + for k, v := range r.pathParams { + urlPath = strings.ReplaceAll(urlPath, "{"+k+"}", url.PathEscape(v)) + } + if reinstateSlash { + urlPath += "/" + } + + req, err := http.NewRequestWithContext(context.Background(), r.method, urlPath, body) + if err != nil { + return nil, err + } + + originalParams := r.GetQueryParams() + + // Merge the query parameters extracted from the basePath with the ones set by + // the client in this struct. In case of conflict, the client wins. + for k, v := range staticQueryParams { + _, present := originalParams[k] + if !present { + if err = r.SetQueryParam(k, v...); err != nil { + return nil, err + } + } + } + + req.URL.RawQuery = r.query.Encode() + req.Header = r.header + + return req, nil +} + +func mangleContentType(mediaType, boundary string) string { + if strings.ToLower(mediaType) == runtime.URLencodedFormMime { + return fmt.Sprintf("%s; boundary=%s", mediaType, boundary) + } + return "multipart/form-data; boundary=" + boundary +} + +func (r *request) GetMethod() string { + return r.method +} + +func (r *request) GetPath() string { + path := r.pathPattern + for k, v := range r.pathParams { + path = strings.ReplaceAll(path, "{"+k+"}", v) + } + return path +} + +func (r *request) GetBody() []byte { + return r.getBody(r) +} + +func getRequestBuffer(r *request) []byte { + if r.buf == nil { + return nil + } + return r.buf.Bytes() +} + +// SetHeaderParam adds a header param to the request +// when there is only 1 value provided for the varargs, it will set it. +// when there are several values provided for the varargs it will add it (no overriding) +func (r *request) SetHeaderParam(name string, values ...string) error { + if r.header == nil { + r.header = make(http.Header) + } + r.header[http.CanonicalHeaderKey(name)] = values + return nil +} + +// GetHeaderParams returns the all headers currently set for the request +func (r *request) GetHeaderParams() http.Header { + return r.header +} + +// SetQueryParam adds a query param to the request +// when there is only 1 value provided for the varargs, it will set it. +// when there are several values provided for the varargs it will add it (no overriding) +func (r *request) SetQueryParam(name string, values ...string) error { + if r.query == nil { + r.query = make(url.Values) + } + r.query[name] = values + return nil +} + +// GetQueryParams returns a copy of all query params currently set for the request +func (r *request) GetQueryParams() url.Values { + var result = make(url.Values) + for key, value := range r.query { + result[key] = append([]string{}, value...) + } + return result +} + +// SetFormParam adds a forn param to the request +// when there is only 1 value provided for the varargs, it will set it. +// when there are several values provided for the varargs it will add it (no overriding) +func (r *request) SetFormParam(name string, values ...string) error { + if r.formFields == nil { + r.formFields = make(url.Values) + } + r.formFields[name] = values + return nil +} + +// SetPathParam adds a path param to the request +func (r *request) SetPathParam(name string, value string) error { + if r.pathParams == nil { + r.pathParams = make(map[string]string) + } + + r.pathParams[name] = value + return nil +} + +// SetFileParam adds a file param to the request +func (r *request) SetFileParam(name string, files ...runtime.NamedReadCloser) error { + for _, file := range files { + if actualFile, ok := file.(*os.File); ok { + fi, err := os.Stat(actualFile.Name()) + if err != nil { + return err + } + if fi.IsDir() { + return fmt.Errorf("%q is a directory, only files are supported", file.Name()) + } + } + } + + if r.fileFields == nil { + r.fileFields = make(map[string][]runtime.NamedReadCloser) + } + if r.formFields == nil { + r.formFields = make(url.Values) + } + + r.fileFields[name] = files + return nil +} + +func (r *request) GetFileParam() map[string][]runtime.NamedReadCloser { + return r.fileFields +} + +// SetBodyParam sets a body parameter on the request. +// This does not yet serialze the object, this happens as late as possible. +func (r *request) SetBodyParam(payload interface{}) error { + r.payload = payload + return nil +} + +func (r *request) GetBodyParam() interface{} { + return r.payload +} + +// SetTimeout sets the timeout for a request +func (r *request) SetTimeout(timeout time.Duration) error { + r.timeout = timeout + return nil +} diff --git a/vendor/github.com/go-openapi/runtime/client/response.go b/vendor/github.com/go-openapi/runtime/client/response.go new file mode 100644 index 0000000..0bbd388 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client/response.go @@ -0,0 +1,50 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "io" + "net/http" + + "github.com/go-openapi/runtime" +) + +var _ runtime.ClientResponse = response{} + +func newResponse(resp *http.Response) runtime.ClientResponse { return response{resp: resp} } + +type response struct { + resp *http.Response +} + +func (r response) Code() int { + return r.resp.StatusCode +} + +func (r response) Message() string { + return r.resp.Status +} + +func (r response) GetHeader(name string) string { + return r.resp.Header.Get(name) +} + +func (r response) GetHeaders(name string) []string { + return r.resp.Header.Values(name) +} + +func (r response) Body() io.ReadCloser { + return r.resp.Body +} diff --git a/vendor/github.com/go-openapi/runtime/client/runtime.go b/vendor/github.com/go-openapi/runtime/client/runtime.go new file mode 100644 index 0000000..5bd4d75 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client/runtime.go @@ -0,0 +1,552 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "context" + "crypto" + "crypto/ecdsa" + "crypto/rsa" + "crypto/tls" + "crypto/x509" + "encoding/pem" + "errors" + "fmt" + "mime" + "net/http" + "net/http/httputil" + "os" + "strings" + "sync" + "time" + + "github.com/go-openapi/strfmt" + "github.com/opentracing/opentracing-go" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/logger" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/yamlpc" +) + +const ( + schemeHTTP = "http" + schemeHTTPS = "https" +) + +// TLSClientOptions to configure client authentication with mutual TLS +type TLSClientOptions struct { + // Certificate is the path to a PEM-encoded certificate to be used for + // client authentication. If set then Key must also be set. + Certificate string + + // LoadedCertificate is the certificate to be used for client authentication. + // This field is ignored if Certificate is set. If this field is set, LoadedKey + // is also required. + LoadedCertificate *x509.Certificate + + // Key is the path to an unencrypted PEM-encoded private key for client + // authentication. This field is required if Certificate is set. + Key string + + // LoadedKey is the key for client authentication. This field is required if + // LoadedCertificate is set. + LoadedKey crypto.PrivateKey + + // CA is a path to a PEM-encoded certificate that specifies the root certificate + // to use when validating the TLS certificate presented by the server. If this field + // (and LoadedCA) is not set, the system certificate pool is used. This field is ignored if LoadedCA + // is set. + CA string + + // LoadedCA specifies the root certificate to use when validating the server's TLS certificate. + // If this field (and CA) is not set, the system certificate pool is used. + LoadedCA *x509.Certificate + + // LoadedCAPool specifies a pool of RootCAs to use when validating the server's TLS certificate. + // If set, it will be combined with the other loaded certificates (see LoadedCA and CA). + // If neither LoadedCA or CA is set, the provided pool with override the system + // certificate pool. + // The caller must not use the supplied pool after calling TLSClientAuth. + LoadedCAPool *x509.CertPool + + // ServerName specifies the hostname to use when verifying the server certificate. + // If this field is set then InsecureSkipVerify will be ignored and treated as + // false. + ServerName string + + // InsecureSkipVerify controls whether the certificate chain and hostname presented + // by the server are validated. If true, any certificate is accepted. + InsecureSkipVerify bool + + // VerifyPeerCertificate, if not nil, is called after normal + // certificate verification. It receives the raw ASN.1 certificates + // provided by the peer and also any verified chains that normal processing found. + // If it returns a non-nil error, the handshake is aborted and that error results. + // + // If normal verification fails then the handshake will abort before + // considering this callback. If normal verification is disabled by + // setting InsecureSkipVerify then this callback will be considered but + // the verifiedChains argument will always be nil. + VerifyPeerCertificate func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error + + // SessionTicketsDisabled may be set to true to disable session ticket and + // PSK (resumption) support. Note that on clients, session ticket support is + // also disabled if ClientSessionCache is nil. + SessionTicketsDisabled bool + + // ClientSessionCache is a cache of ClientSessionState entries for TLS + // session resumption. It is only used by clients. + ClientSessionCache tls.ClientSessionCache + + // Prevents callers using unkeyed fields. + _ struct{} +} + +// TLSClientAuth creates a tls.Config for mutual auth +func TLSClientAuth(opts TLSClientOptions) (*tls.Config, error) { + // create client tls config + cfg := &tls.Config{ + MinVersion: tls.VersionTLS12, + } + + // load client cert if specified + if opts.Certificate != "" { + cert, err := tls.LoadX509KeyPair(opts.Certificate, opts.Key) + if err != nil { + return nil, fmt.Errorf("tls client cert: %v", err) + } + cfg.Certificates = []tls.Certificate{cert} + } else if opts.LoadedCertificate != nil { + block := pem.Block{Type: "CERTIFICATE", Bytes: opts.LoadedCertificate.Raw} + certPem := pem.EncodeToMemory(&block) + + var keyBytes []byte + switch k := opts.LoadedKey.(type) { + case *rsa.PrivateKey: + keyBytes = x509.MarshalPKCS1PrivateKey(k) + case *ecdsa.PrivateKey: + var err error + keyBytes, err = x509.MarshalECPrivateKey(k) + if err != nil { + return nil, fmt.Errorf("tls client priv key: %v", err) + } + default: + return nil, errors.New("tls client priv key: unsupported key type") + } + + block = pem.Block{Type: "PRIVATE KEY", Bytes: keyBytes} + keyPem := pem.EncodeToMemory(&block) + + cert, err := tls.X509KeyPair(certPem, keyPem) + if err != nil { + return nil, fmt.Errorf("tls client cert: %v", err) + } + cfg.Certificates = []tls.Certificate{cert} + } + + cfg.InsecureSkipVerify = opts.InsecureSkipVerify + + cfg.VerifyPeerCertificate = opts.VerifyPeerCertificate + cfg.SessionTicketsDisabled = opts.SessionTicketsDisabled + cfg.ClientSessionCache = opts.ClientSessionCache + + // When no CA certificate is provided, default to the system cert pool + // that way when a request is made to a server known by the system trust store, + // the name is still verified + switch { + case opts.LoadedCA != nil: + caCertPool := basePool(opts.LoadedCAPool) + caCertPool.AddCert(opts.LoadedCA) + cfg.RootCAs = caCertPool + case opts.CA != "": + // load ca cert + caCert, err := os.ReadFile(opts.CA) + if err != nil { + return nil, fmt.Errorf("tls client ca: %v", err) + } + caCertPool := basePool(opts.LoadedCAPool) + caCertPool.AppendCertsFromPEM(caCert) + cfg.RootCAs = caCertPool + case opts.LoadedCAPool != nil: + cfg.RootCAs = opts.LoadedCAPool + } + + // apply servername overrride + if opts.ServerName != "" { + cfg.InsecureSkipVerify = false + cfg.ServerName = opts.ServerName + } + + return cfg, nil +} + +func basePool(pool *x509.CertPool) *x509.CertPool { + if pool == nil { + return x509.NewCertPool() + } + return pool +} + +// TLSTransport creates a http client transport suitable for mutual tls auth +func TLSTransport(opts TLSClientOptions) (http.RoundTripper, error) { + cfg, err := TLSClientAuth(opts) + if err != nil { + return nil, err + } + + return &http.Transport{TLSClientConfig: cfg}, nil +} + +// TLSClient creates a http.Client for mutual auth +func TLSClient(opts TLSClientOptions) (*http.Client, error) { + transport, err := TLSTransport(opts) + if err != nil { + return nil, err + } + return &http.Client{Transport: transport}, nil +} + +// DefaultTimeout the default request timeout +var DefaultTimeout = 30 * time.Second + +// Runtime represents an API client that uses the transport +// to make http requests based on a swagger specification. +type Runtime struct { + DefaultMediaType string + DefaultAuthentication runtime.ClientAuthInfoWriter + Consumers map[string]runtime.Consumer + Producers map[string]runtime.Producer + + Transport http.RoundTripper + Jar http.CookieJar + // Spec *spec.Document + Host string + BasePath string + Formats strfmt.Registry + Context context.Context //nolint:containedctx // we precisely want this type to contain the request context + + Debug bool + logger logger.Logger + + clientOnce *sync.Once + client *http.Client + schemes []string + response ClientResponseFunc +} + +// New creates a new default runtime for a swagger api runtime.Client +func New(host, basePath string, schemes []string) *Runtime { + var rt Runtime + rt.DefaultMediaType = runtime.JSONMime + + // TODO: actually infer this stuff from the spec + rt.Consumers = map[string]runtime.Consumer{ + runtime.YAMLMime: yamlpc.YAMLConsumer(), + runtime.JSONMime: runtime.JSONConsumer(), + runtime.XMLMime: runtime.XMLConsumer(), + runtime.TextMime: runtime.TextConsumer(), + runtime.HTMLMime: runtime.TextConsumer(), + runtime.CSVMime: runtime.CSVConsumer(), + runtime.DefaultMime: runtime.ByteStreamConsumer(), + } + rt.Producers = map[string]runtime.Producer{ + runtime.YAMLMime: yamlpc.YAMLProducer(), + runtime.JSONMime: runtime.JSONProducer(), + runtime.XMLMime: runtime.XMLProducer(), + runtime.TextMime: runtime.TextProducer(), + runtime.HTMLMime: runtime.TextProducer(), + runtime.CSVMime: runtime.CSVProducer(), + runtime.DefaultMime: runtime.ByteStreamProducer(), + } + rt.Transport = http.DefaultTransport + rt.Jar = nil + rt.Host = host + rt.BasePath = basePath + rt.Context = context.Background() + rt.clientOnce = new(sync.Once) + if !strings.HasPrefix(rt.BasePath, "/") { + rt.BasePath = "/" + rt.BasePath + } + + rt.Debug = logger.DebugEnabled() + rt.logger = logger.StandardLogger{} + rt.response = newResponse + + if len(schemes) > 0 { + rt.schemes = schemes + } + return &rt +} + +// NewWithClient allows you to create a new transport with a configured http.Client +func NewWithClient(host, basePath string, schemes []string, client *http.Client) *Runtime { + rt := New(host, basePath, schemes) + if client != nil { + rt.clientOnce.Do(func() { + rt.client = client + }) + } + return rt +} + +// WithOpenTracing adds opentracing support to the provided runtime. +// A new client span is created for each request. +// If the context of the client operation does not contain an active span, no span is created. +// The provided opts are applied to each spans - for example to add global tags. +func (r *Runtime) WithOpenTracing(opts ...opentracing.StartSpanOption) runtime.ClientTransport { + return newOpenTracingTransport(r, r.Host, opts) +} + +// WithOpenTelemetry adds opentelemetry support to the provided runtime. +// A new client span is created for each request. +// If the context of the client operation does not contain an active span, no span is created. +// The provided opts are applied to each spans - for example to add global tags. +func (r *Runtime) WithOpenTelemetry(opts ...OpenTelemetryOpt) runtime.ClientTransport { + return newOpenTelemetryTransport(r, r.Host, opts) +} + +func (r *Runtime) pickScheme(schemes []string) string { + if v := r.selectScheme(r.schemes); v != "" { + return v + } + if v := r.selectScheme(schemes); v != "" { + return v + } + return schemeHTTP +} + +func (r *Runtime) selectScheme(schemes []string) string { + schLen := len(schemes) + if schLen == 0 { + return "" + } + + scheme := schemes[0] + // prefer https, but skip when not possible + if scheme != schemeHTTPS && schLen > 1 { + for _, sch := range schemes { + if sch == schemeHTTPS { + scheme = sch + break + } + } + } + return scheme +} + +func transportOrDefault(left, right http.RoundTripper) http.RoundTripper { + if left == nil { + return right + } + return left +} + +// EnableConnectionReuse drains the remaining body from a response +// so that go will reuse the TCP connections. +// +// This is not enabled by default because there are servers where +// the response never gets closed and that would make the code hang forever. +// So instead it's provided as a http client middleware that can be used to override +// any request. +func (r *Runtime) EnableConnectionReuse() { + if r.client == nil { + r.Transport = KeepAliveTransport( + transportOrDefault(r.Transport, http.DefaultTransport), + ) + return + } + + r.client.Transport = KeepAliveTransport( + transportOrDefault(r.client.Transport, + transportOrDefault(r.Transport, http.DefaultTransport), + ), + ) +} + +// takes a client operation and creates equivalent http.Request +func (r *Runtime) createHttpRequest(operation *runtime.ClientOperation) (*request, *http.Request, error) { //nolint:revive,stylecheck + params, _, auth := operation.Params, operation.Reader, operation.AuthInfo + + request := newRequest(operation.Method, operation.PathPattern, params) + + var accept []string + accept = append(accept, operation.ProducesMediaTypes...) + if err := request.SetHeaderParam(runtime.HeaderAccept, accept...); err != nil { + return nil, nil, err + } + + if auth == nil && r.DefaultAuthentication != nil { + auth = runtime.ClientAuthInfoWriterFunc(func(req runtime.ClientRequest, reg strfmt.Registry) error { + if req.GetHeaderParams().Get(runtime.HeaderAuthorization) != "" { + return nil + } + return r.DefaultAuthentication.AuthenticateRequest(req, reg) + }) + } + // if auth != nil { + // if err := auth.AuthenticateRequest(request, r.Formats); err != nil { + // return nil, err + // } + //} + + // TODO: pick appropriate media type + cmt := r.DefaultMediaType + for _, mediaType := range operation.ConsumesMediaTypes { + // Pick first non-empty media type + if mediaType != "" { + cmt = mediaType + break + } + } + + if _, ok := r.Producers[cmt]; !ok && cmt != runtime.MultipartFormMime && cmt != runtime.URLencodedFormMime { + return nil, nil, fmt.Errorf("none of producers: %v registered. try %s", r.Producers, cmt) + } + + req, err := request.buildHTTP(cmt, r.BasePath, r.Producers, r.Formats, auth) + if err != nil { + return nil, nil, err + } + req.URL.Scheme = r.pickScheme(operation.Schemes) + req.URL.Host = r.Host + req.Host = r.Host + return request, req, nil +} + +func (r *Runtime) CreateHttpRequest(operation *runtime.ClientOperation) (req *http.Request, err error) { //nolint:revive,stylecheck + _, req, err = r.createHttpRequest(operation) + return +} + +// Submit a request and when there is a body on success it will turn that into the result +// all other things are turned into an api error for swagger which retains the status code +func (r *Runtime) Submit(operation *runtime.ClientOperation) (interface{}, error) { + _, readResponse, _ := operation.Params, operation.Reader, operation.AuthInfo + + request, req, err := r.createHttpRequest(operation) + if err != nil { + return nil, err + } + + r.clientOnce.Do(func() { + r.client = &http.Client{ + Transport: r.Transport, + Jar: r.Jar, + } + }) + + if r.Debug { + b, err2 := httputil.DumpRequestOut(req, true) + if err2 != nil { + return nil, err2 + } + r.logger.Debugf("%s\n", string(b)) + } + + var parentCtx context.Context + switch { + case operation.Context != nil: + parentCtx = operation.Context + case r.Context != nil: + parentCtx = r.Context + default: + parentCtx = context.Background() + } + + var ( + ctx context.Context + cancel context.CancelFunc + ) + if request.timeout == 0 { + // There may be a deadline in the context passed to the operation. + // Otherwise, there is no timeout set. + ctx, cancel = context.WithCancel(parentCtx) + } else { + // Sets the timeout passed from request params (by default runtime.DefaultTimeout). + // If there is already a deadline in the parent context, the shortest will + // apply. + ctx, cancel = context.WithTimeout(parentCtx, request.timeout) + } + defer cancel() + + var client *http.Client + if operation.Client != nil { + client = operation.Client + } else { + client = r.client + } + req = req.WithContext(ctx) + res, err := client.Do(req) // make requests, by default follows 10 redirects before failing + if err != nil { + return nil, err + } + defer res.Body.Close() + + ct := res.Header.Get(runtime.HeaderContentType) + if ct == "" { // this should really never occur + ct = r.DefaultMediaType + } + + if r.Debug { + printBody := true + if ct == runtime.DefaultMime { + printBody = false // Spare the terminal from a binary blob. + } + b, err2 := httputil.DumpResponse(res, printBody) + if err2 != nil { + return nil, err2 + } + r.logger.Debugf("%s\n", string(b)) + } + + mt, _, err := mime.ParseMediaType(ct) + if err != nil { + return nil, fmt.Errorf("parse content type: %s", err) + } + + cons, ok := r.Consumers[mt] + if !ok { + if cons, ok = r.Consumers["*/*"]; !ok { + // scream about not knowing what to do + return nil, fmt.Errorf("no consumer: %q", ct) + } + } + return readResponse.ReadResponse(r.response(res), cons) +} + +// SetDebug changes the debug flag. +// It ensures that client and middlewares have the set debug level. +func (r *Runtime) SetDebug(debug bool) { + r.Debug = debug + middleware.Debug = debug +} + +// SetLogger changes the logger stream. +// It ensures that client and middlewares use the same logger. +func (r *Runtime) SetLogger(logger logger.Logger) { + r.logger = logger + middleware.Logger = logger +} + +type ClientResponseFunc = func(*http.Response) runtime.ClientResponse //nolint:revive + +// SetResponseReader changes the response reader implementation. +func (r *Runtime) SetResponseReader(f ClientResponseFunc) { + if f == nil { + return + } + r.response = f +} diff --git a/vendor/github.com/go-openapi/runtime/client_auth_info.go b/vendor/github.com/go-openapi/runtime/client_auth_info.go new file mode 100644 index 0000000..c6c97d9 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client_auth_info.go @@ -0,0 +1,30 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import "github.com/go-openapi/strfmt" + +// A ClientAuthInfoWriterFunc converts a function to a request writer interface +type ClientAuthInfoWriterFunc func(ClientRequest, strfmt.Registry) error + +// AuthenticateRequest adds authentication data to the request +func (fn ClientAuthInfoWriterFunc) AuthenticateRequest(req ClientRequest, reg strfmt.Registry) error { + return fn(req, reg) +} + +// A ClientAuthInfoWriter implementor knows how to write authentication info to a request +type ClientAuthInfoWriter interface { + AuthenticateRequest(ClientRequest, strfmt.Registry) error +} diff --git a/vendor/github.com/go-openapi/runtime/client_operation.go b/vendor/github.com/go-openapi/runtime/client_operation.go new file mode 100644 index 0000000..5a5d635 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client_operation.go @@ -0,0 +1,41 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "context" + "net/http" +) + +// ClientOperation represents the context for a swagger operation to be submitted to the transport +type ClientOperation struct { + ID string + Method string + PathPattern string + ProducesMediaTypes []string + ConsumesMediaTypes []string + Schemes []string + AuthInfo ClientAuthInfoWriter + Params ClientRequestWriter + Reader ClientResponseReader + Context context.Context //nolint:containedctx // we precisely want this type to contain the request context + Client *http.Client +} + +// A ClientTransport implementor knows how to submit Request objects to some destination +type ClientTransport interface { + // Submit(string, RequestWriter, ResponseReader, AuthInfoWriter) (interface{}, error) + Submit(*ClientOperation) (interface{}, error) +} diff --git a/vendor/github.com/go-openapi/runtime/client_request.go b/vendor/github.com/go-openapi/runtime/client_request.go new file mode 100644 index 0000000..4ebb2de --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client_request.go @@ -0,0 +1,152 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "io" + "net/http" + "net/url" + "time" + + "github.com/go-openapi/strfmt" +) + +// ClientRequestWriterFunc converts a function to a request writer interface +type ClientRequestWriterFunc func(ClientRequest, strfmt.Registry) error + +// WriteToRequest adds data to the request +func (fn ClientRequestWriterFunc) WriteToRequest(req ClientRequest, reg strfmt.Registry) error { + return fn(req, reg) +} + +// ClientRequestWriter is an interface for things that know how to write to a request +type ClientRequestWriter interface { + WriteToRequest(ClientRequest, strfmt.Registry) error +} + +// ClientRequest is an interface for things that know how to +// add information to a swagger client request. +type ClientRequest interface { //nolint:interfacebloat // a swagger-capable request is quite rich, hence the many getter/setters + SetHeaderParam(string, ...string) error + + GetHeaderParams() http.Header + + SetQueryParam(string, ...string) error + + SetFormParam(string, ...string) error + + SetPathParam(string, string) error + + GetQueryParams() url.Values + + SetFileParam(string, ...NamedReadCloser) error + + SetBodyParam(interface{}) error + + SetTimeout(time.Duration) error + + GetMethod() string + + GetPath() string + + GetBody() []byte + + GetBodyParam() interface{} + + GetFileParam() map[string][]NamedReadCloser +} + +// NamedReadCloser represents a named ReadCloser interface +type NamedReadCloser interface { + io.ReadCloser + Name() string +} + +// NamedReader creates a NamedReadCloser for use as file upload +func NamedReader(name string, rdr io.Reader) NamedReadCloser { + rc, ok := rdr.(io.ReadCloser) + if !ok { + rc = io.NopCloser(rdr) + } + return &namedReadCloser{ + name: name, + cr: rc, + } +} + +type namedReadCloser struct { + name string + cr io.ReadCloser +} + +func (n *namedReadCloser) Close() error { + return n.cr.Close() +} +func (n *namedReadCloser) Read(p []byte) (int, error) { + return n.cr.Read(p) +} +func (n *namedReadCloser) Name() string { + return n.name +} + +type TestClientRequest struct { + Headers http.Header + Body interface{} +} + +func (t *TestClientRequest) SetHeaderParam(name string, values ...string) error { + if t.Headers == nil { + t.Headers = make(http.Header) + } + t.Headers.Set(name, values[0]) + return nil +} + +func (t *TestClientRequest) SetQueryParam(_ string, _ ...string) error { return nil } + +func (t *TestClientRequest) SetFormParam(_ string, _ ...string) error { return nil } + +func (t *TestClientRequest) SetPathParam(_ string, _ string) error { return nil } + +func (t *TestClientRequest) SetFileParam(_ string, _ ...NamedReadCloser) error { return nil } + +func (t *TestClientRequest) SetBodyParam(body interface{}) error { + t.Body = body + return nil +} + +func (t *TestClientRequest) SetTimeout(time.Duration) error { + return nil +} + +func (t *TestClientRequest) GetQueryParams() url.Values { return nil } + +func (t *TestClientRequest) GetMethod() string { return "" } + +func (t *TestClientRequest) GetPath() string { return "" } + +func (t *TestClientRequest) GetBody() []byte { return nil } + +func (t *TestClientRequest) GetBodyParam() interface{} { + return t.Body +} + +func (t *TestClientRequest) GetFileParam() map[string][]NamedReadCloser { + return nil +} + +func (t *TestClientRequest) GetHeaderParams() http.Header { + return t.Headers +} diff --git a/vendor/github.com/go-openapi/runtime/client_response.go b/vendor/github.com/go-openapi/runtime/client_response.go new file mode 100644 index 0000000..0d16911 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client_response.go @@ -0,0 +1,110 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "encoding/json" + "fmt" + "io" +) + +// A ClientResponse represents a client response +// This bridges between responses obtained from different transports +type ClientResponse interface { + Code() int + Message() string + GetHeader(string) string + GetHeaders(string) []string + Body() io.ReadCloser +} + +// A ClientResponseReaderFunc turns a function into a ClientResponseReader interface implementation +type ClientResponseReaderFunc func(ClientResponse, Consumer) (interface{}, error) + +// ReadResponse reads the response +func (read ClientResponseReaderFunc) ReadResponse(resp ClientResponse, consumer Consumer) (interface{}, error) { + return read(resp, consumer) +} + +// A ClientResponseReader is an interface for things want to read a response. +// An application of this is to create structs from response values +type ClientResponseReader interface { + ReadResponse(ClientResponse, Consumer) (interface{}, error) +} + +// NewAPIError creates a new API error +func NewAPIError(opName string, payload interface{}, code int) *APIError { + return &APIError{ + OperationName: opName, + Response: payload, + Code: code, + } +} + +// APIError wraps an error model and captures the status code +type APIError struct { + OperationName string + Response interface{} + Code int +} + +func (o *APIError) Error() string { + var resp []byte + if err, ok := o.Response.(error); ok { + resp = []byte("'" + err.Error() + "'") + } else { + resp, _ = json.Marshal(o.Response) + } + return fmt.Sprintf("%s (status %d): %s", o.OperationName, o.Code, resp) +} + +func (o *APIError) String() string { + return o.Error() +} + +// IsSuccess returns true when this elapse o k response returns a 2xx status code +func (o *APIError) IsSuccess() bool { + return o.Code/100 == 2 +} + +// IsRedirect returns true when this elapse o k response returns a 3xx status code +func (o *APIError) IsRedirect() bool { + return o.Code/100 == 3 +} + +// IsClientError returns true when this elapse o k response returns a 4xx status code +func (o *APIError) IsClientError() bool { + return o.Code/100 == 4 +} + +// IsServerError returns true when this elapse o k response returns a 5xx status code +func (o *APIError) IsServerError() bool { + return o.Code/100 == 5 +} + +// IsCode returns true when this elapse o k response returns a 4xx status code +func (o *APIError) IsCode(code int) bool { + return o.Code == code +} + +// A ClientResponseStatus is a common interface implemented by all responses on the generated code +// You can use this to treat any client response based on status code +type ClientResponseStatus interface { + IsSuccess() bool + IsRedirect() bool + IsClientError() bool + IsServerError() bool + IsCode(int) bool +} diff --git a/vendor/github.com/go-openapi/runtime/constants.go b/vendor/github.com/go-openapi/runtime/constants.go new file mode 100644 index 0000000..5159692 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/constants.go @@ -0,0 +1,49 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +const ( + // HeaderContentType represents a http content-type header, it's value is supposed to be a mime type + HeaderContentType = "Content-Type" + + // HeaderTransferEncoding represents a http transfer-encoding header. + HeaderTransferEncoding = "Transfer-Encoding" + + // HeaderAccept the Accept header + HeaderAccept = "Accept" + // HeaderAuthorization the Authorization header + HeaderAuthorization = "Authorization" + + charsetKey = "charset" + + // DefaultMime the default fallback mime type + DefaultMime = "application/octet-stream" + // JSONMime the json mime type + JSONMime = "application/json" + // YAMLMime the yaml mime type + YAMLMime = "application/x-yaml" + // XMLMime the xml mime type + XMLMime = "application/xml" + // TextMime the text mime type + TextMime = "text/plain" + // HTMLMime the html mime type + HTMLMime = "text/html" + // CSVMime the csv mime type + CSVMime = "text/csv" + // MultipartFormMime the multipart form mime type + MultipartFormMime = "multipart/form-data" + // URLencodedFormMime the url encoded form mime type + URLencodedFormMime = "application/x-www-form-urlencoded" +) diff --git a/vendor/github.com/go-openapi/runtime/csv.go b/vendor/github.com/go-openapi/runtime/csv.go new file mode 100644 index 0000000..c9597bc --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/csv.go @@ -0,0 +1,350 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "bytes" + "context" + "encoding" + "encoding/csv" + "errors" + "fmt" + "io" + "reflect" + + "golang.org/x/sync/errgroup" +) + +// CSVConsumer creates a new CSV consumer. +// +// The consumer consumes CSV records from a provided reader into the data passed by reference. +// +// CSVOpts options may be specified to alter the default CSV behavior on the reader and the writer side (e.g. separator, skip header, ...). +// The defaults are those of the standard library's csv.Reader and csv.Writer. +// +// Supported output underlying types and interfaces, prioritized in this order: +// - *csv.Writer +// - CSVWriter (writer options are ignored) +// - io.Writer (as raw bytes) +// - io.ReaderFrom (as raw bytes) +// - encoding.BinaryUnmarshaler (as raw bytes) +// - *[][]string (as a collection of records) +// - *[]byte (as raw bytes) +// - *string (a raw bytes) +// +// The consumer prioritizes situations where buffering the input is not required. +func CSVConsumer(opts ...CSVOpt) Consumer { + o := csvOptsWithDefaults(opts) + + return ConsumerFunc(func(reader io.Reader, data interface{}) error { + if reader == nil { + return errors.New("CSVConsumer requires a reader") + } + if data == nil { + return errors.New("nil destination for CSVConsumer") + } + + csvReader := csv.NewReader(reader) + o.applyToReader(csvReader) + closer := defaultCloser + if o.closeStream { + if cl, isReaderCloser := reader.(io.Closer); isReaderCloser { + closer = cl.Close + } + } + defer func() { + _ = closer() + }() + + switch destination := data.(type) { + case *csv.Writer: + csvWriter := destination + o.applyToWriter(csvWriter) + + return pipeCSV(csvWriter, csvReader, o) + + case CSVWriter: + csvWriter := destination + // no writer options available + + return pipeCSV(csvWriter, csvReader, o) + + case io.Writer: + csvWriter := csv.NewWriter(destination) + o.applyToWriter(csvWriter) + + return pipeCSV(csvWriter, csvReader, o) + + case io.ReaderFrom: + var buf bytes.Buffer + csvWriter := csv.NewWriter(&buf) + o.applyToWriter(csvWriter) + if err := bufferedCSV(csvWriter, csvReader, o); err != nil { + return err + } + _, err := destination.ReadFrom(&buf) + + return err + + case encoding.BinaryUnmarshaler: + var buf bytes.Buffer + csvWriter := csv.NewWriter(&buf) + o.applyToWriter(csvWriter) + if err := bufferedCSV(csvWriter, csvReader, o); err != nil { + return err + } + + return destination.UnmarshalBinary(buf.Bytes()) + + default: + // support *[][]string, *[]byte, *string + if ptr := reflect.TypeOf(data); ptr.Kind() != reflect.Ptr { + return errors.New("destination must be a pointer") + } + + v := reflect.Indirect(reflect.ValueOf(data)) + t := v.Type() + + switch { + case t.Kind() == reflect.Slice && t.Elem().Kind() == reflect.Slice && t.Elem().Elem().Kind() == reflect.String: + csvWriter := &csvRecordsWriter{} + // writer options are ignored + if err := pipeCSV(csvWriter, csvReader, o); err != nil { + return err + } + + v.Grow(len(csvWriter.records)) + v.SetCap(len(csvWriter.records)) // in case Grow was unnessary, trim down the capacity + v.SetLen(len(csvWriter.records)) + reflect.Copy(v, reflect.ValueOf(csvWriter.records)) + + return nil + + case t.Kind() == reflect.Slice && t.Elem().Kind() == reflect.Uint8: + var buf bytes.Buffer + csvWriter := csv.NewWriter(&buf) + o.applyToWriter(csvWriter) + if err := bufferedCSV(csvWriter, csvReader, o); err != nil { + return err + } + v.SetBytes(buf.Bytes()) + + return nil + + case t.Kind() == reflect.String: + var buf bytes.Buffer + csvWriter := csv.NewWriter(&buf) + o.applyToWriter(csvWriter) + if err := bufferedCSV(csvWriter, csvReader, o); err != nil { + return err + } + v.SetString(buf.String()) + + return nil + + default: + return fmt.Errorf("%v (%T) is not supported by the CSVConsumer, %s", + data, data, "can be resolved by supporting CSVWriter/Writer/BinaryUnmarshaler interface", + ) + } + } + }) +} + +// CSVProducer creates a new CSV producer. +// +// The producer takes input data then writes as CSV to an output writer (essentially as a pipe). +// +// Supported input underlying types and interfaces, prioritized in this order: +// - *csv.Reader +// - CSVReader (reader options are ignored) +// - io.Reader +// - io.WriterTo +// - encoding.BinaryMarshaler +// - [][]string +// - []byte +// - string +// +// The producer prioritizes situations where buffering the input is not required. +func CSVProducer(opts ...CSVOpt) Producer { + o := csvOptsWithDefaults(opts) + + return ProducerFunc(func(writer io.Writer, data interface{}) error { + if writer == nil { + return errors.New("CSVProducer requires a writer") + } + if data == nil { + return errors.New("nil data for CSVProducer") + } + + csvWriter := csv.NewWriter(writer) + o.applyToWriter(csvWriter) + closer := defaultCloser + if o.closeStream { + if cl, isWriterCloser := writer.(io.Closer); isWriterCloser { + closer = cl.Close + } + } + defer func() { + _ = closer() + }() + + if rc, isDataCloser := data.(io.ReadCloser); isDataCloser { + defer rc.Close() + } + + switch origin := data.(type) { + case *csv.Reader: + csvReader := origin + o.applyToReader(csvReader) + + return pipeCSV(csvWriter, csvReader, o) + + case CSVReader: + csvReader := origin + // no reader options available + + return pipeCSV(csvWriter, csvReader, o) + + case io.Reader: + csvReader := csv.NewReader(origin) + o.applyToReader(csvReader) + + return pipeCSV(csvWriter, csvReader, o) + + case io.WriterTo: + // async piping of the writes performed by WriteTo + r, w := io.Pipe() + csvReader := csv.NewReader(r) + o.applyToReader(csvReader) + + pipe, _ := errgroup.WithContext(context.Background()) + pipe.Go(func() error { + _, err := origin.WriteTo(w) + _ = w.Close() + return err + }) + + pipe.Go(func() error { + defer func() { + _ = r.Close() + }() + + return pipeCSV(csvWriter, csvReader, o) + }) + + return pipe.Wait() + + case encoding.BinaryMarshaler: + buf, err := origin.MarshalBinary() + if err != nil { + return err + } + rdr := bytes.NewBuffer(buf) + csvReader := csv.NewReader(rdr) + + return bufferedCSV(csvWriter, csvReader, o) + + default: + // support [][]string, []byte, string (or pointers to those) + v := reflect.Indirect(reflect.ValueOf(data)) + t := v.Type() + + switch { + case t.Kind() == reflect.Slice && t.Elem().Kind() == reflect.Slice && t.Elem().Elem().Kind() == reflect.String: + csvReader := &csvRecordsWriter{ + records: make([][]string, v.Len()), + } + reflect.Copy(reflect.ValueOf(csvReader.records), v) + + return pipeCSV(csvWriter, csvReader, o) + + case t.Kind() == reflect.Slice && t.Elem().Kind() == reflect.Uint8: + buf := bytes.NewBuffer(v.Bytes()) + csvReader := csv.NewReader(buf) + o.applyToReader(csvReader) + + return bufferedCSV(csvWriter, csvReader, o) + + case t.Kind() == reflect.String: + buf := bytes.NewBufferString(v.String()) + csvReader := csv.NewReader(buf) + o.applyToReader(csvReader) + + return bufferedCSV(csvWriter, csvReader, o) + + default: + return fmt.Errorf("%v (%T) is not supported by the CSVProducer, %s", + data, data, "can be resolved by supporting CSVReader/Reader/BinaryMarshaler interface", + ) + } + } + }) +} + +// pipeCSV copies CSV records from a CSV reader to a CSV writer +func pipeCSV(csvWriter CSVWriter, csvReader CSVReader, opts csvOpts) error { + for ; opts.skippedLines > 0; opts.skippedLines-- { + _, err := csvReader.Read() + if err != nil { + if errors.Is(err, io.EOF) { + return nil + } + + return err + } + } + + for { + record, err := csvReader.Read() + if err != nil { + if errors.Is(err, io.EOF) { + break + } + + return err + } + + if err := csvWriter.Write(record); err != nil { + return err + } + } + + csvWriter.Flush() + + return csvWriter.Error() +} + +// bufferedCSV copies CSV records from a CSV reader to a CSV writer, +// by first reading all records then writing them at once. +func bufferedCSV(csvWriter *csv.Writer, csvReader *csv.Reader, opts csvOpts) error { + for ; opts.skippedLines > 0; opts.skippedLines-- { + _, err := csvReader.Read() + if err != nil { + if errors.Is(err, io.EOF) { + return nil + } + + return err + } + } + + records, err := csvReader.ReadAll() + if err != nil { + return err + } + + return csvWriter.WriteAll(records) +} diff --git a/vendor/github.com/go-openapi/runtime/csv_options.go b/vendor/github.com/go-openapi/runtime/csv_options.go new file mode 100644 index 0000000..c16464c --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/csv_options.go @@ -0,0 +1,121 @@ +package runtime + +import ( + "encoding/csv" + "io" +) + +// CSVOpts alter the behavior of the CSV consumer or producer. +type CSVOpt func(*csvOpts) + +type csvOpts struct { + csvReader csv.Reader + csvWriter csv.Writer + skippedLines int + closeStream bool +} + +// WithCSVReaderOpts specifies the options to csv.Reader +// when reading CSV. +func WithCSVReaderOpts(reader csv.Reader) CSVOpt { + return func(o *csvOpts) { + o.csvReader = reader + } +} + +// WithCSVWriterOpts specifies the options to csv.Writer +// when writing CSV. +func WithCSVWriterOpts(writer csv.Writer) CSVOpt { + return func(o *csvOpts) { + o.csvWriter = writer + } +} + +// WithCSVSkipLines will skip header lines. +func WithCSVSkipLines(skipped int) CSVOpt { + return func(o *csvOpts) { + o.skippedLines = skipped + } +} + +func WithCSVClosesStream() CSVOpt { + return func(o *csvOpts) { + o.closeStream = true + } +} + +func (o csvOpts) applyToReader(in *csv.Reader) { + if o.csvReader.Comma != 0 { + in.Comma = o.csvReader.Comma + } + if o.csvReader.Comment != 0 { + in.Comment = o.csvReader.Comment + } + if o.csvReader.FieldsPerRecord != 0 { + in.FieldsPerRecord = o.csvReader.FieldsPerRecord + } + + in.LazyQuotes = o.csvReader.LazyQuotes + in.TrimLeadingSpace = o.csvReader.TrimLeadingSpace + in.ReuseRecord = o.csvReader.ReuseRecord +} + +func (o csvOpts) applyToWriter(in *csv.Writer) { + if o.csvWriter.Comma != 0 { + in.Comma = o.csvWriter.Comma + } + in.UseCRLF = o.csvWriter.UseCRLF +} + +func csvOptsWithDefaults(opts []CSVOpt) csvOpts { + var o csvOpts + for _, apply := range opts { + apply(&o) + } + + return o +} + +type CSVWriter interface { + Write([]string) error + Flush() + Error() error +} + +type CSVReader interface { + Read() ([]string, error) +} + +var ( + _ CSVWriter = &csvRecordsWriter{} + _ CSVReader = &csvRecordsWriter{} +) + +// csvRecordsWriter is an internal container to move CSV records back and forth +type csvRecordsWriter struct { + i int + records [][]string +} + +func (w *csvRecordsWriter) Write(record []string) error { + w.records = append(w.records, record) + + return nil +} + +func (w *csvRecordsWriter) Read() ([]string, error) { + if w.i >= len(w.records) { + return nil, io.EOF + } + defer func() { + w.i++ + }() + + return w.records[w.i], nil +} + +func (w *csvRecordsWriter) Flush() {} + +func (w *csvRecordsWriter) Error() error { + return nil +} diff --git a/vendor/github.com/go-openapi/runtime/discard.go b/vendor/github.com/go-openapi/runtime/discard.go new file mode 100644 index 0000000..0d390cf --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/discard.go @@ -0,0 +1,9 @@ +package runtime + +import "io" + +// DiscardConsumer does absolutely nothing, it's a black hole. +var DiscardConsumer = ConsumerFunc(func(_ io.Reader, _ interface{}) error { return nil }) + +// DiscardProducer does absolutely nothing, it's a black hole. +var DiscardProducer = ProducerFunc(func(_ io.Writer, _ interface{}) error { return nil }) diff --git a/vendor/github.com/go-openapi/runtime/file.go b/vendor/github.com/go-openapi/runtime/file.go new file mode 100644 index 0000000..397d8a4 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/file.go @@ -0,0 +1,19 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import "github.com/go-openapi/swag" + +type File = swag.File diff --git a/vendor/github.com/go-openapi/runtime/headers.go b/vendor/github.com/go-openapi/runtime/headers.go new file mode 100644 index 0000000..4d111db --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/headers.go @@ -0,0 +1,45 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "mime" + "net/http" + + "github.com/go-openapi/errors" +) + +// ContentType parses a content type header +func ContentType(headers http.Header) (string, string, error) { + ct := headers.Get(HeaderContentType) + orig := ct + if ct == "" { + ct = DefaultMime + } + if ct == "" { + return "", "", nil + } + + mt, opts, err := mime.ParseMediaType(ct) + if err != nil { + return "", "", errors.NewParseError(HeaderContentType, "header", orig, err) + } + + if cs, ok := opts[charsetKey]; ok { + return mt, cs, nil + } + + return mt, "", nil +} diff --git a/vendor/github.com/go-openapi/runtime/interfaces.go b/vendor/github.com/go-openapi/runtime/interfaces.go new file mode 100644 index 0000000..e334128 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/interfaces.go @@ -0,0 +1,112 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "context" + "io" + "net/http" + + "github.com/go-openapi/strfmt" +) + +// OperationHandlerFunc an adapter for a function to the OperationHandler interface +type OperationHandlerFunc func(interface{}) (interface{}, error) + +// Handle implements the operation handler interface +func (s OperationHandlerFunc) Handle(data interface{}) (interface{}, error) { + return s(data) +} + +// OperationHandler a handler for a swagger operation +type OperationHandler interface { + Handle(interface{}) (interface{}, error) +} + +// ConsumerFunc represents a function that can be used as a consumer +type ConsumerFunc func(io.Reader, interface{}) error + +// Consume consumes the reader into the data parameter +func (fn ConsumerFunc) Consume(reader io.Reader, data interface{}) error { + return fn(reader, data) +} + +// Consumer implementations know how to bind the values on the provided interface to +// data provided by the request body +type Consumer interface { + // Consume performs the binding of request values + Consume(io.Reader, interface{}) error +} + +// ProducerFunc represents a function that can be used as a producer +type ProducerFunc func(io.Writer, interface{}) error + +// Produce produces the response for the provided data +func (f ProducerFunc) Produce(writer io.Writer, data interface{}) error { + return f(writer, data) +} + +// Producer implementations know how to turn the provided interface into a valid +// HTTP response +type Producer interface { + // Produce writes to the http response + Produce(io.Writer, interface{}) error +} + +// AuthenticatorFunc turns a function into an authenticator +type AuthenticatorFunc func(interface{}) (bool, interface{}, error) + +// Authenticate authenticates the request with the provided data +func (f AuthenticatorFunc) Authenticate(params interface{}) (bool, interface{}, error) { + return f(params) +} + +// Authenticator represents an authentication strategy +// implementations of Authenticator know how to authenticate the +// request data and translate that into a valid principal object or an error +type Authenticator interface { + Authenticate(interface{}) (bool, interface{}, error) +} + +// AuthorizerFunc turns a function into an authorizer +type AuthorizerFunc func(*http.Request, interface{}) error + +// Authorize authorizes the processing of the request for the principal +func (f AuthorizerFunc) Authorize(r *http.Request, principal interface{}) error { + return f(r, principal) +} + +// Authorizer represents an authorization strategy +// implementations of Authorizer know how to authorize the principal object +// using the request data and returns error if unauthorized +type Authorizer interface { + Authorize(*http.Request, interface{}) error +} + +// Validatable types implementing this interface allow customizing their validation +// this will be used instead of the reflective validation based on the spec document. +// the implementations are assumed to have been generated by the swagger tool so they should +// contain all the validations obtained from the spec +type Validatable interface { + Validate(strfmt.Registry) error +} + +// ContextValidatable types implementing this interface allow customizing their validation +// this will be used instead of the reflective validation based on the spec document. +// the implementations are assumed to have been generated by the swagger tool so they should +// contain all the context validations obtained from the spec +type ContextValidatable interface { + ContextValidate(context.Context, strfmt.Registry) error +} diff --git a/vendor/github.com/go-openapi/runtime/json.go b/vendor/github.com/go-openapi/runtime/json.go new file mode 100644 index 0000000..5a69055 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/json.go @@ -0,0 +1,38 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "encoding/json" + "io" +) + +// JSONConsumer creates a new JSON consumer +func JSONConsumer() Consumer { + return ConsumerFunc(func(reader io.Reader, data interface{}) error { + dec := json.NewDecoder(reader) + dec.UseNumber() // preserve number formats + return dec.Decode(data) + }) +} + +// JSONProducer creates a new JSON producer +func JSONProducer() Producer { + return ProducerFunc(func(writer io.Writer, data interface{}) error { + enc := json.NewEncoder(writer) + enc.SetEscapeHTML(false) + return enc.Encode(data) + }) +} diff --git a/vendor/github.com/go-openapi/runtime/logger/logger.go b/vendor/github.com/go-openapi/runtime/logger/logger.go new file mode 100644 index 0000000..6f4debc --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/logger/logger.go @@ -0,0 +1,20 @@ +package logger + +import "os" + +type Logger interface { + Printf(format string, args ...interface{}) + Debugf(format string, args ...interface{}) +} + +func DebugEnabled() bool { + d := os.Getenv("SWAGGER_DEBUG") + if d != "" && d != "false" && d != "0" { + return true + } + d = os.Getenv("DEBUG") + if d != "" && d != "false" && d != "0" { + return true + } + return false +} diff --git a/vendor/github.com/go-openapi/runtime/logger/standard.go b/vendor/github.com/go-openapi/runtime/logger/standard.go new file mode 100644 index 0000000..30035a7 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/logger/standard.go @@ -0,0 +1,24 @@ +package logger + +import ( + "fmt" + "os" +) + +var _ Logger = StandardLogger{} + +type StandardLogger struct{} + +func (StandardLogger) Printf(format string, args ...interface{}) { + if len(format) == 0 || format[len(format)-1] != '\n' { + format += "\n" + } + fmt.Fprintf(os.Stderr, format, args...) +} + +func (StandardLogger) Debugf(format string, args ...interface{}) { + if len(format) == 0 || format[len(format)-1] != '\n' { + format += "\n" + } + fmt.Fprintf(os.Stderr, format, args...) +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/context.go b/vendor/github.com/go-openapi/runtime/middleware/context.go new file mode 100644 index 0000000..44cecf1 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/context.go @@ -0,0 +1,722 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package middleware + +import ( + stdContext "context" + "fmt" + "net/http" + "net/url" + "path" + "strings" + "sync" + + "github.com/go-openapi/analysis" + "github.com/go-openapi/errors" + "github.com/go-openapi/loads" + "github.com/go-openapi/spec" + "github.com/go-openapi/strfmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/logger" + "github.com/go-openapi/runtime/middleware/untyped" + "github.com/go-openapi/runtime/security" +) + +// Debug when true turns on verbose logging +var Debug = logger.DebugEnabled() + +// Logger is the standard libray logger used for printing debug messages +var Logger logger.Logger = logger.StandardLogger{} + +func debugLogfFunc(lg logger.Logger) func(string, ...any) { + if logger.DebugEnabled() { + if lg == nil { + return Logger.Debugf + } + + return lg.Debugf + } + + // muted logger + return func(_ string, _ ...any) {} +} + +// A Builder can create middlewares +type Builder func(http.Handler) http.Handler + +// PassthroughBuilder returns the handler, aka the builder identity function +func PassthroughBuilder(handler http.Handler) http.Handler { return handler } + +// RequestBinder is an interface for types to implement +// when they want to be able to bind from a request +type RequestBinder interface { + BindRequest(*http.Request, *MatchedRoute) error +} + +// Responder is an interface for types to implement +// when they want to be considered for writing HTTP responses +type Responder interface { + WriteResponse(http.ResponseWriter, runtime.Producer) +} + +// ResponderFunc wraps a func as a Responder interface +type ResponderFunc func(http.ResponseWriter, runtime.Producer) + +// WriteResponse writes to the response +func (fn ResponderFunc) WriteResponse(rw http.ResponseWriter, pr runtime.Producer) { + fn(rw, pr) +} + +// Context is a type safe wrapper around an untyped request context +// used throughout to store request context with the standard context attached +// to the http.Request +type Context struct { + spec *loads.Document + analyzer *analysis.Spec + api RoutableAPI + router Router + debugLogf func(string, ...any) // a logging function to debug context and all components using it +} + +type routableUntypedAPI struct { + api *untyped.API + hlock *sync.Mutex + handlers map[string]map[string]http.Handler + defaultConsumes string + defaultProduces string +} + +func newRoutableUntypedAPI(spec *loads.Document, api *untyped.API, context *Context) *routableUntypedAPI { + var handlers map[string]map[string]http.Handler + if spec == nil || api == nil { + return nil + } + analyzer := analysis.New(spec.Spec()) + for method, hls := range analyzer.Operations() { + um := strings.ToUpper(method) + for path, op := range hls { + schemes := analyzer.SecurityRequirementsFor(op) + + if oh, ok := api.OperationHandlerFor(method, path); ok { + if handlers == nil { + handlers = make(map[string]map[string]http.Handler) + } + if b, ok := handlers[um]; !ok || b == nil { + handlers[um] = make(map[string]http.Handler) + } + + var handler http.Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // lookup route info in the context + route, rCtx, _ := context.RouteInfo(r) + if rCtx != nil { + r = rCtx + } + + // bind and validate the request using reflection + var bound interface{} + var validation error + bound, r, validation = context.BindAndValidate(r, route) + if validation != nil { + context.Respond(w, r, route.Produces, route, validation) + return + } + + // actually handle the request + result, err := oh.Handle(bound) + if err != nil { + // respond with failure + context.Respond(w, r, route.Produces, route, err) + return + } + + // respond with success + context.Respond(w, r, route.Produces, route, result) + }) + + if len(schemes) > 0 { + handler = newSecureAPI(context, handler) + } + handlers[um][path] = handler + } + } + } + + return &routableUntypedAPI{ + api: api, + hlock: new(sync.Mutex), + handlers: handlers, + defaultProduces: api.DefaultProduces, + defaultConsumes: api.DefaultConsumes, + } +} + +func (r *routableUntypedAPI) HandlerFor(method, path string) (http.Handler, bool) { + r.hlock.Lock() + paths, ok := r.handlers[strings.ToUpper(method)] + if !ok { + r.hlock.Unlock() + return nil, false + } + handler, ok := paths[path] + r.hlock.Unlock() + return handler, ok +} +func (r *routableUntypedAPI) ServeErrorFor(_ string) func(http.ResponseWriter, *http.Request, error) { + return r.api.ServeError +} +func (r *routableUntypedAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer { + return r.api.ConsumersFor(mediaTypes) +} +func (r *routableUntypedAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer { + return r.api.ProducersFor(mediaTypes) +} +func (r *routableUntypedAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator { + return r.api.AuthenticatorsFor(schemes) +} +func (r *routableUntypedAPI) Authorizer() runtime.Authorizer { + return r.api.Authorizer() +} +func (r *routableUntypedAPI) Formats() strfmt.Registry { + return r.api.Formats() +} + +func (r *routableUntypedAPI) DefaultProduces() string { + return r.defaultProduces +} + +func (r *routableUntypedAPI) DefaultConsumes() string { + return r.defaultConsumes +} + +// NewRoutableContext creates a new context for a routable API. +// +// If a nil Router is provided, the DefaultRouter (denco-based) will be used. +func NewRoutableContext(spec *loads.Document, routableAPI RoutableAPI, routes Router) *Context { + var an *analysis.Spec + if spec != nil { + an = analysis.New(spec.Spec()) + } + + return NewRoutableContextWithAnalyzedSpec(spec, an, routableAPI, routes) +} + +// NewRoutableContextWithAnalyzedSpec is like NewRoutableContext but takes as input an already analysed spec. +// +// If a nil Router is provided, the DefaultRouter (denco-based) will be used. +func NewRoutableContextWithAnalyzedSpec(spec *loads.Document, an *analysis.Spec, routableAPI RoutableAPI, routes Router) *Context { + // Either there are no spec doc and analysis, or both of them. + if !((spec == nil && an == nil) || (spec != nil && an != nil)) { + panic(errors.New(http.StatusInternalServerError, "routable context requires either both spec doc and analysis, or none of them")) + } + + return &Context{ + spec: spec, + api: routableAPI, + analyzer: an, + router: routes, + debugLogf: debugLogfFunc(nil), + } +} + +// NewContext creates a new context wrapper. +// +// If a nil Router is provided, the DefaultRouter (denco-based) will be used. +func NewContext(spec *loads.Document, api *untyped.API, routes Router) *Context { + var an *analysis.Spec + if spec != nil { + an = analysis.New(spec.Spec()) + } + ctx := &Context{ + spec: spec, + analyzer: an, + router: routes, + debugLogf: debugLogfFunc(nil), + } + ctx.api = newRoutableUntypedAPI(spec, api, ctx) + + return ctx +} + +// Serve serves the specified spec with the specified api registrations as a http.Handler +func Serve(spec *loads.Document, api *untyped.API) http.Handler { + return ServeWithBuilder(spec, api, PassthroughBuilder) +} + +// ServeWithBuilder serves the specified spec with the specified api registrations as a http.Handler that is decorated +// by the Builder +func ServeWithBuilder(spec *loads.Document, api *untyped.API, builder Builder) http.Handler { + context := NewContext(spec, api, nil) + return context.APIHandler(builder) +} + +type contextKey int8 + +const ( + _ contextKey = iota + ctxContentType + ctxResponseFormat + ctxMatchedRoute + ctxBoundParams + ctxSecurityPrincipal + ctxSecurityScopes +) + +// MatchedRouteFrom request context value. +func MatchedRouteFrom(req *http.Request) *MatchedRoute { + mr := req.Context().Value(ctxMatchedRoute) + if mr == nil { + return nil + } + if res, ok := mr.(*MatchedRoute); ok { + return res + } + return nil +} + +// SecurityPrincipalFrom request context value. +func SecurityPrincipalFrom(req *http.Request) interface{} { + return req.Context().Value(ctxSecurityPrincipal) +} + +// SecurityScopesFrom request context value. +func SecurityScopesFrom(req *http.Request) []string { + rs := req.Context().Value(ctxSecurityScopes) + if res, ok := rs.([]string); ok { + return res + } + return nil +} + +type contentTypeValue struct { + MediaType string + Charset string +} + +// BasePath returns the base path for this API +func (c *Context) BasePath() string { + return c.spec.BasePath() +} + +// SetLogger allows for injecting a logger to catch debug entries. +// +// The logger is enabled in DEBUG mode only. +func (c *Context) SetLogger(lg logger.Logger) { + c.debugLogf = debugLogfFunc(lg) +} + +// RequiredProduces returns the accepted content types for responses +func (c *Context) RequiredProduces() []string { + return c.analyzer.RequiredProduces() +} + +// BindValidRequest binds a params object to a request but only when the request is valid +// if the request is not valid an error will be returned +func (c *Context) BindValidRequest(request *http.Request, route *MatchedRoute, binder RequestBinder) error { + var res []error + var requestContentType string + + // check and validate content type, select consumer + if runtime.HasBody(request) { + ct, _, err := runtime.ContentType(request.Header) + if err != nil { + res = append(res, err) + } else { + c.debugLogf("validating content type for %q against [%s]", ct, strings.Join(route.Consumes, ", ")) + if err := validateContentType(route.Consumes, ct); err != nil { + res = append(res, err) + } + if len(res) == 0 { + cons, ok := route.Consumers[ct] + if !ok { + res = append(res, errors.New(500, "no consumer registered for %s", ct)) + } else { + route.Consumer = cons + requestContentType = ct + } + } + } + } + + // check and validate the response format + if len(res) == 0 { + // if the route does not provide Produces and a default contentType could not be identified + // based on a body, typical for GET and DELETE requests, then default contentType to. + if len(route.Produces) == 0 && requestContentType == "" { + requestContentType = "*/*" + } + + if str := NegotiateContentType(request, route.Produces, requestContentType); str == "" { + res = append(res, errors.InvalidResponseFormat(request.Header.Get(runtime.HeaderAccept), route.Produces)) + } + } + + // now bind the request with the provided binder + // it's assumed the binder will also validate the request and return an error if the + // request is invalid + if binder != nil && len(res) == 0 { + if err := binder.BindRequest(request, route); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContentType gets the parsed value of a content type +// Returns the media type, its charset and a shallow copy of the request +// when its context doesn't contain the content type value, otherwise it returns +// the same request +// Returns the error that runtime.ContentType may retunrs. +func (c *Context) ContentType(request *http.Request) (string, string, *http.Request, error) { + var rCtx = request.Context() + + if v, ok := rCtx.Value(ctxContentType).(*contentTypeValue); ok { + return v.MediaType, v.Charset, request, nil + } + + mt, cs, err := runtime.ContentType(request.Header) + if err != nil { + return "", "", nil, err + } + rCtx = stdContext.WithValue(rCtx, ctxContentType, &contentTypeValue{mt, cs}) + return mt, cs, request.WithContext(rCtx), nil +} + +// LookupRoute looks a route up and returns true when it is found +func (c *Context) LookupRoute(request *http.Request) (*MatchedRoute, bool) { + if route, ok := c.router.Lookup(request.Method, request.URL.EscapedPath()); ok { + return route, ok + } + return nil, false +} + +// RouteInfo tries to match a route for this request +// Returns the matched route, a shallow copy of the request if its context +// contains the matched router, otherwise the same request, and a bool to +// indicate if it the request matches one of the routes, if it doesn't +// then it returns false and nil for the other two return values +func (c *Context) RouteInfo(request *http.Request) (*MatchedRoute, *http.Request, bool) { + var rCtx = request.Context() + + if v, ok := rCtx.Value(ctxMatchedRoute).(*MatchedRoute); ok { + return v, request, ok + } + + if route, ok := c.LookupRoute(request); ok { + rCtx = stdContext.WithValue(rCtx, ctxMatchedRoute, route) + return route, request.WithContext(rCtx), ok + } + + return nil, nil, false +} + +// ResponseFormat negotiates the response content type +// Returns the response format and a shallow copy of the request if its context +// doesn't contain the response format, otherwise the same request +func (c *Context) ResponseFormat(r *http.Request, offers []string) (string, *http.Request) { + var rCtx = r.Context() + + if v, ok := rCtx.Value(ctxResponseFormat).(string); ok { + c.debugLogf("[%s %s] found response format %q in context", r.Method, r.URL.Path, v) + return v, r + } + + format := NegotiateContentType(r, offers, "") + if format != "" { + c.debugLogf("[%s %s] set response format %q in context", r.Method, r.URL.Path, format) + r = r.WithContext(stdContext.WithValue(rCtx, ctxResponseFormat, format)) + } + c.debugLogf("[%s %s] negotiated response format %q", r.Method, r.URL.Path, format) + return format, r +} + +// AllowedMethods gets the allowed methods for the path of this request +func (c *Context) AllowedMethods(request *http.Request) []string { + return c.router.OtherMethods(request.Method, request.URL.EscapedPath()) +} + +// ResetAuth removes the current principal from the request context +func (c *Context) ResetAuth(request *http.Request) *http.Request { + rctx := request.Context() + rctx = stdContext.WithValue(rctx, ctxSecurityPrincipal, nil) + rctx = stdContext.WithValue(rctx, ctxSecurityScopes, nil) + return request.WithContext(rctx) +} + +// Authorize authorizes the request +// Returns the principal object and a shallow copy of the request when its +// context doesn't contain the principal, otherwise the same request or an error +// (the last) if one of the authenticators returns one or an Unauthenticated error +func (c *Context) Authorize(request *http.Request, route *MatchedRoute) (interface{}, *http.Request, error) { + if route == nil || !route.HasAuth() { + return nil, nil, nil + } + + var rCtx = request.Context() + if v := rCtx.Value(ctxSecurityPrincipal); v != nil { + return v, request, nil + } + + applies, usr, err := route.Authenticators.Authenticate(request, route) + if !applies || err != nil || !route.Authenticators.AllowsAnonymous() && usr == nil { + if err != nil { + return nil, nil, err + } + return nil, nil, errors.Unauthenticated("invalid credentials") + } + if route.Authorizer != nil { + if err := route.Authorizer.Authorize(request, usr); err != nil { + if _, ok := err.(errors.Error); ok { + return nil, nil, err + } + + return nil, nil, errors.New(http.StatusForbidden, err.Error()) + } + } + + rCtx = request.Context() + + rCtx = stdContext.WithValue(rCtx, ctxSecurityPrincipal, usr) + rCtx = stdContext.WithValue(rCtx, ctxSecurityScopes, route.Authenticator.AllScopes()) + return usr, request.WithContext(rCtx), nil +} + +// BindAndValidate binds and validates the request +// Returns the validation map and a shallow copy of the request when its context +// doesn't contain the validation, otherwise it returns the same request or an +// CompositeValidationError error +func (c *Context) BindAndValidate(request *http.Request, matched *MatchedRoute) (interface{}, *http.Request, error) { + var rCtx = request.Context() + + if v, ok := rCtx.Value(ctxBoundParams).(*validation); ok { + c.debugLogf("got cached validation (valid: %t)", len(v.result) == 0) + if len(v.result) > 0 { + return v.bound, request, errors.CompositeValidationError(v.result...) + } + return v.bound, request, nil + } + result := validateRequest(c, request, matched) + rCtx = stdContext.WithValue(rCtx, ctxBoundParams, result) + request = request.WithContext(rCtx) + if len(result.result) > 0 { + return result.bound, request, errors.CompositeValidationError(result.result...) + } + c.debugLogf("no validation errors found") + return result.bound, request, nil +} + +// NotFound the default not found responder for when no route has been matched yet +func (c *Context) NotFound(rw http.ResponseWriter, r *http.Request) { + c.Respond(rw, r, []string{c.api.DefaultProduces()}, nil, errors.NotFound("not found")) +} + +// Respond renders the response after doing some content negotiation +func (c *Context) Respond(rw http.ResponseWriter, r *http.Request, produces []string, route *MatchedRoute, data interface{}) { + c.debugLogf("responding to %s %s with produces: %v", r.Method, r.URL.Path, produces) + offers := []string{} + for _, mt := range produces { + if mt != c.api.DefaultProduces() { + offers = append(offers, mt) + } + } + // the default producer is last so more specific producers take precedence + offers = append(offers, c.api.DefaultProduces()) + c.debugLogf("offers: %v", offers) + + var format string + format, r = c.ResponseFormat(r, offers) + rw.Header().Set(runtime.HeaderContentType, format) + + if resp, ok := data.(Responder); ok { + producers := route.Producers + // producers contains keys with normalized format, if a format has MIME type parameter such as `text/plain; charset=utf-8` + // then you must provide `text/plain` to get the correct producer. HOWEVER, format here is not normalized. + prod, ok := producers[normalizeOffer(format)] + if !ok { + prods := c.api.ProducersFor(normalizeOffers([]string{c.api.DefaultProduces()})) + pr, ok := prods[c.api.DefaultProduces()] + if !ok { + panic(errors.New(http.StatusInternalServerError, cantFindProducer(format))) + } + prod = pr + } + resp.WriteResponse(rw, prod) + return + } + + if err, ok := data.(error); ok { + if format == "" { + rw.Header().Set(runtime.HeaderContentType, runtime.JSONMime) + } + + if realm := security.FailedBasicAuth(r); realm != "" { + rw.Header().Set("WWW-Authenticate", fmt.Sprintf("Basic realm=%q", realm)) + } + + if route == nil || route.Operation == nil { + c.api.ServeErrorFor("")(rw, r, err) + return + } + c.api.ServeErrorFor(route.Operation.ID)(rw, r, err) + return + } + + if route == nil || route.Operation == nil { + rw.WriteHeader(http.StatusOK) + if r.Method == http.MethodHead { + return + } + producers := c.api.ProducersFor(normalizeOffers(offers)) + prod, ok := producers[format] + if !ok { + panic(errors.New(http.StatusInternalServerError, cantFindProducer(format))) + } + if err := prod.Produce(rw, data); err != nil { + panic(err) // let the recovery middleware deal with this + } + return + } + + if _, code, ok := route.Operation.SuccessResponse(); ok { + rw.WriteHeader(code) + if code == http.StatusNoContent || r.Method == http.MethodHead { + return + } + + producers := route.Producers + prod, ok := producers[format] + if !ok { + if !ok { + prods := c.api.ProducersFor(normalizeOffers([]string{c.api.DefaultProduces()})) + pr, ok := prods[c.api.DefaultProduces()] + if !ok { + panic(errors.New(http.StatusInternalServerError, cantFindProducer(format))) + } + prod = pr + } + } + if err := prod.Produce(rw, data); err != nil { + panic(err) // let the recovery middleware deal with this + } + return + } + + c.api.ServeErrorFor(route.Operation.ID)(rw, r, errors.New(http.StatusInternalServerError, "can't produce response")) +} + +// APIHandlerSwaggerUI returns a handler to serve the API. +// +// This handler includes a swagger spec, router and the contract defined in the swagger spec. +// +// A spec UI (SwaggerUI) is served at {API base path}/docs and the spec document at /swagger.json +// (these can be modified with uiOptions). +func (c *Context) APIHandlerSwaggerUI(builder Builder, opts ...UIOption) http.Handler { + b := builder + if b == nil { + b = PassthroughBuilder + } + + specPath, uiOpts, specOpts := c.uiOptionsForHandler(opts) + var swaggerUIOpts SwaggerUIOpts + fromCommonToAnyOptions(uiOpts, &swaggerUIOpts) + + return Spec(specPath, c.spec.Raw(), SwaggerUI(swaggerUIOpts, c.RoutesHandler(b)), specOpts...) +} + +// APIHandlerRapiDoc returns a handler to serve the API. +// +// This handler includes a swagger spec, router and the contract defined in the swagger spec. +// +// A spec UI (RapiDoc) is served at {API base path}/docs and the spec document at /swagger.json +// (these can be modified with uiOptions). +func (c *Context) APIHandlerRapiDoc(builder Builder, opts ...UIOption) http.Handler { + b := builder + if b == nil { + b = PassthroughBuilder + } + + specPath, uiOpts, specOpts := c.uiOptionsForHandler(opts) + var rapidocUIOpts RapiDocOpts + fromCommonToAnyOptions(uiOpts, &rapidocUIOpts) + + return Spec(specPath, c.spec.Raw(), RapiDoc(rapidocUIOpts, c.RoutesHandler(b)), specOpts...) +} + +// APIHandler returns a handler to serve the API. +// +// This handler includes a swagger spec, router and the contract defined in the swagger spec. +// +// A spec UI (Redoc) is served at {API base path}/docs and the spec document at /swagger.json +// (these can be modified with uiOptions). +func (c *Context) APIHandler(builder Builder, opts ...UIOption) http.Handler { + b := builder + if b == nil { + b = PassthroughBuilder + } + + specPath, uiOpts, specOpts := c.uiOptionsForHandler(opts) + var redocOpts RedocOpts + fromCommonToAnyOptions(uiOpts, &redocOpts) + + return Spec(specPath, c.spec.Raw(), Redoc(redocOpts, c.RoutesHandler(b)), specOpts...) +} + +func (c Context) uiOptionsForHandler(opts []UIOption) (string, uiOptions, []SpecOption) { + var title string + sp := c.spec.Spec() + if sp != nil && sp.Info != nil && sp.Info.Title != "" { + title = sp.Info.Title + } + + // default options (may be overridden) + optsForContext := []UIOption{ + WithUIBasePath(c.BasePath()), + WithUITitle(title), + } + optsForContext = append(optsForContext, opts...) + uiOpts := uiOptionsWithDefaults(optsForContext) + + // If spec URL is provided, there is a non-default path to serve the spec. + // This makes sure that the UI middleware is aligned with the Spec middleware. + u, _ := url.Parse(uiOpts.SpecURL) + var specPath string + if u != nil { + specPath = u.Path + } + + pth, doc := path.Split(specPath) + if pth == "." { + pth = "" + } + + return pth, uiOpts, []SpecOption{WithSpecDocument(doc)} +} + +// RoutesHandler returns a handler to serve the API, just the routes and the contract defined in the swagger spec +func (c *Context) RoutesHandler(builder Builder) http.Handler { + b := builder + if b == nil { + b = PassthroughBuilder + } + return NewRouter(c, b(NewOperationExecutor(c))) +} + +func cantFindProducer(format string) string { + return "can't find a producer for " + format +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/denco/LICENSE b/vendor/github.com/go-openapi/runtime/middleware/denco/LICENSE new file mode 100644 index 0000000..e65039a --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/denco/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014 Naoya Inada + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/github.com/go-openapi/runtime/middleware/denco/README.md b/vendor/github.com/go-openapi/runtime/middleware/denco/README.md new file mode 100644 index 0000000..30109e1 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/denco/README.md @@ -0,0 +1,180 @@ +# Denco [![Build Status](https://travis-ci.org/naoina/denco.png?branch=master)](https://travis-ci.org/naoina/denco) + +The fast and flexible HTTP request router for [Go](http://golang.org). + +Denco is based on Double-Array implementation of [Kocha-urlrouter](https://github.com/naoina/kocha-urlrouter). +However, Denco is optimized and some features added. + +## Features + +* Fast (See [go-http-routing-benchmark](https://github.com/naoina/go-http-routing-benchmark)) +* [URL patterns](#url-patterns) (`/foo/:bar` and `/foo/*wildcard`) +* Small (but enough) URL router API +* HTTP request multiplexer like `http.ServeMux` + +## Installation + + go get -u github.com/go-openapi/runtime/middleware/denco + +## Using as HTTP request multiplexer + +```go +package main + +import ( + "fmt" + "log" + "net/http" + + "github.com/go-openapi/runtime/middleware/denco" +) + +func Index(w http.ResponseWriter, r *http.Request, params denco.Params) { + fmt.Fprintf(w, "Welcome to Denco!\n") +} + +func User(w http.ResponseWriter, r *http.Request, params denco.Params) { + fmt.Fprintf(w, "Hello %s!\n", params.Get("name")) +} + +func main() { + mux := denco.NewMux() + handler, err := mux.Build([]denco.Handler{ + mux.GET("/", Index), + mux.GET("/user/:name", User), + mux.POST("/user/:name", User), + }) + if err != nil { + panic(err) + } + log.Fatal(http.ListenAndServe(":8080", handler)) +} +``` + +## Using as URL router + +```go +package main + +import ( + "fmt" + + "github.com/go-openapi/runtime/middleware/denco" +) + +type route struct { + name string +} + +func main() { + router := denco.New() + router.Build([]denco.Record{ + {"/", &route{"root"}}, + {"/user/:id", &route{"user"}}, + {"/user/:name/:id", &route{"username"}}, + {"/static/*filepath", &route{"static"}}, + }) + + data, params, found := router.Lookup("/") + // print `&main.route{name:"root"}, denco.Params(nil), true`. + fmt.Printf("%#v, %#v, %#v\n", data, params, found) + + data, params, found = router.Lookup("/user/hoge") + // print `&main.route{name:"user"}, denco.Params{denco.Param{Name:"id", Value:"hoge"}}, true`. + fmt.Printf("%#v, %#v, %#v\n", data, params, found) + + data, params, found = router.Lookup("/user/hoge/7") + // print `&main.route{name:"username"}, denco.Params{denco.Param{Name:"name", Value:"hoge"}, denco.Param{Name:"id", Value:"7"}}, true`. + fmt.Printf("%#v, %#v, %#v\n", data, params, found) + + data, params, found = router.Lookup("/static/path/to/file") + // print `&main.route{name:"static"}, denco.Params{denco.Param{Name:"filepath", Value:"path/to/file"}}, true`. + fmt.Printf("%#v, %#v, %#v\n", data, params, found) +} +``` + +See [Godoc](http://godoc.org/github.com/go-openapi/runtime/middleware/denco) for more details. + +## Getting the value of path parameter + +You can get the value of path parameter by 2 ways. + +1. Using [`denco.Params.Get`](http://godoc.org/github.com/go-openapi/runtime/middleware/denco#Params.Get) method +2. Find by loop + +```go +package main + +import ( + "fmt" + + "github.com/go-openapi/runtime/middleware/denco" +) + +func main() { + router := denco.New() + if err := router.Build([]denco.Record{ + {"/user/:name/:id", "route1"}, + }); err != nil { + panic(err) + } + + // 1. Using denco.Params.Get method. + _, params, _ := router.Lookup("/user/alice/1") + name := params.Get("name") + if name != "" { + fmt.Printf("Hello %s.\n", name) // prints "Hello alice.". + } + + // 2. Find by loop. + for _, param := range params { + if param.Name == "name" { + fmt.Printf("Hello %s.\n", name) // prints "Hello alice.". + } + } +} +``` + +## URL patterns + +Denco's route matching strategy is "most nearly matching". + +When routes `/:name` and `/alice` have been built, URI `/alice` matches the route `/alice`, not `/:name`. +Because URI `/alice` is more match with the route `/alice` than `/:name`. + +For more example, when routes below have been built: + +``` +/user/alice +/user/:name +/user/:name/:id +/user/alice/:id +/user/:id/bob +``` + +Routes matching are: + +``` +/user/alice => "/user/alice" (no match with "/user/:name") +/user/bob => "/user/:name" +/user/naoina/1 => "/user/:name/1" +/user/alice/1 => "/user/alice/:id" (no match with "/user/:name/:id") +/user/1/bob => "/user/:id/bob" (no match with "/user/:name/:id") +/user/alice/bob => "/user/alice/:id" (no match with "/user/:name/:id" and "/user/:id/bob") +``` + +## Limitation + +Denco has some limitations below. + +* Number of param records (such as `/:name`) must be less than 2^22 +* Number of elements of internal slice must be less than 2^22 + +## Benchmarks + + cd $GOPATH/github.com/go-openapi/runtime/middleware/denco + go test -bench . -benchmem + +## License + +Denco is licensed under the MIT License. diff --git a/vendor/github.com/go-openapi/runtime/middleware/denco/router.go b/vendor/github.com/go-openapi/runtime/middleware/denco/router.go new file mode 100644 index 0000000..4377f77 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/denco/router.go @@ -0,0 +1,467 @@ +// Package denco provides fast URL router. +package denco + +import ( + "errors" + "fmt" + "sort" + "strings" +) + +const ( + // ParamCharacter is a special character for path parameter. + ParamCharacter = ':' + + // WildcardCharacter is a special character for wildcard path parameter. + WildcardCharacter = '*' + + // TerminationCharacter is a special character for end of path. + TerminationCharacter = '#' + + // SeparatorCharacter separates path segments. + SeparatorCharacter = '/' + + // PathParamCharacter indicates a RESTCONF path param + PathParamCharacter = '=' + + // MaxSize is max size of records and internal slice. + MaxSize = (1 << 22) - 1 +) + +// Router represents a URL router. +type Router struct { + param *doubleArray + // SizeHint expects the maximum number of path parameters in records to Build. + // SizeHint will be used to determine the capacity of the memory to allocate. + // By default, SizeHint will be determined from given records to Build. + SizeHint int + + static map[string]interface{} +} + +// New returns a new Router. +func New() *Router { + return &Router{ + SizeHint: -1, + static: make(map[string]interface{}), + param: newDoubleArray(), + } +} + +// Lookup returns data and path parameters that associated with path. +// params is a slice of the Param that arranged in the order in which parameters appeared. +// e.g. when built routing path is "/path/to/:id/:name" and given path is "/path/to/1/alice". params order is [{"id": "1"}, {"name": "alice"}], not [{"name": "alice"}, {"id": "1"}]. +func (rt *Router) Lookup(path string) (data interface{}, params Params, found bool) { + if data, found = rt.static[path]; found { + return data, nil, true + } + if len(rt.param.node) == 1 { + return nil, nil, false + } + nd, params, found := rt.param.lookup(path, make([]Param, 0, rt.SizeHint), 1) + if !found { + return nil, nil, false + } + for i := 0; i < len(params); i++ { + params[i].Name = nd.paramNames[i] + } + return nd.data, params, true +} + +// Build builds URL router from records. +func (rt *Router) Build(records []Record) error { + statics, params := makeRecords(records) + if len(params) > MaxSize { + return errors.New("denco: too many records") + } + if rt.SizeHint < 0 { + rt.SizeHint = 0 + for _, p := range params { + size := 0 + for _, k := range p.Key { + if k == ParamCharacter || k == WildcardCharacter { + size++ + } + } + if size > rt.SizeHint { + rt.SizeHint = size + } + } + } + for _, r := range statics { + rt.static[r.Key] = r.Value + } + if err := rt.param.build(params, 1, 0, make(map[int]struct{})); err != nil { + return err + } + return nil +} + +// Param represents name and value of path parameter. +type Param struct { + Name string + Value string +} + +// Params represents the name and value of path parameters. +type Params []Param + +// Get gets the first value associated with the given name. +// If there are no values associated with the key, Get returns "". +func (ps Params) Get(name string) string { + for _, p := range ps { + if p.Name == name { + return p.Value + } + } + return "" +} + +type doubleArray struct { + bc []baseCheck + node []*node +} + +func newDoubleArray() *doubleArray { + return &doubleArray{ + bc: []baseCheck{0}, + node: []*node{nil}, // A start index is adjusting to 1 because 0 will be used as a mark of non-existent node. + } +} + +// baseCheck contains BASE, CHECK and Extra flags. +// From the top, 22bits of BASE, 2bits of Extra flags and 8bits of CHECK. +// +// BASE (22bit) | Extra flags (2bit) | CHECK (8bit) +// +// |----------------------|--|--------| +// 32 10 8 0 +type baseCheck uint32 + +func (bc baseCheck) Base() int { + return int(bc >> 10) +} + +func (bc *baseCheck) SetBase(base int) { + *bc |= baseCheck(base) << 10 +} + +func (bc baseCheck) Check() byte { + return byte(bc) +} + +func (bc *baseCheck) SetCheck(check byte) { + *bc |= baseCheck(check) +} + +func (bc baseCheck) IsEmpty() bool { + return bc&0xfffffcff == 0 +} + +func (bc baseCheck) IsSingleParam() bool { + return bc¶mTypeSingle == paramTypeSingle +} + +func (bc baseCheck) IsWildcardParam() bool { + return bc¶mTypeWildcard == paramTypeWildcard +} + +func (bc baseCheck) IsAnyParam() bool { + return bc¶mTypeAny != 0 +} + +func (bc *baseCheck) SetSingleParam() { + *bc |= (1 << 8) +} + +func (bc *baseCheck) SetWildcardParam() { + *bc |= (1 << 9) +} + +const ( + paramTypeSingle = 0x0100 + paramTypeWildcard = 0x0200 + paramTypeAny = 0x0300 +) + +func (da *doubleArray) lookup(path string, params []Param, idx int) (*node, []Param, bool) { + indices := make([]uint64, 0, 1) + for i := 0; i < len(path); i++ { + if da.bc[idx].IsAnyParam() { + indices = append(indices, (uint64(i)<<32)|(uint64(idx)&0xffffffff)) + } + c := path[i] + if idx = nextIndex(da.bc[idx].Base(), c); idx >= len(da.bc) || da.bc[idx].Check() != c { + goto BACKTRACKING + } + } + if next := nextIndex(da.bc[idx].Base(), TerminationCharacter); next < len(da.bc) && da.bc[next].Check() == TerminationCharacter { + return da.node[da.bc[next].Base()], params, true + } + +BACKTRACKING: + for j := len(indices) - 1; j >= 0; j-- { + i, idx := int(indices[j]>>32), int(indices[j]&0xffffffff) + if da.bc[idx].IsSingleParam() { + nextIdx := nextIndex(da.bc[idx].Base(), ParamCharacter) + if nextIdx >= len(da.bc) { + break + } + + next := NextSeparator(path, i) + nextParams := params + nextParams = append(nextParams, Param{Value: path[i:next]}) + if nd, nextNextParams, found := da.lookup(path[next:], nextParams, nextIdx); found { + return nd, nextNextParams, true + } + } + + if da.bc[idx].IsWildcardParam() { + nextIdx := nextIndex(da.bc[idx].Base(), WildcardCharacter) + nextParams := params + nextParams = append(nextParams, Param{Value: path[i:]}) + return da.node[da.bc[nextIdx].Base()], nextParams, true + } + } + return nil, nil, false +} + +// build builds double-array from records. +func (da *doubleArray) build(srcs []*record, idx, depth int, usedBase map[int]struct{}) error { + sort.Stable(recordSlice(srcs)) + base, siblings, leaf, err := da.arrange(srcs, idx, depth, usedBase) + if err != nil { + return err + } + if leaf != nil { + nd, err := makeNode(leaf) + if err != nil { + return err + } + da.bc[idx].SetBase(len(da.node)) + da.node = append(da.node, nd) + } + for _, sib := range siblings { + da.setCheck(nextIndex(base, sib.c), sib.c) + } + for _, sib := range siblings { + records := srcs[sib.start:sib.end] + switch sib.c { + case ParamCharacter: + for _, r := range records { + next := NextSeparator(r.Key, depth+1) + name := r.Key[depth+1 : next] + r.paramNames = append(r.paramNames, name) + r.Key = r.Key[next:] + } + da.bc[idx].SetSingleParam() + if err := da.build(records, nextIndex(base, sib.c), 0, usedBase); err != nil { + return err + } + case WildcardCharacter: + r := records[0] + name := r.Key[depth+1 : len(r.Key)-1] + r.paramNames = append(r.paramNames, name) + r.Key = "" + da.bc[idx].SetWildcardParam() + if err := da.build(records, nextIndex(base, sib.c), 0, usedBase); err != nil { + return err + } + default: + if err := da.build(records, nextIndex(base, sib.c), depth+1, usedBase); err != nil { + return err + } + } + } + return nil +} + +// setBase sets BASE. +func (da *doubleArray) setBase(i, base int) { + da.bc[i].SetBase(base) +} + +// setCheck sets CHECK. +func (da *doubleArray) setCheck(i int, check byte) { + da.bc[i].SetCheck(check) +} + +// findEmptyIndex returns an index of unused BASE/CHECK node. +func (da *doubleArray) findEmptyIndex(start int) int { + i := start + for ; i < len(da.bc); i++ { + if da.bc[i].IsEmpty() { + break + } + } + return i +} + +// findBase returns good BASE. +func (da *doubleArray) findBase(siblings []sibling, start int, usedBase map[int]struct{}) (base int) { + for idx, firstChar := start+1, siblings[0].c; ; idx = da.findEmptyIndex(idx + 1) { + base = nextIndex(idx, firstChar) + if _, used := usedBase[base]; used { + continue + } + i := 0 + for ; i < len(siblings); i++ { + next := nextIndex(base, siblings[i].c) + if len(da.bc) <= next { + da.bc = append(da.bc, make([]baseCheck, next-len(da.bc)+1)...) + } + if !da.bc[next].IsEmpty() { + break + } + } + if i == len(siblings) { + break + } + } + usedBase[base] = struct{}{} + return base +} + +func (da *doubleArray) arrange(records []*record, idx, depth int, usedBase map[int]struct{}) (base int, siblings []sibling, leaf *record, err error) { + siblings, leaf, err = makeSiblings(records, depth) + if err != nil { + return -1, nil, nil, err + } + if len(siblings) < 1 { + return -1, nil, leaf, nil + } + base = da.findBase(siblings, idx, usedBase) + if base > MaxSize { + return -1, nil, nil, errors.New("denco: too many elements of internal slice") + } + da.setBase(idx, base) + return base, siblings, leaf, err +} + +// node represents a node of Double-Array. +type node struct { + data interface{} + + // Names of path parameters. + paramNames []string +} + +// makeNode returns a new node from record. +func makeNode(r *record) (*node, error) { + dups := make(map[string]bool) + for _, name := range r.paramNames { + if dups[name] { + return nil, fmt.Errorf("denco: path parameter `%v' is duplicated in the key `%v'", name, r.Key) + } + dups[name] = true + } + return &node{data: r.Value, paramNames: r.paramNames}, nil +} + +// sibling represents an intermediate data of build for Double-Array. +type sibling struct { + // An index of start of duplicated characters. + start int + + // An index of end of duplicated characters. + end int + + // A character of sibling. + c byte +} + +// nextIndex returns a next index of array of BASE/CHECK. +func nextIndex(base int, c byte) int { + return base ^ int(c) +} + +// makeSiblings returns slice of sibling. +func makeSiblings(records []*record, depth int) (sib []sibling, leaf *record, err error) { + var ( + pc byte + n int + ) + for i, r := range records { + if len(r.Key) <= depth { + leaf = r + continue + } + c := r.Key[depth] + switch { + case pc < c: + sib = append(sib, sibling{start: i, c: c}) + case pc == c: + continue + default: + return nil, nil, errors.New("denco: BUG: routing table hasn't been sorted") + } + if n > 0 { + sib[n-1].end = i + } + pc = c + n++ + } + if n == 0 { + return nil, leaf, nil + } + sib[n-1].end = len(records) + return sib, leaf, nil +} + +// Record represents a record data for router construction. +type Record struct { + // Key for router construction. + Key string + + // Result value for Key. + Value interface{} +} + +// NewRecord returns a new Record. +func NewRecord(key string, value interface{}) Record { + return Record{ + Key: key, + Value: value, + } +} + +// record represents a record that use to build the Double-Array. +type record struct { + Record + paramNames []string +} + +// makeRecords returns the records that use to build Double-Arrays. +func makeRecords(srcs []Record) (statics, params []*record) { + termChar := string(TerminationCharacter) + paramPrefix := string(SeparatorCharacter) + string(ParamCharacter) + wildcardPrefix := string(SeparatorCharacter) + string(WildcardCharacter) + restconfPrefix := string(PathParamCharacter) + string(ParamCharacter) + for _, r := range srcs { + if strings.Contains(r.Key, paramPrefix) || strings.Contains(r.Key, wildcardPrefix) || strings.Contains(r.Key, restconfPrefix) { + r.Key += termChar + params = append(params, &record{Record: r}) + } else { + statics = append(statics, &record{Record: r}) + } + } + return statics, params +} + +// recordSlice represents a slice of Record for sort and implements the sort.Interface. +type recordSlice []*record + +// Len implements the sort.Interface.Len. +func (rs recordSlice) Len() int { + return len(rs) +} + +// Less implements the sort.Interface.Less. +func (rs recordSlice) Less(i, j int) bool { + return rs[i].Key < rs[j].Key +} + +// Swap implements the sort.Interface.Swap. +func (rs recordSlice) Swap(i, j int) { + rs[i], rs[j] = rs[j], rs[i] +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/denco/server.go b/vendor/github.com/go-openapi/runtime/middleware/denco/server.go new file mode 100644 index 0000000..0886713 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/denco/server.go @@ -0,0 +1,106 @@ +package denco + +import ( + "net/http" +) + +// Mux represents a multiplexer for HTTP request. +type Mux struct{} + +// NewMux returns a new Mux. +func NewMux() *Mux { + return &Mux{} +} + +// GET is shorthand of Mux.Handler("GET", path, handler). +func (m *Mux) GET(path string, handler HandlerFunc) Handler { + return m.Handler("GET", path, handler) +} + +// POST is shorthand of Mux.Handler("POST", path, handler). +func (m *Mux) POST(path string, handler HandlerFunc) Handler { + return m.Handler("POST", path, handler) +} + +// PUT is shorthand of Mux.Handler("PUT", path, handler). +func (m *Mux) PUT(path string, handler HandlerFunc) Handler { + return m.Handler("PUT", path, handler) +} + +// HEAD is shorthand of Mux.Handler("HEAD", path, handler). +func (m *Mux) HEAD(path string, handler HandlerFunc) Handler { + return m.Handler("HEAD", path, handler) +} + +// Handler returns a handler for HTTP method. +func (m *Mux) Handler(method, path string, handler HandlerFunc) Handler { + return Handler{ + Method: method, + Path: path, + Func: handler, + } +} + +// Build builds a http.Handler. +func (m *Mux) Build(handlers []Handler) (http.Handler, error) { + recordMap := make(map[string][]Record) + for _, h := range handlers { + recordMap[h.Method] = append(recordMap[h.Method], NewRecord(h.Path, h.Func)) + } + mux := newServeMux() + for m, records := range recordMap { + router := New() + if err := router.Build(records); err != nil { + return nil, err + } + mux.routers[m] = router + } + return mux, nil +} + +// Handler represents a handler of HTTP request. +type Handler struct { + // Method is an HTTP method. + Method string + + // Path is a routing path for handler. + Path string + + // Func is a function of handler of HTTP request. + Func HandlerFunc +} + +// The HandlerFunc type is aliased to type of handler function. +type HandlerFunc func(w http.ResponseWriter, r *http.Request, params Params) + +type serveMux struct { + routers map[string]*Router +} + +func newServeMux() *serveMux { + return &serveMux{ + routers: make(map[string]*Router), + } +} + +// ServeHTTP implements http.Handler interface. +func (mux *serveMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { + handler, params := mux.handler(r.Method, r.URL.Path) + handler(w, r, params) +} + +func (mux *serveMux) handler(method, path string) (HandlerFunc, []Param) { + if router, found := mux.routers[method]; found { + if handler, params, found := router.Lookup(path); found { + return handler.(HandlerFunc), params + } + } + return NotFound, nil +} + +// NotFound replies to the request with an HTTP 404 not found error. +// NotFound is called when unknown HTTP method or a handler not found. +// If you want to use the your own NotFound handler, please overwrite this variable. +var NotFound = func(w http.ResponseWriter, r *http.Request, _ Params) { + http.NotFound(w, r) +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/denco/util.go b/vendor/github.com/go-openapi/runtime/middleware/denco/util.go new file mode 100644 index 0000000..edc1f6a --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/denco/util.go @@ -0,0 +1,12 @@ +package denco + +// NextSeparator returns an index of next separator in path. +func NextSeparator(path string, start int) int { + for start < len(path) { + if c := path[start]; c == '/' || c == TerminationCharacter { + break + } + start++ + } + return start +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/doc.go b/vendor/github.com/go-openapi/runtime/middleware/doc.go new file mode 100644 index 0000000..836a988 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/doc.go @@ -0,0 +1,63 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package middleware provides the library with helper functions for serving swagger APIs. + +Pseudo middleware handler + + import ( + "net/http" + + "github.com/go-openapi/errors" + ) + + func newCompleteMiddleware(ctx *Context) http.Handler { + return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + // use context to lookup routes + if matched, ok := ctx.RouteInfo(r); ok { + + if matched.NeedsAuth() { + if _, err := ctx.Authorize(r, matched); err != nil { + ctx.Respond(rw, r, matched.Produces, matched, err) + return + } + } + + bound, validation := ctx.BindAndValidate(r, matched) + if validation != nil { + ctx.Respond(rw, r, matched.Produces, matched, validation) + return + } + + result, err := matched.Handler.Handle(bound) + if err != nil { + ctx.Respond(rw, r, matched.Produces, matched, err) + return + } + + ctx.Respond(rw, r, matched.Produces, matched, result) + return + } + + // Not found, check if it exists in the other methods first + if others := ctx.AllowedMethods(r); len(others) > 0 { + ctx.Respond(rw, r, ctx.spec.RequiredProduces(), nil, errors.MethodNotAllowed(r.Method, others)) + return + } + ctx.Respond(rw, r, ctx.spec.RequiredProduces(), nil, errors.NotFound("path %s was not found", r.URL.Path)) + }) + } +*/ +package middleware diff --git a/vendor/github.com/go-openapi/runtime/middleware/header/header.go b/vendor/github.com/go-openapi/runtime/middleware/header/header.go new file mode 100644 index 0000000..df073c8 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/header/header.go @@ -0,0 +1,332 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd. + +// this file was taken from the github.com/golang/gddo repository + +// Package header provides functions for parsing HTTP headers. +package header + +import ( + "net/http" + "strings" + "time" +) + +// Octet types from RFC 2616. +var octetTypes [256]octetType + +type octetType byte + +const ( + isToken octetType = 1 << iota + isSpace +) + +func init() { + // OCTET = + // CHAR = + // CTL = + // CR = + // LF = + // SP = + // HT = + // <"> = + // CRLF = CR LF + // LWS = [CRLF] 1*( SP | HT ) + // TEXT = + // separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <"> + // | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT + // token = 1* + // qdtext = > + + for c := 0; c < 256; c++ { + var t octetType + isCtl := c <= 31 || c == 127 + isChar := 0 <= c && c <= 127 + isSeparator := strings.ContainsRune(" \t\"(),/:;<=>?@[]\\{}", rune(c)) + if strings.ContainsRune(" \t\r\n", rune(c)) { + t |= isSpace + } + if isChar && !isCtl && !isSeparator { + t |= isToken + } + octetTypes[c] = t + } +} + +// Copy returns a shallow copy of the header. +func Copy(header http.Header) http.Header { + h := make(http.Header) + for k, vs := range header { + h[k] = vs + } + return h +} + +var timeLayouts = []string{"Mon, 02 Jan 2006 15:04:05 GMT", time.RFC850, time.ANSIC} + +// ParseTime parses the header as time. The zero value is returned if the +// header is not present or there is an error parsing the +// header. +func ParseTime(header http.Header, key string) time.Time { + if s := header.Get(key); s != "" { + for _, layout := range timeLayouts { + if t, err := time.Parse(layout, s); err == nil { + return t.UTC() + } + } + } + return time.Time{} +} + +// ParseList parses a comma separated list of values. Commas are ignored in +// quoted strings. Quoted values are not unescaped or unquoted. Whitespace is +// trimmed. +func ParseList(header http.Header, key string) []string { + var result []string + for _, s := range header[http.CanonicalHeaderKey(key)] { + begin := 0 + end := 0 + escape := false + quote := false + for i := 0; i < len(s); i++ { + b := s[i] + switch { + case escape: + escape = false + end = i + 1 + case quote: + switch b { + case '\\': + escape = true + case '"': + quote = false + } + end = i + 1 + case b == '"': + quote = true + end = i + 1 + case octetTypes[b]&isSpace != 0: + if begin == end { + begin = i + 1 + end = begin + } + case b == ',': + if begin < end { + result = append(result, s[begin:end]) + } + begin = i + 1 + end = begin + default: + end = i + 1 + } + } + if begin < end { + result = append(result, s[begin:end]) + } + } + return result +} + +// ParseValueAndParams parses a comma separated list of values with optional +// semicolon separated name-value pairs. Content-Type and Content-Disposition +// headers are in this format. +func ParseValueAndParams(header http.Header, key string) (string, map[string]string) { + return parseValueAndParams(header.Get(key)) +} + +func parseValueAndParams(s string) (value string, params map[string]string) { + params = make(map[string]string) + value, s = expectTokenSlash(s) + if value == "" { + return + } + value = strings.ToLower(value) + s = skipSpace(s) + for strings.HasPrefix(s, ";") { + var pkey string + pkey, s = expectToken(skipSpace(s[1:])) + if pkey == "" { + return + } + if !strings.HasPrefix(s, "=") { + return + } + var pvalue string + pvalue, s = expectTokenOrQuoted(s[1:]) + if pvalue == "" { + return + } + pkey = strings.ToLower(pkey) + params[pkey] = pvalue + s = skipSpace(s) + } + return +} + +// AcceptSpec ... +type AcceptSpec struct { + Value string + Q float64 +} + +// ParseAccept2 ... +func ParseAccept2(header http.Header, key string) (specs []AcceptSpec) { + for _, en := range ParseList(header, key) { + v, p := parseValueAndParams(en) + var spec AcceptSpec + spec.Value = v + spec.Q = 1.0 + if p != nil { + if q, ok := p["q"]; ok { + spec.Q, _ = expectQuality(q) + } + } + if spec.Q < 0.0 { + continue + } + specs = append(specs, spec) + } + + return +} + +// ParseAccept parses Accept* headers. +func ParseAccept(header http.Header, key string) []AcceptSpec { + var specs []AcceptSpec +loop: + for _, s := range header[key] { + for { + var spec AcceptSpec + spec.Value, s = expectTokenSlash(s) + if spec.Value == "" { + continue loop + } + spec.Q = 1.0 + s = skipSpace(s) + if strings.HasPrefix(s, ";") { + s = skipSpace(s[1:]) + for !strings.HasPrefix(s, "q=") && s != "" && !strings.HasPrefix(s, ",") { + s = skipSpace(s[1:]) + } + if strings.HasPrefix(s, "q=") { + spec.Q, s = expectQuality(s[2:]) + if spec.Q < 0.0 { + continue loop + } + } + } + + specs = append(specs, spec) + s = skipSpace(s) + if !strings.HasPrefix(s, ",") { + continue loop + } + s = skipSpace(s[1:]) + } + } + + return specs +} + +func skipSpace(s string) (rest string) { + i := 0 + for ; i < len(s); i++ { + if octetTypes[s[i]]&isSpace == 0 { + break + } + } + return s[i:] +} + +func expectToken(s string) (token, rest string) { + i := 0 + for ; i < len(s); i++ { + if octetTypes[s[i]]&isToken == 0 { + break + } + } + return s[:i], s[i:] +} + +func expectTokenSlash(s string) (token, rest string) { + i := 0 + for ; i < len(s); i++ { + b := s[i] + if (octetTypes[b]&isToken == 0) && b != '/' { + break + } + } + return s[:i], s[i:] +} + +func expectQuality(s string) (q float64, rest string) { + switch { + case len(s) == 0: + return -1, "" + case s[0] == '0': + // q is already 0 + s = s[1:] + case s[0] == '1': + s = s[1:] + q = 1 + case s[0] == '.': + // q is already 0 + default: + return -1, "" + } + if !strings.HasPrefix(s, ".") { + return q, s + } + s = s[1:] + i := 0 + n := 0 + d := 1 + for ; i < len(s); i++ { + b := s[i] + if b < '0' || b > '9' { + break + } + n = n*10 + int(b) - '0' + d *= 10 + } + return q + float64(n)/float64(d), s[i:] +} + +func expectTokenOrQuoted(s string) (value string, rest string) { + if !strings.HasPrefix(s, "\"") { + return expectToken(s) + } + s = s[1:] + for i := 0; i < len(s); i++ { + switch s[i] { + case '"': + return s[:i], s[i+1:] + case '\\': + p := make([]byte, len(s)-1) + j := copy(p, s[:i]) + escape := true + for i++; i < len(s); i++ { + b := s[i] + switch { + case escape: + escape = false + p[j] = b + j++ + case b == '\\': + escape = true + case b == '"': + return string(p[:j]), s[i+1:] + default: + p[j] = b + j++ + } + } + return "", "" + } + } + return "", "" +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/negotiate.go b/vendor/github.com/go-openapi/runtime/middleware/negotiate.go new file mode 100644 index 0000000..a9b6f27 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/negotiate.go @@ -0,0 +1,98 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd. + +// this file was taken from the github.com/golang/gddo repository + +package middleware + +import ( + "net/http" + "strings" + + "github.com/go-openapi/runtime/middleware/header" +) + +// NegotiateContentEncoding returns the best offered content encoding for the +// request's Accept-Encoding header. If two offers match with equal weight and +// then the offer earlier in the list is preferred. If no offers are +// acceptable, then "" is returned. +func NegotiateContentEncoding(r *http.Request, offers []string) string { + bestOffer := "identity" + bestQ := -1.0 + specs := header.ParseAccept(r.Header, "Accept-Encoding") + for _, offer := range offers { + for _, spec := range specs { + if spec.Q > bestQ && + (spec.Value == "*" || spec.Value == offer) { + bestQ = spec.Q + bestOffer = offer + } + } + } + if bestQ == 0 { + bestOffer = "" + } + return bestOffer +} + +// NegotiateContentType returns the best offered content type for the request's +// Accept header. If two offers match with equal weight, then the more specific +// offer is preferred. For example, text/* trumps */*. If two offers match +// with equal weight and specificity, then the offer earlier in the list is +// preferred. If no offers match, then defaultOffer is returned. +func NegotiateContentType(r *http.Request, offers []string, defaultOffer string) string { + bestOffer := defaultOffer + bestQ := -1.0 + bestWild := 3 + specs := header.ParseAccept(r.Header, "Accept") + for _, rawOffer := range offers { + offer := normalizeOffer(rawOffer) + // No Accept header: just return the first offer. + if len(specs) == 0 { + return rawOffer + } + for _, spec := range specs { + switch { + case spec.Q == 0.0: + // ignore + case spec.Q < bestQ: + // better match found + case spec.Value == "*/*": + if spec.Q > bestQ || bestWild > 2 { + bestQ = spec.Q + bestWild = 2 + bestOffer = rawOffer + } + case strings.HasSuffix(spec.Value, "/*"): + if strings.HasPrefix(offer, spec.Value[:len(spec.Value)-1]) && + (spec.Q > bestQ || bestWild > 1) { + bestQ = spec.Q + bestWild = 1 + bestOffer = rawOffer + } + default: + if spec.Value == offer && + (spec.Q > bestQ || bestWild > 0) { + bestQ = spec.Q + bestWild = 0 + bestOffer = rawOffer + } + } + } + } + return bestOffer +} + +func normalizeOffers(orig []string) (norm []string) { + for _, o := range orig { + norm = append(norm, normalizeOffer(o)) + } + return +} + +func normalizeOffer(orig string) string { + return strings.SplitN(orig, ";", 2)[0] +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/not_implemented.go b/vendor/github.com/go-openapi/runtime/middleware/not_implemented.go new file mode 100644 index 0000000..bc6942a --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/not_implemented.go @@ -0,0 +1,67 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package middleware + +import ( + "net/http" + + "github.com/go-openapi/runtime" +) + +type errorResp struct { + code int + response interface{} + headers http.Header +} + +func (e *errorResp) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + for k, v := range e.headers { + for _, val := range v { + rw.Header().Add(k, val) + } + } + if e.code > 0 { + rw.WriteHeader(e.code) + } else { + rw.WriteHeader(http.StatusInternalServerError) + } + if err := producer.Produce(rw, e.response); err != nil { + Logger.Printf("failed to write error response: %v", err) + } +} + +// NotImplemented the error response when the response is not implemented +func NotImplemented(message string) Responder { + return Error(http.StatusNotImplemented, message) +} + +// Error creates a generic responder for returning errors, the data will be serialized +// with the matching producer for the request +func Error(code int, data interface{}, headers ...http.Header) Responder { + var hdr http.Header + for _, h := range headers { + for k, v := range h { + if hdr == nil { + hdr = make(http.Header) + } + hdr[k] = v + } + } + return &errorResp{ + code: code, + response: data, + headers: hdr, + } +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/operation.go b/vendor/github.com/go-openapi/runtime/middleware/operation.go new file mode 100644 index 0000000..1175a63 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/operation.go @@ -0,0 +1,30 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package middleware + +import "net/http" + +// NewOperationExecutor creates a context aware middleware that handles the operations after routing +func NewOperationExecutor(ctx *Context) http.Handler { + return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + // use context to lookup routes + route, rCtx, _ := ctx.RouteInfo(r) + if rCtx != nil { + r = rCtx + } + + route.Handler.ServeHTTP(rw, r) + }) +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/parameter.go b/vendor/github.com/go-openapi/runtime/middleware/parameter.go new file mode 100644 index 0000000..9c3353a --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/parameter.go @@ -0,0 +1,491 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package middleware + +import ( + "encoding" + "encoding/base64" + "fmt" + "io" + "net/http" + "reflect" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/spec" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" + + "github.com/go-openapi/runtime" +) + +const defaultMaxMemory = 32 << 20 + +const ( + typeString = "string" + typeArray = "array" +) + +var textUnmarshalType = reflect.TypeOf(new(encoding.TextUnmarshaler)).Elem() + +func newUntypedParamBinder(param spec.Parameter, spec *spec.Swagger, formats strfmt.Registry) *untypedParamBinder { + binder := new(untypedParamBinder) + binder.Name = param.Name + binder.parameter = ¶m + binder.formats = formats + if param.In != "body" { + binder.validator = validate.NewParamValidator(¶m, formats) + } else { + binder.validator = validate.NewSchemaValidator(param.Schema, spec, param.Name, formats) + } + + return binder +} + +type untypedParamBinder struct { + parameter *spec.Parameter + formats strfmt.Registry + Name string + validator validate.EntityValidator +} + +func (p *untypedParamBinder) Type() reflect.Type { + return p.typeForSchema(p.parameter.Type, p.parameter.Format, p.parameter.Items) +} + +func (p *untypedParamBinder) typeForSchema(tpe, format string, items *spec.Items) reflect.Type { + switch tpe { + case "boolean": + return reflect.TypeOf(true) + + case typeString: + if tt, ok := p.formats.GetType(format); ok { + return tt + } + return reflect.TypeOf("") + + case "integer": + switch format { + case "int8": + return reflect.TypeOf(int8(0)) + case "int16": + return reflect.TypeOf(int16(0)) + case "int32": + return reflect.TypeOf(int32(0)) + case "int64": + return reflect.TypeOf(int64(0)) + default: + return reflect.TypeOf(int64(0)) + } + + case "number": + switch format { + case "float": + return reflect.TypeOf(float32(0)) + case "double": + return reflect.TypeOf(float64(0)) + } + + case typeArray: + if items == nil { + return nil + } + itemsType := p.typeForSchema(items.Type, items.Format, items.Items) + if itemsType == nil { + return nil + } + return reflect.MakeSlice(reflect.SliceOf(itemsType), 0, 0).Type() + + case "file": + return reflect.TypeOf(&runtime.File{}).Elem() + + case "object": + return reflect.TypeOf(map[string]interface{}{}) + } + return nil +} + +func (p *untypedParamBinder) allowsMulti() bool { + return p.parameter.In == "query" || p.parameter.In == "formData" +} + +func (p *untypedParamBinder) readValue(values runtime.Gettable, target reflect.Value) ([]string, bool, bool, error) { + name, in, cf, tpe := p.parameter.Name, p.parameter.In, p.parameter.CollectionFormat, p.parameter.Type + if tpe == typeArray { + if cf == "multi" { + if !p.allowsMulti() { + return nil, false, false, errors.InvalidCollectionFormat(name, in, cf) + } + vv, hasKey, _ := values.GetOK(name) + return vv, false, hasKey, nil + } + + v, hk, hv := values.GetOK(name) + if !hv { + return nil, false, hk, nil + } + d, c, e := p.readFormattedSliceFieldValue(v[len(v)-1], target) + return d, c, hk, e + } + + vv, hk, _ := values.GetOK(name) + return vv, false, hk, nil +} + +func (p *untypedParamBinder) Bind(request *http.Request, routeParams RouteParams, consumer runtime.Consumer, target reflect.Value) error { + // fmt.Println("binding", p.name, "as", p.Type()) + switch p.parameter.In { + case "query": + data, custom, hasKey, err := p.readValue(runtime.Values(request.URL.Query()), target) + if err != nil { + return err + } + if custom { + return nil + } + + return p.bindValue(data, hasKey, target) + + case "header": + data, custom, hasKey, err := p.readValue(runtime.Values(request.Header), target) + if err != nil { + return err + } + if custom { + return nil + } + return p.bindValue(data, hasKey, target) + + case "path": + data, custom, hasKey, err := p.readValue(routeParams, target) + if err != nil { + return err + } + if custom { + return nil + } + return p.bindValue(data, hasKey, target) + + case "formData": + var err error + var mt string + + mt, _, e := runtime.ContentType(request.Header) + if e != nil { + // because of the interface conversion go thinks the error is not nil + // so we first check for nil and then set the err var if it's not nil + err = e + } + + if err != nil { + return errors.InvalidContentType("", []string{"multipart/form-data", "application/x-www-form-urlencoded"}) + } + + if mt != "multipart/form-data" && mt != "application/x-www-form-urlencoded" { + return errors.InvalidContentType(mt, []string{"multipart/form-data", "application/x-www-form-urlencoded"}) + } + + if mt == "multipart/form-data" { + if err = request.ParseMultipartForm(defaultMaxMemory); err != nil { + return errors.NewParseError(p.Name, p.parameter.In, "", err) + } + } + + if err = request.ParseForm(); err != nil { + return errors.NewParseError(p.Name, p.parameter.In, "", err) + } + + if p.parameter.Type == "file" { + file, header, ffErr := request.FormFile(p.parameter.Name) + if ffErr != nil { + if p.parameter.Required { + return errors.NewParseError(p.Name, p.parameter.In, "", ffErr) + } + + return nil + } + + target.Set(reflect.ValueOf(runtime.File{Data: file, Header: header})) + return nil + } + + if request.MultipartForm != nil { + data, custom, hasKey, rvErr := p.readValue(runtime.Values(request.MultipartForm.Value), target) + if rvErr != nil { + return rvErr + } + if custom { + return nil + } + return p.bindValue(data, hasKey, target) + } + data, custom, hasKey, err := p.readValue(runtime.Values(request.PostForm), target) + if err != nil { + return err + } + if custom { + return nil + } + return p.bindValue(data, hasKey, target) + + case "body": + newValue := reflect.New(target.Type()) + if !runtime.HasBody(request) { + if p.parameter.Default != nil { + target.Set(reflect.ValueOf(p.parameter.Default)) + } + + return nil + } + if err := consumer.Consume(request.Body, newValue.Interface()); err != nil { + if err == io.EOF && p.parameter.Default != nil { + target.Set(reflect.ValueOf(p.parameter.Default)) + return nil + } + tpe := p.parameter.Type + if p.parameter.Format != "" { + tpe = p.parameter.Format + } + return errors.InvalidType(p.Name, p.parameter.In, tpe, nil) + } + target.Set(reflect.Indirect(newValue)) + return nil + default: + return errors.New(500, fmt.Sprintf("invalid parameter location %q", p.parameter.In)) + } +} + +func (p *untypedParamBinder) bindValue(data []string, hasKey bool, target reflect.Value) error { + if p.parameter.Type == typeArray { + return p.setSliceFieldValue(target, p.parameter.Default, data, hasKey) + } + var d string + if len(data) > 0 { + d = data[len(data)-1] + } + return p.setFieldValue(target, p.parameter.Default, d, hasKey) +} + +func (p *untypedParamBinder) setFieldValue(target reflect.Value, defaultValue interface{}, data string, hasKey bool) error { //nolint:gocyclo + tpe := p.parameter.Type + if p.parameter.Format != "" { + tpe = p.parameter.Format + } + + if (!hasKey || (!p.parameter.AllowEmptyValue && data == "")) && p.parameter.Required && p.parameter.Default == nil { + return errors.Required(p.Name, p.parameter.In, data) + } + + ok, err := p.tryUnmarshaler(target, defaultValue, data) + if err != nil { + return errors.InvalidType(p.Name, p.parameter.In, tpe, data) + } + if ok { + return nil + } + + defVal := reflect.Zero(target.Type()) + if defaultValue != nil { + defVal = reflect.ValueOf(defaultValue) + } + + if tpe == "byte" { + if data == "" { + if target.CanSet() { + target.SetBytes(defVal.Bytes()) + } + return nil + } + + b, err := base64.StdEncoding.DecodeString(data) + if err != nil { + b, err = base64.URLEncoding.DecodeString(data) + if err != nil { + return errors.InvalidType(p.Name, p.parameter.In, tpe, data) + } + } + if target.CanSet() { + target.SetBytes(b) + } + return nil + } + + switch target.Kind() { //nolint:exhaustive // we want to check only types that map from a swagger parameter + case reflect.Bool: + if data == "" { + if target.CanSet() { + target.SetBool(defVal.Bool()) + } + return nil + } + b, err := swag.ConvertBool(data) + if err != nil { + return err + } + if target.CanSet() { + target.SetBool(b) + } + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + if data == "" { + if target.CanSet() { + rd := defVal.Convert(reflect.TypeOf(int64(0))) + target.SetInt(rd.Int()) + } + return nil + } + i, err := strconv.ParseInt(data, 10, 64) + if err != nil { + return errors.InvalidType(p.Name, p.parameter.In, tpe, data) + } + if target.OverflowInt(i) { + return errors.InvalidType(p.Name, p.parameter.In, tpe, data) + } + if target.CanSet() { + target.SetInt(i) + } + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + if data == "" { + if target.CanSet() { + rd := defVal.Convert(reflect.TypeOf(uint64(0))) + target.SetUint(rd.Uint()) + } + return nil + } + u, err := strconv.ParseUint(data, 10, 64) + if err != nil { + return errors.InvalidType(p.Name, p.parameter.In, tpe, data) + } + if target.OverflowUint(u) { + return errors.InvalidType(p.Name, p.parameter.In, tpe, data) + } + if target.CanSet() { + target.SetUint(u) + } + + case reflect.Float32, reflect.Float64: + if data == "" { + if target.CanSet() { + rd := defVal.Convert(reflect.TypeOf(float64(0))) + target.SetFloat(rd.Float()) + } + return nil + } + f, err := strconv.ParseFloat(data, 64) + if err != nil { + return errors.InvalidType(p.Name, p.parameter.In, tpe, data) + } + if target.OverflowFloat(f) { + return errors.InvalidType(p.Name, p.parameter.In, tpe, data) + } + if target.CanSet() { + target.SetFloat(f) + } + + case reflect.String: + value := data + if value == "" { + value = defVal.String() + } + // validate string + if target.CanSet() { + target.SetString(value) + } + + case reflect.Ptr: + if data == "" && defVal.Kind() == reflect.Ptr { + if target.CanSet() { + target.Set(defVal) + } + return nil + } + newVal := reflect.New(target.Type().Elem()) + if err := p.setFieldValue(reflect.Indirect(newVal), defVal, data, hasKey); err != nil { + return err + } + if target.CanSet() { + target.Set(newVal) + } + + default: + return errors.InvalidType(p.Name, p.parameter.In, tpe, data) + } + return nil +} + +func (p *untypedParamBinder) tryUnmarshaler(target reflect.Value, defaultValue interface{}, data string) (bool, error) { + if !target.CanSet() { + return false, nil + } + // When a type implements encoding.TextUnmarshaler we'll use that instead of reflecting some more + if reflect.PtrTo(target.Type()).Implements(textUnmarshalType) { + if defaultValue != nil && len(data) == 0 { + target.Set(reflect.ValueOf(defaultValue)) + return true, nil + } + value := reflect.New(target.Type()) + if err := value.Interface().(encoding.TextUnmarshaler).UnmarshalText([]byte(data)); err != nil { + return true, err + } + target.Set(reflect.Indirect(value)) + return true, nil + } + return false, nil +} + +func (p *untypedParamBinder) readFormattedSliceFieldValue(data string, target reflect.Value) ([]string, bool, error) { + ok, err := p.tryUnmarshaler(target, p.parameter.Default, data) + if err != nil { + return nil, true, err + } + if ok { + return nil, true, nil + } + + return swag.SplitByFormat(data, p.parameter.CollectionFormat), false, nil +} + +func (p *untypedParamBinder) setSliceFieldValue(target reflect.Value, defaultValue interface{}, data []string, hasKey bool) error { + sz := len(data) + if (!hasKey || (!p.parameter.AllowEmptyValue && (sz == 0 || (sz == 1 && data[0] == "")))) && p.parameter.Required && defaultValue == nil { + return errors.Required(p.Name, p.parameter.In, data) + } + + defVal := reflect.Zero(target.Type()) + if defaultValue != nil { + defVal = reflect.ValueOf(defaultValue) + } + + if !target.CanSet() { + return nil + } + if sz == 0 { + target.Set(defVal) + return nil + } + + value := reflect.MakeSlice(reflect.SliceOf(target.Type().Elem()), sz, sz) + + for i := 0; i < sz; i++ { + if err := p.setFieldValue(value.Index(i), nil, data[i], hasKey); err != nil { + return err + } + } + + target.Set(value) + + return nil +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/rapidoc.go b/vendor/github.com/go-openapi/runtime/middleware/rapidoc.go new file mode 100644 index 0000000..ef75e74 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/rapidoc.go @@ -0,0 +1,80 @@ +package middleware + +import ( + "bytes" + "fmt" + "html/template" + "net/http" + "path" +) + +// RapiDocOpts configures the RapiDoc middlewares +type RapiDocOpts struct { + // BasePath for the UI, defaults to: / + BasePath string + + // Path combines with BasePath to construct the path to the UI, defaults to: "docs". + Path string + + // SpecURL is the URL of the spec document. + // + // Defaults to: /swagger.json + SpecURL string + + // Title for the documentation site, default to: API documentation + Title string + + // Template specifies a custom template to serve the UI + Template string + + // RapiDocURL points to the js asset that generates the rapidoc site. + // + // Defaults to https://unpkg.com/rapidoc/dist/rapidoc-min.js + RapiDocURL string +} + +func (r *RapiDocOpts) EnsureDefaults() { + common := toCommonUIOptions(r) + common.EnsureDefaults() + fromCommonToAnyOptions(common, r) + + // rapidoc-specifics + if r.RapiDocURL == "" { + r.RapiDocURL = rapidocLatest + } + if r.Template == "" { + r.Template = rapidocTemplate + } +} + +// RapiDoc creates a middleware to serve a documentation site for a swagger spec. +// +// This allows for altering the spec before starting the http listener. +func RapiDoc(opts RapiDocOpts, next http.Handler) http.Handler { + opts.EnsureDefaults() + + pth := path.Join(opts.BasePath, opts.Path) + tmpl := template.Must(template.New("rapidoc").Parse(opts.Template)) + assets := bytes.NewBuffer(nil) + if err := tmpl.Execute(assets, opts); err != nil { + panic(fmt.Errorf("cannot execute template: %w", err)) + } + + return serveUI(pth, assets.Bytes(), next) +} + +const ( + rapidocLatest = "https://unpkg.com/rapidoc/dist/rapidoc-min.js" + rapidocTemplate = ` + + + {{ .Title }} + + + + + + + +` +) diff --git a/vendor/github.com/go-openapi/runtime/middleware/redoc.go b/vendor/github.com/go-openapi/runtime/middleware/redoc.go new file mode 100644 index 0000000..b96b01e --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/redoc.go @@ -0,0 +1,94 @@ +package middleware + +import ( + "bytes" + "fmt" + "html/template" + "net/http" + "path" +) + +// RedocOpts configures the Redoc middlewares +type RedocOpts struct { + // BasePath for the UI, defaults to: / + BasePath string + + // Path combines with BasePath to construct the path to the UI, defaults to: "docs". + Path string + + // SpecURL is the URL of the spec document. + // + // Defaults to: /swagger.json + SpecURL string + + // Title for the documentation site, default to: API documentation + Title string + + // Template specifies a custom template to serve the UI + Template string + + // RedocURL points to the js that generates the redoc site. + // + // Defaults to: https://cdn.jsdelivr.net/npm/redoc/bundles/redoc.standalone.js + RedocURL string +} + +// EnsureDefaults in case some options are missing +func (r *RedocOpts) EnsureDefaults() { + common := toCommonUIOptions(r) + common.EnsureDefaults() + fromCommonToAnyOptions(common, r) + + // redoc-specifics + if r.RedocURL == "" { + r.RedocURL = redocLatest + } + if r.Template == "" { + r.Template = redocTemplate + } +} + +// Redoc creates a middleware to serve a documentation site for a swagger spec. +// +// This allows for altering the spec before starting the http listener. +func Redoc(opts RedocOpts, next http.Handler) http.Handler { + opts.EnsureDefaults() + + pth := path.Join(opts.BasePath, opts.Path) + tmpl := template.Must(template.New("redoc").Parse(opts.Template)) + assets := bytes.NewBuffer(nil) + if err := tmpl.Execute(assets, opts); err != nil { + panic(fmt.Errorf("cannot execute template: %w", err)) + } + + return serveUI(pth, assets.Bytes(), next) +} + +const ( + redocLatest = "https://cdn.jsdelivr.net/npm/redoc/bundles/redoc.standalone.js" + redocTemplate = ` + + + {{ .Title }} + + + + + + + + + + + + + +` +) diff --git a/vendor/github.com/go-openapi/runtime/middleware/request.go b/vendor/github.com/go-openapi/runtime/middleware/request.go new file mode 100644 index 0000000..82e1436 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/request.go @@ -0,0 +1,117 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package middleware + +import ( + "net/http" + "reflect" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/logger" + "github.com/go-openapi/spec" + "github.com/go-openapi/strfmt" +) + +// UntypedRequestBinder binds and validates the data from a http request +type UntypedRequestBinder struct { + Spec *spec.Swagger + Parameters map[string]spec.Parameter + Formats strfmt.Registry + paramBinders map[string]*untypedParamBinder + debugLogf func(string, ...any) // a logging function to debug context and all components using it +} + +// NewUntypedRequestBinder creates a new binder for reading a request. +func NewUntypedRequestBinder(parameters map[string]spec.Parameter, spec *spec.Swagger, formats strfmt.Registry) *UntypedRequestBinder { + binders := make(map[string]*untypedParamBinder) + for fieldName, param := range parameters { + binders[fieldName] = newUntypedParamBinder(param, spec, formats) + } + return &UntypedRequestBinder{ + Parameters: parameters, + paramBinders: binders, + Spec: spec, + Formats: formats, + debugLogf: debugLogfFunc(nil), + } +} + +// Bind perform the databinding and validation +func (o *UntypedRequestBinder) Bind(request *http.Request, routeParams RouteParams, consumer runtime.Consumer, data interface{}) error { + val := reflect.Indirect(reflect.ValueOf(data)) + isMap := val.Kind() == reflect.Map + var result []error + o.debugLogf("binding %d parameters for %s %s", len(o.Parameters), request.Method, request.URL.EscapedPath()) + for fieldName, param := range o.Parameters { + binder := o.paramBinders[fieldName] + o.debugLogf("binding parameter %s for %s %s", fieldName, request.Method, request.URL.EscapedPath()) + var target reflect.Value + if !isMap { + binder.Name = fieldName + target = val.FieldByName(fieldName) + } + + if isMap { + tpe := binder.Type() + if tpe == nil { + if param.Schema.Type.Contains(typeArray) { + tpe = reflect.TypeOf([]interface{}{}) + } else { + tpe = reflect.TypeOf(map[string]interface{}{}) + } + } + target = reflect.Indirect(reflect.New(tpe)) + } + + if !target.IsValid() { + result = append(result, errors.New(500, "parameter name %q is an unknown field", binder.Name)) + continue + } + + if err := binder.Bind(request, routeParams, consumer, target); err != nil { + result = append(result, err) + continue + } + + if binder.validator != nil { + rr := binder.validator.Validate(target.Interface()) + if rr != nil && rr.HasErrors() { + result = append(result, rr.AsError()) + } + } + + if isMap { + val.SetMapIndex(reflect.ValueOf(param.Name), target) + } + } + + if len(result) > 0 { + return errors.CompositeValidationError(result...) + } + + return nil +} + +// SetLogger allows for injecting a logger to catch debug entries. +// +// The logger is enabled in DEBUG mode only. +func (o *UntypedRequestBinder) SetLogger(lg logger.Logger) { + o.debugLogf = debugLogfFunc(lg) +} + +func (o *UntypedRequestBinder) setDebugLogf(fn func(string, ...any)) { + o.debugLogf = fn +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/router.go b/vendor/github.com/go-openapi/runtime/middleware/router.go new file mode 100644 index 0000000..3a6aee9 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/router.go @@ -0,0 +1,531 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package middleware + +import ( + "fmt" + "net/http" + "net/url" + fpath "path" + "regexp" + "strings" + + "github.com/go-openapi/runtime/logger" + "github.com/go-openapi/runtime/security" + "github.com/go-openapi/swag" + + "github.com/go-openapi/analysis" + "github.com/go-openapi/errors" + "github.com/go-openapi/loads" + "github.com/go-openapi/spec" + "github.com/go-openapi/strfmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/middleware/denco" +) + +// RouteParam is a object to capture route params in a framework agnostic way. +// implementations of the muxer should use these route params to communicate with the +// swagger framework +type RouteParam struct { + Name string + Value string +} + +// RouteParams the collection of route params +type RouteParams []RouteParam + +// Get gets the value for the route param for the specified key +func (r RouteParams) Get(name string) string { + vv, _, _ := r.GetOK(name) + if len(vv) > 0 { + return vv[len(vv)-1] + } + return "" +} + +// GetOK gets the value but also returns booleans to indicate if a key or value +// is present. This aids in validation and satisfies an interface in use there +// +// The returned values are: data, has key, has value +func (r RouteParams) GetOK(name string) ([]string, bool, bool) { + for _, p := range r { + if p.Name == name { + return []string{p.Value}, true, p.Value != "" + } + } + return nil, false, false +} + +// NewRouter creates a new context-aware router middleware +func NewRouter(ctx *Context, next http.Handler) http.Handler { + if ctx.router == nil { + ctx.router = DefaultRouter(ctx.spec, ctx.api, WithDefaultRouterLoggerFunc(ctx.debugLogf)) + } + + return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + if _, rCtx, ok := ctx.RouteInfo(r); ok { + next.ServeHTTP(rw, rCtx) + return + } + + // Not found, check if it exists in the other methods first + if others := ctx.AllowedMethods(r); len(others) > 0 { + ctx.Respond(rw, r, ctx.analyzer.RequiredProduces(), nil, errors.MethodNotAllowed(r.Method, others)) + return + } + + ctx.Respond(rw, r, ctx.analyzer.RequiredProduces(), nil, errors.NotFound("path %s was not found", r.URL.EscapedPath())) + }) +} + +// RoutableAPI represents an interface for things that can serve +// as a provider of implementations for the swagger router +type RoutableAPI interface { + HandlerFor(string, string) (http.Handler, bool) + ServeErrorFor(string) func(http.ResponseWriter, *http.Request, error) + ConsumersFor([]string) map[string]runtime.Consumer + ProducersFor([]string) map[string]runtime.Producer + AuthenticatorsFor(map[string]spec.SecurityScheme) map[string]runtime.Authenticator + Authorizer() runtime.Authorizer + Formats() strfmt.Registry + DefaultProduces() string + DefaultConsumes() string +} + +// Router represents a swagger-aware router +type Router interface { + Lookup(method, path string) (*MatchedRoute, bool) + OtherMethods(method, path string) []string +} + +type defaultRouteBuilder struct { + spec *loads.Document + analyzer *analysis.Spec + api RoutableAPI + records map[string][]denco.Record + debugLogf func(string, ...any) // a logging function to debug context and all components using it +} + +type defaultRouter struct { + spec *loads.Document + routers map[string]*denco.Router + debugLogf func(string, ...any) // a logging function to debug context and all components using it +} + +func newDefaultRouteBuilder(spec *loads.Document, api RoutableAPI, opts ...DefaultRouterOpt) *defaultRouteBuilder { + var o defaultRouterOpts + for _, apply := range opts { + apply(&o) + } + if o.debugLogf == nil { + o.debugLogf = debugLogfFunc(nil) // defaults to standard logger + } + + return &defaultRouteBuilder{ + spec: spec, + analyzer: analysis.New(spec.Spec()), + api: api, + records: make(map[string][]denco.Record), + debugLogf: o.debugLogf, + } +} + +// DefaultRouterOpt allows to inject optional behavior to the default router. +type DefaultRouterOpt func(*defaultRouterOpts) + +type defaultRouterOpts struct { + debugLogf func(string, ...any) +} + +// WithDefaultRouterLogger sets the debug logger for the default router. +// +// This is enabled only in DEBUG mode. +func WithDefaultRouterLogger(lg logger.Logger) DefaultRouterOpt { + return func(o *defaultRouterOpts) { + o.debugLogf = debugLogfFunc(lg) + } +} + +// WithDefaultRouterLoggerFunc sets a logging debug method for the default router. +func WithDefaultRouterLoggerFunc(fn func(string, ...any)) DefaultRouterOpt { + return func(o *defaultRouterOpts) { + o.debugLogf = fn + } +} + +// DefaultRouter creates a default implementation of the router +func DefaultRouter(spec *loads.Document, api RoutableAPI, opts ...DefaultRouterOpt) Router { + builder := newDefaultRouteBuilder(spec, api, opts...) + if spec != nil { + for method, paths := range builder.analyzer.Operations() { + for path, operation := range paths { + fp := fpath.Join(spec.BasePath(), path) + builder.debugLogf("adding route %s %s %q", method, fp, operation.ID) + builder.AddRoute(method, fp, operation) + } + } + } + return builder.Build() +} + +// RouteAuthenticator is an authenticator that can compose several authenticators together. +// It also knows when it contains an authenticator that allows for anonymous pass through. +// Contains a group of 1 or more authenticators that have a logical AND relationship +type RouteAuthenticator struct { + Authenticator map[string]runtime.Authenticator + Schemes []string + Scopes map[string][]string + allScopes []string + commonScopes []string + allowAnonymous bool +} + +func (ra *RouteAuthenticator) AllowsAnonymous() bool { + return ra.allowAnonymous +} + +// AllScopes returns a list of unique scopes that is the combination +// of all the scopes in the requirements +func (ra *RouteAuthenticator) AllScopes() []string { + return ra.allScopes +} + +// CommonScopes returns a list of unique scopes that are common in all the +// scopes in the requirements +func (ra *RouteAuthenticator) CommonScopes() []string { + return ra.commonScopes +} + +// Authenticate Authenticator interface implementation +func (ra *RouteAuthenticator) Authenticate(req *http.Request, route *MatchedRoute) (bool, interface{}, error) { + if ra.allowAnonymous { + route.Authenticator = ra + return true, nil, nil + } + // iterate in proper order + var lastResult interface{} + for _, scheme := range ra.Schemes { + if authenticator, ok := ra.Authenticator[scheme]; ok { + applies, princ, err := authenticator.Authenticate(&security.ScopedAuthRequest{ + Request: req, + RequiredScopes: ra.Scopes[scheme], + }) + if !applies { + return false, nil, nil + } + if err != nil { + route.Authenticator = ra + return true, nil, err + } + lastResult = princ + } + } + route.Authenticator = ra + return true, lastResult, nil +} + +func stringSliceUnion(slices ...[]string) []string { + unique := make(map[string]struct{}) + var result []string + for _, slice := range slices { + for _, entry := range slice { + if _, ok := unique[entry]; ok { + continue + } + unique[entry] = struct{}{} + result = append(result, entry) + } + } + return result +} + +func stringSliceIntersection(slices ...[]string) []string { + unique := make(map[string]int) + var intersection []string + + total := len(slices) + var emptyCnt int + for _, slice := range slices { + if len(slice) == 0 { + emptyCnt++ + continue + } + + for _, entry := range slice { + unique[entry]++ + if unique[entry] == total-emptyCnt { // this entry appeared in all the non-empty slices + intersection = append(intersection, entry) + } + } + } + + return intersection +} + +// RouteAuthenticators represents a group of authenticators that represent a logical OR +type RouteAuthenticators []RouteAuthenticator + +// AllowsAnonymous returns true when there is an authenticator that means optional auth +func (ras RouteAuthenticators) AllowsAnonymous() bool { + for _, ra := range ras { + if ra.AllowsAnonymous() { + return true + } + } + return false +} + +// Authenticate method implemention so this collection can be used as authenticator +func (ras RouteAuthenticators) Authenticate(req *http.Request, route *MatchedRoute) (bool, interface{}, error) { + var lastError error + var allowsAnon bool + var anonAuth RouteAuthenticator + + for _, ra := range ras { + if ra.AllowsAnonymous() { + anonAuth = ra + allowsAnon = true + continue + } + applies, usr, err := ra.Authenticate(req, route) + if !applies || err != nil || usr == nil { + if err != nil { + lastError = err + } + continue + } + return applies, usr, nil + } + + if allowsAnon && lastError == nil { + route.Authenticator = &anonAuth + return true, nil, lastError + } + return lastError != nil, nil, lastError +} + +type routeEntry struct { + PathPattern string + BasePath string + Operation *spec.Operation + Consumes []string + Consumers map[string]runtime.Consumer + Produces []string + Producers map[string]runtime.Producer + Parameters map[string]spec.Parameter + Handler http.Handler + Formats strfmt.Registry + Binder *UntypedRequestBinder + Authenticators RouteAuthenticators + Authorizer runtime.Authorizer +} + +// MatchedRoute represents the route that was matched in this request +type MatchedRoute struct { + routeEntry + Params RouteParams + Consumer runtime.Consumer + Producer runtime.Producer + Authenticator *RouteAuthenticator +} + +// HasAuth returns true when the route has a security requirement defined +func (m *MatchedRoute) HasAuth() bool { + return len(m.Authenticators) > 0 +} + +// NeedsAuth returns true when the request still +// needs to perform authentication +func (m *MatchedRoute) NeedsAuth() bool { + return m.HasAuth() && m.Authenticator == nil +} + +func (d *defaultRouter) Lookup(method, path string) (*MatchedRoute, bool) { + mth := strings.ToUpper(method) + d.debugLogf("looking up route for %s %s", method, path) + if Debug { + if len(d.routers) == 0 { + d.debugLogf("there are no known routers") + } + for meth := range d.routers { + d.debugLogf("got a router for %s", meth) + } + } + if router, ok := d.routers[mth]; ok { + if m, rp, ok := router.Lookup(fpath.Clean(path)); ok && m != nil { + if entry, ok := m.(*routeEntry); ok { + d.debugLogf("found a route for %s %s with %d parameters", method, path, len(entry.Parameters)) + var params RouteParams + for _, p := range rp { + v, err := url.PathUnescape(p.Value) + if err != nil { + d.debugLogf("failed to escape %q: %v", p.Value, err) + v = p.Value + } + // a workaround to handle fragment/composing parameters until they are supported in denco router + // check if this parameter is a fragment within a path segment + if xpos := strings.Index(entry.PathPattern, fmt.Sprintf("{%s}", p.Name)) + len(p.Name) + 2; xpos < len(entry.PathPattern) && entry.PathPattern[xpos] != '/' { + // extract fragment parameters + ep := strings.Split(entry.PathPattern[xpos:], "/")[0] + pnames, pvalues := decodeCompositParams(p.Name, v, ep, nil, nil) + for i, pname := range pnames { + params = append(params, RouteParam{Name: pname, Value: pvalues[i]}) + } + } else { + // use the parameter directly + params = append(params, RouteParam{Name: p.Name, Value: v}) + } + } + return &MatchedRoute{routeEntry: *entry, Params: params}, true + } + } else { + d.debugLogf("couldn't find a route by path for %s %s", method, path) + } + } else { + d.debugLogf("couldn't find a route by method for %s %s", method, path) + } + return nil, false +} + +func (d *defaultRouter) OtherMethods(method, path string) []string { + mn := strings.ToUpper(method) + var methods []string + for k, v := range d.routers { + if k != mn { + if _, _, ok := v.Lookup(fpath.Clean(path)); ok { + methods = append(methods, k) + continue + } + } + } + return methods +} + +func (d *defaultRouter) SetLogger(lg logger.Logger) { + d.debugLogf = debugLogfFunc(lg) +} + +// convert swagger parameters per path segment into a denco parameter as multiple parameters per segment are not supported in denco +var pathConverter = regexp.MustCompile(`{(.+?)}([^/]*)`) + +func decodeCompositParams(name string, value string, pattern string, names []string, values []string) ([]string, []string) { + pleft := strings.Index(pattern, "{") + names = append(names, name) + if pleft < 0 { + if strings.HasSuffix(value, pattern) { + values = append(values, value[:len(value)-len(pattern)]) + } else { + values = append(values, "") + } + } else { + toskip := pattern[:pleft] + pright := strings.Index(pattern, "}") + vright := strings.Index(value, toskip) + if vright >= 0 { + values = append(values, value[:vright]) + } else { + values = append(values, "") + value = "" + } + return decodeCompositParams(pattern[pleft+1:pright], value[vright+len(toskip):], pattern[pright+1:], names, values) + } + return names, values +} + +func (d *defaultRouteBuilder) AddRoute(method, path string, operation *spec.Operation) { + mn := strings.ToUpper(method) + + bp := fpath.Clean(d.spec.BasePath()) + if len(bp) > 0 && bp[len(bp)-1] == '/' { + bp = bp[:len(bp)-1] + } + + d.debugLogf("operation: %#v", *operation) + if handler, ok := d.api.HandlerFor(method, strings.TrimPrefix(path, bp)); ok { + consumes := d.analyzer.ConsumesFor(operation) + produces := d.analyzer.ProducesFor(operation) + parameters := d.analyzer.ParamsFor(method, strings.TrimPrefix(path, bp)) + + // add API defaults if not part of the spec + if defConsumes := d.api.DefaultConsumes(); defConsumes != "" && !swag.ContainsStringsCI(consumes, defConsumes) { + consumes = append(consumes, defConsumes) + } + + if defProduces := d.api.DefaultProduces(); defProduces != "" && !swag.ContainsStringsCI(produces, defProduces) { + produces = append(produces, defProduces) + } + + requestBinder := NewUntypedRequestBinder(parameters, d.spec.Spec(), d.api.Formats()) + requestBinder.setDebugLogf(d.debugLogf) + record := denco.NewRecord(pathConverter.ReplaceAllString(path, ":$1"), &routeEntry{ + BasePath: bp, + PathPattern: path, + Operation: operation, + Handler: handler, + Consumes: consumes, + Produces: produces, + Consumers: d.api.ConsumersFor(normalizeOffers(consumes)), + Producers: d.api.ProducersFor(normalizeOffers(produces)), + Parameters: parameters, + Formats: d.api.Formats(), + Binder: requestBinder, + Authenticators: d.buildAuthenticators(operation), + Authorizer: d.api.Authorizer(), + }) + d.records[mn] = append(d.records[mn], record) + } +} + +func (d *defaultRouteBuilder) buildAuthenticators(operation *spec.Operation) RouteAuthenticators { + requirements := d.analyzer.SecurityRequirementsFor(operation) + auths := make([]RouteAuthenticator, 0, len(requirements)) + for _, reqs := range requirements { + schemes := make([]string, 0, len(reqs)) + scopes := make(map[string][]string, len(reqs)) + scopeSlices := make([][]string, 0, len(reqs)) + for _, req := range reqs { + schemes = append(schemes, req.Name) + scopes[req.Name] = req.Scopes + scopeSlices = append(scopeSlices, req.Scopes) + } + + definitions := d.analyzer.SecurityDefinitionsForRequirements(reqs) + authenticators := d.api.AuthenticatorsFor(definitions) + auths = append(auths, RouteAuthenticator{ + Authenticator: authenticators, + Schemes: schemes, + Scopes: scopes, + allScopes: stringSliceUnion(scopeSlices...), + commonScopes: stringSliceIntersection(scopeSlices...), + allowAnonymous: len(reqs) == 1 && reqs[0].Name == "", + }) + } + return auths +} + +func (d *defaultRouteBuilder) Build() *defaultRouter { + routers := make(map[string]*denco.Router) + for method, records := range d.records { + router := denco.New() + _ = router.Build(records) + routers[method] = router + } + return &defaultRouter{ + spec: d.spec, + routers: routers, + debugLogf: d.debugLogf, + } +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/security.go b/vendor/github.com/go-openapi/runtime/middleware/security.go new file mode 100644 index 0000000..2b061ca --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/security.go @@ -0,0 +1,39 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package middleware + +import "net/http" + +func newSecureAPI(ctx *Context, next http.Handler) http.Handler { + return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := ctx.RouteInfo(r) + if rCtx != nil { + r = rCtx + } + if route != nil && !route.NeedsAuth() { + next.ServeHTTP(rw, r) + return + } + + _, rCtx, err := ctx.Authorize(r, route) + if err != nil { + ctx.Respond(rw, r, route.Produces, route, err) + return + } + r = rCtx + + next.ServeHTTP(rw, r) + }) +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/spec.go b/vendor/github.com/go-openapi/runtime/middleware/spec.go new file mode 100644 index 0000000..87e17e3 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/spec.go @@ -0,0 +1,102 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package middleware + +import ( + "net/http" + "path" +) + +const ( + contentTypeHeader = "Content-Type" + applicationJSON = "application/json" +) + +// SpecOption can be applied to the Spec serving middleware +type SpecOption func(*specOptions) + +var defaultSpecOptions = specOptions{ + Path: "", + Document: "swagger.json", +} + +type specOptions struct { + Path string + Document string +} + +func specOptionsWithDefaults(opts []SpecOption) specOptions { + o := defaultSpecOptions + for _, apply := range opts { + apply(&o) + } + + return o +} + +// Spec creates a middleware to serve a swagger spec as a JSON document. +// +// This allows for altering the spec before starting the http listener. +// +// The basePath argument indicates the path of the spec document (defaults to "/"). +// Additional SpecOption can be used to change the name of the document (defaults to "swagger.json"). +func Spec(basePath string, b []byte, next http.Handler, opts ...SpecOption) http.Handler { + if basePath == "" { + basePath = "/" + } + o := specOptionsWithDefaults(opts) + pth := path.Join(basePath, o.Path, o.Document) + + return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + if path.Clean(r.URL.Path) == pth { + rw.Header().Set(contentTypeHeader, applicationJSON) + rw.WriteHeader(http.StatusOK) + _, _ = rw.Write(b) + + return + } + + if next != nil { + next.ServeHTTP(rw, r) + + return + } + + rw.Header().Set(contentTypeHeader, applicationJSON) + rw.WriteHeader(http.StatusNotFound) + }) +} + +// WithSpecPath sets the path to be joined to the base path of the Spec middleware. +// +// This is empty by default. +func WithSpecPath(pth string) SpecOption { + return func(o *specOptions) { + o.Path = pth + } +} + +// WithSpecDocument sets the name of the JSON document served as a spec. +// +// By default, this is "swagger.json" +func WithSpecDocument(doc string) SpecOption { + return func(o *specOptions) { + if doc == "" { + return + } + + o.Document = doc + } +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/swaggerui.go b/vendor/github.com/go-openapi/runtime/middleware/swaggerui.go new file mode 100644 index 0000000..ec3c10c --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/swaggerui.go @@ -0,0 +1,175 @@ +package middleware + +import ( + "bytes" + "fmt" + "html/template" + "net/http" + "path" +) + +// SwaggerUIOpts configures the SwaggerUI middleware +type SwaggerUIOpts struct { + // BasePath for the API, defaults to: / + BasePath string + + // Path combines with BasePath to construct the path to the UI, defaults to: "docs". + Path string + + // SpecURL is the URL of the spec document. + // + // Defaults to: /swagger.json + SpecURL string + + // Title for the documentation site, default to: API documentation + Title string + + // Template specifies a custom template to serve the UI + Template string + + // OAuthCallbackURL the url called after OAuth2 login + OAuthCallbackURL string + + // The three components needed to embed swagger-ui + + // SwaggerURL points to the js that generates the SwaggerUI site. + // + // Defaults to: https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js + SwaggerURL string + + SwaggerPresetURL string + SwaggerStylesURL string + + Favicon32 string + Favicon16 string +} + +// EnsureDefaults in case some options are missing +func (r *SwaggerUIOpts) EnsureDefaults() { + r.ensureDefaults() + + if r.Template == "" { + r.Template = swaggeruiTemplate + } +} + +func (r *SwaggerUIOpts) EnsureDefaultsOauth2() { + r.ensureDefaults() + + if r.Template == "" { + r.Template = swaggerOAuthTemplate + } +} + +func (r *SwaggerUIOpts) ensureDefaults() { + common := toCommonUIOptions(r) + common.EnsureDefaults() + fromCommonToAnyOptions(common, r) + + // swaggerui-specifics + if r.OAuthCallbackURL == "" { + r.OAuthCallbackURL = path.Join(r.BasePath, r.Path, "oauth2-callback") + } + if r.SwaggerURL == "" { + r.SwaggerURL = swaggerLatest + } + if r.SwaggerPresetURL == "" { + r.SwaggerPresetURL = swaggerPresetLatest + } + if r.SwaggerStylesURL == "" { + r.SwaggerStylesURL = swaggerStylesLatest + } + if r.Favicon16 == "" { + r.Favicon16 = swaggerFavicon16Latest + } + if r.Favicon32 == "" { + r.Favicon32 = swaggerFavicon32Latest + } +} + +// SwaggerUI creates a middleware to serve a documentation site for a swagger spec. +// +// This allows for altering the spec before starting the http listener. +func SwaggerUI(opts SwaggerUIOpts, next http.Handler) http.Handler { + opts.EnsureDefaults() + + pth := path.Join(opts.BasePath, opts.Path) + tmpl := template.Must(template.New("swaggerui").Parse(opts.Template)) + assets := bytes.NewBuffer(nil) + if err := tmpl.Execute(assets, opts); err != nil { + panic(fmt.Errorf("cannot execute template: %w", err)) + } + + return serveUI(pth, assets.Bytes(), next) +} + +const ( + swaggerLatest = "https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js" + swaggerPresetLatest = "https://unpkg.com/swagger-ui-dist/swagger-ui-standalone-preset.js" + swaggerStylesLatest = "https://unpkg.com/swagger-ui-dist/swagger-ui.css" + swaggerFavicon32Latest = "https://unpkg.com/swagger-ui-dist/favicon-32x32.png" + swaggerFavicon16Latest = "https://unpkg.com/swagger-ui-dist/favicon-16x16.png" + swaggeruiTemplate = ` + + + + + {{ .Title }} + + + + + + + + +
+ + + + + + +` +) diff --git a/vendor/github.com/go-openapi/runtime/middleware/swaggerui_oauth2.go b/vendor/github.com/go-openapi/runtime/middleware/swaggerui_oauth2.go new file mode 100644 index 0000000..e81212f --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/swaggerui_oauth2.go @@ -0,0 +1,105 @@ +package middleware + +import ( + "bytes" + "fmt" + "net/http" + "text/template" +) + +func SwaggerUIOAuth2Callback(opts SwaggerUIOpts, next http.Handler) http.Handler { + opts.EnsureDefaultsOauth2() + + pth := opts.OAuthCallbackURL + tmpl := template.Must(template.New("swaggeroauth").Parse(opts.Template)) + assets := bytes.NewBuffer(nil) + if err := tmpl.Execute(assets, opts); err != nil { + panic(fmt.Errorf("cannot execute template: %w", err)) + } + + return serveUI(pth, assets.Bytes(), next) +} + +const ( + swaggerOAuthTemplate = ` + + + + {{ .Title }} + + + + + +` +) diff --git a/vendor/github.com/go-openapi/runtime/middleware/ui_options.go b/vendor/github.com/go-openapi/runtime/middleware/ui_options.go new file mode 100644 index 0000000..b86efa0 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/ui_options.go @@ -0,0 +1,173 @@ +package middleware + +import ( + "bytes" + "encoding/gob" + "fmt" + "net/http" + "path" + "strings" +) + +const ( + // constants that are common to all UI-serving middlewares + defaultDocsPath = "docs" + defaultDocsURL = "/swagger.json" + defaultDocsTitle = "API Documentation" +) + +// uiOptions defines common options for UI serving middlewares. +type uiOptions struct { + // BasePath for the UI, defaults to: / + BasePath string + + // Path combines with BasePath to construct the path to the UI, defaults to: "docs". + Path string + + // SpecURL is the URL of the spec document. + // + // Defaults to: /swagger.json + SpecURL string + + // Title for the documentation site, default to: API documentation + Title string + + // Template specifies a custom template to serve the UI + Template string +} + +// toCommonUIOptions converts any UI option type to retain the common options. +// +// This uses gob encoding/decoding to convert common fields from one struct to another. +func toCommonUIOptions(opts interface{}) uiOptions { + var buf bytes.Buffer + enc := gob.NewEncoder(&buf) + dec := gob.NewDecoder(&buf) + var o uiOptions + err := enc.Encode(opts) + if err != nil { + panic(err) + } + + err = dec.Decode(&o) + if err != nil { + panic(err) + } + + return o +} + +func fromCommonToAnyOptions[T any](source uiOptions, target *T) { + var buf bytes.Buffer + enc := gob.NewEncoder(&buf) + dec := gob.NewDecoder(&buf) + err := enc.Encode(source) + if err != nil { + panic(err) + } + + err = dec.Decode(target) + if err != nil { + panic(err) + } +} + +// UIOption can be applied to UI serving middleware, such as Context.APIHandler or +// Context.APIHandlerSwaggerUI to alter the defaut behavior. +type UIOption func(*uiOptions) + +func uiOptionsWithDefaults(opts []UIOption) uiOptions { + var o uiOptions + for _, apply := range opts { + apply(&o) + } + + return o +} + +// WithUIBasePath sets the base path from where to serve the UI assets. +// +// By default, Context middleware sets this value to the API base path. +func WithUIBasePath(base string) UIOption { + return func(o *uiOptions) { + if !strings.HasPrefix(base, "/") { + base = "/" + base + } + o.BasePath = base + } +} + +// WithUIPath sets the path from where to serve the UI assets (i.e. /{basepath}/{path}. +func WithUIPath(pth string) UIOption { + return func(o *uiOptions) { + o.Path = pth + } +} + +// WithUISpecURL sets the path from where to serve swagger spec document. +// +// This may be specified as a full URL or a path. +// +// By default, this is "/swagger.json" +func WithUISpecURL(specURL string) UIOption { + return func(o *uiOptions) { + o.SpecURL = specURL + } +} + +// WithUITitle sets the title of the UI. +// +// By default, Context middleware sets this value to the title found in the API spec. +func WithUITitle(title string) UIOption { + return func(o *uiOptions) { + o.Title = title + } +} + +// WithTemplate allows to set a custom template for the UI. +// +// UI middleware will panic if the template does not parse or execute properly. +func WithTemplate(tpl string) UIOption { + return func(o *uiOptions) { + o.Template = tpl + } +} + +// EnsureDefaults in case some options are missing +func (r *uiOptions) EnsureDefaults() { + if r.BasePath == "" { + r.BasePath = "/" + } + if r.Path == "" { + r.Path = defaultDocsPath + } + if r.SpecURL == "" { + r.SpecURL = defaultDocsURL + } + if r.Title == "" { + r.Title = defaultDocsTitle + } +} + +// serveUI creates a middleware that serves a templated asset as text/html. +func serveUI(pth string, assets []byte, next http.Handler) http.Handler { + return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + if path.Clean(r.URL.Path) == pth { + rw.Header().Set(contentTypeHeader, "text/html; charset=utf-8") + rw.WriteHeader(http.StatusOK) + _, _ = rw.Write(assets) + + return + } + + if next != nil { + next.ServeHTTP(rw, r) + + return + } + + rw.Header().Set(contentTypeHeader, "text/plain") + rw.WriteHeader(http.StatusNotFound) + _, _ = rw.Write([]byte(fmt.Sprintf("%q not found", pth))) + }) +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/untyped/api.go b/vendor/github.com/go-openapi/runtime/middleware/untyped/api.go new file mode 100644 index 0000000..7b7269b --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/untyped/api.go @@ -0,0 +1,287 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package untyped + +import ( + "fmt" + "net/http" + "sort" + "strings" + + "github.com/go-openapi/analysis" + "github.com/go-openapi/errors" + "github.com/go-openapi/loads" + "github.com/go-openapi/spec" + "github.com/go-openapi/strfmt" + + "github.com/go-openapi/runtime" +) + +// NewAPI creates the default untyped API +func NewAPI(spec *loads.Document) *API { + var an *analysis.Spec + if spec != nil && spec.Spec() != nil { + an = analysis.New(spec.Spec()) + } + api := &API{ + spec: spec, + analyzer: an, + consumers: make(map[string]runtime.Consumer, 10), + producers: make(map[string]runtime.Producer, 10), + authenticators: make(map[string]runtime.Authenticator), + operations: make(map[string]map[string]runtime.OperationHandler), + ServeError: errors.ServeError, + Models: make(map[string]func() interface{}), + formats: strfmt.NewFormats(), + } + return api.WithJSONDefaults() +} + +// API represents an untyped mux for a swagger spec +type API struct { + spec *loads.Document + analyzer *analysis.Spec + DefaultProduces string + DefaultConsumes string + consumers map[string]runtime.Consumer + producers map[string]runtime.Producer + authenticators map[string]runtime.Authenticator + authorizer runtime.Authorizer + operations map[string]map[string]runtime.OperationHandler + ServeError func(http.ResponseWriter, *http.Request, error) + Models map[string]func() interface{} + formats strfmt.Registry +} + +// WithJSONDefaults loads the json defaults for this api +func (d *API) WithJSONDefaults() *API { + d.DefaultConsumes = runtime.JSONMime + d.DefaultProduces = runtime.JSONMime + d.consumers[runtime.JSONMime] = runtime.JSONConsumer() + d.producers[runtime.JSONMime] = runtime.JSONProducer() + return d +} + +// WithoutJSONDefaults clears the json defaults for this api +func (d *API) WithoutJSONDefaults() *API { + d.DefaultConsumes = "" + d.DefaultProduces = "" + delete(d.consumers, runtime.JSONMime) + delete(d.producers, runtime.JSONMime) + return d +} + +// Formats returns the registered string formats +func (d *API) Formats() strfmt.Registry { + if d.formats == nil { + d.formats = strfmt.NewFormats() + } + return d.formats +} + +// RegisterFormat registers a custom format validator +func (d *API) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator) { + if d.formats == nil { + d.formats = strfmt.NewFormats() + } + d.formats.Add(name, format, validator) +} + +// RegisterAuth registers an auth handler in this api +func (d *API) RegisterAuth(scheme string, handler runtime.Authenticator) { + if d.authenticators == nil { + d.authenticators = make(map[string]runtime.Authenticator) + } + d.authenticators[scheme] = handler +} + +// RegisterAuthorizer registers an authorizer handler in this api +func (d *API) RegisterAuthorizer(handler runtime.Authorizer) { + d.authorizer = handler +} + +// RegisterConsumer registers a consumer for a media type. +func (d *API) RegisterConsumer(mediaType string, handler runtime.Consumer) { + if d.consumers == nil { + d.consumers = make(map[string]runtime.Consumer, 10) + } + d.consumers[strings.ToLower(mediaType)] = handler +} + +// RegisterProducer registers a producer for a media type +func (d *API) RegisterProducer(mediaType string, handler runtime.Producer) { + if d.producers == nil { + d.producers = make(map[string]runtime.Producer, 10) + } + d.producers[strings.ToLower(mediaType)] = handler +} + +// RegisterOperation registers an operation handler for an operation name +func (d *API) RegisterOperation(method, path string, handler runtime.OperationHandler) { + if d.operations == nil { + d.operations = make(map[string]map[string]runtime.OperationHandler, 30) + } + um := strings.ToUpper(method) + if b, ok := d.operations[um]; !ok || b == nil { + d.operations[um] = make(map[string]runtime.OperationHandler) + } + d.operations[um][path] = handler +} + +// OperationHandlerFor returns the operation handler for the specified id if it can be found +func (d *API) OperationHandlerFor(method, path string) (runtime.OperationHandler, bool) { + if d.operations == nil { + return nil, false + } + if pi, ok := d.operations[strings.ToUpper(method)]; ok { + h, ok := pi[path] + return h, ok + } + return nil, false +} + +// ConsumersFor gets the consumers for the specified media types +func (d *API) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer { + result := make(map[string]runtime.Consumer) + for _, mt := range mediaTypes { + if consumer, ok := d.consumers[mt]; ok { + result[mt] = consumer + } + } + return result +} + +// ProducersFor gets the producers for the specified media types +func (d *API) ProducersFor(mediaTypes []string) map[string]runtime.Producer { + result := make(map[string]runtime.Producer) + for _, mt := range mediaTypes { + if producer, ok := d.producers[mt]; ok { + result[mt] = producer + } + } + return result +} + +// AuthenticatorsFor gets the authenticators for the specified security schemes +func (d *API) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator { + result := make(map[string]runtime.Authenticator) + for k := range schemes { + if a, ok := d.authenticators[k]; ok { + result[k] = a + } + } + return result +} + +// Authorizer returns the registered authorizer +func (d *API) Authorizer() runtime.Authorizer { + return d.authorizer +} + +// Validate validates this API for any missing items +func (d *API) Validate() error { + return d.validate() +} + +// validateWith validates the registrations in this API against the provided spec analyzer +func (d *API) validate() error { + consumes := make([]string, 0, len(d.consumers)) + for k := range d.consumers { + consumes = append(consumes, k) + } + + produces := make([]string, 0, len(d.producers)) + for k := range d.producers { + produces = append(produces, k) + } + + authenticators := make([]string, 0, len(d.authenticators)) + for k := range d.authenticators { + authenticators = append(authenticators, k) + } + + operations := make([]string, 0, len(d.operations)) + for m, v := range d.operations { + for p := range v { + operations = append(operations, fmt.Sprintf("%s %s", strings.ToUpper(m), p)) + } + } + + secDefinitions := d.spec.Spec().SecurityDefinitions + definedAuths := make([]string, 0, len(secDefinitions)) + for k := range secDefinitions { + definedAuths = append(definedAuths, k) + } + + if err := d.verify("consumes", consumes, d.analyzer.RequiredConsumes()); err != nil { + return err + } + if err := d.verify("produces", produces, d.analyzer.RequiredProduces()); err != nil { + return err + } + if err := d.verify("operation", operations, d.analyzer.OperationMethodPaths()); err != nil { + return err + } + + requiredAuths := d.analyzer.RequiredSecuritySchemes() + if err := d.verify("auth scheme", authenticators, requiredAuths); err != nil { + return err + } + if err := d.verify("security definitions", definedAuths, requiredAuths); err != nil { + return err + } + return nil +} + +func (d *API) verify(name string, registrations []string, expectations []string) error { + sort.Strings(registrations) + sort.Strings(expectations) + + expected := map[string]struct{}{} + seen := map[string]struct{}{} + + for _, v := range expectations { + expected[v] = struct{}{} + } + + var unspecified []string + for _, v := range registrations { + seen[v] = struct{}{} + if _, ok := expected[v]; !ok { + unspecified = append(unspecified, v) + } + } + + for k := range seen { + delete(expected, k) + } + + unregistered := make([]string, 0, len(expected)) + for k := range expected { + unregistered = append(unregistered, k) + } + sort.Strings(unspecified) + sort.Strings(unregistered) + + if len(unregistered) > 0 || len(unspecified) > 0 { + return &errors.APIVerificationFailed{ + Section: name, + MissingSpecification: unspecified, + MissingRegistration: unregistered, + } + } + + return nil +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/validation.go b/vendor/github.com/go-openapi/runtime/middleware/validation.go new file mode 100644 index 0000000..0a5356c --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/validation.go @@ -0,0 +1,130 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package middleware + +import ( + "mime" + "net/http" + "strings" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + + "github.com/go-openapi/runtime" +) + +type validation struct { + context *Context + result []error + request *http.Request + route *MatchedRoute + bound map[string]interface{} +} + +// ContentType validates the content type of a request +func validateContentType(allowed []string, actual string) error { + if len(allowed) == 0 { + return nil + } + mt, _, err := mime.ParseMediaType(actual) + if err != nil { + return errors.InvalidContentType(actual, allowed) + } + if swag.ContainsStringsCI(allowed, mt) { + return nil + } + if swag.ContainsStringsCI(allowed, "*/*") { + return nil + } + parts := strings.Split(actual, "/") + if len(parts) == 2 && swag.ContainsStringsCI(allowed, parts[0]+"/*") { + return nil + } + return errors.InvalidContentType(actual, allowed) +} + +func validateRequest(ctx *Context, request *http.Request, route *MatchedRoute) *validation { + validate := &validation{ + context: ctx, + request: request, + route: route, + bound: make(map[string]interface{}), + } + validate.debugLogf("validating request %s %s", request.Method, request.URL.EscapedPath()) + + validate.contentType() + if len(validate.result) == 0 { + validate.responseFormat() + } + if len(validate.result) == 0 { + validate.parameters() + } + + return validate +} + +func (v *validation) debugLogf(format string, args ...any) { + v.context.debugLogf(format, args...) +} + +func (v *validation) parameters() { + v.debugLogf("validating request parameters for %s %s", v.request.Method, v.request.URL.EscapedPath()) + if result := v.route.Binder.Bind(v.request, v.route.Params, v.route.Consumer, v.bound); result != nil { + if result.Error() == "validation failure list" { + for _, e := range result.(*errors.Validation).Value.([]interface{}) { + v.result = append(v.result, e.(error)) + } + return + } + v.result = append(v.result, result) + } +} + +func (v *validation) contentType() { + if len(v.result) == 0 && runtime.HasBody(v.request) { + v.debugLogf("validating body content type for %s %s", v.request.Method, v.request.URL.EscapedPath()) + ct, _, req, err := v.context.ContentType(v.request) + if err != nil { + v.result = append(v.result, err) + } else { + v.request = req + } + + if len(v.result) == 0 { + v.debugLogf("validating content type for %q against [%s]", ct, strings.Join(v.route.Consumes, ", ")) + if err := validateContentType(v.route.Consumes, ct); err != nil { + v.result = append(v.result, err) + } + } + if ct != "" && v.route.Consumer == nil { + cons, ok := v.route.Consumers[ct] + if !ok { + v.result = append(v.result, errors.New(500, "no consumer registered for %s", ct)) + } else { + v.route.Consumer = cons + } + } + } +} + +func (v *validation) responseFormat() { + // if the route provides values for Produces and no format could be identify then return an error. + // if the route does not specify values for Produces then treat request as valid since the API designer + // choose not to specify the format for responses. + if str, rCtx := v.context.ResponseFormat(v.request, v.route.Produces); str == "" && len(v.route.Produces) > 0 { + v.request = rCtx + v.result = append(v.result, errors.InvalidResponseFormat(v.request.Header.Get(runtime.HeaderAccept), v.route.Produces)) + } +} diff --git a/vendor/github.com/go-openapi/runtime/request.go b/vendor/github.com/go-openapi/runtime/request.go new file mode 100644 index 0000000..9e3e1ec --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/request.go @@ -0,0 +1,149 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "bufio" + "context" + "errors" + "io" + "net/http" + "strings" + + "github.com/go-openapi/swag" +) + +// CanHaveBody returns true if this method can have a body +func CanHaveBody(method string) bool { + mn := strings.ToUpper(method) + return mn == "POST" || mn == "PUT" || mn == "PATCH" || mn == "DELETE" +} + +// IsSafe returns true if this is a request with a safe method +func IsSafe(r *http.Request) bool { + mn := strings.ToUpper(r.Method) + return mn == "GET" || mn == "HEAD" +} + +// AllowsBody returns true if the request allows for a body +func AllowsBody(r *http.Request) bool { + mn := strings.ToUpper(r.Method) + return mn != "HEAD" +} + +// HasBody returns true if this method needs a content-type +func HasBody(r *http.Request) bool { + // happy case: we have a content length set + if r.ContentLength > 0 { + return true + } + + if r.Header.Get("content-length") != "" { + // in this case, no Transfer-Encoding should be present + // we have a header set but it was explicitly set to 0, so we assume no body + return false + } + + rdr := newPeekingReader(r.Body) + r.Body = rdr + return rdr.HasContent() +} + +func newPeekingReader(r io.ReadCloser) *peekingReader { + if r == nil { + return nil + } + return &peekingReader{ + underlying: bufio.NewReader(r), + orig: r, + } +} + +type peekingReader struct { + underlying interface { + Buffered() int + Peek(int) ([]byte, error) + Read([]byte) (int, error) + } + orig io.ReadCloser +} + +func (p *peekingReader) HasContent() bool { + if p == nil { + return false + } + if p.underlying.Buffered() > 0 { + return true + } + b, err := p.underlying.Peek(1) + if err != nil { + return false + } + return len(b) > 0 +} + +func (p *peekingReader) Read(d []byte) (int, error) { + if p == nil { + return 0, io.EOF + } + if p.underlying == nil { + return 0, io.ErrUnexpectedEOF + } + return p.underlying.Read(d) +} + +func (p *peekingReader) Close() error { + if p.underlying == nil { + return errors.New("reader already closed") + } + p.underlying = nil + if p.orig != nil { + return p.orig.Close() + } + return nil +} + +// JSONRequest creates a new http request with json headers set. +// +// It uses context.Background. +func JSONRequest(method, urlStr string, body io.Reader) (*http.Request, error) { + req, err := http.NewRequestWithContext(context.Background(), method, urlStr, body) + if err != nil { + return nil, err + } + req.Header.Add(HeaderContentType, JSONMime) + req.Header.Add(HeaderAccept, JSONMime) + return req, nil +} + +// Gettable for things with a method GetOK(string) (data string, hasKey bool, hasValue bool) +type Gettable interface { + GetOK(string) ([]string, bool, bool) +} + +// ReadSingleValue reads a single value from the source +func ReadSingleValue(values Gettable, name string) string { + vv, _, hv := values.GetOK(name) + if hv { + return vv[len(vv)-1] + } + return "" +} + +// ReadCollectionValue reads a collection value from a string data source +func ReadCollectionValue(values Gettable, name, collectionFormat string) []string { + v := ReadSingleValue(values, name) + return swag.SplitByFormat(v, collectionFormat) +} diff --git a/vendor/github.com/go-openapi/runtime/security/authenticator.go b/vendor/github.com/go-openapi/runtime/security/authenticator.go new file mode 100644 index 0000000..bb30472 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/security/authenticator.go @@ -0,0 +1,277 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package security + +import ( + "context" + "net/http" + "strings" + + "github.com/go-openapi/errors" + + "github.com/go-openapi/runtime" +) + +const ( + query = "query" + header = "header" + accessTokenParam = "access_token" +) + +// HttpAuthenticator is a function that authenticates a HTTP request +func HttpAuthenticator(handler func(*http.Request) (bool, interface{}, error)) runtime.Authenticator { //nolint:revive,stylecheck + return runtime.AuthenticatorFunc(func(params interface{}) (bool, interface{}, error) { + if request, ok := params.(*http.Request); ok { + return handler(request) + } + if scoped, ok := params.(*ScopedAuthRequest); ok { + return handler(scoped.Request) + } + return false, nil, nil + }) +} + +// ScopedAuthenticator is a function that authenticates a HTTP request against a list of valid scopes +func ScopedAuthenticator(handler func(*ScopedAuthRequest) (bool, interface{}, error)) runtime.Authenticator { + return runtime.AuthenticatorFunc(func(params interface{}) (bool, interface{}, error) { + if request, ok := params.(*ScopedAuthRequest); ok { + return handler(request) + } + return false, nil, nil + }) +} + +// UserPassAuthentication authentication function +type UserPassAuthentication func(string, string) (interface{}, error) + +// UserPassAuthenticationCtx authentication function with context.Context +type UserPassAuthenticationCtx func(context.Context, string, string) (context.Context, interface{}, error) + +// TokenAuthentication authentication function +type TokenAuthentication func(string) (interface{}, error) + +// TokenAuthenticationCtx authentication function with context.Context +type TokenAuthenticationCtx func(context.Context, string) (context.Context, interface{}, error) + +// ScopedTokenAuthentication authentication function +type ScopedTokenAuthentication func(string, []string) (interface{}, error) + +// ScopedTokenAuthenticationCtx authentication function with context.Context +type ScopedTokenAuthenticationCtx func(context.Context, string, []string) (context.Context, interface{}, error) + +var DefaultRealmName = "API" + +type secCtxKey uint8 + +const ( + failedBasicAuth secCtxKey = iota + oauth2SchemeName +) + +func FailedBasicAuth(r *http.Request) string { + return FailedBasicAuthCtx(r.Context()) +} + +func FailedBasicAuthCtx(ctx context.Context) string { + v, ok := ctx.Value(failedBasicAuth).(string) + if !ok { + return "" + } + return v +} + +func OAuth2SchemeName(r *http.Request) string { + return OAuth2SchemeNameCtx(r.Context()) +} + +func OAuth2SchemeNameCtx(ctx context.Context) string { + v, ok := ctx.Value(oauth2SchemeName).(string) + if !ok { + return "" + } + return v +} + +// BasicAuth creates a basic auth authenticator with the provided authentication function +func BasicAuth(authenticate UserPassAuthentication) runtime.Authenticator { + return BasicAuthRealm(DefaultRealmName, authenticate) +} + +// BasicAuthRealm creates a basic auth authenticator with the provided authentication function and realm name +func BasicAuthRealm(realm string, authenticate UserPassAuthentication) runtime.Authenticator { + if realm == "" { + realm = DefaultRealmName + } + + return HttpAuthenticator(func(r *http.Request) (bool, interface{}, error) { + if usr, pass, ok := r.BasicAuth(); ok { + p, err := authenticate(usr, pass) + if err != nil { + *r = *r.WithContext(context.WithValue(r.Context(), failedBasicAuth, realm)) + } + return true, p, err + } + *r = *r.WithContext(context.WithValue(r.Context(), failedBasicAuth, realm)) + return false, nil, nil + }) +} + +// BasicAuthCtx creates a basic auth authenticator with the provided authentication function with support for context.Context +func BasicAuthCtx(authenticate UserPassAuthenticationCtx) runtime.Authenticator { + return BasicAuthRealmCtx(DefaultRealmName, authenticate) +} + +// BasicAuthRealmCtx creates a basic auth authenticator with the provided authentication function and realm name with support for context.Context +func BasicAuthRealmCtx(realm string, authenticate UserPassAuthenticationCtx) runtime.Authenticator { + if realm == "" { + realm = DefaultRealmName + } + + return HttpAuthenticator(func(r *http.Request) (bool, interface{}, error) { + if usr, pass, ok := r.BasicAuth(); ok { + ctx, p, err := authenticate(r.Context(), usr, pass) + if err != nil { + ctx = context.WithValue(ctx, failedBasicAuth, realm) + } + *r = *r.WithContext(ctx) + return true, p, err + } + *r = *r.WithContext(context.WithValue(r.Context(), failedBasicAuth, realm)) + return false, nil, nil + }) +} + +// APIKeyAuth creates an authenticator that uses a token for authorization. +// This token can be obtained from either a header or a query string +func APIKeyAuth(name, in string, authenticate TokenAuthentication) runtime.Authenticator { + inl := strings.ToLower(in) + if inl != query && inl != header { + // panic because this is most likely a typo + panic(errors.New(500, "api key auth: in value needs to be either \"query\" or \"header\"")) + } + + var getToken func(*http.Request) string + switch inl { + case header: + getToken = func(r *http.Request) string { return r.Header.Get(name) } + case query: + getToken = func(r *http.Request) string { return r.URL.Query().Get(name) } + } + + return HttpAuthenticator(func(r *http.Request) (bool, interface{}, error) { + token := getToken(r) + if token == "" { + return false, nil, nil + } + + p, err := authenticate(token) + return true, p, err + }) +} + +// APIKeyAuthCtx creates an authenticator that uses a token for authorization with support for context.Context. +// This token can be obtained from either a header or a query string +func APIKeyAuthCtx(name, in string, authenticate TokenAuthenticationCtx) runtime.Authenticator { + inl := strings.ToLower(in) + if inl != query && inl != header { + // panic because this is most likely a typo + panic(errors.New(500, "api key auth: in value needs to be either \"query\" or \"header\"")) + } + + var getToken func(*http.Request) string + switch inl { + case header: + getToken = func(r *http.Request) string { return r.Header.Get(name) } + case query: + getToken = func(r *http.Request) string { return r.URL.Query().Get(name) } + } + + return HttpAuthenticator(func(r *http.Request) (bool, interface{}, error) { + token := getToken(r) + if token == "" { + return false, nil, nil + } + + ctx, p, err := authenticate(r.Context(), token) + *r = *r.WithContext(ctx) + return true, p, err + }) +} + +// ScopedAuthRequest contains both a http request and the required scopes for a particular operation +type ScopedAuthRequest struct { + Request *http.Request + RequiredScopes []string +} + +// BearerAuth for use with oauth2 flows +func BearerAuth(name string, authenticate ScopedTokenAuthentication) runtime.Authenticator { + const prefix = "Bearer " + return ScopedAuthenticator(func(r *ScopedAuthRequest) (bool, interface{}, error) { + var token string + hdr := r.Request.Header.Get(runtime.HeaderAuthorization) + if strings.HasPrefix(hdr, prefix) { + token = strings.TrimPrefix(hdr, prefix) + } + if token == "" { + qs := r.Request.URL.Query() + token = qs.Get(accessTokenParam) + } + //#nosec + ct, _, _ := runtime.ContentType(r.Request.Header) + if token == "" && (ct == "application/x-www-form-urlencoded" || ct == "multipart/form-data") { + token = r.Request.FormValue(accessTokenParam) + } + + if token == "" { + return false, nil, nil + } + + rctx := context.WithValue(r.Request.Context(), oauth2SchemeName, name) + *r.Request = *r.Request.WithContext(rctx) + p, err := authenticate(token, r.RequiredScopes) + return true, p, err + }) +} + +// BearerAuthCtx for use with oauth2 flows with support for context.Context. +func BearerAuthCtx(name string, authenticate ScopedTokenAuthenticationCtx) runtime.Authenticator { + const prefix = "Bearer " + return ScopedAuthenticator(func(r *ScopedAuthRequest) (bool, interface{}, error) { + var token string + hdr := r.Request.Header.Get(runtime.HeaderAuthorization) + if strings.HasPrefix(hdr, prefix) { + token = strings.TrimPrefix(hdr, prefix) + } + if token == "" { + qs := r.Request.URL.Query() + token = qs.Get(accessTokenParam) + } + //#nosec + ct, _, _ := runtime.ContentType(r.Request.Header) + if token == "" && (ct == "application/x-www-form-urlencoded" || ct == "multipart/form-data") { + token = r.Request.FormValue(accessTokenParam) + } + + if token == "" { + return false, nil, nil + } + + rctx := context.WithValue(r.Request.Context(), oauth2SchemeName, name) + ctx, p, err := authenticate(rctx, token, r.RequiredScopes) + *r.Request = *r.Request.WithContext(ctx) + return true, p, err + }) +} diff --git a/vendor/github.com/go-openapi/runtime/security/authorizer.go b/vendor/github.com/go-openapi/runtime/security/authorizer.go new file mode 100644 index 0000000..00c1a4d --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/security/authorizer.go @@ -0,0 +1,27 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package security + +import ( + "net/http" + + "github.com/go-openapi/runtime" +) + +// Authorized provides a default implementation of the Authorizer interface where all +// requests are authorized (successful) +func Authorized() runtime.Authorizer { + return runtime.AuthorizerFunc(func(_ *http.Request, _ interface{}) error { return nil }) +} diff --git a/vendor/github.com/go-openapi/runtime/statuses.go b/vendor/github.com/go-openapi/runtime/statuses.go new file mode 100644 index 0000000..3b011a0 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/statuses.go @@ -0,0 +1,90 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +// Statuses lists the most common HTTP status codes to default message +// taken from https://httpstatuses.com/ +var Statuses = map[int]string{ + 100: "Continue", + 101: "Switching Protocols", + 102: "Processing", + 103: "Checkpoint", + 122: "URI too long", + 200: "OK", + 201: "Created", + 202: "Accepted", + 203: "Request Processed", + 204: "No Content", + 205: "Reset Content", + 206: "Partial Content", + 207: "Multi-Status", + 208: "Already Reported", + 226: "IM Used", + 300: "Multiple Choices", + 301: "Moved Permanently", + 302: "Found", + 303: "See Other", + 304: "Not Modified", + 305: "Use Proxy", + 306: "Switch Proxy", + 307: "Temporary Redirect", + 308: "Permanent Redirect", + 400: "Bad Request", + 401: "Unauthorized", + 402: "Payment Required", + 403: "Forbidden", + 404: "Not Found", + 405: "Method Not Allowed", + 406: "Not Acceptable", + 407: "Proxy Authentication Required", + 408: "Request Timeout", + 409: "Conflict", + 410: "Gone", + 411: "Length Required", + 412: "Precondition Failed", + 413: "Request Entity Too Large", + 414: "Request-URI Too Long", + 415: "Unsupported Media Type", + 416: "Request Range Not Satisfiable", + 417: "Expectation Failed", + 418: "I'm a teapot", + 420: "Enhance Your Calm", + 422: "Unprocessable Entity", + 423: "Locked", + 424: "Failed Dependency", + 426: "Upgrade Required", + 428: "Precondition Required", + 429: "Too Many Requests", + 431: "Request Header Fields Too Large", + 444: "No Response", + 449: "Retry With", + 450: "Blocked by Windows Parental Controls", + 451: "Wrong Exchange Server", + 499: "Client Closed Request", + 500: "Internal Server Error", + 501: "Not Implemented", + 502: "Bad Gateway", + 503: "Service Unavailable", + 504: "Gateway Timeout", + 505: "HTTP Version Not Supported", + 506: "Variant Also Negotiates", + 507: "Insufficient Storage", + 508: "Loop Detected", + 509: "Bandwidth Limit Exceeded", + 510: "Not Extended", + 511: "Network Authentication Required", + 598: "Network read timeout error", + 599: "Network connect timeout error", +} diff --git a/vendor/github.com/go-openapi/runtime/text.go b/vendor/github.com/go-openapi/runtime/text.go new file mode 100644 index 0000000..f33320b --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/text.go @@ -0,0 +1,116 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "bytes" + "encoding" + "errors" + "fmt" + "io" + "reflect" + + "github.com/go-openapi/swag" +) + +// TextConsumer creates a new text consumer +func TextConsumer() Consumer { + return ConsumerFunc(func(reader io.Reader, data interface{}) error { + if reader == nil { + return errors.New("TextConsumer requires a reader") // early exit + } + + buf := new(bytes.Buffer) + _, err := buf.ReadFrom(reader) + if err != nil { + return err + } + b := buf.Bytes() + + // If the buffer is empty, no need to unmarshal it, which causes a panic. + if len(b) == 0 { + return nil + } + + if tu, ok := data.(encoding.TextUnmarshaler); ok { + err := tu.UnmarshalText(b) + if err != nil { + return fmt.Errorf("text consumer: %v", err) + } + + return nil + } + + t := reflect.TypeOf(data) + if data != nil && t.Kind() == reflect.Ptr { + v := reflect.Indirect(reflect.ValueOf(data)) + if t.Elem().Kind() == reflect.String { + v.SetString(string(b)) + return nil + } + } + + return fmt.Errorf("%v (%T) is not supported by the TextConsumer, %s", + data, data, "can be resolved by supporting TextUnmarshaler interface") + }) +} + +// TextProducer creates a new text producer +func TextProducer() Producer { + return ProducerFunc(func(writer io.Writer, data interface{}) error { + if writer == nil { + return errors.New("TextProducer requires a writer") // early exit + } + + if data == nil { + return errors.New("no data given to produce text from") + } + + if tm, ok := data.(encoding.TextMarshaler); ok { + txt, err := tm.MarshalText() + if err != nil { + return fmt.Errorf("text producer: %v", err) + } + _, err = writer.Write(txt) + return err + } + + if str, ok := data.(error); ok { + _, err := writer.Write([]byte(str.Error())) + return err + } + + if str, ok := data.(fmt.Stringer); ok { + _, err := writer.Write([]byte(str.String())) + return err + } + + v := reflect.Indirect(reflect.ValueOf(data)) + if t := v.Type(); t.Kind() == reflect.Struct || t.Kind() == reflect.Slice { + b, err := swag.WriteJSON(data) + if err != nil { + return err + } + _, err = writer.Write(b) + return err + } + if v.Kind() != reflect.String { + return fmt.Errorf("%T is not a supported type by the TextProducer", data) + } + + _, err := writer.Write([]byte(v.String())) + return err + }) +} diff --git a/vendor/github.com/go-openapi/runtime/values.go b/vendor/github.com/go-openapi/runtime/values.go new file mode 100644 index 0000000..11f5732 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/values.go @@ -0,0 +1,19 @@ +package runtime + +// Values typically represent parameters on a http request. +type Values map[string][]string + +// GetOK returns the values collection for the given key. +// When the key is present in the map it will return true for hasKey. +// When the value is not empty it will return true for hasValue. +func (v Values) GetOK(key string) (value []string, hasKey bool, hasValue bool) { + value, hasKey = v[key] + if !hasKey { + return + } + if len(value) == 0 { + return + } + hasValue = true + return +} diff --git a/vendor/github.com/go-openapi/runtime/xml.go b/vendor/github.com/go-openapi/runtime/xml.go new file mode 100644 index 0000000..821c739 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/xml.go @@ -0,0 +1,36 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "encoding/xml" + "io" +) + +// XMLConsumer creates a new XML consumer +func XMLConsumer() Consumer { + return ConsumerFunc(func(reader io.Reader, data interface{}) error { + dec := xml.NewDecoder(reader) + return dec.Decode(data) + }) +} + +// XMLProducer creates a new XML producer +func XMLProducer() Producer { + return ProducerFunc(func(writer io.Writer, data interface{}) error { + enc := xml.NewEncoder(writer) + return enc.Encode(data) + }) +} diff --git a/vendor/github.com/go-openapi/runtime/yamlpc/yaml.go b/vendor/github.com/go-openapi/runtime/yamlpc/yaml.go new file mode 100644 index 0000000..a1a0a58 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/yamlpc/yaml.go @@ -0,0 +1,39 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package yamlpc + +import ( + "io" + + "github.com/go-openapi/runtime" + "gopkg.in/yaml.v3" +) + +// YAMLConsumer creates a consumer for yaml data +func YAMLConsumer() runtime.Consumer { + return runtime.ConsumerFunc(func(r io.Reader, v interface{}) error { + dec := yaml.NewDecoder(r) + return dec.Decode(v) + }) +} + +// YAMLProducer creates a producer for yaml data +func YAMLProducer() runtime.Producer { + return runtime.ProducerFunc(func(w io.Writer, v interface{}) error { + enc := yaml.NewEncoder(w) + defer enc.Close() + return enc.Encode(v) + }) +} diff --git a/vendor/github.com/go-openapi/spec/.editorconfig b/vendor/github.com/go-openapi/spec/.editorconfig new file mode 100644 index 0000000..3152da6 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/.editorconfig @@ -0,0 +1,26 @@ +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + +# Set default charset +[*.{js,py,go,scala,rb,java,html,css,less,sass,md}] +charset = utf-8 + +# Tab indentation (no size specified) +[*.go] +indent_style = tab + +[*.md] +trim_trailing_whitespace = false + +# Matches the exact files either package.json or .travis.yml +[{package.json,.travis.yml}] +indent_style = space +indent_size = 2 diff --git a/vendor/github.com/go-openapi/spec/.gitignore b/vendor/github.com/go-openapi/spec/.gitignore new file mode 100644 index 0000000..f47cb20 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/.gitignore @@ -0,0 +1 @@ +*.out diff --git a/vendor/github.com/go-openapi/spec/.golangci.yml b/vendor/github.com/go-openapi/spec/.golangci.yml new file mode 100644 index 0000000..22f8d21 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/.golangci.yml @@ -0,0 +1,61 @@ +linters-settings: + govet: + check-shadowing: true + golint: + min-confidence: 0 + gocyclo: + min-complexity: 45 + maligned: + suggest-new: true + dupl: + threshold: 200 + goconst: + min-len: 2 + min-occurrences: 3 + +linters: + enable-all: true + disable: + - maligned + - unparam + - lll + - gochecknoinits + - gochecknoglobals + - funlen + - godox + - gocognit + - whitespace + - wsl + - wrapcheck + - testpackage + - nlreturn + - gomnd + - exhaustivestruct + - goerr113 + - errorlint + - nestif + - godot + - gofumpt + - paralleltest + - tparallel + - thelper + - ifshort + - exhaustruct + - varnamelen + - gci + - depguard + - errchkjson + - inamedparam + - nonamedreturns + - musttag + - ireturn + - forcetypeassert + - cyclop + # deprecated linters + - deadcode + - interfacer + - scopelint + - varcheck + - structcheck + - golint + - nosnakecase diff --git a/vendor/github.com/go-openapi/spec/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/spec/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..9322b06 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at ivan+abuse@flanders.co.nz. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/go-openapi/spec/LICENSE b/vendor/github.com/go-openapi/spec/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-openapi/spec/README.md b/vendor/github.com/go-openapi/spec/README.md new file mode 100644 index 0000000..7fd2810 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/README.md @@ -0,0 +1,54 @@ +# OpenAPI v2 object model [![Build Status](https://github.com/go-openapi/spec/actions/workflows/go-test.yml/badge.svg)](https://github.com/go-openapi/spec/actions?query=workflow%3A"go+test") [![codecov](https://codecov.io/gh/go-openapi/spec/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/spec) + +[![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) +[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/spec/master/LICENSE) +[![Go Reference](https://pkg.go.dev/badge/github.com/go-openapi/spec.svg)](https://pkg.go.dev/github.com/go-openapi/spec) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/spec)](https://goreportcard.com/report/github.com/go-openapi/spec) + +The object model for OpenAPI specification documents. + +### FAQ + +* What does this do? + +> 1. This package knows how to marshal and unmarshal Swagger API specifications into a golang object model +> 2. It knows how to resolve $ref and expand them to make a single root document + +* How does it play with the rest of the go-openapi packages ? + +> 1. This package is at the core of the go-openapi suite of packages and [code generator](https://github.com/go-swagger/go-swagger) +> 2. There is a [spec loading package](https://github.com/go-openapi/loads) to fetch specs as JSON or YAML from local or remote locations +> 3. There is a [spec validation package](https://github.com/go-openapi/validate) built on top of it +> 4. There is a [spec analysis package](https://github.com/go-openapi/analysis) built on top of it, to analyze, flatten, fix and merge spec documents + +* Does this library support OpenAPI 3? + +> No. +> This package currently only supports OpenAPI 2.0 (aka Swagger 2.0). +> There is no plan to make it evolve toward supporting OpenAPI 3.x. +> This [discussion thread](https://github.com/go-openapi/spec/issues/21) relates the full story. +> +> An early attempt to support Swagger 3 may be found at: https://github.com/go-openapi/spec3 + +* Does the unmarshaling support YAML? + +> Not directly. The exposed types know only how to unmarshal from JSON. +> +> In order to load a YAML document as a Swagger spec, you need to use the loaders provided by +> github.com/go-openapi/loads +> +> Take a look at the example there: https://pkg.go.dev/github.com/go-openapi/loads#example-Spec +> +> See also https://github.com/go-openapi/spec/issues/164 + +* How can I validate a spec? + +> Validation is provided by [the validate package](http://github.com/go-openapi/validate) + +* Why do we have an `ID` field for `Schema` which is not part of the swagger spec? + +> We found jsonschema compatibility more important: since `id` in jsonschema influences +> how `$ref` are resolved. +> This `id` does not conflict with any property named `id`. +> +> See also https://github.com/go-openapi/spec/issues/23 diff --git a/vendor/github.com/go-openapi/spec/cache.go b/vendor/github.com/go-openapi/spec/cache.go new file mode 100644 index 0000000..122993b --- /dev/null +++ b/vendor/github.com/go-openapi/spec/cache.go @@ -0,0 +1,98 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "sync" +) + +// ResolutionCache a cache for resolving urls +type ResolutionCache interface { + Get(string) (interface{}, bool) + Set(string, interface{}) +} + +type simpleCache struct { + lock sync.RWMutex + store map[string]interface{} +} + +func (s *simpleCache) ShallowClone() ResolutionCache { + store := make(map[string]interface{}, len(s.store)) + s.lock.RLock() + for k, v := range s.store { + store[k] = v + } + s.lock.RUnlock() + + return &simpleCache{ + store: store, + } +} + +// Get retrieves a cached URI +func (s *simpleCache) Get(uri string) (interface{}, bool) { + s.lock.RLock() + v, ok := s.store[uri] + + s.lock.RUnlock() + return v, ok +} + +// Set caches a URI +func (s *simpleCache) Set(uri string, data interface{}) { + s.lock.Lock() + s.store[uri] = data + s.lock.Unlock() +} + +var ( + // resCache is a package level cache for $ref resolution and expansion. + // It is initialized lazily by methods that have the need for it: no + // memory is allocated unless some expander methods are called. + // + // It is initialized with JSON schema and swagger schema, + // which do not mutate during normal operations. + // + // All subsequent utilizations of this cache are produced from a shallow + // clone of this initial version. + resCache *simpleCache + onceCache sync.Once + + _ ResolutionCache = &simpleCache{} +) + +// initResolutionCache initializes the URI resolution cache. To be wrapped in a sync.Once.Do call. +func initResolutionCache() { + resCache = defaultResolutionCache() +} + +func defaultResolutionCache() *simpleCache { + return &simpleCache{store: map[string]interface{}{ + "http://swagger.io/v2/schema.json": MustLoadSwagger20Schema(), + "http://json-schema.org/draft-04/schema": MustLoadJSONSchemaDraft04(), + }} +} + +func cacheOrDefault(cache ResolutionCache) ResolutionCache { + onceCache.Do(initResolutionCache) + + if cache != nil { + return cache + } + + // get a shallow clone of the base cache with swagger and json schema + return resCache.ShallowClone() +} diff --git a/vendor/github.com/go-openapi/spec/contact_info.go b/vendor/github.com/go-openapi/spec/contact_info.go new file mode 100644 index 0000000..2f7bb21 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/contact_info.go @@ -0,0 +1,57 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + + "github.com/go-openapi/swag" +) + +// ContactInfo contact information for the exposed API. +// +// For more information: http://goo.gl/8us55a#contactObject +type ContactInfo struct { + ContactInfoProps + VendorExtensible +} + +// ContactInfoProps hold the properties of a ContactInfo object +type ContactInfoProps struct { + Name string `json:"name,omitempty"` + URL string `json:"url,omitempty"` + Email string `json:"email,omitempty"` +} + +// UnmarshalJSON hydrates ContactInfo from json +func (c *ContactInfo) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &c.ContactInfoProps); err != nil { + return err + } + return json.Unmarshal(data, &c.VendorExtensible) +} + +// MarshalJSON produces ContactInfo as json +func (c ContactInfo) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(c.ContactInfoProps) + if err != nil { + return nil, err + } + b2, err := json.Marshal(c.VendorExtensible) + if err != nil { + return nil, err + } + return swag.ConcatJSON(b1, b2), nil +} diff --git a/vendor/github.com/go-openapi/spec/debug.go b/vendor/github.com/go-openapi/spec/debug.go new file mode 100644 index 0000000..fc889f6 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/debug.go @@ -0,0 +1,49 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "fmt" + "log" + "os" + "path" + "runtime" +) + +// Debug is true when the SWAGGER_DEBUG env var is not empty. +// +// It enables a more verbose logging of this package. +var Debug = os.Getenv("SWAGGER_DEBUG") != "" + +var ( + // specLogger is a debug logger for this package + specLogger *log.Logger +) + +func init() { + debugOptions() +} + +func debugOptions() { + specLogger = log.New(os.Stdout, "spec:", log.LstdFlags) +} + +func debugLog(msg string, args ...interface{}) { + // A private, trivial trace logger, based on go-openapi/spec/expander.go:debugLog() + if Debug { + _, file1, pos1, _ := runtime.Caller(1) + specLogger.Printf("%s:%d: %s", path.Base(file1), pos1, fmt.Sprintf(msg, args...)) + } +} diff --git a/vendor/github.com/go-openapi/spec/embed.go b/vendor/github.com/go-openapi/spec/embed.go new file mode 100644 index 0000000..1f42847 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/embed.go @@ -0,0 +1,17 @@ +package spec + +import ( + "embed" + "path" +) + +//go:embed schemas/*.json schemas/*/*.json +var assets embed.FS + +func jsonschemaDraft04JSONBytes() ([]byte, error) { + return assets.ReadFile(path.Join("schemas", "jsonschema-draft-04.json")) +} + +func v2SchemaJSONBytes() ([]byte, error) { + return assets.ReadFile(path.Join("schemas", "v2", "schema.json")) +} diff --git a/vendor/github.com/go-openapi/spec/errors.go b/vendor/github.com/go-openapi/spec/errors.go new file mode 100644 index 0000000..6992c7b --- /dev/null +++ b/vendor/github.com/go-openapi/spec/errors.go @@ -0,0 +1,19 @@ +package spec + +import "errors" + +// Error codes +var ( + // ErrUnknownTypeForReference indicates that a resolved reference was found in an unsupported container type + ErrUnknownTypeForReference = errors.New("unknown type for the resolved reference") + + // ErrResolveRefNeedsAPointer indicates that a $ref target must be a valid JSON pointer + ErrResolveRefNeedsAPointer = errors.New("resolve ref: target needs to be a pointer") + + // ErrDerefUnsupportedType indicates that a resolved reference was found in an unsupported container type. + // At the moment, $ref are supported only inside: schemas, parameters, responses, path items + ErrDerefUnsupportedType = errors.New("deref: unsupported type") + + // ErrExpandUnsupportedType indicates that $ref expansion is attempted on some invalid type + ErrExpandUnsupportedType = errors.New("expand: unsupported type. Input should be of type *Parameter or *Response") +) diff --git a/vendor/github.com/go-openapi/spec/expander.go b/vendor/github.com/go-openapi/spec/expander.go new file mode 100644 index 0000000..b81a569 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/expander.go @@ -0,0 +1,607 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + "fmt" +) + +// ExpandOptions provides options for the spec expander. +// +// RelativeBase is the path to the root document. This can be a remote URL or a path to a local file. +// +// If left empty, the root document is assumed to be located in the current working directory: +// all relative $ref's will be resolved from there. +// +// PathLoader injects a document loading method. By default, this resolves to the function provided by the SpecLoader package variable. +type ExpandOptions struct { + RelativeBase string // the path to the root document to expand. This is a file, not a directory + SkipSchemas bool // do not expand schemas, just paths, parameters and responses + ContinueOnError bool // continue expanding even after and error is found + PathLoader func(string) (json.RawMessage, error) `json:"-"` // the document loading method that takes a path as input and yields a json document + AbsoluteCircularRef bool // circular $ref remaining after expansion remain absolute URLs +} + +func optionsOrDefault(opts *ExpandOptions) *ExpandOptions { + if opts != nil { + clone := *opts // shallow clone to avoid internal changes to be propagated to the caller + if clone.RelativeBase != "" { + clone.RelativeBase = normalizeBase(clone.RelativeBase) + } + // if the relative base is empty, let the schema loader choose a pseudo root document + return &clone + } + return &ExpandOptions{} +} + +// ExpandSpec expands the references in a swagger spec +func ExpandSpec(spec *Swagger, options *ExpandOptions) error { + options = optionsOrDefault(options) + resolver := defaultSchemaLoader(spec, options, nil, nil) + + specBasePath := options.RelativeBase + + if !options.SkipSchemas { + for key, definition := range spec.Definitions { + parentRefs := make([]string, 0, 10) + parentRefs = append(parentRefs, "#/definitions/"+key) + + def, err := expandSchema(definition, parentRefs, resolver, specBasePath) + if resolver.shouldStopOnError(err) { + return err + } + if def != nil { + spec.Definitions[key] = *def + } + } + } + + for key := range spec.Parameters { + parameter := spec.Parameters[key] + if err := expandParameterOrResponse(¶meter, resolver, specBasePath); resolver.shouldStopOnError(err) { + return err + } + spec.Parameters[key] = parameter + } + + for key := range spec.Responses { + response := spec.Responses[key] + if err := expandParameterOrResponse(&response, resolver, specBasePath); resolver.shouldStopOnError(err) { + return err + } + spec.Responses[key] = response + } + + if spec.Paths != nil { + for key := range spec.Paths.Paths { + pth := spec.Paths.Paths[key] + if err := expandPathItem(&pth, resolver, specBasePath); resolver.shouldStopOnError(err) { + return err + } + spec.Paths.Paths[key] = pth + } + } + + return nil +} + +const rootBase = ".root" + +// baseForRoot loads in the cache the root document and produces a fake ".root" base path entry +// for further $ref resolution +func baseForRoot(root interface{}, cache ResolutionCache) string { + // cache the root document to resolve $ref's + normalizedBase := normalizeBase(rootBase) + + if root == nil { + // ensure that we never leave a nil root: always cache the root base pseudo-document + cachedRoot, found := cache.Get(normalizedBase) + if found && cachedRoot != nil { + // the cache is already preloaded with a root + return normalizedBase + } + + root = map[string]interface{}{} + } + + cache.Set(normalizedBase, root) + + return normalizedBase +} + +// ExpandSchema expands the refs in the schema object with reference to the root object. +// +// go-openapi/validate uses this function. +// +// Notice that it is impossible to reference a json schema in a different document other than root +// (use ExpandSchemaWithBasePath to resolve external references). +// +// Setting the cache is optional and this parameter may safely be left to nil. +func ExpandSchema(schema *Schema, root interface{}, cache ResolutionCache) error { + cache = cacheOrDefault(cache) + if root == nil { + root = schema + } + + opts := &ExpandOptions{ + // when a root is specified, cache the root as an in-memory document for $ref retrieval + RelativeBase: baseForRoot(root, cache), + SkipSchemas: false, + ContinueOnError: false, + } + + return ExpandSchemaWithBasePath(schema, cache, opts) +} + +// ExpandSchemaWithBasePath expands the refs in the schema object, base path configured through expand options. +// +// Setting the cache is optional and this parameter may safely be left to nil. +func ExpandSchemaWithBasePath(schema *Schema, cache ResolutionCache, opts *ExpandOptions) error { + if schema == nil { + return nil + } + + cache = cacheOrDefault(cache) + + opts = optionsOrDefault(opts) + + resolver := defaultSchemaLoader(nil, opts, cache, nil) + + parentRefs := make([]string, 0, 10) + s, err := expandSchema(*schema, parentRefs, resolver, opts.RelativeBase) + if err != nil { + return err + } + if s != nil { + // guard for when continuing on error + *schema = *s + } + + return nil +} + +func expandItems(target Schema, parentRefs []string, resolver *schemaLoader, basePath string) (*Schema, error) { + if target.Items == nil { + return &target, nil + } + + // array + if target.Items.Schema != nil { + t, err := expandSchema(*target.Items.Schema, parentRefs, resolver, basePath) + if err != nil { + return nil, err + } + *target.Items.Schema = *t + } + + // tuple + for i := range target.Items.Schemas { + t, err := expandSchema(target.Items.Schemas[i], parentRefs, resolver, basePath) + if err != nil { + return nil, err + } + target.Items.Schemas[i] = *t + } + + return &target, nil +} + +func expandSchema(target Schema, parentRefs []string, resolver *schemaLoader, basePath string) (*Schema, error) { + if target.Ref.String() == "" && target.Ref.IsRoot() { + newRef := normalizeRef(&target.Ref, basePath) + target.Ref = *newRef + return &target, nil + } + + // change the base path of resolution when an ID is encountered + // otherwise the basePath should inherit the parent's + if target.ID != "" { + basePath, _ = resolver.setSchemaID(target, target.ID, basePath) + } + + if target.Ref.String() != "" { + if !resolver.options.SkipSchemas { + return expandSchemaRef(target, parentRefs, resolver, basePath) + } + + // when "expand" with SkipSchema, we just rebase the existing $ref without replacing + // the full schema. + rebasedRef, err := NewRef(normalizeURI(target.Ref.String(), basePath)) + if err != nil { + return nil, err + } + target.Ref = denormalizeRef(&rebasedRef, resolver.context.basePath, resolver.context.rootID) + + return &target, nil + } + + for k := range target.Definitions { + tt, err := expandSchema(target.Definitions[k], parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if tt != nil { + target.Definitions[k] = *tt + } + } + + t, err := expandItems(target, parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if t != nil { + target = *t + } + + for i := range target.AllOf { + t, err := expandSchema(target.AllOf[i], parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if t != nil { + target.AllOf[i] = *t + } + } + + for i := range target.AnyOf { + t, err := expandSchema(target.AnyOf[i], parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if t != nil { + target.AnyOf[i] = *t + } + } + + for i := range target.OneOf { + t, err := expandSchema(target.OneOf[i], parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if t != nil { + target.OneOf[i] = *t + } + } + + if target.Not != nil { + t, err := expandSchema(*target.Not, parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if t != nil { + *target.Not = *t + } + } + + for k := range target.Properties { + t, err := expandSchema(target.Properties[k], parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if t != nil { + target.Properties[k] = *t + } + } + + if target.AdditionalProperties != nil && target.AdditionalProperties.Schema != nil { + t, err := expandSchema(*target.AdditionalProperties.Schema, parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if t != nil { + *target.AdditionalProperties.Schema = *t + } + } + + for k := range target.PatternProperties { + t, err := expandSchema(target.PatternProperties[k], parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if t != nil { + target.PatternProperties[k] = *t + } + } + + for k := range target.Dependencies { + if target.Dependencies[k].Schema != nil { + t, err := expandSchema(*target.Dependencies[k].Schema, parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if t != nil { + *target.Dependencies[k].Schema = *t + } + } + } + + if target.AdditionalItems != nil && target.AdditionalItems.Schema != nil { + t, err := expandSchema(*target.AdditionalItems.Schema, parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if t != nil { + *target.AdditionalItems.Schema = *t + } + } + return &target, nil +} + +func expandSchemaRef(target Schema, parentRefs []string, resolver *schemaLoader, basePath string) (*Schema, error) { + // if a Ref is found, all sibling fields are skipped + // Ref also changes the resolution scope of children expandSchema + + // here the resolution scope is changed because a $ref was encountered + normalizedRef := normalizeRef(&target.Ref, basePath) + normalizedBasePath := normalizedRef.RemoteURI() + + if resolver.isCircular(normalizedRef, basePath, parentRefs...) { + // this means there is a cycle in the recursion tree: return the Ref + // - circular refs cannot be expanded. We leave them as ref. + // - denormalization means that a new local file ref is set relative to the original basePath + debugLog("short circuit circular ref: basePath: %s, normalizedPath: %s, normalized ref: %s", + basePath, normalizedBasePath, normalizedRef.String()) + if !resolver.options.AbsoluteCircularRef { + target.Ref = denormalizeRef(normalizedRef, resolver.context.basePath, resolver.context.rootID) + } else { + target.Ref = *normalizedRef + } + return &target, nil + } + + var t *Schema + err := resolver.Resolve(&target.Ref, &t, basePath) + if resolver.shouldStopOnError(err) { + return nil, err + } + + if t == nil { + // guard for when continuing on error + return &target, nil + } + + parentRefs = append(parentRefs, normalizedRef.String()) + transitiveResolver := resolver.transitiveResolver(basePath, target.Ref) + + basePath = resolver.updateBasePath(transitiveResolver, normalizedBasePath) + + return expandSchema(*t, parentRefs, transitiveResolver, basePath) +} + +func expandPathItem(pathItem *PathItem, resolver *schemaLoader, basePath string) error { + if pathItem == nil { + return nil + } + + parentRefs := make([]string, 0, 10) + if err := resolver.deref(pathItem, parentRefs, basePath); resolver.shouldStopOnError(err) { + return err + } + + if pathItem.Ref.String() != "" { + transitiveResolver := resolver.transitiveResolver(basePath, pathItem.Ref) + basePath = transitiveResolver.updateBasePath(resolver, basePath) + resolver = transitiveResolver + } + + pathItem.Ref = Ref{} + for i := range pathItem.Parameters { + if err := expandParameterOrResponse(&(pathItem.Parameters[i]), resolver, basePath); resolver.shouldStopOnError(err) { + return err + } + } + + ops := []*Operation{ + pathItem.Get, + pathItem.Head, + pathItem.Options, + pathItem.Put, + pathItem.Post, + pathItem.Patch, + pathItem.Delete, + } + for _, op := range ops { + if err := expandOperation(op, resolver, basePath); resolver.shouldStopOnError(err) { + return err + } + } + + return nil +} + +func expandOperation(op *Operation, resolver *schemaLoader, basePath string) error { + if op == nil { + return nil + } + + for i := range op.Parameters { + param := op.Parameters[i] + if err := expandParameterOrResponse(¶m, resolver, basePath); resolver.shouldStopOnError(err) { + return err + } + op.Parameters[i] = param + } + + if op.Responses == nil { + return nil + } + + responses := op.Responses + if err := expandParameterOrResponse(responses.Default, resolver, basePath); resolver.shouldStopOnError(err) { + return err + } + + for code := range responses.StatusCodeResponses { + response := responses.StatusCodeResponses[code] + if err := expandParameterOrResponse(&response, resolver, basePath); resolver.shouldStopOnError(err) { + return err + } + responses.StatusCodeResponses[code] = response + } + + return nil +} + +// ExpandResponseWithRoot expands a response based on a root document, not a fetchable document +// +// Notice that it is impossible to reference a json schema in a different document other than root +// (use ExpandResponse to resolve external references). +// +// Setting the cache is optional and this parameter may safely be left to nil. +func ExpandResponseWithRoot(response *Response, root interface{}, cache ResolutionCache) error { + cache = cacheOrDefault(cache) + opts := &ExpandOptions{ + RelativeBase: baseForRoot(root, cache), + } + resolver := defaultSchemaLoader(root, opts, cache, nil) + + return expandParameterOrResponse(response, resolver, opts.RelativeBase) +} + +// ExpandResponse expands a response based on a basepath +// +// All refs inside response will be resolved relative to basePath +func ExpandResponse(response *Response, basePath string) error { + opts := optionsOrDefault(&ExpandOptions{ + RelativeBase: basePath, + }) + resolver := defaultSchemaLoader(nil, opts, nil, nil) + + return expandParameterOrResponse(response, resolver, opts.RelativeBase) +} + +// ExpandParameterWithRoot expands a parameter based on a root document, not a fetchable document. +// +// Notice that it is impossible to reference a json schema in a different document other than root +// (use ExpandParameter to resolve external references). +func ExpandParameterWithRoot(parameter *Parameter, root interface{}, cache ResolutionCache) error { + cache = cacheOrDefault(cache) + + opts := &ExpandOptions{ + RelativeBase: baseForRoot(root, cache), + } + resolver := defaultSchemaLoader(root, opts, cache, nil) + + return expandParameterOrResponse(parameter, resolver, opts.RelativeBase) +} + +// ExpandParameter expands a parameter based on a basepath. +// This is the exported version of expandParameter +// all refs inside parameter will be resolved relative to basePath +func ExpandParameter(parameter *Parameter, basePath string) error { + opts := optionsOrDefault(&ExpandOptions{ + RelativeBase: basePath, + }) + resolver := defaultSchemaLoader(nil, opts, nil, nil) + + return expandParameterOrResponse(parameter, resolver, opts.RelativeBase) +} + +func getRefAndSchema(input interface{}) (*Ref, *Schema, error) { + var ( + ref *Ref + sch *Schema + ) + + switch refable := input.(type) { + case *Parameter: + if refable == nil { + return nil, nil, nil + } + ref = &refable.Ref + sch = refable.Schema + case *Response: + if refable == nil { + return nil, nil, nil + } + ref = &refable.Ref + sch = refable.Schema + default: + return nil, nil, fmt.Errorf("unsupported type: %T: %w", input, ErrExpandUnsupportedType) + } + + return ref, sch, nil +} + +func expandParameterOrResponse(input interface{}, resolver *schemaLoader, basePath string) error { + ref, sch, err := getRefAndSchema(input) + if err != nil { + return err + } + + if ref == nil && sch == nil { // nothing to do + return nil + } + + parentRefs := make([]string, 0, 10) + if ref != nil { + // dereference this $ref + if err = resolver.deref(input, parentRefs, basePath); resolver.shouldStopOnError(err) { + return err + } + + ref, sch, _ = getRefAndSchema(input) + } + + if ref.String() != "" { + transitiveResolver := resolver.transitiveResolver(basePath, *ref) + basePath = resolver.updateBasePath(transitiveResolver, basePath) + resolver = transitiveResolver + } + + if sch == nil { + // nothing to be expanded + if ref != nil { + *ref = Ref{} + } + + return nil + } + + if sch.Ref.String() != "" { + rebasedRef, ern := NewRef(normalizeURI(sch.Ref.String(), basePath)) + if ern != nil { + return ern + } + + if resolver.isCircular(&rebasedRef, basePath, parentRefs...) { + // this is a circular $ref: stop expansion + if !resolver.options.AbsoluteCircularRef { + sch.Ref = denormalizeRef(&rebasedRef, resolver.context.basePath, resolver.context.rootID) + } else { + sch.Ref = rebasedRef + } + } + } + + // $ref expansion or rebasing is performed by expandSchema below + if ref != nil { + *ref = Ref{} + } + + // expand schema + // yes, we do it even if options.SkipSchema is true: we have to go down that rabbit hole and rebase nested $ref) + s, err := expandSchema(*sch, parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return err + } + + if s != nil { // guard for when continuing on error + *sch = *s + } + + return nil +} diff --git a/vendor/github.com/go-openapi/spec/external_docs.go b/vendor/github.com/go-openapi/spec/external_docs.go new file mode 100644 index 0000000..88add91 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/external_docs.go @@ -0,0 +1,24 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +// ExternalDocumentation allows referencing an external resource for +// extended documentation. +// +// For more information: http://goo.gl/8us55a#externalDocumentationObject +type ExternalDocumentation struct { + Description string `json:"description,omitempty"` + URL string `json:"url,omitempty"` +} diff --git a/vendor/github.com/go-openapi/spec/header.go b/vendor/github.com/go-openapi/spec/header.go new file mode 100644 index 0000000..9dfd17b --- /dev/null +++ b/vendor/github.com/go-openapi/spec/header.go @@ -0,0 +1,203 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + "strings" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +const ( + jsonArray = "array" +) + +// HeaderProps describes a response header +type HeaderProps struct { + Description string `json:"description,omitempty"` +} + +// Header describes a header for a response of the API +// +// For more information: http://goo.gl/8us55a#headerObject +type Header struct { + CommonValidations + SimpleSchema + VendorExtensible + HeaderProps +} + +// ResponseHeader creates a new header instance for use in a response +func ResponseHeader() *Header { + return new(Header) +} + +// WithDescription sets the description on this response, allows for chaining +func (h *Header) WithDescription(description string) *Header { + h.Description = description + return h +} + +// Typed a fluent builder method for the type of parameter +func (h *Header) Typed(tpe, format string) *Header { + h.Type = tpe + h.Format = format + return h +} + +// CollectionOf a fluent builder method for an array item +func (h *Header) CollectionOf(items *Items, format string) *Header { + h.Type = jsonArray + h.Items = items + h.CollectionFormat = format + return h +} + +// WithDefault sets the default value on this item +func (h *Header) WithDefault(defaultValue interface{}) *Header { + h.Default = defaultValue + return h +} + +// WithMaxLength sets a max length value +func (h *Header) WithMaxLength(max int64) *Header { + h.MaxLength = &max + return h +} + +// WithMinLength sets a min length value +func (h *Header) WithMinLength(min int64) *Header { + h.MinLength = &min + return h +} + +// WithPattern sets a pattern value +func (h *Header) WithPattern(pattern string) *Header { + h.Pattern = pattern + return h +} + +// WithMultipleOf sets a multiple of value +func (h *Header) WithMultipleOf(number float64) *Header { + h.MultipleOf = &number + return h +} + +// WithMaximum sets a maximum number value +func (h *Header) WithMaximum(max float64, exclusive bool) *Header { + h.Maximum = &max + h.ExclusiveMaximum = exclusive + return h +} + +// WithMinimum sets a minimum number value +func (h *Header) WithMinimum(min float64, exclusive bool) *Header { + h.Minimum = &min + h.ExclusiveMinimum = exclusive + return h +} + +// WithEnum sets a the enum values (replace) +func (h *Header) WithEnum(values ...interface{}) *Header { + h.Enum = append([]interface{}{}, values...) + return h +} + +// WithMaxItems sets the max items +func (h *Header) WithMaxItems(size int64) *Header { + h.MaxItems = &size + return h +} + +// WithMinItems sets the min items +func (h *Header) WithMinItems(size int64) *Header { + h.MinItems = &size + return h +} + +// UniqueValues dictates that this array can only have unique items +func (h *Header) UniqueValues() *Header { + h.UniqueItems = true + return h +} + +// AllowDuplicates this array can have duplicates +func (h *Header) AllowDuplicates() *Header { + h.UniqueItems = false + return h +} + +// WithValidations is a fluent method to set header validations +func (h *Header) WithValidations(val CommonValidations) *Header { + h.SetValidations(SchemaValidations{CommonValidations: val}) + return h +} + +// MarshalJSON marshal this to JSON +func (h Header) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(h.CommonValidations) + if err != nil { + return nil, err + } + b2, err := json.Marshal(h.SimpleSchema) + if err != nil { + return nil, err + } + b3, err := json.Marshal(h.HeaderProps) + if err != nil { + return nil, err + } + return swag.ConcatJSON(b1, b2, b3), nil +} + +// UnmarshalJSON unmarshals this header from JSON +func (h *Header) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &h.CommonValidations); err != nil { + return err + } + if err := json.Unmarshal(data, &h.SimpleSchema); err != nil { + return err + } + if err := json.Unmarshal(data, &h.VendorExtensible); err != nil { + return err + } + return json.Unmarshal(data, &h.HeaderProps) +} + +// JSONLookup look up a value by the json property name +func (h Header) JSONLookup(token string) (interface{}, error) { + if ex, ok := h.Extensions[token]; ok { + return &ex, nil + } + + r, _, err := jsonpointer.GetForToken(h.CommonValidations, token) + if err != nil && !strings.HasPrefix(err.Error(), "object has no field") { + return nil, err + } + if r != nil { + return r, nil + } + r, _, err = jsonpointer.GetForToken(h.SimpleSchema, token) + if err != nil && !strings.HasPrefix(err.Error(), "object has no field") { + return nil, err + } + if r != nil { + return r, nil + } + r, _, err = jsonpointer.GetForToken(h.HeaderProps, token) + return r, err +} diff --git a/vendor/github.com/go-openapi/spec/info.go b/vendor/github.com/go-openapi/spec/info.go new file mode 100644 index 0000000..582f0fd --- /dev/null +++ b/vendor/github.com/go-openapi/spec/info.go @@ -0,0 +1,184 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + "strconv" + "strings" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +// Extensions vendor specific extensions +type Extensions map[string]interface{} + +// Add adds a value to these extensions +func (e Extensions) Add(key string, value interface{}) { + realKey := strings.ToLower(key) + e[realKey] = value +} + +// GetString gets a string value from the extensions +func (e Extensions) GetString(key string) (string, bool) { + if v, ok := e[strings.ToLower(key)]; ok { + str, ok := v.(string) + return str, ok + } + return "", false +} + +// GetInt gets a int value from the extensions +func (e Extensions) GetInt(key string) (int, bool) { + realKey := strings.ToLower(key) + + if v, ok := e.GetString(realKey); ok { + if r, err := strconv.Atoi(v); err == nil { + return r, true + } + } + + if v, ok := e[realKey]; ok { + if r, rOk := v.(float64); rOk { + return int(r), true + } + } + return -1, false +} + +// GetBool gets a string value from the extensions +func (e Extensions) GetBool(key string) (bool, bool) { + if v, ok := e[strings.ToLower(key)]; ok { + str, ok := v.(bool) + return str, ok + } + return false, false +} + +// GetStringSlice gets a string value from the extensions +func (e Extensions) GetStringSlice(key string) ([]string, bool) { + if v, ok := e[strings.ToLower(key)]; ok { + arr, isSlice := v.([]interface{}) + if !isSlice { + return nil, false + } + var strs []string + for _, iface := range arr { + str, isString := iface.(string) + if !isString { + return nil, false + } + strs = append(strs, str) + } + return strs, ok + } + return nil, false +} + +// VendorExtensible composition block. +type VendorExtensible struct { + Extensions Extensions +} + +// AddExtension adds an extension to this extensible object +func (v *VendorExtensible) AddExtension(key string, value interface{}) { + if value == nil { + return + } + if v.Extensions == nil { + v.Extensions = make(map[string]interface{}) + } + v.Extensions.Add(key, value) +} + +// MarshalJSON marshals the extensions to json +func (v VendorExtensible) MarshalJSON() ([]byte, error) { + toser := make(map[string]interface{}) + for k, v := range v.Extensions { + lk := strings.ToLower(k) + if strings.HasPrefix(lk, "x-") { + toser[k] = v + } + } + return json.Marshal(toser) +} + +// UnmarshalJSON for this extensible object +func (v *VendorExtensible) UnmarshalJSON(data []byte) error { + var d map[string]interface{} + if err := json.Unmarshal(data, &d); err != nil { + return err + } + for k, vv := range d { + lk := strings.ToLower(k) + if strings.HasPrefix(lk, "x-") { + if v.Extensions == nil { + v.Extensions = map[string]interface{}{} + } + v.Extensions[k] = vv + } + } + return nil +} + +// InfoProps the properties for an info definition +type InfoProps struct { + Description string `json:"description,omitempty"` + Title string `json:"title,omitempty"` + TermsOfService string `json:"termsOfService,omitempty"` + Contact *ContactInfo `json:"contact,omitempty"` + License *License `json:"license,omitempty"` + Version string `json:"version,omitempty"` +} + +// Info object provides metadata about the API. +// The metadata can be used by the clients if needed, and can be presented in the Swagger-UI for convenience. +// +// For more information: http://goo.gl/8us55a#infoObject +type Info struct { + VendorExtensible + InfoProps +} + +// JSONLookup look up a value by the json property name +func (i Info) JSONLookup(token string) (interface{}, error) { + if ex, ok := i.Extensions[token]; ok { + return &ex, nil + } + r, _, err := jsonpointer.GetForToken(i.InfoProps, token) + return r, err +} + +// MarshalJSON marshal this to JSON +func (i Info) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(i.InfoProps) + if err != nil { + return nil, err + } + b2, err := json.Marshal(i.VendorExtensible) + if err != nil { + return nil, err + } + return swag.ConcatJSON(b1, b2), nil +} + +// UnmarshalJSON marshal this from JSON +func (i *Info) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &i.InfoProps); err != nil { + return err + } + return json.Unmarshal(data, &i.VendorExtensible) +} diff --git a/vendor/github.com/go-openapi/spec/items.go b/vendor/github.com/go-openapi/spec/items.go new file mode 100644 index 0000000..e2afb21 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/items.go @@ -0,0 +1,234 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + "strings" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +const ( + jsonRef = "$ref" +) + +// SimpleSchema describe swagger simple schemas for parameters and headers +type SimpleSchema struct { + Type string `json:"type,omitempty"` + Nullable bool `json:"nullable,omitempty"` + Format string `json:"format,omitempty"` + Items *Items `json:"items,omitempty"` + CollectionFormat string `json:"collectionFormat,omitempty"` + Default interface{} `json:"default,omitempty"` + Example interface{} `json:"example,omitempty"` +} + +// TypeName return the type (or format) of a simple schema +func (s *SimpleSchema) TypeName() string { + if s.Format != "" { + return s.Format + } + return s.Type +} + +// ItemsTypeName yields the type of items in a simple schema array +func (s *SimpleSchema) ItemsTypeName() string { + if s.Items == nil { + return "" + } + return s.Items.TypeName() +} + +// Items a limited subset of JSON-Schema's items object. +// It is used by parameter definitions that are not located in "body". +// +// For more information: http://goo.gl/8us55a#items-object +type Items struct { + Refable + CommonValidations + SimpleSchema + VendorExtensible +} + +// NewItems creates a new instance of items +func NewItems() *Items { + return &Items{} +} + +// Typed a fluent builder method for the type of item +func (i *Items) Typed(tpe, format string) *Items { + i.Type = tpe + i.Format = format + return i +} + +// AsNullable flags this schema as nullable. +func (i *Items) AsNullable() *Items { + i.Nullable = true + return i +} + +// CollectionOf a fluent builder method for an array item +func (i *Items) CollectionOf(items *Items, format string) *Items { + i.Type = jsonArray + i.Items = items + i.CollectionFormat = format + return i +} + +// WithDefault sets the default value on this item +func (i *Items) WithDefault(defaultValue interface{}) *Items { + i.Default = defaultValue + return i +} + +// WithMaxLength sets a max length value +func (i *Items) WithMaxLength(max int64) *Items { + i.MaxLength = &max + return i +} + +// WithMinLength sets a min length value +func (i *Items) WithMinLength(min int64) *Items { + i.MinLength = &min + return i +} + +// WithPattern sets a pattern value +func (i *Items) WithPattern(pattern string) *Items { + i.Pattern = pattern + return i +} + +// WithMultipleOf sets a multiple of value +func (i *Items) WithMultipleOf(number float64) *Items { + i.MultipleOf = &number + return i +} + +// WithMaximum sets a maximum number value +func (i *Items) WithMaximum(max float64, exclusive bool) *Items { + i.Maximum = &max + i.ExclusiveMaximum = exclusive + return i +} + +// WithMinimum sets a minimum number value +func (i *Items) WithMinimum(min float64, exclusive bool) *Items { + i.Minimum = &min + i.ExclusiveMinimum = exclusive + return i +} + +// WithEnum sets a the enum values (replace) +func (i *Items) WithEnum(values ...interface{}) *Items { + i.Enum = append([]interface{}{}, values...) + return i +} + +// WithMaxItems sets the max items +func (i *Items) WithMaxItems(size int64) *Items { + i.MaxItems = &size + return i +} + +// WithMinItems sets the min items +func (i *Items) WithMinItems(size int64) *Items { + i.MinItems = &size + return i +} + +// UniqueValues dictates that this array can only have unique items +func (i *Items) UniqueValues() *Items { + i.UniqueItems = true + return i +} + +// AllowDuplicates this array can have duplicates +func (i *Items) AllowDuplicates() *Items { + i.UniqueItems = false + return i +} + +// WithValidations is a fluent method to set Items validations +func (i *Items) WithValidations(val CommonValidations) *Items { + i.SetValidations(SchemaValidations{CommonValidations: val}) + return i +} + +// UnmarshalJSON hydrates this items instance with the data from JSON +func (i *Items) UnmarshalJSON(data []byte) error { + var validations CommonValidations + if err := json.Unmarshal(data, &validations); err != nil { + return err + } + var ref Refable + if err := json.Unmarshal(data, &ref); err != nil { + return err + } + var simpleSchema SimpleSchema + if err := json.Unmarshal(data, &simpleSchema); err != nil { + return err + } + var vendorExtensible VendorExtensible + if err := json.Unmarshal(data, &vendorExtensible); err != nil { + return err + } + i.Refable = ref + i.CommonValidations = validations + i.SimpleSchema = simpleSchema + i.VendorExtensible = vendorExtensible + return nil +} + +// MarshalJSON converts this items object to JSON +func (i Items) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(i.CommonValidations) + if err != nil { + return nil, err + } + b2, err := json.Marshal(i.SimpleSchema) + if err != nil { + return nil, err + } + b3, err := json.Marshal(i.Refable) + if err != nil { + return nil, err + } + b4, err := json.Marshal(i.VendorExtensible) + if err != nil { + return nil, err + } + return swag.ConcatJSON(b4, b3, b1, b2), nil +} + +// JSONLookup look up a value by the json property name +func (i Items) JSONLookup(token string) (interface{}, error) { + if token == jsonRef { + return &i.Ref, nil + } + + r, _, err := jsonpointer.GetForToken(i.CommonValidations, token) + if err != nil && !strings.HasPrefix(err.Error(), "object has no field") { + return nil, err + } + if r != nil { + return r, nil + } + r, _, err = jsonpointer.GetForToken(i.SimpleSchema, token) + return r, err +} diff --git a/vendor/github.com/go-openapi/spec/license.go b/vendor/github.com/go-openapi/spec/license.go new file mode 100644 index 0000000..b42f803 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/license.go @@ -0,0 +1,56 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + + "github.com/go-openapi/swag" +) + +// License information for the exposed API. +// +// For more information: http://goo.gl/8us55a#licenseObject +type License struct { + LicenseProps + VendorExtensible +} + +// LicenseProps holds the properties of a License object +type LicenseProps struct { + Name string `json:"name,omitempty"` + URL string `json:"url,omitempty"` +} + +// UnmarshalJSON hydrates License from json +func (l *License) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &l.LicenseProps); err != nil { + return err + } + return json.Unmarshal(data, &l.VendorExtensible) +} + +// MarshalJSON produces License as json +func (l License) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(l.LicenseProps) + if err != nil { + return nil, err + } + b2, err := json.Marshal(l.VendorExtensible) + if err != nil { + return nil, err + } + return swag.ConcatJSON(b1, b2), nil +} diff --git a/vendor/github.com/go-openapi/spec/normalizer.go b/vendor/github.com/go-openapi/spec/normalizer.go new file mode 100644 index 0000000..e8b6009 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/normalizer.go @@ -0,0 +1,202 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "net/url" + "path" + "strings" +) + +const fileScheme = "file" + +// normalizeURI ensures that all $ref paths used internally by the expander are canonicalized. +// +// NOTE(windows): there is a tolerance over the strict URI format on windows. +// +// The normalizer accepts relative file URLs like 'Path\File.JSON' as well as absolute file URLs like +// 'C:\Path\file.Yaml'. +// +// Both are canonicalized with a "file://" scheme, slashes and a lower-cased path: +// 'file:///c:/path/file.yaml' +// +// URLs can be specified with a file scheme, like in 'file:///folder/file.json' or +// 'file:///c:\folder\File.json'. +// +// URLs like file://C:\folder are considered invalid (i.e. there is no host 'c:\folder') and a "repair" +// is attempted. +// +// The base path argument is assumed to be canonicalized (e.g. using normalizeBase()). +func normalizeURI(refPath, base string) string { + refURL, err := parseURL(refPath) + if err != nil { + specLogger.Printf("warning: invalid URI in $ref %q: %v", refPath, err) + refURL, refPath = repairURI(refPath) + } + + fixWindowsURI(refURL, refPath) // noop on non-windows OS + + refURL.Path = path.Clean(refURL.Path) + if refURL.Path == "." { + refURL.Path = "" + } + + r := MustCreateRef(refURL.String()) + if r.IsCanonical() { + return refURL.String() + } + + baseURL, _ := parseURL(base) + if path.IsAbs(refURL.Path) { + baseURL.Path = refURL.Path + } else if refURL.Path != "" { + baseURL.Path = path.Join(path.Dir(baseURL.Path), refURL.Path) + } + // copying fragment from ref to base + baseURL.Fragment = refURL.Fragment + + return baseURL.String() +} + +// denormalizeRef returns the simplest notation for a normalized $ref, given the path of the original root document. +// +// When calling this, we assume that: +// * $ref is a canonical URI +// * originalRelativeBase is a canonical URI +// +// denormalizeRef is currently used when we rewrite a $ref after a circular $ref has been detected. +// In this case, expansion stops and normally renders the internal canonical $ref. +// +// This internal $ref is eventually rebased to the original RelativeBase used for the expansion. +// +// There is a special case for schemas that are anchored with an "id": +// in that case, the rebasing is performed // against the id only if this is an anchor for the initial root document. +// All other intermediate "id"'s found along the way are ignored for the purpose of rebasing. +func denormalizeRef(ref *Ref, originalRelativeBase, id string) Ref { + debugLog("denormalizeRef called:\n$ref: %q\noriginal: %s\nroot ID:%s", ref.String(), originalRelativeBase, id) + + if ref.String() == "" || ref.IsRoot() || ref.HasFragmentOnly { + // short circuit: $ref to current doc + return *ref + } + + if id != "" { + idBaseURL, err := parseURL(id) + if err == nil { // if the schema id is not usable as a URI, ignore it + if ref, ok := rebase(ref, idBaseURL, true); ok { // rebase, but keep references to root unchaged (do not want $ref: "") + // $ref relative to the ID of the schema in the root document + return ref + } + } + } + + originalRelativeBaseURL, _ := parseURL(originalRelativeBase) + + r, _ := rebase(ref, originalRelativeBaseURL, false) + + return r +} + +func rebase(ref *Ref, v *url.URL, notEqual bool) (Ref, bool) { + var newBase url.URL + + u := ref.GetURL() + + if u.Scheme != v.Scheme || u.Host != v.Host { + return *ref, false + } + + docPath := v.Path + v.Path = path.Dir(v.Path) + + if v.Path == "." { + v.Path = "" + } else if !strings.HasSuffix(v.Path, "/") { + v.Path += "/" + } + + newBase.Fragment = u.Fragment + + if strings.HasPrefix(u.Path, docPath) { + newBase.Path = strings.TrimPrefix(u.Path, docPath) + } else { + newBase.Path = strings.TrimPrefix(u.Path, v.Path) + } + + if notEqual && newBase.Path == "" && newBase.Fragment == "" { + // do not want rebasing to end up in an empty $ref + return *ref, false + } + + if path.IsAbs(newBase.Path) { + // whenever we end up with an absolute path, specify the scheme and host + newBase.Scheme = v.Scheme + newBase.Host = v.Host + } + + return MustCreateRef(newBase.String()), true +} + +// normalizeRef canonicalize a Ref, using a canonical relativeBase as its absolute anchor +func normalizeRef(ref *Ref, relativeBase string) *Ref { + r := MustCreateRef(normalizeURI(ref.String(), relativeBase)) + return &r +} + +// normalizeBase performs a normalization of the input base path. +// +// This always yields a canonical URI (absolute), usable for the document cache. +// +// It ensures that all further internal work on basePath may safely assume +// a non-empty, cross-platform, canonical URI (i.e. absolute). +// +// This normalization tolerates windows paths (e.g. C:\x\y\File.dat) and transform this +// in a file:// URL with lower cased drive letter and path. +// +// See also: https://en.wikipedia.org/wiki/File_URI_scheme +func normalizeBase(in string) string { + u, err := parseURL(in) + if err != nil { + specLogger.Printf("warning: invalid URI in RelativeBase %q: %v", in, err) + u, in = repairURI(in) + } + + u.Fragment = "" // any fragment in the base is irrelevant + + fixWindowsURI(u, in) // noop on non-windows OS + + u.Path = path.Clean(u.Path) + if u.Path == "." { // empty after Clean() + u.Path = "" + } + + if u.Scheme != "" { + if path.IsAbs(u.Path) || u.Scheme != fileScheme { + // this is absolute or explicitly not a local file: we're good + return u.String() + } + } + + // no scheme or file scheme with relative path: assume file and make it absolute + // enforce scheme file://... with absolute path. + // + // If the input path is relative, we anchor the path to the current working directory. + // NOTE: we may end up with a host component. Leave it unchanged: e.g. file://host/folder/file.json + + u.Scheme = fileScheme + u.Path = absPath(u.Path) // platform-dependent + u.RawQuery = "" // any query component is irrelevant for a base + return u.String() +} diff --git a/vendor/github.com/go-openapi/spec/normalizer_nonwindows.go b/vendor/github.com/go-openapi/spec/normalizer_nonwindows.go new file mode 100644 index 0000000..f19f1a8 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/normalizer_nonwindows.go @@ -0,0 +1,44 @@ +//go:build !windows +// +build !windows + +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "net/url" + "path/filepath" +) + +// absPath makes a file path absolute and compatible with a URI path component. +// +// The parameter must be a path, not an URI. +func absPath(in string) string { + anchored, err := filepath.Abs(in) + if err != nil { + specLogger.Printf("warning: could not resolve current working directory: %v", err) + return in + } + return anchored +} + +func repairURI(in string) (*url.URL, string) { + u, _ := parseURL("") + debugLog("repaired URI: original: %q, repaired: %q", in, "") + return u, "" +} + +func fixWindowsURI(_ *url.URL, _ string) { +} diff --git a/vendor/github.com/go-openapi/spec/normalizer_windows.go b/vendor/github.com/go-openapi/spec/normalizer_windows.go new file mode 100644 index 0000000..a66c532 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/normalizer_windows.go @@ -0,0 +1,154 @@ +// -build windows + +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "net/url" + "os" + "path" + "path/filepath" + "strings" +) + +// absPath makes a file path absolute and compatible with a URI path component +// +// The parameter must be a path, not an URI. +func absPath(in string) string { + // NOTE(windows): filepath.Abs exhibits a special behavior on windows for empty paths. + // See https://github.com/golang/go/issues/24441 + if in == "" { + in = "." + } + + anchored, err := filepath.Abs(in) + if err != nil { + specLogger.Printf("warning: could not resolve current working directory: %v", err) + return in + } + + pth := strings.ReplaceAll(strings.ToLower(anchored), `\`, `/`) + if !strings.HasPrefix(pth, "/") { + pth = "/" + pth + } + + return path.Clean(pth) +} + +// repairURI tolerates invalid file URIs with common typos +// such as 'file://E:\folder\file', that break the regular URL parser. +// +// Adopting the same defaults as for unixes (e.g. return an empty path) would +// result into a counter-intuitive result for that case (e.g. E:\folder\file is +// eventually resolved as the current directory). The repair will detect the missing "/". +// +// Note that this only works for the file scheme. +func repairURI(in string) (*url.URL, string) { + const prefix = fileScheme + "://" + if !strings.HasPrefix(in, prefix) { + // giving up: resolve to empty path + u, _ := parseURL("") + + return u, "" + } + + // attempt the repair, stripping the scheme should be sufficient + u, _ := parseURL(strings.TrimPrefix(in, prefix)) + debugLog("repaired URI: original: %q, repaired: %q", in, u.String()) + + return u, u.String() +} + +// fixWindowsURI tolerates an absolute file path on windows such as C:\Base\File.yaml or \\host\share\Base\File.yaml +// and makes it a canonical URI: file:///c:/base/file.yaml +// +// Catch 22 notes for Windows: +// +// * There may be a drive letter on windows (it is lower-cased) +// * There may be a share UNC, e.g. \\server\folder\data.xml +// * Paths are case insensitive +// * Paths may already contain slashes +// * Paths must be slashed +// +// NOTE: there is no escaping. "/" may be valid separators just like "\". +// We don't use ToSlash() (which escapes everything) because windows now also +// tolerates the use of "/". Hence, both C:\File.yaml and C:/File.yaml will work. +func fixWindowsURI(u *url.URL, in string) { + drive := filepath.VolumeName(in) + + if len(drive) > 0 { + if len(u.Scheme) == 1 && strings.EqualFold(u.Scheme, drive[:1]) { // a path with a drive letter + u.Scheme = fileScheme + u.Host = "" + u.Path = strings.Join([]string{drive, u.Opaque, u.Path}, `/`) // reconstruct the full path component (no fragment, no query) + } else if u.Host == "" && strings.HasPrefix(u.Path, drive) { // a path with a \\host volume + // NOTE: the special host@port syntax for UNC is not supported (yet) + u.Scheme = fileScheme + + // this is a modified version of filepath.Dir() to apply on the VolumeName itself + i := len(drive) - 1 + for i >= 0 && !os.IsPathSeparator(drive[i]) { + i-- + } + host := drive[:i] // \\host\share => host + + u.Path = strings.TrimPrefix(u.Path, host) + u.Host = strings.TrimPrefix(host, `\\`) + } + + u.Opaque = "" + u.Path = strings.ReplaceAll(strings.ToLower(u.Path), `\`, `/`) + + // ensure we form an absolute path + if !strings.HasPrefix(u.Path, "/") { + u.Path = "/" + u.Path + } + + u.Path = path.Clean(u.Path) + + return + } + + if u.Scheme == fileScheme { + // Handle dodgy cases for file://{...} URIs on windows. + // A canonical URI should always be followed by an absolute path. + // + // Examples: + // * file:///folder/file => valid, unchanged + // * file:///c:\folder\file => slashed + // * file:///./folder/file => valid, cleaned to remove the dot + // * file:///.\folder\file => remapped to cwd + // * file:///. => dodgy, remapped to / (consistent with the behavior on unix) + // * file:///.. => dodgy, remapped to / (consistent with the behavior on unix) + if (!path.IsAbs(u.Path) && !filepath.IsAbs(u.Path)) || (strings.HasPrefix(u.Path, `/.`) && strings.Contains(u.Path, `\`)) { + // ensure we form an absolute path + u.Path, _ = filepath.Abs(strings.TrimLeft(u.Path, `/`)) + if !strings.HasPrefix(u.Path, "/") { + u.Path = "/" + u.Path + } + } + u.Path = strings.ToLower(u.Path) + } + + // NOTE: lower case normalization does not propagate to inner resources, + // generated when rebasing: when joining a relative URI with a file to an absolute base, + // only the base is currently lower-cased. + // + // For now, we assume this is good enough for most use cases + // and try not to generate too many differences + // between the output produced on different platforms. + u.Path = path.Clean(strings.ReplaceAll(u.Path, `\`, `/`)) +} diff --git a/vendor/github.com/go-openapi/spec/operation.go b/vendor/github.com/go-openapi/spec/operation.go new file mode 100644 index 0000000..a69cca8 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/operation.go @@ -0,0 +1,400 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "bytes" + "encoding/gob" + "encoding/json" + "sort" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +func init() { + gob.Register(map[string]interface{}{}) + gob.Register([]interface{}{}) +} + +// OperationProps describes an operation +// +// NOTES: +// - schemes, when present must be from [http, https, ws, wss]: see validate +// - Security is handled as a special case: see MarshalJSON function +type OperationProps struct { + Description string `json:"description,omitempty"` + Consumes []string `json:"consumes,omitempty"` + Produces []string `json:"produces,omitempty"` + Schemes []string `json:"schemes,omitempty"` + Tags []string `json:"tags,omitempty"` + Summary string `json:"summary,omitempty"` + ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` + ID string `json:"operationId,omitempty"` + Deprecated bool `json:"deprecated,omitempty"` + Security []map[string][]string `json:"security,omitempty"` + Parameters []Parameter `json:"parameters,omitempty"` + Responses *Responses `json:"responses,omitempty"` +} + +// MarshalJSON takes care of serializing operation properties to JSON +// +// We use a custom marhaller here to handle a special cases related to +// the Security field. We need to preserve zero length slice +// while omitting the field when the value is nil/unset. +func (op OperationProps) MarshalJSON() ([]byte, error) { + type Alias OperationProps + if op.Security == nil { + return json.Marshal(&struct { + Security []map[string][]string `json:"security,omitempty"` + *Alias + }{ + Security: op.Security, + Alias: (*Alias)(&op), + }) + } + return json.Marshal(&struct { + Security []map[string][]string `json:"security"` + *Alias + }{ + Security: op.Security, + Alias: (*Alias)(&op), + }) +} + +// Operation describes a single API operation on a path. +// +// For more information: http://goo.gl/8us55a#operationObject +type Operation struct { + VendorExtensible + OperationProps +} + +// SuccessResponse gets a success response model +func (o *Operation) SuccessResponse() (*Response, int, bool) { + if o.Responses == nil { + return nil, 0, false + } + + responseCodes := make([]int, 0, len(o.Responses.StatusCodeResponses)) + for k := range o.Responses.StatusCodeResponses { + if k >= 200 && k < 300 { + responseCodes = append(responseCodes, k) + } + } + if len(responseCodes) > 0 { + sort.Ints(responseCodes) + v := o.Responses.StatusCodeResponses[responseCodes[0]] + return &v, responseCodes[0], true + } + + return o.Responses.Default, 0, false +} + +// JSONLookup look up a value by the json property name +func (o Operation) JSONLookup(token string) (interface{}, error) { + if ex, ok := o.Extensions[token]; ok { + return &ex, nil + } + r, _, err := jsonpointer.GetForToken(o.OperationProps, token) + return r, err +} + +// UnmarshalJSON hydrates this items instance with the data from JSON +func (o *Operation) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &o.OperationProps); err != nil { + return err + } + return json.Unmarshal(data, &o.VendorExtensible) +} + +// MarshalJSON converts this items object to JSON +func (o Operation) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(o.OperationProps) + if err != nil { + return nil, err + } + b2, err := json.Marshal(o.VendorExtensible) + if err != nil { + return nil, err + } + concated := swag.ConcatJSON(b1, b2) + return concated, nil +} + +// NewOperation creates a new operation instance. +// It expects an ID as parameter but not passing an ID is also valid. +func NewOperation(id string) *Operation { + op := new(Operation) + op.ID = id + return op +} + +// WithID sets the ID property on this operation, allows for chaining. +func (o *Operation) WithID(id string) *Operation { + o.ID = id + return o +} + +// WithDescription sets the description on this operation, allows for chaining +func (o *Operation) WithDescription(description string) *Operation { + o.Description = description + return o +} + +// WithSummary sets the summary on this operation, allows for chaining +func (o *Operation) WithSummary(summary string) *Operation { + o.Summary = summary + return o +} + +// WithExternalDocs sets/removes the external docs for/from this operation. +// When you pass empty strings as params the external documents will be removed. +// When you pass non-empty string as one value then those values will be used on the external docs object. +// So when you pass a non-empty description, you should also pass the url and vice versa. +func (o *Operation) WithExternalDocs(description, url string) *Operation { + if description == "" && url == "" { + o.ExternalDocs = nil + return o + } + + if o.ExternalDocs == nil { + o.ExternalDocs = &ExternalDocumentation{} + } + o.ExternalDocs.Description = description + o.ExternalDocs.URL = url + return o +} + +// Deprecate marks the operation as deprecated +func (o *Operation) Deprecate() *Operation { + o.Deprecated = true + return o +} + +// Undeprecate marks the operation as not deprected +func (o *Operation) Undeprecate() *Operation { + o.Deprecated = false + return o +} + +// WithConsumes adds media types for incoming body values +func (o *Operation) WithConsumes(mediaTypes ...string) *Operation { + o.Consumes = append(o.Consumes, mediaTypes...) + return o +} + +// WithProduces adds media types for outgoing body values +func (o *Operation) WithProduces(mediaTypes ...string) *Operation { + o.Produces = append(o.Produces, mediaTypes...) + return o +} + +// WithTags adds tags for this operation +func (o *Operation) WithTags(tags ...string) *Operation { + o.Tags = append(o.Tags, tags...) + return o +} + +// AddParam adds a parameter to this operation, when a parameter for that location +// and with that name already exists it will be replaced +func (o *Operation) AddParam(param *Parameter) *Operation { + if param == nil { + return o + } + + for i, p := range o.Parameters { + if p.Name == param.Name && p.In == param.In { + params := make([]Parameter, 0, len(o.Parameters)+1) + params = append(params, o.Parameters[:i]...) + params = append(params, *param) + params = append(params, o.Parameters[i+1:]...) + o.Parameters = params + + return o + } + } + + o.Parameters = append(o.Parameters, *param) + return o +} + +// RemoveParam removes a parameter from the operation +func (o *Operation) RemoveParam(name, in string) *Operation { + for i, p := range o.Parameters { + if p.Name == name && p.In == in { + o.Parameters = append(o.Parameters[:i], o.Parameters[i+1:]...) + return o + } + } + return o +} + +// SecuredWith adds a security scope to this operation. +func (o *Operation) SecuredWith(name string, scopes ...string) *Operation { + o.Security = append(o.Security, map[string][]string{name: scopes}) + return o +} + +// WithDefaultResponse adds a default response to the operation. +// Passing a nil value will remove the response +func (o *Operation) WithDefaultResponse(response *Response) *Operation { + return o.RespondsWith(0, response) +} + +// RespondsWith adds a status code response to the operation. +// When the code is 0 the value of the response will be used as default response value. +// When the value of the response is nil it will be removed from the operation +func (o *Operation) RespondsWith(code int, response *Response) *Operation { + if o.Responses == nil { + o.Responses = new(Responses) + } + if code == 0 { + o.Responses.Default = response + return o + } + if response == nil { + delete(o.Responses.StatusCodeResponses, code) + return o + } + if o.Responses.StatusCodeResponses == nil { + o.Responses.StatusCodeResponses = make(map[int]Response) + } + o.Responses.StatusCodeResponses[code] = *response + return o +} + +type opsAlias OperationProps + +type gobAlias struct { + Security []map[string]struct { + List []string + Pad bool + } + Alias *opsAlias + SecurityIsEmpty bool +} + +// GobEncode provides a safe gob encoder for Operation, including empty security requirements +func (o Operation) GobEncode() ([]byte, error) { + raw := struct { + Ext VendorExtensible + Props OperationProps + }{ + Ext: o.VendorExtensible, + Props: o.OperationProps, + } + var b bytes.Buffer + err := gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err +} + +// GobDecode provides a safe gob decoder for Operation, including empty security requirements +func (o *Operation) GobDecode(b []byte) error { + var raw struct { + Ext VendorExtensible + Props OperationProps + } + + buf := bytes.NewBuffer(b) + err := gob.NewDecoder(buf).Decode(&raw) + if err != nil { + return err + } + o.VendorExtensible = raw.Ext + o.OperationProps = raw.Props + return nil +} + +// GobEncode provides a safe gob encoder for Operation, including empty security requirements +func (op OperationProps) GobEncode() ([]byte, error) { + raw := gobAlias{ + Alias: (*opsAlias)(&op), + } + + var b bytes.Buffer + if op.Security == nil { + // nil security requirement + err := gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err + } + + if len(op.Security) == 0 { + // empty, but non-nil security requirement + raw.SecurityIsEmpty = true + raw.Alias.Security = nil + err := gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err + } + + raw.Security = make([]map[string]struct { + List []string + Pad bool + }, 0, len(op.Security)) + for _, req := range op.Security { + v := make(map[string]struct { + List []string + Pad bool + }, len(req)) + for k, val := range req { + v[k] = struct { + List []string + Pad bool + }{ + List: val, + } + } + raw.Security = append(raw.Security, v) + } + + err := gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err +} + +// GobDecode provides a safe gob decoder for Operation, including empty security requirements +func (op *OperationProps) GobDecode(b []byte) error { + var raw gobAlias + + buf := bytes.NewBuffer(b) + err := gob.NewDecoder(buf).Decode(&raw) + if err != nil { + return err + } + if raw.Alias == nil { + return nil + } + + switch { + case raw.SecurityIsEmpty: + // empty, but non-nil security requirement + raw.Alias.Security = []map[string][]string{} + case len(raw.Alias.Security) == 0: + // nil security requirement + raw.Alias.Security = nil + default: + raw.Alias.Security = make([]map[string][]string, 0, len(raw.Security)) + for _, req := range raw.Security { + v := make(map[string][]string, len(req)) + for k, val := range req { + v[k] = make([]string, 0, len(val.List)) + v[k] = append(v[k], val.List...) + } + raw.Alias.Security = append(raw.Alias.Security, v) + } + } + + *op = *(*OperationProps)(raw.Alias) + return nil +} diff --git a/vendor/github.com/go-openapi/spec/parameter.go b/vendor/github.com/go-openapi/spec/parameter.go new file mode 100644 index 0000000..bd4f1cd --- /dev/null +++ b/vendor/github.com/go-openapi/spec/parameter.go @@ -0,0 +1,326 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + "strings" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +// QueryParam creates a query parameter +func QueryParam(name string) *Parameter { + return &Parameter{ParamProps: ParamProps{Name: name, In: "query"}} +} + +// HeaderParam creates a header parameter, this is always required by default +func HeaderParam(name string) *Parameter { + return &Parameter{ParamProps: ParamProps{Name: name, In: "header", Required: true}} +} + +// PathParam creates a path parameter, this is always required +func PathParam(name string) *Parameter { + return &Parameter{ParamProps: ParamProps{Name: name, In: "path", Required: true}} +} + +// BodyParam creates a body parameter +func BodyParam(name string, schema *Schema) *Parameter { + return &Parameter{ParamProps: ParamProps{Name: name, In: "body", Schema: schema}} +} + +// FormDataParam creates a body parameter +func FormDataParam(name string) *Parameter { + return &Parameter{ParamProps: ParamProps{Name: name, In: "formData"}} +} + +// FileParam creates a body parameter +func FileParam(name string) *Parameter { + return &Parameter{ParamProps: ParamProps{Name: name, In: "formData"}, + SimpleSchema: SimpleSchema{Type: "file"}} +} + +// SimpleArrayParam creates a param for a simple array (string, int, date etc) +func SimpleArrayParam(name, tpe, fmt string) *Parameter { + return &Parameter{ParamProps: ParamProps{Name: name}, + SimpleSchema: SimpleSchema{Type: jsonArray, CollectionFormat: "csv", + Items: &Items{SimpleSchema: SimpleSchema{Type: tpe, Format: fmt}}}} +} + +// ParamRef creates a parameter that's a json reference +func ParamRef(uri string) *Parameter { + p := new(Parameter) + p.Ref = MustCreateRef(uri) + return p +} + +// ParamProps describes the specific attributes of an operation parameter +// +// NOTE: +// - Schema is defined when "in" == "body": see validate +// - AllowEmptyValue is allowed where "in" == "query" || "formData" +type ParamProps struct { + Description string `json:"description,omitempty"` + Name string `json:"name,omitempty"` + In string `json:"in,omitempty"` + Required bool `json:"required,omitempty"` + Schema *Schema `json:"schema,omitempty"` + AllowEmptyValue bool `json:"allowEmptyValue,omitempty"` +} + +// Parameter a unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). +// +// There are five possible parameter types. +// - Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part +// of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, +// the path parameter is `itemId`. +// - Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. +// - Header - Custom headers that are expected as part of the request. +// - Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be +// _one_ body parameter. The name of the body parameter has no effect on the parameter itself and is used for +// documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist +// together for the same operation. +// - Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded` or +// `multipart/form-data` are used as the content type of the request (in Swagger's definition, +// the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used +// to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be +// declared together with a body parameter for the same operation. Form parameters have a different format based on +// the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4). +// - `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. +// For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple +// parameters that are being transferred. +// - `multipart/form-data` - each parameter takes a section in the payload with an internal header. +// For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is +// `submit-name`. This type of form parameters is more commonly used for file transfers. +// +// For more information: http://goo.gl/8us55a#parameterObject +type Parameter struct { + Refable + CommonValidations + SimpleSchema + VendorExtensible + ParamProps +} + +// JSONLookup look up a value by the json property name +func (p Parameter) JSONLookup(token string) (interface{}, error) { + if ex, ok := p.Extensions[token]; ok { + return &ex, nil + } + if token == jsonRef { + return &p.Ref, nil + } + + r, _, err := jsonpointer.GetForToken(p.CommonValidations, token) + if err != nil && !strings.HasPrefix(err.Error(), "object has no field") { + return nil, err + } + if r != nil { + return r, nil + } + r, _, err = jsonpointer.GetForToken(p.SimpleSchema, token) + if err != nil && !strings.HasPrefix(err.Error(), "object has no field") { + return nil, err + } + if r != nil { + return r, nil + } + r, _, err = jsonpointer.GetForToken(p.ParamProps, token) + return r, err +} + +// WithDescription a fluent builder method for the description of the parameter +func (p *Parameter) WithDescription(description string) *Parameter { + p.Description = description + return p +} + +// Named a fluent builder method to override the name of the parameter +func (p *Parameter) Named(name string) *Parameter { + p.Name = name + return p +} + +// WithLocation a fluent builder method to override the location of the parameter +func (p *Parameter) WithLocation(in string) *Parameter { + p.In = in + return p +} + +// Typed a fluent builder method for the type of the parameter value +func (p *Parameter) Typed(tpe, format string) *Parameter { + p.Type = tpe + p.Format = format + return p +} + +// CollectionOf a fluent builder method for an array parameter +func (p *Parameter) CollectionOf(items *Items, format string) *Parameter { + p.Type = jsonArray + p.Items = items + p.CollectionFormat = format + return p +} + +// WithDefault sets the default value on this parameter +func (p *Parameter) WithDefault(defaultValue interface{}) *Parameter { + p.AsOptional() // with default implies optional + p.Default = defaultValue + return p +} + +// AllowsEmptyValues flags this parameter as being ok with empty values +func (p *Parameter) AllowsEmptyValues() *Parameter { + p.AllowEmptyValue = true + return p +} + +// NoEmptyValues flags this parameter as not liking empty values +func (p *Parameter) NoEmptyValues() *Parameter { + p.AllowEmptyValue = false + return p +} + +// AsOptional flags this parameter as optional +func (p *Parameter) AsOptional() *Parameter { + p.Required = false + return p +} + +// AsRequired flags this parameter as required +func (p *Parameter) AsRequired() *Parameter { + if p.Default != nil { // with a default required makes no sense + return p + } + p.Required = true + return p +} + +// WithMaxLength sets a max length value +func (p *Parameter) WithMaxLength(max int64) *Parameter { + p.MaxLength = &max + return p +} + +// WithMinLength sets a min length value +func (p *Parameter) WithMinLength(min int64) *Parameter { + p.MinLength = &min + return p +} + +// WithPattern sets a pattern value +func (p *Parameter) WithPattern(pattern string) *Parameter { + p.Pattern = pattern + return p +} + +// WithMultipleOf sets a multiple of value +func (p *Parameter) WithMultipleOf(number float64) *Parameter { + p.MultipleOf = &number + return p +} + +// WithMaximum sets a maximum number value +func (p *Parameter) WithMaximum(max float64, exclusive bool) *Parameter { + p.Maximum = &max + p.ExclusiveMaximum = exclusive + return p +} + +// WithMinimum sets a minimum number value +func (p *Parameter) WithMinimum(min float64, exclusive bool) *Parameter { + p.Minimum = &min + p.ExclusiveMinimum = exclusive + return p +} + +// WithEnum sets a the enum values (replace) +func (p *Parameter) WithEnum(values ...interface{}) *Parameter { + p.Enum = append([]interface{}{}, values...) + return p +} + +// WithMaxItems sets the max items +func (p *Parameter) WithMaxItems(size int64) *Parameter { + p.MaxItems = &size + return p +} + +// WithMinItems sets the min items +func (p *Parameter) WithMinItems(size int64) *Parameter { + p.MinItems = &size + return p +} + +// UniqueValues dictates that this array can only have unique items +func (p *Parameter) UniqueValues() *Parameter { + p.UniqueItems = true + return p +} + +// AllowDuplicates this array can have duplicates +func (p *Parameter) AllowDuplicates() *Parameter { + p.UniqueItems = false + return p +} + +// WithValidations is a fluent method to set parameter validations +func (p *Parameter) WithValidations(val CommonValidations) *Parameter { + p.SetValidations(SchemaValidations{CommonValidations: val}) + return p +} + +// UnmarshalJSON hydrates this items instance with the data from JSON +func (p *Parameter) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &p.CommonValidations); err != nil { + return err + } + if err := json.Unmarshal(data, &p.Refable); err != nil { + return err + } + if err := json.Unmarshal(data, &p.SimpleSchema); err != nil { + return err + } + if err := json.Unmarshal(data, &p.VendorExtensible); err != nil { + return err + } + return json.Unmarshal(data, &p.ParamProps) +} + +// MarshalJSON converts this items object to JSON +func (p Parameter) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(p.CommonValidations) + if err != nil { + return nil, err + } + b2, err := json.Marshal(p.SimpleSchema) + if err != nil { + return nil, err + } + b3, err := json.Marshal(p.Refable) + if err != nil { + return nil, err + } + b4, err := json.Marshal(p.VendorExtensible) + if err != nil { + return nil, err + } + b5, err := json.Marshal(p.ParamProps) + if err != nil { + return nil, err + } + return swag.ConcatJSON(b3, b1, b2, b4, b5), nil +} diff --git a/vendor/github.com/go-openapi/spec/path_item.go b/vendor/github.com/go-openapi/spec/path_item.go new file mode 100644 index 0000000..68fc8e9 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/path_item.go @@ -0,0 +1,87 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +// PathItemProps the path item specific properties +type PathItemProps struct { + Get *Operation `json:"get,omitempty"` + Put *Operation `json:"put,omitempty"` + Post *Operation `json:"post,omitempty"` + Delete *Operation `json:"delete,omitempty"` + Options *Operation `json:"options,omitempty"` + Head *Operation `json:"head,omitempty"` + Patch *Operation `json:"patch,omitempty"` + Parameters []Parameter `json:"parameters,omitempty"` +} + +// PathItem describes the operations available on a single path. +// A Path Item may be empty, due to [ACL constraints](http://goo.gl/8us55a#securityFiltering). +// The path itself is still exposed to the documentation viewer but they will +// not know which operations and parameters are available. +// +// For more information: http://goo.gl/8us55a#pathItemObject +type PathItem struct { + Refable + VendorExtensible + PathItemProps +} + +// JSONLookup look up a value by the json property name +func (p PathItem) JSONLookup(token string) (interface{}, error) { + if ex, ok := p.Extensions[token]; ok { + return &ex, nil + } + if token == jsonRef { + return &p.Ref, nil + } + r, _, err := jsonpointer.GetForToken(p.PathItemProps, token) + return r, err +} + +// UnmarshalJSON hydrates this items instance with the data from JSON +func (p *PathItem) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &p.Refable); err != nil { + return err + } + if err := json.Unmarshal(data, &p.VendorExtensible); err != nil { + return err + } + return json.Unmarshal(data, &p.PathItemProps) +} + +// MarshalJSON converts this items object to JSON +func (p PathItem) MarshalJSON() ([]byte, error) { + b3, err := json.Marshal(p.Refable) + if err != nil { + return nil, err + } + b4, err := json.Marshal(p.VendorExtensible) + if err != nil { + return nil, err + } + b5, err := json.Marshal(p.PathItemProps) + if err != nil { + return nil, err + } + concated := swag.ConcatJSON(b3, b4, b5) + return concated, nil +} diff --git a/vendor/github.com/go-openapi/spec/paths.go b/vendor/github.com/go-openapi/spec/paths.go new file mode 100644 index 0000000..9dc82a2 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/paths.go @@ -0,0 +1,97 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + "fmt" + "strings" + + "github.com/go-openapi/swag" +) + +// Paths holds the relative paths to the individual endpoints. +// The path is appended to the [`basePath`](http://goo.gl/8us55a#swaggerBasePath) in order +// to construct the full URL. +// The Paths may be empty, due to [ACL constraints](http://goo.gl/8us55a#securityFiltering). +// +// For more information: http://goo.gl/8us55a#pathsObject +type Paths struct { + VendorExtensible + Paths map[string]PathItem `json:"-"` // custom serializer to flatten this, each entry must start with "/" +} + +// JSONLookup look up a value by the json property name +func (p Paths) JSONLookup(token string) (interface{}, error) { + if pi, ok := p.Paths[token]; ok { + return &pi, nil + } + if ex, ok := p.Extensions[token]; ok { + return &ex, nil + } + return nil, fmt.Errorf("object has no field %q", token) +} + +// UnmarshalJSON hydrates this items instance with the data from JSON +func (p *Paths) UnmarshalJSON(data []byte) error { + var res map[string]json.RawMessage + if err := json.Unmarshal(data, &res); err != nil { + return err + } + for k, v := range res { + if strings.HasPrefix(strings.ToLower(k), "x-") { + if p.Extensions == nil { + p.Extensions = make(map[string]interface{}) + } + var d interface{} + if err := json.Unmarshal(v, &d); err != nil { + return err + } + p.Extensions[k] = d + } + if strings.HasPrefix(k, "/") { + if p.Paths == nil { + p.Paths = make(map[string]PathItem) + } + var pi PathItem + if err := json.Unmarshal(v, &pi); err != nil { + return err + } + p.Paths[k] = pi + } + } + return nil +} + +// MarshalJSON converts this items object to JSON +func (p Paths) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(p.VendorExtensible) + if err != nil { + return nil, err + } + + pths := make(map[string]PathItem) + for k, v := range p.Paths { + if strings.HasPrefix(k, "/") { + pths[k] = v + } + } + b2, err := json.Marshal(pths) + if err != nil { + return nil, err + } + concated := swag.ConcatJSON(b1, b2) + return concated, nil +} diff --git a/vendor/github.com/go-openapi/spec/properties.go b/vendor/github.com/go-openapi/spec/properties.go new file mode 100644 index 0000000..91d2435 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/properties.go @@ -0,0 +1,91 @@ +package spec + +import ( + "bytes" + "encoding/json" + "reflect" + "sort" +) + +// OrderSchemaItem holds a named schema (e.g. from a property of an object) +type OrderSchemaItem struct { + Name string + Schema +} + +// OrderSchemaItems is a sortable slice of named schemas. +// The ordering is defined by the x-order schema extension. +type OrderSchemaItems []OrderSchemaItem + +// MarshalJSON produces a json object with keys defined by the name schemas +// of the OrderSchemaItems slice, keeping the original order of the slice. +func (items OrderSchemaItems) MarshalJSON() ([]byte, error) { + buf := bytes.NewBuffer(nil) + buf.WriteString("{") + for i := range items { + if i > 0 { + buf.WriteString(",") + } + buf.WriteString("\"") + buf.WriteString(items[i].Name) + buf.WriteString("\":") + bs, err := json.Marshal(&items[i].Schema) + if err != nil { + return nil, err + } + buf.Write(bs) + } + buf.WriteString("}") + return buf.Bytes(), nil +} + +func (items OrderSchemaItems) Len() int { return len(items) } +func (items OrderSchemaItems) Swap(i, j int) { items[i], items[j] = items[j], items[i] } +func (items OrderSchemaItems) Less(i, j int) (ret bool) { + ii, oki := items[i].Extensions.GetInt("x-order") + ij, okj := items[j].Extensions.GetInt("x-order") + if oki { + if okj { + defer func() { + if err := recover(); err != nil { + defer func() { + if err = recover(); err != nil { + ret = items[i].Name < items[j].Name + } + }() + ret = reflect.ValueOf(ii).String() < reflect.ValueOf(ij).String() + } + }() + return ii < ij + } + return true + } else if okj { + return false + } + return items[i].Name < items[j].Name +} + +// SchemaProperties is a map representing the properties of a Schema object. +// It knows how to transform its keys into an ordered slice. +type SchemaProperties map[string]Schema + +// ToOrderedSchemaItems transforms the map of properties into a sortable slice +func (properties SchemaProperties) ToOrderedSchemaItems() OrderSchemaItems { + items := make(OrderSchemaItems, 0, len(properties)) + for k, v := range properties { + items = append(items, OrderSchemaItem{ + Name: k, + Schema: v, + }) + } + sort.Sort(items) + return items +} + +// MarshalJSON produces properties as json, keeping their order. +func (properties SchemaProperties) MarshalJSON() ([]byte, error) { + if properties == nil { + return []byte("null"), nil + } + return json.Marshal(properties.ToOrderedSchemaItems()) +} diff --git a/vendor/github.com/go-openapi/spec/ref.go b/vendor/github.com/go-openapi/spec/ref.go new file mode 100644 index 0000000..b0ef9bd --- /dev/null +++ b/vendor/github.com/go-openapi/spec/ref.go @@ -0,0 +1,193 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "bytes" + "encoding/gob" + "encoding/json" + "net/http" + "os" + "path/filepath" + + "github.com/go-openapi/jsonreference" +) + +// Refable is a struct for things that accept a $ref property +type Refable struct { + Ref Ref +} + +// MarshalJSON marshals the ref to json +func (r Refable) MarshalJSON() ([]byte, error) { + return r.Ref.MarshalJSON() +} + +// UnmarshalJSON unmarshalss the ref from json +func (r *Refable) UnmarshalJSON(d []byte) error { + return json.Unmarshal(d, &r.Ref) +} + +// Ref represents a json reference that is potentially resolved +type Ref struct { + jsonreference.Ref +} + +// RemoteURI gets the remote uri part of the ref +func (r *Ref) RemoteURI() string { + if r.String() == "" { + return "" + } + + u := *r.GetURL() + u.Fragment = "" + return u.String() +} + +// IsValidURI returns true when the url the ref points to can be found +func (r *Ref) IsValidURI(basepaths ...string) bool { + if r.String() == "" { + return true + } + + v := r.RemoteURI() + if v == "" { + return true + } + + if r.HasFullURL { + //nolint:noctx,gosec + rr, err := http.Get(v) + if err != nil { + return false + } + defer rr.Body.Close() + + return rr.StatusCode/100 == 2 + } + + if !(r.HasFileScheme || r.HasFullFilePath || r.HasURLPathOnly) { + return false + } + + // check for local file + pth := v + if r.HasURLPathOnly { + base := "." + if len(basepaths) > 0 { + base = filepath.Dir(filepath.Join(basepaths...)) + } + p, e := filepath.Abs(filepath.ToSlash(filepath.Join(base, pth))) + if e != nil { + return false + } + pth = p + } + + fi, err := os.Stat(filepath.ToSlash(pth)) + if err != nil { + return false + } + + return !fi.IsDir() +} + +// Inherits creates a new reference from a parent and a child +// If the child cannot inherit from the parent, an error is returned +func (r *Ref) Inherits(child Ref) (*Ref, error) { + ref, err := r.Ref.Inherits(child.Ref) + if err != nil { + return nil, err + } + return &Ref{Ref: *ref}, nil +} + +// NewRef creates a new instance of a ref object +// returns an error when the reference uri is an invalid uri +func NewRef(refURI string) (Ref, error) { + ref, err := jsonreference.New(refURI) + if err != nil { + return Ref{}, err + } + return Ref{Ref: ref}, nil +} + +// MustCreateRef creates a ref object but panics when refURI is invalid. +// Use the NewRef method for a version that returns an error. +func MustCreateRef(refURI string) Ref { + return Ref{Ref: jsonreference.MustCreateRef(refURI)} +} + +// MarshalJSON marshals this ref into a JSON object +func (r Ref) MarshalJSON() ([]byte, error) { + str := r.String() + if str == "" { + if r.IsRoot() { + return []byte(`{"$ref":""}`), nil + } + return []byte("{}"), nil + } + v := map[string]interface{}{"$ref": str} + return json.Marshal(v) +} + +// UnmarshalJSON unmarshals this ref from a JSON object +func (r *Ref) UnmarshalJSON(d []byte) error { + var v map[string]interface{} + if err := json.Unmarshal(d, &v); err != nil { + return err + } + return r.fromMap(v) +} + +// GobEncode provides a safe gob encoder for Ref +func (r Ref) GobEncode() ([]byte, error) { + var b bytes.Buffer + raw, err := r.MarshalJSON() + if err != nil { + return nil, err + } + err = gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err +} + +// GobDecode provides a safe gob decoder for Ref +func (r *Ref) GobDecode(b []byte) error { + var raw []byte + buf := bytes.NewBuffer(b) + err := gob.NewDecoder(buf).Decode(&raw) + if err != nil { + return err + } + return json.Unmarshal(raw, r) +} + +func (r *Ref) fromMap(v map[string]interface{}) error { + if v == nil { + return nil + } + + if vv, ok := v["$ref"]; ok { + if str, ok := vv.(string); ok { + ref, err := jsonreference.New(str) + if err != nil { + return err + } + *r = Ref{Ref: ref} + } + } + + return nil +} diff --git a/vendor/github.com/go-openapi/spec/resolver.go b/vendor/github.com/go-openapi/spec/resolver.go new file mode 100644 index 0000000..47d1ee1 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/resolver.go @@ -0,0 +1,127 @@ +package spec + +import ( + "fmt" + + "github.com/go-openapi/swag" +) + +func resolveAnyWithBase(root interface{}, ref *Ref, result interface{}, options *ExpandOptions) error { + options = optionsOrDefault(options) + resolver := defaultSchemaLoader(root, options, nil, nil) + + if err := resolver.Resolve(ref, result, options.RelativeBase); err != nil { + return err + } + + return nil +} + +// ResolveRefWithBase resolves a reference against a context root with preservation of base path +func ResolveRefWithBase(root interface{}, ref *Ref, options *ExpandOptions) (*Schema, error) { + result := new(Schema) + + if err := resolveAnyWithBase(root, ref, result, options); err != nil { + return nil, err + } + + return result, nil +} + +// ResolveRef resolves a reference for a schema against a context root +// ref is guaranteed to be in root (no need to go to external files) +// +// ResolveRef is ONLY called from the code generation module +func ResolveRef(root interface{}, ref *Ref) (*Schema, error) { + res, _, err := ref.GetPointer().Get(root) + if err != nil { + return nil, err + } + + switch sch := res.(type) { + case Schema: + return &sch, nil + case *Schema: + return sch, nil + case map[string]interface{}: + newSch := new(Schema) + if err = swag.DynamicJSONToStruct(sch, newSch); err != nil { + return nil, err + } + return newSch, nil + default: + return nil, fmt.Errorf("type: %T: %w", sch, ErrUnknownTypeForReference) + } +} + +// ResolveParameterWithBase resolves a parameter reference against a context root and base path +func ResolveParameterWithBase(root interface{}, ref Ref, options *ExpandOptions) (*Parameter, error) { + result := new(Parameter) + + if err := resolveAnyWithBase(root, &ref, result, options); err != nil { + return nil, err + } + + return result, nil +} + +// ResolveParameter resolves a parameter reference against a context root +func ResolveParameter(root interface{}, ref Ref) (*Parameter, error) { + return ResolveParameterWithBase(root, ref, nil) +} + +// ResolveResponseWithBase resolves response a reference against a context root and base path +func ResolveResponseWithBase(root interface{}, ref Ref, options *ExpandOptions) (*Response, error) { + result := new(Response) + + err := resolveAnyWithBase(root, &ref, result, options) + if err != nil { + return nil, err + } + + return result, nil +} + +// ResolveResponse resolves response a reference against a context root +func ResolveResponse(root interface{}, ref Ref) (*Response, error) { + return ResolveResponseWithBase(root, ref, nil) +} + +// ResolvePathItemWithBase resolves response a path item against a context root and base path +func ResolvePathItemWithBase(root interface{}, ref Ref, options *ExpandOptions) (*PathItem, error) { + result := new(PathItem) + + if err := resolveAnyWithBase(root, &ref, result, options); err != nil { + return nil, err + } + + return result, nil +} + +// ResolvePathItem resolves response a path item against a context root and base path +// +// Deprecated: use ResolvePathItemWithBase instead +func ResolvePathItem(root interface{}, ref Ref, options *ExpandOptions) (*PathItem, error) { + return ResolvePathItemWithBase(root, ref, options) +} + +// ResolveItemsWithBase resolves parameter items reference against a context root and base path. +// +// NOTE: stricly speaking, this construct is not supported by Swagger 2.0. +// Similarly, $ref are forbidden in response headers. +func ResolveItemsWithBase(root interface{}, ref Ref, options *ExpandOptions) (*Items, error) { + result := new(Items) + + if err := resolveAnyWithBase(root, &ref, result, options); err != nil { + return nil, err + } + + return result, nil +} + +// ResolveItems resolves parameter items reference against a context root and base path. +// +// Deprecated: use ResolveItemsWithBase instead +func ResolveItems(root interface{}, ref Ref, options *ExpandOptions) (*Items, error) { + return ResolveItemsWithBase(root, ref, options) +} diff --git a/vendor/github.com/go-openapi/spec/response.go b/vendor/github.com/go-openapi/spec/response.go new file mode 100644 index 0000000..0340b60 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/response.go @@ -0,0 +1,152 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +// ResponseProps properties specific to a response +type ResponseProps struct { + Description string `json:"description"` + Schema *Schema `json:"schema,omitempty"` + Headers map[string]Header `json:"headers,omitempty"` + Examples map[string]interface{} `json:"examples,omitempty"` +} + +// Response describes a single response from an API Operation. +// +// For more information: http://goo.gl/8us55a#responseObject +type Response struct { + Refable + ResponseProps + VendorExtensible +} + +// JSONLookup look up a value by the json property name +func (r Response) JSONLookup(token string) (interface{}, error) { + if ex, ok := r.Extensions[token]; ok { + return &ex, nil + } + if token == "$ref" { + return &r.Ref, nil + } + ptr, _, err := jsonpointer.GetForToken(r.ResponseProps, token) + return ptr, err +} + +// UnmarshalJSON hydrates this items instance with the data from JSON +func (r *Response) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &r.ResponseProps); err != nil { + return err + } + if err := json.Unmarshal(data, &r.Refable); err != nil { + return err + } + return json.Unmarshal(data, &r.VendorExtensible) +} + +// MarshalJSON converts this items object to JSON +func (r Response) MarshalJSON() ([]byte, error) { + var ( + b1 []byte + err error + ) + + if r.Ref.String() == "" { + // when there is no $ref, empty description is rendered as an empty string + b1, err = json.Marshal(r.ResponseProps) + } else { + // when there is $ref inside the schema, description should be omitempty-ied + b1, err = json.Marshal(struct { + Description string `json:"description,omitempty"` + Schema *Schema `json:"schema,omitempty"` + Headers map[string]Header `json:"headers,omitempty"` + Examples map[string]interface{} `json:"examples,omitempty"` + }{ + Description: r.ResponseProps.Description, + Schema: r.ResponseProps.Schema, + Examples: r.ResponseProps.Examples, + }) + } + if err != nil { + return nil, err + } + + b2, err := json.Marshal(r.Refable) + if err != nil { + return nil, err + } + b3, err := json.Marshal(r.VendorExtensible) + if err != nil { + return nil, err + } + return swag.ConcatJSON(b1, b2, b3), nil +} + +// NewResponse creates a new response instance +func NewResponse() *Response { + return new(Response) +} + +// ResponseRef creates a response as a json reference +func ResponseRef(url string) *Response { + resp := NewResponse() + resp.Ref = MustCreateRef(url) + return resp +} + +// WithDescription sets the description on this response, allows for chaining +func (r *Response) WithDescription(description string) *Response { + r.Description = description + return r +} + +// WithSchema sets the schema on this response, allows for chaining. +// Passing a nil argument removes the schema from this response +func (r *Response) WithSchema(schema *Schema) *Response { + r.Schema = schema + return r +} + +// AddHeader adds a header to this response +func (r *Response) AddHeader(name string, header *Header) *Response { + if header == nil { + return r.RemoveHeader(name) + } + if r.Headers == nil { + r.Headers = make(map[string]Header) + } + r.Headers[name] = *header + return r +} + +// RemoveHeader removes a header from this response +func (r *Response) RemoveHeader(name string) *Response { + delete(r.Headers, name) + return r +} + +// AddExample adds an example to this response +func (r *Response) AddExample(mediaType string, example interface{}) *Response { + if r.Examples == nil { + r.Examples = make(map[string]interface{}) + } + r.Examples[mediaType] = example + return r +} diff --git a/vendor/github.com/go-openapi/spec/responses.go b/vendor/github.com/go-openapi/spec/responses.go new file mode 100644 index 0000000..16c3076 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/responses.go @@ -0,0 +1,140 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + "fmt" + "reflect" + "strconv" + "strings" + + "github.com/go-openapi/swag" +) + +// Responses is a container for the expected responses of an operation. +// The container maps a HTTP response code to the expected response. +// It is not expected from the documentation to necessarily cover all possible HTTP response codes, +// since they may not be known in advance. However, it is expected from the documentation to cover +// a successful operation response and any known errors. +// +// The `default` can be used a default response object for all HTTP codes that are not covered +// individually by the specification. +// +// The `Responses Object` MUST contain at least one response code, and it SHOULD be the response +// for a successful operation call. +// +// For more information: http://goo.gl/8us55a#responsesObject +type Responses struct { + VendorExtensible + ResponsesProps +} + +// JSONLookup implements an interface to customize json pointer lookup +func (r Responses) JSONLookup(token string) (interface{}, error) { + if token == "default" { + return r.Default, nil + } + if ex, ok := r.Extensions[token]; ok { + return &ex, nil + } + if i, err := strconv.Atoi(token); err == nil { + if scr, ok := r.StatusCodeResponses[i]; ok { + return scr, nil + } + } + return nil, fmt.Errorf("object has no field %q", token) +} + +// UnmarshalJSON hydrates this items instance with the data from JSON +func (r *Responses) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &r.ResponsesProps); err != nil { + return err + } + + if err := json.Unmarshal(data, &r.VendorExtensible); err != nil { + return err + } + if reflect.DeepEqual(ResponsesProps{}, r.ResponsesProps) { + r.ResponsesProps = ResponsesProps{} + } + return nil +} + +// MarshalJSON converts this items object to JSON +func (r Responses) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(r.ResponsesProps) + if err != nil { + return nil, err + } + b2, err := json.Marshal(r.VendorExtensible) + if err != nil { + return nil, err + } + concated := swag.ConcatJSON(b1, b2) + return concated, nil +} + +// ResponsesProps describes all responses for an operation. +// It tells what is the default response and maps all responses with a +// HTTP status code. +type ResponsesProps struct { + Default *Response + StatusCodeResponses map[int]Response +} + +// MarshalJSON marshals responses as JSON +func (r ResponsesProps) MarshalJSON() ([]byte, error) { + toser := map[string]Response{} + if r.Default != nil { + toser["default"] = *r.Default + } + for k, v := range r.StatusCodeResponses { + toser[strconv.Itoa(k)] = v + } + return json.Marshal(toser) +} + +// UnmarshalJSON unmarshals responses from JSON +func (r *ResponsesProps) UnmarshalJSON(data []byte) error { + var res map[string]json.RawMessage + if err := json.Unmarshal(data, &res); err != nil { + return err + } + + if v, ok := res["default"]; ok { + var defaultRes Response + if err := json.Unmarshal(v, &defaultRes); err != nil { + return err + } + r.Default = &defaultRes + delete(res, "default") + } + for k, v := range res { + if !strings.HasPrefix(k, "x-") { + var statusCodeResp Response + if err := json.Unmarshal(v, &statusCodeResp); err != nil { + return err + } + if nk, err := strconv.Atoi(k); err == nil { + if r.StatusCodeResponses == nil { + r.StatusCodeResponses = map[int]Response{} + } + r.StatusCodeResponses[nk] = statusCodeResp + } + } + } + return nil +} diff --git a/vendor/github.com/go-openapi/spec/schema.go b/vendor/github.com/go-openapi/spec/schema.go new file mode 100644 index 0000000..4e9be85 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/schema.go @@ -0,0 +1,645 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + "fmt" + "strings" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +// BooleanProperty creates a boolean property +func BooleanProperty() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"boolean"}}} +} + +// BoolProperty creates a boolean property +func BoolProperty() *Schema { return BooleanProperty() } + +// StringProperty creates a string property +func StringProperty() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}}} +} + +// CharProperty creates a string property +func CharProperty() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}}} +} + +// Float64Property creates a float64/double property +func Float64Property() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"number"}, Format: "double"}} +} + +// Float32Property creates a float32/float property +func Float32Property() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"number"}, Format: "float"}} +} + +// Int8Property creates an int8 property +func Int8Property() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"integer"}, Format: "int8"}} +} + +// Int16Property creates an int16 property +func Int16Property() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"integer"}, Format: "int16"}} +} + +// Int32Property creates an int32 property +func Int32Property() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"integer"}, Format: "int32"}} +} + +// Int64Property creates an int64 property +func Int64Property() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"integer"}, Format: "int64"}} +} + +// StrFmtProperty creates a property for the named string format +func StrFmtProperty(format string) *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}, Format: format}} +} + +// DateProperty creates a date property +func DateProperty() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}, Format: "date"}} +} + +// DateTimeProperty creates a date time property +func DateTimeProperty() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}, Format: "date-time"}} +} + +// MapProperty creates a map property +func MapProperty(property *Schema) *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"object"}, + AdditionalProperties: &SchemaOrBool{Allows: true, Schema: property}}} +} + +// RefProperty creates a ref property +func RefProperty(name string) *Schema { + return &Schema{SchemaProps: SchemaProps{Ref: MustCreateRef(name)}} +} + +// RefSchema creates a ref property +func RefSchema(name string) *Schema { + return &Schema{SchemaProps: SchemaProps{Ref: MustCreateRef(name)}} +} + +// ArrayProperty creates an array property +func ArrayProperty(items *Schema) *Schema { + if items == nil { + return &Schema{SchemaProps: SchemaProps{Type: []string{"array"}}} + } + return &Schema{SchemaProps: SchemaProps{Items: &SchemaOrArray{Schema: items}, Type: []string{"array"}}} +} + +// ComposedSchema creates a schema with allOf +func ComposedSchema(schemas ...Schema) *Schema { + s := new(Schema) + s.AllOf = schemas + return s +} + +// SchemaURL represents a schema url +type SchemaURL string + +// MarshalJSON marshal this to JSON +func (r SchemaURL) MarshalJSON() ([]byte, error) { + if r == "" { + return []byte("{}"), nil + } + v := map[string]interface{}{"$schema": string(r)} + return json.Marshal(v) +} + +// UnmarshalJSON unmarshal this from JSON +func (r *SchemaURL) UnmarshalJSON(data []byte) error { + var v map[string]interface{} + if err := json.Unmarshal(data, &v); err != nil { + return err + } + return r.fromMap(v) +} + +func (r *SchemaURL) fromMap(v map[string]interface{}) error { + if v == nil { + return nil + } + if vv, ok := v["$schema"]; ok { + if str, ok := vv.(string); ok { + u, err := parseURL(str) + if err != nil { + return err + } + + *r = SchemaURL(u.String()) + } + } + return nil +} + +// SchemaProps describes a JSON schema (draft 4) +type SchemaProps struct { + ID string `json:"id,omitempty"` + Ref Ref `json:"-"` + Schema SchemaURL `json:"-"` + Description string `json:"description,omitempty"` + Type StringOrArray `json:"type,omitempty"` + Nullable bool `json:"nullable,omitempty"` + Format string `json:"format,omitempty"` + Title string `json:"title,omitempty"` + Default interface{} `json:"default,omitempty"` + Maximum *float64 `json:"maximum,omitempty"` + ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"` + Minimum *float64 `json:"minimum,omitempty"` + ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"` + MaxLength *int64 `json:"maxLength,omitempty"` + MinLength *int64 `json:"minLength,omitempty"` + Pattern string `json:"pattern,omitempty"` + MaxItems *int64 `json:"maxItems,omitempty"` + MinItems *int64 `json:"minItems,omitempty"` + UniqueItems bool `json:"uniqueItems,omitempty"` + MultipleOf *float64 `json:"multipleOf,omitempty"` + Enum []interface{} `json:"enum,omitempty"` + MaxProperties *int64 `json:"maxProperties,omitempty"` + MinProperties *int64 `json:"minProperties,omitempty"` + Required []string `json:"required,omitempty"` + Items *SchemaOrArray `json:"items,omitempty"` + AllOf []Schema `json:"allOf,omitempty"` + OneOf []Schema `json:"oneOf,omitempty"` + AnyOf []Schema `json:"anyOf,omitempty"` + Not *Schema `json:"not,omitempty"` + Properties SchemaProperties `json:"properties,omitempty"` + AdditionalProperties *SchemaOrBool `json:"additionalProperties,omitempty"` + PatternProperties SchemaProperties `json:"patternProperties,omitempty"` + Dependencies Dependencies `json:"dependencies,omitempty"` + AdditionalItems *SchemaOrBool `json:"additionalItems,omitempty"` + Definitions Definitions `json:"definitions,omitempty"` +} + +// SwaggerSchemaProps are additional properties supported by swagger schemas, but not JSON-schema (draft 4) +type SwaggerSchemaProps struct { + Discriminator string `json:"discriminator,omitempty"` + ReadOnly bool `json:"readOnly,omitempty"` + XML *XMLObject `json:"xml,omitempty"` + ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` + Example interface{} `json:"example,omitempty"` +} + +// Schema the schema object allows the definition of input and output data types. +// These types can be objects, but also primitives and arrays. +// This object is based on the [JSON Schema Specification Draft 4](http://json-schema.org/) +// and uses a predefined subset of it. +// On top of this subset, there are extensions provided by this specification to allow for more complete documentation. +// +// For more information: http://goo.gl/8us55a#schemaObject +type Schema struct { + VendorExtensible + SchemaProps + SwaggerSchemaProps + ExtraProps map[string]interface{} `json:"-"` +} + +// JSONLookup implements an interface to customize json pointer lookup +func (s Schema) JSONLookup(token string) (interface{}, error) { + if ex, ok := s.Extensions[token]; ok { + return &ex, nil + } + + if ex, ok := s.ExtraProps[token]; ok { + return &ex, nil + } + + r, _, err := jsonpointer.GetForToken(s.SchemaProps, token) + if r != nil || (err != nil && !strings.HasPrefix(err.Error(), "object has no field")) { + return r, err + } + r, _, err = jsonpointer.GetForToken(s.SwaggerSchemaProps, token) + return r, err +} + +// WithID sets the id for this schema, allows for chaining +func (s *Schema) WithID(id string) *Schema { + s.ID = id + return s +} + +// WithTitle sets the title for this schema, allows for chaining +func (s *Schema) WithTitle(title string) *Schema { + s.Title = title + return s +} + +// WithDescription sets the description for this schema, allows for chaining +func (s *Schema) WithDescription(description string) *Schema { + s.Description = description + return s +} + +// WithProperties sets the properties for this schema +func (s *Schema) WithProperties(schemas map[string]Schema) *Schema { + s.Properties = schemas + return s +} + +// SetProperty sets a property on this schema +func (s *Schema) SetProperty(name string, schema Schema) *Schema { + if s.Properties == nil { + s.Properties = make(map[string]Schema) + } + s.Properties[name] = schema + return s +} + +// WithAllOf sets the all of property +func (s *Schema) WithAllOf(schemas ...Schema) *Schema { + s.AllOf = schemas + return s +} + +// WithMaxProperties sets the max number of properties an object can have +func (s *Schema) WithMaxProperties(max int64) *Schema { + s.MaxProperties = &max + return s +} + +// WithMinProperties sets the min number of properties an object must have +func (s *Schema) WithMinProperties(min int64) *Schema { + s.MinProperties = &min + return s +} + +// Typed sets the type of this schema for a single value item +func (s *Schema) Typed(tpe, format string) *Schema { + s.Type = []string{tpe} + s.Format = format + return s +} + +// AddType adds a type with potential format to the types for this schema +func (s *Schema) AddType(tpe, format string) *Schema { + s.Type = append(s.Type, tpe) + if format != "" { + s.Format = format + } + return s +} + +// AsNullable flags this schema as nullable. +func (s *Schema) AsNullable() *Schema { + s.Nullable = true + return s +} + +// CollectionOf a fluent builder method for an array parameter +func (s *Schema) CollectionOf(items Schema) *Schema { + s.Type = []string{jsonArray} + s.Items = &SchemaOrArray{Schema: &items} + return s +} + +// WithDefault sets the default value on this parameter +func (s *Schema) WithDefault(defaultValue interface{}) *Schema { + s.Default = defaultValue + return s +} + +// WithRequired flags this parameter as required +func (s *Schema) WithRequired(items ...string) *Schema { + s.Required = items + return s +} + +// AddRequired adds field names to the required properties array +func (s *Schema) AddRequired(items ...string) *Schema { + s.Required = append(s.Required, items...) + return s +} + +// WithMaxLength sets a max length value +func (s *Schema) WithMaxLength(max int64) *Schema { + s.MaxLength = &max + return s +} + +// WithMinLength sets a min length value +func (s *Schema) WithMinLength(min int64) *Schema { + s.MinLength = &min + return s +} + +// WithPattern sets a pattern value +func (s *Schema) WithPattern(pattern string) *Schema { + s.Pattern = pattern + return s +} + +// WithMultipleOf sets a multiple of value +func (s *Schema) WithMultipleOf(number float64) *Schema { + s.MultipleOf = &number + return s +} + +// WithMaximum sets a maximum number value +func (s *Schema) WithMaximum(max float64, exclusive bool) *Schema { + s.Maximum = &max + s.ExclusiveMaximum = exclusive + return s +} + +// WithMinimum sets a minimum number value +func (s *Schema) WithMinimum(min float64, exclusive bool) *Schema { + s.Minimum = &min + s.ExclusiveMinimum = exclusive + return s +} + +// WithEnum sets a the enum values (replace) +func (s *Schema) WithEnum(values ...interface{}) *Schema { + s.Enum = append([]interface{}{}, values...) + return s +} + +// WithMaxItems sets the max items +func (s *Schema) WithMaxItems(size int64) *Schema { + s.MaxItems = &size + return s +} + +// WithMinItems sets the min items +func (s *Schema) WithMinItems(size int64) *Schema { + s.MinItems = &size + return s +} + +// UniqueValues dictates that this array can only have unique items +func (s *Schema) UniqueValues() *Schema { + s.UniqueItems = true + return s +} + +// AllowDuplicates this array can have duplicates +func (s *Schema) AllowDuplicates() *Schema { + s.UniqueItems = false + return s +} + +// AddToAllOf adds a schema to the allOf property +func (s *Schema) AddToAllOf(schemas ...Schema) *Schema { + s.AllOf = append(s.AllOf, schemas...) + return s +} + +// WithDiscriminator sets the name of the discriminator field +func (s *Schema) WithDiscriminator(discriminator string) *Schema { + s.Discriminator = discriminator + return s +} + +// AsReadOnly flags this schema as readonly +func (s *Schema) AsReadOnly() *Schema { + s.ReadOnly = true + return s +} + +// AsWritable flags this schema as writeable (not read-only) +func (s *Schema) AsWritable() *Schema { + s.ReadOnly = false + return s +} + +// WithExample sets the example for this schema +func (s *Schema) WithExample(example interface{}) *Schema { + s.Example = example + return s +} + +// WithExternalDocs sets/removes the external docs for/from this schema. +// When you pass empty strings as params the external documents will be removed. +// When you pass non-empty string as one value then those values will be used on the external docs object. +// So when you pass a non-empty description, you should also pass the url and vice versa. +func (s *Schema) WithExternalDocs(description, url string) *Schema { + if description == "" && url == "" { + s.ExternalDocs = nil + return s + } + + if s.ExternalDocs == nil { + s.ExternalDocs = &ExternalDocumentation{} + } + s.ExternalDocs.Description = description + s.ExternalDocs.URL = url + return s +} + +// WithXMLName sets the xml name for the object +func (s *Schema) WithXMLName(name string) *Schema { + if s.XML == nil { + s.XML = new(XMLObject) + } + s.XML.Name = name + return s +} + +// WithXMLNamespace sets the xml namespace for the object +func (s *Schema) WithXMLNamespace(namespace string) *Schema { + if s.XML == nil { + s.XML = new(XMLObject) + } + s.XML.Namespace = namespace + return s +} + +// WithXMLPrefix sets the xml prefix for the object +func (s *Schema) WithXMLPrefix(prefix string) *Schema { + if s.XML == nil { + s.XML = new(XMLObject) + } + s.XML.Prefix = prefix + return s +} + +// AsXMLAttribute flags this object as xml attribute +func (s *Schema) AsXMLAttribute() *Schema { + if s.XML == nil { + s.XML = new(XMLObject) + } + s.XML.Attribute = true + return s +} + +// AsXMLElement flags this object as an xml node +func (s *Schema) AsXMLElement() *Schema { + if s.XML == nil { + s.XML = new(XMLObject) + } + s.XML.Attribute = false + return s +} + +// AsWrappedXML flags this object as wrapped, this is mostly useful for array types +func (s *Schema) AsWrappedXML() *Schema { + if s.XML == nil { + s.XML = new(XMLObject) + } + s.XML.Wrapped = true + return s +} + +// AsUnwrappedXML flags this object as an xml node +func (s *Schema) AsUnwrappedXML() *Schema { + if s.XML == nil { + s.XML = new(XMLObject) + } + s.XML.Wrapped = false + return s +} + +// SetValidations defines all schema validations. +// +// NOTE: Required, ReadOnly, AllOf, AnyOf, OneOf and Not are not considered. +func (s *Schema) SetValidations(val SchemaValidations) { + s.Maximum = val.Maximum + s.ExclusiveMaximum = val.ExclusiveMaximum + s.Minimum = val.Minimum + s.ExclusiveMinimum = val.ExclusiveMinimum + s.MaxLength = val.MaxLength + s.MinLength = val.MinLength + s.Pattern = val.Pattern + s.MaxItems = val.MaxItems + s.MinItems = val.MinItems + s.UniqueItems = val.UniqueItems + s.MultipleOf = val.MultipleOf + s.Enum = val.Enum + s.MinProperties = val.MinProperties + s.MaxProperties = val.MaxProperties + s.PatternProperties = val.PatternProperties +} + +// WithValidations is a fluent method to set schema validations +func (s *Schema) WithValidations(val SchemaValidations) *Schema { + s.SetValidations(val) + return s +} + +// Validations returns a clone of the validations for this schema +func (s Schema) Validations() SchemaValidations { + return SchemaValidations{ + CommonValidations: CommonValidations{ + Maximum: s.Maximum, + ExclusiveMaximum: s.ExclusiveMaximum, + Minimum: s.Minimum, + ExclusiveMinimum: s.ExclusiveMinimum, + MaxLength: s.MaxLength, + MinLength: s.MinLength, + Pattern: s.Pattern, + MaxItems: s.MaxItems, + MinItems: s.MinItems, + UniqueItems: s.UniqueItems, + MultipleOf: s.MultipleOf, + Enum: s.Enum, + }, + MinProperties: s.MinProperties, + MaxProperties: s.MaxProperties, + PatternProperties: s.PatternProperties, + } +} + +// MarshalJSON marshal this to JSON +func (s Schema) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(s.SchemaProps) + if err != nil { + return nil, fmt.Errorf("schema props %v", err) + } + b2, err := json.Marshal(s.VendorExtensible) + if err != nil { + return nil, fmt.Errorf("vendor props %v", err) + } + b3, err := s.Ref.MarshalJSON() + if err != nil { + return nil, fmt.Errorf("ref prop %v", err) + } + b4, err := s.Schema.MarshalJSON() + if err != nil { + return nil, fmt.Errorf("schema prop %v", err) + } + b5, err := json.Marshal(s.SwaggerSchemaProps) + if err != nil { + return nil, fmt.Errorf("common validations %v", err) + } + var b6 []byte + if s.ExtraProps != nil { + jj, err := json.Marshal(s.ExtraProps) + if err != nil { + return nil, fmt.Errorf("extra props %v", err) + } + b6 = jj + } + return swag.ConcatJSON(b1, b2, b3, b4, b5, b6), nil +} + +// UnmarshalJSON marshal this from JSON +func (s *Schema) UnmarshalJSON(data []byte) error { + props := struct { + SchemaProps + SwaggerSchemaProps + }{} + if err := json.Unmarshal(data, &props); err != nil { + return err + } + + sch := Schema{ + SchemaProps: props.SchemaProps, + SwaggerSchemaProps: props.SwaggerSchemaProps, + } + + var d map[string]interface{} + if err := json.Unmarshal(data, &d); err != nil { + return err + } + + _ = sch.Ref.fromMap(d) + _ = sch.Schema.fromMap(d) + + delete(d, "$ref") + delete(d, "$schema") + for _, pn := range swag.DefaultJSONNameProvider.GetJSONNames(s) { + delete(d, pn) + } + + for k, vv := range d { + lk := strings.ToLower(k) + if strings.HasPrefix(lk, "x-") { + if sch.Extensions == nil { + sch.Extensions = map[string]interface{}{} + } + sch.Extensions[k] = vv + continue + } + if sch.ExtraProps == nil { + sch.ExtraProps = map[string]interface{}{} + } + sch.ExtraProps[k] = vv + } + + *s = sch + + return nil +} diff --git a/vendor/github.com/go-openapi/spec/schema_loader.go b/vendor/github.com/go-openapi/spec/schema_loader.go new file mode 100644 index 0000000..0059b99 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/schema_loader.go @@ -0,0 +1,331 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + "fmt" + "log" + "net/url" + "reflect" + "strings" + + "github.com/go-openapi/swag" +) + +// PathLoader is a function to use when loading remote refs. +// +// This is a package level default. It may be overridden or bypassed by +// specifying the loader in ExpandOptions. +// +// NOTE: if you are using the go-openapi/loads package, it will override +// this value with its own default (a loader to retrieve YAML documents as +// well as JSON ones). +var PathLoader = func(pth string) (json.RawMessage, error) { + data, err := swag.LoadFromFileOrHTTP(pth) + if err != nil { + return nil, err + } + return json.RawMessage(data), nil +} + +// resolverContext allows to share a context during spec processing. +// At the moment, it just holds the index of circular references found. +type resolverContext struct { + // circulars holds all visited circular references, to shortcircuit $ref resolution. + // + // This structure is privately instantiated and needs not be locked against + // concurrent access, unless we chose to implement a parallel spec walking. + circulars map[string]bool + basePath string + loadDoc func(string) (json.RawMessage, error) + rootID string +} + +func newResolverContext(options *ExpandOptions) *resolverContext { + expandOptions := optionsOrDefault(options) + + // path loader may be overridden by options + var loader func(string) (json.RawMessage, error) + if expandOptions.PathLoader == nil { + loader = PathLoader + } else { + loader = expandOptions.PathLoader + } + + return &resolverContext{ + circulars: make(map[string]bool), + basePath: expandOptions.RelativeBase, // keep the root base path in context + loadDoc: loader, + } +} + +type schemaLoader struct { + root interface{} + options *ExpandOptions + cache ResolutionCache + context *resolverContext +} + +func (r *schemaLoader) transitiveResolver(basePath string, ref Ref) *schemaLoader { + if ref.IsRoot() || ref.HasFragmentOnly { + return r + } + + baseRef := MustCreateRef(basePath) + currentRef := normalizeRef(&ref, basePath) + if strings.HasPrefix(currentRef.String(), baseRef.String()) { + return r + } + + // set a new root against which to resolve + rootURL := currentRef.GetURL() + rootURL.Fragment = "" + root, _ := r.cache.Get(rootURL.String()) + + // shallow copy of resolver options to set a new RelativeBase when + // traversing multiple documents + newOptions := r.options + newOptions.RelativeBase = rootURL.String() + + return defaultSchemaLoader(root, newOptions, r.cache, r.context) +} + +func (r *schemaLoader) updateBasePath(transitive *schemaLoader, basePath string) string { + if transitive != r { + if transitive.options != nil && transitive.options.RelativeBase != "" { + return normalizeBase(transitive.options.RelativeBase) + } + } + + return basePath +} + +func (r *schemaLoader) resolveRef(ref *Ref, target interface{}, basePath string) error { + tgt := reflect.ValueOf(target) + if tgt.Kind() != reflect.Ptr { + return ErrResolveRefNeedsAPointer + } + + if ref.GetURL() == nil { + return nil + } + + var ( + res interface{} + data interface{} + err error + ) + + // Resolve against the root if it isn't nil, and if ref is pointing at the root, or has a fragment only which means + // it is pointing somewhere in the root. + root := r.root + if (ref.IsRoot() || ref.HasFragmentOnly) && root == nil && basePath != "" { + if baseRef, erb := NewRef(basePath); erb == nil { + root, _, _, _ = r.load(baseRef.GetURL()) + } + } + + if (ref.IsRoot() || ref.HasFragmentOnly) && root != nil { + data = root + } else { + baseRef := normalizeRef(ref, basePath) + data, _, _, err = r.load(baseRef.GetURL()) + if err != nil { + return err + } + } + + res = data + if ref.String() != "" { + res, _, err = ref.GetPointer().Get(data) + if err != nil { + return err + } + } + return swag.DynamicJSONToStruct(res, target) +} + +func (r *schemaLoader) load(refURL *url.URL) (interface{}, url.URL, bool, error) { + debugLog("loading schema from url: %s", refURL) + toFetch := *refURL + toFetch.Fragment = "" + + var err error + pth := toFetch.String() + normalized := normalizeBase(pth) + debugLog("loading doc from: %s", normalized) + + data, fromCache := r.cache.Get(normalized) + if fromCache { + return data, toFetch, fromCache, nil + } + + b, err := r.context.loadDoc(normalized) + if err != nil { + return nil, url.URL{}, false, err + } + + var doc interface{} + if err := json.Unmarshal(b, &doc); err != nil { + return nil, url.URL{}, false, err + } + r.cache.Set(normalized, doc) + + return doc, toFetch, fromCache, nil +} + +// isCircular detects cycles in sequences of $ref. +// +// It relies on a private context (which needs not be locked). +func (r *schemaLoader) isCircular(ref *Ref, basePath string, parentRefs ...string) (foundCycle bool) { + normalizedRef := normalizeURI(ref.String(), basePath) + if _, ok := r.context.circulars[normalizedRef]; ok { + // circular $ref has been already detected in another explored cycle + foundCycle = true + return + } + foundCycle = swag.ContainsStrings(parentRefs, normalizedRef) // normalized windows url's are lower cased + if foundCycle { + r.context.circulars[normalizedRef] = true + } + return +} + +// Resolve resolves a reference against basePath and stores the result in target. +// +// Resolve is not in charge of following references: it only resolves ref by following its URL. +// +// If the schema the ref is referring to holds nested refs, Resolve doesn't resolve them. +// +// If basePath is an empty string, ref is resolved against the root schema stored in the schemaLoader struct +func (r *schemaLoader) Resolve(ref *Ref, target interface{}, basePath string) error { + return r.resolveRef(ref, target, basePath) +} + +func (r *schemaLoader) deref(input interface{}, parentRefs []string, basePath string) error { + var ref *Ref + switch refable := input.(type) { + case *Schema: + ref = &refable.Ref + case *Parameter: + ref = &refable.Ref + case *Response: + ref = &refable.Ref + case *PathItem: + ref = &refable.Ref + default: + return fmt.Errorf("unsupported type: %T: %w", input, ErrDerefUnsupportedType) + } + + curRef := ref.String() + if curRef == "" { + return nil + } + + normalizedRef := normalizeRef(ref, basePath) + normalizedBasePath := normalizedRef.RemoteURI() + + if r.isCircular(normalizedRef, basePath, parentRefs...) { + return nil + } + + if err := r.resolveRef(ref, input, basePath); r.shouldStopOnError(err) { + return err + } + + if ref.String() == "" || ref.String() == curRef { + // done with rereferencing + return nil + } + + parentRefs = append(parentRefs, normalizedRef.String()) + return r.deref(input, parentRefs, normalizedBasePath) +} + +func (r *schemaLoader) shouldStopOnError(err error) bool { + if err != nil && !r.options.ContinueOnError { + return true + } + + if err != nil { + log.Println(err) + } + + return false +} + +func (r *schemaLoader) setSchemaID(target interface{}, id, basePath string) (string, string) { + debugLog("schema has ID: %s", id) + + // handling the case when id is a folder + // remember that basePath has to point to a file + var refPath string + if strings.HasSuffix(id, "/") { + // ensure this is detected as a file, not a folder + refPath = fmt.Sprintf("%s%s", id, "placeholder.json") + } else { + refPath = id + } + + // updates the current base path + // * important: ID can be a relative path + // * registers target to be fetchable from the new base proposed by this id + newBasePath := normalizeURI(refPath, basePath) + + // store found IDs for possible future reuse in $ref + r.cache.Set(newBasePath, target) + + // the root document has an ID: all $ref relative to that ID may + // be rebased relative to the root document + if basePath == r.context.basePath { + debugLog("root document is a schema with ID: %s (normalized as:%s)", id, newBasePath) + r.context.rootID = newBasePath + } + + return newBasePath, refPath +} + +func defaultSchemaLoader( + root interface{}, + expandOptions *ExpandOptions, + cache ResolutionCache, + context *resolverContext) *schemaLoader { + + if expandOptions == nil { + expandOptions = &ExpandOptions{} + } + + cache = cacheOrDefault(cache) + + if expandOptions.RelativeBase == "" { + // if no relative base is provided, assume the root document + // contains all $ref, or at least, that the relative documents + // may be resolved from the current working directory. + expandOptions.RelativeBase = baseForRoot(root, cache) + } + debugLog("effective expander options: %#v", expandOptions) + + if context == nil { + context = newResolverContext(expandOptions) + } + + return &schemaLoader{ + root: root, + options: expandOptions, + cache: cache, + context: context, + } +} diff --git a/vendor/github.com/go-openapi/spec/schemas/jsonschema-draft-04.json b/vendor/github.com/go-openapi/spec/schemas/jsonschema-draft-04.json new file mode 100644 index 0000000..bcbb847 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/schemas/jsonschema-draft-04.json @@ -0,0 +1,149 @@ +{ + "id": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft-04/schema#", + "description": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "positiveInteger": { + "type": "integer", + "minimum": 0 + }, + "positiveIntegerDefault0": { + "allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ] + }, + "simpleTypes": { + "enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "minItems": 1, + "uniqueItems": true + } + }, + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "$schema": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": {}, + "multipleOf": { + "type": "number", + "minimum": 0, + "exclusiveMinimum": true + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "boolean", + "default": false + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "boolean", + "default": false + }, + "maxLength": { "$ref": "#/definitions/positiveInteger" }, + "minLength": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { + "anyOf": [ + { "type": "boolean" }, + { "$ref": "#" } + ], + "default": {} + }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": {} + }, + "maxItems": { "$ref": "#/definitions/positiveInteger" }, + "minItems": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxProperties": { "$ref": "#/definitions/positiveInteger" }, + "minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { + "anyOf": [ + { "type": "boolean" }, + { "$ref": "#" } + ], + "default": {} + }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "enum": { + "type": "array", + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "dependencies": { + "exclusiveMaximum": [ "maximum" ], + "exclusiveMinimum": [ "minimum" ] + }, + "default": {} +} diff --git a/vendor/github.com/go-openapi/spec/schemas/v2/schema.json b/vendor/github.com/go-openapi/spec/schemas/v2/schema.json new file mode 100644 index 0000000..ebe10ed --- /dev/null +++ b/vendor/github.com/go-openapi/spec/schemas/v2/schema.json @@ -0,0 +1,1607 @@ +{ + "title": "A JSON Schema for Swagger 2.0 API.", + "id": "http://swagger.io/v2/schema.json#", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "required": [ + "swagger", + "info", + "paths" + ], + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "swagger": { + "type": "string", + "enum": [ + "2.0" + ], + "description": "The Swagger version of this document." + }, + "info": { + "$ref": "#/definitions/info" + }, + "host": { + "type": "string", + "pattern": "^[^{}/ :\\\\]+(?::\\d+)?$", + "description": "The host (name or ip) of the API. Example: 'swagger.io'" + }, + "basePath": { + "type": "string", + "pattern": "^/", + "description": "The base path to the API. Example: '/api'." + }, + "schemes": { + "$ref": "#/definitions/schemesList" + }, + "consumes": { + "description": "A list of MIME types accepted by the API.", + "allOf": [ + { + "$ref": "#/definitions/mediaTypeList" + } + ] + }, + "produces": { + "description": "A list of MIME types the API can produce.", + "allOf": [ + { + "$ref": "#/definitions/mediaTypeList" + } + ] + }, + "paths": { + "$ref": "#/definitions/paths" + }, + "definitions": { + "$ref": "#/definitions/definitions" + }, + "parameters": { + "$ref": "#/definitions/parameterDefinitions" + }, + "responses": { + "$ref": "#/definitions/responseDefinitions" + }, + "security": { + "$ref": "#/definitions/security" + }, + "securityDefinitions": { + "$ref": "#/definitions/securityDefinitions" + }, + "tags": { + "type": "array", + "items": { + "$ref": "#/definitions/tag" + }, + "uniqueItems": true + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" + } + }, + "definitions": { + "info": { + "type": "object", + "description": "General information about the API.", + "required": [ + "version", + "title" + ], + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "title": { + "type": "string", + "description": "A unique and precise title of the API." + }, + "version": { + "type": "string", + "description": "A semantic version number of the API." + }, + "description": { + "type": "string", + "description": "A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed." + }, + "termsOfService": { + "type": "string", + "description": "The terms of service for the API." + }, + "contact": { + "$ref": "#/definitions/contact" + }, + "license": { + "$ref": "#/definitions/license" + } + } + }, + "contact": { + "type": "object", + "description": "Contact information for the owners of the API.", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "description": "The identifying name of the contact person/organization." + }, + "url": { + "type": "string", + "description": "The URL pointing to the contact information.", + "format": "uri" + }, + "email": { + "type": "string", + "description": "The email address of the contact person/organization.", + "format": "email" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "license": { + "type": "object", + "required": [ + "name" + ], + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "description": "The name of the license type. It's encouraged to use an OSI compatible license." + }, + "url": { + "type": "string", + "description": "The URL pointing to the license.", + "format": "uri" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "paths": { + "type": "object", + "description": "Relative paths to the individual endpoints. They must be relative to the 'basePath'.", + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + }, + "^/": { + "$ref": "#/definitions/pathItem" + } + }, + "additionalProperties": false + }, + "definitions": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/schema" + }, + "description": "One or more JSON objects describing the schemas being consumed and produced by the API." + }, + "parameterDefinitions": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/parameter" + }, + "description": "One or more JSON representations for parameters" + }, + "responseDefinitions": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/response" + }, + "description": "One or more JSON representations for responses" + }, + "externalDocs": { + "type": "object", + "additionalProperties": false, + "description": "information about external documentation", + "required": [ + "url" + ], + "properties": { + "description": { + "type": "string" + }, + "url": { + "type": "string", + "format": "uri" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "examples": { + "type": "object", + "additionalProperties": true + }, + "mimeType": { + "type": "string", + "description": "The MIME type of the HTTP message." + }, + "operation": { + "type": "object", + "required": [ + "responses" + ], + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "tags": { + "type": "array", + "items": { + "type": "string" + }, + "uniqueItems": true + }, + "summary": { + "type": "string", + "description": "A brief summary of the operation." + }, + "description": { + "type": "string", + "description": "A longer description of the operation, GitHub Flavored Markdown is allowed." + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" + }, + "operationId": { + "type": "string", + "description": "A unique identifier of the operation." + }, + "produces": { + "description": "A list of MIME types the API can produce.", + "allOf": [ + { + "$ref": "#/definitions/mediaTypeList" + } + ] + }, + "consumes": { + "description": "A list of MIME types the API can consume.", + "allOf": [ + { + "$ref": "#/definitions/mediaTypeList" + } + ] + }, + "parameters": { + "$ref": "#/definitions/parametersList" + }, + "responses": { + "$ref": "#/definitions/responses" + }, + "schemes": { + "$ref": "#/definitions/schemesList" + }, + "deprecated": { + "type": "boolean", + "default": false + }, + "security": { + "$ref": "#/definitions/security" + } + } + }, + "pathItem": { + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "$ref": { + "type": "string" + }, + "get": { + "$ref": "#/definitions/operation" + }, + "put": { + "$ref": "#/definitions/operation" + }, + "post": { + "$ref": "#/definitions/operation" + }, + "delete": { + "$ref": "#/definitions/operation" + }, + "options": { + "$ref": "#/definitions/operation" + }, + "head": { + "$ref": "#/definitions/operation" + }, + "patch": { + "$ref": "#/definitions/operation" + }, + "parameters": { + "$ref": "#/definitions/parametersList" + } + } + }, + "responses": { + "type": "object", + "description": "Response objects names can either be any valid HTTP status code or 'default'.", + "minProperties": 1, + "additionalProperties": false, + "patternProperties": { + "^([0-9]{3})$|^(default)$": { + "$ref": "#/definitions/responseValue" + }, + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "not": { + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + } + }, + "responseValue": { + "oneOf": [ + { + "$ref": "#/definitions/response" + }, + { + "$ref": "#/definitions/jsonReference" + } + ] + }, + "response": { + "type": "object", + "required": [ + "description" + ], + "properties": { + "description": { + "type": "string" + }, + "schema": { + "oneOf": [ + { + "$ref": "#/definitions/schema" + }, + { + "$ref": "#/definitions/fileSchema" + } + ] + }, + "headers": { + "$ref": "#/definitions/headers" + }, + "examples": { + "$ref": "#/definitions/examples" + } + }, + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "headers": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/header" + } + }, + "header": { + "type": "object", + "additionalProperties": false, + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "string", + "number", + "integer", + "boolean", + "array" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormat" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "vendorExtension": { + "description": "Any property starting with x- is valid.", + "additionalProperties": true, + "additionalItems": true + }, + "bodyParameter": { + "type": "object", + "required": [ + "name", + "in", + "schema" + ], + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." + }, + "name": { + "type": "string", + "description": "The name of the parameter." + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "body" + ] + }, + "required": { + "type": "boolean", + "description": "Determines whether or not this parameter is required or optional.", + "default": false + }, + "schema": { + "$ref": "#/definitions/schema" + } + }, + "additionalProperties": false + }, + "headerParameterSubSchema": { + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "required": { + "type": "boolean", + "description": "Determines whether or not this parameter is required or optional.", + "default": false + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "header" + ] + }, + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." + }, + "name": { + "type": "string", + "description": "The name of the parameter." + }, + "type": { + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "integer", + "array" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormat" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + } + } + }, + "queryParameterSubSchema": { + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "required": { + "type": "boolean", + "description": "Determines whether or not this parameter is required or optional.", + "default": false + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "query" + ] + }, + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." + }, + "name": { + "type": "string", + "description": "The name of the parameter." + }, + "allowEmptyValue": { + "type": "boolean", + "default": false, + "description": "allows sending a parameter by name only or with an empty value." + }, + "type": { + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "integer", + "array" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormatWithMulti" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + } + } + }, + "formDataParameterSubSchema": { + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "required": { + "type": "boolean", + "description": "Determines whether or not this parameter is required or optional.", + "default": false + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "formData" + ] + }, + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." + }, + "name": { + "type": "string", + "description": "The name of the parameter." + }, + "allowEmptyValue": { + "type": "boolean", + "default": false, + "description": "allows sending a parameter by name only or with an empty value." + }, + "type": { + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "integer", + "array", + "file" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormatWithMulti" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + } + } + }, + "pathParameterSubSchema": { + "additionalProperties": false, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "required": [ + "required" + ], + "properties": { + "required": { + "type": "boolean", + "enum": [ + true + ], + "description": "Determines whether or not this parameter is required or optional." + }, + "in": { + "type": "string", + "description": "Determines the location of the parameter.", + "enum": [ + "path" + ] + }, + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." + }, + "name": { + "type": "string", + "description": "The name of the parameter." + }, + "type": { + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "integer", + "array" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormat" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + } + } + }, + "nonBodyParameter": { + "type": "object", + "required": [ + "name", + "in", + "type" + ], + "oneOf": [ + { + "$ref": "#/definitions/headerParameterSubSchema" + }, + { + "$ref": "#/definitions/formDataParameterSubSchema" + }, + { + "$ref": "#/definitions/queryParameterSubSchema" + }, + { + "$ref": "#/definitions/pathParameterSubSchema" + } + ] + }, + "parameter": { + "oneOf": [ + { + "$ref": "#/definitions/bodyParameter" + }, + { + "$ref": "#/definitions/nonBodyParameter" + } + ] + }, + "schema": { + "type": "object", + "description": "A deterministic version of a JSON Schema object.", + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "$ref": { + "type": "string" + }, + "format": { + "type": "string" + }, + "title": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/title" + }, + "description": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/description" + }, + "default": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/default" + }, + "multipleOf": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" + }, + "maximum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" + }, + "exclusiveMaximum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" + }, + "minimum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" + }, + "exclusiveMinimum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" + }, + "maxLength": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minLength": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "pattern": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" + }, + "maxItems": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minItems": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "uniqueItems": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" + }, + "maxProperties": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minProperties": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "required": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" + }, + "enum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" + }, + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/definitions/schema" + }, + { + "type": "boolean" + } + ], + "default": {} + }, + "type": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/type" + }, + "items": { + "anyOf": [ + { + "$ref": "#/definitions/schema" + }, + { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/schema" + } + } + ], + "default": {} + }, + "allOf": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/schema" + } + }, + "properties": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/schema" + }, + "default": {} + }, + "discriminator": { + "type": "string" + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "xml": { + "$ref": "#/definitions/xml" + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" + }, + "example": {} + }, + "additionalProperties": false + }, + "fileSchema": { + "type": "object", + "description": "A deterministic version of a JSON Schema object.", + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "required": [ + "type" + ], + "properties": { + "format": { + "type": "string" + }, + "title": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/title" + }, + "description": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/description" + }, + "default": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/default" + }, + "required": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" + }, + "type": { + "type": "string", + "enum": [ + "file" + ] + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" + }, + "example": {} + }, + "additionalProperties": false + }, + "primitivesItems": { + "type": "object", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "enum": [ + "string", + "number", + "integer", + "boolean", + "array" + ] + }, + "format": { + "type": "string" + }, + "items": { + "$ref": "#/definitions/primitivesItems" + }, + "collectionFormat": { + "$ref": "#/definitions/collectionFormat" + }, + "default": { + "$ref": "#/definitions/default" + }, + "maximum": { + "$ref": "#/definitions/maximum" + }, + "exclusiveMaximum": { + "$ref": "#/definitions/exclusiveMaximum" + }, + "minimum": { + "$ref": "#/definitions/minimum" + }, + "exclusiveMinimum": { + "$ref": "#/definitions/exclusiveMinimum" + }, + "maxLength": { + "$ref": "#/definitions/maxLength" + }, + "minLength": { + "$ref": "#/definitions/minLength" + }, + "pattern": { + "$ref": "#/definitions/pattern" + }, + "maxItems": { + "$ref": "#/definitions/maxItems" + }, + "minItems": { + "$ref": "#/definitions/minItems" + }, + "uniqueItems": { + "$ref": "#/definitions/uniqueItems" + }, + "enum": { + "$ref": "#/definitions/enum" + }, + "multipleOf": { + "$ref": "#/definitions/multipleOf" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "security": { + "type": "array", + "items": { + "$ref": "#/definitions/securityRequirement" + }, + "uniqueItems": true + }, + "securityRequirement": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + }, + "uniqueItems": true + } + }, + "xml": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "prefix": { + "type": "string" + }, + "attribute": { + "type": "boolean", + "default": false + }, + "wrapped": { + "type": "boolean", + "default": false + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "tag": { + "type": "object", + "additionalProperties": false, + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "securityDefinitions": { + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "$ref": "#/definitions/basicAuthenticationSecurity" + }, + { + "$ref": "#/definitions/apiKeySecurity" + }, + { + "$ref": "#/definitions/oauth2ImplicitSecurity" + }, + { + "$ref": "#/definitions/oauth2PasswordSecurity" + }, + { + "$ref": "#/definitions/oauth2ApplicationSecurity" + }, + { + "$ref": "#/definitions/oauth2AccessCodeSecurity" + } + ] + } + }, + "basicAuthenticationSecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "basic" + ] + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "apiKeySecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "name", + "in" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "apiKey" + ] + }, + "name": { + "type": "string" + }, + "in": { + "type": "string", + "enum": [ + "header", + "query" + ] + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "oauth2ImplicitSecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "flow", + "authorizationUrl" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "oauth2" + ] + }, + "flow": { + "type": "string", + "enum": [ + "implicit" + ] + }, + "scopes": { + "$ref": "#/definitions/oauth2Scopes" + }, + "authorizationUrl": { + "type": "string", + "format": "uri" + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "oauth2PasswordSecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "flow", + "tokenUrl" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "oauth2" + ] + }, + "flow": { + "type": "string", + "enum": [ + "password" + ] + }, + "scopes": { + "$ref": "#/definitions/oauth2Scopes" + }, + "tokenUrl": { + "type": "string", + "format": "uri" + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "oauth2ApplicationSecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "flow", + "tokenUrl" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "oauth2" + ] + }, + "flow": { + "type": "string", + "enum": [ + "application" + ] + }, + "scopes": { + "$ref": "#/definitions/oauth2Scopes" + }, + "tokenUrl": { + "type": "string", + "format": "uri" + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "oauth2AccessCodeSecurity": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "flow", + "authorizationUrl", + "tokenUrl" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "oauth2" + ] + }, + "flow": { + "type": "string", + "enum": [ + "accessCode" + ] + }, + "scopes": { + "$ref": "#/definitions/oauth2Scopes" + }, + "authorizationUrl": { + "type": "string", + "format": "uri" + }, + "tokenUrl": { + "type": "string", + "format": "uri" + }, + "description": { + "type": "string" + } + }, + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + } + }, + "oauth2Scopes": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "mediaTypeList": { + "type": "array", + "items": { + "$ref": "#/definitions/mimeType" + }, + "uniqueItems": true + }, + "parametersList": { + "type": "array", + "description": "The parameters needed to send a valid API call.", + "additionalItems": false, + "items": { + "oneOf": [ + { + "$ref": "#/definitions/parameter" + }, + { + "$ref": "#/definitions/jsonReference" + } + ] + }, + "uniqueItems": true + }, + "schemesList": { + "type": "array", + "description": "The transfer protocol of the API.", + "items": { + "type": "string", + "enum": [ + "http", + "https", + "ws", + "wss" + ] + }, + "uniqueItems": true + }, + "collectionFormat": { + "type": "string", + "enum": [ + "csv", + "ssv", + "tsv", + "pipes" + ], + "default": "csv" + }, + "collectionFormatWithMulti": { + "type": "string", + "enum": [ + "csv", + "ssv", + "tsv", + "pipes", + "multi" + ], + "default": "csv" + }, + "title": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/title" + }, + "description": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/description" + }, + "default": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/default" + }, + "multipleOf": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" + }, + "maximum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" + }, + "exclusiveMaximum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" + }, + "minimum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" + }, + "exclusiveMinimum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" + }, + "maxLength": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minLength": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "pattern": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" + }, + "maxItems": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minItems": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "uniqueItems": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" + }, + "enum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" + }, + "jsonReference": { + "type": "object", + "required": [ + "$ref" + ], + "additionalProperties": false, + "properties": { + "$ref": { + "type": "string" + } + } + } + } +} diff --git a/vendor/github.com/go-openapi/spec/security_scheme.go b/vendor/github.com/go-openapi/spec/security_scheme.go new file mode 100644 index 0000000..9d0bdae --- /dev/null +++ b/vendor/github.com/go-openapi/spec/security_scheme.go @@ -0,0 +1,170 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +const ( + basic = "basic" + apiKey = "apiKey" + oauth2 = "oauth2" + implicit = "implicit" + password = "password" + application = "application" + accessCode = "accessCode" +) + +// BasicAuth creates a basic auth security scheme +func BasicAuth() *SecurityScheme { + return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{Type: basic}} +} + +// APIKeyAuth creates an api key auth security scheme +func APIKeyAuth(fieldName, valueSource string) *SecurityScheme { + return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{Type: apiKey, Name: fieldName, In: valueSource}} +} + +// OAuth2Implicit creates an implicit flow oauth2 security scheme +func OAuth2Implicit(authorizationURL string) *SecurityScheme { + return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{ + Type: oauth2, + Flow: implicit, + AuthorizationURL: authorizationURL, + }} +} + +// OAuth2Password creates a password flow oauth2 security scheme +func OAuth2Password(tokenURL string) *SecurityScheme { + return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{ + Type: oauth2, + Flow: password, + TokenURL: tokenURL, + }} +} + +// OAuth2Application creates an application flow oauth2 security scheme +func OAuth2Application(tokenURL string) *SecurityScheme { + return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{ + Type: oauth2, + Flow: application, + TokenURL: tokenURL, + }} +} + +// OAuth2AccessToken creates an access token flow oauth2 security scheme +func OAuth2AccessToken(authorizationURL, tokenURL string) *SecurityScheme { + return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{ + Type: oauth2, + Flow: accessCode, + AuthorizationURL: authorizationURL, + TokenURL: tokenURL, + }} +} + +// SecuritySchemeProps describes a swagger security scheme in the securityDefinitions section +type SecuritySchemeProps struct { + Description string `json:"description,omitempty"` + Type string `json:"type"` + Name string `json:"name,omitempty"` // api key + In string `json:"in,omitempty"` // api key + Flow string `json:"flow,omitempty"` // oauth2 + AuthorizationURL string `json:"authorizationUrl"` // oauth2 + TokenURL string `json:"tokenUrl,omitempty"` // oauth2 + Scopes map[string]string `json:"scopes,omitempty"` // oauth2 +} + +// AddScope adds a scope to this security scheme +func (s *SecuritySchemeProps) AddScope(scope, description string) { + if s.Scopes == nil { + s.Scopes = make(map[string]string) + } + s.Scopes[scope] = description +} + +// SecurityScheme allows the definition of a security scheme that can be used by the operations. +// Supported schemes are basic authentication, an API key (either as a header or as a query parameter) +// and OAuth2's common flows (implicit, password, application and access code). +// +// For more information: http://goo.gl/8us55a#securitySchemeObject +type SecurityScheme struct { + VendorExtensible + SecuritySchemeProps +} + +// JSONLookup implements an interface to customize json pointer lookup +func (s SecurityScheme) JSONLookup(token string) (interface{}, error) { + if ex, ok := s.Extensions[token]; ok { + return &ex, nil + } + + r, _, err := jsonpointer.GetForToken(s.SecuritySchemeProps, token) + return r, err +} + +// MarshalJSON marshal this to JSON +func (s SecurityScheme) MarshalJSON() ([]byte, error) { + var ( + b1 []byte + err error + ) + + if s.Type == oauth2 && (s.Flow == "implicit" || s.Flow == "accessCode") { + // when oauth2 for implicit or accessCode flows, empty AuthorizationURL is added as empty string + b1, err = json.Marshal(s.SecuritySchemeProps) + } else { + // when not oauth2, empty AuthorizationURL should be omitted + b1, err = json.Marshal(struct { + Description string `json:"description,omitempty"` + Type string `json:"type"` + Name string `json:"name,omitempty"` // api key + In string `json:"in,omitempty"` // api key + Flow string `json:"flow,omitempty"` // oauth2 + AuthorizationURL string `json:"authorizationUrl,omitempty"` // oauth2 + TokenURL string `json:"tokenUrl,omitempty"` // oauth2 + Scopes map[string]string `json:"scopes,omitempty"` // oauth2 + }{ + Description: s.Description, + Type: s.Type, + Name: s.Name, + In: s.In, + Flow: s.Flow, + AuthorizationURL: s.AuthorizationURL, + TokenURL: s.TokenURL, + Scopes: s.Scopes, + }) + } + if err != nil { + return nil, err + } + + b2, err := json.Marshal(s.VendorExtensible) + if err != nil { + return nil, err + } + return swag.ConcatJSON(b1, b2), nil +} + +// UnmarshalJSON marshal this from JSON +func (s *SecurityScheme) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &s.SecuritySchemeProps); err != nil { + return err + } + return json.Unmarshal(data, &s.VendorExtensible) +} diff --git a/vendor/github.com/go-openapi/spec/spec.go b/vendor/github.com/go-openapi/spec/spec.go new file mode 100644 index 0000000..876aa12 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/spec.go @@ -0,0 +1,78 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" +) + +//go:generate curl -L --progress -o ./schemas/v2/schema.json http://swagger.io/v2/schema.json +//go:generate curl -L --progress -o ./schemas/jsonschema-draft-04.json http://json-schema.org/draft-04/schema +//go:generate go-bindata -pkg=spec -prefix=./schemas -ignore=.*\.md ./schemas/... +//go:generate perl -pi -e s,Json,JSON,g bindata.go + +const ( + // SwaggerSchemaURL the url for the swagger 2.0 schema to validate specs + SwaggerSchemaURL = "http://swagger.io/v2/schema.json#" + // JSONSchemaURL the url for the json schema + JSONSchemaURL = "http://json-schema.org/draft-04/schema#" +) + +// MustLoadJSONSchemaDraft04 panics when Swagger20Schema returns an error +func MustLoadJSONSchemaDraft04() *Schema { + d, e := JSONSchemaDraft04() + if e != nil { + panic(e) + } + return d +} + +// JSONSchemaDraft04 loads the json schema document for json shema draft04 +func JSONSchemaDraft04() (*Schema, error) { + b, err := jsonschemaDraft04JSONBytes() + if err != nil { + return nil, err + } + + schema := new(Schema) + if err := json.Unmarshal(b, schema); err != nil { + return nil, err + } + return schema, nil +} + +// MustLoadSwagger20Schema panics when Swagger20Schema returns an error +func MustLoadSwagger20Schema() *Schema { + d, e := Swagger20Schema() + if e != nil { + panic(e) + } + return d +} + +// Swagger20Schema loads the swagger 2.0 schema from the embedded assets +func Swagger20Schema() (*Schema, error) { + + b, err := v2SchemaJSONBytes() + if err != nil { + return nil, err + } + + schema := new(Schema) + if err := json.Unmarshal(b, schema); err != nil { + return nil, err + } + return schema, nil +} diff --git a/vendor/github.com/go-openapi/spec/swagger.go b/vendor/github.com/go-openapi/spec/swagger.go new file mode 100644 index 0000000..1590fd1 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/swagger.go @@ -0,0 +1,448 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "bytes" + "encoding/gob" + "encoding/json" + "fmt" + "strconv" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +// Swagger this is the root document object for the API specification. +// It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) +// together into one document. +// +// For more information: http://goo.gl/8us55a#swagger-object- +type Swagger struct { + VendorExtensible + SwaggerProps +} + +// JSONLookup look up a value by the json property name +func (s Swagger) JSONLookup(token string) (interface{}, error) { + if ex, ok := s.Extensions[token]; ok { + return &ex, nil + } + r, _, err := jsonpointer.GetForToken(s.SwaggerProps, token) + return r, err +} + +// MarshalJSON marshals this swagger structure to json +func (s Swagger) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(s.SwaggerProps) + if err != nil { + return nil, err + } + b2, err := json.Marshal(s.VendorExtensible) + if err != nil { + return nil, err + } + return swag.ConcatJSON(b1, b2), nil +} + +// UnmarshalJSON unmarshals a swagger spec from json +func (s *Swagger) UnmarshalJSON(data []byte) error { + var sw Swagger + if err := json.Unmarshal(data, &sw.SwaggerProps); err != nil { + return err + } + if err := json.Unmarshal(data, &sw.VendorExtensible); err != nil { + return err + } + *s = sw + return nil +} + +// GobEncode provides a safe gob encoder for Swagger, including extensions +func (s Swagger) GobEncode() ([]byte, error) { + var b bytes.Buffer + raw := struct { + Props SwaggerProps + Ext VendorExtensible + }{ + Props: s.SwaggerProps, + Ext: s.VendorExtensible, + } + err := gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err +} + +// GobDecode provides a safe gob decoder for Swagger, including extensions +func (s *Swagger) GobDecode(b []byte) error { + var raw struct { + Props SwaggerProps + Ext VendorExtensible + } + buf := bytes.NewBuffer(b) + err := gob.NewDecoder(buf).Decode(&raw) + if err != nil { + return err + } + s.SwaggerProps = raw.Props + s.VendorExtensible = raw.Ext + return nil +} + +// SwaggerProps captures the top-level properties of an Api specification +// +// NOTE: validation rules +// - the scheme, when present must be from [http, https, ws, wss] +// - BasePath must start with a leading "/" +// - Paths is required +type SwaggerProps struct { + ID string `json:"id,omitempty"` + Consumes []string `json:"consumes,omitempty"` + Produces []string `json:"produces,omitempty"` + Schemes []string `json:"schemes,omitempty"` + Swagger string `json:"swagger,omitempty"` + Info *Info `json:"info,omitempty"` + Host string `json:"host,omitempty"` + BasePath string `json:"basePath,omitempty"` + Paths *Paths `json:"paths"` + Definitions Definitions `json:"definitions,omitempty"` + Parameters map[string]Parameter `json:"parameters,omitempty"` + Responses map[string]Response `json:"responses,omitempty"` + SecurityDefinitions SecurityDefinitions `json:"securityDefinitions,omitempty"` + Security []map[string][]string `json:"security,omitempty"` + Tags []Tag `json:"tags,omitempty"` + ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` +} + +type swaggerPropsAlias SwaggerProps + +type gobSwaggerPropsAlias struct { + Security []map[string]struct { + List []string + Pad bool + } + Alias *swaggerPropsAlias + SecurityIsEmpty bool +} + +// GobEncode provides a safe gob encoder for SwaggerProps, including empty security requirements +func (o SwaggerProps) GobEncode() ([]byte, error) { + raw := gobSwaggerPropsAlias{ + Alias: (*swaggerPropsAlias)(&o), + } + + var b bytes.Buffer + if o.Security == nil { + // nil security requirement + err := gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err + } + + if len(o.Security) == 0 { + // empty, but non-nil security requirement + raw.SecurityIsEmpty = true + raw.Alias.Security = nil + err := gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err + } + + raw.Security = make([]map[string]struct { + List []string + Pad bool + }, 0, len(o.Security)) + for _, req := range o.Security { + v := make(map[string]struct { + List []string + Pad bool + }, len(req)) + for k, val := range req { + v[k] = struct { + List []string + Pad bool + }{ + List: val, + } + } + raw.Security = append(raw.Security, v) + } + + err := gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err +} + +// GobDecode provides a safe gob decoder for SwaggerProps, including empty security requirements +func (o *SwaggerProps) GobDecode(b []byte) error { + var raw gobSwaggerPropsAlias + + buf := bytes.NewBuffer(b) + err := gob.NewDecoder(buf).Decode(&raw) + if err != nil { + return err + } + if raw.Alias == nil { + return nil + } + + switch { + case raw.SecurityIsEmpty: + // empty, but non-nil security requirement + raw.Alias.Security = []map[string][]string{} + case len(raw.Alias.Security) == 0: + // nil security requirement + raw.Alias.Security = nil + default: + raw.Alias.Security = make([]map[string][]string, 0, len(raw.Security)) + for _, req := range raw.Security { + v := make(map[string][]string, len(req)) + for k, val := range req { + v[k] = make([]string, 0, len(val.List)) + v[k] = append(v[k], val.List...) + } + raw.Alias.Security = append(raw.Alias.Security, v) + } + } + + *o = *(*SwaggerProps)(raw.Alias) + return nil +} + +// Dependencies represent a dependencies property +type Dependencies map[string]SchemaOrStringArray + +// SchemaOrBool represents a schema or boolean value, is biased towards true for the boolean property +type SchemaOrBool struct { + Allows bool + Schema *Schema +} + +// JSONLookup implements an interface to customize json pointer lookup +func (s SchemaOrBool) JSONLookup(token string) (interface{}, error) { + if token == "allows" { + return s.Allows, nil + } + r, _, err := jsonpointer.GetForToken(s.Schema, token) + return r, err +} + +var jsTrue = []byte("true") +var jsFalse = []byte("false") + +// MarshalJSON convert this object to JSON +func (s SchemaOrBool) MarshalJSON() ([]byte, error) { + if s.Schema != nil { + return json.Marshal(s.Schema) + } + + if s.Schema == nil && !s.Allows { + return jsFalse, nil + } + return jsTrue, nil +} + +// UnmarshalJSON converts this bool or schema object from a JSON structure +func (s *SchemaOrBool) UnmarshalJSON(data []byte) error { + var nw SchemaOrBool + if len(data) > 0 { + if data[0] == '{' { + var sch Schema + if err := json.Unmarshal(data, &sch); err != nil { + return err + } + nw.Schema = &sch + } + nw.Allows = !bytes.Equal(data, []byte("false")) + } + *s = nw + return nil +} + +// SchemaOrStringArray represents a schema or a string array +type SchemaOrStringArray struct { + Schema *Schema + Property []string +} + +// JSONLookup implements an interface to customize json pointer lookup +func (s SchemaOrStringArray) JSONLookup(token string) (interface{}, error) { + r, _, err := jsonpointer.GetForToken(s.Schema, token) + return r, err +} + +// MarshalJSON converts this schema object or array into JSON structure +func (s SchemaOrStringArray) MarshalJSON() ([]byte, error) { + if len(s.Property) > 0 { + return json.Marshal(s.Property) + } + if s.Schema != nil { + return json.Marshal(s.Schema) + } + return []byte("null"), nil +} + +// UnmarshalJSON converts this schema object or array from a JSON structure +func (s *SchemaOrStringArray) UnmarshalJSON(data []byte) error { + var first byte + if len(data) > 1 { + first = data[0] + } + var nw SchemaOrStringArray + if first == '{' { + var sch Schema + if err := json.Unmarshal(data, &sch); err != nil { + return err + } + nw.Schema = &sch + } + if first == '[' { + if err := json.Unmarshal(data, &nw.Property); err != nil { + return err + } + } + *s = nw + return nil +} + +// Definitions contains the models explicitly defined in this spec +// An object to hold data types that can be consumed and produced by operations. +// These data types can be primitives, arrays or models. +// +// For more information: http://goo.gl/8us55a#definitionsObject +type Definitions map[string]Schema + +// SecurityDefinitions a declaration of the security schemes available to be used in the specification. +// This does not enforce the security schemes on the operations and only serves to provide +// the relevant details for each scheme. +// +// For more information: http://goo.gl/8us55a#securityDefinitionsObject +type SecurityDefinitions map[string]*SecurityScheme + +// StringOrArray represents a value that can either be a string +// or an array of strings. Mainly here for serialization purposes +type StringOrArray []string + +// Contains returns true when the value is contained in the slice +func (s StringOrArray) Contains(value string) bool { + for _, str := range s { + if str == value { + return true + } + } + return false +} + +// JSONLookup implements an interface to customize json pointer lookup +func (s SchemaOrArray) JSONLookup(token string) (interface{}, error) { + if _, err := strconv.Atoi(token); err == nil { + r, _, err := jsonpointer.GetForToken(s.Schemas, token) + return r, err + } + r, _, err := jsonpointer.GetForToken(s.Schema, token) + return r, err +} + +// UnmarshalJSON unmarshals this string or array object from a JSON array or JSON string +func (s *StringOrArray) UnmarshalJSON(data []byte) error { + var first byte + if len(data) > 1 { + first = data[0] + } + + if first == '[' { + var parsed []string + if err := json.Unmarshal(data, &parsed); err != nil { + return err + } + *s = StringOrArray(parsed) + return nil + } + + var single interface{} + if err := json.Unmarshal(data, &single); err != nil { + return err + } + if single == nil { + return nil + } + switch v := single.(type) { + case string: + *s = StringOrArray([]string{v}) + return nil + default: + return fmt.Errorf("only string or array is allowed, not %T", single) + } +} + +// MarshalJSON converts this string or array to a JSON array or JSON string +func (s StringOrArray) MarshalJSON() ([]byte, error) { + if len(s) == 1 { + return json.Marshal([]string(s)[0]) + } + return json.Marshal([]string(s)) +} + +// SchemaOrArray represents a value that can either be a Schema +// or an array of Schema. Mainly here for serialization purposes +type SchemaOrArray struct { + Schema *Schema + Schemas []Schema +} + +// Len returns the number of schemas in this property +func (s SchemaOrArray) Len() int { + if s.Schema != nil { + return 1 + } + return len(s.Schemas) +} + +// ContainsType returns true when one of the schemas is of the specified type +func (s *SchemaOrArray) ContainsType(name string) bool { + if s.Schema != nil { + return s.Schema.Type != nil && s.Schema.Type.Contains(name) + } + return false +} + +// MarshalJSON converts this schema object or array into JSON structure +func (s SchemaOrArray) MarshalJSON() ([]byte, error) { + if len(s.Schemas) > 0 { + return json.Marshal(s.Schemas) + } + return json.Marshal(s.Schema) +} + +// UnmarshalJSON converts this schema object or array from a JSON structure +func (s *SchemaOrArray) UnmarshalJSON(data []byte) error { + var nw SchemaOrArray + var first byte + if len(data) > 1 { + first = data[0] + } + if first == '{' { + var sch Schema + if err := json.Unmarshal(data, &sch); err != nil { + return err + } + nw.Schema = &sch + } + if first == '[' { + if err := json.Unmarshal(data, &nw.Schemas); err != nil { + return err + } + } + *s = nw + return nil +} + +// vim:set ft=go noet sts=2 sw=2 ts=2: diff --git a/vendor/github.com/go-openapi/spec/tag.go b/vendor/github.com/go-openapi/spec/tag.go new file mode 100644 index 0000000..faa3d3d --- /dev/null +++ b/vendor/github.com/go-openapi/spec/tag.go @@ -0,0 +1,75 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +// TagProps describe a tag entry in the top level tags section of a swagger spec +type TagProps struct { + Description string `json:"description,omitempty"` + Name string `json:"name,omitempty"` + ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` +} + +// NewTag creates a new tag +func NewTag(name, description string, externalDocs *ExternalDocumentation) Tag { + return Tag{TagProps: TagProps{Description: description, Name: name, ExternalDocs: externalDocs}} +} + +// Tag allows adding meta data to a single tag that is used by the +// [Operation Object](http://goo.gl/8us55a#operationObject). +// It is not mandatory to have a Tag Object per tag used there. +// +// For more information: http://goo.gl/8us55a#tagObject +type Tag struct { + VendorExtensible + TagProps +} + +// JSONLookup implements an interface to customize json pointer lookup +func (t Tag) JSONLookup(token string) (interface{}, error) { + if ex, ok := t.Extensions[token]; ok { + return &ex, nil + } + + r, _, err := jsonpointer.GetForToken(t.TagProps, token) + return r, err +} + +// MarshalJSON marshal this to JSON +func (t Tag) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(t.TagProps) + if err != nil { + return nil, err + } + b2, err := json.Marshal(t.VendorExtensible) + if err != nil { + return nil, err + } + return swag.ConcatJSON(b1, b2), nil +} + +// UnmarshalJSON marshal this from JSON +func (t *Tag) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &t.TagProps); err != nil { + return err + } + return json.Unmarshal(data, &t.VendorExtensible) +} diff --git a/vendor/github.com/go-openapi/spec/url_go19.go b/vendor/github.com/go-openapi/spec/url_go19.go new file mode 100644 index 0000000..5bdfe40 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/url_go19.go @@ -0,0 +1,11 @@ +package spec + +import "net/url" + +func parseURL(s string) (*url.URL, error) { + u, err := url.Parse(s) + if err == nil { + u.OmitHost = false + } + return u, err +} diff --git a/vendor/github.com/go-openapi/spec/validations.go b/vendor/github.com/go-openapi/spec/validations.go new file mode 100644 index 0000000..6360a8e --- /dev/null +++ b/vendor/github.com/go-openapi/spec/validations.go @@ -0,0 +1,215 @@ +package spec + +// CommonValidations describe common JSON-schema validations +type CommonValidations struct { + Maximum *float64 `json:"maximum,omitempty"` + ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"` + Minimum *float64 `json:"minimum,omitempty"` + ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"` + MaxLength *int64 `json:"maxLength,omitempty"` + MinLength *int64 `json:"minLength,omitempty"` + Pattern string `json:"pattern,omitempty"` + MaxItems *int64 `json:"maxItems,omitempty"` + MinItems *int64 `json:"minItems,omitempty"` + UniqueItems bool `json:"uniqueItems,omitempty"` + MultipleOf *float64 `json:"multipleOf,omitempty"` + Enum []interface{} `json:"enum,omitempty"` +} + +// SetValidations defines all validations for a simple schema. +// +// NOTE: the input is the larger set of validations available for schemas. +// For simple schemas, MinProperties and MaxProperties are ignored. +func (v *CommonValidations) SetValidations(val SchemaValidations) { + v.Maximum = val.Maximum + v.ExclusiveMaximum = val.ExclusiveMaximum + v.Minimum = val.Minimum + v.ExclusiveMinimum = val.ExclusiveMinimum + v.MaxLength = val.MaxLength + v.MinLength = val.MinLength + v.Pattern = val.Pattern + v.MaxItems = val.MaxItems + v.MinItems = val.MinItems + v.UniqueItems = val.UniqueItems + v.MultipleOf = val.MultipleOf + v.Enum = val.Enum +} + +type clearedValidation struct { + Validation string + Value interface{} +} + +type clearedValidations []clearedValidation + +func (c clearedValidations) apply(cbs []func(string, interface{})) { + for _, cb := range cbs { + for _, cleared := range c { + cb(cleared.Validation, cleared.Value) + } + } +} + +// ClearNumberValidations clears all number validations. +// +// Some callbacks may be set by the caller to capture changed values. +func (v *CommonValidations) ClearNumberValidations(cbs ...func(string, interface{})) { + done := make(clearedValidations, 0, 5) + defer func() { + done.apply(cbs) + }() + + if v.Minimum != nil { + done = append(done, clearedValidation{Validation: "minimum", Value: v.Minimum}) + v.Minimum = nil + } + if v.Maximum != nil { + done = append(done, clearedValidation{Validation: "maximum", Value: v.Maximum}) + v.Maximum = nil + } + if v.ExclusiveMaximum { + done = append(done, clearedValidation{Validation: "exclusiveMaximum", Value: v.ExclusiveMaximum}) + v.ExclusiveMaximum = false + } + if v.ExclusiveMinimum { + done = append(done, clearedValidation{Validation: "exclusiveMinimum", Value: v.ExclusiveMinimum}) + v.ExclusiveMinimum = false + } + if v.MultipleOf != nil { + done = append(done, clearedValidation{Validation: "multipleOf", Value: v.MultipleOf}) + v.MultipleOf = nil + } +} + +// ClearStringValidations clears all string validations. +// +// Some callbacks may be set by the caller to capture changed values. +func (v *CommonValidations) ClearStringValidations(cbs ...func(string, interface{})) { + done := make(clearedValidations, 0, 3) + defer func() { + done.apply(cbs) + }() + + if v.Pattern != "" { + done = append(done, clearedValidation{Validation: "pattern", Value: v.Pattern}) + v.Pattern = "" + } + if v.MinLength != nil { + done = append(done, clearedValidation{Validation: "minLength", Value: v.MinLength}) + v.MinLength = nil + } + if v.MaxLength != nil { + done = append(done, clearedValidation{Validation: "maxLength", Value: v.MaxLength}) + v.MaxLength = nil + } +} + +// ClearArrayValidations clears all array validations. +// +// Some callbacks may be set by the caller to capture changed values. +func (v *CommonValidations) ClearArrayValidations(cbs ...func(string, interface{})) { + done := make(clearedValidations, 0, 3) + defer func() { + done.apply(cbs) + }() + + if v.MaxItems != nil { + done = append(done, clearedValidation{Validation: "maxItems", Value: v.MaxItems}) + v.MaxItems = nil + } + if v.MinItems != nil { + done = append(done, clearedValidation{Validation: "minItems", Value: v.MinItems}) + v.MinItems = nil + } + if v.UniqueItems { + done = append(done, clearedValidation{Validation: "uniqueItems", Value: v.UniqueItems}) + v.UniqueItems = false + } +} + +// Validations returns a clone of the validations for a simple schema. +// +// NOTE: in the context of simple schema objects, MinProperties, MaxProperties +// and PatternProperties remain unset. +func (v CommonValidations) Validations() SchemaValidations { + return SchemaValidations{ + CommonValidations: v, + } +} + +// HasNumberValidations indicates if the validations are for numbers or integers +func (v CommonValidations) HasNumberValidations() bool { + return v.Maximum != nil || v.Minimum != nil || v.MultipleOf != nil +} + +// HasStringValidations indicates if the validations are for strings +func (v CommonValidations) HasStringValidations() bool { + return v.MaxLength != nil || v.MinLength != nil || v.Pattern != "" +} + +// HasArrayValidations indicates if the validations are for arrays +func (v CommonValidations) HasArrayValidations() bool { + return v.MaxItems != nil || v.MinItems != nil || v.UniqueItems +} + +// HasEnum indicates if the validation includes some enum constraint +func (v CommonValidations) HasEnum() bool { + return len(v.Enum) > 0 +} + +// SchemaValidations describes the validation properties of a schema +// +// NOTE: at this moment, this is not embedded in SchemaProps because this would induce a breaking change +// in the exported members: all initializers using litterals would fail. +type SchemaValidations struct { + CommonValidations + + PatternProperties SchemaProperties `json:"patternProperties,omitempty"` + MaxProperties *int64 `json:"maxProperties,omitempty"` + MinProperties *int64 `json:"minProperties,omitempty"` +} + +// HasObjectValidations indicates if the validations are for objects +func (v SchemaValidations) HasObjectValidations() bool { + return v.MaxProperties != nil || v.MinProperties != nil || v.PatternProperties != nil +} + +// SetValidations for schema validations +func (v *SchemaValidations) SetValidations(val SchemaValidations) { + v.CommonValidations.SetValidations(val) + v.PatternProperties = val.PatternProperties + v.MaxProperties = val.MaxProperties + v.MinProperties = val.MinProperties +} + +// Validations for a schema +func (v SchemaValidations) Validations() SchemaValidations { + val := v.CommonValidations.Validations() + val.PatternProperties = v.PatternProperties + val.MinProperties = v.MinProperties + val.MaxProperties = v.MaxProperties + return val +} + +// ClearObjectValidations returns a clone of the validations with all object validations cleared. +// +// Some callbacks may be set by the caller to capture changed values. +func (v *SchemaValidations) ClearObjectValidations(cbs ...func(string, interface{})) { + done := make(clearedValidations, 0, 3) + defer func() { + done.apply(cbs) + }() + + if v.MaxProperties != nil { + done = append(done, clearedValidation{Validation: "maxProperties", Value: v.MaxProperties}) + v.MaxProperties = nil + } + if v.MinProperties != nil { + done = append(done, clearedValidation{Validation: "minProperties", Value: v.MinProperties}) + v.MinProperties = nil + } + if v.PatternProperties != nil { + done = append(done, clearedValidation{Validation: "patternProperties", Value: v.PatternProperties}) + v.PatternProperties = nil + } +} diff --git a/vendor/github.com/go-openapi/spec/xml_object.go b/vendor/github.com/go-openapi/spec/xml_object.go new file mode 100644 index 0000000..945a467 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/xml_object.go @@ -0,0 +1,68 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +// XMLObject a metadata object that allows for more fine-tuned XML model definitions. +// +// For more information: http://goo.gl/8us55a#xmlObject +type XMLObject struct { + Name string `json:"name,omitempty"` + Namespace string `json:"namespace,omitempty"` + Prefix string `json:"prefix,omitempty"` + Attribute bool `json:"attribute,omitempty"` + Wrapped bool `json:"wrapped,omitempty"` +} + +// WithName sets the xml name for the object +func (x *XMLObject) WithName(name string) *XMLObject { + x.Name = name + return x +} + +// WithNamespace sets the xml namespace for the object +func (x *XMLObject) WithNamespace(namespace string) *XMLObject { + x.Namespace = namespace + return x +} + +// WithPrefix sets the xml prefix for the object +func (x *XMLObject) WithPrefix(prefix string) *XMLObject { + x.Prefix = prefix + return x +} + +// AsAttribute flags this object as xml attribute +func (x *XMLObject) AsAttribute() *XMLObject { + x.Attribute = true + return x +} + +// AsElement flags this object as an xml node +func (x *XMLObject) AsElement() *XMLObject { + x.Attribute = false + return x +} + +// AsWrapped flags this object as wrapped, this is mostly useful for array types +func (x *XMLObject) AsWrapped() *XMLObject { + x.Wrapped = true + return x +} + +// AsUnwrapped flags this object as an xml node +func (x *XMLObject) AsUnwrapped() *XMLObject { + x.Wrapped = false + return x +} diff --git a/vendor/github.com/go-openapi/strfmt/.editorconfig b/vendor/github.com/go-openapi/strfmt/.editorconfig new file mode 100644 index 0000000..3152da6 --- /dev/null +++ b/vendor/github.com/go-openapi/strfmt/.editorconfig @@ -0,0 +1,26 @@ +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + +# Set default charset +[*.{js,py,go,scala,rb,java,html,css,less,sass,md}] +charset = utf-8 + +# Tab indentation (no size specified) +[*.go] +indent_style = tab + +[*.md] +trim_trailing_whitespace = false + +# Matches the exact files either package.json or .travis.yml +[{package.json,.travis.yml}] +indent_style = space +indent_size = 2 diff --git a/vendor/github.com/go-openapi/strfmt/.gitattributes b/vendor/github.com/go-openapi/strfmt/.gitattributes new file mode 100644 index 0000000..d020be8 --- /dev/null +++ b/vendor/github.com/go-openapi/strfmt/.gitattributes @@ -0,0 +1,2 @@ +*.go text eol=lf + diff --git a/vendor/github.com/go-openapi/strfmt/.gitignore b/vendor/github.com/go-openapi/strfmt/.gitignore new file mode 100644 index 0000000..dd91ed6 --- /dev/null +++ b/vendor/github.com/go-openapi/strfmt/.gitignore @@ -0,0 +1,2 @@ +secrets.yml +coverage.out diff --git a/vendor/github.com/go-openapi/strfmt/.golangci.yml b/vendor/github.com/go-openapi/strfmt/.golangci.yml new file mode 100644 index 0000000..22f8d21 --- /dev/null +++ b/vendor/github.com/go-openapi/strfmt/.golangci.yml @@ -0,0 +1,61 @@ +linters-settings: + govet: + check-shadowing: true + golint: + min-confidence: 0 + gocyclo: + min-complexity: 45 + maligned: + suggest-new: true + dupl: + threshold: 200 + goconst: + min-len: 2 + min-occurrences: 3 + +linters: + enable-all: true + disable: + - maligned + - unparam + - lll + - gochecknoinits + - gochecknoglobals + - funlen + - godox + - gocognit + - whitespace + - wsl + - wrapcheck + - testpackage + - nlreturn + - gomnd + - exhaustivestruct + - goerr113 + - errorlint + - nestif + - godot + - gofumpt + - paralleltest + - tparallel + - thelper + - ifshort + - exhaustruct + - varnamelen + - gci + - depguard + - errchkjson + - inamedparam + - nonamedreturns + - musttag + - ireturn + - forcetypeassert + - cyclop + # deprecated linters + - deadcode + - interfacer + - scopelint + - varcheck + - structcheck + - golint + - nosnakecase diff --git a/vendor/github.com/go-openapi/strfmt/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/strfmt/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..9322b06 --- /dev/null +++ b/vendor/github.com/go-openapi/strfmt/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at ivan+abuse@flanders.co.nz. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/go-openapi/strfmt/LICENSE b/vendor/github.com/go-openapi/strfmt/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/vendor/github.com/go-openapi/strfmt/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-openapi/strfmt/README.md b/vendor/github.com/go-openapi/strfmt/README.md new file mode 100644 index 0000000..f6b39c6 --- /dev/null +++ b/vendor/github.com/go-openapi/strfmt/README.md @@ -0,0 +1,87 @@ +# Strfmt [![Build Status](https://github.com/go-openapi/strfmt/actions/workflows/go-test.yml/badge.svg)](https://github.com/go-openapi/strfmt/actions?query=workflow%3A"go+test") [![codecov](https://codecov.io/gh/go-openapi/strfmt/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/strfmt) +[![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) +[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/strfmt/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/go-openapi/strfmt?status.svg)](http://godoc.org/github.com/go-openapi/strfmt) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/strfmt)](https://goreportcard.com/report/github.com/go-openapi/strfmt) + +This package exposes a registry of data types to support string formats in the go-openapi toolkit. + +strfmt represents a well known string format such as credit card or email. The go toolkit for OpenAPI specifications knows how to deal with those. + +## Supported data formats +go-openapi/strfmt follows the swagger 2.0 specification with the following formats +defined [here](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types). + +It also provides convenient extensions to go-openapi users. + +- [x] JSON-schema draft 4 formats + - date-time + - email + - hostname + - ipv4 + - ipv6 + - uri +- [x] swagger 2.0 format extensions + - binary + - byte (e.g. base64 encoded string) + - date (e.g. "1970-01-01") + - password +- [x] go-openapi custom format extensions + - bsonobjectid (BSON objectID) + - creditcard + - duration (e.g. "3 weeks", "1ms") + - hexcolor (e.g. "#FFFFFF") + - isbn, isbn10, isbn13 + - mac (e.g "01:02:03:04:05:06") + - rgbcolor (e.g. "rgb(100,100,100)") + - ssn + - uuid, uuid3, uuid4, uuid5 + - cidr (e.g. "192.0.2.1/24", "2001:db8:a0b:12f0::1/32") + - ulid (e.g. "00000PP9HGSBSSDZ1JTEXBJ0PW", [spec](https://github.com/ulid/spec)) + +> NOTE: as the name stands for, this package is intended to support string formatting only. +> It does not provide validation for numerical values with swagger format extension for JSON types "number" or +> "integer" (e.g. float, double, int32...). + +## Type conversion + +All types defined here are stringers and may be converted to strings with `.String()`. +Note that most types defined by this package may be converted directly to string like `string(Email{})`. + +`Date` and `DateTime` may be converted directly to `time.Time` like `time.Time(Time{})`. +Similarly, you can convert `Duration` to `time.Duration` as in `time.Duration(Duration{})` + +## Using pointers + +The `conv` subpackage provides helpers to convert the types to and from pointers, just like `go-openapi/swag` does +with primitive types. + +## Format types +Types defined in strfmt expose marshaling and validation capabilities. + +List of defined types: +- Base64 +- CreditCard +- Date +- DateTime +- Duration +- Email +- HexColor +- Hostname +- IPv4 +- IPv6 +- CIDR +- ISBN +- ISBN10 +- ISBN13 +- MAC +- ObjectId +- Password +- RGBColor +- SSN +- URI +- UUID +- UUID3 +- UUID4 +- UUID5 +- [ULID](https://github.com/ulid/spec) diff --git a/vendor/github.com/go-openapi/strfmt/bson.go b/vendor/github.com/go-openapi/strfmt/bson.go new file mode 100644 index 0000000..cfa9a52 --- /dev/null +++ b/vendor/github.com/go-openapi/strfmt/bson.go @@ -0,0 +1,165 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package strfmt + +import ( + "database/sql/driver" + "fmt" + + "go.mongodb.org/mongo-driver/bson" + + "go.mongodb.org/mongo-driver/bson/bsontype" + bsonprim "go.mongodb.org/mongo-driver/bson/primitive" +) + +func init() { + var id ObjectId + // register this format in the default registry + Default.Add("bsonobjectid", &id, IsBSONObjectID) +} + +// IsBSONObjectID returns true when the string is a valid BSON.ObjectId +func IsBSONObjectID(str string) bool { + _, err := bsonprim.ObjectIDFromHex(str) + return err == nil +} + +// ObjectId represents a BSON object ID (alias to go.mongodb.org/mongo-driver/bson/primitive.ObjectID) +// +// swagger:strfmt bsonobjectid +type ObjectId bsonprim.ObjectID //nolint:revive,stylecheck + +// NewObjectId creates a ObjectId from a Hex String +func NewObjectId(hex string) ObjectId { //nolint:revive,stylecheck + oid, err := bsonprim.ObjectIDFromHex(hex) + if err != nil { + panic(err) + } + return ObjectId(oid) +} + +// MarshalText turns this instance into text +func (id ObjectId) MarshalText() ([]byte, error) { + oid := bsonprim.ObjectID(id) + if oid == bsonprim.NilObjectID { + return nil, nil + } + return []byte(oid.Hex()), nil +} + +// UnmarshalText hydrates this instance from text +func (id *ObjectId) UnmarshalText(data []byte) error { // validation is performed later on + if len(data) == 0 { + *id = ObjectId(bsonprim.NilObjectID) + return nil + } + oidstr := string(data) + oid, err := bsonprim.ObjectIDFromHex(oidstr) + if err != nil { + return err + } + *id = ObjectId(oid) + return nil +} + +// Scan read a value from a database driver +func (id *ObjectId) Scan(raw interface{}) error { + var data []byte + switch v := raw.(type) { + case []byte: + data = v + case string: + data = []byte(v) + default: + return fmt.Errorf("cannot sql.Scan() strfmt.URI from: %#v", v) + } + + return id.UnmarshalText(data) +} + +// Value converts a value to a database driver value +func (id ObjectId) Value() (driver.Value, error) { + return driver.Value(bsonprim.ObjectID(id).Hex()), nil +} + +func (id ObjectId) String() string { + return bsonprim.ObjectID(id).Hex() +} + +// MarshalJSON returns the ObjectId as JSON +func (id ObjectId) MarshalJSON() ([]byte, error) { + return bsonprim.ObjectID(id).MarshalJSON() +} + +// UnmarshalJSON sets the ObjectId from JSON +func (id *ObjectId) UnmarshalJSON(data []byte) error { + var obj bsonprim.ObjectID + if err := obj.UnmarshalJSON(data); err != nil { + return err + } + *id = ObjectId(obj) + return nil +} + +// MarshalBSON renders the object id as a BSON document +func (id ObjectId) MarshalBSON() ([]byte, error) { + return bson.Marshal(bson.M{"data": bsonprim.ObjectID(id)}) +} + +// UnmarshalBSON reads the objectId from a BSON document +func (id *ObjectId) UnmarshalBSON(data []byte) error { + var obj struct { + Data bsonprim.ObjectID + } + if err := bson.Unmarshal(data, &obj); err != nil { + return err + } + *id = ObjectId(obj.Data) + return nil +} + +// MarshalBSONValue is an interface implemented by types that can marshal themselves +// into a BSON document represented as bytes. The bytes returned must be a valid +// BSON document if the error is nil. +func (id ObjectId) MarshalBSONValue() (bsontype.Type, []byte, error) { + oid := bsonprim.ObjectID(id) + return bson.TypeObjectID, oid[:], nil +} + +// UnmarshalBSONValue is an interface implemented by types that can unmarshal a +// BSON value representation of themselves. The BSON bytes and type can be +// assumed to be valid. UnmarshalBSONValue must copy the BSON value bytes if it +// wishes to retain the data after returning. +func (id *ObjectId) UnmarshalBSONValue(_ bsontype.Type, data []byte) error { + var oid bsonprim.ObjectID + copy(oid[:], data) + *id = ObjectId(oid) + return nil +} + +// DeepCopyInto copies the receiver and writes its value into out. +func (id *ObjectId) DeepCopyInto(out *ObjectId) { + *out = *id +} + +// DeepCopy copies the receiver into a new ObjectId. +func (id *ObjectId) DeepCopy() *ObjectId { + if id == nil { + return nil + } + out := new(ObjectId) + id.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/go-openapi/strfmt/date.go b/vendor/github.com/go-openapi/strfmt/date.go new file mode 100644 index 0000000..3c93381 --- /dev/null +++ b/vendor/github.com/go-openapi/strfmt/date.go @@ -0,0 +1,187 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package strfmt + +import ( + "database/sql/driver" + "encoding/json" + "errors" + "fmt" + "time" + + "go.mongodb.org/mongo-driver/bson" +) + +func init() { + d := Date{} + // register this format in the default registry + Default.Add("date", &d, IsDate) +} + +// IsDate returns true when the string is a valid date +func IsDate(str string) bool { + _, err := time.Parse(RFC3339FullDate, str) + return err == nil +} + +const ( + // RFC3339FullDate represents a full-date as specified by RFC3339 + // See: http://goo.gl/xXOvVd + RFC3339FullDate = "2006-01-02" +) + +// Date represents a date from the API +// +// swagger:strfmt date +type Date time.Time + +// String converts this date into a string +func (d Date) String() string { + return time.Time(d).Format(RFC3339FullDate) +} + +// UnmarshalText parses a text representation into a date type +func (d *Date) UnmarshalText(text []byte) error { + if len(text) == 0 { + return nil + } + dd, err := time.ParseInLocation(RFC3339FullDate, string(text), DefaultTimeLocation) + if err != nil { + return err + } + *d = Date(dd) + return nil +} + +// MarshalText serializes this date type to string +func (d Date) MarshalText() ([]byte, error) { + return []byte(d.String()), nil +} + +// Scan scans a Date value from database driver type. +func (d *Date) Scan(raw interface{}) error { + switch v := raw.(type) { + case []byte: + return d.UnmarshalText(v) + case string: + return d.UnmarshalText([]byte(v)) + case time.Time: + *d = Date(v) + return nil + case nil: + *d = Date{} + return nil + default: + return fmt.Errorf("cannot sql.Scan() strfmt.Date from: %#v", v) + } +} + +// Value converts Date to a primitive value ready to written to a database. +func (d Date) Value() (driver.Value, error) { + return driver.Value(d.String()), nil +} + +// MarshalJSON returns the Date as JSON +func (d Date) MarshalJSON() ([]byte, error) { + return json.Marshal(time.Time(d).Format(RFC3339FullDate)) +} + +// UnmarshalJSON sets the Date from JSON +func (d *Date) UnmarshalJSON(data []byte) error { + if string(data) == jsonNull { + return nil + } + var strdate string + if err := json.Unmarshal(data, &strdate); err != nil { + return err + } + tt, err := time.ParseInLocation(RFC3339FullDate, strdate, DefaultTimeLocation) + if err != nil { + return err + } + *d = Date(tt) + return nil +} + +func (d Date) MarshalBSON() ([]byte, error) { + return bson.Marshal(bson.M{"data": d.String()}) +} + +func (d *Date) UnmarshalBSON(data []byte) error { + var m bson.M + if err := bson.Unmarshal(data, &m); err != nil { + return err + } + + if data, ok := m["data"].(string); ok { + rd, err := time.ParseInLocation(RFC3339FullDate, data, DefaultTimeLocation) + if err != nil { + return err + } + *d = Date(rd) + return nil + } + + return errors.New("couldn't unmarshal bson bytes value as Date") +} + +// DeepCopyInto copies the receiver and writes its value into out. +func (d *Date) DeepCopyInto(out *Date) { + *out = *d +} + +// DeepCopy copies the receiver into a new Date. +func (d *Date) DeepCopy() *Date { + if d == nil { + return nil + } + out := new(Date) + d.DeepCopyInto(out) + return out +} + +// GobEncode implements the gob.GobEncoder interface. +func (d Date) GobEncode() ([]byte, error) { + return d.MarshalBinary() +} + +// GobDecode implements the gob.GobDecoder interface. +func (d *Date) GobDecode(data []byte) error { + return d.UnmarshalBinary(data) +} + +// MarshalBinary implements the encoding.BinaryMarshaler interface. +func (d Date) MarshalBinary() ([]byte, error) { + return time.Time(d).MarshalBinary() +} + +// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. +func (d *Date) UnmarshalBinary(data []byte) error { + var original time.Time + + err := original.UnmarshalBinary(data) + if err != nil { + return err + } + + *d = Date(original) + + return nil +} + +// Equal checks if two Date instances are equal +func (d Date) Equal(d2 Date) bool { + return time.Time(d).Equal(time.Time(d2)) +} diff --git a/vendor/github.com/go-openapi/strfmt/default.go b/vendor/github.com/go-openapi/strfmt/default.go new file mode 100644 index 0000000..2813714 --- /dev/null +++ b/vendor/github.com/go-openapi/strfmt/default.go @@ -0,0 +1,2051 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package strfmt + +import ( + "database/sql/driver" + "encoding/base64" + "encoding/json" + "errors" + "fmt" + "net/mail" + "regexp" + "strings" + + "github.com/asaskevich/govalidator" + "github.com/google/uuid" + "go.mongodb.org/mongo-driver/bson" +) + +const ( + // HostnamePattern http://json-schema.org/latest/json-schema-validation.html#anchor114 + // A string instance is valid against this attribute if it is a valid + // representation for an Internet host name, as defined by RFC 1034, section 3.1 [RFC1034]. + // http://tools.ietf.org/html/rfc1034#section-3.5 + // ::= any one of the ten digits 0 through 9 + // var digit = /[0-9]/; + // ::= any one of the 52 alphabetic characters A through Z in upper case and a through z in lower case + // var letter = /[a-zA-Z]/; + // ::= | + // var letDig = /[0-9a-zA-Z]/; + // ::= | "-" + // var letDigHyp = /[-0-9a-zA-Z]/; + // ::= | + // var ldhStr = /[-0-9a-zA-Z]+/; + //