From 3cf6afb39c5e01317e89fb8888871cb4f5433daf Mon Sep 17 00:00:00 2001 From: James Tombleson Date: Wed, 17 Jul 2024 22:02:38 -0700 Subject: [PATCH] updated make to allow me to convert swagger into a api client with some tools --- .gitignore | 2 + api/api.gen.go | 3756 +++++++++++++++++++++++++++++++++++++++++++++++ api/client.yaml | 6 + makefile | 11 +- 4 files changed, 3772 insertions(+), 3 deletions(-) create mode 100644 api/api.gen.go create mode 100644 api/client.yaml diff --git a/.gitignore b/.gitignore index 29a5f2f..659e393 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ dev.session.sql __debug_bin server .vscode +openapi.json # Binaries for programs and plugins *.exe @@ -12,6 +13,7 @@ server *.dylib collector newsbot.db +tmp/ # Test binary, built with `go test -c` *.test diff --git a/api/api.gen.go b/api/api.gen.go new file mode 100644 index 0000000..8931148 --- /dev/null +++ b/api/api.gen.go @@ -0,0 +1,3756 @@ +// Package api provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 DO NOT EDIT. +package api + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/oapi-codegen/runtime" +) + +const ( + BearerScopes = "Bearer.Scopes" +) + +// DomainArticleAndSourceModel defines model for domain.ArticleAndSourceModel. +type DomainArticleAndSourceModel struct { + Article *DomainArticleDto `json:"article,omitempty"` + Source *DomainSourceDto `json:"source,omitempty"` +} + +// DomainArticleDetailedResponse defines model for domain.ArticleDetailedResponse. +type DomainArticleDetailedResponse struct { + IsError *bool `json:"isError,omitempty"` + Message *string `json:"message,omitempty"` + Payload *DomainArticleAndSourceModel `json:"payload,omitempty"` +} + +// DomainArticleDto defines model for domain.ArticleDto. +type DomainArticleDto struct { + AuthorImage *string `json:"authorImage,omitempty"` + AuthorName *string `json:"authorName,omitempty"` + Description *string `json:"description,omitempty"` + Id *int `json:"id,omitempty"` + IsVideo *bool `json:"isVideo,omitempty"` + PubDate *string `json:"pubDate,omitempty"` + SourceId *int `json:"sourceId,omitempty"` + Tags *string `json:"tags,omitempty"` + Thumbnail *string `json:"thumbnail,omitempty"` + Title *string `json:"title,omitempty"` + Url *string `json:"url,omitempty"` +} + +// DomainArticleResponse defines model for domain.ArticleResponse. +type DomainArticleResponse struct { + IsError *bool `json:"isError,omitempty"` + Message *string `json:"message,omitempty"` + Payload *[]DomainArticleDto `json:"payload,omitempty"` +} + +// DomainBaseResponse defines model for domain.BaseResponse. +type DomainBaseResponse struct { + IsError *bool `json:"isError,omitempty"` + Message *string `json:"message,omitempty"` +} + +// DomainDiscordWebHookDto defines model for domain.DiscordWebHookDto. +type DomainDiscordWebHookDto struct { + Channel *string `json:"channel,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Id *int `json:"id,omitempty"` + Server *string `json:"server,omitempty"` + + // Url Name string `json:"name"` + // Key string `json:"key"` + Url *string `json:"url,omitempty"` +} + +// DomainDiscordWebhookResponse defines model for domain.DiscordWebhookResponse. +type DomainDiscordWebhookResponse struct { + IsError *bool `json:"isError,omitempty"` + Message *string `json:"message,omitempty"` + Payload *[]DomainDiscordWebHookDto `json:"payload,omitempty"` +} + +// DomainLoginResponse defines model for domain.LoginResponse. +type DomainLoginResponse struct { + IsError *bool `json:"isError,omitempty"` + Message *string `json:"message,omitempty"` + RefreshToken *string `json:"refreshToken,omitempty"` + Token *string `json:"token,omitempty"` + Type *string `json:"type,omitempty"` +} + +// DomainNewSourceParamRequest defines model for domain.NewSourceParamRequest. +type DomainNewSourceParamRequest struct { + Name *string `json:"name,omitempty"` + Tags *string `json:"tags,omitempty"` + Url *string `json:"url,omitempty"` +} + +// DomainRefreshTokenRequest defines model for domain.RefreshTokenRequest. +type DomainRefreshTokenRequest struct { + RefreshToken *string `json:"refreshToken,omitempty"` + Username *string `json:"username,omitempty"` +} + +// DomainSourceDto defines model for domain.SourceDto. +type DomainSourceDto struct { + Enabled *bool `json:"enabled,omitempty"` + Id *int `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Source *string `json:"source,omitempty"` + Tags *string `json:"tags,omitempty"` + Url *string `json:"url,omitempty"` +} + +// DomainSourcesResponse defines model for domain.SourcesResponse. +type DomainSourcesResponse struct { + IsError *bool `json:"isError,omitempty"` + Message *string `json:"message,omitempty"` + Payload *[]DomainSourceDto `json:"payload,omitempty"` +} + +// DomainUpdateScopesRequest defines model for domain.UpdateScopesRequest. +type DomainUpdateScopesRequest struct { + Scopes []string `json:"scopes"` + Username *string `json:"username,omitempty"` +} + +// GetV1ArticlesParams defines parameters for GetV1Articles. +type GetV1ArticlesParams struct { + // Page page number + Page int `form:"page" json:"page"` +} + +// GetV1ArticlesBySourceIdParams defines parameters for GetV1ArticlesBySourceId. +type GetV1ArticlesBySourceIdParams struct { + // Page Page to query + Page *int `form:"page,omitempty" json:"page,omitempty"` +} + +// GetV1DiscordWebhooksByServerAndChannelParams defines parameters for GetV1DiscordWebhooksByServerAndChannel. +type GetV1DiscordWebhooksByServerAndChannelParams struct { + // Server Fancy Server + Server string `form:"server" json:"server"` + + // Channel memes + Channel string `form:"channel" json:"channel"` +} + +// PostV1DiscordWebhooksNewParams defines parameters for PostV1DiscordWebhooksNew. +type PostV1DiscordWebhooksNewParams struct { + // Url url + Url string `form:"url" json:"url"` + + // Server Server name + Server string `form:"server" json:"server"` + + // Channel Channel name + Channel string `form:"channel" json:"channel"` +} + +// GetV1SourcesParams defines parameters for GetV1Sources. +type GetV1SourcesParams struct { + // Page page number + Page *string `form:"page,omitempty" json:"page,omitempty"` +} + +// GetV1SourcesBySourceParams defines parameters for GetV1SourcesBySource. +type GetV1SourcesBySourceParams struct { + // Source Source Name + Source string `form:"source" json:"source"` + + // Page page number + Page *string `form:"page,omitempty" json:"page,omitempty"` +} + +// GetV1SourcesBySourceAndNameParams defines parameters for GetV1SourcesBySourceAndName. +type GetV1SourcesBySourceAndNameParams struct { + // Name dadjokes + Name string `form:"name" json:"name"` + + // Source reddit + Source string `form:"source" json:"source"` +} + +// PostV1SourcesNewRedditParams defines parameters for PostV1SourcesNewReddit. +type PostV1SourcesNewRedditParams struct { + // Name name + Name string `form:"name" json:"name"` + + // Url url + Url string `form:"url" json:"url"` +} + +// PostV1SourcesNewTwitchParams defines parameters for PostV1SourcesNewTwitch. +type PostV1SourcesNewTwitchParams struct { + // Name name + Name string `form:"name" json:"name"` +} + +// PostV1SourcesNewYoutubeParams defines parameters for PostV1SourcesNewYoutube. +type PostV1SourcesNewYoutubeParams struct { + // Name name + Name string `form:"name" json:"name"` + + // Url url + Url string `form:"url" json:"url"` +} + +// PostV1UsersLoginMultipartBody defines parameters for PostV1UsersLogin. +type PostV1UsersLoginMultipartBody struct { + Password *string `json:"password,omitempty"` + Username *string `json:"username,omitempty"` +} + +// PostV1UsersRegisterMultipartBody defines parameters for PostV1UsersRegister. +type PostV1UsersRegisterMultipartBody struct { + Password *string `json:"password,omitempty"` + Username *string `json:"username,omitempty"` +} + +// PostV1UsersLoginMultipartRequestBody defines body for PostV1UsersLogin for multipart/form-data ContentType. +type PostV1UsersLoginMultipartRequestBody PostV1UsersLoginMultipartBody + +// PostV1UsersRegisterMultipartRequestBody defines body for PostV1UsersRegister for multipart/form-data ContentType. +type PostV1UsersRegisterMultipartRequestBody PostV1UsersRegisterMultipartBody + +// PostV1UsersScopesAddJSONRequestBody defines body for PostV1UsersScopesAdd for application/json ContentType. +type PostV1UsersScopesAddJSONRequestBody = DomainUpdateScopesRequest + +// PostV1UsersScopesRemoveJSONRequestBody defines body for PostV1UsersScopesRemove for application/json ContentType. +type PostV1UsersScopesRemoveJSONRequestBody = DomainUpdateScopesRequest + +// RequestEditorFn is the function signature for the RequestEditor callback function +type RequestEditorFn func(ctx context.Context, req *http.Request) error + +// Doer performs HTTP requests. +// +// The standard http.Client implements this interface. +type HttpRequestDoer interface { + Do(req *http.Request) (*http.Response, error) +} + +// Client which conforms to the OpenAPI3 specification for this service. +type Client struct { + // The endpoint of the server conforming to this interface, with scheme, + // https://api.deepmap.com for example. This can contain a path relative + // to the server, such as https://api.deepmap.com/dev-test, and all the + // paths in the swagger spec will be appended to the server. + Server string + + // Doer for performing requests, typically a *http.Client with any + // customized settings, such as certificate chains. + Client HttpRequestDoer + + // A list of callbacks for modifying requests which are generated before sending over + // the network. + RequestEditors []RequestEditorFn +} + +// ClientOption allows setting custom parameters during construction +type ClientOption func(*Client) error + +// Creates a new Client, with reasonable defaults +func NewClient(server string, opts ...ClientOption) (*Client, error) { + // create a client with sane default values + client := Client{ + Server: server, + } + // mutate client and add all optional params + for _, o := range opts { + if err := o(&client); err != nil { + return nil, err + } + } + // ensure the server URL always has a trailing slash + if !strings.HasSuffix(client.Server, "/") { + client.Server += "/" + } + // create httpClient, if not already present + if client.Client == nil { + client.Client = &http.Client{} + } + return &client, nil +} + +// WithHTTPClient allows overriding the default Doer, which is +// automatically created using http.Client. This is useful for tests. +func WithHTTPClient(doer HttpRequestDoer) ClientOption { + return func(c *Client) error { + c.Client = doer + return nil + } +} + +// WithRequestEditorFn allows setting up a callback function, which will be +// called right before sending the request. This can be used to mutate the request. +func WithRequestEditorFn(fn RequestEditorFn) ClientOption { + return func(c *Client) error { + c.RequestEditors = append(c.RequestEditors, fn) + return nil + } +} + +// The interface specification for the client above. +type ClientInterface interface { + // GetV1Articles request + GetV1Articles(ctx context.Context, params *GetV1ArticlesParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetV1ArticlesBySourceId request + GetV1ArticlesBySourceId(ctx context.Context, id string, params *GetV1ArticlesBySourceIdParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetV1ArticlesId request + GetV1ArticlesId(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetV1ArticlesIdDetails request + GetV1ArticlesIdDetails(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetV1DiscordWebhooks request + GetV1DiscordWebhooks(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetV1DiscordWebhooksByServerAndChannel request + GetV1DiscordWebhooksByServerAndChannel(ctx context.Context, params *GetV1DiscordWebhooksByServerAndChannelParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PostV1DiscordWebhooksNew request + PostV1DiscordWebhooksNew(ctx context.Context, params *PostV1DiscordWebhooksNewParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // DeleteV1DiscordWebhooksId request + DeleteV1DiscordWebhooksId(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetV1DiscordWebhooksId request + GetV1DiscordWebhooksId(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PostV1DiscordWebhooksIdDisable request + PostV1DiscordWebhooksIdDisable(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PostV1DiscordWebhooksIdEnable request + PostV1DiscordWebhooksIdEnable(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetV1Sources request + GetV1Sources(ctx context.Context, params *GetV1SourcesParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetV1SourcesBySource request + GetV1SourcesBySource(ctx context.Context, params *GetV1SourcesBySourceParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetV1SourcesBySourceAndName request + GetV1SourcesBySourceAndName(ctx context.Context, params *GetV1SourcesBySourceAndNameParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PostV1SourcesNewReddit request + PostV1SourcesNewReddit(ctx context.Context, params *PostV1SourcesNewRedditParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PostV1SourcesNewRssWithBody request with any body + PostV1SourcesNewRssWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PostV1SourcesNewTwitch request + PostV1SourcesNewTwitch(ctx context.Context, params *PostV1SourcesNewTwitchParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PostV1SourcesNewYoutube request + PostV1SourcesNewYoutube(ctx context.Context, params *PostV1SourcesNewYoutubeParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetV1SourcesId request + GetV1SourcesId(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PostV1SourcesId request + PostV1SourcesId(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PostV1SourcesIdDisable request + PostV1SourcesIdDisable(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PostV1SourcesIdEnable request + PostV1SourcesIdEnable(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PostV1UsersLoginWithBody request with any body + PostV1UsersLoginWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PostV1UsersRefreshSessionToken request + PostV1UsersRefreshSessionToken(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PostV1UsersRefreshTokenWithBody request with any body + PostV1UsersRefreshTokenWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PostV1UsersRegisterWithBody request with any body + PostV1UsersRegisterWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PostV1UsersScopesAddWithBody request with any body + PostV1UsersScopesAddWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + PostV1UsersScopesAdd(ctx context.Context, body PostV1UsersScopesAddJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // PostV1UsersScopesRemoveWithBody request with any body + PostV1UsersScopesRemoveWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + PostV1UsersScopesRemove(ctx context.Context, body PostV1UsersScopesRemoveJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) +} + +func (c *Client) GetV1Articles(ctx context.Context, params *GetV1ArticlesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetV1ArticlesRequest(c.Server, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetV1ArticlesBySourceId(ctx context.Context, id string, params *GetV1ArticlesBySourceIdParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetV1ArticlesBySourceIdRequest(c.Server, id, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetV1ArticlesId(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetV1ArticlesIdRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetV1ArticlesIdDetails(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetV1ArticlesIdDetailsRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetV1DiscordWebhooks(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetV1DiscordWebhooksRequest(c.Server) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetV1DiscordWebhooksByServerAndChannel(ctx context.Context, params *GetV1DiscordWebhooksByServerAndChannelParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetV1DiscordWebhooksByServerAndChannelRequest(c.Server, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostV1DiscordWebhooksNew(ctx context.Context, params *PostV1DiscordWebhooksNewParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostV1DiscordWebhooksNewRequest(c.Server, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) DeleteV1DiscordWebhooksId(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDeleteV1DiscordWebhooksIdRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetV1DiscordWebhooksId(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetV1DiscordWebhooksIdRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostV1DiscordWebhooksIdDisable(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostV1DiscordWebhooksIdDisableRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostV1DiscordWebhooksIdEnable(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostV1DiscordWebhooksIdEnableRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetV1Sources(ctx context.Context, params *GetV1SourcesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetV1SourcesRequest(c.Server, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetV1SourcesBySource(ctx context.Context, params *GetV1SourcesBySourceParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetV1SourcesBySourceRequest(c.Server, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetV1SourcesBySourceAndName(ctx context.Context, params *GetV1SourcesBySourceAndNameParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetV1SourcesBySourceAndNameRequest(c.Server, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostV1SourcesNewReddit(ctx context.Context, params *PostV1SourcesNewRedditParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostV1SourcesNewRedditRequest(c.Server, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostV1SourcesNewRssWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostV1SourcesNewRssRequestWithBody(c.Server, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostV1SourcesNewTwitch(ctx context.Context, params *PostV1SourcesNewTwitchParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostV1SourcesNewTwitchRequest(c.Server, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostV1SourcesNewYoutube(ctx context.Context, params *PostV1SourcesNewYoutubeParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostV1SourcesNewYoutubeRequest(c.Server, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetV1SourcesId(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetV1SourcesIdRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostV1SourcesId(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostV1SourcesIdRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostV1SourcesIdDisable(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostV1SourcesIdDisableRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostV1SourcesIdEnable(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostV1SourcesIdEnableRequest(c.Server, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostV1UsersLoginWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostV1UsersLoginRequestWithBody(c.Server, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostV1UsersRefreshSessionToken(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostV1UsersRefreshSessionTokenRequest(c.Server) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostV1UsersRefreshTokenWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostV1UsersRefreshTokenRequestWithBody(c.Server, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostV1UsersRegisterWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostV1UsersRegisterRequestWithBody(c.Server, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostV1UsersScopesAddWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostV1UsersScopesAddRequestWithBody(c.Server, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostV1UsersScopesAdd(ctx context.Context, body PostV1UsersScopesAddJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostV1UsersScopesAddRequest(c.Server, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostV1UsersScopesRemoveWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostV1UsersScopesRemoveRequestWithBody(c.Server, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) PostV1UsersScopesRemove(ctx context.Context, body PostV1UsersScopesRemoveJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostV1UsersScopesRemoveRequest(c.Server, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// NewGetV1ArticlesRequest generates requests for GetV1Articles +func NewGetV1ArticlesRequest(server string, params *GetV1ArticlesParams) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/articles") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "page", runtime.ParamLocationQuery, params.Page); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewGetV1ArticlesBySourceIdRequest generates requests for GetV1ArticlesBySourceId +func NewGetV1ArticlesBySourceIdRequest(server string, id string, params *GetV1ArticlesBySourceIdParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/articles/by/source/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if params.Page != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "page", runtime.ParamLocationQuery, *params.Page); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewGetV1ArticlesIdRequest generates requests for GetV1ArticlesId +func NewGetV1ArticlesIdRequest(server string, id string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/articles/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewGetV1ArticlesIdDetailsRequest generates requests for GetV1ArticlesIdDetails +func NewGetV1ArticlesIdDetailsRequest(server string, id string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/articles/%s/details", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewGetV1DiscordWebhooksRequest generates requests for GetV1DiscordWebhooks +func NewGetV1DiscordWebhooksRequest(server string) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/discord/webhooks") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewGetV1DiscordWebhooksByServerAndChannelRequest generates requests for GetV1DiscordWebhooksByServerAndChannel +func NewGetV1DiscordWebhooksByServerAndChannelRequest(server string, params *GetV1DiscordWebhooksByServerAndChannelParams) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/discord/webhooks/by/serverAndChannel") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "server", runtime.ParamLocationQuery, params.Server); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "channel", runtime.ParamLocationQuery, params.Channel); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewPostV1DiscordWebhooksNewRequest generates requests for PostV1DiscordWebhooksNew +func NewPostV1DiscordWebhooksNewRequest(server string, params *PostV1DiscordWebhooksNewParams) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/discord/webhooks/new") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "url", runtime.ParamLocationQuery, params.Url); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "server", runtime.ParamLocationQuery, params.Server); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "channel", runtime.ParamLocationQuery, params.Channel); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewDeleteV1DiscordWebhooksIdRequest generates requests for DeleteV1DiscordWebhooksId +func NewDeleteV1DiscordWebhooksIdRequest(server string, id string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/discord/webhooks/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewGetV1DiscordWebhooksIdRequest generates requests for GetV1DiscordWebhooksId +func NewGetV1DiscordWebhooksIdRequest(server string, id int) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/discord/webhooks/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewPostV1DiscordWebhooksIdDisableRequest generates requests for PostV1DiscordWebhooksIdDisable +func NewPostV1DiscordWebhooksIdDisableRequest(server string, id int) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/discord/webhooks/%s/disable", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewPostV1DiscordWebhooksIdEnableRequest generates requests for PostV1DiscordWebhooksIdEnable +func NewPostV1DiscordWebhooksIdEnableRequest(server string, id int) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/discord/webhooks/%s/enable", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewGetV1SourcesRequest generates requests for GetV1Sources +func NewGetV1SourcesRequest(server string, params *GetV1SourcesParams) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/sources") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if params.Page != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "page", runtime.ParamLocationQuery, *params.Page); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewGetV1SourcesBySourceRequest generates requests for GetV1SourcesBySource +func NewGetV1SourcesBySourceRequest(server string, params *GetV1SourcesBySourceParams) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/sources/by/source") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "source", runtime.ParamLocationQuery, params.Source); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + if params.Page != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "page", runtime.ParamLocationQuery, *params.Page); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewGetV1SourcesBySourceAndNameRequest generates requests for GetV1SourcesBySourceAndName +func NewGetV1SourcesBySourceAndNameRequest(server string, params *GetV1SourcesBySourceAndNameParams) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/sources/by/sourceAndName") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "name", runtime.ParamLocationQuery, params.Name); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "source", runtime.ParamLocationQuery, params.Source); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewPostV1SourcesNewRedditRequest generates requests for PostV1SourcesNewReddit +func NewPostV1SourcesNewRedditRequest(server string, params *PostV1SourcesNewRedditParams) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/sources/new/reddit") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "name", runtime.ParamLocationQuery, params.Name); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "url", runtime.ParamLocationQuery, params.Url); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewPostV1SourcesNewRssRequestWithBody generates requests for PostV1SourcesNewRss with any type of body +func NewPostV1SourcesNewRssRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/sources/new/rss") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewPostV1SourcesNewTwitchRequest generates requests for PostV1SourcesNewTwitch +func NewPostV1SourcesNewTwitchRequest(server string, params *PostV1SourcesNewTwitchParams) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/sources/new/twitch") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "name", runtime.ParamLocationQuery, params.Name); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewPostV1SourcesNewYoutubeRequest generates requests for PostV1SourcesNewYoutube +func NewPostV1SourcesNewYoutubeRequest(server string, params *PostV1SourcesNewYoutubeParams) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/sources/new/youtube") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "name", runtime.ParamLocationQuery, params.Name); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "url", runtime.ParamLocationQuery, params.Url); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewGetV1SourcesIdRequest generates requests for GetV1SourcesId +func NewGetV1SourcesIdRequest(server string, id int) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/sources/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewPostV1SourcesIdRequest generates requests for PostV1SourcesId +func NewPostV1SourcesIdRequest(server string, id int) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/sources/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewPostV1SourcesIdDisableRequest generates requests for PostV1SourcesIdDisable +func NewPostV1SourcesIdDisableRequest(server string, id int) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/sources/%s/disable", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewPostV1SourcesIdEnableRequest generates requests for PostV1SourcesIdEnable +func NewPostV1SourcesIdEnableRequest(server string, id string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/sources/%s/enable", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewPostV1UsersLoginRequestWithBody generates requests for PostV1UsersLogin with any type of body +func NewPostV1UsersLoginRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/users/login") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewPostV1UsersRefreshSessionTokenRequest generates requests for PostV1UsersRefreshSessionToken +func NewPostV1UsersRefreshSessionTokenRequest(server string) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/users/refresh/sessionToken") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewPostV1UsersRefreshTokenRequestWithBody generates requests for PostV1UsersRefreshToken with any type of body +func NewPostV1UsersRefreshTokenRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/users/refresh/token") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewPostV1UsersRegisterRequestWithBody generates requests for PostV1UsersRegister with any type of body +func NewPostV1UsersRegisterRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/users/register") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewPostV1UsersScopesAddRequest calls the generic PostV1UsersScopesAdd builder with application/json body +func NewPostV1UsersScopesAddRequest(server string, body PostV1UsersScopesAddJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewPostV1UsersScopesAddRequestWithBody(server, "application/json", bodyReader) +} + +// NewPostV1UsersScopesAddRequestWithBody generates requests for PostV1UsersScopesAdd with any type of body +func NewPostV1UsersScopesAddRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/users/scopes/add") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewPostV1UsersScopesRemoveRequest calls the generic PostV1UsersScopesRemove builder with application/json body +func NewPostV1UsersScopesRemoveRequest(server string, body PostV1UsersScopesRemoveJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewPostV1UsersScopesRemoveRequestWithBody(server, "application/json", bodyReader) +} + +// NewPostV1UsersScopesRemoveRequestWithBody generates requests for PostV1UsersScopesRemove with any type of body +func NewPostV1UsersScopesRemoveRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/users/scopes/remove") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { + for _, r := range c.RequestEditors { + if err := r(ctx, req); err != nil { + return err + } + } + for _, r := range additionalEditors { + if err := r(ctx, req); err != nil { + return err + } + } + return nil +} + +// ClientWithResponses builds on ClientInterface to offer response payloads +type ClientWithResponses struct { + ClientInterface +} + +// NewClientWithResponses creates a new ClientWithResponses, which wraps +// Client with return type handling +func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) { + client, err := NewClient(server, opts...) + if err != nil { + return nil, err + } + return &ClientWithResponses{client}, nil +} + +// WithBaseURL overrides the baseURL. +func WithBaseURL(baseURL string) ClientOption { + return func(c *Client) error { + newBaseURL, err := url.Parse(baseURL) + if err != nil { + return err + } + c.Server = newBaseURL.String() + return nil + } +} + +// ClientWithResponsesInterface is the interface specification for the client with responses above. +type ClientWithResponsesInterface interface { + // GetV1ArticlesWithResponse request + GetV1ArticlesWithResponse(ctx context.Context, params *GetV1ArticlesParams, reqEditors ...RequestEditorFn) (*GetV1ArticlesResponse, error) + + // GetV1ArticlesBySourceIdWithResponse request + GetV1ArticlesBySourceIdWithResponse(ctx context.Context, id string, params *GetV1ArticlesBySourceIdParams, reqEditors ...RequestEditorFn) (*GetV1ArticlesBySourceIdResponse, error) + + // GetV1ArticlesIdWithResponse request + GetV1ArticlesIdWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetV1ArticlesIdResponse, error) + + // GetV1ArticlesIdDetailsWithResponse request + GetV1ArticlesIdDetailsWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetV1ArticlesIdDetailsResponse, error) + + // GetV1DiscordWebhooksWithResponse request + GetV1DiscordWebhooksWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetV1DiscordWebhooksResponse, error) + + // GetV1DiscordWebhooksByServerAndChannelWithResponse request + GetV1DiscordWebhooksByServerAndChannelWithResponse(ctx context.Context, params *GetV1DiscordWebhooksByServerAndChannelParams, reqEditors ...RequestEditorFn) (*GetV1DiscordWebhooksByServerAndChannelResponse, error) + + // PostV1DiscordWebhooksNewWithResponse request + PostV1DiscordWebhooksNewWithResponse(ctx context.Context, params *PostV1DiscordWebhooksNewParams, reqEditors ...RequestEditorFn) (*PostV1DiscordWebhooksNewResponse, error) + + // DeleteV1DiscordWebhooksIdWithResponse request + DeleteV1DiscordWebhooksIdWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteV1DiscordWebhooksIdResponse, error) + + // GetV1DiscordWebhooksIdWithResponse request + GetV1DiscordWebhooksIdWithResponse(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*GetV1DiscordWebhooksIdResponse, error) + + // PostV1DiscordWebhooksIdDisableWithResponse request + PostV1DiscordWebhooksIdDisableWithResponse(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*PostV1DiscordWebhooksIdDisableResponse, error) + + // PostV1DiscordWebhooksIdEnableWithResponse request + PostV1DiscordWebhooksIdEnableWithResponse(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*PostV1DiscordWebhooksIdEnableResponse, error) + + // GetV1SourcesWithResponse request + GetV1SourcesWithResponse(ctx context.Context, params *GetV1SourcesParams, reqEditors ...RequestEditorFn) (*GetV1SourcesResponse, error) + + // GetV1SourcesBySourceWithResponse request + GetV1SourcesBySourceWithResponse(ctx context.Context, params *GetV1SourcesBySourceParams, reqEditors ...RequestEditorFn) (*GetV1SourcesBySourceResponse, error) + + // GetV1SourcesBySourceAndNameWithResponse request + GetV1SourcesBySourceAndNameWithResponse(ctx context.Context, params *GetV1SourcesBySourceAndNameParams, reqEditors ...RequestEditorFn) (*GetV1SourcesBySourceAndNameResponse, error) + + // PostV1SourcesNewRedditWithResponse request + PostV1SourcesNewRedditWithResponse(ctx context.Context, params *PostV1SourcesNewRedditParams, reqEditors ...RequestEditorFn) (*PostV1SourcesNewRedditResponse, error) + + // PostV1SourcesNewRssWithBodyWithResponse request with any body + PostV1SourcesNewRssWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostV1SourcesNewRssResponse, error) + + // PostV1SourcesNewTwitchWithResponse request + PostV1SourcesNewTwitchWithResponse(ctx context.Context, params *PostV1SourcesNewTwitchParams, reqEditors ...RequestEditorFn) (*PostV1SourcesNewTwitchResponse, error) + + // PostV1SourcesNewYoutubeWithResponse request + PostV1SourcesNewYoutubeWithResponse(ctx context.Context, params *PostV1SourcesNewYoutubeParams, reqEditors ...RequestEditorFn) (*PostV1SourcesNewYoutubeResponse, error) + + // GetV1SourcesIdWithResponse request + GetV1SourcesIdWithResponse(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*GetV1SourcesIdResponse, error) + + // PostV1SourcesIdWithResponse request + PostV1SourcesIdWithResponse(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*PostV1SourcesIdResponse, error) + + // PostV1SourcesIdDisableWithResponse request + PostV1SourcesIdDisableWithResponse(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*PostV1SourcesIdDisableResponse, error) + + // PostV1SourcesIdEnableWithResponse request + PostV1SourcesIdEnableWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*PostV1SourcesIdEnableResponse, error) + + // PostV1UsersLoginWithBodyWithResponse request with any body + PostV1UsersLoginWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostV1UsersLoginResponse, error) + + // PostV1UsersRefreshSessionTokenWithResponse request + PostV1UsersRefreshSessionTokenWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostV1UsersRefreshSessionTokenResponse, error) + + // PostV1UsersRefreshTokenWithBodyWithResponse request with any body + PostV1UsersRefreshTokenWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostV1UsersRefreshTokenResponse, error) + + // PostV1UsersRegisterWithBodyWithResponse request with any body + PostV1UsersRegisterWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostV1UsersRegisterResponse, error) + + // PostV1UsersScopesAddWithBodyWithResponse request with any body + PostV1UsersScopesAddWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostV1UsersScopesAddResponse, error) + + PostV1UsersScopesAddWithResponse(ctx context.Context, body PostV1UsersScopesAddJSONRequestBody, reqEditors ...RequestEditorFn) (*PostV1UsersScopesAddResponse, error) + + // PostV1UsersScopesRemoveWithBodyWithResponse request with any body + PostV1UsersScopesRemoveWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostV1UsersScopesRemoveResponse, error) + + PostV1UsersScopesRemoveWithResponse(ctx context.Context, body PostV1UsersScopesRemoveJSONRequestBody, reqEditors ...RequestEditorFn) (*PostV1UsersScopesRemoveResponse, error) +} + +type GetV1ArticlesResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DomainArticleResponse + JSON400 *DomainBaseResponse + JSON500 *DomainBaseResponse +} + +// Status returns HTTPResponse.Status +func (r GetV1ArticlesResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetV1ArticlesResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetV1ArticlesBySourceIdResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DomainArticleResponse + JSON400 *DomainBaseResponse + JSON500 *DomainBaseResponse +} + +// Status returns HTTPResponse.Status +func (r GetV1ArticlesBySourceIdResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetV1ArticlesBySourceIdResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetV1ArticlesIdResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DomainArticleResponse + JSON400 *DomainBaseResponse + JSON500 *DomainBaseResponse +} + +// Status returns HTTPResponse.Status +func (r GetV1ArticlesIdResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetV1ArticlesIdResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetV1ArticlesIdDetailsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DomainArticleDetailedResponse + JSON400 *DomainBaseResponse + JSON500 *DomainBaseResponse +} + +// Status returns HTTPResponse.Status +func (r GetV1ArticlesIdDetailsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetV1ArticlesIdDetailsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetV1DiscordWebhooksResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DomainDiscordWebhookResponse + JSON400 *DomainDiscordWebhookResponse + JSON500 *DomainDiscordWebhookResponse +} + +// Status returns HTTPResponse.Status +func (r GetV1DiscordWebhooksResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetV1DiscordWebhooksResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetV1DiscordWebhooksByServerAndChannelResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DomainDiscordWebhookResponse + JSON400 *DomainDiscordWebhookResponse + JSON500 *DomainDiscordWebhookResponse +} + +// Status returns HTTPResponse.Status +func (r GetV1DiscordWebhooksByServerAndChannelResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetV1DiscordWebhooksByServerAndChannelResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostV1DiscordWebhooksNewResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r PostV1DiscordWebhooksNewResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostV1DiscordWebhooksNewResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type DeleteV1DiscordWebhooksIdResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r DeleteV1DiscordWebhooksIdResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r DeleteV1DiscordWebhooksIdResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetV1DiscordWebhooksIdResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DomainDiscordWebhookResponse + JSON400 *DomainDiscordWebhookResponse + JSON500 *DomainDiscordWebhookResponse +} + +// Status returns HTTPResponse.Status +func (r GetV1DiscordWebhooksIdResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetV1DiscordWebhooksIdResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostV1DiscordWebhooksIdDisableResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r PostV1DiscordWebhooksIdDisableResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostV1DiscordWebhooksIdDisableResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostV1DiscordWebhooksIdEnableResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r PostV1DiscordWebhooksIdEnableResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostV1DiscordWebhooksIdEnableResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetV1SourcesResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DomainSourcesResponse + JSON400 *DomainSourcesResponse +} + +// Status returns HTTPResponse.Status +func (r GetV1SourcesResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetV1SourcesResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetV1SourcesBySourceResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DomainSourcesResponse + JSON400 *DomainSourcesResponse + JSON500 *DomainSourcesResponse +} + +// Status returns HTTPResponse.Status +func (r GetV1SourcesBySourceResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetV1SourcesBySourceResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetV1SourcesBySourceAndNameResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DomainSourcesResponse + JSON400 *DomainBaseResponse + JSON500 *DomainBaseResponse +} + +// Status returns HTTPResponse.Status +func (r GetV1SourcesBySourceAndNameResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetV1SourcesBySourceAndNameResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostV1SourcesNewRedditResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r PostV1SourcesNewRedditResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostV1SourcesNewRedditResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostV1SourcesNewRssResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r PostV1SourcesNewRssResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostV1SourcesNewRssResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostV1SourcesNewTwitchResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r PostV1SourcesNewTwitchResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostV1SourcesNewTwitchResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostV1SourcesNewYoutubeResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r PostV1SourcesNewYoutubeResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostV1SourcesNewYoutubeResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetV1SourcesIdResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DomainSourcesResponse + JSON400 *DomainSourcesResponse + JSON500 *DomainSourcesResponse +} + +// Status returns HTTPResponse.Status +func (r GetV1SourcesIdResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetV1SourcesIdResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostV1SourcesIdResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r PostV1SourcesIdResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostV1SourcesIdResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostV1SourcesIdDisableResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r PostV1SourcesIdDisableResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostV1SourcesIdDisableResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostV1SourcesIdEnableResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r PostV1SourcesIdEnableResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostV1SourcesIdEnableResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostV1UsersLoginResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DomainLoginResponse + JSON400 *DomainLoginResponse + JSON500 *DomainLoginResponse +} + +// Status returns HTTPResponse.Status +func (r PostV1UsersLoginResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostV1UsersLoginResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostV1UsersRefreshSessionTokenResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DomainBaseResponse + JSON400 *DomainBaseResponse + JSON500 *DomainBaseResponse +} + +// Status returns HTTPResponse.Status +func (r PostV1UsersRefreshSessionTokenResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostV1UsersRefreshSessionTokenResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostV1UsersRefreshTokenResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r PostV1UsersRefreshTokenResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostV1UsersRefreshTokenResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostV1UsersRegisterResponse struct { + Body []byte + HTTPResponse *http.Response + JSON201 *DomainBaseResponse + JSON400 *DomainBaseResponse + JSON500 *DomainBaseResponse +} + +// Status returns HTTPResponse.Status +func (r PostV1UsersRegisterResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostV1UsersRegisterResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostV1UsersScopesAddResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DomainBaseResponse + JSON400 *DomainBaseResponse + JSON500 *DomainBaseResponse +} + +// Status returns HTTPResponse.Status +func (r PostV1UsersScopesAddResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostV1UsersScopesAddResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type PostV1UsersScopesRemoveResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DomainBaseResponse + JSON400 *DomainBaseResponse + JSON500 *DomainBaseResponse +} + +// Status returns HTTPResponse.Status +func (r PostV1UsersScopesRemoveResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r PostV1UsersScopesRemoveResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// GetV1ArticlesWithResponse request returning *GetV1ArticlesResponse +func (c *ClientWithResponses) GetV1ArticlesWithResponse(ctx context.Context, params *GetV1ArticlesParams, reqEditors ...RequestEditorFn) (*GetV1ArticlesResponse, error) { + rsp, err := c.GetV1Articles(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetV1ArticlesResponse(rsp) +} + +// GetV1ArticlesBySourceIdWithResponse request returning *GetV1ArticlesBySourceIdResponse +func (c *ClientWithResponses) GetV1ArticlesBySourceIdWithResponse(ctx context.Context, id string, params *GetV1ArticlesBySourceIdParams, reqEditors ...RequestEditorFn) (*GetV1ArticlesBySourceIdResponse, error) { + rsp, err := c.GetV1ArticlesBySourceId(ctx, id, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetV1ArticlesBySourceIdResponse(rsp) +} + +// GetV1ArticlesIdWithResponse request returning *GetV1ArticlesIdResponse +func (c *ClientWithResponses) GetV1ArticlesIdWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetV1ArticlesIdResponse, error) { + rsp, err := c.GetV1ArticlesId(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetV1ArticlesIdResponse(rsp) +} + +// GetV1ArticlesIdDetailsWithResponse request returning *GetV1ArticlesIdDetailsResponse +func (c *ClientWithResponses) GetV1ArticlesIdDetailsWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetV1ArticlesIdDetailsResponse, error) { + rsp, err := c.GetV1ArticlesIdDetails(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetV1ArticlesIdDetailsResponse(rsp) +} + +// GetV1DiscordWebhooksWithResponse request returning *GetV1DiscordWebhooksResponse +func (c *ClientWithResponses) GetV1DiscordWebhooksWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetV1DiscordWebhooksResponse, error) { + rsp, err := c.GetV1DiscordWebhooks(ctx, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetV1DiscordWebhooksResponse(rsp) +} + +// GetV1DiscordWebhooksByServerAndChannelWithResponse request returning *GetV1DiscordWebhooksByServerAndChannelResponse +func (c *ClientWithResponses) GetV1DiscordWebhooksByServerAndChannelWithResponse(ctx context.Context, params *GetV1DiscordWebhooksByServerAndChannelParams, reqEditors ...RequestEditorFn) (*GetV1DiscordWebhooksByServerAndChannelResponse, error) { + rsp, err := c.GetV1DiscordWebhooksByServerAndChannel(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetV1DiscordWebhooksByServerAndChannelResponse(rsp) +} + +// PostV1DiscordWebhooksNewWithResponse request returning *PostV1DiscordWebhooksNewResponse +func (c *ClientWithResponses) PostV1DiscordWebhooksNewWithResponse(ctx context.Context, params *PostV1DiscordWebhooksNewParams, reqEditors ...RequestEditorFn) (*PostV1DiscordWebhooksNewResponse, error) { + rsp, err := c.PostV1DiscordWebhooksNew(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostV1DiscordWebhooksNewResponse(rsp) +} + +// DeleteV1DiscordWebhooksIdWithResponse request returning *DeleteV1DiscordWebhooksIdResponse +func (c *ClientWithResponses) DeleteV1DiscordWebhooksIdWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteV1DiscordWebhooksIdResponse, error) { + rsp, err := c.DeleteV1DiscordWebhooksId(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParseDeleteV1DiscordWebhooksIdResponse(rsp) +} + +// GetV1DiscordWebhooksIdWithResponse request returning *GetV1DiscordWebhooksIdResponse +func (c *ClientWithResponses) GetV1DiscordWebhooksIdWithResponse(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*GetV1DiscordWebhooksIdResponse, error) { + rsp, err := c.GetV1DiscordWebhooksId(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetV1DiscordWebhooksIdResponse(rsp) +} + +// PostV1DiscordWebhooksIdDisableWithResponse request returning *PostV1DiscordWebhooksIdDisableResponse +func (c *ClientWithResponses) PostV1DiscordWebhooksIdDisableWithResponse(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*PostV1DiscordWebhooksIdDisableResponse, error) { + rsp, err := c.PostV1DiscordWebhooksIdDisable(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostV1DiscordWebhooksIdDisableResponse(rsp) +} + +// PostV1DiscordWebhooksIdEnableWithResponse request returning *PostV1DiscordWebhooksIdEnableResponse +func (c *ClientWithResponses) PostV1DiscordWebhooksIdEnableWithResponse(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*PostV1DiscordWebhooksIdEnableResponse, error) { + rsp, err := c.PostV1DiscordWebhooksIdEnable(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostV1DiscordWebhooksIdEnableResponse(rsp) +} + +// GetV1SourcesWithResponse request returning *GetV1SourcesResponse +func (c *ClientWithResponses) GetV1SourcesWithResponse(ctx context.Context, params *GetV1SourcesParams, reqEditors ...RequestEditorFn) (*GetV1SourcesResponse, error) { + rsp, err := c.GetV1Sources(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetV1SourcesResponse(rsp) +} + +// GetV1SourcesBySourceWithResponse request returning *GetV1SourcesBySourceResponse +func (c *ClientWithResponses) GetV1SourcesBySourceWithResponse(ctx context.Context, params *GetV1SourcesBySourceParams, reqEditors ...RequestEditorFn) (*GetV1SourcesBySourceResponse, error) { + rsp, err := c.GetV1SourcesBySource(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetV1SourcesBySourceResponse(rsp) +} + +// GetV1SourcesBySourceAndNameWithResponse request returning *GetV1SourcesBySourceAndNameResponse +func (c *ClientWithResponses) GetV1SourcesBySourceAndNameWithResponse(ctx context.Context, params *GetV1SourcesBySourceAndNameParams, reqEditors ...RequestEditorFn) (*GetV1SourcesBySourceAndNameResponse, error) { + rsp, err := c.GetV1SourcesBySourceAndName(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetV1SourcesBySourceAndNameResponse(rsp) +} + +// PostV1SourcesNewRedditWithResponse request returning *PostV1SourcesNewRedditResponse +func (c *ClientWithResponses) PostV1SourcesNewRedditWithResponse(ctx context.Context, params *PostV1SourcesNewRedditParams, reqEditors ...RequestEditorFn) (*PostV1SourcesNewRedditResponse, error) { + rsp, err := c.PostV1SourcesNewReddit(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostV1SourcesNewRedditResponse(rsp) +} + +// PostV1SourcesNewRssWithBodyWithResponse request with arbitrary body returning *PostV1SourcesNewRssResponse +func (c *ClientWithResponses) PostV1SourcesNewRssWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostV1SourcesNewRssResponse, error) { + rsp, err := c.PostV1SourcesNewRssWithBody(ctx, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostV1SourcesNewRssResponse(rsp) +} + +// PostV1SourcesNewTwitchWithResponse request returning *PostV1SourcesNewTwitchResponse +func (c *ClientWithResponses) PostV1SourcesNewTwitchWithResponse(ctx context.Context, params *PostV1SourcesNewTwitchParams, reqEditors ...RequestEditorFn) (*PostV1SourcesNewTwitchResponse, error) { + rsp, err := c.PostV1SourcesNewTwitch(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostV1SourcesNewTwitchResponse(rsp) +} + +// PostV1SourcesNewYoutubeWithResponse request returning *PostV1SourcesNewYoutubeResponse +func (c *ClientWithResponses) PostV1SourcesNewYoutubeWithResponse(ctx context.Context, params *PostV1SourcesNewYoutubeParams, reqEditors ...RequestEditorFn) (*PostV1SourcesNewYoutubeResponse, error) { + rsp, err := c.PostV1SourcesNewYoutube(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostV1SourcesNewYoutubeResponse(rsp) +} + +// GetV1SourcesIdWithResponse request returning *GetV1SourcesIdResponse +func (c *ClientWithResponses) GetV1SourcesIdWithResponse(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*GetV1SourcesIdResponse, error) { + rsp, err := c.GetV1SourcesId(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetV1SourcesIdResponse(rsp) +} + +// PostV1SourcesIdWithResponse request returning *PostV1SourcesIdResponse +func (c *ClientWithResponses) PostV1SourcesIdWithResponse(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*PostV1SourcesIdResponse, error) { + rsp, err := c.PostV1SourcesId(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostV1SourcesIdResponse(rsp) +} + +// PostV1SourcesIdDisableWithResponse request returning *PostV1SourcesIdDisableResponse +func (c *ClientWithResponses) PostV1SourcesIdDisableWithResponse(ctx context.Context, id int, reqEditors ...RequestEditorFn) (*PostV1SourcesIdDisableResponse, error) { + rsp, err := c.PostV1SourcesIdDisable(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostV1SourcesIdDisableResponse(rsp) +} + +// PostV1SourcesIdEnableWithResponse request returning *PostV1SourcesIdEnableResponse +func (c *ClientWithResponses) PostV1SourcesIdEnableWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*PostV1SourcesIdEnableResponse, error) { + rsp, err := c.PostV1SourcesIdEnable(ctx, id, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostV1SourcesIdEnableResponse(rsp) +} + +// PostV1UsersLoginWithBodyWithResponse request with arbitrary body returning *PostV1UsersLoginResponse +func (c *ClientWithResponses) PostV1UsersLoginWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostV1UsersLoginResponse, error) { + rsp, err := c.PostV1UsersLoginWithBody(ctx, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostV1UsersLoginResponse(rsp) +} + +// PostV1UsersRefreshSessionTokenWithResponse request returning *PostV1UsersRefreshSessionTokenResponse +func (c *ClientWithResponses) PostV1UsersRefreshSessionTokenWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostV1UsersRefreshSessionTokenResponse, error) { + rsp, err := c.PostV1UsersRefreshSessionToken(ctx, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostV1UsersRefreshSessionTokenResponse(rsp) +} + +// PostV1UsersRefreshTokenWithBodyWithResponse request with arbitrary body returning *PostV1UsersRefreshTokenResponse +func (c *ClientWithResponses) PostV1UsersRefreshTokenWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostV1UsersRefreshTokenResponse, error) { + rsp, err := c.PostV1UsersRefreshTokenWithBody(ctx, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostV1UsersRefreshTokenResponse(rsp) +} + +// PostV1UsersRegisterWithBodyWithResponse request with arbitrary body returning *PostV1UsersRegisterResponse +func (c *ClientWithResponses) PostV1UsersRegisterWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostV1UsersRegisterResponse, error) { + rsp, err := c.PostV1UsersRegisterWithBody(ctx, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostV1UsersRegisterResponse(rsp) +} + +// PostV1UsersScopesAddWithBodyWithResponse request with arbitrary body returning *PostV1UsersScopesAddResponse +func (c *ClientWithResponses) PostV1UsersScopesAddWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostV1UsersScopesAddResponse, error) { + rsp, err := c.PostV1UsersScopesAddWithBody(ctx, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostV1UsersScopesAddResponse(rsp) +} + +func (c *ClientWithResponses) PostV1UsersScopesAddWithResponse(ctx context.Context, body PostV1UsersScopesAddJSONRequestBody, reqEditors ...RequestEditorFn) (*PostV1UsersScopesAddResponse, error) { + rsp, err := c.PostV1UsersScopesAdd(ctx, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostV1UsersScopesAddResponse(rsp) +} + +// PostV1UsersScopesRemoveWithBodyWithResponse request with arbitrary body returning *PostV1UsersScopesRemoveResponse +func (c *ClientWithResponses) PostV1UsersScopesRemoveWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostV1UsersScopesRemoveResponse, error) { + rsp, err := c.PostV1UsersScopesRemoveWithBody(ctx, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostV1UsersScopesRemoveResponse(rsp) +} + +func (c *ClientWithResponses) PostV1UsersScopesRemoveWithResponse(ctx context.Context, body PostV1UsersScopesRemoveJSONRequestBody, reqEditors ...RequestEditorFn) (*PostV1UsersScopesRemoveResponse, error) { + rsp, err := c.PostV1UsersScopesRemove(ctx, body, reqEditors...) + if err != nil { + return nil, err + } + return ParsePostV1UsersScopesRemoveResponse(rsp) +} + +// ParseGetV1ArticlesResponse parses an HTTP response from a GetV1ArticlesWithResponse call +func ParseGetV1ArticlesResponse(rsp *http.Response) (*GetV1ArticlesResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetV1ArticlesResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DomainArticleResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParseGetV1ArticlesBySourceIdResponse parses an HTTP response from a GetV1ArticlesBySourceIdWithResponse call +func ParseGetV1ArticlesBySourceIdResponse(rsp *http.Response) (*GetV1ArticlesBySourceIdResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetV1ArticlesBySourceIdResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DomainArticleResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParseGetV1ArticlesIdResponse parses an HTTP response from a GetV1ArticlesIdWithResponse call +func ParseGetV1ArticlesIdResponse(rsp *http.Response) (*GetV1ArticlesIdResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetV1ArticlesIdResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DomainArticleResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParseGetV1ArticlesIdDetailsResponse parses an HTTP response from a GetV1ArticlesIdDetailsWithResponse call +func ParseGetV1ArticlesIdDetailsResponse(rsp *http.Response) (*GetV1ArticlesIdDetailsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetV1ArticlesIdDetailsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DomainArticleDetailedResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParseGetV1DiscordWebhooksResponse parses an HTTP response from a GetV1DiscordWebhooksWithResponse call +func ParseGetV1DiscordWebhooksResponse(rsp *http.Response) (*GetV1DiscordWebhooksResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetV1DiscordWebhooksResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DomainDiscordWebhookResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest DomainDiscordWebhookResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest DomainDiscordWebhookResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParseGetV1DiscordWebhooksByServerAndChannelResponse parses an HTTP response from a GetV1DiscordWebhooksByServerAndChannelWithResponse call +func ParseGetV1DiscordWebhooksByServerAndChannelResponse(rsp *http.Response) (*GetV1DiscordWebhooksByServerAndChannelResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetV1DiscordWebhooksByServerAndChannelResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DomainDiscordWebhookResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest DomainDiscordWebhookResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest DomainDiscordWebhookResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParsePostV1DiscordWebhooksNewResponse parses an HTTP response from a PostV1DiscordWebhooksNewWithResponse call +func ParsePostV1DiscordWebhooksNewResponse(rsp *http.Response) (*PostV1DiscordWebhooksNewResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostV1DiscordWebhooksNewResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParseDeleteV1DiscordWebhooksIdResponse parses an HTTP response from a DeleteV1DiscordWebhooksIdWithResponse call +func ParseDeleteV1DiscordWebhooksIdResponse(rsp *http.Response) (*DeleteV1DiscordWebhooksIdResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &DeleteV1DiscordWebhooksIdResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParseGetV1DiscordWebhooksIdResponse parses an HTTP response from a GetV1DiscordWebhooksIdWithResponse call +func ParseGetV1DiscordWebhooksIdResponse(rsp *http.Response) (*GetV1DiscordWebhooksIdResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetV1DiscordWebhooksIdResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DomainDiscordWebhookResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest DomainDiscordWebhookResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest DomainDiscordWebhookResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParsePostV1DiscordWebhooksIdDisableResponse parses an HTTP response from a PostV1DiscordWebhooksIdDisableWithResponse call +func ParsePostV1DiscordWebhooksIdDisableResponse(rsp *http.Response) (*PostV1DiscordWebhooksIdDisableResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostV1DiscordWebhooksIdDisableResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParsePostV1DiscordWebhooksIdEnableResponse parses an HTTP response from a PostV1DiscordWebhooksIdEnableWithResponse call +func ParsePostV1DiscordWebhooksIdEnableResponse(rsp *http.Response) (*PostV1DiscordWebhooksIdEnableResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostV1DiscordWebhooksIdEnableResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParseGetV1SourcesResponse parses an HTTP response from a GetV1SourcesWithResponse call +func ParseGetV1SourcesResponse(rsp *http.Response) (*GetV1SourcesResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetV1SourcesResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DomainSourcesResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest DomainSourcesResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + } + + return response, nil +} + +// ParseGetV1SourcesBySourceResponse parses an HTTP response from a GetV1SourcesBySourceWithResponse call +func ParseGetV1SourcesBySourceResponse(rsp *http.Response) (*GetV1SourcesBySourceResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetV1SourcesBySourceResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DomainSourcesResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest DomainSourcesResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest DomainSourcesResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParseGetV1SourcesBySourceAndNameResponse parses an HTTP response from a GetV1SourcesBySourceAndNameWithResponse call +func ParseGetV1SourcesBySourceAndNameResponse(rsp *http.Response) (*GetV1SourcesBySourceAndNameResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetV1SourcesBySourceAndNameResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DomainSourcesResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParsePostV1SourcesNewRedditResponse parses an HTTP response from a PostV1SourcesNewRedditWithResponse call +func ParsePostV1SourcesNewRedditResponse(rsp *http.Response) (*PostV1SourcesNewRedditResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostV1SourcesNewRedditResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParsePostV1SourcesNewRssResponse parses an HTTP response from a PostV1SourcesNewRssWithResponse call +func ParsePostV1SourcesNewRssResponse(rsp *http.Response) (*PostV1SourcesNewRssResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostV1SourcesNewRssResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParsePostV1SourcesNewTwitchResponse parses an HTTP response from a PostV1SourcesNewTwitchWithResponse call +func ParsePostV1SourcesNewTwitchResponse(rsp *http.Response) (*PostV1SourcesNewTwitchResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostV1SourcesNewTwitchResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParsePostV1SourcesNewYoutubeResponse parses an HTTP response from a PostV1SourcesNewYoutubeWithResponse call +func ParsePostV1SourcesNewYoutubeResponse(rsp *http.Response) (*PostV1SourcesNewYoutubeResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostV1SourcesNewYoutubeResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParseGetV1SourcesIdResponse parses an HTTP response from a GetV1SourcesIdWithResponse call +func ParseGetV1SourcesIdResponse(rsp *http.Response) (*GetV1SourcesIdResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetV1SourcesIdResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DomainSourcesResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest DomainSourcesResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest DomainSourcesResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParsePostV1SourcesIdResponse parses an HTTP response from a PostV1SourcesIdWithResponse call +func ParsePostV1SourcesIdResponse(rsp *http.Response) (*PostV1SourcesIdResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostV1SourcesIdResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParsePostV1SourcesIdDisableResponse parses an HTTP response from a PostV1SourcesIdDisableWithResponse call +func ParsePostV1SourcesIdDisableResponse(rsp *http.Response) (*PostV1SourcesIdDisableResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostV1SourcesIdDisableResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParsePostV1SourcesIdEnableResponse parses an HTTP response from a PostV1SourcesIdEnableWithResponse call +func ParsePostV1SourcesIdEnableResponse(rsp *http.Response) (*PostV1SourcesIdEnableResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostV1SourcesIdEnableResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParsePostV1UsersLoginResponse parses an HTTP response from a PostV1UsersLoginWithResponse call +func ParsePostV1UsersLoginResponse(rsp *http.Response) (*PostV1UsersLoginResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostV1UsersLoginResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DomainLoginResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest DomainLoginResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest DomainLoginResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParsePostV1UsersRefreshSessionTokenResponse parses an HTTP response from a PostV1UsersRefreshSessionTokenWithResponse call +func ParsePostV1UsersRefreshSessionTokenResponse(rsp *http.Response) (*PostV1UsersRefreshSessionTokenResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostV1UsersRefreshSessionTokenResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParsePostV1UsersRefreshTokenResponse parses an HTTP response from a PostV1UsersRefreshTokenWithResponse call +func ParsePostV1UsersRefreshTokenResponse(rsp *http.Response) (*PostV1UsersRefreshTokenResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostV1UsersRefreshTokenResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParsePostV1UsersRegisterResponse parses an HTTP response from a PostV1UsersRegisterWithResponse call +func ParsePostV1UsersRegisterResponse(rsp *http.Response) (*PostV1UsersRegisterResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostV1UsersRegisterResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON201 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParsePostV1UsersScopesAddResponse parses an HTTP response from a PostV1UsersScopesAddWithResponse call +func ParsePostV1UsersScopesAddResponse(rsp *http.Response) (*PostV1UsersScopesAddResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostV1UsersScopesAddResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParsePostV1UsersScopesRemoveResponse parses an HTTP response from a PostV1UsersScopesRemoveWithResponse call +func ParsePostV1UsersScopesRemoveResponse(rsp *http.Response) (*PostV1UsersScopesRemoveResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &PostV1UsersScopesRemoveResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest DomainBaseResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} diff --git a/api/client.yaml b/api/client.yaml new file mode 100644 index 0000000..2c1480a --- /dev/null +++ b/api/client.yaml @@ -0,0 +1,6 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/deepmap/oapi-codegen/HEAD/configuration-schema.json +package: api +output: api.gen.go +generate: + models: true + client: true \ No newline at end of file diff --git a/makefile b/makefile index ad19d77..b65e76a 100644 --- a/makefile +++ b/makefile @@ -19,8 +19,13 @@ migrate-dev-down: ## revert sql migrations to dev db goose -dir "./internal/database/migrations" sqlite3 ./cmd/newsbot.db down swag: ## Generates the swagger documentation with the swag tool - ~/go/bin/swag f + ~/go/bin/swag f -g cmd/server.go ~/go/bin/swag init -g cmd/server.go + go run tools/swaggertoopenapi/main.go + oapi-codegen -config api/client.yaml docs/openapi.json + mv api.gen.go api/ -gensql: ## Generates SQL code with sqlc - sqlc generate \ No newline at end of file +install-tools: ## Installs the required tools for this project + go install github.com/swaggo/swag/cmd/swag@v1.8.1 + go install github.com/pressly/goose/v3/cmd/goose@latest + go install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v2.3.0