@@ -8,12 +8,25 @@ namespace IO.Swagger.Api {
8
8
9
9
public class PetApi {
10
10
string basePath ;
11
- public ApiInvoker apiClient { get ; set ; }
11
+ public ApiClient apiClient { get ; set ; }
12
12
13
13
public PetApi ( String basePath = "http://petstore.swagger.io/v2" )
14
14
{
15
15
this . basePath = basePath ;
16
- this . apiClient = new ApiInvoker ( basePath ) ;
16
+ this . apiClient = new ApiClient ( basePath ) ;
17
+ }
18
+
19
+ /// <summary>
20
+ /// Create a new object
21
+ /// </summary>
22
+ /// <param name="apiClient"> an instance of ApiClient
23
+ /// <returns></returns>
24
+ public PetApi ( ApiClient apiClient = null ) {
25
+ if ( apiClient == null ) { // use the default one in Configuration
26
+ this . apiClient = Configuration . apiClient ;
27
+ } else {
28
+ this . apiClient = apiClient ;
29
+ }
17
30
}
18
31
19
32
/// <summary>
@@ -34,7 +47,6 @@ public String GetBasePath() {
34
47
}
35
48
36
49
37
-
38
50
/// <summary>
39
51
/// Update an existing pet
40
52
/// </summary>
@@ -61,7 +73,7 @@ public void UpdatePet (Pet Body) {
61
73
62
74
63
75
// make the HTTP request
64
- IRestResponse response = ( IRestResponse ) apiClient . CallApi ( "/pet" , Method . PUT , queryParams , postBody , headerParams , formParams , fileParams ) ;
76
+ IRestResponse response = ( IRestResponse ) apiClient . CallApi ( path , Method . PUT , queryParams , postBody , headerParams , formParams , fileParams ) ;
65
77
66
78
if ( ( ( int ) response . StatusCode ) >= 400 ) {
67
79
throw new ApiException ( ( int ) response . StatusCode , "Error calling UpdatePet: " + response . Content ) ;
@@ -70,7 +82,6 @@ public void UpdatePet (Pet Body) {
70
82
return ;
71
83
}
72
84
73
-
74
85
/// <summary>
75
86
/// Add a new pet to the store
76
87
/// </summary>
@@ -97,7 +108,7 @@ public void AddPet (Pet Body) {
97
108
98
109
99
110
// make the HTTP request
100
- IRestResponse response = ( IRestResponse ) apiClient . CallApi ( "/pet" , Method . POST , queryParams , postBody , headerParams , formParams , fileParams ) ;
111
+ IRestResponse response = ( IRestResponse ) apiClient . CallApi ( path , Method . POST , queryParams , postBody , headerParams , formParams , fileParams ) ;
101
112
102
113
if ( ( ( int ) response . StatusCode ) >= 400 ) {
103
114
throw new ApiException ( ( int ) response . StatusCode , "Error calling AddPet: " + response . Content ) ;
@@ -106,7 +117,6 @@ public void AddPet (Pet Body) {
106
117
return ;
107
118
}
108
119
109
-
110
120
/// <summary>
111
121
/// Finds Pets by status Multiple status values can be provided with comma seperated strings
112
122
/// </summary>
@@ -133,15 +143,14 @@ public List<Pet> FindPetsByStatus (List<string> Status) {
133
143
134
144
135
145
// make the HTTP request
136
- IRestResponse response = ( IRestResponse ) apiClient . CallApi ( "/pet/findByStatus" , Method . GET , queryParams , postBody , headerParams , formParams , fileParams ) ;
146
+ IRestResponse response = ( IRestResponse ) apiClient . CallApi ( path , Method . GET , queryParams , postBody , headerParams , formParams , fileParams ) ;
137
147
138
148
if ( ( ( int ) response . StatusCode ) >= 400 ) {
139
149
throw new ApiException ( ( int ) response . StatusCode , "Error calling FindPetsByStatus: " + response . Content ) ;
140
150
}
141
151
return ( List < Pet > ) apiClient . Deserialize ( response . Content , typeof ( List < Pet > ) ) ;
142
152
}
143
153
144
-
145
154
/// <summary>
146
155
/// Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
147
156
/// </summary>
@@ -168,15 +177,14 @@ public List<Pet> FindPetsByTags (List<string> Tags) {
168
177
169
178
170
179
// make the HTTP request
171
- IRestResponse response = ( IRestResponse ) apiClient . CallApi ( "/pet/findByTags" , Method . GET , queryParams , postBody , headerParams , formParams , fileParams ) ;
180
+ IRestResponse response = ( IRestResponse ) apiClient . CallApi ( path , Method . GET , queryParams , postBody , headerParams , formParams , fileParams ) ;
172
181
173
182
if ( ( ( int ) response . StatusCode ) >= 400 ) {
174
183
throw new ApiException ( ( int ) response . StatusCode , "Error calling FindPetsByTags: " + response . Content ) ;
175
184
}
176
185
return ( List < Pet > ) apiClient . Deserialize ( response . Content , typeof ( List < Pet > ) ) ;
177
186
}
178
187
179
-
180
188
/// <summary>
181
189
/// Find pet by ID Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
182
190
/// </summary>
@@ -206,15 +214,14 @@ public Pet GetPetById (long? PetId) {
206
214
207
215
208
216
// make the HTTP request
209
- IRestResponse response = ( IRestResponse ) apiClient . CallApi ( "/pet/{petId}" , Method . GET , queryParams , postBody , headerParams , formParams , fileParams ) ;
217
+ IRestResponse response = ( IRestResponse ) apiClient . CallApi ( path , Method . GET , queryParams , postBody , headerParams , formParams , fileParams ) ;
210
218
211
219
if ( ( ( int ) response . StatusCode ) >= 400 ) {
212
220
throw new ApiException ( ( int ) response . StatusCode , "Error calling GetPetById: " + response . Content ) ;
213
221
}
214
222
return ( Pet ) apiClient . Deserialize ( response . Content , typeof ( Pet ) ) ;
215
223
}
216
224
217
-
218
225
/// <summary>
219
226
/// Updates a pet in the store with form data
220
227
/// </summary>
@@ -248,7 +255,7 @@ public void UpdatePetWithForm (string PetId, string Name, string Status) {
248
255
249
256
250
257
// make the HTTP request
251
- IRestResponse response = ( IRestResponse ) apiClient . CallApi ( "/pet/{petId}" , Method . POST , queryParams , postBody , headerParams , formParams , fileParams ) ;
258
+ IRestResponse response = ( IRestResponse ) apiClient . CallApi ( path , Method . POST , queryParams , postBody , headerParams , formParams , fileParams ) ;
252
259
253
260
if ( ( ( int ) response . StatusCode ) >= 400 ) {
254
261
throw new ApiException ( ( int ) response . StatusCode , "Error calling UpdatePetWithForm: " + response . Content ) ;
@@ -257,7 +264,6 @@ public void UpdatePetWithForm (string PetId, string Name, string Status) {
257
264
return ;
258
265
}
259
266
260
-
261
267
/// <summary>
262
268
/// Deletes a pet
263
269
/// </summary>
@@ -289,7 +295,7 @@ public void DeletePet (string ApiKey, long? PetId) {
289
295
290
296
291
297
// make the HTTP request
292
- IRestResponse response = ( IRestResponse ) apiClient . CallApi ( "/pet/{petId}" , Method . DELETE , queryParams , postBody , headerParams , formParams , fileParams ) ;
298
+ IRestResponse response = ( IRestResponse ) apiClient . CallApi ( path , Method . DELETE , queryParams , postBody , headerParams , formParams , fileParams ) ;
293
299
294
300
if ( ( ( int ) response . StatusCode ) >= 400 ) {
295
301
throw new ApiException ( ( int ) response . StatusCode , "Error calling DeletePet: " + response . Content ) ;
@@ -298,7 +304,6 @@ public void DeletePet (string ApiKey, long? PetId) {
298
304
return ;
299
305
}
300
306
301
-
302
307
/// <summary>
303
308
/// uploads an image
304
309
/// </summary>
@@ -332,7 +337,7 @@ public void UploadFile (long? PetId, string AdditionalMetadata, string File) {
332
337
333
338
334
339
// make the HTTP request
335
- IRestResponse response = ( IRestResponse ) apiClient . CallApi ( "/pet/{petId}/uploadImage" , Method . POST , queryParams , postBody , headerParams , formParams , fileParams ) ;
340
+ IRestResponse response = ( IRestResponse ) apiClient . CallApi ( path , Method . POST , queryParams , postBody , headerParams , formParams , fileParams ) ;
336
341
337
342
if ( ( ( int ) response . StatusCode ) >= 400 ) {
338
343
throw new ApiException ( ( int ) response . StatusCode , "Error calling UploadFile: " + response . Content ) ;
0 commit comments