@@ -10,7 +10,7 @@ import PromiseKit
10
10
11
11
extension PetstoreClientAPI {
12
12
13
- class PetAPI : APIBase {
13
+ public class PetAPI : APIBase {
14
14
15
15
/**
16
16
@@ -22,19 +22,19 @@ extension PetstoreClientAPI {
22
22
- type: oauth2
23
23
- name: petstore_auth
24
24
25
- :param: body (body) Pet object that needs to be added to the store
25
+ - parameter body: (body) Pet object that needs to be added to the store
26
26
27
- : returns: Promise<Response< Void> >
27
+ - returns: RequestBuilder< Void>
28
28
*/
29
- func updatePet( # body: Pet? ) -> RequestBuilder < Void > {
29
+ public class func updatePet( body body: Pet ? ) -> RequestBuilder < Void > {
30
30
let path = " /pet "
31
- let url = PetstoreClientAPI . basePath + path
31
+ let URLString = PetstoreClientAPI . basePath + path
32
32
33
33
let parameters = body? . encodeToJSON ( ) as? [ String : AnyObject ]
34
34
35
35
let requestBuilder : RequestBuilder < Void > . Type = PetstoreClientAPI . requestBuilderFactory. getBuilder ( )
36
36
37
- return requestBuilder ( method: " PUT " , URLString: url , parameters: parameters, isBody: true )
37
+ return requestBuilder. init ( method: " PUT " , URLString: URLString , parameters: parameters, isBody: true )
38
38
}
39
39
40
40
/**
@@ -47,19 +47,19 @@ extension PetstoreClientAPI {
47
47
- type: oauth2
48
48
- name: petstore_auth
49
49
50
- :param: body (body) Pet object that needs to be added to the store
50
+ - parameter body: (body) Pet object that needs to be added to the store
51
51
52
- : returns: Promise<Response< Void> >
52
+ - returns: RequestBuilder< Void>
53
53
*/
54
- func addPet( # body: Pet? ) -> RequestBuilder < Void > {
54
+ public class func addPet( body body: Pet ? ) -> RequestBuilder < Void > {
55
55
let path = " /pet "
56
- let url = PetstoreClientAPI . basePath + path
56
+ let URLString = PetstoreClientAPI . basePath + path
57
57
58
58
let parameters = body? . encodeToJSON ( ) as? [ String : AnyObject ]
59
59
60
60
let requestBuilder : RequestBuilder < Void > . Type = PetstoreClientAPI . requestBuilderFactory. getBuilder ( )
61
61
62
- return requestBuilder ( method: " POST " , URLString: url , parameters: parameters, isBody: true )
62
+ return requestBuilder. init ( method: " POST " , URLString: URLString , parameters: parameters, isBody: true )
63
63
}
64
64
65
65
/**
@@ -87,7 +87,11 @@ extension PetstoreClientAPI {
87
87
} ], contentType=application/json}, {example=<Pet>
88
88
<id>123456</id>
89
89
<name>doggie</name>
90
- <photoUrls>string</photoUrls>
90
+ <photoUrls>
91
+ <photoUrls>string</photoUrls>
92
+ </photoUrls>
93
+ <tags>
94
+ </tags>
91
95
<status>string</status>
92
96
</Pet>, contentType=application/xml}]
93
97
- examples: [{example=[ {
@@ -106,17 +110,21 @@ extension PetstoreClientAPI {
106
110
} ], contentType=application/json}, {example=<Pet>
107
111
<id>123456</id>
108
112
<name>doggie</name>
109
- <photoUrls>string</photoUrls>
113
+ <photoUrls>
114
+ <photoUrls>string</photoUrls>
115
+ </photoUrls>
116
+ <tags>
117
+ </tags>
110
118
<status>string</status>
111
119
</Pet>, contentType=application/xml}]
112
120
113
- :param: status (query) Status values that need to be considered for filter
121
+ - parameter status: (query) Status values that need to be considered for filter
114
122
115
- : returns: Promise<Response< [Pet]> >
123
+ - returns: RequestBuilder< [Pet]>
116
124
*/
117
- func findPetsByStatus( # status: [ String] ? ) -> RequestBuilder < [ Pet ] > {
125
+ public class func findPetsByStatus( status status: [ String ] ? ) -> RequestBuilder < [ Pet ] > {
118
126
let path = " /pet/findByStatus "
119
- let url = PetstoreClientAPI . basePath + path
127
+ let URLString = PetstoreClientAPI . basePath + path
120
128
121
129
let nillableParameters : [ String : AnyObject ? ] = [
122
130
" status " : status
@@ -125,7 +133,7 @@ extension PetstoreClientAPI {
125
133
126
134
let requestBuilder : RequestBuilder < [ Pet ] > . Type = PetstoreClientAPI . requestBuilderFactory. getBuilder ( )
127
135
128
- return requestBuilder ( method: " GET " , URLString: url , parameters: parameters, isBody: false )
136
+ return requestBuilder. init ( method: " GET " , URLString: URLString , parameters: parameters, isBody: false )
129
137
}
130
138
131
139
/**
@@ -153,7 +161,11 @@ extension PetstoreClientAPI {
153
161
} ], contentType=application/json}, {example=<Pet>
154
162
<id>123456</id>
155
163
<name>doggie</name>
156
- <photoUrls>string</photoUrls>
164
+ <photoUrls>
165
+ <photoUrls>string</photoUrls>
166
+ </photoUrls>
167
+ <tags>
168
+ </tags>
157
169
<status>string</status>
158
170
</Pet>, contentType=application/xml}]
159
171
- examples: [{example=[ {
@@ -172,17 +184,21 @@ extension PetstoreClientAPI {
172
184
} ], contentType=application/json}, {example=<Pet>
173
185
<id>123456</id>
174
186
<name>doggie</name>
175
- <photoUrls>string</photoUrls>
187
+ <photoUrls>
188
+ <photoUrls>string</photoUrls>
189
+ </photoUrls>
190
+ <tags>
191
+ </tags>
176
192
<status>string</status>
177
193
</Pet>, contentType=application/xml}]
178
194
179
- :param: tags (query) Tags to filter by
195
+ - parameter tags: (query) Tags to filter by
180
196
181
- : returns: Promise<Response< [Pet]> >
197
+ - returns: RequestBuilder< [Pet]>
182
198
*/
183
- func findPetsByTags( # tags: [ String] ? ) -> RequestBuilder < [ Pet ] > {
199
+ public class func findPetsByTags( tags tags: [ String ] ? ) -> RequestBuilder < [ Pet ] > {
184
200
let path = " /pet/findByTags "
185
- let url = PetstoreClientAPI . basePath + path
201
+ let URLString = PetstoreClientAPI . basePath + path
186
202
187
203
let nillableParameters : [ String : AnyObject ? ] = [
188
204
" tags " : tags
@@ -191,7 +207,7 @@ extension PetstoreClientAPI {
191
207
192
208
let requestBuilder : RequestBuilder < [ Pet ] > . Type = PetstoreClientAPI . requestBuilderFactory. getBuilder ( )
193
209
194
- return requestBuilder ( method: " GET " , URLString: url , parameters: parameters, isBody: false )
210
+ return requestBuilder. init ( method: " GET " , URLString: URLString , parameters: parameters, isBody: false )
195
211
}
196
212
197
213
/**
@@ -222,7 +238,11 @@ extension PetstoreClientAPI {
222
238
}, contentType=application/json}, {example=<Pet>
223
239
<id>123456</id>
224
240
<name>doggie</name>
225
- <photoUrls>string</photoUrls>
241
+ <photoUrls>
242
+ <photoUrls>string</photoUrls>
243
+ </photoUrls>
244
+ <tags>
245
+ </tags>
226
246
<status>string</status>
227
247
</Pet>, contentType=application/xml}]
228
248
- examples: [{example={
@@ -241,25 +261,29 @@ extension PetstoreClientAPI {
241
261
}, contentType=application/json}, {example=<Pet>
242
262
<id>123456</id>
243
263
<name>doggie</name>
244
- <photoUrls>string</photoUrls>
264
+ <photoUrls>
265
+ <photoUrls>string</photoUrls>
266
+ </photoUrls>
267
+ <tags>
268
+ </tags>
245
269
<status>string</status>
246
270
</Pet>, contentType=application/xml}]
247
271
248
- :param: petId (path) ID of pet that needs to be fetched
272
+ - parameter petId: (path) ID of pet that needs to be fetched
249
273
250
- : returns: Promise<Response< Pet> >
274
+ - returns: RequestBuilder< Pet>
251
275
*/
252
- func getPetById( # petId: Int) -> RequestBuilder < Pet > {
276
+ public class func getPetById( petId petId: Int ) -> RequestBuilder < Pet > {
253
277
var path = " /pet/{petId} "
254
278
path = path. stringByReplacingOccurrencesOfString ( " {petId} " , withString: " \( petId) " , options: . LiteralSearch, range: nil )
255
- let url = PetstoreClientAPI . basePath + path
279
+ let URLString = PetstoreClientAPI . basePath + path
256
280
257
281
let nillableParameters : [ String : AnyObject ? ] = [ : ]
258
282
let parameters = APIHelper . rejectNil ( nillableParameters)
259
283
260
284
let requestBuilder : RequestBuilder < Pet > . Type = PetstoreClientAPI . requestBuilderFactory. getBuilder ( )
261
285
262
- return requestBuilder ( method: " GET " , URLString: url , parameters: parameters, isBody: true )
286
+ return requestBuilder. init ( method: " GET " , URLString: URLString , parameters: parameters, isBody: true )
263
287
}
264
288
265
289
/**
@@ -272,23 +296,26 @@ extension PetstoreClientAPI {
272
296
- type: oauth2
273
297
- name: petstore_auth
274
298
275
- :param: petId (path) ID of pet that needs to be updated
276
- :param: name (form) Updated name of the pet
277
- :param: status (form) Updated status of the pet
299
+ - parameter petId: (path) ID of pet that needs to be updated
300
+ - parameter name: (form) Updated name of the pet
301
+ - parameter status: (form) Updated status of the pet
278
302
279
- : returns: Promise<Response< Void> >
303
+ - returns: RequestBuilder< Void>
280
304
*/
281
- func updatePetWithForm( # petId: String, name: String? , status: String? ) -> RequestBuilder < Void > {
305
+ public class func updatePetWithForm( petId petId: String , name: String ? , status: String ? ) -> RequestBuilder < Void > {
282
306
var path = " /pet/{petId} "
283
307
path = path. stringByReplacingOccurrencesOfString ( " {petId} " , withString: " \( petId) " , options: . LiteralSearch, range: nil )
284
- let url = PetstoreClientAPI . basePath + path
308
+ let URLString = PetstoreClientAPI . basePath + path
285
309
286
- let nillableParameters : [ String : AnyObject ? ] = [ : ]
310
+ let nillableParameters : [ String : AnyObject ? ] = [
311
+ " name " : name,
312
+ " status " : status
313
+ ]
287
314
let parameters = APIHelper . rejectNil ( nillableParameters)
288
315
289
316
let requestBuilder : RequestBuilder < Void > . Type = PetstoreClientAPI . requestBuilderFactory. getBuilder ( )
290
317
291
- return requestBuilder ( method: " POST " , URLString: url , parameters: parameters, isBody: true )
318
+ return requestBuilder. init ( method: " POST " , URLString: URLString , parameters: parameters, isBody: false )
292
319
}
293
320
294
321
/**
@@ -301,21 +328,21 @@ extension PetstoreClientAPI {
301
328
- type: oauth2
302
329
- name: petstore_auth
303
330
304
- :param: petId (path) Pet id to delete
331
+ - parameter petId: (path) Pet id to delete
305
332
306
- : returns: Promise<Response< Void> >
333
+ - returns: RequestBuilder< Void>
307
334
*/
308
- func deletePet( # petId: Int) -> RequestBuilder < Void > {
335
+ public class func deletePet( petId petId: Int ) -> RequestBuilder < Void > {
309
336
var path = " /pet/{petId} "
310
337
path = path. stringByReplacingOccurrencesOfString ( " {petId} " , withString: " \( petId) " , options: . LiteralSearch, range: nil )
311
- let url = PetstoreClientAPI . basePath + path
338
+ let URLString = PetstoreClientAPI . basePath + path
312
339
313
340
let nillableParameters : [ String : AnyObject ? ] = [ : ]
314
341
let parameters = APIHelper . rejectNil ( nillableParameters)
315
342
316
343
let requestBuilder : RequestBuilder < Void > . Type = PetstoreClientAPI . requestBuilderFactory. getBuilder ( )
317
344
318
- return requestBuilder ( method: " DELETE " , URLString: url , parameters: parameters, isBody: true )
345
+ return requestBuilder. init ( method: " DELETE " , URLString: URLString , parameters: parameters, isBody: true )
319
346
}
320
347
321
348
/**
@@ -328,23 +355,26 @@ extension PetstoreClientAPI {
328
355
- type: oauth2
329
356
- name: petstore_auth
330
357
331
- :param: petId (path) ID of pet to update
332
- :param: additionalMetadata (form) Additional data to pass to server
333
- :param: file (form) file to upload
358
+ - parameter petId: (path) ID of pet to update
359
+ - parameter additionalMetadata: (form) Additional data to pass to server
360
+ - parameter file: (form) file to upload
334
361
335
- : returns: Promise<Response< Void> >
362
+ - returns: RequestBuilder< Void>
336
363
*/
337
- func uploadFile( # petId: Int, additionalMetadata: String? , file: NSData ? ) -> RequestBuilder < Void > {
364
+ public class func uploadFile( petId petId : Int , additionalMetadata: String ? , file: NSURL ? ) -> RequestBuilder < Void > {
338
365
var path = " /pet/{petId}/uploadImage "
339
366
path = path. stringByReplacingOccurrencesOfString ( " {petId} " , withString: " \( petId) " , options: . LiteralSearch, range: nil )
340
- let url = PetstoreClientAPI . basePath + path
367
+ let URLString = PetstoreClientAPI . basePath + path
341
368
342
- let nillableParameters : [ String : AnyObject ? ] = [ : ]
369
+ let nillableParameters : [ String : AnyObject ? ] = [
370
+ " additionalMetadata " : additionalMetadata,
371
+ " file " : file
372
+ ]
343
373
let parameters = APIHelper . rejectNil ( nillableParameters)
344
374
345
375
let requestBuilder : RequestBuilder < Void > . Type = PetstoreClientAPI . requestBuilderFactory. getBuilder ( )
346
376
347
- return requestBuilder ( method: " POST " , URLString: url , parameters: parameters, isBody: true )
377
+ return requestBuilder. init ( method: " POST " , URLString: URLString , parameters: parameters, isBody: false )
348
378
}
349
379
350
380
}
0 commit comments