zrok/rest_client_zrok/service/service_client.go

245 lines
7.7 KiB
Go
Raw Normal View History

2022-07-26 21:38:35 +02:00
// Code generated by go-swagger; DO NOT EDIT.
package service
2022-07-26 21:38:35 +02:00
// 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 service API client.
2022-07-26 21:38:35 +02:00
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for service API
2022-07-26 21:38:35 +02:00
*/
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 {
2022-11-23 18:12:11 +01:00
Access(params *AccessParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccessCreated, error)
2022-11-30 17:17:09 +01:00
GetService(params *GetServiceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetServiceOK, error)
Share(params *ShareParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ShareCreated, error)
2022-07-26 21:38:35 +02:00
2022-11-23 18:12:11 +01:00
Unaccess(params *UnaccessParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UnaccessOK, error)
Unshare(params *UnshareParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UnshareOK, error)
2022-07-27 17:35:28 +02:00
2022-07-26 21:38:35 +02:00
SetTransport(transport runtime.ClientTransport)
}
2022-11-23 18:12:11 +01:00
/*
Access access API
*/
func (a *Client) Access(params *AccessParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccessCreated, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewAccessParams()
}
op := &runtime.ClientOperation{
ID: "access",
Method: "POST",
PathPattern: "/access",
ProducesMediaTypes: []string{"application/zrok.v1+json"},
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
Schemes: []string{"http"},
Params: params,
Reader: &AccessReader{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.(*AccessCreated)
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 access: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
2022-11-30 17:17:09 +01:00
/*
GetService get service API
*/
func (a *Client) GetService(params *GetServiceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetServiceOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetServiceParams()
}
op := &runtime.ClientOperation{
ID: "getService",
Method: "GET",
PathPattern: "/service",
ProducesMediaTypes: []string{"application/zrok.v1+json"},
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetServiceReader{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.(*GetServiceOK)
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 getService: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
2022-07-26 21:38:35 +02:00
/*
Share share API
2022-07-26 21:38:35 +02:00
*/
func (a *Client) Share(params *ShareParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ShareCreated, error) {
2022-07-26 21:38:35 +02:00
// TODO: Validate the params before sending
if params == nil {
params = NewShareParams()
2022-07-26 21:38:35 +02:00
}
op := &runtime.ClientOperation{
ID: "share",
2022-07-26 21:38:35 +02:00
Method: "POST",
PathPattern: "/share",
2022-07-26 21:38:35 +02:00
ProducesMediaTypes: []string{"application/zrok.v1+json"},
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
Schemes: []string{"http"},
Params: params,
Reader: &ShareReader{formats: a.formats},
AuthInfo: authInfo,
2022-07-26 21:38:35 +02:00
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.(*ShareCreated)
2022-07-26 21:38:35 +02:00
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 share: API contract not enforced by server. Client expected to get an error, but got: %T", result)
2022-07-26 21:38:35 +02:00
panic(msg)
}
2022-11-23 18:12:11 +01:00
/*
Unaccess unaccess API
*/
func (a *Client) Unaccess(params *UnaccessParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UnaccessOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewUnaccessParams()
}
op := &runtime.ClientOperation{
ID: "unaccess",
Method: "DELETE",
PathPattern: "/unaccess",
ProducesMediaTypes: []string{"application/zrok.v1+json"},
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
Schemes: []string{"http"},
Params: params,
Reader: &UnaccessReader{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.(*UnaccessOK)
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 unaccess: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
2022-07-27 17:35:28 +02:00
/*
Unshare unshare API
2022-07-27 17:35:28 +02:00
*/
func (a *Client) Unshare(params *UnshareParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UnshareOK, error) {
2022-07-27 17:35:28 +02:00
// TODO: Validate the params before sending
if params == nil {
params = NewUnshareParams()
2022-07-27 17:35:28 +02:00
}
op := &runtime.ClientOperation{
ID: "unshare",
2022-07-27 17:35:28 +02:00
Method: "DELETE",
PathPattern: "/unshare",
2022-07-27 17:35:28 +02:00
ProducesMediaTypes: []string{"application/zrok.v1+json"},
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
Schemes: []string{"http"},
Params: params,
Reader: &UnshareReader{formats: a.formats},
AuthInfo: authInfo,
2022-07-27 17:35:28 +02:00
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.(*UnshareOK)
2022-07-27 17:35:28 +02:00
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 unshare: API contract not enforced by server. Client expected to get an error, but got: %T", result)
2022-07-27 17:35:28 +02:00
panic(msg)
}
2022-07-26 21:38:35 +02:00
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}