go-kimai/client/default_operations/default_operations_client.go

238 lines
7.8 KiB
Go
Raw Normal View History

2023-01-14 14:14:06 +00:00
// Code generated by go-swagger; DO NOT EDIT.
package default_operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// New creates a new default operations API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for default operations API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods
type ClientService interface {
GetAPIConfigI18n(params *GetAPIConfigI18nParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIConfigI18nOK, error)
GetAPIConfigTimesheet(params *GetAPIConfigTimesheetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIConfigTimesheetOK, error)
GetAPIPing(params *GetAPIPingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error
GetAPIPlugins(params *GetAPIPluginsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIPluginsOK, error)
GetAPIVersion(params *GetAPIVersionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIVersionOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
GetAPIConfigI18n returns the user specific locale configuration
*/
func (a *Client) GetAPIConfigI18n(params *GetAPIConfigI18nParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIConfigI18nOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIConfigI18nParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIConfigI18n",
Method: "GET",
PathPattern: "/api/config/i18n",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIConfigI18nReader{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.(*GetAPIConfigI18nOK)
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 GetAPIConfigI18n: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPIConfigTimesheet returns the timesheet configuration
*/
func (a *Client) GetAPIConfigTimesheet(params *GetAPIConfigTimesheetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIConfigTimesheetOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIConfigTimesheetParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIConfigTimesheet",
Method: "GET",
PathPattern: "/api/config/timesheet",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIConfigTimesheetReader{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.(*GetAPIConfigTimesheetOK)
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 GetAPIConfigTimesheet: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPIPing as testing route for the API
*/
func (a *Client) GetAPIPing(params *GetAPIPingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIPingParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIPing",
Method: "GET",
PathPattern: "/api/ping",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIPingReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
_, err := a.transport.Submit(op)
if err != nil {
return err
}
return nil
}
/*
GetAPIPlugins returns information about installed plugins
*/
func (a *Client) GetAPIPlugins(params *GetAPIPluginsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIPluginsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIPluginsParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIPlugins",
Method: "GET",
PathPattern: "/api/plugins",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIPluginsReader{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.(*GetAPIPluginsOK)
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 GetAPIPlugins: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPIVersion returns information about the kimai release
*/
func (a *Client) GetAPIVersion(params *GetAPIVersionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIVersionOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIVersionParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIVersion",
Method: "GET",
PathPattern: "/api/version",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIVersionReader{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.(*GetAPIVersionOK)
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 GetAPIVersion: 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
}