go-kimai/client/expense/expense_client.go

331 lines
12 KiB
Go
Raw Normal View History

2023-01-14 14:14:06 +00:00
// Code generated by go-swagger; DO NOT EDIT.
package expense
// 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 expense API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for expense 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 {
DeleteAPIExpensesID(params *DeleteAPIExpensesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPIExpensesIDNoContent, error)
GetAPIExpenses(params *GetAPIExpensesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIExpensesOK, error)
GetAPIExpensesID(params *GetAPIExpensesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIExpensesIDOK, error)
PatchAPIExpensesID(params *PatchAPIExpensesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIExpensesIDOK, error)
PatchAPIExpensesIDDuplicate(params *PatchAPIExpensesIDDuplicateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIExpensesIDDuplicateOK, error)
PatchAPIExpensesIDMeta(params *PatchAPIExpensesIDMetaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIExpensesIDMetaOK, error)
PostAPIExpenses(params *PostAPIExpensesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIExpensesOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
DeleteAPIExpensesID deletes an existing expense record
*/
func (a *Client) DeleteAPIExpensesID(params *DeleteAPIExpensesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPIExpensesIDNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteAPIExpensesIDParams()
}
op := &runtime.ClientOperation{
ID: "DeleteAPIExpensesID",
Method: "DELETE",
PathPattern: "/api/expenses/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &DeleteAPIExpensesIDReader{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.(*DeleteAPIExpensesIDNoContent)
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 DeleteAPIExpensesID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPIExpenses returns a collection of expenses
*/
func (a *Client) GetAPIExpenses(params *GetAPIExpensesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIExpensesOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIExpensesParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIExpenses",
Method: "GET",
PathPattern: "/api/expenses",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIExpensesReader{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.(*GetAPIExpensesOK)
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 GetAPIExpenses: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPIExpensesID returns one expense
*/
func (a *Client) GetAPIExpensesID(params *GetAPIExpensesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIExpensesIDOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIExpensesIDParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIExpensesID",
Method: "GET",
PathPattern: "/api/expenses/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIExpensesIDReader{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.(*GetAPIExpensesIDOK)
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 GetAPIExpensesID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPIExpensesID updates an existing expense
Update an existing expense, you can pass all or just a subset of all attributes
*/
func (a *Client) PatchAPIExpensesID(params *PatchAPIExpensesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIExpensesIDOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPIExpensesIDParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPIExpensesID",
Method: "PATCH",
PathPattern: "/api/expenses/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPIExpensesIDReader{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.(*PatchAPIExpensesIDOK)
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 PatchAPIExpensesID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPIExpensesIDDuplicate duplicates an existing expense record
*/
func (a *Client) PatchAPIExpensesIDDuplicate(params *PatchAPIExpensesIDDuplicateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIExpensesIDDuplicateOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPIExpensesIDDuplicateParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPIExpensesIDDuplicate",
Method: "PATCH",
PathPattern: "/api/expenses/{id}/duplicate",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPIExpensesIDDuplicateReader{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.(*PatchAPIExpensesIDDuplicateOK)
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 PatchAPIExpensesIDDuplicate: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPIExpensesIDMeta sets the value of a meta field for an existing expense
*/
func (a *Client) PatchAPIExpensesIDMeta(params *PatchAPIExpensesIDMetaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIExpensesIDMetaOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPIExpensesIDMetaParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPIExpensesIDMeta",
Method: "PATCH",
PathPattern: "/api/expenses/{id}/meta",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPIExpensesIDMetaReader{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.(*PatchAPIExpensesIDMetaOK)
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 PatchAPIExpensesIDMeta: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PostAPIExpenses creates a new expense
Creates a new expense and returns it afterwards
*/
func (a *Client) PostAPIExpenses(params *PostAPIExpensesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIExpensesOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPostAPIExpensesParams()
}
op := &runtime.ClientOperation{
ID: "PostAPIExpenses",
Method: "POST",
PathPattern: "/api/expenses",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PostAPIExpensesReader{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.(*PostAPIExpensesOK)
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 PostAPIExpenses: 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
}