mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-20 09:17:05 +00:00
Compare commits
264 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ece072aee3 | ||
|
|
2386e394ae | ||
|
|
f55d9eaa68 | ||
|
|
0f041dae90 | ||
|
|
6c97a9c6c7 | ||
|
|
257d67346c | ||
|
|
e955c9dcfd | ||
|
|
63bb20238b | ||
|
|
55575541d8 | ||
|
|
33e6105822 | ||
|
|
87be442ad9 | ||
|
|
65b3b594e3 | ||
|
|
94ceb504b8 | ||
|
|
f914f26f3b | ||
|
|
4a6e719d6a | ||
|
|
61ea9564f8 | ||
|
|
bfc14938d0 | ||
|
|
c98a78062f | ||
|
|
fd128cbab0 | ||
|
|
59568915de | ||
|
|
bff2515bf2 | ||
|
|
dcaf639bec | ||
|
|
2f6bf95fa2 | ||
|
|
154c28b062 | ||
|
|
8106de95dc | ||
|
|
7c342a060a | ||
|
|
3abc42eee9 | ||
|
|
2d81c71b52 | ||
|
|
2d193a0e92 | ||
|
|
09e7bd9c43 | ||
|
|
0ece4a084f | ||
|
|
0821d1859b | ||
|
|
25aef5fd6e | ||
|
|
3a77287f8b | ||
|
|
d2111a8e68 | ||
|
|
3c0d639d0e | ||
|
|
1f30c65464 | ||
|
|
1b68671e98 | ||
|
|
586420b919 | ||
|
|
43a5ece5b3 | ||
|
|
9f6d883e68 | ||
|
|
524497a606 | ||
|
|
665ba22c7a | ||
|
|
0614d1b221 | ||
|
|
fb3f331e3c | ||
|
|
4e9378965b | ||
|
|
d1fe146522 | ||
|
|
b9758107c3 | ||
|
|
06332e5dce | ||
|
|
aa262f6021 | ||
|
|
88692ec42d | ||
|
|
a656ea301e | ||
|
|
5e4e838a48 | ||
|
|
f3dc69a7e7 | ||
|
|
12eba440ae | ||
|
|
4676c4cdf7 | ||
|
|
d5674c9a7b | ||
|
|
c8dac4a3cf | ||
|
|
6f30a6d65a | ||
|
|
9d1f0bf568 | ||
|
|
643c211d72 | ||
|
|
fb84985e9b | ||
|
|
afb34b4f2f | ||
|
|
1734ac2e18 | ||
|
|
72bef1fb68 | ||
|
|
ec99bef893 | ||
|
|
2fd29d74f2 | ||
|
|
033a9a4b97 | ||
|
|
885e463bcb | ||
|
|
b8f3201dba | ||
|
|
983edbd85b | ||
|
|
86d56b978a | ||
|
|
ed86bfb79b | ||
|
|
44a73c32fa | ||
|
|
39662e45b1 | ||
|
|
998bf633d8 | ||
|
|
b927ffbd53 | ||
|
|
1ff47393ed | ||
|
|
a6ecc7a65b | ||
|
|
dbf04a9563 | ||
|
|
d1603ba25e | ||
|
|
d4ce57bd15 | ||
|
|
5e56346dc9 | ||
|
|
05db83a067 | ||
|
|
707ee1c85b | ||
|
|
a54adb925f | ||
|
|
8c53837802 | ||
|
|
3625b89a15 | ||
|
|
2ed68c2df8 | ||
|
|
db1915ec89 | ||
|
|
77e9ce5ede | ||
|
|
013c19eb36 | ||
|
|
61c04ddaf1 | ||
|
|
b4d361130c | ||
|
|
8e7571c34f | ||
|
|
1ba42ef6cc | ||
|
|
fc77521d49 | ||
|
|
1522069281 | ||
|
|
a13f46e781 | ||
|
|
3ad1ecf153 | ||
|
|
6087181634 | ||
|
|
c09adc4539 | ||
|
|
a626dea181 | ||
|
|
454ec4b438 | ||
|
|
4a64d602a0 | ||
|
|
f294656073 | ||
|
|
c7da910e68 | ||
|
|
40d33693cf | ||
|
|
13eaf2bf63 | ||
|
|
d4508ed112 | ||
|
|
c252e9f7c6 | ||
|
|
6690b80b29 | ||
|
|
19bb97a725 | ||
|
|
62ee62ebd3 | ||
|
|
87083034ee | ||
|
|
d9de57da6f | ||
|
|
d0b0323925 | ||
|
|
f592414409 | ||
|
|
e1c8f58d28 | ||
|
|
4870ed7e51 | ||
|
|
bbe48814b4 | ||
|
|
3b6ffa4a1f | ||
|
|
527c40b996 | ||
|
|
3aa2c86991 | ||
|
|
e2a20447df | ||
|
|
5d42c8cc5f | ||
|
|
256485ec5b | ||
|
|
7ab0394e76 | ||
|
|
89b04b2e10 | ||
|
|
a019a438e0 | ||
|
|
9834059786 | ||
|
|
550fade9e0 | ||
|
|
aa1b4fc0fb | ||
|
|
5a659803a8 | ||
|
|
7bc7789e81 | ||
|
|
cf0721da73 | ||
|
|
dcbf4d1bfd | ||
|
|
017b578502 | ||
|
|
58bade3b01 | ||
|
|
02631e674a | ||
|
|
5f5e534d05 | ||
|
|
51deeb478d | ||
|
|
acff8229b3 | ||
|
|
233555790a | ||
|
|
d5ddac8e7e | ||
|
|
e8210cd5e3 | ||
|
|
2dc6b485e0 | ||
|
|
11bede2b7d | ||
|
|
ed51dd9dea | ||
|
|
218f514005 | ||
|
|
209e8e066c | ||
|
|
7d05b01a56 | ||
|
|
64f6bedc37 | ||
|
|
4ae4aa98bb | ||
|
|
db8bda087b | ||
|
|
06eb52118e | ||
|
|
63be7d0069 | ||
|
|
c7468125fa | ||
|
|
7b3d8bf799 | ||
|
|
c4913fe583 | ||
|
|
d3339cb087 | ||
|
|
ba4fda12dc | ||
|
|
7a6d6d27ff | ||
|
|
bcabb03225 | ||
|
|
a404823c54 | ||
|
|
96ea70e3c9 | ||
|
|
9a01331ddd | ||
|
|
3bfa468ed1 | ||
|
|
fdf8572535 | ||
|
|
cff8b1552d | ||
|
|
e73dd0a7c4 | ||
|
|
9c4c2dfd37 | ||
|
|
2f8355c953 | ||
|
|
3f480482b6 | ||
|
|
8274196999 | ||
|
|
4e8c71f754 | ||
|
|
57e7b41e9c | ||
|
|
58d9894f1f | ||
|
|
4b4d4d32cd | ||
|
|
6a2ea9f614 | ||
|
|
0d6754e167 | ||
|
|
cb5c2a9708 | ||
|
|
dc8ad7edf5 | ||
|
|
52bc82149f | ||
|
|
f53b5e27e0 | ||
|
|
ce5be3452c | ||
|
|
ce14c225e5 | ||
|
|
b78721826e | ||
|
|
85113df113 | ||
|
|
607b56cb87 | ||
|
|
2dbf8b7d41 | ||
|
|
7d4c10043d | ||
|
|
64604124c9 | ||
|
|
50f20ad836 | ||
|
|
ac40283501 | ||
|
|
e03d4fc1a5 | ||
|
|
05e9443db5 | ||
|
|
1250cc758f | ||
|
|
a18784da6c | ||
|
|
c87d637edd | ||
|
|
bf4a4e5296 | ||
|
|
4f7b80dad2 | ||
|
|
8a2f9bc7bb | ||
|
|
b9806c183b | ||
|
|
5aa4c4c999 | ||
|
|
424cfac80f | ||
|
|
715913f3b4 | ||
|
|
1c2c4fdcd3 | ||
|
|
2ea6c2a3a7 | ||
|
|
d91da857a0 | ||
|
|
31e65969b3 | ||
|
|
df250bc056 | ||
|
|
1569274684 | ||
|
|
6d8f751da4 | ||
|
|
c2dd00a4ab | ||
|
|
9e6ae6eef8 | ||
|
|
58b985ba02 | ||
|
|
b4f3143c8c | ||
|
|
84ad6b5d50 | ||
|
|
32c14af5ce | ||
|
|
46023c47f5 | ||
|
|
71212e5f68 | ||
|
|
6d1c34048c | ||
|
|
f67006057e | ||
|
|
e1e397a7b5 | ||
|
|
0f35799a77 | ||
|
|
be44221d98 | ||
|
|
94ad254a58 | ||
|
|
666a4be1f2 | ||
|
|
e542fbd0a2 | ||
|
|
f4b2d13aa4 | ||
|
|
abcae6da96 | ||
|
|
1b9b3eaa8e | ||
|
|
0babc4f192 | ||
|
|
e51ffb37b4 | ||
|
|
2fba96713c | ||
|
|
dccf8edc25 | ||
|
|
d98aeac818 | ||
|
|
62bfc4ea19 | ||
|
|
8d74029fba | ||
|
|
809cb5cf1f | ||
|
|
a4196609c9 | ||
|
|
e7eedcf48d | ||
|
|
8bf042b153 | ||
|
|
8325a12faf | ||
|
|
03abccd8e8 | ||
|
|
19e79fedb2 | ||
|
|
71eacaa3b1 | ||
|
|
7cfa46d838 | ||
|
|
7989e78460 | ||
|
|
08466f615f | ||
|
|
880d14990f | ||
|
|
39ac8f6d46 | ||
|
|
685fc7066f | ||
|
|
127600e728 | ||
|
|
d764328026 | ||
|
|
cae8296999 | ||
|
|
86efb71124 | ||
|
|
0899b08b8c | ||
|
|
a770db9d3e | ||
|
|
87b5c43166 | ||
|
|
d14ab2aeff | ||
|
|
b39a609226 | ||
|
|
d25f64cca0 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -28,3 +28,4 @@ target
|
|||||||
.lib
|
.lib
|
||||||
atlassian-ide-plugin.xml
|
atlassian-ide-plugin.xml
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
*~
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
language: scala
|
language: scala
|
||||||
scala:
|
scala:
|
||||||
- 2.10.2
|
- 2.10.0
|
||||||
|
|||||||
11
LICENSE
Normal file
11
LICENSE
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
Copyright 2014 Reverb Technologies, Inc.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
55
README.md
55
README.md
@@ -1,11 +1,28 @@
|
|||||||
# Swagger Code Generator
|
# Swagger Code Generator
|
||||||
|
|
||||||
[](https://travis-ci.org/wordnik/swagger-codegen)
|
[](https://travis-ci.org/swagger-api/swagger-codegen)
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
This is the swagger codegen project, which allows generation of client libraries automatically from a
|
This is the swagger codegen project, which allows generation of client libraries automatically from a
|
||||||
Swagger-compliant server. You can find out more about both the spec and the framework at
|
Swagger-compliant server.
|
||||||
http://swagger.wordnik.com. For more information about Wordnik's APIs, please visit http://developer.wordnik.com.
|
|
||||||
|
## What's Swagger?
|
||||||
|
|
||||||
|
The goal of Swagger™ is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, Swagger removes the guesswork in calling the service.
|
||||||
|
|
||||||
|
|
||||||
|
Check out [Swagger-Spec](https://github.com/swagger-api/swagger-spec) for additional information about the Swagger project, including additional libraries with support for other languages and more.
|
||||||
|
|
||||||
|
|
||||||
|
## Compatibility
|
||||||
|
The Swagger Specification has undergone 3 revisions since initial creation in 2010. Compatibility between swagger-codegen and the Swagger specification is as follows:
|
||||||
|
|
||||||
|
Swagger Codegen Version | Release Date | Swagger Spec compatibility | Notes
|
||||||
|
----------------------- | ------------ | -------------------------- | -----
|
||||||
|
2.1.0 (in development) | n/a | 1.0, 1.1, 1.2, 2.0 | [branch develop_2.0](https://github.com/swagger-api/swagger-codegen/tree/develop_2.0)
|
||||||
|
2.0.17 | 2014-08-22 | 1.1, 1.2 | [tag v2.0.17](https://github.com/swagger-api/swagger-codegen/tree/2.0.17)
|
||||||
|
1.0.4 | 2012-04-12 | 1.0, 1.1 | [tag v1.0.4](https://github.com/swagger-api/swagger-codegen/tree/swagger-codegen_2.9.1-1.1)
|
||||||
|
|
||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
You need the following installed and available in your $PATH:
|
You need the following installed and available in your $PATH:
|
||||||
@@ -16,7 +33,7 @@ Note! Some folks have had issues with OOM errors with java version "1.6.0_51".
|
|||||||
|
|
||||||
* [Apache maven 3.0.3 or greater](http://maven.apache.org/)
|
* [Apache maven 3.0.3 or greater](http://maven.apache.org/)
|
||||||
|
|
||||||
* [Scala 2.9.1](http://www.scala-lang.org)
|
* [Scala 2.10.4](http://www.scala-lang.org)
|
||||||
|
|
||||||
* [sbt (only download if you're building on Windows)](http://www.scala-sbt.org/)
|
* [sbt (only download if you're building on Windows)](http://www.scala-sbt.org/)
|
||||||
|
|
||||||
@@ -42,7 +59,7 @@ You can build a client against Wordnik's [petstore](http://petstore.swagger.word
|
|||||||
./bin/scala-petstore.sh
|
./bin/scala-petstore.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
This will run the script in [samples/client/petstore/ScalaPetstoreCodegen.scala](https://github.com/wordnik/swagger-codegen/blob/master/samples/client/petstore/scala/ScalaPetstoreCodegen.scala) and create the client. You can then
|
This will run the script in [samples/client/petstore/ScalaPetstoreCodegen.scala](https://github.com/swagger-api/swagger-codegen/blob/master/samples/client/petstore/scala/ScalaPetstoreCodegen.scala) and create the client. You can then
|
||||||
compile and run the client, as well as unit tests against it:
|
compile and run the client, as well as unit tests against it:
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -71,7 +88,7 @@ It's just as easy--you can either run the default generators:
|
|||||||
Replace `Scala` with `Flash`, `Java`, `Objc`, `PHP`, `Python`, `Python3`, `Ruby`.
|
Replace `Scala` with `Flash`, `Java`, `Objc`, `PHP`, `Python`, `Python3`, `Ruby`.
|
||||||
|
|
||||||
You will probably want to override some of the defaults--like packages, etc. For doing this, just create a scala
|
You will probably want to override some of the defaults--like packages, etc. For doing this, just create a scala
|
||||||
script with the overrides you want. Follow [ScalaPetstoreCodegen](https://github.com/wordnik/swagger-codegen/blob/master/samples/client/petstore/scala/ScalaPetstoreCodegen.scala) as an example:
|
script with the overrides you want. Follow [ScalaPetstoreCodegen](https://github.com/swagger-api/swagger-codegen/blob/master/samples/client/petstore/scala/ScalaPetstoreCodegen.scala) as an example:
|
||||||
|
|
||||||
For example, create `src/main/scala/MyCodegen.scala` with these contents:
|
For example, create `src/main/scala/MyCodegen.scala` with these contents:
|
||||||
|
|
||||||
@@ -121,15 +138,17 @@ You can look at `src/main/resources/${your-language}` for examples. To make you
|
|||||||
and override the `templateDir` in your script to point to the right place. It actually is that easy.
|
and override the `templateDir` in your script to point to the right place. It actually is that easy.
|
||||||
|
|
||||||
### Where is Javascript???
|
### Where is Javascript???
|
||||||
See our [javascript library](http://github.com/wordnik/swagger.js)--it's completely dynamic and doesn't require
|
See our [javascript library](http://github.com/swagger-api/swagger-js)--it's completely dynamic and doesn't require
|
||||||
static code generation.
|
static code generation.
|
||||||
|
There is a third-party component called [swagger-js-codegen](https://github.com/wcandillon/swagger-js-codegen) that can generate angularjs or nodejs source code from a swagger specification.
|
||||||
|
|
||||||
|
|
||||||
#### Generating a client from flat files (i.e. no remote server calls)
|
#### Generating a client from flat files (i.e. no remote server calls)
|
||||||
If you don't want to call your server, you can save the swagger spec files into a directory and pass an argument
|
If you don't want to call your server, you can save the swagger spec files into a directory and pass an argument
|
||||||
to the code generator like this:
|
to the code generator like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
-DfileMap=/path/to/files
|
-DfileMap=/path/to/resource-listing
|
||||||
```
|
```
|
||||||
|
|
||||||
Or for example:
|
Or for example:
|
||||||
@@ -142,7 +161,7 @@ ci server... or while coding on an airplane.
|
|||||||
|
|
||||||
### Validating your swagger spec
|
### Validating your swagger spec
|
||||||
You can use the validation tool to see that your server is creating a proper spec file. If you want to learn
|
You can use the validation tool to see that your server is creating a proper spec file. If you want to learn
|
||||||
more about the spec file and format, please see [swagger-core](https://github.com/wordnik/swagger-core/wiki). This
|
more about the spec file and format, please see [swagger-spec](https://github.com/swagger-api/swagger-spec). This
|
||||||
tool will read the server and generate a report of any violations of the spec. If there are violations, the
|
tool will read the server and generate a report of any violations of the spec. If there are violations, the
|
||||||
client codegen and ui may not work correctly.
|
client codegen and ui may not work correctly.
|
||||||
|
|
||||||
@@ -162,35 +181,35 @@ If you need to make static pages or don't want the sandbox of the swagger-ui, yo
|
|||||||
Will produce the output here:
|
Will produce the output here:
|
||||||
|
|
||||||
```
|
```
|
||||||
https://github.com/wordnik/swagger-codegen/tree/master/samples/docs/swagger-static-docs
|
https://github.com/swagger-api/swagger-codegen/tree/master/samples/swagger-static-docs/docs
|
||||||
```
|
```
|
||||||
|
|
||||||
which is based on these templates:
|
which is based on these templates:
|
||||||
|
|
||||||
```
|
```
|
||||||
https://github.com/wordnik/swagger-codegen/tree/master/src/main/resources/swagger-static
|
https://github.com/swagger-api/swagger-codegen/tree/master/src/main/resources/swagger-static
|
||||||
```
|
```
|
||||||
|
|
||||||
and looks like this
|
and looks like this
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### To build a server stub
|
### To build a server stub
|
||||||
|
|
||||||
You can also use the codegen to generate a server for a couple different frameworks. Take a look here:
|
You can also use the codegen to generate a server for a couple different frameworks. Take a look here:
|
||||||
|
|
||||||
* [javascript node.js Server generator](https://github.com/wordnik/swagger-codegen/tree/master/samples/server-generator/node)
|
* [javascript node.js Server generator](https://github.com/swagger-api/swagger-codegen/tree/master/samples/server-generator/node)
|
||||||
|
|
||||||
* [ruby sinatra generator](https://github.com/wordnik/swagger-codegen/tree/master/samples/server-generator/sinatra)
|
* [ruby sinatra generator](https://github.com/swagger-api/swagger-codegen/tree/master/samples/server-generator/sinatra)
|
||||||
|
|
||||||
* [scala scalatra generator](https://github.com/wordnik/swagger-codegen/tree/master/samples/server-generator/scalatra)
|
* [scala scalatra generator](https://github.com/swagger-api/swagger-codegen/tree/master/samples/server-generator/scalatra)
|
||||||
|
|
||||||
* [java jax-rs generator](https://github.com/wordnik/swagger-codegen/tree/master/samples/server-generator/java-jaxrs)
|
* [java jax-rs generator](https://github.com/swagger-api/swagger-codegen/tree/master/samples/server-generator/java-jaxrs)
|
||||||
|
|
||||||
|
|
||||||
### Migrating from Swagger 1.1 to 1.2 format
|
### Migrating from Swagger 1.1 to 1.2 format
|
||||||
|
|
||||||
If you've spent time hand-crafting your swagger spec files, you can use the [SpecConverter](https://github.com/wordnik/swagger-codegen/blob/master/src/main/scala/com/wordnik/swagger/codegen/SpecConverter.scala) to do the dirty work. For example:
|
If you've spent time hand-crafting your swagger spec files, you can use the [SpecConverter](https://github.com/swagger-api/swagger-codegen/blob/master/src/main/scala/com/wordnik/swagger/codegen/SpecConverter.scala) to do the dirty work. For example:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ./bin/update-spec.sh http://developer.wordnik.com/v4/resources.json wordnik-developer
|
$ ./bin/update-spec.sh http://developer.wordnik.com/v4/resources.json wordnik-developer
|
||||||
@@ -224,7 +243,7 @@ either repackage the library OR modify your codegen script to use a file path!
|
|||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
||||||
Copyright 2013 Wordnik, Inc.
|
Copyright 2014 Reverb Technologies, Inc.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
val version = scala.util.Properties.scalaPropOrElse("version.number", "unknown").toString match {
|
val version = scala.util.Properties.scalaPropOrElse("version.number", "unknown").toString match {
|
||||||
case "2.10.0" => "2.10"
|
case s if s startsWith "2.10" => "2.10"
|
||||||
case "2.10.2" => "2.10"
|
case s if s startsWith "2.11" => "2.11"
|
||||||
case "2.10.3" => "2.10"
|
|
||||||
case e: String => e
|
case e: String => e
|
||||||
}
|
}
|
||||||
println(version)
|
println(version)
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
SCRIPT="$0"
|
SCRIPT="$0"
|
||||||
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
while [ -h "$SCRIPT" ] ; do
|
||||||
ls=`ls -ld "$SCRIPT"`
|
ls=`ls -ld "$SCRIPT"`
|
||||||
@@ -19,14 +18,15 @@ if [ ! -d "${APP_DIR}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cd $APP_DIR
|
cd $APP_DIR
|
||||||
|
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
|
||||||
|
|
||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ samples/client/petstore/android-java/AndroidJavaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
ags="$@ samples/client/petstore/android-java/AndroidJavaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
|||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ samples/client/petstore/android-java/AndroidJavaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
ags="$@ samples/client/petstore/android-java/AndroidJavaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
|||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ samples/client/petstore/csharp/CsharpPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
ags="$@ samples/client/petstore/csharp/CsharpPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
|||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties "
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties "
|
||||||
ags="$@ samples/client/petstore/flash/FlashPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
ags="$@ samples/client/petstore/flash/FlashPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ cd $APP_DIR
|
|||||||
|
|
||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DfileMap=src/test/resources/petstore-1.1/resources.json -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DfileMap=src/test/resources/petstore-1.2/api-docs -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ samples/client/petstore/java/JavaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
ags="$@ samples/client/petstore/java/JavaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
|||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ samples/client/petstore/java/JavaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
ags="$@ samples/client/petstore/java/JavaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
|||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=samples/client/wordnik-api/spec-files/resources.json"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=samples/client/wordnik-api/spec-files/resources.json"
|
||||||
ags="$@ samples/client/wordnik-api/java/JavaWordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json"
|
ags="$@ samples/client/wordnik-api/java/JavaWordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ cd $APP_DIR
|
|||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ samples/client/petstore/objc/ObjcPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
ags="$@ samples/client/petstore/objc/ObjcPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ cd $APP_DIR
|
|||||||
|
|
||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=samples/client/wordnik-api/spec-files"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=samples/client/wordnik-api/spec-files/resources.json"
|
||||||
ags="$@ samples/client/wordnik-api/objc/ObjcWordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json"
|
ags="$@ samples/client/wordnik-api/objc/ObjcWordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
|||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ samples/client/petstore/php/PHPPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
ags="$@ samples/client/petstore/php/PHPPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
|||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=samples/client/wordnik-api/spec-files/resources.json"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=samples/client/wordnik-api/spec-files/resources.json"
|
||||||
ags="$@ samples/client/wordnik-api/php/PHPWordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json"
|
ags="$@ samples/client/wordnik-api/php/PHPWordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
|||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ samples/client/petstore/python/PythonPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
ags="$@ samples/client/petstore/python/PythonPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
|||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=samples/client/wordnik-api/spec-files/resources.json"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=samples/client/wordnik-api/spec-files/resources.json"
|
||||||
ags="$@ samples/client/wordnik-api/python/PythonWordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json"
|
ags="$@ samples/client/wordnik-api/python/PythonWordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
|||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ samples/client/petstore/python3/Python3PetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
ags="$@ samples/client/petstore/python3/Python3PetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
|||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=samples/client/wordnik-api/spec-files/resources.json"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=samples/client/wordnik-api/spec-files/resources.json"
|
||||||
ags="$@ samples/client/wordnik-api/python3/Python3WordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json"
|
ags="$@ samples/client/wordnik-api/python3/Python3WordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
|||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ samples/client/petstore/ruby/RubyPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
ags="$@ samples/client/petstore/ruby/RubyPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
SCRIPT="$0"
|
SCRIPT="$0"
|
||||||
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
while [ -h "$SCRIPT" ] ; do
|
||||||
ls=`ls -ld "$SCRIPT"`
|
ls=`ls -ld "$SCRIPT"`
|
||||||
@@ -19,14 +18,15 @@ if [ ! -d "${APP_DIR}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cd $APP_DIR
|
cd $APP_DIR
|
||||||
|
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
|
||||||
|
|
||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@"
|
ags="$@"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
SCRIPT="$0"
|
SCRIPT="$0"
|
||||||
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
|
SCALA_RUNNER_VERSION=2.10 #$(scala ./bin/Version.scala)
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
while [ -h "$SCRIPT" ] ; do
|
||||||
ls=`ls -ld "$SCRIPT"`
|
ls=`ls -ld "$SCRIPT"`
|
||||||
@@ -24,8 +24,8 @@ cd $APP_DIR
|
|||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
ags="com.wordnik.swagger.codegen.ScalaAsyncClientGenerator $@"
|
ags="com.wordnik.swagger.codegen.ScalaAsyncClientGenerator $@"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
java -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
|||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ samples/client/petstore/scala/ScalaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
ags="$@ samples/client/petstore/scala/ScalaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
|||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=samples/client/wordnik-api/spec-files/resources.json"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=samples/client/wordnik-api/spec-files/resources.json"
|
||||||
ags="$@ samples/client/wordnik-api/scala/ScalaWordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json"
|
ags="$@ samples/client/wordnik-api/scala/ScalaWordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ cd $APP_DIR
|
|||||||
|
|
||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=samples/client/wordnik-api/spec-files"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties "
|
||||||
ags="$@ SwaggerDocGenerator http://developer.wordnik.com/v4/resources.json"
|
ags="$@ com.wordnik.swagger.codegen.SwaggerDocGenerator http://petstore.swagger.wordnik.com/api/api-docs"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ cd $APP_DIR
|
|||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
ags="com.wordnik.swagger.codegen.SpecConverter $@"
|
ags="com.wordnik.swagger.codegen.SpecConverter $@"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ cd $APP_DIR
|
|||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
ags="com.wordnik.swagger.codegen.spec.Validator $@"
|
ags="com.wordnik.swagger.codegen.spec.Validator $@"
|
||||||
|
|
||||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||||
else
|
else
|
||||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||||
fi
|
fi
|
||||||
|
|||||||
30
build.sbt
30
build.sbt
@@ -5,9 +5,7 @@ organization := "com.wordnik"
|
|||||||
|
|
||||||
name := "swagger-codegen"
|
name := "swagger-codegen"
|
||||||
|
|
||||||
version := "2.0.13"
|
version := "2.0.18-SNAPSHOT"
|
||||||
|
|
||||||
scalaVersion := "2.10.1"
|
|
||||||
|
|
||||||
crossVersion := CrossVersion.full
|
crossVersion := CrossVersion.full
|
||||||
|
|
||||||
@@ -15,33 +13,39 @@ javacOptions ++= Seq("-target", "1.6", "-source", "1.6", "-Xlint:unchecked", "-X
|
|||||||
|
|
||||||
scalacOptions ++= Seq("-optimize", "-unchecked", "-deprecation", "-Xcheckinit", "-encoding", "utf8")
|
scalacOptions ++= Seq("-optimize", "-unchecked", "-deprecation", "-Xcheckinit", "-encoding", "utf8")
|
||||||
|
|
||||||
crossScalaVersions := Seq("2.9.0", "2.9.0-1", "2.9.1", "2.9.1-1", "2.9.2", "2.9.3", "2.10.0", "2.10.1", "2.10.2")
|
crossScalaVersions := Seq("2.10.4", "2.11.0", "2.11.1")
|
||||||
|
|
||||||
|
scalaVersion := "2.10.4"
|
||||||
|
|
||||||
libraryDependencies ++= Seq(
|
libraryDependencies ++= Seq(
|
||||||
"org.json4s" %% "json4s-jackson" % "3.2.5",
|
"org.json4s" %% "json4s-jackson" % "3.2.10",
|
||||||
"io.backchat.inflector" %% "scala-inflector" % "1.3.5",
|
"io.backchat.inflector" %% "scala-inflector" % "1.3.5",
|
||||||
"commons-io" % "commons-io" % "2.3",
|
"commons-io" % "commons-io" % "2.3",
|
||||||
|
"net.iharder" % "base64" % "2.3.8",
|
||||||
"ch.qos.logback" % "logback-classic" % "1.0.13" % "provided",
|
"ch.qos.logback" % "logback-classic" % "1.0.13" % "provided",
|
||||||
"org.rogach" %% "scallop" % "0.8.1",
|
"org.rogach" %% "scallop" % "0.9.5",
|
||||||
"junit" % "junit" % "4.11" % "test",
|
"junit" % "junit" % "4.11" % "test",
|
||||||
"org.scalatest" %% "scalatest" % "1.9.1" % "test"
|
"org.scalatest" %% "scalatest" % "2.1.7" % "test"
|
||||||
)
|
)
|
||||||
|
|
||||||
libraryDependencies <+= scalaVersion {
|
libraryDependencies <+= scalaVersion {
|
||||||
case v if v.startsWith("2.9") =>
|
case v if v.startsWith("2.9") =>
|
||||||
"org.fusesource.scalate" % "scalate-core_2.9" % "1.6.1"
|
"org.fusesource.scalate" % "scalate-core_2.9" % "1.6.1"
|
||||||
case v if v.startsWith("2.10") => {
|
case v if v.startsWith("2.10") =>
|
||||||
"org.fusesource.scalate" %% "scalate-core" % "1.6.1"
|
"org.scalatra.scalate" %% "scalate-core" % "1.7.0"
|
||||||
}
|
case v if v.startsWith("2.11") =>
|
||||||
|
"org.scalatra.scalate" %% "scalate-core" % "1.7.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
libraryDependencies ++= {
|
libraryDependencies ++= {
|
||||||
scalaVersion.toString match {
|
scalaVersion.toString match {
|
||||||
case v if v.startsWith("2.10") => Seq("org.scala-lang" % "scala-reflect" % v)
|
case v if v.startsWith("2.10") || v.startsWith("2.11") => Seq("org.scala-lang" % "scala-reflect" % v)
|
||||||
case _ => Seq()
|
case _ => Seq()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resolvers += "Typesafe releases" at "http://repo.typesafe.com/typesafe/releases"
|
||||||
|
|
||||||
packageOptions <+= (name, version, organization) map {
|
packageOptions <+= (name, version, organization) map {
|
||||||
(title, version, vendor) =>
|
(title, version, vendor) =>
|
||||||
Package.ManifestAttributes(
|
Package.ManifestAttributes(
|
||||||
@@ -65,7 +69,7 @@ publishTo <<= (version) { version: String =>
|
|||||||
Some("Sonatype Nexus Releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2")
|
Some("Sonatype Nexus Releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2")
|
||||||
}
|
}
|
||||||
|
|
||||||
//publishTo := Some(Resolver.file("file", new File(Path.userHome.absolutePath+"/.m2/repository")))
|
// publishTo := Some(Resolver.file("file", new File(Path.userHome.absolutePath+"/.m2/repository")))
|
||||||
|
|
||||||
artifact in (Compile, assembly) ~= { art =>
|
artifact in (Compile, assembly) ~= { art =>
|
||||||
art.copy(`classifier` = Some("assembly"))
|
art.copy(`classifier` = Some("assembly"))
|
||||||
@@ -130,4 +134,4 @@ pomExtra <<= (pomExtra, name, description) {(pom, name, desc) => pom ++ Group(
|
|||||||
|
|
||||||
assemblySettings
|
assemblySettings
|
||||||
|
|
||||||
jarName in assembly := "swagger-codegen.jar"
|
// jarName in assembly := "swagger-codegen.jar"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
sbt.version=0.13.0
|
sbt.version=0.13.5
|
||||||
@@ -1,2 +1,5 @@
|
|||||||
|
addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.2")
|
||||||
|
|
||||||
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.9.1")
|
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.9.1")
|
||||||
|
|
||||||
|
resolvers += "Sonatype OSS Releases" at "https://oss.sonatype.org/content/repositories/releases"
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013 Wordnik, Inc.
|
* Copyright 2014 Wordnik, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -42,6 +42,7 @@ object AndroidJavaPetstoreCodegen extends BasicAndroidJavaGenerator {
|
|||||||
// supporting classes
|
// supporting classes
|
||||||
override def supportingFiles = List(
|
override def supportingFiles = List(
|
||||||
("apiInvoker.mustache", destinationDir + java.io.File.separator + invokerPackage.get.replace(".", java.io.File.separator) + java.io.File.separator, "ApiInvoker.java"),
|
("apiInvoker.mustache", destinationDir + java.io.File.separator + invokerPackage.get.replace(".", java.io.File.separator) + java.io.File.separator, "ApiInvoker.java"),
|
||||||
|
("httpPatch.mustache", destinationDir + java.io.File.separator + invokerPackage.get.replace(".", java.io.File.separator) + java.io.File.separator, "HttpPatch.java"),
|
||||||
("jsonUtil.mustache", destinationDir + java.io.File.separator + invokerPackage.get.replace(".", java.io.File.separator) + java.io.File.separator, "JsonUtil.java"),
|
("jsonUtil.mustache", destinationDir + java.io.File.separator + invokerPackage.get.replace(".", java.io.File.separator) + java.io.File.separator, "JsonUtil.java"),
|
||||||
("apiException.mustache", destinationDir + java.io.File.separator + invokerPackage.get.replace(".", java.io.File.separator) + java.io.File.separator, "ApiException.java"),
|
("apiException.mustache", destinationDir + java.io.File.separator + invokerPackage.get.replace(".", java.io.File.separator) + java.io.File.separator, "ApiException.java"),
|
||||||
("pom.mustache", "samples/client/petstore/android-java", "pom.xml")
|
("pom.mustache", "samples/client/petstore/android-java", "pom.xml")
|
||||||
|
|||||||
@@ -104,55 +104,8 @@
|
|||||||
<target>1.6</target>
|
<target>1.6</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>net.alchim31.maven</groupId>
|
|
||||||
<artifactId>scala-maven-plugin</artifactId>
|
|
||||||
<version>${scala-maven-plugin-version}</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<goals>
|
|
||||||
<goal>compile</goal>
|
|
||||||
<goal>testCompile</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
<configuration>
|
|
||||||
<configuration>
|
|
||||||
<recompileMode>incremental</recompileMode>
|
|
||||||
</configuration>
|
|
||||||
<jvmArgs>
|
|
||||||
<jvmArg>-Xmx384m</jvmArg>
|
|
||||||
</jvmArgs>
|
|
||||||
<args>
|
|
||||||
<arg>-target:jvm-1.5</arg>
|
|
||||||
<arg>-deprecation</arg>
|
|
||||||
</args>
|
|
||||||
<launchers>
|
|
||||||
<launcher>
|
|
||||||
<id>run-scalatest</id>
|
|
||||||
<mainClass>org.scalatest.tools.Runner</mainClass>
|
|
||||||
<args>
|
|
||||||
<arg>-p</arg>
|
|
||||||
<arg>${project.build.testOutputDirectory}</arg>
|
|
||||||
</args>
|
|
||||||
<jvmArgs>
|
|
||||||
<jvmArg>-Xmx512m</jvmArg>
|
|
||||||
</jvmArgs>
|
|
||||||
</launcher>
|
|
||||||
</launchers>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<reporting>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>net.alchim31.maven</groupId>
|
|
||||||
<artifactId>scala-maven-plugin</artifactId>
|
|
||||||
<version>${scala-maven-plugin-version}</version>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</reporting>
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
@@ -178,20 +131,26 @@
|
|||||||
<version>${httpclient-version}</version>
|
<version>${httpclient-version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.httpcomponents</groupId>
|
||||||
|
<artifactId>httpcore</artifactId>
|
||||||
|
<version>${httpclient-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.httpcomponents</groupId>
|
||||||
|
<artifactId>httpmime</artifactId>
|
||||||
|
<version>${httpclient-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.android</groupId>
|
||||||
|
<artifactId>android</artifactId>
|
||||||
|
<version>4.1.1.4</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- test dependencies -->
|
<!-- test dependencies -->
|
||||||
<dependency>
|
|
||||||
<groupId>org.scala-lang</groupId>
|
|
||||||
<artifactId>scala-library</artifactId>
|
|
||||||
<version>${scala-version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.scalatest</groupId>
|
|
||||||
<artifactId>scalatest_2.9.1</artifactId>
|
|
||||||
<version>${scala-test-version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
@@ -202,13 +161,10 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<jackson-version>2.1.4</jackson-version>
|
<jackson-version>2.1.4</jackson-version>
|
||||||
<scala-version>2.9.1-1</scala-version>
|
|
||||||
<junit-version>4.8.1</junit-version>
|
<junit-version>4.8.1</junit-version>
|
||||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||||
<junit-version>4.8.1</junit-version>
|
<junit-version>4.8.1</junit-version>
|
||||||
<scala-test-version>1.6.1</scala-test-version>
|
<httpclient-version>4.3</httpclient-version>
|
||||||
<httpclient-version>4.2.3</httpclient-version>
|
|
||||||
<scala-maven-plugin-version>3.1.5</scala-maven-plugin-version>
|
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,20 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|||||||
import org.apache.http.*;
|
import org.apache.http.*;
|
||||||
import org.apache.http.client.*;
|
import org.apache.http.client.*;
|
||||||
import org.apache.http.client.methods.*;
|
import org.apache.http.client.methods.*;
|
||||||
|
import org.apache.http.conn.*;
|
||||||
|
import org.apache.http.conn.scheme.*;
|
||||||
|
import org.apache.http.conn.ssl.*;
|
||||||
|
import org.apache.http.entity.mime.*;
|
||||||
import org.apache.http.entity.StringEntity;
|
import org.apache.http.entity.StringEntity;
|
||||||
|
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||||
import org.apache.http.impl.client.*;
|
import org.apache.http.impl.client.*;
|
||||||
|
import org.apache.http.impl.conn.*;
|
||||||
|
import org.apache.http.params.*;
|
||||||
import org.apache.http.util.EntityUtils;
|
import org.apache.http.util.EntityUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.net.Socket;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -22,15 +31,50 @@ import java.util.List;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
|
import java.security.GeneralSecurityException;
|
||||||
|
import java.security.KeyManagementException;
|
||||||
|
import java.security.KeyStore;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.SecureRandom;
|
||||||
|
import java.security.cert.*;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.crypto.Mac;
|
||||||
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.TrustManager;
|
||||||
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
|
||||||
public class ApiInvoker {
|
public class ApiInvoker {
|
||||||
private static ApiInvoker INSTANCE = new ApiInvoker();
|
private static ApiInvoker INSTANCE = new ApiInvoker();
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
|
|
||||||
private HttpClient client = null;
|
private HttpClient client = null;
|
||||||
|
|
||||||
|
private boolean ignoreSSLCertificates = false;
|
||||||
|
|
||||||
|
private ClientConnectionManager ignoreSSLConnectionManager;
|
||||||
|
|
||||||
|
public ApiInvoker() {
|
||||||
|
initConnectionManager();
|
||||||
|
}
|
||||||
|
|
||||||
public static ApiInvoker getInstance() {
|
public static ApiInvoker getInstance() {
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ignoreSSLCertificates(boolean ignoreSSLCertificates) {
|
||||||
|
this.ignoreSSLCertificates = ignoreSSLCertificates;
|
||||||
|
}
|
||||||
|
|
||||||
public void addDefaultHeader(String key, String value) {
|
public void addDefaultHeader(String key, String value) {
|
||||||
defaultHeaderMap.put(key, value);
|
defaultHeaderMap.put(key, value);
|
||||||
}
|
}
|
||||||
@@ -114,8 +158,24 @@ public class ApiInvoker {
|
|||||||
}
|
}
|
||||||
else if ("POST".equals(method)) {
|
else if ("POST".equals(method)) {
|
||||||
HttpPost post = new HttpPost(url);
|
HttpPost post = new HttpPost(url);
|
||||||
post.setHeader("Content-Type", contentType);
|
if (body != null) {
|
||||||
post.setEntity(new StringEntity(serialize(body), "UTF-8"));
|
if("application/x-www-form-urlencoded".equals(contentType)) {
|
||||||
|
post.setHeader("Content-Type", contentType);
|
||||||
|
post.setEntity(new UrlEncodedFormEntity((List<NameValuePair>)body));
|
||||||
|
}
|
||||||
|
else if("multipart/form-data".equals(contentType)) {
|
||||||
|
String boundary = "-------------" + System.currentTimeMillis();
|
||||||
|
post.setHeader("Content-type", "multipart/form-data; boundary="+boundary);
|
||||||
|
MultipartEntityBuilder builder = (MultipartEntityBuilder)body;
|
||||||
|
builder.setBoundary(boundary);
|
||||||
|
post.setEntity(builder.build());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
post.setHeader("Content-Type", contentType);
|
||||||
|
post.setEntity(new StringEntity(serialize(body), "UTF-8"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
for(String key : headers.keySet()) {
|
for(String key : headers.keySet()) {
|
||||||
post.setHeader(key, headers.get(key));
|
post.setHeader(key, headers.get(key));
|
||||||
}
|
}
|
||||||
@@ -124,8 +184,21 @@ public class ApiInvoker {
|
|||||||
else if ("PUT".equals(method)) {
|
else if ("PUT".equals(method)) {
|
||||||
HttpPut put = new HttpPut(url);
|
HttpPut put = new HttpPut(url);
|
||||||
if(body != null) {
|
if(body != null) {
|
||||||
put.setHeader("Content-Type", contentType);
|
if("application/x-www-form-urlencoded".equals(contentType)) {
|
||||||
put.setEntity(new StringEntity(serialize(body), "UTF-8"));
|
put.setHeader("Content-Type", contentType);
|
||||||
|
put.setEntity(new UrlEncodedFormEntity((List<NameValuePair>)body));
|
||||||
|
}
|
||||||
|
else if("multipart/form-data".equals(contentType)) {
|
||||||
|
String boundary = "-------------" + System.currentTimeMillis();
|
||||||
|
put.setHeader("Content-type", "multipart/form-data; boundary="+boundary);
|
||||||
|
MultipartEntityBuilder builder = (MultipartEntityBuilder)body;
|
||||||
|
builder.setBoundary(boundary);
|
||||||
|
put.setEntity(builder.build());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
put.setHeader("Content-Type", contentType);
|
||||||
|
put.setEntity(new StringEntity(serialize(body), "UTF-8"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for(String key : headers.keySet()) {
|
for(String key : headers.keySet()) {
|
||||||
put.setHeader(key, headers.get(key));
|
put.setHeader(key, headers.get(key));
|
||||||
@@ -139,6 +212,18 @@ public class ApiInvoker {
|
|||||||
}
|
}
|
||||||
response = client.execute(delete);
|
response = client.execute(delete);
|
||||||
}
|
}
|
||||||
|
else if ("PATCH".equals(method)) {
|
||||||
|
HttpPatch patch = new HttpPatch(url);
|
||||||
|
|
||||||
|
if (body != null) {
|
||||||
|
patch.setHeader("Content-Type", contentType);
|
||||||
|
patch.setEntity(new StringEntity(serialize(body), "UTF-8"));
|
||||||
|
}
|
||||||
|
for(String key : headers.keySet()) {
|
||||||
|
patch.setHeader(key, headers.get(key));
|
||||||
|
}
|
||||||
|
response = client.execute(patch);
|
||||||
|
}
|
||||||
|
|
||||||
int code = response.getStatusLine().getStatusCode();
|
int code = response.getStatusLine().getStatusCode();
|
||||||
String responseString = null;
|
String responseString = null;
|
||||||
@@ -167,8 +252,61 @@ public class ApiInvoker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private HttpClient getClient(String host) {
|
private HttpClient getClient(String host) {
|
||||||
if(client == null)
|
if (client == null) {
|
||||||
client = new DefaultHttpClient();
|
if (ignoreSSLCertificates && ignoreSSLConnectionManager != null) {
|
||||||
|
// Trust self signed certificates
|
||||||
|
client = new DefaultHttpClient(ignoreSSLConnectionManager, new BasicHttpParams());
|
||||||
|
} else {
|
||||||
|
client = new DefaultHttpClient();
|
||||||
|
}
|
||||||
|
}
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initConnectionManager() {
|
||||||
|
try {
|
||||||
|
final SSLContext sslContext = SSLContext.getInstance("SSL");
|
||||||
|
|
||||||
|
// set up a TrustManager that trusts everything
|
||||||
|
TrustManager[] trustManagers = new TrustManager[] {
|
||||||
|
new X509TrustManager() {
|
||||||
|
public X509Certificate[] getAcceptedIssuers() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public void checkClientTrusted(X509Certificate[] certs, String authType) {}
|
||||||
|
public void checkServerTrusted(X509Certificate[] certs, String authType) {}
|
||||||
|
}};
|
||||||
|
|
||||||
|
sslContext.init(null, trustManagers, new SecureRandom());
|
||||||
|
|
||||||
|
SSLSocketFactory sf = new SSLSocketFactory((KeyStore)null) {
|
||||||
|
private javax.net.ssl.SSLSocketFactory sslFactory = sslContext.getSocketFactory();
|
||||||
|
|
||||||
|
public Socket createSocket(Socket socket, String host, int port, boolean autoClose)
|
||||||
|
throws IOException, UnknownHostException {
|
||||||
|
return sslFactory.createSocket(socket, host, port, autoClose);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Socket createSocket() throws IOException {
|
||||||
|
return sslFactory.createSocket();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
||||||
|
Scheme httpsScheme = new Scheme("https", sf, 443);
|
||||||
|
SchemeRegistry schemeRegistry = new SchemeRegistry();
|
||||||
|
schemeRegistry.register(httpsScheme);
|
||||||
|
schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
|
||||||
|
|
||||||
|
ignoreSSLConnectionManager = new SingleClientConnManager(new BasicHttpParams(), schemeRegistry);
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
// This will only be thrown if SSL isn't available for some reason.
|
||||||
|
} catch (KeyManagementException e) {
|
||||||
|
// This might be thrown when passing a key into init(), but no key is being passed.
|
||||||
|
} catch (GeneralSecurityException e) {
|
||||||
|
// This catches anything else that might go wrong.
|
||||||
|
// If anything goes wrong we default to the standard connection manager.
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.wordnik.client;
|
||||||
|
|
||||||
|
import org.apache.http.client.methods.*;
|
||||||
|
|
||||||
|
public class HttpPatch extends HttpPost {
|
||||||
|
public static final String METHOD_PATCH = "PATCH";
|
||||||
|
|
||||||
|
public HttpPatch(final String url) {
|
||||||
|
super(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMethod() {
|
||||||
|
return METHOD_PATCH;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,9 +2,17 @@ package com.wordnik.petstore.api;
|
|||||||
|
|
||||||
import com.wordnik.client.ApiException;
|
import com.wordnik.client.ApiException;
|
||||||
import com.wordnik.client.ApiInvoker;
|
import com.wordnik.client.ApiInvoker;
|
||||||
import java.io.File;
|
|
||||||
import com.wordnik.petstore.model.Pet;
|
import com.wordnik.petstore.model.Pet;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import org.apache.http.NameValuePair;
|
||||||
|
import org.apache.http.message.BasicNameValuePair;
|
||||||
|
import org.apache.http.entity.mime.*;
|
||||||
|
import org.apache.http.entity.mime.content.*;
|
||||||
|
import org.apache.http.entity.ContentType;
|
||||||
|
|
||||||
|
import android.webkit.MimeTypeMap;
|
||||||
|
|
||||||
public class PetApi {
|
public class PetApi {
|
||||||
String basePath = "http://petstore.swagger.wordnik.com/api";
|
String basePath = "http://petstore.swagger.wordnik.com/api";
|
||||||
@@ -26,7 +34,234 @@ public class PetApi {
|
|||||||
return basePath;
|
return basePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pet getPetById (Long petId) throws ApiException {
|
private static String getMimeType(File file) {
|
||||||
|
MimeTypeMap mime = MimeTypeMap.getSingleton();
|
||||||
|
int index = file.getName().lastIndexOf('.')+1;
|
||||||
|
String ext = file.getName().substring(index).toLowerCase();
|
||||||
|
return mime.getMimeTypeFromExtension(ext);
|
||||||
|
}
|
||||||
|
|
||||||
|
//error info- code: 400 reason: "Invalid ID supplied" model: <none>
|
||||||
|
//error info- code: 404 reason: "Pet not found" model: <none>
|
||||||
|
//error info- code: 405 reason: "Validation exception" model: <none>
|
||||||
|
public void updatePet (Pet body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
|
// verify required params are set
|
||||||
|
if(body == null ) {
|
||||||
|
throw new ApiException(400, "missing required params");
|
||||||
|
}
|
||||||
|
// create path and map variables
|
||||||
|
String path = "/pet".replaceAll("\\{format\\}","json");
|
||||||
|
|
||||||
|
// query params
|
||||||
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
List<NameValuePair> mp = new ArrayList<NameValuePair>();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
|
if(hasFields)
|
||||||
|
postBody = builder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postBody = body;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, contentType);
|
||||||
|
if(response != null){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
} catch (ApiException ex) {
|
||||||
|
if(ex.getCode() == 404) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//error info- code: 405 reason: "Invalid input" model: <none>
|
||||||
|
public void addPet (Pet body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
|
// verify required params are set
|
||||||
|
if(body == null ) {
|
||||||
|
throw new ApiException(400, "missing required params");
|
||||||
|
}
|
||||||
|
// create path and map variables
|
||||||
|
String path = "/pet".replaceAll("\\{format\\}","json");
|
||||||
|
|
||||||
|
// query params
|
||||||
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
String[] contentTypes = {
|
||||||
|
"application/json","application/xml"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
List<NameValuePair> mp = new ArrayList<NameValuePair>();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
|
if(hasFields)
|
||||||
|
postBody = builder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postBody = body;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, contentType);
|
||||||
|
if(response != null){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
} catch (ApiException ex) {
|
||||||
|
if(ex.getCode() == 404) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//error info- code: 400 reason: "Invalid status value" model: <none>
|
||||||
|
public List<Pet> findPetsByStatus (String status) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
|
// verify required params are set
|
||||||
|
if(status == null ) {
|
||||||
|
throw new ApiException(400, "missing required params");
|
||||||
|
}
|
||||||
|
// create path and map variables
|
||||||
|
String path = "/pet/findByStatus".replaceAll("\\{format\\}","json");
|
||||||
|
|
||||||
|
// query params
|
||||||
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
if(!"null".equals(String.valueOf(status)))
|
||||||
|
queryParams.put("status", String.valueOf(status));
|
||||||
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
List<NameValuePair> mp = new ArrayList<NameValuePair>();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
|
if(hasFields)
|
||||||
|
postBody = builder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postBody = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType);
|
||||||
|
if(response != null){
|
||||||
|
return (List<Pet>) ApiInvoker.deserialize(response, "List", Pet.class);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} catch (ApiException ex) {
|
||||||
|
if(ex.getCode() == 404) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//error info- code: 400 reason: "Invalid tag value" model: <none>
|
||||||
|
public List<Pet> findPetsByTags (String tags) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
|
// verify required params are set
|
||||||
|
if(tags == null ) {
|
||||||
|
throw new ApiException(400, "missing required params");
|
||||||
|
}
|
||||||
|
// create path and map variables
|
||||||
|
String path = "/pet/findByTags".replaceAll("\\{format\\}","json");
|
||||||
|
|
||||||
|
// query params
|
||||||
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
if(!"null".equals(String.valueOf(tags)))
|
||||||
|
queryParams.put("tags", String.valueOf(tags));
|
||||||
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
List<NameValuePair> mp = new ArrayList<NameValuePair>();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
|
if(hasFields)
|
||||||
|
postBody = builder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postBody = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType);
|
||||||
|
if(response != null){
|
||||||
|
return (List<Pet>) ApiInvoker.deserialize(response, "List", Pet.class);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} catch (ApiException ex) {
|
||||||
|
if(ex.getCode() == 404) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//error info- code: 405 reason: "Invalid input" model: <none>
|
||||||
|
public void updatePetWithForm (String petId, String name, String status) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(petId == null ) {
|
if(petId == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -38,10 +273,92 @@ public class PetApi {
|
|||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/x-www-form-urlencoded"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
List<NameValuePair> mp = new ArrayList<NameValuePair>();
|
||||||
|
hasFields = true;
|
||||||
|
mp.add(new BasicNameValuePair("name", name));
|
||||||
|
hasFields = true;
|
||||||
|
mp.add(new BasicNameValuePair("status", status));
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
|
hasFields = true;
|
||||||
|
builder.addTextBody("name", name.toString());
|
||||||
|
hasFields = true;
|
||||||
|
builder.addTextBody("status", status.toString());
|
||||||
|
if(hasFields)
|
||||||
|
postBody = builder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postBody = null;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, contentType);
|
||||||
|
if(response != null){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
} catch (ApiException ex) {
|
||||||
|
if(ex.getCode() == 404) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//error info- code: 400 reason: "Invalid ID supplied" model: <none>
|
||||||
|
//error info- code: 404 reason: "Pet not found" model: <none>
|
||||||
|
public Pet getPetById (Long petId) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
|
// verify required params are set
|
||||||
|
if(petId == null ) {
|
||||||
|
throw new ApiException(400, "missing required params");
|
||||||
|
}
|
||||||
|
// create path and map variables
|
||||||
|
String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
|
||||||
|
|
||||||
|
// query params
|
||||||
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
List<NameValuePair> mp = new ArrayList<NameValuePair>();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
|
if(hasFields)
|
||||||
|
postBody = builder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postBody = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return (Pet) ApiInvoker.deserialize(response, "", Pet.class);
|
return (Pet) ApiInvoker.deserialize(response, "", Pet.class);
|
||||||
}
|
}
|
||||||
@@ -57,7 +374,9 @@ public class PetApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//error info- code: 400 reason: "Invalid pet value" model: <none>
|
||||||
public void deletePet (String petId) throws ApiException {
|
public void deletePet (String petId) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(petId == null ) {
|
if(petId == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -69,10 +388,30 @@ public class PetApi {
|
|||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
List<NameValuePair> mp = new ArrayList<NameValuePair>();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
|
if(hasFields)
|
||||||
|
postBody = builder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postBody = null;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@@ -88,7 +427,9 @@ public class PetApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//error info- code: 400 reason: "Invalid tag value" model: <none>
|
||||||
public List<Pet> partialUpdate (String petId, Pet body) throws ApiException {
|
public List<Pet> partialUpdate (String petId, Pet body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(petId == null || body == null ) {
|
if(petId == null || body == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -100,12 +441,32 @@ public class PetApi {
|
|||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json","application/xml"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
List<NameValuePair> mp = new ArrayList<NameValuePair>();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
|
if(hasFields)
|
||||||
|
postBody = builder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postBody = body;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "PATCH", queryParams, body, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "PATCH", queryParams, postBody, headerParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return (List<Pet>) ApiInvoker.deserialize(response, "Array", Pet.class);
|
return (List<Pet>) ApiInvoker.deserialize(response, "List", Pet.class);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return null;
|
return null;
|
||||||
@@ -119,38 +480,8 @@ public class PetApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void updatePetWithForm (String petId, String name, String status) throws ApiException {
|
public void uploadFile (String additionalMetadata, File file) throws ApiException {
|
||||||
// verify required params are set
|
Object postBody = null;
|
||||||
if(petId == null ) {
|
|
||||||
throw new ApiException(400, "missing required params");
|
|
||||||
}
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
|
|
||||||
|
|
||||||
// query params
|
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
|
||||||
|
|
||||||
String contentType = "application/json";
|
|
||||||
|
|
||||||
try {
|
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams, contentType);
|
|
||||||
if(response != null){
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
if(ex.getCode() == 404) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void uploadFile (String additionalMetadata, File body) throws ApiException {
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
String path = "/pet/uploadImage".replaceAll("\\{format\\}","json");
|
String path = "/pet/uploadImage".replaceAll("\\{format\\}","json");
|
||||||
|
|
||||||
@@ -158,10 +489,36 @@ public class PetApi {
|
|||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"multipart/form-data"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
List<NameValuePair> mp = new ArrayList<NameValuePair>();
|
||||||
|
hasFields = true;
|
||||||
|
mp.add(new BasicNameValuePair("additionalMetadata", additionalMetadata));
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
|
hasFields = true;
|
||||||
|
builder.addTextBody("additionalMetadata", additionalMetadata.toString());
|
||||||
|
hasFields = true;
|
||||||
|
builder.addBinaryBody("file", file, ContentType.create(getMimeType(file)), file.getName());
|
||||||
|
if(hasFields)
|
||||||
|
postBody = builder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postBody = null;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@@ -177,133 +534,5 @@ public class PetApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void addPet (Pet body) throws ApiException {
|
|
||||||
// verify required params are set
|
|
||||||
if(body == null ) {
|
|
||||||
throw new ApiException(400, "missing required params");
|
|
||||||
}
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet".replaceAll("\\{format\\}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
|
||||||
|
|
||||||
String contentType = "application/json";
|
|
||||||
|
|
||||||
try {
|
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
|
||||||
if(response != null){
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
if(ex.getCode() == 404) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void updatePet (Pet body) throws ApiException {
|
|
||||||
// verify required params are set
|
|
||||||
if(body == null ) {
|
|
||||||
throw new ApiException(400, "missing required params");
|
|
||||||
}
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet".replaceAll("\\{format\\}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
|
||||||
|
|
||||||
String contentType = "application/json";
|
|
||||||
|
|
||||||
try {
|
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams, contentType);
|
|
||||||
if(response != null){
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
if(ex.getCode() == 404) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public List<Pet> findPetsByStatus (String status) throws ApiException {
|
|
||||||
// verify required params are set
|
|
||||||
if(status == null ) {
|
|
||||||
throw new ApiException(400, "missing required params");
|
|
||||||
}
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet/findByStatus".replaceAll("\\{format\\}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
|
||||||
|
|
||||||
if(!"null".equals(String.valueOf(status)))
|
|
||||||
queryParams.put("status", String.valueOf(status));
|
|
||||||
String contentType = "application/json";
|
|
||||||
|
|
||||||
try {
|
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
|
||||||
if(response != null){
|
|
||||||
return (List<Pet>) ApiInvoker.deserialize(response, "Array", Pet.class);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
if(ex.getCode() == 404) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public List<Pet> findPetsByTags (String tags) throws ApiException {
|
|
||||||
// verify required params are set
|
|
||||||
if(tags == null ) {
|
|
||||||
throw new ApiException(400, "missing required params");
|
|
||||||
}
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet/findByTags".replaceAll("\\{format\\}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
|
||||||
|
|
||||||
if(!"null".equals(String.valueOf(tags)))
|
|
||||||
queryParams.put("tags", String.valueOf(tags));
|
|
||||||
String contentType = "application/json";
|
|
||||||
|
|
||||||
try {
|
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
|
||||||
if(response != null){
|
|
||||||
return (List<Pet>) ApiInvoker.deserialize(response, "Array", Pet.class);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
if(ex.getCode() == 404) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,15 @@ import com.wordnik.client.ApiException;
|
|||||||
import com.wordnik.client.ApiInvoker;
|
import com.wordnik.client.ApiInvoker;
|
||||||
import com.wordnik.petstore.model.Order;
|
import com.wordnik.petstore.model.Order;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import org.apache.http.NameValuePair;
|
||||||
|
import org.apache.http.message.BasicNameValuePair;
|
||||||
|
import org.apache.http.entity.mime.*;
|
||||||
|
import org.apache.http.entity.mime.content.*;
|
||||||
|
import org.apache.http.entity.ContentType;
|
||||||
|
|
||||||
|
import android.webkit.MimeTypeMap;
|
||||||
|
|
||||||
public class StoreApi {
|
public class StoreApi {
|
||||||
String basePath = "http://petstore.swagger.wordnik.com/api";
|
String basePath = "http://petstore.swagger.wordnik.com/api";
|
||||||
@@ -25,7 +34,70 @@ public class StoreApi {
|
|||||||
return basePath;
|
return basePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Order getOrderById (String orderId) throws ApiException {
|
private static String getMimeType(File file) {
|
||||||
|
MimeTypeMap mime = MimeTypeMap.getSingleton();
|
||||||
|
int index = file.getName().lastIndexOf('.')+1;
|
||||||
|
String ext = file.getName().substring(index).toLowerCase();
|
||||||
|
return mime.getMimeTypeFromExtension(ext);
|
||||||
|
}
|
||||||
|
|
||||||
|
//error info- code: 400 reason: "Invalid order" model: <none>
|
||||||
|
public void placeOrder (Order body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
|
// verify required params are set
|
||||||
|
if(body == null ) {
|
||||||
|
throw new ApiException(400, "missing required params");
|
||||||
|
}
|
||||||
|
// create path and map variables
|
||||||
|
String path = "/store/order".replaceAll("\\{format\\}","json");
|
||||||
|
|
||||||
|
// query params
|
||||||
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
List<NameValuePair> mp = new ArrayList<NameValuePair>();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
|
if(hasFields)
|
||||||
|
postBody = builder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postBody = body;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, contentType);
|
||||||
|
if(response != null){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
} catch (ApiException ex) {
|
||||||
|
if(ex.getCode() == 404) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//error info- code: 400 reason: "Invalid ID supplied" model: <none>
|
||||||
|
//error info- code: 404 reason: "Order not found" model: <none>
|
||||||
|
public void deleteOrder (String orderId) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(orderId == null ) {
|
if(orderId == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -37,10 +109,84 @@ public class StoreApi {
|
|||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
List<NameValuePair> mp = new ArrayList<NameValuePair>();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
|
if(hasFields)
|
||||||
|
postBody = builder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postBody = null;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, contentType);
|
||||||
|
if(response != null){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
} catch (ApiException ex) {
|
||||||
|
if(ex.getCode() == 404) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//error info- code: 400 reason: "Invalid ID supplied" model: <none>
|
||||||
|
//error info- code: 404 reason: "Order not found" model: <none>
|
||||||
|
public Order getOrderById (String orderId) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
|
// verify required params are set
|
||||||
|
if(orderId == null ) {
|
||||||
|
throw new ApiException(400, "missing required params");
|
||||||
|
}
|
||||||
|
// create path and map variables
|
||||||
|
String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString()));
|
||||||
|
|
||||||
|
// query params
|
||||||
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
List<NameValuePair> mp = new ArrayList<NameValuePair>();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
|
if(hasFields)
|
||||||
|
postBody = builder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postBody = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return (Order) ApiInvoker.deserialize(response, "", Order.class);
|
return (Order) ApiInvoker.deserialize(response, "", Order.class);
|
||||||
}
|
}
|
||||||
@@ -56,67 +202,5 @@ public class StoreApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void deleteOrder (String orderId) throws ApiException {
|
|
||||||
// verify required params are set
|
|
||||||
if(orderId == null ) {
|
|
||||||
throw new ApiException(400, "missing required params");
|
|
||||||
}
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString()));
|
|
||||||
|
|
||||||
// query params
|
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
|
||||||
|
|
||||||
String contentType = "application/json";
|
|
||||||
|
|
||||||
try {
|
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, contentType);
|
|
||||||
if(response != null){
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
if(ex.getCode() == 404) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void placeOrder (Order body) throws ApiException {
|
|
||||||
// verify required params are set
|
|
||||||
if(body == null ) {
|
|
||||||
throw new ApiException(400, "missing required params");
|
|
||||||
}
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/store/order".replaceAll("\\{format\\}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
|
||||||
|
|
||||||
String contentType = "application/json";
|
|
||||||
|
|
||||||
try {
|
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
|
||||||
if(response != null){
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
if(ex.getCode() == 404) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,15 @@ import com.wordnik.client.ApiException;
|
|||||||
import com.wordnik.client.ApiInvoker;
|
import com.wordnik.client.ApiInvoker;
|
||||||
import com.wordnik.petstore.model.User;
|
import com.wordnik.petstore.model.User;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import org.apache.http.NameValuePair;
|
||||||
|
import org.apache.http.message.BasicNameValuePair;
|
||||||
|
import org.apache.http.entity.mime.*;
|
||||||
|
import org.apache.http.entity.mime.content.*;
|
||||||
|
import org.apache.http.entity.ContentType;
|
||||||
|
|
||||||
|
import android.webkit.MimeTypeMap;
|
||||||
|
|
||||||
public class UserApi {
|
public class UserApi {
|
||||||
String basePath = "http://petstore.swagger.wordnik.com/api";
|
String basePath = "http://petstore.swagger.wordnik.com/api";
|
||||||
@@ -25,38 +34,15 @@ public class UserApi {
|
|||||||
return basePath;
|
return basePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createUser (User body) throws ApiException {
|
private static String getMimeType(File file) {
|
||||||
// verify required params are set
|
MimeTypeMap mime = MimeTypeMap.getSingleton();
|
||||||
if(body == null ) {
|
int index = file.getName().lastIndexOf('.')+1;
|
||||||
throw new ApiException(400, "missing required params");
|
String ext = file.getName().substring(index).toLowerCase();
|
||||||
}
|
return mime.getMimeTypeFromExtension(ext);
|
||||||
// create path and map variables
|
|
||||||
String path = "/user".replaceAll("\\{format\\}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
|
||||||
|
|
||||||
String contentType = "application/json";
|
|
||||||
|
|
||||||
try {
|
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
|
||||||
if(response != null){
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
if(ex.getCode() == 404) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createUsersWithArrayInput (List<User> body) throws ApiException {
|
public void createUsersWithArrayInput (List<User> body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(body == null ) {
|
if(body == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -68,10 +54,30 @@ public class UserApi {
|
|||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
List<NameValuePair> mp = new ArrayList<NameValuePair>();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
|
if(hasFields)
|
||||||
|
postBody = builder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postBody = body;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@@ -88,6 +94,7 @@ public class UserApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void createUsersWithListInput (List<User> body) throws ApiException {
|
public void createUsersWithListInput (List<User> body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(body == null ) {
|
if(body == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -99,10 +106,30 @@ public class UserApi {
|
|||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
List<NameValuePair> mp = new ArrayList<NameValuePair>();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
|
if(hasFields)
|
||||||
|
postBody = builder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postBody = body;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@@ -118,7 +145,10 @@ public class UserApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//error info- code: 400 reason: "Invalid username supplied" model: <none>
|
||||||
|
//error info- code: 404 reason: "User not found" model: <none>
|
||||||
public void updateUser (String username, User body) throws ApiException {
|
public void updateUser (String username, User body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(username == null || body == null ) {
|
if(username == null || body == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -130,10 +160,30 @@ public class UserApi {
|
|||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
List<NameValuePair> mp = new ArrayList<NameValuePair>();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
|
if(hasFields)
|
||||||
|
postBody = builder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postBody = body;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@@ -149,7 +199,10 @@ public class UserApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//error info- code: 400 reason: "Invalid username supplied" model: <none>
|
||||||
|
//error info- code: 404 reason: "User not found" model: <none>
|
||||||
public void deleteUser (String username) throws ApiException {
|
public void deleteUser (String username) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(username == null ) {
|
if(username == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -161,10 +214,30 @@ public class UserApi {
|
|||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
List<NameValuePair> mp = new ArrayList<NameValuePair>();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
|
if(hasFields)
|
||||||
|
postBody = builder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postBody = null;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@@ -180,7 +253,10 @@ public class UserApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//error info- code: 400 reason: "Invalid username supplied" model: <none>
|
||||||
|
//error info- code: 404 reason: "User not found" model: <none>
|
||||||
public User getUserByName (String username) throws ApiException {
|
public User getUserByName (String username) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(username == null ) {
|
if(username == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -192,10 +268,30 @@ public class UserApi {
|
|||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
List<NameValuePair> mp = new ArrayList<NameValuePair>();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
|
if(hasFields)
|
||||||
|
postBody = builder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postBody = null;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return (User) ApiInvoker.deserialize(response, "", User.class);
|
return (User) ApiInvoker.deserialize(response, "", User.class);
|
||||||
}
|
}
|
||||||
@@ -211,7 +307,9 @@ public class UserApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//error info- code: 400 reason: "Invalid username and password combination" model: <none>
|
||||||
public String loginUser (String username, String password) throws ApiException {
|
public String loginUser (String username, String password) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(username == null || password == null ) {
|
if(username == null || password == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -227,10 +325,30 @@ public class UserApi {
|
|||||||
queryParams.put("username", String.valueOf(username));
|
queryParams.put("username", String.valueOf(username));
|
||||||
if(!"null".equals(String.valueOf(password)))
|
if(!"null".equals(String.valueOf(password)))
|
||||||
queryParams.put("password", String.valueOf(password));
|
queryParams.put("password", String.valueOf(password));
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
List<NameValuePair> mp = new ArrayList<NameValuePair>();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
|
if(hasFields)
|
||||||
|
postBody = builder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postBody = null;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return (String) ApiInvoker.deserialize(response, "", String.class);
|
return (String) ApiInvoker.deserialize(response, "", String.class);
|
||||||
}
|
}
|
||||||
@@ -247,6 +365,7 @@ public class UserApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void logoutUser () throws ApiException {
|
public void logoutUser () throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
String path = "/user/logout".replaceAll("\\{format\\}","json");
|
String path = "/user/logout".replaceAll("\\{format\\}","json");
|
||||||
|
|
||||||
@@ -254,10 +373,82 @@ public class UserApi {
|
|||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
List<NameValuePair> mp = new ArrayList<NameValuePair>();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
|
if(hasFields)
|
||||||
|
postBody = builder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postBody = null;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, contentType);
|
||||||
|
if(response != null){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
} catch (ApiException ex) {
|
||||||
|
if(ex.getCode() == 404) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void createUser (User body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
|
// verify required params are set
|
||||||
|
if(body == null ) {
|
||||||
|
throw new ApiException(400, "missing required params");
|
||||||
|
}
|
||||||
|
// create path and map variables
|
||||||
|
String path = "/user".replaceAll("\\{format\\}","json");
|
||||||
|
|
||||||
|
// query params
|
||||||
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
List<NameValuePair> mp = new ArrayList<NameValuePair>();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
|
if(hasFields)
|
||||||
|
postBody = builder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postBody = body;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,8 @@ package com.wordnik.petstore.model;
|
|||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
public class Category {
|
public class Category {
|
||||||
/* Category unique identifier */
|
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
/* Name of the category */
|
|
||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
private String name = null;
|
private String name = null;
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
|
|||||||
@@ -4,19 +4,15 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
public class Order {
|
public class Order {
|
||||||
/* Unique identifier for the order */
|
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
/* ID of pet being ordered */
|
|
||||||
@JsonProperty("petId")
|
@JsonProperty("petId")
|
||||||
private Long petId = null;
|
private Long petId = null;
|
||||||
/* Number of pets ordered */
|
|
||||||
@JsonProperty("quantity")
|
@JsonProperty("quantity")
|
||||||
private Integer quantity = null;
|
private Integer quantity = null;
|
||||||
/* Status of the order */
|
/* Order Status */
|
||||||
@JsonProperty("status")
|
@JsonProperty("status")
|
||||||
private String status = null;
|
private String status = null;
|
||||||
/* Date shipped, only if it has been */
|
|
||||||
@JsonProperty("shipDate")
|
@JsonProperty("shipDate")
|
||||||
private Date shipDate = null;
|
private Date shipDate = null;
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
|
|||||||
@@ -4,21 +4,16 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import com.wordnik.petstore.model.Category;
|
import com.wordnik.petstore.model.Category;
|
||||||
import com.wordnik.petstore.model.Tag;
|
|
||||||
public class Pet {
|
public class Pet {
|
||||||
/* Unique identifier for the Pet */
|
/* unique identifier for the pet */
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
/* Category the pet is in */
|
|
||||||
@JsonProperty("category")
|
@JsonProperty("category")
|
||||||
private Category category = null;
|
private Category category = null;
|
||||||
/* Friendly name of the pet */
|
|
||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
private String name = null;
|
private String name = null;
|
||||||
/* Image URLs */
|
|
||||||
@JsonProperty("photoUrls")
|
@JsonProperty("photoUrls")
|
||||||
private List<String> photoUrls = new ArrayList<String>();
|
private List<String> photoUrls = new ArrayList<String>();
|
||||||
/* Tags assigned to this pet */
|
|
||||||
@JsonProperty("tags")
|
@JsonProperty("tags")
|
||||||
private List<Tag> tags = new ArrayList<Tag>();
|
private List<Tag> tags = new ArrayList<Tag>();
|
||||||
/* pet status in the store */
|
/* pet status in the store */
|
||||||
|
|||||||
@@ -3,10 +3,8 @@ package com.wordnik.petstore.model;
|
|||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
public class Tag {
|
public class Tag {
|
||||||
/* Unique identifier for the tag */
|
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
/* Friendly name for the tag */
|
|
||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
private String name = null;
|
private String name = null;
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
|
|||||||
@@ -3,25 +3,18 @@ package com.wordnik.petstore.model;
|
|||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
public class User {
|
public class User {
|
||||||
/* Unique identifier for the user */
|
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
/* Unique username */
|
|
||||||
@JsonProperty("username")
|
|
||||||
private String username = null;
|
|
||||||
/* First name of the user */
|
|
||||||
@JsonProperty("firstName")
|
@JsonProperty("firstName")
|
||||||
private String firstName = null;
|
private String firstName = null;
|
||||||
/* Last name of the user */
|
@JsonProperty("username")
|
||||||
|
private String username = null;
|
||||||
@JsonProperty("lastName")
|
@JsonProperty("lastName")
|
||||||
private String lastName = null;
|
private String lastName = null;
|
||||||
/* Email address of the user */
|
|
||||||
@JsonProperty("email")
|
@JsonProperty("email")
|
||||||
private String email = null;
|
private String email = null;
|
||||||
/* Password name of the user */
|
|
||||||
@JsonProperty("password")
|
@JsonProperty("password")
|
||||||
private String password = null;
|
private String password = null;
|
||||||
/* Phone number of the user */
|
|
||||||
@JsonProperty("phone")
|
@JsonProperty("phone")
|
||||||
private String phone = null;
|
private String phone = null;
|
||||||
/* User Status */
|
/* User Status */
|
||||||
@@ -34,13 +27,6 @@ public class User {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUsername() {
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
public void setUsername(String username) {
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFirstName() {
|
public String getFirstName() {
|
||||||
return firstName;
|
return firstName;
|
||||||
}
|
}
|
||||||
@@ -48,6 +34,13 @@ public class User {
|
|||||||
this.firstName = firstName;
|
this.firstName = firstName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
public String getLastName() {
|
public String getLastName() {
|
||||||
return lastName;
|
return lastName;
|
||||||
}
|
}
|
||||||
@@ -88,8 +81,8 @@ public class User {
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("class User {\n");
|
sb.append("class User {\n");
|
||||||
sb.append(" id: ").append(id).append("\n");
|
sb.append(" id: ").append(id).append("\n");
|
||||||
sb.append(" username: ").append(username).append("\n");
|
|
||||||
sb.append(" firstName: ").append(firstName).append("\n");
|
sb.append(" firstName: ").append(firstName).append("\n");
|
||||||
|
sb.append(" username: ").append(username).append("\n");
|
||||||
sb.append(" lastName: ").append(lastName).append("\n");
|
sb.append(" lastName: ").append(lastName).append("\n");
|
||||||
sb.append(" email: ").append(email).append("\n");
|
sb.append(" email: ").append(email).append("\n");
|
||||||
sb.append(" password: ").append(password).append("\n");
|
sb.append(" password: ").append(password).append("\n");
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2012 Wordnik, Inc.
|
* Copyright 2014 Wordnik, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -21,38 +21,6 @@
|
|||||||
return basePath;
|
return basePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// uploads an image
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="additionalMetadata">Additional data to pass to server</param>
|
|
||||||
/// <param name="body">file to upload</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public void uploadFile (string additionalMetadata, File body) {
|
|
||||||
// create path and map variables
|
|
||||||
var path = "/pet/uploadImage".Replace("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
var queryParams = new Dictionary<String, String>();
|
|
||||||
var headerParams = new Dictionary<String, String>();
|
|
||||||
|
|
||||||
string paramStr = null;
|
|
||||||
try {
|
|
||||||
var response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams);
|
|
||||||
if(response != null){
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
if(ex.ErrorCode == 404) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Find pet by ID Returns a pet based on ID
|
/// Find pet by ID Returns a pet based on ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -197,6 +165,38 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// uploads an image
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="additionalMetadata">Additional data to pass to server</param>
|
||||||
|
/// <param name="body">file to upload</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public void uploadFile (string additionalMetadata, File body) {
|
||||||
|
// create path and map variables
|
||||||
|
var path = "/pet/uploadImage".Replace("{format}","json");
|
||||||
|
|
||||||
|
// query params
|
||||||
|
var queryParams = new Dictionary<String, String>();
|
||||||
|
var headerParams = new Dictionary<String, String>();
|
||||||
|
|
||||||
|
string paramStr = null;
|
||||||
|
try {
|
||||||
|
var response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams);
|
||||||
|
if(response != null){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
} catch (ApiException ex) {
|
||||||
|
if(ex.ErrorCode == 404) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
/// Add a new pet to the store
|
/// Add a new pet to the store
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||||
|
|||||||
@@ -21,41 +21,6 @@
|
|||||||
return basePath;
|
return basePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="orderId">ID of the order that needs to be deleted</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public void deleteOrder (string orderId) {
|
|
||||||
// create path and map variables
|
|
||||||
var path = "/store/order/{orderId}".Replace("{format}","json").Replace("{" + "orderId" + "}", apiInvoker.escapeString(orderId.ToString()));
|
|
||||||
|
|
||||||
// query params
|
|
||||||
var queryParams = new Dictionary<String, String>();
|
|
||||||
var headerParams = new Dictionary<String, String>();
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if (orderId == null ) {
|
|
||||||
throw new ApiException(400, "missing required params");
|
|
||||||
}
|
|
||||||
string paramStr = null;
|
|
||||||
try {
|
|
||||||
var response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams);
|
|
||||||
if(response != null){
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
if(ex.ErrorCode == 404) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Find purchase order by ID For valid response try integer IDs with value <= 5. Anything above 5 or nonintegers will generate API errors
|
/// Find purchase order by ID For valid response try integer IDs with value <= 5. Anything above 5 or nonintegers will generate API errors
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -92,6 +57,41 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="orderId">ID of the order that needs to be deleted</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public void deleteOrder (string orderId) {
|
||||||
|
// create path and map variables
|
||||||
|
var path = "/store/order/{orderId}".Replace("{format}","json").Replace("{" + "orderId" + "}", apiInvoker.escapeString(orderId.ToString()));
|
||||||
|
|
||||||
|
// query params
|
||||||
|
var queryParams = new Dictionary<String, String>();
|
||||||
|
var headerParams = new Dictionary<String, String>();
|
||||||
|
|
||||||
|
// verify required params are set
|
||||||
|
if (orderId == null ) {
|
||||||
|
throw new ApiException(400, "missing required params");
|
||||||
|
}
|
||||||
|
string paramStr = null;
|
||||||
|
try {
|
||||||
|
var response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams);
|
||||||
|
if(response != null){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
} catch (ApiException ex) {
|
||||||
|
if(ex.ErrorCode == 404) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
/// Place an order for a pet
|
/// Place an order for a pet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="body">order placed for purchasing the pet</param>
|
/// <param name="body">order placed for purchasing the pet</param>
|
||||||
|
|||||||
@@ -21,6 +21,42 @@
|
|||||||
return basePath;
|
return basePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updated user This can only be done by the logged in user.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="username">name that need to be deleted</param>
|
||||||
|
/// <param name="body">Updated user object</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public void updateUser (string username, User body) {
|
||||||
|
// create path and map variables
|
||||||
|
var path = "/user/{username}".Replace("{format}","json").Replace("{" + "username" + "}", apiInvoker.escapeString(username.ToString()));
|
||||||
|
|
||||||
|
// query params
|
||||||
|
var queryParams = new Dictionary<String, String>();
|
||||||
|
var headerParams = new Dictionary<String, String>();
|
||||||
|
|
||||||
|
// verify required params are set
|
||||||
|
if (username == null || body == null ) {
|
||||||
|
throw new ApiException(400, "missing required params");
|
||||||
|
}
|
||||||
|
string paramStr = null;
|
||||||
|
try {
|
||||||
|
var response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams);
|
||||||
|
if(response != null){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
} catch (ApiException ex) {
|
||||||
|
if(ex.ErrorCode == 404) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delete user This can only be done by the logged in user.
|
/// Delete user This can only be done by the logged in user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -92,42 +128,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updated user This can only be done by the logged in user.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="username">name that need to be deleted</param>
|
|
||||||
/// <param name="body">Updated user object</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public void updateUser (string username, User body) {
|
|
||||||
// create path and map variables
|
|
||||||
var path = "/user/{username}".Replace("{format}","json").Replace("{" + "username" + "}", apiInvoker.escapeString(username.ToString()));
|
|
||||||
|
|
||||||
// query params
|
|
||||||
var queryParams = new Dictionary<String, String>();
|
|
||||||
var headerParams = new Dictionary<String, String>();
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if (username == null || body == null ) {
|
|
||||||
throw new ApiException(400, "missing required params");
|
|
||||||
}
|
|
||||||
string paramStr = null;
|
|
||||||
try {
|
|
||||||
var response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams);
|
|
||||||
if(response != null){
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
if(ex.ErrorCode == 404) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Logs user into the system
|
/// Logs user into the system
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="username">The user name for login</param>
|
/// <param name="username">The user name for login</param>
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
|
|
||||||
var client = WebRequest.Create(host + path + querystring);
|
var client = WebRequest.Create(host + path + querystring);
|
||||||
client.ContentType = "application/json";
|
client.ContentType = "application/json";
|
||||||
|
client.Method = method;
|
||||||
|
|
||||||
foreach (var headerParamsItem in headerParams)
|
foreach (var headerParamsItem in headerParams)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2012 Wordnik, Inc.
|
* Copyright 2014 Wordnik, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
<arg line="-source-path ${sourcepath}"/>
|
<arg line="-source-path ${sourcepath}"/>
|
||||||
<arg line="-footer 'Copyright Wordnik'"/>
|
<arg line="-footer 'Copyright Wordnik'"/>
|
||||||
<arg line="-package com.wordnik.swagger.api 'Contains the apis which are used by clients to make calls to the services deployed'"/>
|
<arg line="-package com.wordnik.swagger.api 'Contains the apis which are used by clients to make calls to the services deployed'"/>
|
||||||
<arg line="-package com.wordnik.swagger.model 'Contains common classes which encapsulate data elements required'"/>
|
<arg line="-package com.wordnik.swagger.codegen.model 'Contains common classes which encapsulate data elements required'"/>
|
||||||
<arg line="-package com.wordnik.swagger.common 'Contains classes which are used by the api classes to invoke the deployed api like SwaggerApi - a base class, ApiUserCredentials, etc.'"/>
|
<arg line="-package com.wordnik.swagger.common 'Contains classes which are used by the api classes to invoke the deployed api like SwaggerApi - a base class, ApiUserCredentials, etc.'"/>
|
||||||
<arg line="-package com.wordnik.swagger.event 'Results of calls made to Wordnik are returned via dispatched events. This package contains such event classes. Right now thats just ApiClientEvent and Response.'"/>
|
<arg line="-package com.wordnik.swagger.event 'Results of calls made to Wordnik are returned via dispatched events. This package contains such event classes. Right now thats just ApiClientEvent and Response.'"/>
|
||||||
<arg line="-package com.wordnik.swagger.exception 'Contains classes that encapsulate the errors generated'"/>
|
<arg line="-package com.wordnik.swagger.exception 'Contains classes that encapsulate the errors generated'"/>
|
||||||
|
|||||||
@@ -22,91 +22,16 @@ public class UserApi extends SwaggerApi {
|
|||||||
super(apiCredentials, eventDispatcher);
|
super(apiCredentials, eventDispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static const event_createUser: String = "createUser";
|
|
||||||
public static const event_createUsersWithArrayInput: String = "createUsersWithArrayInput";
|
|
||||||
public static const event_createUsersWithListInput: String = "createUsersWithListInput";
|
|
||||||
public static const event_updateUser: String = "updateUser";
|
public static const event_updateUser: String = "updateUser";
|
||||||
public static const event_deleteUser: String = "deleteUser";
|
public static const event_deleteUser: String = "deleteUser";
|
||||||
public static const event_getUserByName: String = "getUserByName";
|
public static const event_getUserByName: String = "getUserByName";
|
||||||
public static const event_loginUser: String = "loginUser";
|
public static const event_loginUser: String = "loginUser";
|
||||||
public static const event_logoutUser: String = "logoutUser";
|
public static const event_logoutUser: String = "logoutUser";
|
||||||
|
public static const event_createUser: String = "createUser";
|
||||||
|
public static const event_createUsersWithArrayInput: String = "createUsersWithArrayInput";
|
||||||
|
public static const event_createUsersWithListInput: String = "createUsersWithListInput";
|
||||||
/*
|
/*
|
||||||
* Returns void */
|
* Returns void */
|
||||||
public function createUser (body: User): String {
|
|
||||||
// create path and map variables
|
|
||||||
var path: String = "/user".replace(/{format}/g,"xml");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
var queryParams: Dictionary = new Dictionary();
|
|
||||||
var headerParams: Dictionary = new Dictionary();
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(body == null ) {
|
|
||||||
throw new ApiError(400, "missing required params");
|
|
||||||
}
|
|
||||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
|
|
||||||
|
|
||||||
var requestId: String = getUniqueId();
|
|
||||||
|
|
||||||
token.requestId = requestId;
|
|
||||||
token.completionEventType = "createUser";
|
|
||||||
|
|
||||||
token.returnType = null ;
|
|
||||||
return requestId;
|
|
||||||
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Returns void */
|
|
||||||
public function createUsersWithArrayInput (body: Array): String {
|
|
||||||
// create path and map variables
|
|
||||||
var path: String = "/user/createWithArray".replace(/{format}/g,"xml");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
var queryParams: Dictionary = new Dictionary();
|
|
||||||
var headerParams: Dictionary = new Dictionary();
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(body == null ) {
|
|
||||||
throw new ApiError(400, "missing required params");
|
|
||||||
}
|
|
||||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
|
|
||||||
|
|
||||||
var requestId: String = getUniqueId();
|
|
||||||
|
|
||||||
token.requestId = requestId;
|
|
||||||
token.completionEventType = "createUsersWithArrayInput";
|
|
||||||
|
|
||||||
token.returnType = null ;
|
|
||||||
return requestId;
|
|
||||||
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Returns void */
|
|
||||||
public function createUsersWithListInput (body: Array): String {
|
|
||||||
// create path and map variables
|
|
||||||
var path: String = "/user/createWithList".replace(/{format}/g,"xml");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
var queryParams: Dictionary = new Dictionary();
|
|
||||||
var headerParams: Dictionary = new Dictionary();
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(body == null ) {
|
|
||||||
throw new ApiError(400, "missing required params");
|
|
||||||
}
|
|
||||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
|
|
||||||
|
|
||||||
var requestId: String = getUniqueId();
|
|
||||||
|
|
||||||
token.requestId = requestId;
|
|
||||||
token.completionEventType = "createUsersWithListInput";
|
|
||||||
|
|
||||||
token.returnType = null ;
|
|
||||||
return requestId;
|
|
||||||
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Returns void */
|
|
||||||
public function updateUser (username: String, body: User): String {
|
public function updateUser (username: String, body: User): String {
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
var path: String = "/user/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username));
|
var path: String = "/user/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username));
|
||||||
@@ -229,6 +154,81 @@ public static const event_logoutUser: String = "logoutUser";
|
|||||||
token.returnType = null ;
|
token.returnType = null ;
|
||||||
return requestId;
|
return requestId;
|
||||||
|
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Returns void */
|
||||||
|
public function createUser (body: User): String {
|
||||||
|
// create path and map variables
|
||||||
|
var path: String = "/user".replace(/{format}/g,"xml");
|
||||||
|
|
||||||
|
// query params
|
||||||
|
var queryParams: Dictionary = new Dictionary();
|
||||||
|
var headerParams: Dictionary = new Dictionary();
|
||||||
|
|
||||||
|
// verify required params are set
|
||||||
|
if(body == null ) {
|
||||||
|
throw new ApiError(400, "missing required params");
|
||||||
|
}
|
||||||
|
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
|
||||||
|
|
||||||
|
var requestId: String = getUniqueId();
|
||||||
|
|
||||||
|
token.requestId = requestId;
|
||||||
|
token.completionEventType = "createUser";
|
||||||
|
|
||||||
|
token.returnType = null ;
|
||||||
|
return requestId;
|
||||||
|
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Returns void */
|
||||||
|
public function createUsersWithArrayInput (body: Array): String {
|
||||||
|
// create path and map variables
|
||||||
|
var path: String = "/user/createWithArray".replace(/{format}/g,"xml");
|
||||||
|
|
||||||
|
// query params
|
||||||
|
var queryParams: Dictionary = new Dictionary();
|
||||||
|
var headerParams: Dictionary = new Dictionary();
|
||||||
|
|
||||||
|
// verify required params are set
|
||||||
|
if(body == null ) {
|
||||||
|
throw new ApiError(400, "missing required params");
|
||||||
|
}
|
||||||
|
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
|
||||||
|
|
||||||
|
var requestId: String = getUniqueId();
|
||||||
|
|
||||||
|
token.requestId = requestId;
|
||||||
|
token.completionEventType = "createUsersWithArrayInput";
|
||||||
|
|
||||||
|
token.returnType = null ;
|
||||||
|
return requestId;
|
||||||
|
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Returns void */
|
||||||
|
public function createUsersWithListInput (body: Array): String {
|
||||||
|
// create path and map variables
|
||||||
|
var path: String = "/user/createWithList".replace(/{format}/g,"xml");
|
||||||
|
|
||||||
|
// query params
|
||||||
|
var queryParams: Dictionary = new Dictionary();
|
||||||
|
var headerParams: Dictionary = new Dictionary();
|
||||||
|
|
||||||
|
// verify required params are set
|
||||||
|
if(body == null ) {
|
||||||
|
throw new ApiError(400, "missing required params");
|
||||||
|
}
|
||||||
|
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
|
||||||
|
|
||||||
|
var requestId: String = getUniqueId();
|
||||||
|
|
||||||
|
token.requestId = requestId;
|
||||||
|
token.completionEventType = "createUsersWithListInput";
|
||||||
|
|
||||||
|
token.returnType = null ;
|
||||||
|
return requestId;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,9 @@ package com.wordnik.client.model {
|
|||||||
|
|
||||||
[XmlRootNode(name="Category")]
|
[XmlRootNode(name="Category")]
|
||||||
public class Category {
|
public class Category {
|
||||||
/* Category unique identifier */
|
|
||||||
[XmlElement(name="id")]
|
[XmlElement(name="id")]
|
||||||
public var id: Number = 0.0;
|
public var id: Number = 0.0;
|
||||||
|
|
||||||
/* Name of the category */
|
|
||||||
[XmlElement(name="name")]
|
[XmlElement(name="name")]
|
||||||
public var name: String = null;
|
public var name: String = null;
|
||||||
|
|
||||||
|
|||||||
@@ -2,23 +2,19 @@ package com.wordnik.client.model {
|
|||||||
|
|
||||||
[XmlRootNode(name="Order")]
|
[XmlRootNode(name="Order")]
|
||||||
public class Order {
|
public class Order {
|
||||||
/* Unique identifier for the order */
|
|
||||||
[XmlElement(name="id")]
|
[XmlElement(name="id")]
|
||||||
public var id: Number = 0.0;
|
public var id: Number = 0.0;
|
||||||
|
|
||||||
/* ID of pet being ordered */
|
|
||||||
[XmlElement(name="petId")]
|
[XmlElement(name="petId")]
|
||||||
public var petId: Number = 0.0;
|
public var petId: Number = 0.0;
|
||||||
|
|
||||||
/* Number of pets ordered */
|
|
||||||
[XmlElement(name="quantity")]
|
[XmlElement(name="quantity")]
|
||||||
public var quantity: Number = 0.0;
|
public var quantity: Number = 0.0;
|
||||||
|
|
||||||
/* Status of the order */
|
/* Order Status */
|
||||||
[XmlElement(name="status")]
|
[XmlElement(name="status")]
|
||||||
public var status: String = null;
|
public var status: String = null;
|
||||||
|
|
||||||
/* Date shipped, only if it has been */
|
|
||||||
[XmlElement(name="shipDate")]
|
[XmlElement(name="shipDate")]
|
||||||
public var shipDate: Date = null;
|
public var shipDate: Date = null;
|
||||||
|
|
||||||
|
|||||||
@@ -4,26 +4,22 @@ import com.wordnik.client.model.Category;
|
|||||||
import com.wordnik.client.model.Tag;
|
import com.wordnik.client.model.Tag;
|
||||||
[XmlRootNode(name="Pet")]
|
[XmlRootNode(name="Pet")]
|
||||||
public class Pet {
|
public class Pet {
|
||||||
/* Unique identifier for the Pet */
|
/* unique identifier for the pet */
|
||||||
[XmlElement(name="id")]
|
[XmlElement(name="id")]
|
||||||
public var id: Number = 0.0;
|
public var id: Number = 0.0;
|
||||||
|
|
||||||
/* Category the pet is in */
|
|
||||||
[XmlElement(name="category")]
|
[XmlElement(name="category")]
|
||||||
public var category: Category = null;
|
public var category: Category = null;
|
||||||
|
|
||||||
/* Friendly name of the pet */
|
|
||||||
[XmlElement(name="name")]
|
[XmlElement(name="name")]
|
||||||
public var name: String = null;
|
public var name: String = null;
|
||||||
|
|
||||||
/* Image URLs */
|
|
||||||
// This declaration below of _photoUrls_obj_class is to force flash compiler to include this class
|
// This declaration below of _photoUrls_obj_class is to force flash compiler to include this class
|
||||||
private var _photoUrls_obj_class: com.wordnik.client.model.String = null;
|
private var _photoUrls_obj_class: com.wordnik.client.model.String = null;
|
||||||
[XmlElementWrapper(name="photoUrls")]
|
[XmlElementWrapper(name="photoUrls")]
|
||||||
[XmlElements(name="photoUrl", type="com.wordnik.client.model.String")]
|
[XmlElements(name="photoUrl", type="com.wordnik.client.model.String")]
|
||||||
public var photoUrls: Array = new Array();
|
public var photoUrls: Array = new Array();
|
||||||
|
|
||||||
/* Tags assigned to this pet */
|
|
||||||
// This declaration below of _tags_obj_class is to force flash compiler to include this class
|
// This declaration below of _tags_obj_class is to force flash compiler to include this class
|
||||||
private var _tags_obj_class: com.wordnik.client.model.Tag = null;
|
private var _tags_obj_class: com.wordnik.client.model.Tag = null;
|
||||||
[XmlElementWrapper(name="tags")]
|
[XmlElementWrapper(name="tags")]
|
||||||
|
|||||||
@@ -2,11 +2,9 @@ package com.wordnik.client.model {
|
|||||||
|
|
||||||
[XmlRootNode(name="Tag")]
|
[XmlRootNode(name="Tag")]
|
||||||
public class Tag {
|
public class Tag {
|
||||||
/* Unique identifier for the tag */
|
|
||||||
[XmlElement(name="id")]
|
[XmlElement(name="id")]
|
||||||
public var id: Number = 0.0;
|
public var id: Number = 0.0;
|
||||||
|
|
||||||
/* Friendly name for the tag */
|
|
||||||
[XmlElement(name="name")]
|
[XmlElement(name="name")]
|
||||||
public var name: String = null;
|
public var name: String = null;
|
||||||
|
|
||||||
|
|||||||
@@ -2,31 +2,24 @@ package com.wordnik.client.model {
|
|||||||
|
|
||||||
[XmlRootNode(name="User")]
|
[XmlRootNode(name="User")]
|
||||||
public class User {
|
public class User {
|
||||||
/* Unique identifier for the user */
|
|
||||||
[XmlElement(name="id")]
|
[XmlElement(name="id")]
|
||||||
public var id: Number = 0.0;
|
public var id: Number = 0.0;
|
||||||
|
|
||||||
/* Unique username */
|
|
||||||
[XmlElement(name="username")]
|
|
||||||
public var username: String = null;
|
|
||||||
|
|
||||||
/* First name of the user */
|
|
||||||
[XmlElement(name="firstName")]
|
[XmlElement(name="firstName")]
|
||||||
public var firstName: String = null;
|
public var firstName: String = null;
|
||||||
|
|
||||||
/* Last name of the user */
|
[XmlElement(name="username")]
|
||||||
|
public var username: String = null;
|
||||||
|
|
||||||
[XmlElement(name="lastName")]
|
[XmlElement(name="lastName")]
|
||||||
public var lastName: String = null;
|
public var lastName: String = null;
|
||||||
|
|
||||||
/* Email address of the user */
|
|
||||||
[XmlElement(name="email")]
|
[XmlElement(name="email")]
|
||||||
public var email: String = null;
|
public var email: String = null;
|
||||||
|
|
||||||
/* Password name of the user */
|
|
||||||
[XmlElement(name="password")]
|
[XmlElement(name="password")]
|
||||||
public var password: String = null;
|
public var password: String = null;
|
||||||
|
|
||||||
/* Phone number of the user */
|
|
||||||
[XmlElement(name="phone")]
|
[XmlElement(name="phone")]
|
||||||
public var phone: String = null;
|
public var phone: String = null;
|
||||||
|
|
||||||
@@ -37,8 +30,8 @@ package com.wordnik.client.model {
|
|||||||
public function toString(): String {
|
public function toString(): String {
|
||||||
var str: String = "User: ";
|
var str: String = "User: ";
|
||||||
str += " (id: " + id + ")";
|
str += " (id: " + id + ")";
|
||||||
str += " (username: " + username + ")";
|
|
||||||
str += " (firstName: " + firstName + ")";
|
str += " (firstName: " + firstName + ")";
|
||||||
|
str += " (username: " + username + ")";
|
||||||
str += " (lastName: " + lastName + ")";
|
str += " (lastName: " + lastName + ")";
|
||||||
str += " (email: " + email + ")";
|
str += " (email: " + email + ")";
|
||||||
str += " (password: " + password + ")";
|
str += " (password: " + password + ")";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013 Wordnik, Inc.
|
* Copyright 2014 Wordnik, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -20,7 +20,7 @@ object JavaPetstoreCodegen extends BasicJavaGenerator {
|
|||||||
def main(args: Array[String]) = generateClient(args)
|
def main(args: Array[String]) = generateClient(args)
|
||||||
|
|
||||||
// location of templates
|
// location of templates
|
||||||
override def templateDir = "Java"
|
override def templateDir = "src/main/resources/Java"
|
||||||
|
|
||||||
// where to write generated code
|
// where to write generated code
|
||||||
override def destinationDir = "samples/client/petstore/java/src/main/java"
|
override def destinationDir = "samples/client/petstore/java/src/main/java"
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.wordnik.client</groupId>
|
<groupId>com.wordnik</groupId>
|
||||||
<artifactId>api-client</artifactId>
|
<artifactId>swagger-petstore</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>api-client</name>
|
<name>swagger-petstore</name>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<scm>
|
<scm>
|
||||||
<connection>scm:git:git@github.com:wordnik/swagger-mustache.git</connection>
|
<connection>scm:git:git@github.com:wordnik/swagger-mustache.git</connection>
|
||||||
@@ -104,55 +104,8 @@
|
|||||||
<target>1.6</target>
|
<target>1.6</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>net.alchim31.maven</groupId>
|
|
||||||
<artifactId>scala-maven-plugin</artifactId>
|
|
||||||
<version>${scala-maven-plugin-version}</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<goals>
|
|
||||||
<goal>compile</goal>
|
|
||||||
<goal>testCompile</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
<configuration>
|
|
||||||
<configuration>
|
|
||||||
<recompileMode>incremental</recompileMode>
|
|
||||||
</configuration>
|
|
||||||
<jvmArgs>
|
|
||||||
<jvmArg>-Xmx384m</jvmArg>
|
|
||||||
</jvmArgs>
|
|
||||||
<args>
|
|
||||||
<arg>-target:jvm-1.5</arg>
|
|
||||||
<arg>-deprecation</arg>
|
|
||||||
</args>
|
|
||||||
<launchers>
|
|
||||||
<launcher>
|
|
||||||
<id>run-scalatest</id>
|
|
||||||
<mainClass>org.scalatest.tools.Runner</mainClass>
|
|
||||||
<args>
|
|
||||||
<arg>-p</arg>
|
|
||||||
<arg>${project.build.testOutputDirectory}</arg>
|
|
||||||
</args>
|
|
||||||
<jvmArgs>
|
|
||||||
<jvmArg>-Xmx512m</jvmArg>
|
|
||||||
</jvmArgs>
|
|
||||||
</launcher>
|
|
||||||
</launchers>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<reporting>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>net.alchim31.maven</groupId>
|
|
||||||
<artifactId>scala-maven-plugin</artifactId>
|
|
||||||
<version>${scala-maven-plugin-version}</version>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</reporting>
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sun.jersey</groupId>
|
<groupId>com.sun.jersey</groupId>
|
||||||
@@ -160,6 +113,12 @@
|
|||||||
<version>${jersey-version}</version>
|
<version>${jersey-version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.jersey.contribs</groupId>
|
||||||
|
<artifactId>jersey-multipart</artifactId>
|
||||||
|
<version>${jersey-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-core</artifactId>
|
<artifactId>jackson-core</artifactId>
|
||||||
@@ -178,20 +137,19 @@
|
|||||||
<version>${jackson-version}</version>
|
<version>${jackson-version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-joda</artifactId>
|
||||||
|
<version>2.1.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>joda-time</groupId>
|
||||||
|
<artifactId>joda-time</artifactId>
|
||||||
|
<version>${jodatime-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- test dependencies -->
|
<!-- test dependencies -->
|
||||||
<dependency>
|
|
||||||
<groupId>org.scala-lang</groupId>
|
|
||||||
<artifactId>scala-library</artifactId>
|
|
||||||
<version>${scala-version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.scalatest</groupId>
|
|
||||||
<artifactId>scalatest_2.9.1</artifactId>
|
|
||||||
<version>${scala-test-version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
@@ -203,12 +161,10 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<jersey-version>1.7</jersey-version>
|
<jersey-version>1.7</jersey-version>
|
||||||
<jackson-version>2.1.4</jackson-version>
|
<jackson-version>2.1.4</jackson-version>
|
||||||
<scala-version>2.9.1-1</scala-version>
|
<jodatime-version>2.3</jodatime-version>
|
||||||
<junit-version>4.8.1</junit-version>
|
<junit-version>4.8.1</junit-version>
|
||||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||||
<junit-version>4.8.1</junit-version>
|
<junit-version>4.8.1</junit-version>
|
||||||
<scala-test-version>1.6.1</scala-test-version>
|
|
||||||
<scala-maven-plugin-version>3.1.5</scala-maven-plugin-version>
|
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.sun.jersey.api.client.config.ClientConfig;
|
|||||||
import com.sun.jersey.api.client.config.DefaultClientConfig;
|
import com.sun.jersey.api.client.config.DefaultClientConfig;
|
||||||
import com.sun.jersey.api.client.filter.LoggingFilter;
|
import com.sun.jersey.api.client.filter.LoggingFilter;
|
||||||
import com.sun.jersey.api.client.WebResource.Builder;
|
import com.sun.jersey.api.client.WebResource.Builder;
|
||||||
|
import com.sun.jersey.multipart.FormDataMultiPart;
|
||||||
|
|
||||||
import javax.ws.rs.core.Response.Status.Family;
|
import javax.ws.rs.core.Response.Status.Family;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
@@ -19,11 +20,18 @@ import java.util.Map;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
public class ApiInvoker {
|
public class ApiInvoker {
|
||||||
private static ApiInvoker INSTANCE = new ApiInvoker();
|
private static ApiInvoker INSTANCE = new ApiInvoker();
|
||||||
private Map<String, Client> hostMap = new HashMap<String, Client>();
|
private Map<String, Client> hostMap = new HashMap<String, Client>();
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
|
private boolean isDebug = false;
|
||||||
|
|
||||||
|
public void enableDebug() {
|
||||||
|
isDebug = true;
|
||||||
|
}
|
||||||
|
|
||||||
public static ApiInvoker getInstance() {
|
public static ApiInvoker getInstance() {
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
@@ -34,7 +42,12 @@ public class ApiInvoker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String escapeString(String str) {
|
public String escapeString(String str) {
|
||||||
return str;
|
try{
|
||||||
|
return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20");
|
||||||
|
}
|
||||||
|
catch(UnsupportedEncodingException e) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object deserialize(String json, String containerType, Class cls) throws ApiException {
|
public static Object deserialize(String json, String containerType, Class cls) throws ApiException {
|
||||||
@@ -71,7 +84,7 @@ public class ApiInvoker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String invokeAPI(String host, String path, String method, Map<String, String> queryParams, Object body, Map<String, String> headerParams, String contentType) throws ApiException {
|
public String invokeAPI(String host, String path, String method, Map<String, String> queryParams, Object body, Map<String, String> headerParams, Map<String, String> formParams, String contentType) throws ApiException {
|
||||||
Client client = getClient(host);
|
Client client = getClient(host);
|
||||||
|
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
@@ -105,21 +118,46 @@ public class ApiInvoker {
|
|||||||
}
|
}
|
||||||
else if ("POST".equals(method)) {
|
else if ("POST".equals(method)) {
|
||||||
if(body == null)
|
if(body == null)
|
||||||
response = builder.post(ClientResponse.class, serialize(body));
|
response = builder.post(ClientResponse.class, null);
|
||||||
|
else if(body instanceof FormDataMultiPart) {
|
||||||
|
response = builder.type(contentType).post(ClientResponse.class, body);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
response = builder.type("application/json").post(ClientResponse.class, serialize(body));
|
response = builder.type(contentType).post(ClientResponse.class, serialize(body));
|
||||||
}
|
}
|
||||||
else if ("PUT".equals(method)) {
|
else if ("PUT".equals(method)) {
|
||||||
if(body == null)
|
if(body == null)
|
||||||
response = builder.put(ClientResponse.class, serialize(body));
|
response = builder.put(ClientResponse.class, serialize(body));
|
||||||
else
|
else {
|
||||||
response = builder.type("application/json").put(ClientResponse.class, serialize(body));
|
if("application/x-www-form-urlencoded".equals(contentType)) {
|
||||||
|
StringBuilder formParamBuilder = new StringBuilder();
|
||||||
|
|
||||||
|
// encode the form params
|
||||||
|
for(String key : formParams.keySet()) {
|
||||||
|
String value = formParams.get(key);
|
||||||
|
if(value != null && !"".equals(value.trim())) {
|
||||||
|
if(formParamBuilder.length() > 0) {
|
||||||
|
formParamBuilder.append("&");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
formParamBuilder.append(URLEncoder.encode(key, "utf8")).append("=").append(URLEncoder.encode(value, "utf8"));
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
// move on to next
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
response = builder.type(contentType).put(ClientResponse.class, formParamBuilder.toString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
response = builder.type(contentType).put(ClientResponse.class, serialize(body));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ("DELETE".equals(method)) {
|
else if ("DELETE".equals(method)) {
|
||||||
if(body == null)
|
if(body == null)
|
||||||
response = builder.delete(ClientResponse.class, serialize(body));
|
response = builder.delete(ClientResponse.class, serialize(body));
|
||||||
else
|
else
|
||||||
response = builder.type("application/json").delete(ClientResponse.class, serialize(body));
|
response = builder.type(contentType).delete(ClientResponse.class, serialize(body));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new ApiException(500, "unknown method type " + method);
|
throw new ApiException(500, "unknown method type " + method);
|
||||||
@@ -140,7 +178,8 @@ public class ApiInvoker {
|
|||||||
private Client getClient(String host) {
|
private Client getClient(String host) {
|
||||||
if(!hostMap.containsKey(host)) {
|
if(!hostMap.containsKey(host)) {
|
||||||
Client client = Client.create();
|
Client client = Client.create();
|
||||||
client.addFilter(new LoggingFilter());
|
if(isDebug)
|
||||||
|
client.addFilter(new LoggingFilter());
|
||||||
hostMap.put(host, client);
|
hostMap.put(host, client);
|
||||||
}
|
}
|
||||||
return hostMap.get(host);
|
return hostMap.get(host);
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import com.fasterxml.jackson.databind.*;
|
|||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.core.JsonGenerator.Feature;
|
import com.fasterxml.jackson.core.JsonGenerator.Feature;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.datatype.joda.*;
|
||||||
|
|
||||||
public class JsonUtil {
|
public class JsonUtil {
|
||||||
public static ObjectMapper mapper;
|
public static ObjectMapper mapper;
|
||||||
|
|
||||||
@@ -12,6 +14,7 @@ public class JsonUtil {
|
|||||||
mapper = new ObjectMapper();
|
mapper = new ObjectMapper();
|
||||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||||
|
mapper.registerModule(new JodaModule());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ObjectMapper getJsonMapper() {
|
public static ObjectMapper getJsonMapper() {
|
||||||
|
|||||||
@@ -2,8 +2,13 @@ package com.wordnik.petstore.api;
|
|||||||
|
|
||||||
import com.wordnik.client.ApiException;
|
import com.wordnik.client.ApiException;
|
||||||
import com.wordnik.client.ApiInvoker;
|
import com.wordnik.client.ApiInvoker;
|
||||||
import java.io.File;
|
|
||||||
import com.wordnik.petstore.model.Pet;
|
import com.wordnik.petstore.model.Pet;
|
||||||
|
import com.sun.jersey.multipart.FormDataMultiPart;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class PetApi {
|
public class PetApi {
|
||||||
@@ -22,34 +27,10 @@ public class PetApi {
|
|||||||
return basePath;
|
return basePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uploadFile (String additionalMetadata, File body) throws ApiException {
|
//error info- code: 400 reason: "Invalid ID supplied" model: <none>
|
||||||
// create path and map variables
|
//error info- code: 404 reason: "Pet not found" model: <none>
|
||||||
String path = "/pet/uploadImage".replaceAll("\\{format\\}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
|
||||||
|
|
||||||
String contentType = "application/json";
|
|
||||||
|
|
||||||
try {
|
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
|
||||||
if(response != null){
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
if(ex.getCode() == 404) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public Pet getPetById (Long petId) throws ApiException {
|
public Pet getPetById (Long petId) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(petId == null ) {
|
if(petId == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -60,11 +41,24 @@ public class PetApi {
|
|||||||
// query params
|
// query params
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return (Pet) ApiInvoker.deserialize(response, "", Pet.class);
|
return (Pet) ApiInvoker.deserialize(response, "", Pet.class);
|
||||||
}
|
}
|
||||||
@@ -80,7 +74,9 @@ public class PetApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void deletePet (String petId) throws ApiException {
|
//error info- code: 405 reason: "Invalid input" model: <none>
|
||||||
|
public void updatePetWithForm (String petId, String name, String status) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(petId == null ) {
|
if(petId == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -91,11 +87,28 @@ public class PetApi {
|
|||||||
// query params
|
// query params
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/x-www-form-urlencoded"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
hasFields = true;
|
||||||
|
mp.field("name", name, MediaType.MULTIPART_FORM_DATA_TYPE);
|
||||||
|
hasFields = true;
|
||||||
|
mp.field("status", status, MediaType.MULTIPART_FORM_DATA_TYPE);
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
formParams.put("name", name);formParams.put("status", status);}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@@ -111,7 +124,55 @@ public class PetApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//error info- code: 400 reason: "Invalid pet value" model: <none>
|
||||||
|
public void deletePet (String petId) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
|
// verify required params are set
|
||||||
|
if(petId == null ) {
|
||||||
|
throw new ApiException(400, "missing required params");
|
||||||
|
}
|
||||||
|
// create path and map variables
|
||||||
|
String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
|
||||||
|
|
||||||
|
// query params
|
||||||
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
|
if(response != null){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
} catch (ApiException ex) {
|
||||||
|
if(ex.getCode() == 404) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//error info- code: 400 reason: "Invalid tag value" model: <none>
|
||||||
public List<Pet> partialUpdate (String petId, Pet body) throws ApiException {
|
public List<Pet> partialUpdate (String petId, Pet body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(petId == null || body == null ) {
|
if(petId == null || body == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -122,13 +183,26 @@ public class PetApi {
|
|||||||
// query params
|
// query params
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json","application/xml"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "PATCH", queryParams, body, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "PATCH", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return (List<Pet>) ApiInvoker.deserialize(response, "Array", Pet.class);
|
return (List<Pet>) ApiInvoker.deserialize(response, "List", Pet.class);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return null;
|
return null;
|
||||||
@@ -142,38 +216,9 @@ public class PetApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void updatePetWithForm (String petId, String name, String status) throws ApiException {
|
//error info- code: 405 reason: "Invalid input" model: <none>
|
||||||
// verify required params are set
|
|
||||||
if(petId == null ) {
|
|
||||||
throw new ApiException(400, "missing required params");
|
|
||||||
}
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
|
|
||||||
|
|
||||||
// query params
|
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
|
||||||
|
|
||||||
String contentType = "application/json";
|
|
||||||
|
|
||||||
try {
|
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams, contentType);
|
|
||||||
if(response != null){
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
if(ex.getCode() == 404) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void addPet (Pet body) throws ApiException {
|
public void addPet (Pet body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(body == null ) {
|
if(body == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -184,11 +229,24 @@ public class PetApi {
|
|||||||
// query params
|
// query params
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json","application/xml"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@@ -204,7 +262,11 @@ public class PetApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//error info- code: 400 reason: "Invalid ID supplied" model: <none>
|
||||||
|
//error info- code: 404 reason: "Pet not found" model: <none>
|
||||||
|
//error info- code: 405 reason: "Validation exception" model: <none>
|
||||||
public void updatePet (Pet body) throws ApiException {
|
public void updatePet (Pet body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(body == null ) {
|
if(body == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -215,11 +277,24 @@ public class PetApi {
|
|||||||
// query params
|
// query params
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@@ -235,7 +310,9 @@ public class PetApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//error info- code: 400 reason: "Invalid status value" model: <none>
|
||||||
public List<Pet> findPetsByStatus (String status) throws ApiException {
|
public List<Pet> findPetsByStatus (String status) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(status == null ) {
|
if(status == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -246,15 +323,28 @@ public class PetApi {
|
|||||||
// query params
|
// query params
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
if(!"null".equals(String.valueOf(status)))
|
if(!"null".equals(String.valueOf(status)))
|
||||||
queryParams.put("status", String.valueOf(status));
|
queryParams.put("status", String.valueOf(status));
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return (List<Pet>) ApiInvoker.deserialize(response, "Array", Pet.class);
|
return (List<Pet>) ApiInvoker.deserialize(response, "List", Pet.class);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return null;
|
return null;
|
||||||
@@ -268,7 +358,9 @@ public class PetApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//error info- code: 400 reason: "Invalid tag value" model: <none>
|
||||||
public List<Pet> findPetsByTags (String tags) throws ApiException {
|
public List<Pet> findPetsByTags (String tags) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(tags == null ) {
|
if(tags == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -279,15 +371,28 @@ public class PetApi {
|
|||||||
// query params
|
// query params
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
if(!"null".equals(String.valueOf(tags)))
|
if(!"null".equals(String.valueOf(tags)))
|
||||||
queryParams.put("tags", String.valueOf(tags));
|
queryParams.put("tags", String.valueOf(tags));
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return (List<Pet>) ApiInvoker.deserialize(response, "Array", Pet.class);
|
return (List<Pet>) ApiInvoker.deserialize(response, "List", Pet.class);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return null;
|
return null;
|
||||||
@@ -301,5 +406,50 @@ public class PetApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void uploadFile (String additionalMetadata, File file) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
|
// create path and map variables
|
||||||
|
String path = "/pet/uploadImage".replaceAll("\\{format\\}","json");
|
||||||
|
|
||||||
|
// query params
|
||||||
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
String[] contentTypes = {
|
||||||
|
"multipart/form-data"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
hasFields = true;
|
||||||
|
mp.field("additionalMetadata", additionalMetadata, MediaType.MULTIPART_FORM_DATA_TYPE);
|
||||||
|
hasFields = true;
|
||||||
|
mp.field("file", file, MediaType.MULTIPART_FORM_DATA_TYPE);
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
formParams.put("additionalMetadata", additionalMetadata);}
|
||||||
|
|
||||||
|
try {
|
||||||
|
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
|
if(response != null){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
} catch (ApiException ex) {
|
||||||
|
if(ex.getCode() == 404) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,13 @@ package com.wordnik.petstore.api;
|
|||||||
|
|
||||||
import com.wordnik.client.ApiException;
|
import com.wordnik.client.ApiException;
|
||||||
import com.wordnik.client.ApiInvoker;
|
import com.wordnik.client.ApiInvoker;
|
||||||
|
|
||||||
import com.wordnik.petstore.model.Order;
|
import com.wordnik.petstore.model.Order;
|
||||||
|
import com.sun.jersey.multipart.FormDataMultiPart;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class StoreApi {
|
public class StoreApi {
|
||||||
@@ -21,22 +27,37 @@ public class StoreApi {
|
|||||||
return basePath;
|
return basePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteOrder (String orderId) throws ApiException {
|
//error info- code: 400 reason: "Invalid order" model: <none>
|
||||||
|
public void placeOrder (Order body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(orderId == null ) {
|
if(body == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
}
|
}
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString()));
|
String path = "/store/order".replaceAll("\\{format\\}","json");
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@@ -52,7 +73,10 @@ public class StoreApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public Order getOrderById (String orderId) throws ApiException {
|
//error info- code: 400 reason: "Invalid ID supplied" model: <none>
|
||||||
|
//error info- code: 404 reason: "Order not found" model: <none>
|
||||||
|
public void deleteOrder (String orderId) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(orderId == null ) {
|
if(orderId == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -63,11 +87,71 @@ public class StoreApi {
|
|||||||
// query params
|
// query params
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
|
if(response != null){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
} catch (ApiException ex) {
|
||||||
|
if(ex.getCode() == 404) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//error info- code: 400 reason: "Invalid ID supplied" model: <none>
|
||||||
|
//error info- code: 404 reason: "Order not found" model: <none>
|
||||||
|
public Order getOrderById (String orderId) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
|
// verify required params are set
|
||||||
|
if(orderId == null ) {
|
||||||
|
throw new ApiException(400, "missing required params");
|
||||||
|
}
|
||||||
|
// create path and map variables
|
||||||
|
String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString()));
|
||||||
|
|
||||||
|
// query params
|
||||||
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return (Order) ApiInvoker.deserialize(response, "", Order.class);
|
return (Order) ApiInvoker.deserialize(response, "", Order.class);
|
||||||
}
|
}
|
||||||
@@ -83,36 +167,5 @@ public class StoreApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void placeOrder (Order body) throws ApiException {
|
|
||||||
// verify required params are set
|
|
||||||
if(body == null ) {
|
|
||||||
throw new ApiException(400, "missing required params");
|
|
||||||
}
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/store/order".replaceAll("\\{format\\}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
|
||||||
|
|
||||||
String contentType = "application/json";
|
|
||||||
|
|
||||||
try {
|
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
|
||||||
if(response != null){
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
if(ex.getCode() == 404) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,13 @@ package com.wordnik.petstore.api;
|
|||||||
|
|
||||||
import com.wordnik.client.ApiException;
|
import com.wordnik.client.ApiException;
|
||||||
import com.wordnik.client.ApiInvoker;
|
import com.wordnik.client.ApiInvoker;
|
||||||
|
|
||||||
import com.wordnik.petstore.model.User;
|
import com.wordnik.petstore.model.User;
|
||||||
|
import com.sun.jersey.multipart.FormDataMultiPart;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class UserApi {
|
public class UserApi {
|
||||||
@@ -21,9 +27,12 @@ public class UserApi {
|
|||||||
return basePath;
|
return basePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteUser (String username) throws ApiException {
|
//error info- code: 400 reason: "Invalid username supplied" model: <none>
|
||||||
|
//error info- code: 404 reason: "User not found" model: <none>
|
||||||
|
public void updateUser (String username, User body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(username == null ) {
|
if(username == null || body == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
}
|
}
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@@ -32,11 +41,24 @@ public class UserApi {
|
|||||||
// query params
|
// query params
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@@ -52,7 +74,10 @@ public class UserApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public User getUserByName (String username) throws ApiException {
|
//error info- code: 400 reason: "Invalid username supplied" model: <none>
|
||||||
|
//error info- code: 404 reason: "User not found" model: <none>
|
||||||
|
public void deleteUser (String username) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(username == null ) {
|
if(username == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -63,11 +88,71 @@ public class UserApi {
|
|||||||
// query params
|
// query params
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
|
if(response != null){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
} catch (ApiException ex) {
|
||||||
|
if(ex.getCode() == 404) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//error info- code: 400 reason: "Invalid username supplied" model: <none>
|
||||||
|
//error info- code: 404 reason: "User not found" model: <none>
|
||||||
|
public User getUserByName (String username) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
|
// verify required params are set
|
||||||
|
if(username == null ) {
|
||||||
|
throw new ApiException(400, "missing required params");
|
||||||
|
}
|
||||||
|
// create path and map variables
|
||||||
|
String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
|
||||||
|
|
||||||
|
// query params
|
||||||
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return (User) ApiInvoker.deserialize(response, "", User.class);
|
return (User) ApiInvoker.deserialize(response, "", User.class);
|
||||||
}
|
}
|
||||||
@@ -83,38 +168,9 @@ public class UserApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void updateUser (String username, User body) throws ApiException {
|
//error info- code: 400 reason: "Invalid username and password combination" model: <none>
|
||||||
// verify required params are set
|
|
||||||
if(username == null || body == null ) {
|
|
||||||
throw new ApiException(400, "missing required params");
|
|
||||||
}
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
|
|
||||||
|
|
||||||
// query params
|
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
|
||||||
|
|
||||||
String contentType = "application/json";
|
|
||||||
|
|
||||||
try {
|
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams, contentType);
|
|
||||||
if(response != null){
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
if(ex.getCode() == 404) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public String loginUser (String username, String password) throws ApiException {
|
public String loginUser (String username, String password) throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(username == null || password == null ) {
|
if(username == null || password == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -125,15 +181,28 @@ public class UserApi {
|
|||||||
// query params
|
// query params
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
if(!"null".equals(String.valueOf(username)))
|
if(!"null".equals(String.valueOf(username)))
|
||||||
queryParams.put("username", String.valueOf(username));
|
queryParams.put("username", String.valueOf(username));
|
||||||
if(!"null".equals(String.valueOf(password)))
|
if(!"null".equals(String.valueOf(password)))
|
||||||
queryParams.put("password", String.valueOf(password));
|
queryParams.put("password", String.valueOf(password));
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return (String) ApiInvoker.deserialize(response, "", String.class);
|
return (String) ApiInvoker.deserialize(response, "", String.class);
|
||||||
}
|
}
|
||||||
@@ -150,48 +219,31 @@ public class UserApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void logoutUser () throws ApiException {
|
public void logoutUser () throws ApiException {
|
||||||
|
Object postBody = null;
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
String path = "/user/logout".replaceAll("\\{format\\}","json");
|
String path = "/user/logout".replaceAll("\\{format\\}","json");
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
if(response != null){
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
if(ex.getCode() == 404) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void createUser (User body) throws ApiException {
|
|
||||||
// verify required params are set
|
|
||||||
if(body == null ) {
|
|
||||||
throw new ApiException(400, "missing required params");
|
|
||||||
}
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/user".replaceAll("\\{format\\}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
|
||||||
|
|
||||||
String contentType = "application/json";
|
|
||||||
|
|
||||||
try {
|
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@@ -208,6 +260,7 @@ public class UserApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void createUsersWithArrayInput (List<User> body) throws ApiException {
|
public void createUsersWithArrayInput (List<User> body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(body == null ) {
|
if(body == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -218,11 +271,24 @@ public class UserApi {
|
|||||||
// query params
|
// query params
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@@ -239,6 +305,7 @@ public class UserApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void createUsersWithListInput (List<User> body) throws ApiException {
|
public void createUsersWithListInput (List<User> body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
if(body == null ) {
|
if(body == null ) {
|
||||||
throw new ApiException(400, "missing required params");
|
throw new ApiException(400, "missing required params");
|
||||||
@@ -249,11 +316,69 @@ public class UserApi {
|
|||||||
// query params
|
// query params
|
||||||
Map<String, String> queryParams = new HashMap<String, String>();
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
String contentType = "application/json";
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
|
if(response != null){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
} catch (ApiException ex) {
|
||||||
|
if(ex.getCode() == 404) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void createUser (User body) throws ApiException {
|
||||||
|
Object postBody = body;
|
||||||
|
// verify required params are set
|
||||||
|
if(body == null ) {
|
||||||
|
throw new ApiException(400, "missing required params");
|
||||||
|
}
|
||||||
|
// create path and map variables
|
||||||
|
String path = "/user".replaceAll("\\{format\\}","json");
|
||||||
|
|
||||||
|
// query params
|
||||||
|
Map<String, String> queryParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> formParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
String[] contentTypes = {
|
||||||
|
"application/json"};
|
||||||
|
|
||||||
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
|
|
||||||
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
|
boolean hasFields = false;
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
if(hasFields)
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
|
||||||
if(response != null){
|
if(response != null){
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2012 Wordnik, Inc.
|
* Copyright 2014 Wordnik, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -23,7 +23,6 @@ object ObjcPetstoreCodegen extends BasicObjcGenerator {
|
|||||||
val outputFolder = "samples/client/petstore/objc/"
|
val outputFolder = "samples/client/petstore/objc/"
|
||||||
override def destinationDir = outputFolder + java.io.File.separator + "client"
|
override def destinationDir = outputFolder + java.io.File.separator + "client"
|
||||||
|
|
||||||
// to avoid recompiling ...
|
|
||||||
override def templateDir = "objc"
|
override def templateDir = "objc"
|
||||||
|
|
||||||
additionalParams ++= Map("projectName" -> "PetstoreClient")
|
additionalParams ++= Map("projectName" -> "PetstoreClient")
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ static bool loggingEnabled = false;
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(body != nil) {
|
if(body != nil) {
|
||||||
if([body isKindOfClass:[NSDictionary class]]){
|
if([body isKindOfClass:[NSDictionary class]] || [body isKindOfClass:[NSArray class]]){
|
||||||
[request setValue:requestContentType forHTTPHeaderField:@"Content-Type"];
|
[request setValue:requestContentType forHTTPHeaderField:@"Content-Type"];
|
||||||
}
|
}
|
||||||
else if ([body isKindOfClass:[SWGFile class]]) {}
|
else if ([body isKindOfClass:[SWGFile class]]) {}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "SWGObject.h"
|
#import "SWGObject.h"
|
||||||
|
|
||||||
|
|
||||||
@interface SWGCategory : SWGObject
|
@interface SWGCategory : SWGObject
|
||||||
|
|
||||||
@property(nonatomic) NSNumber* _id; /* Category unique identifier [optional]*/
|
@property(nonatomic) NSNumber* _id;
|
||||||
|
|
||||||
@property(nonatomic) NSString* name; /* Name of the category [optional]*/
|
@property(nonatomic) NSString* name;
|
||||||
|
|
||||||
- (id) _id: (NSNumber*) _id
|
- (id) _id: (NSNumber*) _id
|
||||||
name: (NSString*) name;
|
name: (NSString*) name;
|
||||||
|
|||||||
@@ -2,17 +2,18 @@
|
|||||||
#import "SWGObject.h"
|
#import "SWGObject.h"
|
||||||
#import "SWGDate.h"
|
#import "SWGDate.h"
|
||||||
|
|
||||||
|
|
||||||
@interface SWGOrder : SWGObject
|
@interface SWGOrder : SWGObject
|
||||||
|
|
||||||
@property(nonatomic) NSNumber* _id; /* Unique identifier for the order [optional]*/
|
@property(nonatomic) NSNumber* _id;
|
||||||
|
|
||||||
@property(nonatomic) NSNumber* petId; /* ID of pet being ordered [optional]*/
|
@property(nonatomic) NSNumber* petId;
|
||||||
|
|
||||||
@property(nonatomic) NSNumber* quantity; /* Number of pets ordered [optional]*/
|
@property(nonatomic) NSNumber* quantity;
|
||||||
|
|
||||||
@property(nonatomic) NSString* status; /* Status of the order [optional]*/
|
@property(nonatomic) NSString* status; /* Order Status [optional]*/
|
||||||
|
|
||||||
@property(nonatomic) SWGDate* shipDate; /* Date shipped, only if it has been [optional]*/
|
@property(nonatomic) SWGDate* shipDate;
|
||||||
|
|
||||||
- (id) _id: (NSNumber*) _id
|
- (id) _id: (NSNumber*) _id
|
||||||
petId: (NSNumber*) petId
|
petId: (NSNumber*) petId
|
||||||
|
|||||||
@@ -3,17 +3,18 @@
|
|||||||
#import "SWGCategory.h"
|
#import "SWGCategory.h"
|
||||||
#import "SWGTag.h"
|
#import "SWGTag.h"
|
||||||
|
|
||||||
|
|
||||||
@interface SWGPet : SWGObject
|
@interface SWGPet : SWGObject
|
||||||
|
|
||||||
@property(nonatomic) NSNumber* _id; /* Unique identifier for the Pet */
|
@property(nonatomic) NSNumber* _id; /* unique identifier for the pet */
|
||||||
|
|
||||||
@property(nonatomic) SWGCategory* category; /* Category the pet is in [optional]*/
|
@property(nonatomic) SWGCategory* category;
|
||||||
|
|
||||||
@property(nonatomic) NSString* name; /* Friendly name of the pet */
|
@property(nonatomic) NSString* name;
|
||||||
|
|
||||||
@property(nonatomic) NSArray* photoUrls; /* Image URLs [optional]*/
|
@property(nonatomic) NSArray* photoUrls;
|
||||||
|
|
||||||
@property(nonatomic) NSArray* tags; /* Tags assigned to this pet [optional]*/
|
@property(nonatomic) NSArray* tags;
|
||||||
|
|
||||||
@property(nonatomic) NSString* status; /* pet status in the store [optional]*/
|
@property(nonatomic) NSString* status; /* pet status in the store [optional]*/
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#import "SWGFile.h"
|
#import "SWGFile.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@interface SWGPetApi: NSObject
|
@interface SWGPetApi: NSObject
|
||||||
|
|
||||||
-(void) addHeader:(NSString*)value forKey:(NSString*)key;
|
-(void) addHeader:(NSString*)value forKey:(NSString*)key;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@implementation SWGPetApi
|
@implementation SWGPetApi
|
||||||
static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||||
|
|
||||||
@@ -561,4 +562,5 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#import "SWGOrder.h"
|
#import "SWGOrder.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@interface SWGStoreApi: NSObject
|
@interface SWGStoreApi: NSObject
|
||||||
|
|
||||||
-(void) addHeader:(NSString*)value forKey:(NSString*)key;
|
-(void) addHeader:(NSString*)value forKey:(NSString*)key;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@implementation SWGStoreApi
|
@implementation SWGStoreApi
|
||||||
static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||||
|
|
||||||
@@ -202,4 +203,5 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "SWGObject.h"
|
#import "SWGObject.h"
|
||||||
|
|
||||||
|
|
||||||
@interface SWGTag : SWGObject
|
@interface SWGTag : SWGObject
|
||||||
|
|
||||||
@property(nonatomic) NSNumber* _id; /* Unique identifier for the tag [optional]*/
|
@property(nonatomic) NSNumber* _id;
|
||||||
|
|
||||||
@property(nonatomic) NSString* name; /* Friendly name for the tag [optional]*/
|
@property(nonatomic) NSString* name;
|
||||||
|
|
||||||
- (id) _id: (NSNumber*) _id
|
- (id) _id: (NSNumber*) _id
|
||||||
name: (NSString*) name;
|
name: (NSString*) name;
|
||||||
|
|||||||
@@ -1,27 +1,28 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "SWGObject.h"
|
#import "SWGObject.h"
|
||||||
|
|
||||||
|
|
||||||
@interface SWGUser : SWGObject
|
@interface SWGUser : SWGObject
|
||||||
|
|
||||||
@property(nonatomic) NSNumber* _id; /* Unique identifier for the user [optional]*/
|
@property(nonatomic) NSNumber* _id;
|
||||||
|
|
||||||
@property(nonatomic) NSString* username; /* Unique username [optional]*/
|
@property(nonatomic) NSString* firstName;
|
||||||
|
|
||||||
@property(nonatomic) NSString* firstName; /* First name of the user [optional]*/
|
@property(nonatomic) NSString* username;
|
||||||
|
|
||||||
@property(nonatomic) NSString* lastName; /* Last name of the user [optional]*/
|
@property(nonatomic) NSString* lastName;
|
||||||
|
|
||||||
@property(nonatomic) NSString* email; /* Email address of the user [optional]*/
|
@property(nonatomic) NSString* email;
|
||||||
|
|
||||||
@property(nonatomic) NSString* password; /* Password name of the user [optional]*/
|
@property(nonatomic) NSString* password;
|
||||||
|
|
||||||
@property(nonatomic) NSString* phone; /* Phone number of the user [optional]*/
|
@property(nonatomic) NSString* phone;
|
||||||
|
|
||||||
@property(nonatomic) NSNumber* userStatus; /* User Status [optional]*/
|
@property(nonatomic) NSNumber* userStatus; /* User Status [optional]*/
|
||||||
|
|
||||||
- (id) _id: (NSNumber*) _id
|
- (id) _id: (NSNumber*) _id
|
||||||
username: (NSString*) username
|
|
||||||
firstName: (NSString*) firstName
|
firstName: (NSString*) firstName
|
||||||
|
username: (NSString*) username
|
||||||
lastName: (NSString*) lastName
|
lastName: (NSString*) lastName
|
||||||
email: (NSString*) email
|
email: (NSString*) email
|
||||||
password: (NSString*) password
|
password: (NSString*) password
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
@implementation SWGUser
|
@implementation SWGUser
|
||||||
|
|
||||||
-(id)_id: (NSNumber*) _id
|
-(id)_id: (NSNumber*) _id
|
||||||
username: (NSString*) username
|
|
||||||
firstName: (NSString*) firstName
|
firstName: (NSString*) firstName
|
||||||
|
username: (NSString*) username
|
||||||
lastName: (NSString*) lastName
|
lastName: (NSString*) lastName
|
||||||
email: (NSString*) email
|
email: (NSString*) email
|
||||||
password: (NSString*) password
|
password: (NSString*) password
|
||||||
@@ -13,8 +13,8 @@
|
|||||||
userStatus: (NSNumber*) userStatus
|
userStatus: (NSNumber*) userStatus
|
||||||
{
|
{
|
||||||
__id = _id;
|
__id = _id;
|
||||||
_username = username;
|
|
||||||
_firstName = firstName;
|
_firstName = firstName;
|
||||||
|
_username = username;
|
||||||
_lastName = lastName;
|
_lastName = lastName;
|
||||||
_email = email;
|
_email = email;
|
||||||
_password = password;
|
_password = password;
|
||||||
@@ -28,8 +28,8 @@
|
|||||||
self = [super init];
|
self = [super init];
|
||||||
if(self) {
|
if(self) {
|
||||||
__id = dict[@"id"];
|
__id = dict[@"id"];
|
||||||
_username = dict[@"username"];
|
|
||||||
_firstName = dict[@"firstName"];
|
_firstName = dict[@"firstName"];
|
||||||
|
_username = dict[@"username"];
|
||||||
_lastName = dict[@"lastName"];
|
_lastName = dict[@"lastName"];
|
||||||
_email = dict[@"email"];
|
_email = dict[@"email"];
|
||||||
_password = dict[@"password"];
|
_password = dict[@"password"];
|
||||||
@@ -44,8 +44,8 @@
|
|||||||
-(NSDictionary*) asDictionary {
|
-(NSDictionary*) asDictionary {
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
||||||
if(__id != nil) dict[@"id"] = __id ;
|
if(__id != nil) dict[@"id"] = __id ;
|
||||||
if(_username != nil) dict[@"username"] = _username ;
|
|
||||||
if(_firstName != nil) dict[@"firstName"] = _firstName ;
|
if(_firstName != nil) dict[@"firstName"] = _firstName ;
|
||||||
|
if(_username != nil) dict[@"username"] = _username ;
|
||||||
if(_lastName != nil) dict[@"lastName"] = _lastName ;
|
if(_lastName != nil) dict[@"lastName"] = _lastName ;
|
||||||
if(_email != nil) dict[@"email"] = _email ;
|
if(_email != nil) dict[@"email"] = _email ;
|
||||||
if(_password != nil) dict[@"password"] = _password ;
|
if(_password != nil) dict[@"password"] = _password ;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#import "SWGUser.h"
|
#import "SWGUser.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@interface SWGUserApi: NSObject
|
@interface SWGUserApi: NSObject
|
||||||
|
|
||||||
-(void) addHeader:(NSString*)value forKey:(NSString*)key;
|
-(void) addHeader:(NSString*)value forKey:(NSString*)key;
|
||||||
@@ -9,33 +10,6 @@
|
|||||||
+(SWGUserApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
|
+(SWGUserApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
|
||||||
+(void) setBasePath:(NSString*)basePath;
|
+(void) setBasePath:(NSString*)basePath;
|
||||||
+(NSString*) getBasePath;
|
+(NSString*) getBasePath;
|
||||||
/**
|
|
||||||
|
|
||||||
Create user
|
|
||||||
This can only be done by the logged in user.
|
|
||||||
@param body Created user object
|
|
||||||
*/
|
|
||||||
-(NSNumber*) createUserWithCompletionBlock :(SWGUser*) body
|
|
||||||
completionHandler: (void (^)(NSError* error))completionBlock;
|
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
Creates list of users with given input array
|
|
||||||
|
|
||||||
@param body List of user object
|
|
||||||
*/
|
|
||||||
-(NSNumber*) createUsersWithArrayInputWithCompletionBlock :(NSArray*) body
|
|
||||||
completionHandler: (void (^)(NSError* error))completionBlock;
|
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
Creates list of users with given list input
|
|
||||||
|
|
||||||
@param body List of user object
|
|
||||||
*/
|
|
||||||
-(NSNumber*) createUsersWithListInputWithCompletionBlock :(NSArray*) body
|
|
||||||
completionHandler: (void (^)(NSError* error))completionBlock;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Updated user
|
Updated user
|
||||||
@@ -83,4 +57,31 @@
|
|||||||
*/
|
*/
|
||||||
-(NSNumber*) logoutUserWithCompletionBlock :(void (^)(NSError* error))completionBlock;
|
-(NSNumber*) logoutUserWithCompletionBlock :(void (^)(NSError* error))completionBlock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Create user
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
@param body Created user object
|
||||||
|
*/
|
||||||
|
-(NSNumber*) createUserWithCompletionBlock :(SWGUser*) body
|
||||||
|
completionHandler: (void (^)(NSError* error))completionBlock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Creates list of users with given input array
|
||||||
|
|
||||||
|
@param body List of user object
|
||||||
|
*/
|
||||||
|
-(NSNumber*) createUsersWithArrayInputWithCompletionBlock :(NSArray*) body
|
||||||
|
completionHandler: (void (^)(NSError* error))completionBlock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Creates list of users with given list input
|
||||||
|
|
||||||
|
@param body List of user object
|
||||||
|
*/
|
||||||
|
-(NSNumber*) createUsersWithListInputWithCompletionBlock :(NSArray*) body
|
||||||
|
completionHandler: (void (^)(NSError* error))completionBlock;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@implementation SWGUserApi
|
@implementation SWGUserApi
|
||||||
static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||||
|
|
||||||
@@ -50,219 +51,6 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-(NSNumber*) createUserWithCompletionBlock:(SWGUser*) body
|
|
||||||
completionHandler: (void (^)(NSError* error))completionBlock{
|
|
||||||
|
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user", basePath];
|
|
||||||
|
|
||||||
// remove format in URL if needed
|
|
||||||
if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
|
|
||||||
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
|
|
||||||
|
|
||||||
NSString* requestContentType = @"application/json";
|
|
||||||
NSString* responseContentType = @"application/json";
|
|
||||||
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
if(body != nil && [body isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
|
||||||
for (id dict in (NSArray*)body) {
|
|
||||||
if([dict respondsToSelector:@selector(asDictionary)]) {
|
|
||||||
[objs addObject:[(SWGObject*)dict asDictionary]];
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
[objs addObject:dict];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bodyDictionary = objs;
|
|
||||||
}
|
|
||||||
else if([body respondsToSelector:@selector(asDictionary)]) {
|
|
||||||
bodyDictionary = [(SWGObject*)body asDictionary];
|
|
||||||
}
|
|
||||||
else if([body isKindOfClass:[NSString class]]) {
|
|
||||||
// convert it to a dictionary
|
|
||||||
NSError * error;
|
|
||||||
NSString * str = (NSString*)body;
|
|
||||||
NSDictionary *JSON =
|
|
||||||
[NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
|
|
||||||
options:NSJSONReadingMutableContainers
|
|
||||||
error:&error];
|
|
||||||
bodyDictionary = JSON;
|
|
||||||
}
|
|
||||||
else if([body isKindOfClass: [SWGFile class]]) {
|
|
||||||
requestContentType = @"form-data";
|
|
||||||
bodyDictionary = body;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
NSLog(@"don't know what to do with %@", body);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(body == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
|
|
||||||
|
|
||||||
return [client stringWithCompletionBlock:requestUrl
|
|
||||||
method:@"POST"
|
|
||||||
queryParams:queryParams
|
|
||||||
body:bodyDictionary
|
|
||||||
headerParams:headerParams
|
|
||||||
requestContentType: requestContentType
|
|
||||||
responseContentType: responseContentType
|
|
||||||
completionBlock:^(NSString *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
completionBlock(nil);
|
|
||||||
}];
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSNumber*) createUsersWithArrayInputWithCompletionBlock:(NSArray*) body
|
|
||||||
completionHandler: (void (^)(NSError* error))completionBlock{
|
|
||||||
|
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/createWithArray", basePath];
|
|
||||||
|
|
||||||
// remove format in URL if needed
|
|
||||||
if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
|
|
||||||
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
|
|
||||||
|
|
||||||
NSString* requestContentType = @"application/json";
|
|
||||||
NSString* responseContentType = @"application/json";
|
|
||||||
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
if(body != nil && [body isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
|
||||||
for (id dict in (NSArray*)body) {
|
|
||||||
if([dict respondsToSelector:@selector(asDictionary)]) {
|
|
||||||
[objs addObject:[(SWGObject*)dict asDictionary]];
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
[objs addObject:dict];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bodyDictionary = objs;
|
|
||||||
}
|
|
||||||
else if([body respondsToSelector:@selector(asDictionary)]) {
|
|
||||||
bodyDictionary = [(SWGObject*)body asDictionary];
|
|
||||||
}
|
|
||||||
else if([body isKindOfClass:[NSString class]]) {
|
|
||||||
// convert it to a dictionary
|
|
||||||
NSError * error;
|
|
||||||
NSString * str = (NSString*)body;
|
|
||||||
NSDictionary *JSON =
|
|
||||||
[NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
|
|
||||||
options:NSJSONReadingMutableContainers
|
|
||||||
error:&error];
|
|
||||||
bodyDictionary = JSON;
|
|
||||||
}
|
|
||||||
else if([body isKindOfClass: [SWGFile class]]) {
|
|
||||||
requestContentType = @"form-data";
|
|
||||||
bodyDictionary = body;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
NSLog(@"don't know what to do with %@", body);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(body == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
|
|
||||||
|
|
||||||
return [client stringWithCompletionBlock:requestUrl
|
|
||||||
method:@"POST"
|
|
||||||
queryParams:queryParams
|
|
||||||
body:bodyDictionary
|
|
||||||
headerParams:headerParams
|
|
||||||
requestContentType: requestContentType
|
|
||||||
responseContentType: responseContentType
|
|
||||||
completionBlock:^(NSString *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
completionBlock(nil);
|
|
||||||
}];
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSNumber*) createUsersWithListInputWithCompletionBlock:(NSArray*) body
|
|
||||||
completionHandler: (void (^)(NSError* error))completionBlock{
|
|
||||||
|
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/createWithList", basePath];
|
|
||||||
|
|
||||||
// remove format in URL if needed
|
|
||||||
if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
|
|
||||||
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
|
|
||||||
|
|
||||||
NSString* requestContentType = @"application/json";
|
|
||||||
NSString* responseContentType = @"application/json";
|
|
||||||
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
if(body != nil && [body isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
|
||||||
for (id dict in (NSArray*)body) {
|
|
||||||
if([dict respondsToSelector:@selector(asDictionary)]) {
|
|
||||||
[objs addObject:[(SWGObject*)dict asDictionary]];
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
[objs addObject:dict];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bodyDictionary = objs;
|
|
||||||
}
|
|
||||||
else if([body respondsToSelector:@selector(asDictionary)]) {
|
|
||||||
bodyDictionary = [(SWGObject*)body asDictionary];
|
|
||||||
}
|
|
||||||
else if([body isKindOfClass:[NSString class]]) {
|
|
||||||
// convert it to a dictionary
|
|
||||||
NSError * error;
|
|
||||||
NSString * str = (NSString*)body;
|
|
||||||
NSDictionary *JSON =
|
|
||||||
[NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
|
|
||||||
options:NSJSONReadingMutableContainers
|
|
||||||
error:&error];
|
|
||||||
bodyDictionary = JSON;
|
|
||||||
}
|
|
||||||
else if([body isKindOfClass: [SWGFile class]]) {
|
|
||||||
requestContentType = @"form-data";
|
|
||||||
bodyDictionary = body;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
NSLog(@"don't know what to do with %@", body);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(body == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
|
|
||||||
|
|
||||||
return [client stringWithCompletionBlock:requestUrl
|
|
||||||
method:@"POST"
|
|
||||||
queryParams:queryParams
|
|
||||||
body:bodyDictionary
|
|
||||||
headerParams:headerParams
|
|
||||||
requestContentType: requestContentType
|
|
||||||
responseContentType: responseContentType
|
|
||||||
completionBlock:^(NSString *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
completionBlock(nil);
|
|
||||||
}];
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSNumber*) updateUserWithCompletionBlock:(NSString*) username
|
-(NSNumber*) updateUserWithCompletionBlock:(NSString*) username
|
||||||
body:(SWGUser*) body
|
body:(SWGUser*) body
|
||||||
completionHandler: (void (^)(NSError* error))completionBlock{
|
completionHandler: (void (^)(NSError* error))completionBlock{
|
||||||
@@ -500,5 +288,219 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(NSNumber*) createUserWithCompletionBlock:(SWGUser*) body
|
||||||
|
completionHandler: (void (^)(NSError* error))completionBlock{
|
||||||
|
|
||||||
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user", basePath];
|
||||||
|
|
||||||
|
// remove format in URL if needed
|
||||||
|
if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
|
||||||
|
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
|
||||||
|
|
||||||
|
NSString* requestContentType = @"application/json";
|
||||||
|
NSString* responseContentType = @"application/json";
|
||||||
|
|
||||||
|
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||||
|
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
||||||
|
id bodyDictionary = nil;
|
||||||
|
if(body != nil && [body isKindOfClass:[NSArray class]]){
|
||||||
|
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
||||||
|
for (id dict in (NSArray*)body) {
|
||||||
|
if([dict respondsToSelector:@selector(asDictionary)]) {
|
||||||
|
[objs addObject:[(SWGObject*)dict asDictionary]];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
[objs addObject:dict];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bodyDictionary = objs;
|
||||||
|
}
|
||||||
|
else if([body respondsToSelector:@selector(asDictionary)]) {
|
||||||
|
bodyDictionary = [(SWGObject*)body asDictionary];
|
||||||
|
}
|
||||||
|
else if([body isKindOfClass:[NSString class]]) {
|
||||||
|
// convert it to a dictionary
|
||||||
|
NSError * error;
|
||||||
|
NSString * str = (NSString*)body;
|
||||||
|
NSDictionary *JSON =
|
||||||
|
[NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
|
||||||
|
options:NSJSONReadingMutableContainers
|
||||||
|
error:&error];
|
||||||
|
bodyDictionary = JSON;
|
||||||
|
}
|
||||||
|
else if([body isKindOfClass: [SWGFile class]]) {
|
||||||
|
requestContentType = @"form-data";
|
||||||
|
bodyDictionary = body;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
NSLog(@"don't know what to do with %@", body);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(body == nil) {
|
||||||
|
// error
|
||||||
|
}
|
||||||
|
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
|
||||||
|
|
||||||
|
return [client stringWithCompletionBlock:requestUrl
|
||||||
|
method:@"POST"
|
||||||
|
queryParams:queryParams
|
||||||
|
body:bodyDictionary
|
||||||
|
headerParams:headerParams
|
||||||
|
requestContentType: requestContentType
|
||||||
|
responseContentType: responseContentType
|
||||||
|
completionBlock:^(NSString *data, NSError *error) {
|
||||||
|
if (error) {
|
||||||
|
completionBlock(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
completionBlock(nil);
|
||||||
|
}];
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSNumber*) createUsersWithArrayInputWithCompletionBlock:(NSArray*) body
|
||||||
|
completionHandler: (void (^)(NSError* error))completionBlock{
|
||||||
|
|
||||||
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/createWithArray", basePath];
|
||||||
|
|
||||||
|
// remove format in URL if needed
|
||||||
|
if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
|
||||||
|
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
|
||||||
|
|
||||||
|
NSString* requestContentType = @"application/json";
|
||||||
|
NSString* responseContentType = @"application/json";
|
||||||
|
|
||||||
|
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||||
|
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
||||||
|
id bodyDictionary = nil;
|
||||||
|
if(body != nil && [body isKindOfClass:[NSArray class]]){
|
||||||
|
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
||||||
|
for (id dict in (NSArray*)body) {
|
||||||
|
if([dict respondsToSelector:@selector(asDictionary)]) {
|
||||||
|
[objs addObject:[(SWGObject*)dict asDictionary]];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
[objs addObject:dict];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bodyDictionary = objs;
|
||||||
|
}
|
||||||
|
else if([body respondsToSelector:@selector(asDictionary)]) {
|
||||||
|
bodyDictionary = [(SWGObject*)body asDictionary];
|
||||||
|
}
|
||||||
|
else if([body isKindOfClass:[NSString class]]) {
|
||||||
|
// convert it to a dictionary
|
||||||
|
NSError * error;
|
||||||
|
NSString * str = (NSString*)body;
|
||||||
|
NSDictionary *JSON =
|
||||||
|
[NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
|
||||||
|
options:NSJSONReadingMutableContainers
|
||||||
|
error:&error];
|
||||||
|
bodyDictionary = JSON;
|
||||||
|
}
|
||||||
|
else if([body isKindOfClass: [SWGFile class]]) {
|
||||||
|
requestContentType = @"form-data";
|
||||||
|
bodyDictionary = body;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
NSLog(@"don't know what to do with %@", body);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(body == nil) {
|
||||||
|
// error
|
||||||
|
}
|
||||||
|
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
|
||||||
|
|
||||||
|
return [client stringWithCompletionBlock:requestUrl
|
||||||
|
method:@"POST"
|
||||||
|
queryParams:queryParams
|
||||||
|
body:bodyDictionary
|
||||||
|
headerParams:headerParams
|
||||||
|
requestContentType: requestContentType
|
||||||
|
responseContentType: responseContentType
|
||||||
|
completionBlock:^(NSString *data, NSError *error) {
|
||||||
|
if (error) {
|
||||||
|
completionBlock(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
completionBlock(nil);
|
||||||
|
}];
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSNumber*) createUsersWithListInputWithCompletionBlock:(NSArray*) body
|
||||||
|
completionHandler: (void (^)(NSError* error))completionBlock{
|
||||||
|
|
||||||
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/createWithList", basePath];
|
||||||
|
|
||||||
|
// remove format in URL if needed
|
||||||
|
if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
|
||||||
|
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
|
||||||
|
|
||||||
|
NSString* requestContentType = @"application/json";
|
||||||
|
NSString* responseContentType = @"application/json";
|
||||||
|
|
||||||
|
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||||
|
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
||||||
|
id bodyDictionary = nil;
|
||||||
|
if(body != nil && [body isKindOfClass:[NSArray class]]){
|
||||||
|
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
||||||
|
for (id dict in (NSArray*)body) {
|
||||||
|
if([dict respondsToSelector:@selector(asDictionary)]) {
|
||||||
|
[objs addObject:[(SWGObject*)dict asDictionary]];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
[objs addObject:dict];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bodyDictionary = objs;
|
||||||
|
}
|
||||||
|
else if([body respondsToSelector:@selector(asDictionary)]) {
|
||||||
|
bodyDictionary = [(SWGObject*)body asDictionary];
|
||||||
|
}
|
||||||
|
else if([body isKindOfClass:[NSString class]]) {
|
||||||
|
// convert it to a dictionary
|
||||||
|
NSError * error;
|
||||||
|
NSString * str = (NSString*)body;
|
||||||
|
NSDictionary *JSON =
|
||||||
|
[NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
|
||||||
|
options:NSJSONReadingMutableContainers
|
||||||
|
error:&error];
|
||||||
|
bodyDictionary = JSON;
|
||||||
|
}
|
||||||
|
else if([body isKindOfClass: [SWGFile class]]) {
|
||||||
|
requestContentType = @"form-data";
|
||||||
|
bodyDictionary = body;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
NSLog(@"don't know what to do with %@", body);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(body == nil) {
|
||||||
|
// error
|
||||||
|
}
|
||||||
|
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
|
||||||
|
|
||||||
|
return [client stringWithCompletionBlock:requestUrl
|
||||||
|
method:@"POST"
|
||||||
|
queryParams:queryParams
|
||||||
|
body:bodyDictionary
|
||||||
|
headerParams:headerParams
|
||||||
|
requestContentType: requestContentType
|
||||||
|
responseContentType: responseContentType
|
||||||
|
completionBlock:^(NSString *data, NSError *error) {
|
||||||
|
if (error) {
|
||||||
|
completionBlock(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
completionBlock(nil);
|
||||||
|
}];
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2012 Wordnik, Inc.
|
* Copyright 2014 Wordnik, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ class PetApi {
|
|||||||
* getPetById
|
* getPetById
|
||||||
* Find pet by ID
|
* Find pet by ID
|
||||||
* petId, int: ID of pet that needs to be fetched (required)
|
* petId, int: ID of pet that needs to be fetched (required)
|
||||||
|
|
||||||
* @return Pet
|
* @return Pet
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -40,6 +41,8 @@ class PetApi {
|
|||||||
$method = "GET";
|
$method = "GET";
|
||||||
$queryParams = array();
|
$queryParams = array();
|
||||||
$headerParams = array();
|
$headerParams = array();
|
||||||
|
$headerParams['Accept'] = 'application/json';
|
||||||
|
$headerParams['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
if($petId != null) {
|
if($petId != null) {
|
||||||
$resourcePath = str_replace("{" . "petId" . "}",
|
$resourcePath = str_replace("{" . "petId" . "}",
|
||||||
@@ -67,6 +70,7 @@ class PetApi {
|
|||||||
* deletePet
|
* deletePet
|
||||||
* Deletes a pet
|
* Deletes a pet
|
||||||
* petId, string: Pet id to delete (required)
|
* petId, string: Pet id to delete (required)
|
||||||
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -78,6 +82,8 @@ class PetApi {
|
|||||||
$method = "DELETE";
|
$method = "DELETE";
|
||||||
$queryParams = array();
|
$queryParams = array();
|
||||||
$headerParams = array();
|
$headerParams = array();
|
||||||
|
$headerParams['Accept'] = 'application/json';
|
||||||
|
$headerParams['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
if($petId != null) {
|
if($petId != null) {
|
||||||
$resourcePath = str_replace("{" . "petId" . "}",
|
$resourcePath = str_replace("{" . "petId" . "}",
|
||||||
@@ -97,7 +103,9 @@ class PetApi {
|
|||||||
* partialUpdate
|
* partialUpdate
|
||||||
* partial updates to a pet
|
* partial updates to a pet
|
||||||
* petId, string: ID of pet that needs to be fetched (required)
|
* petId, string: ID of pet that needs to be fetched (required)
|
||||||
|
|
||||||
* body, Pet: Pet object that needs to be added to the store (required)
|
* body, Pet: Pet object that needs to be added to the store (required)
|
||||||
|
|
||||||
* @return Array[Pet]
|
* @return Array[Pet]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -109,6 +117,8 @@ class PetApi {
|
|||||||
$method = "PATCH";
|
$method = "PATCH";
|
||||||
$queryParams = array();
|
$queryParams = array();
|
||||||
$headerParams = array();
|
$headerParams = array();
|
||||||
|
$headerParams['Accept'] = 'application/json,application/xml';
|
||||||
|
$headerParams['Content-Type'] = 'application/json,application/xml';
|
||||||
|
|
||||||
if($petId != null) {
|
if($petId != null) {
|
||||||
$resourcePath = str_replace("{" . "petId" . "}",
|
$resourcePath = str_replace("{" . "petId" . "}",
|
||||||
@@ -136,8 +146,11 @@ class PetApi {
|
|||||||
* updatePetWithForm
|
* updatePetWithForm
|
||||||
* Updates a pet in the store with form data
|
* Updates a pet in the store with form data
|
||||||
* petId, string: ID of pet that needs to be updated (required)
|
* petId, string: ID of pet that needs to be updated (required)
|
||||||
|
|
||||||
* name, string: Updated name of the pet (optional)
|
* name, string: Updated name of the pet (optional)
|
||||||
|
|
||||||
* status, string: Updated status of the pet (optional)
|
* status, string: Updated status of the pet (optional)
|
||||||
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -149,6 +162,8 @@ class PetApi {
|
|||||||
$method = "POST";
|
$method = "POST";
|
||||||
$queryParams = array();
|
$queryParams = array();
|
||||||
$headerParams = array();
|
$headerParams = array();
|
||||||
|
$headerParams['Accept'] = 'application/json';
|
||||||
|
$headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||||
|
|
||||||
if($petId != null) {
|
if($petId != null) {
|
||||||
$resourcePath = str_replace("{" . "petId" . "}",
|
$resourcePath = str_replace("{" . "petId" . "}",
|
||||||
@@ -168,7 +183,9 @@ class PetApi {
|
|||||||
* uploadFile
|
* uploadFile
|
||||||
* uploads an image
|
* uploads an image
|
||||||
* additionalMetadata, string: Additional data to pass to server (optional)
|
* additionalMetadata, string: Additional data to pass to server (optional)
|
||||||
|
|
||||||
* body, File: file to upload (optional)
|
* body, File: file to upload (optional)
|
||||||
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -180,6 +197,8 @@ class PetApi {
|
|||||||
$method = "POST";
|
$method = "POST";
|
||||||
$queryParams = array();
|
$queryParams = array();
|
||||||
$headerParams = array();
|
$headerParams = array();
|
||||||
|
$headerParams['Accept'] = 'application/json';
|
||||||
|
$headerParams['Content-Type'] = 'multipart/form-data';
|
||||||
|
|
||||||
//make the API Call
|
//make the API Call
|
||||||
if (! isset($body)) {
|
if (! isset($body)) {
|
||||||
@@ -195,6 +214,7 @@ class PetApi {
|
|||||||
* addPet
|
* addPet
|
||||||
* Add a new pet to the store
|
* Add a new pet to the store
|
||||||
* body, Pet: Pet object that needs to be added to the store (required)
|
* body, Pet: Pet object that needs to be added to the store (required)
|
||||||
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -206,6 +226,8 @@ class PetApi {
|
|||||||
$method = "POST";
|
$method = "POST";
|
||||||
$queryParams = array();
|
$queryParams = array();
|
||||||
$headerParams = array();
|
$headerParams = array();
|
||||||
|
$headerParams['Accept'] = 'application/json';
|
||||||
|
$headerParams['Content-Type'] = 'application/json,application/xml';
|
||||||
|
|
||||||
//make the API Call
|
//make the API Call
|
||||||
if (! isset($body)) {
|
if (! isset($body)) {
|
||||||
@@ -221,6 +243,7 @@ class PetApi {
|
|||||||
* updatePet
|
* updatePet
|
||||||
* Update an existing pet
|
* Update an existing pet
|
||||||
* body, Pet: Pet object that needs to be updated in the store (required)
|
* body, Pet: Pet object that needs to be updated in the store (required)
|
||||||
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -232,6 +255,8 @@ class PetApi {
|
|||||||
$method = "PUT";
|
$method = "PUT";
|
||||||
$queryParams = array();
|
$queryParams = array();
|
||||||
$headerParams = array();
|
$headerParams = array();
|
||||||
|
$headerParams['Accept'] = 'application/json';
|
||||||
|
$headerParams['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
//make the API Call
|
//make the API Call
|
||||||
if (! isset($body)) {
|
if (! isset($body)) {
|
||||||
@@ -247,6 +272,7 @@ class PetApi {
|
|||||||
* findPetsByStatus
|
* findPetsByStatus
|
||||||
* Finds Pets by status
|
* Finds Pets by status
|
||||||
* status, string: Status values that need to be considered for filter (required)
|
* status, string: Status values that need to be considered for filter (required)
|
||||||
|
|
||||||
* @return Array[Pet]
|
* @return Array[Pet]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -258,6 +284,8 @@ class PetApi {
|
|||||||
$method = "GET";
|
$method = "GET";
|
||||||
$queryParams = array();
|
$queryParams = array();
|
||||||
$headerParams = array();
|
$headerParams = array();
|
||||||
|
$headerParams['Accept'] = 'application/json';
|
||||||
|
$headerParams['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
if($status != null) {
|
if($status != null) {
|
||||||
$queryParams['status'] = $this->apiClient->toQueryValue($status);
|
$queryParams['status'] = $this->apiClient->toQueryValue($status);
|
||||||
@@ -284,6 +312,7 @@ class PetApi {
|
|||||||
* findPetsByTags
|
* findPetsByTags
|
||||||
* Finds Pets by tags
|
* Finds Pets by tags
|
||||||
* tags, string: Tags to filter by (required)
|
* tags, string: Tags to filter by (required)
|
||||||
|
|
||||||
* @return Array[Pet]
|
* @return Array[Pet]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -295,6 +324,8 @@ class PetApi {
|
|||||||
$method = "GET";
|
$method = "GET";
|
||||||
$queryParams = array();
|
$queryParams = array();
|
||||||
$headerParams = array();
|
$headerParams = array();
|
||||||
|
$headerParams['Accept'] = 'application/json';
|
||||||
|
$headerParams['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
if($tags != null) {
|
if($tags != null) {
|
||||||
$queryParams['tags'] = $this->apiClient->toQueryValue($tags);
|
$queryParams['tags'] = $this->apiClient->toQueryValue($tags);
|
||||||
@@ -318,5 +349,6 @@ class PetApi {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ class StoreApi {
|
|||||||
* getOrderById
|
* getOrderById
|
||||||
* Find purchase order by ID
|
* Find purchase order by ID
|
||||||
* orderId, string: ID of pet that needs to be fetched (required)
|
* orderId, string: ID of pet that needs to be fetched (required)
|
||||||
|
|
||||||
* @return Order
|
* @return Order
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -40,6 +41,8 @@ class StoreApi {
|
|||||||
$method = "GET";
|
$method = "GET";
|
||||||
$queryParams = array();
|
$queryParams = array();
|
||||||
$headerParams = array();
|
$headerParams = array();
|
||||||
|
$headerParams['Accept'] = 'application/json';
|
||||||
|
$headerParams['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
if($orderId != null) {
|
if($orderId != null) {
|
||||||
$resourcePath = str_replace("{" . "orderId" . "}",
|
$resourcePath = str_replace("{" . "orderId" . "}",
|
||||||
@@ -67,6 +70,7 @@ class StoreApi {
|
|||||||
* deleteOrder
|
* deleteOrder
|
||||||
* Delete purchase order by ID
|
* Delete purchase order by ID
|
||||||
* orderId, string: ID of the order that needs to be deleted (required)
|
* orderId, string: ID of the order that needs to be deleted (required)
|
||||||
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -78,6 +82,8 @@ class StoreApi {
|
|||||||
$method = "DELETE";
|
$method = "DELETE";
|
||||||
$queryParams = array();
|
$queryParams = array();
|
||||||
$headerParams = array();
|
$headerParams = array();
|
||||||
|
$headerParams['Accept'] = 'application/json';
|
||||||
|
$headerParams['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
if($orderId != null) {
|
if($orderId != null) {
|
||||||
$resourcePath = str_replace("{" . "orderId" . "}",
|
$resourcePath = str_replace("{" . "orderId" . "}",
|
||||||
@@ -97,6 +103,7 @@ class StoreApi {
|
|||||||
* placeOrder
|
* placeOrder
|
||||||
* Place an order for a pet
|
* Place an order for a pet
|
||||||
* body, Order: order placed for purchasing the pet (required)
|
* body, Order: order placed for purchasing the pet (required)
|
||||||
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -108,6 +115,8 @@ class StoreApi {
|
|||||||
$method = "POST";
|
$method = "POST";
|
||||||
$queryParams = array();
|
$queryParams = array();
|
||||||
$headerParams = array();
|
$headerParams = array();
|
||||||
|
$headerParams['Accept'] = 'application/json';
|
||||||
|
$headerParams['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
//make the API Call
|
//make the API Call
|
||||||
if (! isset($body)) {
|
if (! isset($body)) {
|
||||||
@@ -120,5 +129,6 @@ class StoreApi {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,13 +44,12 @@ class APIClient {
|
|||||||
* @param array $queryParams parameters to be place in query URL
|
* @param array $queryParams parameters to be place in query URL
|
||||||
* @param array $postData parameters to be placed in POST body
|
* @param array $postData parameters to be placed in POST body
|
||||||
* @param array $headerParams parameters to be place in request header
|
* @param array $headerParams parameters to be place in request header
|
||||||
* @return unknown
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function callAPI($resourcePath, $method, $queryParams, $postData,
|
public function callAPI($resourcePath, $method, $queryParams, $postData,
|
||||||
$headerParams) {
|
$headerParams) {
|
||||||
|
|
||||||
$headers = array();
|
$headers = array();
|
||||||
$headers[] = "Content-type: application/json";
|
|
||||||
|
|
||||||
# Allow API key from $headerParams to override default
|
# Allow API key from $headerParams to override default
|
||||||
$added_api_key = False;
|
$added_api_key = False;
|
||||||
@@ -67,7 +66,7 @@ class APIClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_object($postData) or is_array($postData)) {
|
if (is_object($postData) or is_array($postData)) {
|
||||||
$postData = json_encode(self::sanitizeForSerialization($postData));
|
$postData = json_encode($this->sanitizeForSerialization($postData));
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = $this->apiServer . $resourcePath;
|
$url = $this->apiServer . $resourcePath;
|
||||||
@@ -118,21 +117,35 @@ class APIClient {
|
|||||||
$response_info['http_code']);
|
$response_info['http_code']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a JSON POST object
|
* Build a JSON POST object
|
||||||
*/
|
*/
|
||||||
public static function sanitizeForSerialization($postData) {
|
protected function sanitizeForSerialization($data)
|
||||||
foreach ($postData as $key => $value) {
|
{
|
||||||
if (is_a($value, "DateTime")) {
|
if (is_scalar($data) || null === $data) {
|
||||||
$postData->{$key} = $value->format(DateTime::ISO8601);
|
$sanitized = $data;
|
||||||
}
|
} else if ($data instanceof \DateTime) {
|
||||||
}
|
$sanitized = $data->format(\DateTime::ISO8601);
|
||||||
return $postData;
|
} else if (is_array($data)) {
|
||||||
}
|
foreach ($data as $property => $value) {
|
||||||
|
$data[$property] = $this->sanitizeForSerialization($value);
|
||||||
|
}
|
||||||
|
$sanitized = $data;
|
||||||
|
} else if (is_object($data)) {
|
||||||
|
$values = array();
|
||||||
|
foreach (array_keys($data::$swaggerTypes) as $property) {
|
||||||
|
$values[$property] = $this->sanitizeForSerialization($data->$property);
|
||||||
|
}
|
||||||
|
$sanitized = $values;
|
||||||
|
} else {
|
||||||
|
$sanitized = (string)$data;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sanitized;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Take value and turn it into a string suitable for inclusion in
|
* Take value and turn it into a string suitable for inclusion in
|
||||||
@@ -170,73 +183,43 @@ class APIClient {
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize a JSON string into an object
|
* Deserialize a JSON string into an object
|
||||||
*
|
*
|
||||||
* @param object $object object or primitive to be deserialized
|
* @param object $object object or primitive to be deserialized
|
||||||
* @param string $class class name is passed as a string
|
* @param string $class class name is passed as a string
|
||||||
* @return object an instance of $class
|
* @return object an instance of $class
|
||||||
*/
|
*/
|
||||||
public static function deserialize($object, $class) {
|
|
||||||
|
|
||||||
if (gettype($object) == "NULL") {
|
public static function deserialize($data, $class)
|
||||||
return $object;
|
{
|
||||||
}
|
if (null === $data) {
|
||||||
|
$deserialized = null;
|
||||||
if (substr($class, 0, 6) == 'array[') {
|
} else if (substr($class, 0, 6) == 'array[') {
|
||||||
$sub_class = substr($class, 6, -1);
|
$subClass = substr($class, 6, -1);
|
||||||
$sub_objects = array();
|
$values = array();
|
||||||
foreach ($object as $sub_object) {
|
foreach ($data as $value) {
|
||||||
$sub_objects[] = self::deserialize($sub_object,
|
$values[] = self::deserialize($value, $subClass);
|
||||||
$sub_class);
|
|
||||||
}
|
}
|
||||||
return $sub_objects;
|
$deserialized = $values;
|
||||||
} elseif ($class == 'DateTime') {
|
} elseif ($class == 'DateTime') {
|
||||||
return new DateTime($object);
|
$deserialized = new \DateTime($data);
|
||||||
} elseif (in_array($class, array('string', 'int', 'float', 'bool'))) {
|
} elseif (in_array($class, array('string', 'int', 'float', 'bool'))) {
|
||||||
settype($object, $class);
|
settype($data, $class);
|
||||||
return $object;
|
$deserialized = $data;
|
||||||
} else {
|
} else {
|
||||||
$instance = new $class(); // this instantiates class named $class
|
$instance = new $class();
|
||||||
$classVars = get_class_vars($class);
|
foreach ($instance::$swaggerTypes as $property => $type) {
|
||||||
}
|
if (isset($data->$property)) {
|
||||||
|
$instance->$property = self::deserialize($data->$property, $type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$deserialized = $instance;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($object as $property => $value) {
|
return $deserialized;
|
||||||
|
}
|
||||||
|
|
||||||
// Need to handle possible pluralization differences
|
|
||||||
$true_property = $property;
|
|
||||||
|
|
||||||
if (! property_exists($class, $true_property)) {
|
|
||||||
if (substr($property, -1) == 's') {
|
|
||||||
$true_property = substr($property, 0, -1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (array_key_exists($true_property, $classVars['swaggerTypes'])) {
|
|
||||||
$type = $classVars['swaggerTypes'][$true_property];
|
|
||||||
} else {
|
|
||||||
$type = 'string';
|
|
||||||
}
|
|
||||||
if (in_array($type, array('string', 'int', 'float', 'bool'))) {
|
|
||||||
settype($value, $type);
|
|
||||||
$instance->{$true_property} = $value;
|
|
||||||
} elseif (preg_match("/array<(.*)>/", $type, $matches)) {
|
|
||||||
$sub_class = $matches[1];
|
|
||||||
$instance->{$true_property} = array();
|
|
||||||
foreach ($value as $sub_property => $sub_value) {
|
|
||||||
$instance->{$true_property}[] = self::deserialize($sub_value,
|
|
||||||
$sub_class);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$instance->{$true_property} = self::deserialize($value, $type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $instance;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,89 +25,13 @@ class UserApi {
|
|||||||
$this->apiClient = $apiClient;
|
$this->apiClient = $apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* createUser
|
|
||||||
* Create user
|
|
||||||
* body, User: Created user object (required)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
|
|
||||||
public function createUser($body) {
|
|
||||||
|
|
||||||
//parse inputs
|
|
||||||
$resourcePath = "/user";
|
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
|
||||||
$method = "POST";
|
|
||||||
$queryParams = array();
|
|
||||||
$headerParams = array();
|
|
||||||
|
|
||||||
//make the API Call
|
|
||||||
if (! isset($body)) {
|
|
||||||
$body = null;
|
|
||||||
}
|
|
||||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
|
||||||
$queryParams, $body,
|
|
||||||
$headerParams);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* createUsersWithArrayInput
|
|
||||||
* Creates list of users with given input array
|
|
||||||
* body, array[User]: List of user object (required)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
|
|
||||||
public function createUsersWithArrayInput($body) {
|
|
||||||
|
|
||||||
//parse inputs
|
|
||||||
$resourcePath = "/user/createWithArray";
|
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
|
||||||
$method = "POST";
|
|
||||||
$queryParams = array();
|
|
||||||
$headerParams = array();
|
|
||||||
|
|
||||||
//make the API Call
|
|
||||||
if (! isset($body)) {
|
|
||||||
$body = null;
|
|
||||||
}
|
|
||||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
|
||||||
$queryParams, $body,
|
|
||||||
$headerParams);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* createUsersWithListInput
|
|
||||||
* Creates list of users with given list input
|
|
||||||
* body, array[User]: List of user object (required)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
|
|
||||||
public function createUsersWithListInput($body) {
|
|
||||||
|
|
||||||
//parse inputs
|
|
||||||
$resourcePath = "/user/createWithList";
|
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
|
||||||
$method = "POST";
|
|
||||||
$queryParams = array();
|
|
||||||
$headerParams = array();
|
|
||||||
|
|
||||||
//make the API Call
|
|
||||||
if (! isset($body)) {
|
|
||||||
$body = null;
|
|
||||||
}
|
|
||||||
$response = $this->apiClient->callAPI($resourcePath, $method,
|
|
||||||
$queryParams, $body,
|
|
||||||
$headerParams);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* updateUser
|
* updateUser
|
||||||
* Updated user
|
* Updated user
|
||||||
* username, string: name that need to be deleted (required)
|
* username, string: name that need to be deleted (required)
|
||||||
|
|
||||||
* body, User: Updated user object (required)
|
* body, User: Updated user object (required)
|
||||||
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -119,6 +43,8 @@ class UserApi {
|
|||||||
$method = "PUT";
|
$method = "PUT";
|
||||||
$queryParams = array();
|
$queryParams = array();
|
||||||
$headerParams = array();
|
$headerParams = array();
|
||||||
|
$headerParams['Accept'] = 'application/json';
|
||||||
|
$headerParams['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
if($username != null) {
|
if($username != null) {
|
||||||
$resourcePath = str_replace("{" . "username" . "}",
|
$resourcePath = str_replace("{" . "username" . "}",
|
||||||
@@ -138,6 +64,7 @@ class UserApi {
|
|||||||
* deleteUser
|
* deleteUser
|
||||||
* Delete user
|
* Delete user
|
||||||
* username, string: The name that needs to be deleted (required)
|
* username, string: The name that needs to be deleted (required)
|
||||||
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -149,6 +76,8 @@ class UserApi {
|
|||||||
$method = "DELETE";
|
$method = "DELETE";
|
||||||
$queryParams = array();
|
$queryParams = array();
|
||||||
$headerParams = array();
|
$headerParams = array();
|
||||||
|
$headerParams['Accept'] = 'application/json';
|
||||||
|
$headerParams['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
if($username != null) {
|
if($username != null) {
|
||||||
$resourcePath = str_replace("{" . "username" . "}",
|
$resourcePath = str_replace("{" . "username" . "}",
|
||||||
@@ -168,6 +97,7 @@ class UserApi {
|
|||||||
* getUserByName
|
* getUserByName
|
||||||
* Get user by user name
|
* Get user by user name
|
||||||
* username, string: The name that needs to be fetched. Use user1 for testing. (required)
|
* username, string: The name that needs to be fetched. Use user1 for testing. (required)
|
||||||
|
|
||||||
* @return User
|
* @return User
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -179,6 +109,8 @@ class UserApi {
|
|||||||
$method = "GET";
|
$method = "GET";
|
||||||
$queryParams = array();
|
$queryParams = array();
|
||||||
$headerParams = array();
|
$headerParams = array();
|
||||||
|
$headerParams['Accept'] = 'application/json';
|
||||||
|
$headerParams['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
if($username != null) {
|
if($username != null) {
|
||||||
$resourcePath = str_replace("{" . "username" . "}",
|
$resourcePath = str_replace("{" . "username" . "}",
|
||||||
@@ -206,7 +138,9 @@ class UserApi {
|
|||||||
* loginUser
|
* loginUser
|
||||||
* Logs user into the system
|
* Logs user into the system
|
||||||
* username, string: The user name for login (required)
|
* username, string: The user name for login (required)
|
||||||
|
|
||||||
* password, string: The password for login in clear text (required)
|
* password, string: The password for login in clear text (required)
|
||||||
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -218,6 +152,8 @@ class UserApi {
|
|||||||
$method = "GET";
|
$method = "GET";
|
||||||
$queryParams = array();
|
$queryParams = array();
|
||||||
$headerParams = array();
|
$headerParams = array();
|
||||||
|
$headerParams['Accept'] = 'application/json';
|
||||||
|
$headerParams['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
if($username != null) {
|
if($username != null) {
|
||||||
$queryParams['username'] = $this->apiClient->toQueryValue($username);
|
$queryParams['username'] = $this->apiClient->toQueryValue($username);
|
||||||
@@ -257,6 +193,95 @@ class UserApi {
|
|||||||
$method = "GET";
|
$method = "GET";
|
||||||
$queryParams = array();
|
$queryParams = array();
|
||||||
$headerParams = array();
|
$headerParams = array();
|
||||||
|
$headerParams['Accept'] = 'application/json';
|
||||||
|
$headerParams['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
|
//make the API Call
|
||||||
|
if (! isset($body)) {
|
||||||
|
$body = null;
|
||||||
|
}
|
||||||
|
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||||
|
$queryParams, $body,
|
||||||
|
$headerParams);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* createUser
|
||||||
|
* Create user
|
||||||
|
* body, User: Created user object (required)
|
||||||
|
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function createUser($body) {
|
||||||
|
|
||||||
|
//parse inputs
|
||||||
|
$resourcePath = "/user";
|
||||||
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
|
$method = "POST";
|
||||||
|
$queryParams = array();
|
||||||
|
$headerParams = array();
|
||||||
|
$headerParams['Accept'] = 'application/json';
|
||||||
|
$headerParams['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
|
//make the API Call
|
||||||
|
if (! isset($body)) {
|
||||||
|
$body = null;
|
||||||
|
}
|
||||||
|
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||||
|
$queryParams, $body,
|
||||||
|
$headerParams);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* createUsersWithArrayInput
|
||||||
|
* Creates list of users with given input array
|
||||||
|
* body, array[User]: List of user object (required)
|
||||||
|
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function createUsersWithArrayInput($body) {
|
||||||
|
|
||||||
|
//parse inputs
|
||||||
|
$resourcePath = "/user/createWithArray";
|
||||||
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
|
$method = "POST";
|
||||||
|
$queryParams = array();
|
||||||
|
$headerParams = array();
|
||||||
|
$headerParams['Accept'] = 'application/json';
|
||||||
|
$headerParams['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
|
//make the API Call
|
||||||
|
if (! isset($body)) {
|
||||||
|
$body = null;
|
||||||
|
}
|
||||||
|
$response = $this->apiClient->callAPI($resourcePath, $method,
|
||||||
|
$queryParams, $body,
|
||||||
|
$headerParams);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* createUsersWithListInput
|
||||||
|
* Creates list of users with given list input
|
||||||
|
* body, array[User]: List of user object (required)
|
||||||
|
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function createUsersWithListInput($body) {
|
||||||
|
|
||||||
|
//parse inputs
|
||||||
|
$resourcePath = "/user/createWithList";
|
||||||
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
|
$method = "POST";
|
||||||
|
$queryParams = array();
|
||||||
|
$headerParams = array();
|
||||||
|
$headerParams['Accept'] = 'application/json';
|
||||||
|
$headerParams['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
//make the API Call
|
//make the API Call
|
||||||
if (! isset($body)) {
|
if (! isset($body)) {
|
||||||
@@ -269,5 +294,6 @@ class UserApi {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,13 +29,7 @@ class Category {
|
|||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* Category unique identifier
|
|
||||||
*/
|
|
||||||
public $id; // int
|
public $id; // int
|
||||||
/**
|
|
||||||
* Name of the category
|
|
||||||
*/
|
|
||||||
public $name; // string
|
public $name; // string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,25 +32,13 @@ class Order {
|
|||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* Unique identifier for the order
|
|
||||||
*/
|
|
||||||
public $id; // int
|
public $id; // int
|
||||||
/**
|
|
||||||
* ID of pet being ordered
|
|
||||||
*/
|
|
||||||
public $petId; // int
|
public $petId; // int
|
||||||
/**
|
|
||||||
* Number of pets ordered
|
|
||||||
*/
|
|
||||||
public $quantity; // int
|
public $quantity; // int
|
||||||
/**
|
/**
|
||||||
* Status of the order
|
* Order Status
|
||||||
*/
|
*/
|
||||||
public $status; // string
|
public $status; // string
|
||||||
/**
|
|
||||||
* Date shipped, only if it has been
|
|
||||||
*/
|
|
||||||
public $shipDate; // DateTime
|
public $shipDate; // DateTime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,24 +34,12 @@ class Pet {
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unique identifier for the Pet
|
* unique identifier for the pet
|
||||||
*/
|
*/
|
||||||
public $id; // int
|
public $id; // int
|
||||||
/**
|
|
||||||
* Category the pet is in
|
|
||||||
*/
|
|
||||||
public $category; // Category
|
public $category; // Category
|
||||||
/**
|
|
||||||
* Friendly name of the pet
|
|
||||||
*/
|
|
||||||
public $name; // string
|
public $name; // string
|
||||||
/**
|
|
||||||
* Image URLs
|
|
||||||
*/
|
|
||||||
public $photoUrls; // array[string]
|
public $photoUrls; // array[string]
|
||||||
/**
|
|
||||||
* Tags assigned to this pet
|
|
||||||
*/
|
|
||||||
public $tags; // array[Tag]
|
public $tags; // array[Tag]
|
||||||
/**
|
/**
|
||||||
* pet status in the store
|
* pet status in the store
|
||||||
|
|||||||
@@ -29,13 +29,7 @@ class Tag {
|
|||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* Unique identifier for the tag
|
|
||||||
*/
|
|
||||||
public $id; // int
|
public $id; // int
|
||||||
/**
|
|
||||||
* Friendly name for the tag
|
|
||||||
*/
|
|
||||||
public $name; // string
|
public $name; // string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ class User {
|
|||||||
|
|
||||||
static $swaggerTypes = array(
|
static $swaggerTypes = array(
|
||||||
'id' => 'int',
|
'id' => 'int',
|
||||||
'username' => 'string',
|
|
||||||
'firstName' => 'string',
|
'firstName' => 'string',
|
||||||
|
'username' => 'string',
|
||||||
'lastName' => 'string',
|
'lastName' => 'string',
|
||||||
'email' => 'string',
|
'email' => 'string',
|
||||||
'password' => 'string',
|
'password' => 'string',
|
||||||
@@ -35,33 +35,12 @@ class User {
|
|||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* Unique identifier for the user
|
|
||||||
*/
|
|
||||||
public $id; // int
|
public $id; // int
|
||||||
/**
|
|
||||||
* Unique username
|
|
||||||
*/
|
|
||||||
public $username; // string
|
|
||||||
/**
|
|
||||||
* First name of the user
|
|
||||||
*/
|
|
||||||
public $firstName; // string
|
public $firstName; // string
|
||||||
/**
|
public $username; // string
|
||||||
* Last name of the user
|
|
||||||
*/
|
|
||||||
public $lastName; // string
|
public $lastName; // string
|
||||||
/**
|
|
||||||
* Email address of the user
|
|
||||||
*/
|
|
||||||
public $email; // string
|
public $email; // string
|
||||||
/**
|
|
||||||
* Password name of the user
|
|
||||||
*/
|
|
||||||
public $password; // string
|
public $password; // string
|
||||||
/**
|
|
||||||
* Phone number of the user
|
|
||||||
*/
|
|
||||||
public $phone; // string
|
public $phone; // string
|
||||||
/**
|
/**
|
||||||
* User Status
|
* User Status
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
"""
|
"""
|
||||||
WordAPI.py
|
WordAPI.py
|
||||||
Copyright 2012 Wordnik, Inc.
|
Copyright 2014 Wordnik, Inc.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -29,12 +29,15 @@ class PetApi(object):
|
|||||||
self.apiClient = apiClient
|
self.apiClient = apiClient
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def getPetById(self, petId, **kwargs):
|
def getPetById(self, petId, **kwargs):
|
||||||
"""Find pet by ID
|
"""Find pet by ID
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
petId, long: ID of pet that needs to be fetched (required)
|
petId, long: ID of pet that needs to be fetched (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns: Pet
|
Returns: Pet
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -70,12 +73,16 @@ class PetApi(object):
|
|||||||
return responseObject
|
return responseObject
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def deletePet(self, petId, **kwargs):
|
def deletePet(self, petId, **kwargs):
|
||||||
"""Deletes a pet
|
"""Deletes a pet
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
petId, str: Pet id to delete (required)
|
petId, str: Pet id to delete (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -106,13 +113,18 @@ class PetApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def partialUpdate(self, petId, body, **kwargs):
|
def partialUpdate(self, petId, body, **kwargs):
|
||||||
"""partial updates to a pet
|
"""partial updates to a pet
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
petId, str: ID of pet that needs to be fetched (required)
|
petId, str: ID of pet that needs to be fetched (required)
|
||||||
|
|
||||||
body, Pet: Pet object that needs to be added to the store (required)
|
body, Pet: Pet object that needs to be added to the store (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns: Array[Pet]
|
Returns: Array[Pet]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -148,14 +160,20 @@ class PetApi(object):
|
|||||||
return responseObject
|
return responseObject
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def updatePetWithForm(self, petId, **kwargs):
|
def updatePetWithForm(self, petId, **kwargs):
|
||||||
"""Updates a pet in the store with form data
|
"""Updates a pet in the store with form data
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
petId, str: ID of pet that needs to be updated (required)
|
petId, str: ID of pet that needs to be updated (required)
|
||||||
|
|
||||||
name, str: Updated name of the pet (optional)
|
name, str: Updated name of the pet (optional)
|
||||||
|
|
||||||
status, str: Updated status of the pet (optional)
|
status, str: Updated status of the pet (optional)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -186,13 +204,18 @@ class PetApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def uploadFile(self, **kwargs):
|
def uploadFile(self, **kwargs):
|
||||||
"""uploads an image
|
"""uploads an image
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
additionalMetadata, str: Additional data to pass to server (optional)
|
additionalMetadata, str: Additional data to pass to server (optional)
|
||||||
|
|
||||||
body, File: file to upload (optional)
|
body, File: file to upload (optional)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -219,12 +242,16 @@ class PetApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def addPet(self, body, **kwargs):
|
def addPet(self, body, **kwargs):
|
||||||
"""Add a new pet to the store
|
"""Add a new pet to the store
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
body, Pet: Pet object that needs to be added to the store (required)
|
body, Pet: Pet object that needs to be added to the store (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -251,12 +278,16 @@ class PetApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def updatePet(self, body, **kwargs):
|
def updatePet(self, body, **kwargs):
|
||||||
"""Update an existing pet
|
"""Update an existing pet
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
body, Pet: Pet object that needs to be updated in the store (required)
|
body, Pet: Pet object that needs to be updated in the store (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -283,12 +314,16 @@ class PetApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def findPetsByStatus(self, status= None, **kwargs):
|
def findPetsByStatus(self, status= None, **kwargs):
|
||||||
"""Finds Pets by status
|
"""Finds Pets by status
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
status, str: Status values that need to be considered for filter (required)
|
status, str: Status values that need to be considered for filter (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns: Array[Pet]
|
Returns: Array[Pet]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -322,12 +357,16 @@ class PetApi(object):
|
|||||||
return responseObject
|
return responseObject
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def findPetsByTags(self, tags, **kwargs):
|
def findPetsByTags(self, tags, **kwargs):
|
||||||
"""Finds Pets by tags
|
"""Finds Pets by tags
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
tags, str: Tags to filter by (required)
|
tags, str: Tags to filter by (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns: Array[Pet]
|
Returns: Array[Pet]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -364,3 +403,7 @@ class PetApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2012 Wordnik, Inc.
|
* Copyright 2014 Wordnik, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
"""
|
"""
|
||||||
WordAPI.py
|
WordAPI.py
|
||||||
Copyright 2012 Wordnik, Inc.
|
Copyright 2014 Wordnik, Inc.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -29,12 +29,15 @@ class StoreApi(object):
|
|||||||
self.apiClient = apiClient
|
self.apiClient = apiClient
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def getOrderById(self, orderId, **kwargs):
|
def getOrderById(self, orderId, **kwargs):
|
||||||
"""Find purchase order by ID
|
"""Find purchase order by ID
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
orderId, str: ID of pet that needs to be fetched (required)
|
orderId, str: ID of pet that needs to be fetched (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns: Order
|
Returns: Order
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -70,12 +73,16 @@ class StoreApi(object):
|
|||||||
return responseObject
|
return responseObject
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def deleteOrder(self, orderId, **kwargs):
|
def deleteOrder(self, orderId, **kwargs):
|
||||||
"""Delete purchase order by ID
|
"""Delete purchase order by ID
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
orderId, str: ID of the order that needs to be deleted (required)
|
orderId, str: ID of the order that needs to be deleted (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -106,12 +113,16 @@ class StoreApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def placeOrder(self, body, **kwargs):
|
def placeOrder(self, body, **kwargs):
|
||||||
"""Place an order for a pet
|
"""Place an order for a pet
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
body, Order: order placed for purchasing the pet (required)
|
body, Order: order placed for purchasing the pet (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -141,3 +152,7 @@ class StoreApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
"""
|
"""
|
||||||
WordAPI.py
|
WordAPI.py
|
||||||
Copyright 2012 Wordnik, Inc.
|
Copyright 2014 Wordnik, Inc.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -29,109 +29,17 @@ class UserApi(object):
|
|||||||
self.apiClient = apiClient
|
self.apiClient = apiClient
|
||||||
|
|
||||||
|
|
||||||
def createUser(self, body, **kwargs):
|
|
||||||
"""Create user
|
|
||||||
|
|
||||||
Args:
|
|
||||||
body, User: Created user object (required)
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
"""
|
|
||||||
|
|
||||||
allParams = ['body']
|
|
||||||
|
|
||||||
params = locals()
|
|
||||||
for (key, val) in params['kwargs'].iteritems():
|
|
||||||
if key not in allParams:
|
|
||||||
raise TypeError("Got an unexpected keyword argument '%s' to method createUser" % key)
|
|
||||||
params[key] = val
|
|
||||||
del params['kwargs']
|
|
||||||
|
|
||||||
resourcePath = '/user'
|
|
||||||
resourcePath = resourcePath.replace('{format}', 'json')
|
|
||||||
method = 'POST'
|
|
||||||
|
|
||||||
queryParams = {}
|
|
||||||
headerParams = {}
|
|
||||||
|
|
||||||
postData = (params['body'] if 'body' in params else None)
|
|
||||||
|
|
||||||
response = self.apiClient.callAPI(resourcePath, method, queryParams,
|
|
||||||
postData, headerParams)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def createUsersWithArrayInput(self, body, **kwargs):
|
|
||||||
"""Creates list of users with given input array
|
|
||||||
|
|
||||||
Args:
|
|
||||||
body, list[User]: List of user object (required)
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
"""
|
|
||||||
|
|
||||||
allParams = ['body']
|
|
||||||
|
|
||||||
params = locals()
|
|
||||||
for (key, val) in params['kwargs'].iteritems():
|
|
||||||
if key not in allParams:
|
|
||||||
raise TypeError("Got an unexpected keyword argument '%s' to method createUsersWithArrayInput" % key)
|
|
||||||
params[key] = val
|
|
||||||
del params['kwargs']
|
|
||||||
|
|
||||||
resourcePath = '/user/createWithArray'
|
|
||||||
resourcePath = resourcePath.replace('{format}', 'json')
|
|
||||||
method = 'POST'
|
|
||||||
|
|
||||||
queryParams = {}
|
|
||||||
headerParams = {}
|
|
||||||
|
|
||||||
postData = (params['body'] if 'body' in params else None)
|
|
||||||
|
|
||||||
response = self.apiClient.callAPI(resourcePath, method, queryParams,
|
|
||||||
postData, headerParams)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def createUsersWithListInput(self, body, **kwargs):
|
|
||||||
"""Creates list of users with given list input
|
|
||||||
|
|
||||||
Args:
|
|
||||||
body, list[User]: List of user object (required)
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
"""
|
|
||||||
|
|
||||||
allParams = ['body']
|
|
||||||
|
|
||||||
params = locals()
|
|
||||||
for (key, val) in params['kwargs'].iteritems():
|
|
||||||
if key not in allParams:
|
|
||||||
raise TypeError("Got an unexpected keyword argument '%s' to method createUsersWithListInput" % key)
|
|
||||||
params[key] = val
|
|
||||||
del params['kwargs']
|
|
||||||
|
|
||||||
resourcePath = '/user/createWithList'
|
|
||||||
resourcePath = resourcePath.replace('{format}', 'json')
|
|
||||||
method = 'POST'
|
|
||||||
|
|
||||||
queryParams = {}
|
|
||||||
headerParams = {}
|
|
||||||
|
|
||||||
postData = (params['body'] if 'body' in params else None)
|
|
||||||
|
|
||||||
response = self.apiClient.callAPI(resourcePath, method, queryParams,
|
|
||||||
postData, headerParams)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def updateUser(self, username, body, **kwargs):
|
def updateUser(self, username, body, **kwargs):
|
||||||
"""Updated user
|
"""Updated user
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
username, str: name that need to be deleted (required)
|
username, str: name that need to be deleted (required)
|
||||||
|
|
||||||
body, User: Updated user object (required)
|
body, User: Updated user object (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -162,12 +70,16 @@ class UserApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def deleteUser(self, username, **kwargs):
|
def deleteUser(self, username, **kwargs):
|
||||||
"""Delete user
|
"""Delete user
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
username, str: The name that needs to be deleted (required)
|
username, str: The name that needs to be deleted (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -198,12 +110,16 @@ class UserApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def getUserByName(self, username, **kwargs):
|
def getUserByName(self, username, **kwargs):
|
||||||
"""Get user by user name
|
"""Get user by user name
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
username, str: The name that needs to be fetched. Use user1 for testing. (required)
|
username, str: The name that needs to be fetched. Use user1 for testing. (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns: User
|
Returns: User
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -239,13 +155,18 @@ class UserApi(object):
|
|||||||
return responseObject
|
return responseObject
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def loginUser(self, username, password, **kwargs):
|
def loginUser(self, username, password, **kwargs):
|
||||||
"""Logs user into the system
|
"""Logs user into the system
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
username, str: The user name for login (required)
|
username, str: The user name for login (required)
|
||||||
|
|
||||||
password, str: The password for login in clear text (required)
|
password, str: The password for login in clear text (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns: str
|
Returns: str
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -281,11 +202,14 @@ class UserApi(object):
|
|||||||
return responseObject
|
return responseObject
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def logoutUser(self, **kwargs):
|
def logoutUser(self, **kwargs):
|
||||||
"""Logs out current logged in user session
|
"""Logs out current logged in user session
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -314,4 +238,116 @@ class UserApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def createUser(self, body, **kwargs):
|
||||||
|
"""Create user
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body, User: Created user object (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
"""
|
||||||
|
|
||||||
|
allParams = ['body']
|
||||||
|
|
||||||
|
params = locals()
|
||||||
|
for (key, val) in params['kwargs'].iteritems():
|
||||||
|
if key not in allParams:
|
||||||
|
raise TypeError("Got an unexpected keyword argument '%s' to method createUser" % key)
|
||||||
|
params[key] = val
|
||||||
|
del params['kwargs']
|
||||||
|
|
||||||
|
resourcePath = '/user'
|
||||||
|
resourcePath = resourcePath.replace('{format}', 'json')
|
||||||
|
method = 'POST'
|
||||||
|
|
||||||
|
queryParams = {}
|
||||||
|
headerParams = {}
|
||||||
|
|
||||||
|
postData = (params['body'] if 'body' in params else None)
|
||||||
|
|
||||||
|
response = self.apiClient.callAPI(resourcePath, method, queryParams,
|
||||||
|
postData, headerParams)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def createUsersWithArrayInput(self, body, **kwargs):
|
||||||
|
"""Creates list of users with given input array
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body, list[User]: List of user object (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
"""
|
||||||
|
|
||||||
|
allParams = ['body']
|
||||||
|
|
||||||
|
params = locals()
|
||||||
|
for (key, val) in params['kwargs'].iteritems():
|
||||||
|
if key not in allParams:
|
||||||
|
raise TypeError("Got an unexpected keyword argument '%s' to method createUsersWithArrayInput" % key)
|
||||||
|
params[key] = val
|
||||||
|
del params['kwargs']
|
||||||
|
|
||||||
|
resourcePath = '/user/createWithArray'
|
||||||
|
resourcePath = resourcePath.replace('{format}', 'json')
|
||||||
|
method = 'POST'
|
||||||
|
|
||||||
|
queryParams = {}
|
||||||
|
headerParams = {}
|
||||||
|
|
||||||
|
postData = (params['body'] if 'body' in params else None)
|
||||||
|
|
||||||
|
response = self.apiClient.callAPI(resourcePath, method, queryParams,
|
||||||
|
postData, headerParams)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def createUsersWithListInput(self, body, **kwargs):
|
||||||
|
"""Creates list of users with given list input
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body, list[User]: List of user object (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
"""
|
||||||
|
|
||||||
|
allParams = ['body']
|
||||||
|
|
||||||
|
params = locals()
|
||||||
|
for (key, val) in params['kwargs'].iteritems():
|
||||||
|
if key not in allParams:
|
||||||
|
raise TypeError("Got an unexpected keyword argument '%s' to method createUsersWithListInput" % key)
|
||||||
|
params[key] = val
|
||||||
|
del params['kwargs']
|
||||||
|
|
||||||
|
resourcePath = '/user/createWithList'
|
||||||
|
resourcePath = resourcePath.replace('{format}', 'json')
|
||||||
|
method = 'POST'
|
||||||
|
|
||||||
|
queryParams = {}
|
||||||
|
headerParams = {}
|
||||||
|
|
||||||
|
postData = (params['body'] if 'body' in params else None)
|
||||||
|
|
||||||
|
response = self.apiClient.callAPI(resourcePath, method, queryParams,
|
||||||
|
postData, headerParams)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
"""
|
"""
|
||||||
Copyright 2012 Wordnik, Inc.
|
Copyright 2014 Wordnik, Inc.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -27,8 +27,6 @@ class Category:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#Category unique identifier
|
|
||||||
self.id = None # long
|
self.id = None # long
|
||||||
#Name of the category
|
|
||||||
self.name = None # str
|
self.name = None # str
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
"""
|
"""
|
||||||
Copyright 2012 Wordnik, Inc.
|
Copyright 2014 Wordnik, Inc.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -30,14 +30,10 @@ class Order:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#Unique identifier for the order
|
|
||||||
self.id = None # long
|
self.id = None # long
|
||||||
#ID of pet being ordered
|
|
||||||
self.petId = None # long
|
self.petId = None # long
|
||||||
#Number of pets ordered
|
|
||||||
self.quantity = None # int
|
self.quantity = None # int
|
||||||
#Status of the order
|
#Order Status
|
||||||
self.status = None # str
|
self.status = None # str
|
||||||
#Date shipped, only if it has been
|
|
||||||
self.shipDate = None # datetime
|
self.shipDate = None # datetime
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
"""
|
"""
|
||||||
Copyright 2012 Wordnik, Inc.
|
Copyright 2014 Wordnik, Inc.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -31,15 +31,11 @@ class Pet:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#Unique identifier for the Pet
|
#unique identifier for the pet
|
||||||
self.id = None # long
|
self.id = None # long
|
||||||
#Category the pet is in
|
|
||||||
self.category = None # Category
|
self.category = None # Category
|
||||||
#Friendly name of the pet
|
|
||||||
self.name = None # str
|
self.name = None # str
|
||||||
#Image URLs
|
|
||||||
self.photoUrls = None # list[str]
|
self.photoUrls = None # list[str]
|
||||||
#Tags assigned to this pet
|
|
||||||
self.tags = None # list[Tag]
|
self.tags = None # list[Tag]
|
||||||
#pet status in the store
|
#pet status in the store
|
||||||
self.status = None # str
|
self.status = None # str
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
"""
|
"""
|
||||||
Copyright 2012 Wordnik, Inc.
|
Copyright 2014 Wordnik, Inc.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -27,8 +27,6 @@ class Tag:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#Unique identifier for the tag
|
|
||||||
self.id = None # long
|
self.id = None # long
|
||||||
#Friendly name for the tag
|
|
||||||
self.name = None # str
|
self.name = None # str
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
"""
|
"""
|
||||||
Copyright 2012 Wordnik, Inc.
|
Copyright 2014 Wordnik, Inc.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -22,8 +22,8 @@ class User:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.swaggerTypes = {
|
self.swaggerTypes = {
|
||||||
'id': 'long',
|
'id': 'long',
|
||||||
'username': 'str',
|
|
||||||
'firstName': 'str',
|
'firstName': 'str',
|
||||||
|
'username': 'str',
|
||||||
'lastName': 'str',
|
'lastName': 'str',
|
||||||
'email': 'str',
|
'email': 'str',
|
||||||
'password': 'str',
|
'password': 'str',
|
||||||
@@ -33,19 +33,12 @@ class User:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#Unique identifier for the user
|
|
||||||
self.id = None # long
|
self.id = None # long
|
||||||
#Unique username
|
|
||||||
self.username = None # str
|
|
||||||
#First name of the user
|
|
||||||
self.firstName = None # str
|
self.firstName = None # str
|
||||||
#Last name of the user
|
self.username = None # str
|
||||||
self.lastName = None # str
|
self.lastName = None # str
|
||||||
#Email address of the user
|
|
||||||
self.email = None # str
|
self.email = None # str
|
||||||
#Password name of the user
|
|
||||||
self.password = None # str
|
self.password = None # str
|
||||||
#Phone number of the user
|
|
||||||
self.phone = None # str
|
self.phone = None # str
|
||||||
#User Status
|
#User Status
|
||||||
self.userStatus = None # int
|
self.userStatus = None # int
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
"""
|
"""
|
||||||
WordAPI.py
|
WordAPI.py
|
||||||
Copyright 2012 Wordnik, Inc.
|
Copyright 2014 Wordnik, Inc.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -29,12 +29,15 @@ class PetApi(object):
|
|||||||
self.apiClient = apiClient
|
self.apiClient = apiClient
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def getPetById(self, petId, **kwargs):
|
def getPetById(self, petId, **kwargs):
|
||||||
"""Find pet by ID
|
"""Find pet by ID
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
petId, int: ID of pet that needs to be fetched (required)
|
petId, int: ID of pet that needs to be fetched (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns: Pet
|
Returns: Pet
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -70,12 +73,16 @@ class PetApi(object):
|
|||||||
return responseObject
|
return responseObject
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def deletePet(self, petId, **kwargs):
|
def deletePet(self, petId, **kwargs):
|
||||||
"""Deletes a pet
|
"""Deletes a pet
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
petId, str: Pet id to delete (required)
|
petId, str: Pet id to delete (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -106,13 +113,18 @@ class PetApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def partialUpdate(self, petId, body, **kwargs):
|
def partialUpdate(self, petId, body, **kwargs):
|
||||||
"""partial updates to a pet
|
"""partial updates to a pet
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
petId, str: ID of pet that needs to be fetched (required)
|
petId, str: ID of pet that needs to be fetched (required)
|
||||||
|
|
||||||
body, Pet: Pet object that needs to be added to the store (required)
|
body, Pet: Pet object that needs to be added to the store (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns: Array[Pet]
|
Returns: Array[Pet]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -148,14 +160,20 @@ class PetApi(object):
|
|||||||
return responseObject
|
return responseObject
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def updatePetWithForm(self, petId, **kwargs):
|
def updatePetWithForm(self, petId, **kwargs):
|
||||||
"""Updates a pet in the store with form data
|
"""Updates a pet in the store with form data
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
petId, str: ID of pet that needs to be updated (required)
|
petId, str: ID of pet that needs to be updated (required)
|
||||||
|
|
||||||
name, str: Updated name of the pet (optional)
|
name, str: Updated name of the pet (optional)
|
||||||
|
|
||||||
status, str: Updated status of the pet (optional)
|
status, str: Updated status of the pet (optional)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -186,13 +204,18 @@ class PetApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def uploadFile(self, **kwargs):
|
def uploadFile(self, **kwargs):
|
||||||
"""uploads an image
|
"""uploads an image
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
additionalMetadata, str: Additional data to pass to server (optional)
|
additionalMetadata, str: Additional data to pass to server (optional)
|
||||||
|
|
||||||
body, File: file to upload (optional)
|
body, File: file to upload (optional)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -219,12 +242,16 @@ class PetApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def addPet(self, body, **kwargs):
|
def addPet(self, body, **kwargs):
|
||||||
"""Add a new pet to the store
|
"""Add a new pet to the store
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
body, Pet: Pet object that needs to be added to the store (required)
|
body, Pet: Pet object that needs to be added to the store (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -251,12 +278,16 @@ class PetApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def updatePet(self, body, **kwargs):
|
def updatePet(self, body, **kwargs):
|
||||||
"""Update an existing pet
|
"""Update an existing pet
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
body, Pet: Pet object that needs to be updated in the store (required)
|
body, Pet: Pet object that needs to be updated in the store (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -283,12 +314,16 @@ class PetApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def findPetsByStatus(self, status= None, **kwargs):
|
def findPetsByStatus(self, status= None, **kwargs):
|
||||||
"""Finds Pets by status
|
"""Finds Pets by status
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
status, str: Status values that need to be considered for filter (required)
|
status, str: Status values that need to be considered for filter (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns: Array[Pet]
|
Returns: Array[Pet]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -322,12 +357,16 @@ class PetApi(object):
|
|||||||
return responseObject
|
return responseObject
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def findPetsByTags(self, tags, **kwargs):
|
def findPetsByTags(self, tags, **kwargs):
|
||||||
"""Finds Pets by tags
|
"""Finds Pets by tags
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
tags, str: Tags to filter by (required)
|
tags, str: Tags to filter by (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns: Array[Pet]
|
Returns: Array[Pet]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -364,3 +403,7 @@ class PetApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2012 Wordnik, Inc.
|
* Copyright 2014 Wordnik, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
"""
|
"""
|
||||||
WordAPI.py
|
WordAPI.py
|
||||||
Copyright 2012 Wordnik, Inc.
|
Copyright 2014 Wordnik, Inc.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -29,12 +29,15 @@ class StoreApi(object):
|
|||||||
self.apiClient = apiClient
|
self.apiClient = apiClient
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def getOrderById(self, orderId, **kwargs):
|
def getOrderById(self, orderId, **kwargs):
|
||||||
"""Find purchase order by ID
|
"""Find purchase order by ID
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
orderId, str: ID of pet that needs to be fetched (required)
|
orderId, str: ID of pet that needs to be fetched (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns: Order
|
Returns: Order
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -70,12 +73,16 @@ class StoreApi(object):
|
|||||||
return responseObject
|
return responseObject
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def deleteOrder(self, orderId, **kwargs):
|
def deleteOrder(self, orderId, **kwargs):
|
||||||
"""Delete purchase order by ID
|
"""Delete purchase order by ID
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
orderId, str: ID of the order that needs to be deleted (required)
|
orderId, str: ID of the order that needs to be deleted (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -106,12 +113,16 @@ class StoreApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def placeOrder(self, body, **kwargs):
|
def placeOrder(self, body, **kwargs):
|
||||||
"""Place an order for a pet
|
"""Place an order for a pet
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
body, Order: order placed for purchasing the pet (required)
|
body, Order: order placed for purchasing the pet (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -141,3 +152,7 @@ class StoreApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
"""
|
"""
|
||||||
WordAPI.py
|
WordAPI.py
|
||||||
Copyright 2012 Wordnik, Inc.
|
Copyright 2014 Wordnik, Inc.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -29,109 +29,17 @@ class UserApi(object):
|
|||||||
self.apiClient = apiClient
|
self.apiClient = apiClient
|
||||||
|
|
||||||
|
|
||||||
def createUser(self, body, **kwargs):
|
|
||||||
"""Create user
|
|
||||||
|
|
||||||
Args:
|
|
||||||
body, User: Created user object (required)
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
"""
|
|
||||||
|
|
||||||
allParams = ['body']
|
|
||||||
|
|
||||||
params = locals()
|
|
||||||
for (key, val) in params['kwargs'].items():
|
|
||||||
if key not in allParams:
|
|
||||||
raise TypeError("Got an unexpected keyword argument '%s' to method createUser" % key)
|
|
||||||
params[key] = val
|
|
||||||
del params['kwargs']
|
|
||||||
|
|
||||||
resourcePath = '/user'
|
|
||||||
resourcePath = resourcePath.replace('{format}', 'json')
|
|
||||||
method = 'POST'
|
|
||||||
|
|
||||||
queryParams = {}
|
|
||||||
headerParams = {}
|
|
||||||
|
|
||||||
postData = (params['body'] if 'body' in params else None)
|
|
||||||
|
|
||||||
response = self.apiClient.callAPI(resourcePath, method, queryParams,
|
|
||||||
postData, headerParams)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def createUsersWithArrayInput(self, body, **kwargs):
|
|
||||||
"""Creates list of users with given input array
|
|
||||||
|
|
||||||
Args:
|
|
||||||
body, list[User]: List of user object (required)
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
"""
|
|
||||||
|
|
||||||
allParams = ['body']
|
|
||||||
|
|
||||||
params = locals()
|
|
||||||
for (key, val) in params['kwargs'].items():
|
|
||||||
if key not in allParams:
|
|
||||||
raise TypeError("Got an unexpected keyword argument '%s' to method createUsersWithArrayInput" % key)
|
|
||||||
params[key] = val
|
|
||||||
del params['kwargs']
|
|
||||||
|
|
||||||
resourcePath = '/user/createWithArray'
|
|
||||||
resourcePath = resourcePath.replace('{format}', 'json')
|
|
||||||
method = 'POST'
|
|
||||||
|
|
||||||
queryParams = {}
|
|
||||||
headerParams = {}
|
|
||||||
|
|
||||||
postData = (params['body'] if 'body' in params else None)
|
|
||||||
|
|
||||||
response = self.apiClient.callAPI(resourcePath, method, queryParams,
|
|
||||||
postData, headerParams)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def createUsersWithListInput(self, body, **kwargs):
|
|
||||||
"""Creates list of users with given list input
|
|
||||||
|
|
||||||
Args:
|
|
||||||
body, list[User]: List of user object (required)
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
"""
|
|
||||||
|
|
||||||
allParams = ['body']
|
|
||||||
|
|
||||||
params = locals()
|
|
||||||
for (key, val) in params['kwargs'].items():
|
|
||||||
if key not in allParams:
|
|
||||||
raise TypeError("Got an unexpected keyword argument '%s' to method createUsersWithListInput" % key)
|
|
||||||
params[key] = val
|
|
||||||
del params['kwargs']
|
|
||||||
|
|
||||||
resourcePath = '/user/createWithList'
|
|
||||||
resourcePath = resourcePath.replace('{format}', 'json')
|
|
||||||
method = 'POST'
|
|
||||||
|
|
||||||
queryParams = {}
|
|
||||||
headerParams = {}
|
|
||||||
|
|
||||||
postData = (params['body'] if 'body' in params else None)
|
|
||||||
|
|
||||||
response = self.apiClient.callAPI(resourcePath, method, queryParams,
|
|
||||||
postData, headerParams)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def updateUser(self, username, body, **kwargs):
|
def updateUser(self, username, body, **kwargs):
|
||||||
"""Updated user
|
"""Updated user
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
username, str: name that need to be deleted (required)
|
username, str: name that need to be deleted (required)
|
||||||
|
|
||||||
body, User: Updated user object (required)
|
body, User: Updated user object (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -162,12 +70,16 @@ class UserApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def deleteUser(self, username, **kwargs):
|
def deleteUser(self, username, **kwargs):
|
||||||
"""Delete user
|
"""Delete user
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
username, str: The name that needs to be deleted (required)
|
username, str: The name that needs to be deleted (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -198,12 +110,16 @@ class UserApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def getUserByName(self, username, **kwargs):
|
def getUserByName(self, username, **kwargs):
|
||||||
"""Get user by user name
|
"""Get user by user name
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
username, str: The name that needs to be fetched. Use user1 for testing. (required)
|
username, str: The name that needs to be fetched. Use user1 for testing. (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns: User
|
Returns: User
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -239,13 +155,18 @@ class UserApi(object):
|
|||||||
return responseObject
|
return responseObject
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def loginUser(self, username, password, **kwargs):
|
def loginUser(self, username, password, **kwargs):
|
||||||
"""Logs user into the system
|
"""Logs user into the system
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
username, str: The user name for login (required)
|
username, str: The user name for login (required)
|
||||||
|
|
||||||
password, str: The password for login in clear text (required)
|
password, str: The password for login in clear text (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns: str
|
Returns: str
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -281,11 +202,14 @@ class UserApi(object):
|
|||||||
return responseObject
|
return responseObject
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def logoutUser(self, **kwargs):
|
def logoutUser(self, **kwargs):
|
||||||
"""Logs out current logged in user session
|
"""Logs out current logged in user session
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -314,4 +238,116 @@ class UserApi(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def createUser(self, body, **kwargs):
|
||||||
|
"""Create user
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body, User: Created user object (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
"""
|
||||||
|
|
||||||
|
allParams = ['body']
|
||||||
|
|
||||||
|
params = locals()
|
||||||
|
for (key, val) in params['kwargs'].items():
|
||||||
|
if key not in allParams:
|
||||||
|
raise TypeError("Got an unexpected keyword argument '%s' to method createUser" % key)
|
||||||
|
params[key] = val
|
||||||
|
del params['kwargs']
|
||||||
|
|
||||||
|
resourcePath = '/user'
|
||||||
|
resourcePath = resourcePath.replace('{format}', 'json')
|
||||||
|
method = 'POST'
|
||||||
|
|
||||||
|
queryParams = {}
|
||||||
|
headerParams = {}
|
||||||
|
|
||||||
|
postData = (params['body'] if 'body' in params else None)
|
||||||
|
|
||||||
|
response = self.apiClient.callAPI(resourcePath, method, queryParams,
|
||||||
|
postData, headerParams)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def createUsersWithArrayInput(self, body, **kwargs):
|
||||||
|
"""Creates list of users with given input array
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body, list[User]: List of user object (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
"""
|
||||||
|
|
||||||
|
allParams = ['body']
|
||||||
|
|
||||||
|
params = locals()
|
||||||
|
for (key, val) in params['kwargs'].items():
|
||||||
|
if key not in allParams:
|
||||||
|
raise TypeError("Got an unexpected keyword argument '%s' to method createUsersWithArrayInput" % key)
|
||||||
|
params[key] = val
|
||||||
|
del params['kwargs']
|
||||||
|
|
||||||
|
resourcePath = '/user/createWithArray'
|
||||||
|
resourcePath = resourcePath.replace('{format}', 'json')
|
||||||
|
method = 'POST'
|
||||||
|
|
||||||
|
queryParams = {}
|
||||||
|
headerParams = {}
|
||||||
|
|
||||||
|
postData = (params['body'] if 'body' in params else None)
|
||||||
|
|
||||||
|
response = self.apiClient.callAPI(resourcePath, method, queryParams,
|
||||||
|
postData, headerParams)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def createUsersWithListInput(self, body, **kwargs):
|
||||||
|
"""Creates list of users with given list input
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body, list[User]: List of user object (required)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
"""
|
||||||
|
|
||||||
|
allParams = ['body']
|
||||||
|
|
||||||
|
params = locals()
|
||||||
|
for (key, val) in params['kwargs'].items():
|
||||||
|
if key not in allParams:
|
||||||
|
raise TypeError("Got an unexpected keyword argument '%s' to method createUsersWithListInput" % key)
|
||||||
|
params[key] = val
|
||||||
|
del params['kwargs']
|
||||||
|
|
||||||
|
resourcePath = '/user/createWithList'
|
||||||
|
resourcePath = resourcePath.replace('{format}', 'json')
|
||||||
|
method = 'POST'
|
||||||
|
|
||||||
|
queryParams = {}
|
||||||
|
headerParams = {}
|
||||||
|
|
||||||
|
postData = (params['body'] if 'body' in params else None)
|
||||||
|
|
||||||
|
response = self.apiClient.callAPI(resourcePath, method, queryParams,
|
||||||
|
postData, headerParams)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user