go-kimai/client/activity/activity_client.go

372 lines
13 KiB
Go
Raw Normal View History

2023-01-14 14:14:06 +00:00
// Code generated by go-swagger; DO NOT EDIT.
package activity
// 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 activity API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for activity 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 {
DeleteAPIActivitiesIDRatesRateID(params *DeleteAPIActivitiesIDRatesRateIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPIActivitiesIDRatesRateIDNoContent, error)
GetAPIActivities(params *GetAPIActivitiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIActivitiesOK, error)
GetAPIActivitiesID(params *GetAPIActivitiesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIActivitiesIDOK, error)
GetAPIActivitiesIDRates(params *GetAPIActivitiesIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIActivitiesIDRatesOK, error)
PatchAPIActivitiesID(params *PatchAPIActivitiesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIActivitiesIDOK, error)
PatchAPIActivitiesIDMeta(params *PatchAPIActivitiesIDMetaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIActivitiesIDMetaOK, error)
PostAPIActivities(params *PostAPIActivitiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIActivitiesOK, error)
PostAPIActivitiesIDRates(params *PostAPIActivitiesIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIActivitiesIDRatesOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
DeleteAPIActivitiesIDRatesRateID deletes one rate for an activity
*/
func (a *Client) DeleteAPIActivitiesIDRatesRateID(params *DeleteAPIActivitiesIDRatesRateIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPIActivitiesIDRatesRateIDNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteAPIActivitiesIDRatesRateIDParams()
}
op := &runtime.ClientOperation{
ID: "DeleteAPIActivitiesIDRatesRateID",
Method: "DELETE",
PathPattern: "/api/activities/{id}/rates/{rateId}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &DeleteAPIActivitiesIDRatesRateIDReader{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.(*DeleteAPIActivitiesIDRatesRateIDNoContent)
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 DeleteAPIActivitiesIDRatesRateID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPIActivities returns a collection of activities
*/
func (a *Client) GetAPIActivities(params *GetAPIActivitiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIActivitiesOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIActivitiesParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIActivities",
Method: "GET",
PathPattern: "/api/activities",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIActivitiesReader{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.(*GetAPIActivitiesOK)
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 GetAPIActivities: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPIActivitiesID returns one activity
*/
func (a *Client) GetAPIActivitiesID(params *GetAPIActivitiesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIActivitiesIDOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIActivitiesIDParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIActivitiesID",
Method: "GET",
PathPattern: "/api/activities/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIActivitiesIDReader{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.(*GetAPIActivitiesIDOK)
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 GetAPIActivitiesID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPIActivitiesIDRates returns a collection of all rates for one activity
*/
func (a *Client) GetAPIActivitiesIDRates(params *GetAPIActivitiesIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIActivitiesIDRatesOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIActivitiesIDRatesParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIActivitiesIDRates",
Method: "GET",
PathPattern: "/api/activities/{id}/rates",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIActivitiesIDRatesReader{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.(*GetAPIActivitiesIDRatesOK)
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 GetAPIActivitiesIDRates: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPIActivitiesID updates an existing activity
Update an existing activity, you can pass all or just a subset of all attributes
*/
func (a *Client) PatchAPIActivitiesID(params *PatchAPIActivitiesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIActivitiesIDOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPIActivitiesIDParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPIActivitiesID",
Method: "PATCH",
PathPattern: "/api/activities/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPIActivitiesIDReader{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.(*PatchAPIActivitiesIDOK)
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 PatchAPIActivitiesID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPIActivitiesIDMeta sets the value of a meta field for an existing activity
*/
func (a *Client) PatchAPIActivitiesIDMeta(params *PatchAPIActivitiesIDMetaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIActivitiesIDMetaOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPIActivitiesIDMetaParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPIActivitiesIDMeta",
Method: "PATCH",
PathPattern: "/api/activities/{id}/meta",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPIActivitiesIDMetaReader{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.(*PatchAPIActivitiesIDMetaOK)
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 PatchAPIActivitiesIDMeta: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PostAPIActivities creates a new activity
Creates a new activity and returns it afterwards
*/
func (a *Client) PostAPIActivities(params *PostAPIActivitiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIActivitiesOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPostAPIActivitiesParams()
}
op := &runtime.ClientOperation{
ID: "PostAPIActivities",
Method: "POST",
PathPattern: "/api/activities",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PostAPIActivitiesReader{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.(*PostAPIActivitiesOK)
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 PostAPIActivities: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PostAPIActivitiesIDRates adds a new rate to an activity
*/
func (a *Client) PostAPIActivitiesIDRates(params *PostAPIActivitiesIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIActivitiesIDRatesOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPostAPIActivitiesIDRatesParams()
}
op := &runtime.ClientOperation{
ID: "PostAPIActivitiesIDRates",
Method: "POST",
PathPattern: "/api/activities/{id}/rates",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PostAPIActivitiesIDRatesReader{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.(*PostAPIActivitiesIDRatesOK)
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 PostAPIActivitiesIDRates: 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
}