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,156 @@
// Code generated by go-swagger; DO NOT EDIT.
package meta_field
// 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"
)
// NewGetAPIMetafieldsParams creates a new GetAPIMetafieldsParams 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 NewGetAPIMetafieldsParams() *GetAPIMetafieldsParams {
return &GetAPIMetafieldsParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAPIMetafieldsParamsWithTimeout creates a new GetAPIMetafieldsParams object
// with the ability to set a timeout on a request.
func NewGetAPIMetafieldsParamsWithTimeout(timeout time.Duration) *GetAPIMetafieldsParams {
return &GetAPIMetafieldsParams{
timeout: timeout,
}
}
// NewGetAPIMetafieldsParamsWithContext creates a new GetAPIMetafieldsParams object
// with the ability to set a context for a request.
func NewGetAPIMetafieldsParamsWithContext(ctx context.Context) *GetAPIMetafieldsParams {
return &GetAPIMetafieldsParams{
Context: ctx,
}
}
// NewGetAPIMetafieldsParamsWithHTTPClient creates a new GetAPIMetafieldsParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetAPIMetafieldsParamsWithHTTPClient(client *http.Client) *GetAPIMetafieldsParams {
return &GetAPIMetafieldsParams{
HTTPClient: client,
}
}
/*
GetAPIMetafieldsParams contains all the parameters to send to the API endpoint
for the get API metafields operation.
Typically these are written to a http.Request.
*/
type GetAPIMetafieldsParams struct {
/* Entity.
The type of object to fetch meta-fields for. Allowed values: timesheet, customer, project, activity, user, expense - returns all if not given (default: all)
Format: MetaFieldExternalType
*/
Entity string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get API metafields params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPIMetafieldsParams) WithDefaults() *GetAPIMetafieldsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get API metafields params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPIMetafieldsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get API metafields params
func (o *GetAPIMetafieldsParams) WithTimeout(timeout time.Duration) *GetAPIMetafieldsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get API metafields params
func (o *GetAPIMetafieldsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get API metafields params
func (o *GetAPIMetafieldsParams) WithContext(ctx context.Context) *GetAPIMetafieldsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get API metafields params
func (o *GetAPIMetafieldsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get API metafields params
func (o *GetAPIMetafieldsParams) WithHTTPClient(client *http.Client) *GetAPIMetafieldsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get API metafields params
func (o *GetAPIMetafieldsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithEntity adds the entity to the get API metafields params
func (o *GetAPIMetafieldsParams) WithEntity(entity string) *GetAPIMetafieldsParams {
o.SetEntity(entity)
return o
}
// SetEntity adds the entity to the get API metafields params
func (o *GetAPIMetafieldsParams) SetEntity(entity string) {
o.Entity = entity
}
// WriteToRequest writes these params to a swagger request
func (o *GetAPIMetafieldsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// query param entity
qrEntity := o.Entity
qEntity := qrEntity
if err := r.SetQueryParam("entity", qEntity); 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 meta_field
// 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"
)
// GetAPIMetafieldsReader is a Reader for the GetAPIMetafields structure.
type GetAPIMetafieldsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAPIMetafieldsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAPIMetafieldsOK()
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())
}
}
// NewGetAPIMetafieldsOK creates a GetAPIMetafieldsOK with default headers values
func NewGetAPIMetafieldsOK() *GetAPIMetafieldsOK {
return &GetAPIMetafieldsOK{}
}
/*
GetAPIMetafieldsOK describes a response with status code 200, with default header values.
Returns a collection of meta-fields
*/
type GetAPIMetafieldsOK struct {
Payload []*models.MetaFieldRule
}
// IsSuccess returns true when this get Api metafields o k response has a 2xx status code
func (o *GetAPIMetafieldsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get Api metafields o k response has a 3xx status code
func (o *GetAPIMetafieldsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get Api metafields o k response has a 4xx status code
func (o *GetAPIMetafieldsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get Api metafields o k response has a 5xx status code
func (o *GetAPIMetafieldsOK) IsServerError() bool {
return false
}
// IsCode returns true when this get Api metafields o k response a status code equal to that given
func (o *GetAPIMetafieldsOK) IsCode(code int) bool {
return code == 200
}
func (o *GetAPIMetafieldsOK) Error() string {
return fmt.Sprintf("[GET /api/metafields][%d] getApiMetafieldsOK %+v", 200, o.Payload)
}
func (o *GetAPIMetafieldsOK) String() string {
return fmt.Sprintf("[GET /api/metafields][%d] getApiMetafieldsOK %+v", 200, o.Payload)
}
func (o *GetAPIMetafieldsOK) GetPayload() []*models.MetaFieldRule {
return o.Payload
}
func (o *GetAPIMetafieldsOK) 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,80 @@
// Code generated by go-swagger; DO NOT EDIT.
package meta_field
// 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 meta field API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for meta field 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 {
GetAPIMetafields(params *GetAPIMetafieldsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIMetafieldsOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
GetAPIMetafields returns a collection of meta fields
*/
func (a *Client) GetAPIMetafields(params *GetAPIMetafieldsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIMetafieldsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIMetafieldsParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIMetafields",
Method: "GET",
PathPattern: "/api/metafields",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIMetafieldsReader{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.(*GetAPIMetafieldsOK)
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 GetAPIMetafields: 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
}