fix: error handling and vendor
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
decentral1se 2024-08-04 10:55:35 +02:00
parent 8603738b38
commit 9e9227b420
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
1193 changed files with 283471 additions and 1 deletions

BIN
blurp

Binary file not shown.

View File

@ -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)))

View File

@ -0,0 +1,8 @@
---
kind: pipeline
name: gtslib-auth-keyring
steps:
- name: build
image: golang:1.21
commands:
- go build -v ./...

View File

@ -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 <https://www.gnu.org/licenses/>.

View File

@ -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
<a href="https://git.coopcloud.tech/decentral1se/gtslib-auth-keyring/src/branch/main/LICENSE">
<img src="https://www.gnu.org/graphics/agplv3-with-text-162x68.png" />
</a>

View File

@ -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
}

View File

@ -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 <https://www.gnu.org/licenses/>.

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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: &notifyDefault,
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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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: &notificationsDefault,
}
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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

File diff suppressed because it is too large Load Diff

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

File diff suppressed because it is too large Load Diff

View File

@ -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
}

View File

@ -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
}

View File

@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package admin
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// 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
}

View File

@ -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
}

View File

@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package admin
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// 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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package admin
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// 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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package admin
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// 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
}

View File

@ -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
}

View File

@ -0,0 +1,128 @@
// Code generated by go-swagger; DO NOT EDIT.
package admin
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// 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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package admin
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// 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
}

View File

@ -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
}

View File

@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package admin
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// 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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package admin
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// 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
}

View File

@ -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
}

View File

@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package admin
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// 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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -0,0 +1,128 @@
// Code generated by go-swagger; DO NOT EDIT.
package admin
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// 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
}

View File

@ -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
}

View File

@ -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
}

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