feat: init
This commit is contained in:
152
client/expense/delete_api_expenses_id_parameters.go
Normal file
152
client/expense/delete_api_expenses_id_parameters.go
Normal file
@ -0,0 +1,152 @@
|
||||
// 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 (
|
||||
"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"
|
||||
)
|
||||
|
||||
// NewDeleteAPIExpensesIDParams creates a new DeleteAPIExpensesIDParams 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 NewDeleteAPIExpensesIDParams() *DeleteAPIExpensesIDParams {
|
||||
return &DeleteAPIExpensesIDParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteAPIExpensesIDParamsWithTimeout creates a new DeleteAPIExpensesIDParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewDeleteAPIExpensesIDParamsWithTimeout(timeout time.Duration) *DeleteAPIExpensesIDParams {
|
||||
return &DeleteAPIExpensesIDParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteAPIExpensesIDParamsWithContext creates a new DeleteAPIExpensesIDParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewDeleteAPIExpensesIDParamsWithContext(ctx context.Context) *DeleteAPIExpensesIDParams {
|
||||
return &DeleteAPIExpensesIDParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteAPIExpensesIDParamsWithHTTPClient creates a new DeleteAPIExpensesIDParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewDeleteAPIExpensesIDParamsWithHTTPClient(client *http.Client) *DeleteAPIExpensesIDParams {
|
||||
return &DeleteAPIExpensesIDParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteAPIExpensesIDParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the delete API expenses ID operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type DeleteAPIExpensesIDParams struct {
|
||||
|
||||
/* ID.
|
||||
|
||||
Expense record ID to delete
|
||||
*/
|
||||
ID int64
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the delete API expenses ID params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteAPIExpensesIDParams) WithDefaults() *DeleteAPIExpensesIDParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the delete API expenses ID params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteAPIExpensesIDParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the delete API expenses ID params
|
||||
func (o *DeleteAPIExpensesIDParams) WithTimeout(timeout time.Duration) *DeleteAPIExpensesIDParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the delete API expenses ID params
|
||||
func (o *DeleteAPIExpensesIDParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the delete API expenses ID params
|
||||
func (o *DeleteAPIExpensesIDParams) WithContext(ctx context.Context) *DeleteAPIExpensesIDParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the delete API expenses ID params
|
||||
func (o *DeleteAPIExpensesIDParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the delete API expenses ID params
|
||||
func (o *DeleteAPIExpensesIDParams) WithHTTPClient(client *http.Client) *DeleteAPIExpensesIDParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the delete API expenses ID params
|
||||
func (o *DeleteAPIExpensesIDParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithID adds the id to the delete API expenses ID params
|
||||
func (o *DeleteAPIExpensesIDParams) WithID(id int64) *DeleteAPIExpensesIDParams {
|
||||
o.SetID(id)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetID adds the id to the delete API expenses ID params
|
||||
func (o *DeleteAPIExpensesIDParams) SetID(id int64) {
|
||||
o.ID = id
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *DeleteAPIExpensesIDParams) 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
|
||||
}
|
83
client/expense/delete_api_expenses_id_responses.go
Normal file
83
client/expense/delete_api_expenses_id_responses.go
Normal file
@ -0,0 +1,83 @@
|
||||
// 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"
|
||||
)
|
||||
|
||||
// DeleteAPIExpensesIDReader is a Reader for the DeleteAPIExpensesID structure.
|
||||
type DeleteAPIExpensesIDReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *DeleteAPIExpensesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 204:
|
||||
result := NewDeleteAPIExpensesIDNoContent()
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteAPIExpensesIDNoContent creates a DeleteAPIExpensesIDNoContent with default headers values
|
||||
func NewDeleteAPIExpensesIDNoContent() *DeleteAPIExpensesIDNoContent {
|
||||
return &DeleteAPIExpensesIDNoContent{}
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteAPIExpensesIDNoContent describes a response with status code 204, with default header values.
|
||||
|
||||
Delete one expense record
|
||||
*/
|
||||
type DeleteAPIExpensesIDNoContent struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this delete Api expenses Id no content response has a 2xx status code
|
||||
func (o *DeleteAPIExpensesIDNoContent) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this delete Api expenses Id no content response has a 3xx status code
|
||||
func (o *DeleteAPIExpensesIDNoContent) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this delete Api expenses Id no content response has a 4xx status code
|
||||
func (o *DeleteAPIExpensesIDNoContent) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this delete Api expenses Id no content response has a 5xx status code
|
||||
func (o *DeleteAPIExpensesIDNoContent) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this delete Api expenses Id no content response a status code equal to that given
|
||||
func (o *DeleteAPIExpensesIDNoContent) IsCode(code int) bool {
|
||||
return code == 204
|
||||
}
|
||||
|
||||
func (o *DeleteAPIExpensesIDNoContent) Error() string {
|
||||
return fmt.Sprintf("[DELETE /api/expenses/{id}][%d] deleteApiExpensesIdNoContent ", 204)
|
||||
}
|
||||
|
||||
func (o *DeleteAPIExpensesIDNoContent) String() string {
|
||||
return fmt.Sprintf("[DELETE /api/expenses/{id}][%d] deleteApiExpensesIdNoContent ", 204)
|
||||
}
|
||||
|
||||
func (o *DeleteAPIExpensesIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
330
client/expense/expense_client.go
Normal file
330
client/expense/expense_client.go
Normal file
@ -0,0 +1,330 @@
|
||||
// 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
|
||||
}
|
152
client/expense/get_api_expenses_id_parameters.go
Normal file
152
client/expense/get_api_expenses_id_parameters.go
Normal file
@ -0,0 +1,152 @@
|
||||
// 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 (
|
||||
"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"
|
||||
)
|
||||
|
||||
// NewGetAPIExpensesIDParams creates a new GetAPIExpensesIDParams 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 NewGetAPIExpensesIDParams() *GetAPIExpensesIDParams {
|
||||
return &GetAPIExpensesIDParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetAPIExpensesIDParamsWithTimeout creates a new GetAPIExpensesIDParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGetAPIExpensesIDParamsWithTimeout(timeout time.Duration) *GetAPIExpensesIDParams {
|
||||
return &GetAPIExpensesIDParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetAPIExpensesIDParamsWithContext creates a new GetAPIExpensesIDParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewGetAPIExpensesIDParamsWithContext(ctx context.Context) *GetAPIExpensesIDParams {
|
||||
return &GetAPIExpensesIDParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetAPIExpensesIDParamsWithHTTPClient creates a new GetAPIExpensesIDParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGetAPIExpensesIDParamsWithHTTPClient(client *http.Client) *GetAPIExpensesIDParams {
|
||||
return &GetAPIExpensesIDParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetAPIExpensesIDParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the get API expenses ID operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GetAPIExpensesIDParams struct {
|
||||
|
||||
/* ID.
|
||||
|
||||
Expense ID to fetch
|
||||
*/
|
||||
ID int64
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the get API expenses ID params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetAPIExpensesIDParams) WithDefaults() *GetAPIExpensesIDParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the get API expenses ID params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetAPIExpensesIDParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the get API expenses ID params
|
||||
func (o *GetAPIExpensesIDParams) WithTimeout(timeout time.Duration) *GetAPIExpensesIDParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the get API expenses ID params
|
||||
func (o *GetAPIExpensesIDParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the get API expenses ID params
|
||||
func (o *GetAPIExpensesIDParams) WithContext(ctx context.Context) *GetAPIExpensesIDParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the get API expenses ID params
|
||||
func (o *GetAPIExpensesIDParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the get API expenses ID params
|
||||
func (o *GetAPIExpensesIDParams) WithHTTPClient(client *http.Client) *GetAPIExpensesIDParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the get API expenses ID params
|
||||
func (o *GetAPIExpensesIDParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithID adds the id to the get API expenses ID params
|
||||
func (o *GetAPIExpensesIDParams) WithID(id int64) *GetAPIExpensesIDParams {
|
||||
o.SetID(id)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetID adds the id to the get API expenses ID params
|
||||
func (o *GetAPIExpensesIDParams) SetID(id int64) {
|
||||
o.ID = id
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *GetAPIExpensesIDParams) 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
|
||||
}
|
98
client/expense/get_api_expenses_id_responses.go
Normal file
98
client/expense/get_api_expenses_id_responses.go
Normal file
@ -0,0 +1,98 @@
|
||||
// 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"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"decentral1se/go-kimai/models"
|
||||
)
|
||||
|
||||
// GetAPIExpensesIDReader is a Reader for the GetAPIExpensesID structure.
|
||||
type GetAPIExpensesIDReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *GetAPIExpensesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewGetAPIExpensesIDOK()
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetAPIExpensesIDOK creates a GetAPIExpensesIDOK with default headers values
|
||||
func NewGetAPIExpensesIDOK() *GetAPIExpensesIDOK {
|
||||
return &GetAPIExpensesIDOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetAPIExpensesIDOK describes a response with status code 200, with default header values.
|
||||
|
||||
Returns one expense entity
|
||||
*/
|
||||
type GetAPIExpensesIDOK struct {
|
||||
Payload *models.ExpenseEntity
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get Api expenses Id o k response has a 2xx status code
|
||||
func (o *GetAPIExpensesIDOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get Api expenses Id o k response has a 3xx status code
|
||||
func (o *GetAPIExpensesIDOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get Api expenses Id o k response has a 4xx status code
|
||||
func (o *GetAPIExpensesIDOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get Api expenses Id o k response has a 5xx status code
|
||||
func (o *GetAPIExpensesIDOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get Api expenses Id o k response a status code equal to that given
|
||||
func (o *GetAPIExpensesIDOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
func (o *GetAPIExpensesIDOK) Error() string {
|
||||
return fmt.Sprintf("[GET /api/expenses/{id}][%d] getApiExpensesIdOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAPIExpensesIDOK) String() string {
|
||||
return fmt.Sprintf("[GET /api/expenses/{id}][%d] getApiExpensesIdOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAPIExpensesIDOK) GetPayload() *models.ExpenseEntity {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetAPIExpensesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.ExpenseEntity)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
358
client/expense/get_api_expenses_parameters.go
Normal file
358
client/expense/get_api_expenses_parameters.go
Normal file
@ -0,0 +1,358 @@
|
||||
// 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 (
|
||||
"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"
|
||||
)
|
||||
|
||||
// NewGetAPIExpensesParams creates a new GetAPIExpensesParams 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 NewGetAPIExpensesParams() *GetAPIExpensesParams {
|
||||
return &GetAPIExpensesParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetAPIExpensesParamsWithTimeout creates a new GetAPIExpensesParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGetAPIExpensesParamsWithTimeout(timeout time.Duration) *GetAPIExpensesParams {
|
||||
return &GetAPIExpensesParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetAPIExpensesParamsWithContext creates a new GetAPIExpensesParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewGetAPIExpensesParamsWithContext(ctx context.Context) *GetAPIExpensesParams {
|
||||
return &GetAPIExpensesParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetAPIExpensesParamsWithHTTPClient creates a new GetAPIExpensesParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGetAPIExpensesParamsWithHTTPClient(client *http.Client) *GetAPIExpensesParams {
|
||||
return &GetAPIExpensesParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetAPIExpensesParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the get API expenses operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GetAPIExpensesParams struct {
|
||||
|
||||
/* Begin.
|
||||
|
||||
Only records after this date will be included (format: HTML5)
|
||||
|
||||
Format: DateTime
|
||||
*/
|
||||
Begin string
|
||||
|
||||
/* End.
|
||||
|
||||
Only records before this date will be included (format: HTML5)
|
||||
|
||||
Format: DateTime
|
||||
*/
|
||||
End string
|
||||
|
||||
/* Exported.
|
||||
|
||||
Use this flag if you want to filter for export state. Allowed values: 0=not exported, 1=exported (default: all)
|
||||
*/
|
||||
Exported string
|
||||
|
||||
/* Order.
|
||||
|
||||
The result order. Allowed values: ASC, DESC (default: DESC)
|
||||
*/
|
||||
Order string
|
||||
|
||||
/* OrderBy.
|
||||
|
||||
The field by which results will be ordered. Allowed values: begin, end, duration, total, category, cost, user, customer, project, activity, description, exported, refundable, multiplier (default: begin)
|
||||
*/
|
||||
OrderBy string
|
||||
|
||||
/* Page.
|
||||
|
||||
The page to display, renders a 404 if not found (default: 1)
|
||||
*/
|
||||
Page string
|
||||
|
||||
/* Refundable.
|
||||
|
||||
Use this flag if you want to filter for refundable expenses. Allowed values: 0=not refundable, 1=refundable (default: all)
|
||||
*/
|
||||
Refundable string
|
||||
|
||||
/* Size.
|
||||
|
||||
The amount of entries for each page (default: 50)
|
||||
*/
|
||||
Size string
|
||||
|
||||
/* Term.
|
||||
|
||||
Free search term
|
||||
*/
|
||||
Term string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the get API expenses params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetAPIExpensesParams) WithDefaults() *GetAPIExpensesParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the get API expenses params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetAPIExpensesParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) WithTimeout(timeout time.Duration) *GetAPIExpensesParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) WithContext(ctx context.Context) *GetAPIExpensesParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) WithHTTPClient(client *http.Client) *GetAPIExpensesParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBegin adds the begin to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) WithBegin(begin string) *GetAPIExpensesParams {
|
||||
o.SetBegin(begin)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBegin adds the begin to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) SetBegin(begin string) {
|
||||
o.Begin = begin
|
||||
}
|
||||
|
||||
// WithEnd adds the end to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) WithEnd(end string) *GetAPIExpensesParams {
|
||||
o.SetEnd(end)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetEnd adds the end to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) SetEnd(end string) {
|
||||
o.End = end
|
||||
}
|
||||
|
||||
// WithExported adds the exported to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) WithExported(exported string) *GetAPIExpensesParams {
|
||||
o.SetExported(exported)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetExported adds the exported to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) SetExported(exported string) {
|
||||
o.Exported = exported
|
||||
}
|
||||
|
||||
// WithOrder adds the order to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) WithOrder(order string) *GetAPIExpensesParams {
|
||||
o.SetOrder(order)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOrder adds the order to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) SetOrder(order string) {
|
||||
o.Order = order
|
||||
}
|
||||
|
||||
// WithOrderBy adds the orderBy to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) WithOrderBy(orderBy string) *GetAPIExpensesParams {
|
||||
o.SetOrderBy(orderBy)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOrderBy adds the orderBy to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) SetOrderBy(orderBy string) {
|
||||
o.OrderBy = orderBy
|
||||
}
|
||||
|
||||
// WithPage adds the page to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) WithPage(page string) *GetAPIExpensesParams {
|
||||
o.SetPage(page)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPage adds the page to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) SetPage(page string) {
|
||||
o.Page = page
|
||||
}
|
||||
|
||||
// WithRefundable adds the refundable to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) WithRefundable(refundable string) *GetAPIExpensesParams {
|
||||
o.SetRefundable(refundable)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetRefundable adds the refundable to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) SetRefundable(refundable string) {
|
||||
o.Refundable = refundable
|
||||
}
|
||||
|
||||
// WithSize adds the size to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) WithSize(size string) *GetAPIExpensesParams {
|
||||
o.SetSize(size)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetSize adds the size to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) SetSize(size string) {
|
||||
o.Size = size
|
||||
}
|
||||
|
||||
// WithTerm adds the term to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) WithTerm(term string) *GetAPIExpensesParams {
|
||||
o.SetTerm(term)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTerm adds the term to the get API expenses params
|
||||
func (o *GetAPIExpensesParams) SetTerm(term string) {
|
||||
o.Term = term
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *GetAPIExpensesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// query param begin
|
||||
qrBegin := o.Begin
|
||||
qBegin := qrBegin
|
||||
|
||||
if err := r.SetQueryParam("begin", qBegin); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// query param end
|
||||
qrEnd := o.End
|
||||
qEnd := qrEnd
|
||||
|
||||
if err := r.SetQueryParam("end", qEnd); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// query param exported
|
||||
qrExported := o.Exported
|
||||
qExported := qrExported
|
||||
|
||||
if err := r.SetQueryParam("exported", qExported); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 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 refundable
|
||||
qrRefundable := o.Refundable
|
||||
qRefundable := qrRefundable
|
||||
|
||||
if err := r.SetQueryParam("refundable", qRefundable); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// query param size
|
||||
qrSize := o.Size
|
||||
qSize := qrSize
|
||||
|
||||
if err := r.SetQueryParam("size", qSize); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// query param term
|
||||
qrTerm := o.Term
|
||||
qTerm := qrTerm
|
||||
|
||||
if err := r.SetQueryParam("term", qTerm); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
96
client/expense/get_api_expenses_responses.go
Normal file
96
client/expense/get_api_expenses_responses.go
Normal file
@ -0,0 +1,96 @@
|
||||
// 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"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"decentral1se/go-kimai/models"
|
||||
)
|
||||
|
||||
// GetAPIExpensesReader is a Reader for the GetAPIExpenses structure.
|
||||
type GetAPIExpensesReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *GetAPIExpensesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewGetAPIExpensesOK()
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetAPIExpensesOK creates a GetAPIExpensesOK with default headers values
|
||||
func NewGetAPIExpensesOK() *GetAPIExpensesOK {
|
||||
return &GetAPIExpensesOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetAPIExpensesOK describes a response with status code 200, with default header values.
|
||||
|
||||
Returns a collection of expense entities
|
||||
*/
|
||||
type GetAPIExpensesOK struct {
|
||||
Payload []*models.ExpenseEntity
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get Api expenses o k response has a 2xx status code
|
||||
func (o *GetAPIExpensesOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get Api expenses o k response has a 3xx status code
|
||||
func (o *GetAPIExpensesOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get Api expenses o k response has a 4xx status code
|
||||
func (o *GetAPIExpensesOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get Api expenses o k response has a 5xx status code
|
||||
func (o *GetAPIExpensesOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get Api expenses o k response a status code equal to that given
|
||||
func (o *GetAPIExpensesOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
func (o *GetAPIExpensesOK) Error() string {
|
||||
return fmt.Sprintf("[GET /api/expenses][%d] getApiExpensesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAPIExpensesOK) String() string {
|
||||
return fmt.Sprintf("[GET /api/expenses][%d] getApiExpensesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAPIExpensesOK) GetPayload() []*models.ExpenseEntity {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetAPIExpensesOK) 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
|
||||
}
|
152
client/expense/patch_api_expenses_id_duplicate_parameters.go
Normal file
152
client/expense/patch_api_expenses_id_duplicate_parameters.go
Normal file
@ -0,0 +1,152 @@
|
||||
// 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 (
|
||||
"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"
|
||||
)
|
||||
|
||||
// NewPatchAPIExpensesIDDuplicateParams creates a new PatchAPIExpensesIDDuplicateParams 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 NewPatchAPIExpensesIDDuplicateParams() *PatchAPIExpensesIDDuplicateParams {
|
||||
return &PatchAPIExpensesIDDuplicateParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPatchAPIExpensesIDDuplicateParamsWithTimeout creates a new PatchAPIExpensesIDDuplicateParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewPatchAPIExpensesIDDuplicateParamsWithTimeout(timeout time.Duration) *PatchAPIExpensesIDDuplicateParams {
|
||||
return &PatchAPIExpensesIDDuplicateParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPatchAPIExpensesIDDuplicateParamsWithContext creates a new PatchAPIExpensesIDDuplicateParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewPatchAPIExpensesIDDuplicateParamsWithContext(ctx context.Context) *PatchAPIExpensesIDDuplicateParams {
|
||||
return &PatchAPIExpensesIDDuplicateParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPatchAPIExpensesIDDuplicateParamsWithHTTPClient creates a new PatchAPIExpensesIDDuplicateParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewPatchAPIExpensesIDDuplicateParamsWithHTTPClient(client *http.Client) *PatchAPIExpensesIDDuplicateParams {
|
||||
return &PatchAPIExpensesIDDuplicateParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
PatchAPIExpensesIDDuplicateParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the patch API expenses ID duplicate operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type PatchAPIExpensesIDDuplicateParams struct {
|
||||
|
||||
/* ID.
|
||||
|
||||
Expense record ID to duplicate
|
||||
*/
|
||||
ID int64
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the patch API expenses ID duplicate params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *PatchAPIExpensesIDDuplicateParams) WithDefaults() *PatchAPIExpensesIDDuplicateParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the patch API expenses ID duplicate params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *PatchAPIExpensesIDDuplicateParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the patch API expenses ID duplicate params
|
||||
func (o *PatchAPIExpensesIDDuplicateParams) WithTimeout(timeout time.Duration) *PatchAPIExpensesIDDuplicateParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the patch API expenses ID duplicate params
|
||||
func (o *PatchAPIExpensesIDDuplicateParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the patch API expenses ID duplicate params
|
||||
func (o *PatchAPIExpensesIDDuplicateParams) WithContext(ctx context.Context) *PatchAPIExpensesIDDuplicateParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the patch API expenses ID duplicate params
|
||||
func (o *PatchAPIExpensesIDDuplicateParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the patch API expenses ID duplicate params
|
||||
func (o *PatchAPIExpensesIDDuplicateParams) WithHTTPClient(client *http.Client) *PatchAPIExpensesIDDuplicateParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the patch API expenses ID duplicate params
|
||||
func (o *PatchAPIExpensesIDDuplicateParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithID adds the id to the patch API expenses ID duplicate params
|
||||
func (o *PatchAPIExpensesIDDuplicateParams) WithID(id int64) *PatchAPIExpensesIDDuplicateParams {
|
||||
o.SetID(id)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetID adds the id to the patch API expenses ID duplicate params
|
||||
func (o *PatchAPIExpensesIDDuplicateParams) SetID(id int64) {
|
||||
o.ID = id
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *PatchAPIExpensesIDDuplicateParams) 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
|
||||
}
|
98
client/expense/patch_api_expenses_id_duplicate_responses.go
Normal file
98
client/expense/patch_api_expenses_id_duplicate_responses.go
Normal file
@ -0,0 +1,98 @@
|
||||
// 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"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"decentral1se/go-kimai/models"
|
||||
)
|
||||
|
||||
// PatchAPIExpensesIDDuplicateReader is a Reader for the PatchAPIExpensesIDDuplicate structure.
|
||||
type PatchAPIExpensesIDDuplicateReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *PatchAPIExpensesIDDuplicateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewPatchAPIExpensesIDDuplicateOK()
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
// NewPatchAPIExpensesIDDuplicateOK creates a PatchAPIExpensesIDDuplicateOK with default headers values
|
||||
func NewPatchAPIExpensesIDDuplicateOK() *PatchAPIExpensesIDDuplicateOK {
|
||||
return &PatchAPIExpensesIDDuplicateOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
PatchAPIExpensesIDDuplicateOK describes a response with status code 200, with default header values.
|
||||
|
||||
Duplicates a expense record, resetting the export state only.
|
||||
*/
|
||||
type PatchAPIExpensesIDDuplicateOK struct {
|
||||
Payload *models.ExpenseEntity
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this patch Api expenses Id duplicate o k response has a 2xx status code
|
||||
func (o *PatchAPIExpensesIDDuplicateOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this patch Api expenses Id duplicate o k response has a 3xx status code
|
||||
func (o *PatchAPIExpensesIDDuplicateOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this patch Api expenses Id duplicate o k response has a 4xx status code
|
||||
func (o *PatchAPIExpensesIDDuplicateOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this patch Api expenses Id duplicate o k response has a 5xx status code
|
||||
func (o *PatchAPIExpensesIDDuplicateOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this patch Api expenses Id duplicate o k response a status code equal to that given
|
||||
func (o *PatchAPIExpensesIDDuplicateOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
func (o *PatchAPIExpensesIDDuplicateOK) Error() string {
|
||||
return fmt.Sprintf("[PATCH /api/expenses/{id}/duplicate][%d] patchApiExpensesIdDuplicateOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PatchAPIExpensesIDDuplicateOK) String() string {
|
||||
return fmt.Sprintf("[PATCH /api/expenses/{id}/duplicate][%d] patchApiExpensesIdDuplicateOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PatchAPIExpensesIDDuplicateOK) GetPayload() *models.ExpenseEntity {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *PatchAPIExpensesIDDuplicateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.ExpenseEntity)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
169
client/expense/patch_api_expenses_id_meta_parameters.go
Normal file
169
client/expense/patch_api_expenses_id_meta_parameters.go
Normal file
@ -0,0 +1,169 @@
|
||||
// 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 (
|
||||
"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"
|
||||
)
|
||||
|
||||
// NewPatchAPIExpensesIDMetaParams creates a new PatchAPIExpensesIDMetaParams 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 NewPatchAPIExpensesIDMetaParams() *PatchAPIExpensesIDMetaParams {
|
||||
return &PatchAPIExpensesIDMetaParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPatchAPIExpensesIDMetaParamsWithTimeout creates a new PatchAPIExpensesIDMetaParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewPatchAPIExpensesIDMetaParamsWithTimeout(timeout time.Duration) *PatchAPIExpensesIDMetaParams {
|
||||
return &PatchAPIExpensesIDMetaParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPatchAPIExpensesIDMetaParamsWithContext creates a new PatchAPIExpensesIDMetaParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewPatchAPIExpensesIDMetaParamsWithContext(ctx context.Context) *PatchAPIExpensesIDMetaParams {
|
||||
return &PatchAPIExpensesIDMetaParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPatchAPIExpensesIDMetaParamsWithHTTPClient creates a new PatchAPIExpensesIDMetaParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewPatchAPIExpensesIDMetaParamsWithHTTPClient(client *http.Client) *PatchAPIExpensesIDMetaParams {
|
||||
return &PatchAPIExpensesIDMetaParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
PatchAPIExpensesIDMetaParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the patch API expenses ID meta operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type PatchAPIExpensesIDMetaParams struct {
|
||||
|
||||
// Body.
|
||||
Body PatchAPIExpensesIDMetaBody
|
||||
|
||||
/* ID.
|
||||
|
||||
Expense record ID to set the meta-field value for
|
||||
*/
|
||||
ID int64
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the patch API expenses ID meta params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *PatchAPIExpensesIDMetaParams) WithDefaults() *PatchAPIExpensesIDMetaParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the patch API expenses ID meta params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *PatchAPIExpensesIDMetaParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the patch API expenses ID meta params
|
||||
func (o *PatchAPIExpensesIDMetaParams) WithTimeout(timeout time.Duration) *PatchAPIExpensesIDMetaParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the patch API expenses ID meta params
|
||||
func (o *PatchAPIExpensesIDMetaParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the patch API expenses ID meta params
|
||||
func (o *PatchAPIExpensesIDMetaParams) WithContext(ctx context.Context) *PatchAPIExpensesIDMetaParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the patch API expenses ID meta params
|
||||
func (o *PatchAPIExpensesIDMetaParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the patch API expenses ID meta params
|
||||
func (o *PatchAPIExpensesIDMetaParams) WithHTTPClient(client *http.Client) *PatchAPIExpensesIDMetaParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the patch API expenses ID meta params
|
||||
func (o *PatchAPIExpensesIDMetaParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the patch API expenses ID meta params
|
||||
func (o *PatchAPIExpensesIDMetaParams) WithBody(body PatchAPIExpensesIDMetaBody) *PatchAPIExpensesIDMetaParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the patch API expenses ID meta params
|
||||
func (o *PatchAPIExpensesIDMetaParams) SetBody(body PatchAPIExpensesIDMetaBody) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WithID adds the id to the patch API expenses ID meta params
|
||||
func (o *PatchAPIExpensesIDMetaParams) WithID(id int64) *PatchAPIExpensesIDMetaParams {
|
||||
o.SetID(id)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetID adds the id to the patch API expenses ID meta params
|
||||
func (o *PatchAPIExpensesIDMetaParams) SetID(id int64) {
|
||||
o.ID = id
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *PatchAPIExpensesIDMetaParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
176
client/expense/patch_api_expenses_id_meta_responses.go
Normal file
176
client/expense/patch_api_expenses_id_meta_responses.go
Normal file
@ -0,0 +1,176 @@
|
||||
// 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 (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
|
||||
"decentral1se/go-kimai/models"
|
||||
)
|
||||
|
||||
// PatchAPIExpensesIDMetaReader is a Reader for the PatchAPIExpensesIDMeta structure.
|
||||
type PatchAPIExpensesIDMetaReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *PatchAPIExpensesIDMetaReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewPatchAPIExpensesIDMetaOK()
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
// NewPatchAPIExpensesIDMetaOK creates a PatchAPIExpensesIDMetaOK with default headers values
|
||||
func NewPatchAPIExpensesIDMetaOK() *PatchAPIExpensesIDMetaOK {
|
||||
return &PatchAPIExpensesIDMetaOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
PatchAPIExpensesIDMetaOK describes a response with status code 200, with default header values.
|
||||
|
||||
Sets the value of an existing/configured meta-field. You cannot create unknown meta-fields, if the given name is not a configured meta-field, this will return an exception.
|
||||
*/
|
||||
type PatchAPIExpensesIDMetaOK struct {
|
||||
Payload *models.ExpenseEntity
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this patch Api expenses Id meta o k response has a 2xx status code
|
||||
func (o *PatchAPIExpensesIDMetaOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this patch Api expenses Id meta o k response has a 3xx status code
|
||||
func (o *PatchAPIExpensesIDMetaOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this patch Api expenses Id meta o k response has a 4xx status code
|
||||
func (o *PatchAPIExpensesIDMetaOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this patch Api expenses Id meta o k response has a 5xx status code
|
||||
func (o *PatchAPIExpensesIDMetaOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this patch Api expenses Id meta o k response a status code equal to that given
|
||||
func (o *PatchAPIExpensesIDMetaOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
func (o *PatchAPIExpensesIDMetaOK) Error() string {
|
||||
return fmt.Sprintf("[PATCH /api/expenses/{id}/meta][%d] patchApiExpensesIdMetaOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PatchAPIExpensesIDMetaOK) String() string {
|
||||
return fmt.Sprintf("[PATCH /api/expenses/{id}/meta][%d] patchApiExpensesIdMetaOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PatchAPIExpensesIDMetaOK) GetPayload() *models.ExpenseEntity {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *PatchAPIExpensesIDMetaOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.ExpenseEntity)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
PatchAPIExpensesIDMetaBody patch API expenses ID meta body
|
||||
swagger:model PatchAPIExpensesIDMetaBody
|
||||
*/
|
||||
type PatchAPIExpensesIDMetaBody struct {
|
||||
|
||||
// The meta-field name
|
||||
// Required: true
|
||||
Name *string `json:"name"`
|
||||
|
||||
// The meta-field value
|
||||
// Required: true
|
||||
Value *string `json:"value"`
|
||||
}
|
||||
|
||||
// Validate validates this patch API expenses ID meta body
|
||||
func (o *PatchAPIExpensesIDMetaBody) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := o.validateName(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := o.validateValue(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *PatchAPIExpensesIDMetaBody) validateName(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("body"+"."+"name", "body", o.Name); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *PatchAPIExpensesIDMetaBody) validateValue(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("body"+"."+"value", "body", o.Value); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this patch API expenses ID meta body based on context it is used
|
||||
func (o *PatchAPIExpensesIDMetaBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *PatchAPIExpensesIDMetaBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *PatchAPIExpensesIDMetaBody) UnmarshalBinary(b []byte) error {
|
||||
var res PatchAPIExpensesIDMetaBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
173
client/expense/patch_api_expenses_id_parameters.go
Normal file
173
client/expense/patch_api_expenses_id_parameters.go
Normal file
@ -0,0 +1,173 @@
|
||||
// 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 (
|
||||
"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"
|
||||
|
||||
"decentral1se/go-kimai/models"
|
||||
)
|
||||
|
||||
// NewPatchAPIExpensesIDParams creates a new PatchAPIExpensesIDParams 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 NewPatchAPIExpensesIDParams() *PatchAPIExpensesIDParams {
|
||||
return &PatchAPIExpensesIDParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPatchAPIExpensesIDParamsWithTimeout creates a new PatchAPIExpensesIDParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewPatchAPIExpensesIDParamsWithTimeout(timeout time.Duration) *PatchAPIExpensesIDParams {
|
||||
return &PatchAPIExpensesIDParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPatchAPIExpensesIDParamsWithContext creates a new PatchAPIExpensesIDParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewPatchAPIExpensesIDParamsWithContext(ctx context.Context) *PatchAPIExpensesIDParams {
|
||||
return &PatchAPIExpensesIDParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPatchAPIExpensesIDParamsWithHTTPClient creates a new PatchAPIExpensesIDParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewPatchAPIExpensesIDParamsWithHTTPClient(client *http.Client) *PatchAPIExpensesIDParams {
|
||||
return &PatchAPIExpensesIDParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
PatchAPIExpensesIDParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the patch API expenses ID operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type PatchAPIExpensesIDParams struct {
|
||||
|
||||
// Body.
|
||||
Body *models.ExpenseEditForm
|
||||
|
||||
/* ID.
|
||||
|
||||
Expense ID to update
|
||||
*/
|
||||
ID int64
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the patch API expenses ID params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *PatchAPIExpensesIDParams) WithDefaults() *PatchAPIExpensesIDParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the patch API expenses ID params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *PatchAPIExpensesIDParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the patch API expenses ID params
|
||||
func (o *PatchAPIExpensesIDParams) WithTimeout(timeout time.Duration) *PatchAPIExpensesIDParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the patch API expenses ID params
|
||||
func (o *PatchAPIExpensesIDParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the patch API expenses ID params
|
||||
func (o *PatchAPIExpensesIDParams) WithContext(ctx context.Context) *PatchAPIExpensesIDParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the patch API expenses ID params
|
||||
func (o *PatchAPIExpensesIDParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the patch API expenses ID params
|
||||
func (o *PatchAPIExpensesIDParams) WithHTTPClient(client *http.Client) *PatchAPIExpensesIDParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the patch API expenses ID params
|
||||
func (o *PatchAPIExpensesIDParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the patch API expenses ID params
|
||||
func (o *PatchAPIExpensesIDParams) WithBody(body *models.ExpenseEditForm) *PatchAPIExpensesIDParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the patch API expenses ID params
|
||||
func (o *PatchAPIExpensesIDParams) SetBody(body *models.ExpenseEditForm) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WithID adds the id to the patch API expenses ID params
|
||||
func (o *PatchAPIExpensesIDParams) WithID(id int64) *PatchAPIExpensesIDParams {
|
||||
o.SetID(id)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetID adds the id to the patch API expenses ID params
|
||||
func (o *PatchAPIExpensesIDParams) SetID(id int64) {
|
||||
o.ID = id
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *PatchAPIExpensesIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
98
client/expense/patch_api_expenses_id_responses.go
Normal file
98
client/expense/patch_api_expenses_id_responses.go
Normal file
@ -0,0 +1,98 @@
|
||||
// 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"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"decentral1se/go-kimai/models"
|
||||
)
|
||||
|
||||
// PatchAPIExpensesIDReader is a Reader for the PatchAPIExpensesID structure.
|
||||
type PatchAPIExpensesIDReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *PatchAPIExpensesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewPatchAPIExpensesIDOK()
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
// NewPatchAPIExpensesIDOK creates a PatchAPIExpensesIDOK with default headers values
|
||||
func NewPatchAPIExpensesIDOK() *PatchAPIExpensesIDOK {
|
||||
return &PatchAPIExpensesIDOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
PatchAPIExpensesIDOK describes a response with status code 200, with default header values.
|
||||
|
||||
Returns the updated expense
|
||||
*/
|
||||
type PatchAPIExpensesIDOK struct {
|
||||
Payload *models.ExpenseEntity
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this patch Api expenses Id o k response has a 2xx status code
|
||||
func (o *PatchAPIExpensesIDOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this patch Api expenses Id o k response has a 3xx status code
|
||||
func (o *PatchAPIExpensesIDOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this patch Api expenses Id o k response has a 4xx status code
|
||||
func (o *PatchAPIExpensesIDOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this patch Api expenses Id o k response has a 5xx status code
|
||||
func (o *PatchAPIExpensesIDOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this patch Api expenses Id o k response a status code equal to that given
|
||||
func (o *PatchAPIExpensesIDOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
func (o *PatchAPIExpensesIDOK) Error() string {
|
||||
return fmt.Sprintf("[PATCH /api/expenses/{id}][%d] patchApiExpensesIdOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PatchAPIExpensesIDOK) String() string {
|
||||
return fmt.Sprintf("[PATCH /api/expenses/{id}][%d] patchApiExpensesIdOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PatchAPIExpensesIDOK) GetPayload() *models.ExpenseEntity {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *PatchAPIExpensesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.ExpenseEntity)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
150
client/expense/post_api_expenses_parameters.go
Normal file
150
client/expense/post_api_expenses_parameters.go
Normal file
@ -0,0 +1,150 @@
|
||||
// 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 (
|
||||
"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"
|
||||
|
||||
"decentral1se/go-kimai/models"
|
||||
)
|
||||
|
||||
// NewPostAPIExpensesParams creates a new PostAPIExpensesParams 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 NewPostAPIExpensesParams() *PostAPIExpensesParams {
|
||||
return &PostAPIExpensesParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPostAPIExpensesParamsWithTimeout creates a new PostAPIExpensesParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewPostAPIExpensesParamsWithTimeout(timeout time.Duration) *PostAPIExpensesParams {
|
||||
return &PostAPIExpensesParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPostAPIExpensesParamsWithContext creates a new PostAPIExpensesParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewPostAPIExpensesParamsWithContext(ctx context.Context) *PostAPIExpensesParams {
|
||||
return &PostAPIExpensesParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPostAPIExpensesParamsWithHTTPClient creates a new PostAPIExpensesParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewPostAPIExpensesParamsWithHTTPClient(client *http.Client) *PostAPIExpensesParams {
|
||||
return &PostAPIExpensesParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
PostAPIExpensesParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the post API expenses operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type PostAPIExpensesParams struct {
|
||||
|
||||
// Body.
|
||||
Body *models.ExpenseEditForm
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the post API expenses params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *PostAPIExpensesParams) WithDefaults() *PostAPIExpensesParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the post API expenses params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *PostAPIExpensesParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the post API expenses params
|
||||
func (o *PostAPIExpensesParams) WithTimeout(timeout time.Duration) *PostAPIExpensesParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the post API expenses params
|
||||
func (o *PostAPIExpensesParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the post API expenses params
|
||||
func (o *PostAPIExpensesParams) WithContext(ctx context.Context) *PostAPIExpensesParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the post API expenses params
|
||||
func (o *PostAPIExpensesParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the post API expenses params
|
||||
func (o *PostAPIExpensesParams) WithHTTPClient(client *http.Client) *PostAPIExpensesParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the post API expenses params
|
||||
func (o *PostAPIExpensesParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the post API expenses params
|
||||
func (o *PostAPIExpensesParams) WithBody(body *models.ExpenseEditForm) *PostAPIExpensesParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the post API expenses params
|
||||
func (o *PostAPIExpensesParams) SetBody(body *models.ExpenseEditForm) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *PostAPIExpensesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
98
client/expense/post_api_expenses_responses.go
Normal file
98
client/expense/post_api_expenses_responses.go
Normal file
@ -0,0 +1,98 @@
|
||||
// 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"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"decentral1se/go-kimai/models"
|
||||
)
|
||||
|
||||
// PostAPIExpensesReader is a Reader for the PostAPIExpenses structure.
|
||||
type PostAPIExpensesReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *PostAPIExpensesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewPostAPIExpensesOK()
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
// NewPostAPIExpensesOK creates a PostAPIExpensesOK with default headers values
|
||||
func NewPostAPIExpensesOK() *PostAPIExpensesOK {
|
||||
return &PostAPIExpensesOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
PostAPIExpensesOK describes a response with status code 200, with default header values.
|
||||
|
||||
Returns the new created expense
|
||||
*/
|
||||
type PostAPIExpensesOK struct {
|
||||
Payload *models.ExpenseEntity
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this post Api expenses o k response has a 2xx status code
|
||||
func (o *PostAPIExpensesOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this post Api expenses o k response has a 3xx status code
|
||||
func (o *PostAPIExpensesOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this post Api expenses o k response has a 4xx status code
|
||||
func (o *PostAPIExpensesOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this post Api expenses o k response has a 5xx status code
|
||||
func (o *PostAPIExpensesOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this post Api expenses o k response a status code equal to that given
|
||||
func (o *PostAPIExpensesOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
func (o *PostAPIExpensesOK) Error() string {
|
||||
return fmt.Sprintf("[POST /api/expenses][%d] postApiExpensesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PostAPIExpensesOK) String() string {
|
||||
return fmt.Sprintf("[POST /api/expenses][%d] postApiExpensesOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PostAPIExpensesOK) GetPayload() *models.ExpenseEntity {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *PostAPIExpensesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.ExpenseEntity)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user