This commit is contained in:
430
client/lists/lists_client.go
Normal file
430
client/lists/lists_client.go
Normal file
@ -0,0 +1,430 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package lists
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
httptransport "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// New creates a new lists API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
// New creates a new lists API client with basic auth credentials.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - user: user for basic authentication header.
|
||||
// - password: password for basic authentication header.
|
||||
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
// New creates a new lists API client with a bearer token for authentication.
|
||||
// It takes the following parameters:
|
||||
// - host: http host (github.com).
|
||||
// - basePath: any base path for the API client ("/v1", "/v3").
|
||||
// - scheme: http scheme ("http", "https").
|
||||
// - bearerToken: bearer token for Bearer authentication header.
|
||||
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
|
||||
transport := httptransport.New(host, basePath, []string{scheme})
|
||||
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
|
||||
return &Client{transport: transport, formats: strfmt.Default}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for lists API
|
||||
*/
|
||||
type Client struct {
|
||||
transport runtime.ClientTransport
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ClientOption may be used to customize the behavior of Client methods.
|
||||
type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// This client is generated with a few options you might find useful for your swagger spec.
|
||||
//
|
||||
// Feel free to add you own set of options.
|
||||
|
||||
// WithContentType allows the client to force the Content-Type header
|
||||
// to negotiate a specific Consumer from the server.
|
||||
//
|
||||
// You may use this option to set arbitrary extensions to your MIME media type.
|
||||
func WithContentType(mime string) ClientOption {
|
||||
return func(r *runtime.ClientOperation) {
|
||||
r.ConsumesMediaTypes = []string{mime}
|
||||
}
|
||||
}
|
||||
|
||||
// WithContentTypeApplicationJSON sets the Content-Type header to "application/json".
|
||||
func WithContentTypeApplicationJSON(r *runtime.ClientOperation) {
|
||||
r.ConsumesMediaTypes = []string{"application/json"}
|
||||
}
|
||||
|
||||
// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded".
|
||||
func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) {
|
||||
r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"}
|
||||
}
|
||||
|
||||
// WithContentTypeApplicationXML sets the Content-Type header to "application/xml".
|
||||
func WithContentTypeApplicationXML(r *runtime.ClientOperation) {
|
||||
r.ConsumesMediaTypes = []string{"application/xml"}
|
||||
}
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
AddListAccounts(params *AddListAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AddListAccountsOK, error)
|
||||
|
||||
List(params *ListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOK, error)
|
||||
|
||||
ListAccounts(params *ListAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListAccountsOK, error)
|
||||
|
||||
ListCreate(params *ListCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListCreateOK, error)
|
||||
|
||||
ListDelete(params *ListDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListDeleteOK, error)
|
||||
|
||||
ListUpdate(params *ListUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListUpdateOK, error)
|
||||
|
||||
Lists(params *ListsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListsOK, error)
|
||||
|
||||
RemoveListAccounts(params *RemoveListAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RemoveListAccountsOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
AddListAccounts adds one or more accounts to the given list
|
||||
*/
|
||||
func (a *Client) AddListAccounts(params *AddListAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AddListAccountsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewAddListAccountsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "addListAccounts",
|
||||
Method: "POST",
|
||||
PathPattern: "/api/v1/lists/{id}/accounts",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"},
|
||||
Schemes: []string{"http", "https"},
|
||||
Params: params,
|
||||
Reader: &AddListAccountsReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*AddListAccountsOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for addListAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
List gets a single list with the given ID
|
||||
*/
|
||||
func (a *Client) List(params *ListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "list",
|
||||
Method: "GET",
|
||||
PathPattern: "/api/v1/lists/{id}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http", "https"},
|
||||
Params: params,
|
||||
Reader: &ListReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ListOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for list: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
ListAccounts pages through accounts in this list
|
||||
|
||||
The returned Link header can be used to generate the previous and next queries when scrolling up or down a timeline.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
<https://example.org/api/v1/list/01H0W619198FX7J54NF7EH1NG2/accounts?limit=20&max_id=01FC3GSQ8A3MMJ43BPZSGEG29M>; rel="next", <https://example.org/api/v1/list/01H0W619198FX7J54NF7EH1NG2/accounts?limit=20&min_id=01FC3KJW2GYXSDDRA6RWNDM46M>; rel="prev"
|
||||
````
|
||||
*/
|
||||
func (a *Client) ListAccounts(params *ListAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListAccountsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListAccountsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "listAccounts",
|
||||
Method: "GET",
|
||||
PathPattern: "/api/v1/lists/{id}/accounts",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http", "https"},
|
||||
Params: params,
|
||||
Reader: &ListAccountsReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ListAccountsOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for listAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
ListCreate creates a new list
|
||||
*/
|
||||
func (a *Client) ListCreate(params *ListCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListCreateOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListCreateParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "listCreate",
|
||||
Method: "POST",
|
||||
PathPattern: "/api/v1/lists",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"},
|
||||
Schemes: []string{"http", "https"},
|
||||
Params: params,
|
||||
Reader: &ListCreateReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ListCreateOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for listCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
ListDelete deletes a single list with the given ID
|
||||
*/
|
||||
func (a *Client) ListDelete(params *ListDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListDeleteOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListDeleteParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "listDelete",
|
||||
Method: "DELETE",
|
||||
PathPattern: "/api/v1/lists/{id}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http", "https"},
|
||||
Params: params,
|
||||
Reader: &ListDeleteReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ListDeleteOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for listDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
ListUpdate updates an existing list
|
||||
*/
|
||||
func (a *Client) ListUpdate(params *ListUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListUpdateOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListUpdateParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "listUpdate",
|
||||
Method: "PUT",
|
||||
PathPattern: "/api/v1/lists/{id}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"},
|
||||
Schemes: []string{"http", "https"},
|
||||
Params: params,
|
||||
Reader: &ListUpdateReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ListUpdateOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for listUpdate: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
Lists gets all lists for owned by authorized user
|
||||
*/
|
||||
func (a *Client) Lists(params *ListsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "lists",
|
||||
Method: "GET",
|
||||
PathPattern: "/api/v1/lists",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http", "https"},
|
||||
Params: params,
|
||||
Reader: &ListsReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ListsOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for lists: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
RemoveListAccounts removes one or more accounts from the given list
|
||||
*/
|
||||
func (a *Client) RemoveListAccounts(params *RemoveListAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RemoveListAccountsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewRemoveListAccountsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "removeListAccounts",
|
||||
Method: "DELETE",
|
||||
PathPattern: "/api/v1/lists/{id}/accounts",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"},
|
||||
Schemes: []string{"http", "https"},
|
||||
Params: params,
|
||||
Reader: &RemoveListAccountsReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*RemoveListAccountsOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
|
||||
msg := fmt.Sprintf("unexpected success response for removeListAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client
|
||||
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||
a.transport = transport
|
||||
}
|
Reference in New Issue
Block a user