Ai
3 Star 2 Fork 0

Gitee 极速下载/go-swagger

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/go-swagger/go-swagger
克隆/下载
todos_client.go 2.80 KB
一键复制 编辑 原始数据 按行查看 历史
Ivan Porto Carrero 提交于 2015-11-22 13:03 +08:00 . add todolist generated client back
package todos
// 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-swagger/go-swagger/client"
"github.com/go-swagger/go-swagger/strfmt"
)
// New creates a new todos API client.
func New(transport client.Transport, formats strfmt.Registry) *Client {
return &Client{transport: transport, formats: formats}
}
/*
Client for todos API
*/
type Client struct {
transport client.Transport
formats strfmt.Registry
}
/*AddOne add one API
*/
func (a *Client) AddOne(params AddOneParams, authInfo client.AuthInfoWriter) (*AddOneCreated, error) {
// TODO: Validate the params before sending
result, err := a.transport.Submit(&client.Operation{
ID: "addOne",
Params: &params,
Reader: &AddOneReader{formats: a.formats},
AuthInfo: authInfo,
})
if err != nil {
return nil, err
}
return result.(*AddOneCreated), nil
}
/*DestroyOne destroy one API
*/
func (a *Client) DestroyOne(params DestroyOneParams, authInfo client.AuthInfoWriter) (*DestroyOneNoContent, error) {
// TODO: Validate the params before sending
result, err := a.transport.Submit(&client.Operation{
ID: "destroyOne",
Params: &params,
Reader: &DestroyOneReader{formats: a.formats},
AuthInfo: authInfo,
})
if err != nil {
return nil, err
}
return result.(*DestroyOneNoContent), nil
}
/*Find find API
*/
func (a *Client) Find(params FindParams, authInfo client.AuthInfoWriter) (*FindOK, error) {
// TODO: Validate the params before sending
result, err := a.transport.Submit(&client.Operation{
ID: "find",
Params: &params,
Reader: &FindReader{formats: a.formats},
AuthInfo: authInfo,
})
if err != nil {
return nil, err
}
return result.(*FindOK), nil
}
/*UpdateOne update one API
*/
func (a *Client) UpdateOne(params UpdateOneParams, authInfo client.AuthInfoWriter) (*UpdateOneOK, error) {
// TODO: Validate the params before sending
result, err := a.transport.Submit(&client.Operation{
ID: "updateOne",
Params: &params,
Reader: &UpdateOneReader{formats: a.formats},
AuthInfo: authInfo,
})
if err != nil {
return nil, err
}
return result.(*UpdateOneOK), nil
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport client.Transport) {
a.transport = transport
}
// NewAPIError creates a new API error
func NewAPIError(opName string, response interface{}, code int) APIError {
return APIError{
OperationName: opName,
Response: response,
Code: code,
}
}
// APIError wraps an error model and captures the status code
type APIError struct {
OperationName string
Response interface{}
Code int
}
func (a APIError) Error() string {
return fmt.Sprintf("%s (status %d): %+v ", a.OperationName, a.Code, a.Response)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/mirrors/go-swagger.git
git@gitee.com:mirrors/go-swagger.git
mirrors
go-swagger
go-swagger
v0.1.0

搜索帮助