go-kimai/client/project/project_client.go

372 lines
13 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package project
// 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 project API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for project 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 {
DeleteAPIProjectsIDRatesRateID(params *DeleteAPIProjectsIDRatesRateIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPIProjectsIDRatesRateIDNoContent, error)
GetAPIProjects(params *GetAPIProjectsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIProjectsOK, error)
GetAPIProjectsID(params *GetAPIProjectsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIProjectsIDOK, error)
GetAPIProjectsIDRates(params *GetAPIProjectsIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIProjectsIDRatesOK, error)
PatchAPIProjectsID(params *PatchAPIProjectsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIProjectsIDOK, error)
PatchAPIProjectsIDMeta(params *PatchAPIProjectsIDMetaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIProjectsIDMetaOK, error)
PostAPIProjects(params *PostAPIProjectsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIProjectsOK, error)
PostAPIProjectsIDRates(params *PostAPIProjectsIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIProjectsIDRatesOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
DeleteAPIProjectsIDRatesRateID deletes one rate for an project
*/
func (a *Client) DeleteAPIProjectsIDRatesRateID(params *DeleteAPIProjectsIDRatesRateIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPIProjectsIDRatesRateIDNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteAPIProjectsIDRatesRateIDParams()
}
op := &runtime.ClientOperation{
ID: "DeleteAPIProjectsIDRatesRateID",
Method: "DELETE",
PathPattern: "/api/projects/{id}/rates/{rateId}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &DeleteAPIProjectsIDRatesRateIDReader{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.(*DeleteAPIProjectsIDRatesRateIDNoContent)
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 DeleteAPIProjectsIDRatesRateID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPIProjects returns a collection of projects
*/
func (a *Client) GetAPIProjects(params *GetAPIProjectsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIProjectsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIProjectsParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIProjects",
Method: "GET",
PathPattern: "/api/projects",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIProjectsReader{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.(*GetAPIProjectsOK)
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 GetAPIProjects: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPIProjectsID returns one project
*/
func (a *Client) GetAPIProjectsID(params *GetAPIProjectsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIProjectsIDOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIProjectsIDParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIProjectsID",
Method: "GET",
PathPattern: "/api/projects/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIProjectsIDReader{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.(*GetAPIProjectsIDOK)
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 GetAPIProjectsID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPIProjectsIDRates returns a collection of all rates for one project
*/
func (a *Client) GetAPIProjectsIDRates(params *GetAPIProjectsIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIProjectsIDRatesOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIProjectsIDRatesParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIProjectsIDRates",
Method: "GET",
PathPattern: "/api/projects/{id}/rates",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIProjectsIDRatesReader{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.(*GetAPIProjectsIDRatesOK)
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 GetAPIProjectsIDRates: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPIProjectsID updates an existing project
Update an existing project, you can pass all or just a subset of all attributes
*/
func (a *Client) PatchAPIProjectsID(params *PatchAPIProjectsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIProjectsIDOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPIProjectsIDParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPIProjectsID",
Method: "PATCH",
PathPattern: "/api/projects/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPIProjectsIDReader{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.(*PatchAPIProjectsIDOK)
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 PatchAPIProjectsID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPIProjectsIDMeta sets the value of a meta field for an existing project
*/
func (a *Client) PatchAPIProjectsIDMeta(params *PatchAPIProjectsIDMetaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIProjectsIDMetaOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPIProjectsIDMetaParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPIProjectsIDMeta",
Method: "PATCH",
PathPattern: "/api/projects/{id}/meta",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPIProjectsIDMetaReader{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.(*PatchAPIProjectsIDMetaOK)
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 PatchAPIProjectsIDMeta: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PostAPIProjects creates a new project
Creates a new project and returns it afterwards
*/
func (a *Client) PostAPIProjects(params *PostAPIProjectsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIProjectsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPostAPIProjectsParams()
}
op := &runtime.ClientOperation{
ID: "PostAPIProjects",
Method: "POST",
PathPattern: "/api/projects",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PostAPIProjectsReader{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.(*PostAPIProjectsOK)
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 PostAPIProjects: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PostAPIProjectsIDRates adds a new rate to an project
*/
func (a *Client) PostAPIProjectsIDRates(params *PostAPIProjectsIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIProjectsIDRatesOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPostAPIProjectsIDRatesParams()
}
op := &runtime.ClientOperation{
ID: "PostAPIProjectsIDRates",
Method: "POST",
PathPattern: "/api/projects/{id}/rates",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PostAPIProjectsIDRatesReader{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.(*PostAPIProjectsIDRatesOK)
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 PostAPIProjectsIDRates: 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
}