forked from go-swagger/go-swagger
/
pet_client.go
200 lines (173 loc) · 5.65 KB
/
pet_client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
// Code generated by go-swagger; DO NOT EDIT.
package pet
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
)
//go:generate mockery -name API -inpkg
// API is the interface of the pet client
type API interface {
// PetCreate adds a new pet to the store
PetCreate(ctx context.Context, params *PetCreateParams) (*PetCreateCreated, error)
// PetDelete deletes a pet
PetDelete(ctx context.Context, params *PetDeleteParams) (*PetDeleteNoContent, error)
// PetGet gets pet by it s ID
PetGet(ctx context.Context, params *PetGetParams) (*PetGetOK, error)
// PetList lists pets
PetList(ctx context.Context, params *PetListParams) (*PetListOK, error)
// PetUpdate updates an existing pet
PetUpdate(ctx context.Context, params *PetUpdateParams) (*PetUpdateCreated, error)
// PetUploadImage uploads an image
PetUploadImage(ctx context.Context, params *PetUploadImageParams) (*PetUploadImageOK, error)
}
// New creates a new pet API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client {
return &Client{
transport: transport,
formats: formats,
authInfo: authInfo,
}
}
/*
Client for pet API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
authInfo runtime.ClientAuthInfoWriter
}
/*
PetCreate adds a new pet to the store
*/
func (a *Client) PetCreate(ctx context.Context, params *PetCreateParams) (*PetCreateCreated, error) {
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "PetCreate",
Method: "POST",
PathPattern: "/pet",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PetCreateReader{formats: a.formats},
AuthInfo: a.authInfo,
Context: ctx,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*PetCreateCreated), nil
}
/*
PetDelete deletes a pet
*/
func (a *Client) PetDelete(ctx context.Context, params *PetDeleteParams) (*PetDeleteNoContent, error) {
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "PetDelete",
Method: "DELETE",
PathPattern: "/pet/{petId}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PetDeleteReader{formats: a.formats},
AuthInfo: a.authInfo,
Context: ctx,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*PetDeleteNoContent), nil
}
/*
PetGet gets pet by it s ID
*/
func (a *Client) PetGet(ctx context.Context, params *PetGetParams) (*PetGetOK, error) {
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "PetGet",
Method: "GET",
PathPattern: "/pet/{petId}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PetGetReader{formats: a.formats},
AuthInfo: a.authInfo,
Context: ctx,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*PetGetOK), nil
}
/*
PetList lists pets
*/
func (a *Client) PetList(ctx context.Context, params *PetListParams) (*PetListOK, error) {
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "PetList",
Method: "GET",
PathPattern: "/pet",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PetListReader{formats: a.formats},
AuthInfo: a.authInfo,
Context: ctx,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*PetListOK), nil
}
/*
PetUpdate updates an existing pet
*/
func (a *Client) PetUpdate(ctx context.Context, params *PetUpdateParams) (*PetUpdateCreated, error) {
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "PetUpdate",
Method: "PUT",
PathPattern: "/pet",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PetUpdateReader{formats: a.formats},
AuthInfo: a.authInfo,
Context: ctx,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*PetUpdateCreated), nil
}
/*
PetUploadImage uploads an image
*/
func (a *Client) PetUploadImage(ctx context.Context, params *PetUploadImageParams) (*PetUploadImageOK, error) {
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "PetUploadImage",
Method: "POST",
PathPattern: "/pet/{petId}/image",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PetUploadImageReader{formats: a.formats},
AuthInfo: a.authInfo,
Context: ctx,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*PetUploadImageOK), nil
}