feat: init
This commit is contained in:
152
client/tag/delete_api_tags_id_parameters.go
Normal file
152
client/tag/delete_api_tags_id_parameters.go
Normal file
@ -0,0 +1,152 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package tag
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// NewDeleteAPITagsIDParams creates a new DeleteAPITagsIDParams 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 NewDeleteAPITagsIDParams() *DeleteAPITagsIDParams {
|
||||
return &DeleteAPITagsIDParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteAPITagsIDParamsWithTimeout creates a new DeleteAPITagsIDParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewDeleteAPITagsIDParamsWithTimeout(timeout time.Duration) *DeleteAPITagsIDParams {
|
||||
return &DeleteAPITagsIDParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteAPITagsIDParamsWithContext creates a new DeleteAPITagsIDParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewDeleteAPITagsIDParamsWithContext(ctx context.Context) *DeleteAPITagsIDParams {
|
||||
return &DeleteAPITagsIDParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteAPITagsIDParamsWithHTTPClient creates a new DeleteAPITagsIDParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewDeleteAPITagsIDParamsWithHTTPClient(client *http.Client) *DeleteAPITagsIDParams {
|
||||
return &DeleteAPITagsIDParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteAPITagsIDParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the delete API tags ID operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type DeleteAPITagsIDParams struct {
|
||||
|
||||
/* ID.
|
||||
|
||||
Tag ID to delete
|
||||
*/
|
||||
ID int64
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the delete API tags ID params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteAPITagsIDParams) WithDefaults() *DeleteAPITagsIDParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the delete API tags ID params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *DeleteAPITagsIDParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the delete API tags ID params
|
||||
func (o *DeleteAPITagsIDParams) WithTimeout(timeout time.Duration) *DeleteAPITagsIDParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the delete API tags ID params
|
||||
func (o *DeleteAPITagsIDParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the delete API tags ID params
|
||||
func (o *DeleteAPITagsIDParams) WithContext(ctx context.Context) *DeleteAPITagsIDParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the delete API tags ID params
|
||||
func (o *DeleteAPITagsIDParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the delete API tags ID params
|
||||
func (o *DeleteAPITagsIDParams) WithHTTPClient(client *http.Client) *DeleteAPITagsIDParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the delete API tags ID params
|
||||
func (o *DeleteAPITagsIDParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithID adds the id to the delete API tags ID params
|
||||
func (o *DeleteAPITagsIDParams) WithID(id int64) *DeleteAPITagsIDParams {
|
||||
o.SetID(id)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetID adds the id to the delete API tags ID params
|
||||
func (o *DeleteAPITagsIDParams) SetID(id int64) {
|
||||
o.ID = id
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *DeleteAPITagsIDParams) 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/tag/delete_api_tags_id_responses.go
Normal file
83
client/tag/delete_api_tags_id_responses.go
Normal file
@ -0,0 +1,83 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package tag
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// DeleteAPITagsIDReader is a Reader for the DeleteAPITagsID structure.
|
||||
type DeleteAPITagsIDReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *DeleteAPITagsIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 204:
|
||||
result := NewDeleteAPITagsIDNoContent()
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteAPITagsIDNoContent creates a DeleteAPITagsIDNoContent with default headers values
|
||||
func NewDeleteAPITagsIDNoContent() *DeleteAPITagsIDNoContent {
|
||||
return &DeleteAPITagsIDNoContent{}
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteAPITagsIDNoContent describes a response with status code 204, with default header values.
|
||||
|
||||
HTTP code 204 for a successful delete
|
||||
*/
|
||||
type DeleteAPITagsIDNoContent struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this delete Api tags Id no content response has a 2xx status code
|
||||
func (o *DeleteAPITagsIDNoContent) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this delete Api tags Id no content response has a 3xx status code
|
||||
func (o *DeleteAPITagsIDNoContent) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this delete Api tags Id no content response has a 4xx status code
|
||||
func (o *DeleteAPITagsIDNoContent) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this delete Api tags Id no content response has a 5xx status code
|
||||
func (o *DeleteAPITagsIDNoContent) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this delete Api tags Id no content response a status code equal to that given
|
||||
func (o *DeleteAPITagsIDNoContent) IsCode(code int) bool {
|
||||
return code == 204
|
||||
}
|
||||
|
||||
func (o *DeleteAPITagsIDNoContent) Error() string {
|
||||
return fmt.Sprintf("[DELETE /api/tags/{id}][%d] deleteApiTagsIdNoContent ", 204)
|
||||
}
|
||||
|
||||
func (o *DeleteAPITagsIDNoContent) String() string {
|
||||
return fmt.Sprintf("[DELETE /api/tags/{id}][%d] deleteApiTagsIdNoContent ", 204)
|
||||
}
|
||||
|
||||
func (o *DeleteAPITagsIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
154
client/tag/get_api_tags_parameters.go
Normal file
154
client/tag/get_api_tags_parameters.go
Normal file
@ -0,0 +1,154 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package tag
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// NewGetAPITagsParams creates a new GetAPITagsParams 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 NewGetAPITagsParams() *GetAPITagsParams {
|
||||
return &GetAPITagsParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetAPITagsParamsWithTimeout creates a new GetAPITagsParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewGetAPITagsParamsWithTimeout(timeout time.Duration) *GetAPITagsParams {
|
||||
return &GetAPITagsParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetAPITagsParamsWithContext creates a new GetAPITagsParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewGetAPITagsParamsWithContext(ctx context.Context) *GetAPITagsParams {
|
||||
return &GetAPITagsParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetAPITagsParamsWithHTTPClient creates a new GetAPITagsParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewGetAPITagsParamsWithHTTPClient(client *http.Client) *GetAPITagsParams {
|
||||
return &GetAPITagsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetAPITagsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the get API tags operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type GetAPITagsParams struct {
|
||||
|
||||
/* Name.
|
||||
|
||||
Search term to filter tag list
|
||||
*/
|
||||
Name string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the get API tags params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetAPITagsParams) WithDefaults() *GetAPITagsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the get API tags params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *GetAPITagsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the get API tags params
|
||||
func (o *GetAPITagsParams) WithTimeout(timeout time.Duration) *GetAPITagsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the get API tags params
|
||||
func (o *GetAPITagsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the get API tags params
|
||||
func (o *GetAPITagsParams) WithContext(ctx context.Context) *GetAPITagsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the get API tags params
|
||||
func (o *GetAPITagsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the get API tags params
|
||||
func (o *GetAPITagsParams) WithHTTPClient(client *http.Client) *GetAPITagsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the get API tags params
|
||||
func (o *GetAPITagsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithName adds the name to the get API tags params
|
||||
func (o *GetAPITagsParams) WithName(name string) *GetAPITagsParams {
|
||||
o.SetName(name)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetName adds the name to the get API tags params
|
||||
func (o *GetAPITagsParams) SetName(name string) {
|
||||
o.Name = name
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *GetAPITagsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
// query param name
|
||||
qrName := o.Name
|
||||
qName := qrName
|
||||
|
||||
if err := r.SetQueryParam("name", qName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
94
client/tag/get_api_tags_responses.go
Normal file
94
client/tag/get_api_tags_responses.go
Normal file
@ -0,0 +1,94 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package tag
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// GetAPITagsReader is a Reader for the GetAPITags structure.
|
||||
type GetAPITagsReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *GetAPITagsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewGetAPITagsOK()
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetAPITagsOK creates a GetAPITagsOK with default headers values
|
||||
func NewGetAPITagsOK() *GetAPITagsOK {
|
||||
return &GetAPITagsOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
GetAPITagsOK describes a response with status code 200, with default header values.
|
||||
|
||||
Returns the collection of all existing tags as string array
|
||||
*/
|
||||
type GetAPITagsOK struct {
|
||||
Payload []string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get Api tags o k response has a 2xx status code
|
||||
func (o *GetAPITagsOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this get Api tags o k response has a 3xx status code
|
||||
func (o *GetAPITagsOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this get Api tags o k response has a 4xx status code
|
||||
func (o *GetAPITagsOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this get Api tags o k response has a 5xx status code
|
||||
func (o *GetAPITagsOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this get Api tags o k response a status code equal to that given
|
||||
func (o *GetAPITagsOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
func (o *GetAPITagsOK) Error() string {
|
||||
return fmt.Sprintf("[GET /api/tags][%d] getApiTagsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAPITagsOK) String() string {
|
||||
return fmt.Sprintf("[GET /api/tags][%d] getApiTagsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetAPITagsOK) GetPayload() []string {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetAPITagsOK) 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
|
||||
}
|
150
client/tag/post_api_tags_parameters.go
Normal file
150
client/tag/post_api_tags_parameters.go
Normal file
@ -0,0 +1,150 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package tag
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// NewPostAPITagsParams creates a new PostAPITagsParams 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 NewPostAPITagsParams() *PostAPITagsParams {
|
||||
return &PostAPITagsParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPostAPITagsParamsWithTimeout creates a new PostAPITagsParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewPostAPITagsParamsWithTimeout(timeout time.Duration) *PostAPITagsParams {
|
||||
return &PostAPITagsParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPostAPITagsParamsWithContext creates a new PostAPITagsParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewPostAPITagsParamsWithContext(ctx context.Context) *PostAPITagsParams {
|
||||
return &PostAPITagsParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewPostAPITagsParamsWithHTTPClient creates a new PostAPITagsParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewPostAPITagsParamsWithHTTPClient(client *http.Client) *PostAPITagsParams {
|
||||
return &PostAPITagsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
PostAPITagsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the post API tags operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type PostAPITagsParams struct {
|
||||
|
||||
// Body.
|
||||
Body *models.TagEditForm
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the post API tags params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *PostAPITagsParams) WithDefaults() *PostAPITagsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the post API tags params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *PostAPITagsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the post API tags params
|
||||
func (o *PostAPITagsParams) WithTimeout(timeout time.Duration) *PostAPITagsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the post API tags params
|
||||
func (o *PostAPITagsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the post API tags params
|
||||
func (o *PostAPITagsParams) WithContext(ctx context.Context) *PostAPITagsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the post API tags params
|
||||
func (o *PostAPITagsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the post API tags params
|
||||
func (o *PostAPITagsParams) WithHTTPClient(client *http.Client) *PostAPITagsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the post API tags params
|
||||
func (o *PostAPITagsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the post API tags params
|
||||
func (o *PostAPITagsParams) WithBody(body *models.TagEditForm) *PostAPITagsParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the post API tags params
|
||||
func (o *PostAPITagsParams) SetBody(body *models.TagEditForm) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *PostAPITagsParams) 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/tag/post_api_tags_responses.go
Normal file
98
client/tag/post_api_tags_responses.go
Normal file
@ -0,0 +1,98 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package tag
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// PostAPITagsReader is a Reader for the PostAPITags structure.
|
||||
type PostAPITagsReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *PostAPITagsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewPostAPITagsOK()
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
// NewPostAPITagsOK creates a PostAPITagsOK with default headers values
|
||||
func NewPostAPITagsOK() *PostAPITagsOK {
|
||||
return &PostAPITagsOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
PostAPITagsOK describes a response with status code 200, with default header values.
|
||||
|
||||
Returns the new created tag
|
||||
*/
|
||||
type PostAPITagsOK struct {
|
||||
Payload *models.TagEntity
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this post Api tags o k response has a 2xx status code
|
||||
func (o *PostAPITagsOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this post Api tags o k response has a 3xx status code
|
||||
func (o *PostAPITagsOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this post Api tags o k response has a 4xx status code
|
||||
func (o *PostAPITagsOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this post Api tags o k response has a 5xx status code
|
||||
func (o *PostAPITagsOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this post Api tags o k response a status code equal to that given
|
||||
func (o *PostAPITagsOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
func (o *PostAPITagsOK) Error() string {
|
||||
return fmt.Sprintf("[POST /api/tags][%d] postApiTagsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PostAPITagsOK) String() string {
|
||||
return fmt.Sprintf("[POST /api/tags][%d] postApiTagsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *PostAPITagsOK) GetPayload() *models.TagEntity {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *PostAPITagsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.TagEntity)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
164
client/tag/tag_client.go
Normal file
164
client/tag/tag_client.go
Normal file
@ -0,0 +1,164 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package tag
|
||||
|
||||
// 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 tag API client.
|
||||
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
||||
return &Client{transport: transport, formats: formats}
|
||||
}
|
||||
|
||||
/*
|
||||
Client for tag 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 {
|
||||
DeleteAPITagsID(params *DeleteAPITagsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITagsIDNoContent, error)
|
||||
|
||||
GetAPITags(params *GetAPITagsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITagsOK, error)
|
||||
|
||||
PostAPITags(params *PostAPITagsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITagsOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteAPITagsID deletes a tag
|
||||
*/
|
||||
func (a *Client) DeleteAPITagsID(params *DeleteAPITagsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITagsIDNoContent, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewDeleteAPITagsIDParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "DeleteAPITagsID",
|
||||
Method: "DELETE",
|
||||
PathPattern: "/api/tags/{id}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &DeleteAPITagsIDReader{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.(*DeleteAPITagsIDNoContent)
|
||||
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 DeleteAPITagsID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
GetAPITags fetches all existing tags
|
||||
*/
|
||||
func (a *Client) GetAPITags(params *GetAPITagsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITagsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewGetAPITagsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "GetAPITags",
|
||||
Method: "GET",
|
||||
PathPattern: "/api/tags",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &GetAPITagsReader{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.(*GetAPITagsOK)
|
||||
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 GetAPITags: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
PostAPITags creates a new tag
|
||||
|
||||
Creates a new tag and returns it afterwards
|
||||
*/
|
||||
func (a *Client) PostAPITags(params *PostAPITagsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITagsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewPostAPITagsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "PostAPITags",
|
||||
Method: "POST",
|
||||
PathPattern: "/api/tags",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &PostAPITagsReader{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.(*PostAPITagsOK)
|
||||
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 PostAPITags: 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
|
||||
}
|
Reference in New Issue
Block a user