go-kimai/client/kiosk/kiosk_client.go
2023-01-14 22:44:16 +01:00

124 lines
3.9 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package kiosk
// 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 kiosk API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for kiosk 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 {
GetAPIKiosks(params *GetAPIKiosksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIKiosksOK, error)
GetAPIKiosksID(params *GetAPIKiosksIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIKiosksIDOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
GetAPIKiosks returns a collection of user auth codes objects
*/
func (a *Client) GetAPIKiosks(params *GetAPIKiosksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIKiosksOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIKiosksParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIKiosks",
Method: "GET",
PathPattern: "/api/kiosks",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIKiosksReader{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.(*GetAPIKiosksOK)
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 GetAPIKiosks: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPIKiosksID returns one user auth codes entity
Creates the code for the configured default type (if not yet existing).
*/
func (a *Client) GetAPIKiosksID(params *GetAPIKiosksIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIKiosksIDOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIKiosksIDParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIKiosksID",
Method: "GET",
PathPattern: "/api/kiosks/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIKiosksIDReader{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.(*GetAPIKiosksIDOK)
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 GetAPIKiosksID: 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
}