feat: init

This commit is contained in:
decentral1se
2023-01-14 15:14:06 +01:00
commit f44e2acbaf
245 changed files with 44079 additions and 0 deletions

View File

@ -0,0 +1,152 @@
// 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 (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// NewGetAPIKiosksIDParams creates a new GetAPIKiosksIDParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetAPIKiosksIDParams() *GetAPIKiosksIDParams {
return &GetAPIKiosksIDParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAPIKiosksIDParamsWithTimeout creates a new GetAPIKiosksIDParams object
// with the ability to set a timeout on a request.
func NewGetAPIKiosksIDParamsWithTimeout(timeout time.Duration) *GetAPIKiosksIDParams {
return &GetAPIKiosksIDParams{
timeout: timeout,
}
}
// NewGetAPIKiosksIDParamsWithContext creates a new GetAPIKiosksIDParams object
// with the ability to set a context for a request.
func NewGetAPIKiosksIDParamsWithContext(ctx context.Context) *GetAPIKiosksIDParams {
return &GetAPIKiosksIDParams{
Context: ctx,
}
}
// NewGetAPIKiosksIDParamsWithHTTPClient creates a new GetAPIKiosksIDParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetAPIKiosksIDParamsWithHTTPClient(client *http.Client) *GetAPIKiosksIDParams {
return &GetAPIKiosksIDParams{
HTTPClient: client,
}
}
/*
GetAPIKiosksIDParams contains all the parameters to send to the API endpoint
for the get API kiosks ID operation.
Typically these are written to a http.Request.
*/
type GetAPIKiosksIDParams struct {
/* ID.
User ID to fetch
*/
ID int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get API kiosks ID params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPIKiosksIDParams) WithDefaults() *GetAPIKiosksIDParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get API kiosks ID params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPIKiosksIDParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get API kiosks ID params
func (o *GetAPIKiosksIDParams) WithTimeout(timeout time.Duration) *GetAPIKiosksIDParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get API kiosks ID params
func (o *GetAPIKiosksIDParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get API kiosks ID params
func (o *GetAPIKiosksIDParams) WithContext(ctx context.Context) *GetAPIKiosksIDParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get API kiosks ID params
func (o *GetAPIKiosksIDParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get API kiosks ID params
func (o *GetAPIKiosksIDParams) WithHTTPClient(client *http.Client) *GetAPIKiosksIDParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get API kiosks ID params
func (o *GetAPIKiosksIDParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the get API kiosks ID params
func (o *GetAPIKiosksIDParams) WithID(id int64) *GetAPIKiosksIDParams {
o.SetID(id)
return o
}
// SetID adds the id to the get API kiosks ID params
func (o *GetAPIKiosksIDParams) SetID(id int64) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *GetAPIKiosksIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param id
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,98 @@
// 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"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"decentral1se/go-kimai/models"
)
// GetAPIKiosksIDReader is a Reader for the GetAPIKiosksID structure.
type GetAPIKiosksIDReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAPIKiosksIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAPIKiosksIDOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewGetAPIKiosksIDOK creates a GetAPIKiosksIDOK with default headers values
func NewGetAPIKiosksIDOK() *GetAPIKiosksIDOK {
return &GetAPIKiosksIDOK{}
}
/*
GetAPIKiosksIDOK describes a response with status code 200, with default header values.
Returns one UserAuthCodes entity
*/
type GetAPIKiosksIDOK struct {
Payload *models.UserAuthCodes
}
// IsSuccess returns true when this get Api kiosks Id o k response has a 2xx status code
func (o *GetAPIKiosksIDOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get Api kiosks Id o k response has a 3xx status code
func (o *GetAPIKiosksIDOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get Api kiosks Id o k response has a 4xx status code
func (o *GetAPIKiosksIDOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get Api kiosks Id o k response has a 5xx status code
func (o *GetAPIKiosksIDOK) IsServerError() bool {
return false
}
// IsCode returns true when this get Api kiosks Id o k response a status code equal to that given
func (o *GetAPIKiosksIDOK) IsCode(code int) bool {
return code == 200
}
func (o *GetAPIKiosksIDOK) Error() string {
return fmt.Sprintf("[GET /api/kiosks/{id}][%d] getApiKiosksIdOK %+v", 200, o.Payload)
}
func (o *GetAPIKiosksIDOK) String() string {
return fmt.Sprintf("[GET /api/kiosks/{id}][%d] getApiKiosksIdOK %+v", 200, o.Payload)
}
func (o *GetAPIKiosksIDOK) GetPayload() *models.UserAuthCodes {
return o.Payload
}
func (o *GetAPIKiosksIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.UserAuthCodes)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@ -0,0 +1,229 @@
// 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 (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewGetAPIKiosksParams creates a new GetAPIKiosksParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetAPIKiosksParams() *GetAPIKiosksParams {
return &GetAPIKiosksParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAPIKiosksParamsWithTimeout creates a new GetAPIKiosksParams object
// with the ability to set a timeout on a request.
func NewGetAPIKiosksParamsWithTimeout(timeout time.Duration) *GetAPIKiosksParams {
return &GetAPIKiosksParams{
timeout: timeout,
}
}
// NewGetAPIKiosksParamsWithContext creates a new GetAPIKiosksParams object
// with the ability to set a context for a request.
func NewGetAPIKiosksParamsWithContext(ctx context.Context) *GetAPIKiosksParams {
return &GetAPIKiosksParams{
Context: ctx,
}
}
// NewGetAPIKiosksParamsWithHTTPClient creates a new GetAPIKiosksParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetAPIKiosksParamsWithHTTPClient(client *http.Client) *GetAPIKiosksParams {
return &GetAPIKiosksParams{
HTTPClient: client,
}
}
/*
GetAPIKiosksParams contains all the parameters to send to the API endpoint
for the get API kiosks operation.
Typically these are written to a http.Request.
*/
type GetAPIKiosksParams struct {
/* Order.
The result order. Allowed values: ASC, DESC (default: DESC)
*/
Order string
/* OrderBy.
The field by which results will be ordered. Allowed values: id, user, type, code (default: id)
*/
OrderBy string
/* Page.
The page to display, renders a 404 if not found (default: 1)
*/
Page string
/* Size.
The amount of entries for each page (default: 50)
*/
Size string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get API kiosks params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPIKiosksParams) WithDefaults() *GetAPIKiosksParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get API kiosks params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPIKiosksParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get API kiosks params
func (o *GetAPIKiosksParams) WithTimeout(timeout time.Duration) *GetAPIKiosksParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get API kiosks params
func (o *GetAPIKiosksParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get API kiosks params
func (o *GetAPIKiosksParams) WithContext(ctx context.Context) *GetAPIKiosksParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get API kiosks params
func (o *GetAPIKiosksParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get API kiosks params
func (o *GetAPIKiosksParams) WithHTTPClient(client *http.Client) *GetAPIKiosksParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get API kiosks params
func (o *GetAPIKiosksParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithOrder adds the order to the get API kiosks params
func (o *GetAPIKiosksParams) WithOrder(order string) *GetAPIKiosksParams {
o.SetOrder(order)
return o
}
// SetOrder adds the order to the get API kiosks params
func (o *GetAPIKiosksParams) SetOrder(order string) {
o.Order = order
}
// WithOrderBy adds the orderBy to the get API kiosks params
func (o *GetAPIKiosksParams) WithOrderBy(orderBy string) *GetAPIKiosksParams {
o.SetOrderBy(orderBy)
return o
}
// SetOrderBy adds the orderBy to the get API kiosks params
func (o *GetAPIKiosksParams) SetOrderBy(orderBy string) {
o.OrderBy = orderBy
}
// WithPage adds the page to the get API kiosks params
func (o *GetAPIKiosksParams) WithPage(page string) *GetAPIKiosksParams {
o.SetPage(page)
return o
}
// SetPage adds the page to the get API kiosks params
func (o *GetAPIKiosksParams) SetPage(page string) {
o.Page = page
}
// WithSize adds the size to the get API kiosks params
func (o *GetAPIKiosksParams) WithSize(size string) *GetAPIKiosksParams {
o.SetSize(size)
return o
}
// SetSize adds the size to the get API kiosks params
func (o *GetAPIKiosksParams) SetSize(size string) {
o.Size = size
}
// WriteToRequest writes these params to a swagger request
func (o *GetAPIKiosksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// query param order
qrOrder := o.Order
qOrder := qrOrder
if err := r.SetQueryParam("order", qOrder); err != nil {
return err
}
// query param orderBy
qrOrderBy := o.OrderBy
qOrderBy := qrOrderBy
if err := r.SetQueryParam("orderBy", qOrderBy); err != nil {
return err
}
// query param page
qrPage := o.Page
qPage := qrPage
if err := r.SetQueryParam("page", qPage); err != nil {
return err
}
// query param size
qrSize := o.Size
qSize := qrSize
if err := r.SetQueryParam("size", qSize); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,96 @@
// 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"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"decentral1se/go-kimai/models"
)
// GetAPIKiosksReader is a Reader for the GetAPIKiosks structure.
type GetAPIKiosksReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAPIKiosksReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAPIKiosksOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewGetAPIKiosksOK creates a GetAPIKiosksOK with default headers values
func NewGetAPIKiosksOK() *GetAPIKiosksOK {
return &GetAPIKiosksOK{}
}
/*
GetAPIKiosksOK describes a response with status code 200, with default header values.
Returns a collection of UserAuthCodes
*/
type GetAPIKiosksOK struct {
Payload []*models.UserAuthCodes
}
// IsSuccess returns true when this get Api kiosks o k response has a 2xx status code
func (o *GetAPIKiosksOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get Api kiosks o k response has a 3xx status code
func (o *GetAPIKiosksOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get Api kiosks o k response has a 4xx status code
func (o *GetAPIKiosksOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get Api kiosks o k response has a 5xx status code
func (o *GetAPIKiosksOK) IsServerError() bool {
return false
}
// IsCode returns true when this get Api kiosks o k response a status code equal to that given
func (o *GetAPIKiosksOK) IsCode(code int) bool {
return code == 200
}
func (o *GetAPIKiosksOK) Error() string {
return fmt.Sprintf("[GET /api/kiosks][%d] getApiKiosksOK %+v", 200, o.Payload)
}
func (o *GetAPIKiosksOK) String() string {
return fmt.Sprintf("[GET /api/kiosks][%d] getApiKiosksOK %+v", 200, o.Payload)
}
func (o *GetAPIKiosksOK) GetPayload() []*models.UserAuthCodes {
return o.Payload
}
func (o *GetAPIKiosksOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@ -0,0 +1,123 @@
// 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
}