go-kimai/client/task/task_client.go

548 lines
19 KiB
Go
Raw Normal View History

2023-01-14 14:14:06 +00:00
// Code generated by go-swagger; DO NOT EDIT.
package task
// 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 task API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for task 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 {
DeleteAPITasksID(params *DeleteAPITasksIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITasksIDNoContent, error)
GetAPITasks(params *GetAPITasksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITasksOK, error)
GetAPITasksID(params *GetAPITasksIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITasksIDOK, error)
PatchAPITasksID(params *PatchAPITasksIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDOK, error)
PatchAPITasksIDAssign(params *PatchAPITasksIDAssignParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDAssignOK, error)
PatchAPITasksIDClose(params *PatchAPITasksIDCloseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDCloseOK, error)
PatchAPITasksIDLog(params *PatchAPITasksIDLogParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDLogOK, error)
PatchAPITasksIDReopen(params *PatchAPITasksIDReopenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDReopenOK, error)
PatchAPITasksIDStart(params *PatchAPITasksIDStartParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDStartOK, error)
PatchAPITasksIDStop(params *PatchAPITasksIDStopParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDStopOK, error)
PatchAPITasksIDUnassign(params *PatchAPITasksIDUnassignParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDUnassignOK, error)
PostAPITasks(params *PostAPITasksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITasksOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
DeleteAPITasksID deletes an existing task record
*/
func (a *Client) DeleteAPITasksID(params *DeleteAPITasksIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITasksIDNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteAPITasksIDParams()
}
op := &runtime.ClientOperation{
ID: "DeleteAPITasksID",
Method: "DELETE",
PathPattern: "/api/tasks/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &DeleteAPITasksIDReader{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.(*DeleteAPITasksIDNoContent)
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 DeleteAPITasksID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPITasks returns a collection of tasks
Attention: This is a GET request and you can pass in every field of the form as query parameter.
Array values need to be written like this: /api/tasks?projects[]=1&projects[]=2
*/
func (a *Client) GetAPITasks(params *GetAPITasksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITasksOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPITasksParams()
}
op := &runtime.ClientOperation{
ID: "GetAPITasks",
Method: "GET",
PathPattern: "/api/tasks",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPITasksReader{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.(*GetAPITasksOK)
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 GetAPITasks: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPITasksID returns one task
*/
func (a *Client) GetAPITasksID(params *GetAPITasksIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITasksIDOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPITasksIDParams()
}
op := &runtime.ClientOperation{
ID: "GetAPITasksID",
Method: "GET",
PathPattern: "/api/tasks/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPITasksIDReader{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.(*GetAPITasksIDOK)
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 GetAPITasksID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPITasksID updates an existing task
Update an existing task, you can pass all or just a subset of all attributes
*/
func (a *Client) PatchAPITasksID(params *PatchAPITasksIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPITasksIDParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPITasksID",
Method: "PATCH",
PathPattern: "/api/tasks/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPITasksIDReader{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.(*PatchAPITasksIDOK)
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 PatchAPITasksID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPITasksIDAssign assigns a task to the current user
Assign a currently unassigned task to the current user
*/
func (a *Client) PatchAPITasksIDAssign(params *PatchAPITasksIDAssignParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDAssignOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPITasksIDAssignParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPITasksIDAssign",
Method: "PATCH",
PathPattern: "/api/tasks/{id}/assign",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPITasksIDAssignReader{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.(*PatchAPITasksIDAssignOK)
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 PatchAPITasksIDAssign: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPITasksIDClose closes a task for the current user
Closes an assigned task for the current user
*/
func (a *Client) PatchAPITasksIDClose(params *PatchAPITasksIDCloseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDCloseOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPITasksIDCloseParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPITasksIDClose",
Method: "PATCH",
PathPattern: "/api/tasks/{id}/close",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPITasksIDCloseReader{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.(*PatchAPITasksIDCloseOK)
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 PatchAPITasksIDClose: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPITasksIDLog logs work for a task record
*/
func (a *Client) PatchAPITasksIDLog(params *PatchAPITasksIDLogParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDLogOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPITasksIDLogParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPITasksIDLog",
Method: "PATCH",
PathPattern: "/api/tasks/{id}/log",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPITasksIDLogReader{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.(*PatchAPITasksIDLogOK)
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 PatchAPITasksIDLog: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPITasksIDReopen reopens a task for the current user
Reopens an assigned task for the current user
*/
func (a *Client) PatchAPITasksIDReopen(params *PatchAPITasksIDReopenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDReopenOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPITasksIDReopenParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPITasksIDReopen",
Method: "PATCH",
PathPattern: "/api/tasks/{id}/reopen",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPITasksIDReopenReader{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.(*PatchAPITasksIDReopenOK)
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 PatchAPITasksIDReopen: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPITasksIDStart starts a task record
*/
func (a *Client) PatchAPITasksIDStart(params *PatchAPITasksIDStartParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDStartOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPITasksIDStartParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPITasksIDStart",
Method: "PATCH",
PathPattern: "/api/tasks/{id}/start",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPITasksIDStartReader{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.(*PatchAPITasksIDStartOK)
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 PatchAPITasksIDStart: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPITasksIDStop stops a task record for the current user
*/
func (a *Client) PatchAPITasksIDStop(params *PatchAPITasksIDStopParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDStopOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPITasksIDStopParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPITasksIDStop",
Method: "PATCH",
PathPattern: "/api/tasks/{id}/stop",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPITasksIDStopReader{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.(*PatchAPITasksIDStopOK)
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 PatchAPITasksIDStop: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPITasksIDUnassign unassigns a task from the current user
Unassign a currently assigned task from the current user
*/
func (a *Client) PatchAPITasksIDUnassign(params *PatchAPITasksIDUnassignParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDUnassignOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPITasksIDUnassignParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPITasksIDUnassign",
Method: "PATCH",
PathPattern: "/api/tasks/{id}/unassign",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPITasksIDUnassignReader{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.(*PatchAPITasksIDUnassignOK)
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 PatchAPITasksIDUnassign: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PostAPITasks creates a new task
Creates a new task and returns it afterwards
*/
func (a *Client) PostAPITasks(params *PostAPITasksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITasksOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPostAPITasksParams()
}
op := &runtime.ClientOperation{
ID: "PostAPITasks",
Method: "POST",
PathPattern: "/api/tasks",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PostAPITasksReader{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.(*PostAPITasksOK)
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 PostAPITasks: 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
}