forked from OpenAPITools/openapi-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi_PetApi.jl
285 lines (221 loc) · 11.2 KB
/
api_PetApi.jl
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# This file was generated by the Julia OpenAPI Code Generator
# Do not modify this file directly. Modify the OpenAPI specification instead.
struct PetApi <: OpenAPI.APIClientImpl
client::OpenAPI.Clients.Client
end
"""
The default API base path for APIs in `PetApi`.
This can be used to construct the `OpenAPI.Clients.Client` instance.
"""
basepath(::Type{ PetApi }) = "http://petstore.swagger.io/v2"
const _returntypes_add_pet_PetApi = Dict{Regex,Type}(
Regex("^" * replace("200", "x"=>".") * "\$") => Pet,
Regex("^" * replace("405", "x"=>".") * "\$") => Nothing,
)
function _oacinternal_add_pet(_api::PetApi, pet::Pet; _mediaType=nothing)
_ctx = OpenAPI.Clients.Ctx(_api.client, "POST", _returntypes_add_pet_PetApi, "/pet", ["petstore_auth", ], pet)
OpenAPI.Clients.set_header_accept(_ctx, ["application/xml", "application/json", ])
OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? ["application/json", "application/xml", ] : [_mediaType])
return _ctx
end
@doc raw"""Add a new pet to the store
Params:
- pet::Pet (required)
Return: Pet, OpenAPI.Clients.ApiResponse
"""
function add_pet(_api::PetApi, pet::Pet; _mediaType=nothing)
_ctx = _oacinternal_add_pet(_api, pet; _mediaType=_mediaType)
return OpenAPI.Clients.exec(_ctx)
end
function add_pet(_api::PetApi, response_stream::Channel, pet::Pet; _mediaType=nothing)
_ctx = _oacinternal_add_pet(_api, pet; _mediaType=_mediaType)
return OpenAPI.Clients.exec(_ctx, response_stream)
end
const _returntypes_delete_pet_PetApi = Dict{Regex,Type}(
Regex("^" * replace("400", "x"=>".") * "\$") => Nothing,
)
function _oacinternal_delete_pet(_api::PetApi, pet_id::Int64; api_key=nothing, _mediaType=nothing)
_ctx = OpenAPI.Clients.Ctx(_api.client, "DELETE", _returntypes_delete_pet_PetApi, "/pet/{petId}", ["petstore_auth", ])
OpenAPI.Clients.set_param(_ctx.path, "petId", pet_id) # type Int64
OpenAPI.Clients.set_param(_ctx.header, "api_key", api_key) # type String
OpenAPI.Clients.set_header_accept(_ctx, [])
OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? [] : [_mediaType])
return _ctx
end
@doc raw"""Deletes a pet
Params:
- pet_id::Int64 (required)
- api_key::String
Return: Nothing, OpenAPI.Clients.ApiResponse
"""
function delete_pet(_api::PetApi, pet_id::Int64; api_key=nothing, _mediaType=nothing)
_ctx = _oacinternal_delete_pet(_api, pet_id; api_key=api_key, _mediaType=_mediaType)
return OpenAPI.Clients.exec(_ctx)
end
function delete_pet(_api::PetApi, response_stream::Channel, pet_id::Int64; api_key=nothing, _mediaType=nothing)
_ctx = _oacinternal_delete_pet(_api, pet_id; api_key=api_key, _mediaType=_mediaType)
return OpenAPI.Clients.exec(_ctx, response_stream)
end
const _returntypes_find_pets_by_status_PetApi = Dict{Regex,Type}(
Regex("^" * replace("200", "x"=>".") * "\$") => Vector{Pet},
Regex("^" * replace("400", "x"=>".") * "\$") => Nothing,
)
function _oacinternal_find_pets_by_status(_api::PetApi, status::Vector{String}; _mediaType=nothing)
_ctx = OpenAPI.Clients.Ctx(_api.client, "GET", _returntypes_find_pets_by_status_PetApi, "/pet/findByStatus", ["petstore_auth", ])
OpenAPI.Clients.set_param(_ctx.query, "status", status; style="form", is_explode=false) # type Vector{String}
OpenAPI.Clients.set_header_accept(_ctx, ["application/xml", "application/json", ])
OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? [] : [_mediaType])
return _ctx
end
@doc raw"""Finds Pets by status
Multiple status values can be provided with comma separated strings
Params:
- status::Vector{String} (required)
Return: Vector{Pet}, OpenAPI.Clients.ApiResponse
"""
function find_pets_by_status(_api::PetApi, status::Vector{String}; _mediaType=nothing)
_ctx = _oacinternal_find_pets_by_status(_api, status; _mediaType=_mediaType)
return OpenAPI.Clients.exec(_ctx)
end
function find_pets_by_status(_api::PetApi, response_stream::Channel, status::Vector{String}; _mediaType=nothing)
_ctx = _oacinternal_find_pets_by_status(_api, status; _mediaType=_mediaType)
return OpenAPI.Clients.exec(_ctx, response_stream)
end
const _returntypes_find_pets_by_tags_PetApi = Dict{Regex,Type}(
Regex("^" * replace("200", "x"=>".") * "\$") => Vector{Pet},
Regex("^" * replace("400", "x"=>".") * "\$") => Nothing,
)
function _oacinternal_find_pets_by_tags(_api::PetApi, tags::Vector{String}; _mediaType=nothing)
_ctx = OpenAPI.Clients.Ctx(_api.client, "GET", _returntypes_find_pets_by_tags_PetApi, "/pet/findByTags", ["petstore_auth", ])
OpenAPI.Clients.set_param(_ctx.query, "tags", tags; style="form", is_explode=false) # type Vector{String}
OpenAPI.Clients.set_header_accept(_ctx, ["application/xml", "application/json", ])
OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? [] : [_mediaType])
return _ctx
end
@doc raw"""Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Params:
- tags::Vector{String} (required)
Return: Vector{Pet}, OpenAPI.Clients.ApiResponse
"""
function find_pets_by_tags(_api::PetApi, tags::Vector{String}; _mediaType=nothing)
_ctx = _oacinternal_find_pets_by_tags(_api, tags; _mediaType=_mediaType)
return OpenAPI.Clients.exec(_ctx)
end
function find_pets_by_tags(_api::PetApi, response_stream::Channel, tags::Vector{String}; _mediaType=nothing)
_ctx = _oacinternal_find_pets_by_tags(_api, tags; _mediaType=_mediaType)
return OpenAPI.Clients.exec(_ctx, response_stream)
end
const _returntypes_get_pet_by_id_PetApi = Dict{Regex,Type}(
Regex("^" * replace("200", "x"=>".") * "\$") => Pet,
Regex("^" * replace("400", "x"=>".") * "\$") => Nothing,
Regex("^" * replace("404", "x"=>".") * "\$") => Nothing,
)
function _oacinternal_get_pet_by_id(_api::PetApi, pet_id::Int64; _mediaType=nothing)
_ctx = OpenAPI.Clients.Ctx(_api.client, "GET", _returntypes_get_pet_by_id_PetApi, "/pet/{petId}", ["api_key", ])
OpenAPI.Clients.set_param(_ctx.path, "petId", pet_id) # type Int64
OpenAPI.Clients.set_header_accept(_ctx, ["application/xml", "application/json", ])
OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? [] : [_mediaType])
return _ctx
end
@doc raw"""Find pet by ID
Returns a single pet
Params:
- pet_id::Int64 (required)
Return: Pet, OpenAPI.Clients.ApiResponse
"""
function get_pet_by_id(_api::PetApi, pet_id::Int64; _mediaType=nothing)
_ctx = _oacinternal_get_pet_by_id(_api, pet_id; _mediaType=_mediaType)
return OpenAPI.Clients.exec(_ctx)
end
function get_pet_by_id(_api::PetApi, response_stream::Channel, pet_id::Int64; _mediaType=nothing)
_ctx = _oacinternal_get_pet_by_id(_api, pet_id; _mediaType=_mediaType)
return OpenAPI.Clients.exec(_ctx, response_stream)
end
const _returntypes_update_pet_PetApi = Dict{Regex,Type}(
Regex("^" * replace("200", "x"=>".") * "\$") => Pet,
Regex("^" * replace("400", "x"=>".") * "\$") => Nothing,
Regex("^" * replace("404", "x"=>".") * "\$") => Nothing,
Regex("^" * replace("405", "x"=>".") * "\$") => Nothing,
)
function _oacinternal_update_pet(_api::PetApi, pet::Pet; _mediaType=nothing)
_ctx = OpenAPI.Clients.Ctx(_api.client, "PUT", _returntypes_update_pet_PetApi, "/pet", ["petstore_auth", ], pet)
OpenAPI.Clients.set_header_accept(_ctx, ["application/xml", "application/json", ])
OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? ["application/json", "application/xml", ] : [_mediaType])
return _ctx
end
@doc raw"""Update an existing pet
Params:
- pet::Pet (required)
Return: Pet, OpenAPI.Clients.ApiResponse
"""
function update_pet(_api::PetApi, pet::Pet; _mediaType=nothing)
_ctx = _oacinternal_update_pet(_api, pet; _mediaType=_mediaType)
return OpenAPI.Clients.exec(_ctx)
end
function update_pet(_api::PetApi, response_stream::Channel, pet::Pet; _mediaType=nothing)
_ctx = _oacinternal_update_pet(_api, pet; _mediaType=_mediaType)
return OpenAPI.Clients.exec(_ctx, response_stream)
end
const _returntypes_update_pet_with_form_PetApi = Dict{Regex,Type}(
Regex("^" * replace("405", "x"=>".") * "\$") => Nothing,
)
function _oacinternal_update_pet_with_form(_api::PetApi, pet_id::Int64; name=nothing, status=nothing, _mediaType=nothing)
_ctx = OpenAPI.Clients.Ctx(_api.client, "POST", _returntypes_update_pet_with_form_PetApi, "/pet/{petId}", ["petstore_auth", ])
OpenAPI.Clients.set_param(_ctx.path, "petId", pet_id) # type Int64
OpenAPI.Clients.set_param(_ctx.form, "name", name) # type String
OpenAPI.Clients.set_param(_ctx.form, "status", status) # type String
OpenAPI.Clients.set_header_accept(_ctx, [])
OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? ["application/x-www-form-urlencoded", ] : [_mediaType])
return _ctx
end
@doc raw"""Updates a pet in the store with form data
Params:
- pet_id::Int64 (required)
- name::String
- status::String
Return: Nothing, OpenAPI.Clients.ApiResponse
"""
function update_pet_with_form(_api::PetApi, pet_id::Int64; name=nothing, status=nothing, _mediaType=nothing)
_ctx = _oacinternal_update_pet_with_form(_api, pet_id; name=name, status=status, _mediaType=_mediaType)
return OpenAPI.Clients.exec(_ctx)
end
function update_pet_with_form(_api::PetApi, response_stream::Channel, pet_id::Int64; name=nothing, status=nothing, _mediaType=nothing)
_ctx = _oacinternal_update_pet_with_form(_api, pet_id; name=name, status=status, _mediaType=_mediaType)
return OpenAPI.Clients.exec(_ctx, response_stream)
end
const _returntypes_upload_file_PetApi = Dict{Regex,Type}(
Regex("^" * replace("200", "x"=>".") * "\$") => ApiResponse,
)
function _oacinternal_upload_file(_api::PetApi, pet_id::Int64; additional_metadata=nothing, file=nothing, _mediaType=nothing)
_ctx = OpenAPI.Clients.Ctx(_api.client, "POST", _returntypes_upload_file_PetApi, "/pet/{petId}/uploadImage", ["petstore_auth", ])
OpenAPI.Clients.set_param(_ctx.path, "petId", pet_id) # type Int64
OpenAPI.Clients.set_param(_ctx.form, "additionalMetadata", additional_metadata) # type String
OpenAPI.Clients.set_param(_ctx.file, "file", file) # type String
OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ])
OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? ["multipart/form-data", ] : [_mediaType])
return _ctx
end
@doc raw"""uploads an image
Params:
- pet_id::Int64 (required)
- additional_metadata::String
- file::String
Return: ApiResponse, OpenAPI.Clients.ApiResponse
"""
function upload_file(_api::PetApi, pet_id::Int64; additional_metadata=nothing, file=nothing, _mediaType=nothing)
_ctx = _oacinternal_upload_file(_api, pet_id; additional_metadata=additional_metadata, file=file, _mediaType=_mediaType)
return OpenAPI.Clients.exec(_ctx)
end
function upload_file(_api::PetApi, response_stream::Channel, pet_id::Int64; additional_metadata=nothing, file=nothing, _mediaType=nothing)
_ctx = _oacinternal_upload_file(_api, pet_id; additional_metadata=additional_metadata, file=file, _mediaType=_mediaType)
return OpenAPI.Clients.exec(_ctx, response_stream)
end
export add_pet
export delete_pet
export find_pets_by_status
export find_pets_by_tags
export get_pet_by_id
export update_pet
export update_pet_with_form
export upload_file