forked from loafle/openapi-generator-original
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
|
||||
atlassian-ide-plugin.xml
|
||||
.DS_Store
|
||||
*~
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
language: 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
|
||||
|
||||
[](https://travis-ci.org/wordnik/swagger-codegen)
|
||||
[](https://travis-ci.org/swagger-api/swagger-codegen)
|
||||
|
||||
## Overview
|
||||
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
|
||||
http://swagger.wordnik.com. For more information about Wordnik's APIs, please visit http://developer.wordnik.com.
|
||||
Swagger-compliant server.
|
||||
|
||||
## 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
|
||||
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/)
|
||||
|
||||
* [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/)
|
||||
|
||||
@@ -42,7 +59,7 @@ You can build a client against Wordnik's [petstore](http://petstore.swagger.word
|
||||
./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:
|
||||
|
||||
```
|
||||
@@ -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`.
|
||||
|
||||
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:
|
||||
|
||||
@@ -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.
|
||||
|
||||
### 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.
|
||||
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)
|
||||
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:
|
||||
|
||||
```
|
||||
-DfileMap=/path/to/files
|
||||
-DfileMap=/path/to/resource-listing
|
||||
```
|
||||
|
||||
Or for example:
|
||||
@@ -142,7 +161,7 @@ ci server... or while coding on an airplane.
|
||||
|
||||
### 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
|
||||
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
|
||||
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:
|
||||
|
||||
```
|
||||
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:
|
||||
|
||||
```
|
||||
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
|
||||
|
||||

|
||||

|
||||
|
||||
### To build a server stub
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
$ ./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
|
||||
-------
|
||||
|
||||
Copyright 2013 Wordnik, Inc.
|
||||
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.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
val version = scala.util.Properties.scalaPropOrElse("version.number", "unknown").toString match {
|
||||
case "2.10.0" => "2.10"
|
||||
case "2.10.2" => "2.10"
|
||||
case "2.10.3" => "2.10"
|
||||
case s if s startsWith "2.10" => "2.10"
|
||||
case s if s startsWith "2.11" => "2.11"
|
||||
case e: String => e
|
||||
}
|
||||
println(version)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
@@ -19,14 +18,15 @@ if [ ! -d "${APP_DIR}" ]; then
|
||||
fi
|
||||
|
||||
cd $APP_DIR
|
||||
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
|
||||
|
||||
|
||||
# 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"
|
||||
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
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
fi
|
||||
|
||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
||||
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"
|
||||
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
fi
|
||||
|
||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
||||
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"
|
||||
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
fi
|
||||
|
||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
||||
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"
|
||||
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
fi
|
||||
|
||||
@@ -22,11 +22,11 @@ cd $APP_DIR
|
||||
|
||||
|
||||
# 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"
|
||||
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
fi
|
||||
|
||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
||||
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"
|
||||
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
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"
|
||||
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
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
fi
|
||||
|
||||
@@ -27,8 +27,8 @@ cd $APP_DIR
|
||||
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"
|
||||
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
fi
|
||||
|
||||
@@ -22,11 +22,11 @@ cd $APP_DIR
|
||||
|
||||
|
||||
# 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"
|
||||
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
fi
|
||||
|
||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
||||
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"
|
||||
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
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"
|
||||
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
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
fi
|
||||
|
||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
||||
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"
|
||||
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
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"
|
||||
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
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
fi
|
||||
|
||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
||||
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"
|
||||
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
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"
|
||||
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
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
fi
|
||||
|
||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
||||
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"
|
||||
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
fi
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
@@ -19,14 +18,15 @@ if [ ! -d "${APP_DIR}" ]; then
|
||||
fi
|
||||
|
||||
cd $APP_DIR
|
||||
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
|
||||
|
||||
|
||||
# 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"
|
||||
ags="$@"
|
||||
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
fi
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
|
||||
SCALA_RUNNER_VERSION=2.10 #$(scala ./bin/Version.scala)
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
@@ -24,8 +24,8 @@ cd $APP_DIR
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
ags="com.wordnik.swagger.codegen.ScalaAsyncClientGenerator $@"
|
||||
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
java -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
fi
|
||||
|
||||
@@ -25,8 +25,8 @@ cd $APP_DIR
|
||||
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"
|
||||
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
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"
|
||||
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
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
fi
|
||||
|
||||
@@ -22,11 +22,11 @@ cd $APP_DIR
|
||||
|
||||
|
||||
# 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"
|
||||
ags="$@ SwaggerDocGenerator http://developer.wordnik.com/v4/resources.json"
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties "
|
||||
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
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
fi
|
||||
|
||||
@@ -24,8 +24,8 @@ cd $APP_DIR
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
ags="com.wordnik.swagger.codegen.SpecConverter $@"
|
||||
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
fi
|
||||
|
||||
@@ -24,8 +24,8 @@ cd $APP_DIR
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
ags="com.wordnik.swagger.codegen.spec.Validator $@"
|
||||
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
fi
|
||||
|
||||
30
build.sbt
30
build.sbt
@@ -5,9 +5,7 @@ organization := "com.wordnik"
|
||||
|
||||
name := "swagger-codegen"
|
||||
|
||||
version := "2.0.13"
|
||||
|
||||
scalaVersion := "2.10.1"
|
||||
version := "2.0.18-SNAPSHOT"
|
||||
|
||||
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")
|
||||
|
||||
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(
|
||||
"org.json4s" %% "json4s-jackson" % "3.2.5",
|
||||
"org.json4s" %% "json4s-jackson" % "3.2.10",
|
||||
"io.backchat.inflector" %% "scala-inflector" % "1.3.5",
|
||||
"commons-io" % "commons-io" % "2.3",
|
||||
"net.iharder" % "base64" % "2.3.8",
|
||||
"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",
|
||||
"org.scalatest" %% "scalatest" % "1.9.1" % "test"
|
||||
"org.scalatest" %% "scalatest" % "2.1.7" % "test"
|
||||
)
|
||||
|
||||
libraryDependencies <+= scalaVersion {
|
||||
case v if v.startsWith("2.9") =>
|
||||
"org.fusesource.scalate" % "scalate-core_2.9" % "1.6.1"
|
||||
case v if v.startsWith("2.10") => {
|
||||
"org.fusesource.scalate" %% "scalate-core" % "1.6.1"
|
||||
}
|
||||
case v if v.startsWith("2.10") =>
|
||||
"org.scalatra.scalate" %% "scalate-core" % "1.7.0"
|
||||
case v if v.startsWith("2.11") =>
|
||||
"org.scalatra.scalate" %% "scalate-core" % "1.7.0"
|
||||
}
|
||||
|
||||
libraryDependencies ++= {
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
resolvers += "Typesafe releases" at "http://repo.typesafe.com/typesafe/releases"
|
||||
|
||||
packageOptions <+= (name, version, organization) map {
|
||||
(title, version, vendor) =>
|
||||
Package.ManifestAttributes(
|
||||
@@ -65,7 +69,7 @@ publishTo <<= (version) { version: String =>
|
||||
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 =>
|
||||
art.copy(`classifier` = Some("assembly"))
|
||||
@@ -130,4 +134,4 @@ pomExtra <<= (pomExtra, name, description) {(pom, name, desc) => pom ++ Group(
|
||||
|
||||
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")
|
||||
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,6 +42,7 @@ object AndroidJavaPetstoreCodegen extends BasicAndroidJavaGenerator {
|
||||
// supporting classes
|
||||
override def supportingFiles = List(
|
||||
("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"),
|
||||
("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")
|
||||
|
||||
@@ -104,55 +104,8 @@
|
||||
<target>1.6</target>
|
||||
</configuration>
|
||||
</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>
|
||||
</build>
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>net.alchim31.maven</groupId>
|
||||
<artifactId>scala-maven-plugin</artifactId>
|
||||
<version>${scala-maven-plugin-version}</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
@@ -178,20 +131,26 @@
|
||||
<version>${httpclient-version}</version>
|
||||
<scope>compile</scope>
|
||||
</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 -->
|
||||
<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>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
@@ -202,13 +161,10 @@
|
||||
|
||||
<properties>
|
||||
<jackson-version>2.1.4</jackson-version>
|
||||
<scala-version>2.9.1-1</scala-version>
|
||||
<junit-version>4.8.1</junit-version>
|
||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||
<junit-version>4.8.1</junit-version>
|
||||
<scala-test-version>1.6.1</scala-test-version>
|
||||
<httpclient-version>4.2.3</httpclient-version>
|
||||
<scala-maven-plugin-version>3.1.5</scala-maven-plugin-version>
|
||||
<httpclient-version>4.3</httpclient-version>
|
||||
</properties>
|
||||
</project>
|
||||
|
||||
|
||||
@@ -9,11 +9,20 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import org.apache.http.*;
|
||||
import org.apache.http.client.*;
|
||||
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.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.impl.client.*;
|
||||
import org.apache.http.impl.conn.*;
|
||||
import org.apache.http.params.*;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -22,15 +31,50 @@ import java.util.List;
|
||||
import java.io.IOException;
|
||||
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 {
|
||||
private static ApiInvoker INSTANCE = new ApiInvoker();
|
||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||
|
||||
private HttpClient client = null;
|
||||
|
||||
private boolean ignoreSSLCertificates = false;
|
||||
|
||||
private ClientConnectionManager ignoreSSLConnectionManager;
|
||||
|
||||
public ApiInvoker() {
|
||||
initConnectionManager();
|
||||
}
|
||||
|
||||
public static ApiInvoker getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void ignoreSSLCertificates(boolean ignoreSSLCertificates) {
|
||||
this.ignoreSSLCertificates = ignoreSSLCertificates;
|
||||
}
|
||||
|
||||
public void addDefaultHeader(String key, String value) {
|
||||
defaultHeaderMap.put(key, value);
|
||||
}
|
||||
@@ -114,8 +158,24 @@ public class ApiInvoker {
|
||||
}
|
||||
else if ("POST".equals(method)) {
|
||||
HttpPost post = new HttpPost(url);
|
||||
post.setHeader("Content-Type", contentType);
|
||||
post.setEntity(new StringEntity(serialize(body), "UTF-8"));
|
||||
if (body != null) {
|
||||
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()) {
|
||||
post.setHeader(key, headers.get(key));
|
||||
}
|
||||
@@ -124,8 +184,21 @@ public class ApiInvoker {
|
||||
else if ("PUT".equals(method)) {
|
||||
HttpPut put = new HttpPut(url);
|
||||
if(body != null) {
|
||||
put.setHeader("Content-Type", contentType);
|
||||
put.setEntity(new StringEntity(serialize(body), "UTF-8"));
|
||||
if("application/x-www-form-urlencoded".equals(contentType)) {
|
||||
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()) {
|
||||
put.setHeader(key, headers.get(key));
|
||||
@@ -139,6 +212,18 @@ public class ApiInvoker {
|
||||
}
|
||||
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();
|
||||
String responseString = null;
|
||||
@@ -167,8 +252,61 @@ public class ApiInvoker {
|
||||
}
|
||||
|
||||
private HttpClient getClient(String host) {
|
||||
if(client == null)
|
||||
client = new DefaultHttpClient();
|
||||
if (client == null) {
|
||||
if (ignoreSSLCertificates && ignoreSSLConnectionManager != null) {
|
||||
// Trust self signed certificates
|
||||
client = new DefaultHttpClient(ignoreSSLConnectionManager, new BasicHttpParams());
|
||||
} else {
|
||||
client = new DefaultHttpClient();
|
||||
}
|
||||
}
|
||||
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.ApiInvoker;
|
||||
import java.io.File;
|
||||
import com.wordnik.petstore.model.Pet;
|
||||
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 {
|
||||
String basePath = "http://petstore.swagger.wordnik.com/api";
|
||||
@@ -17,16 +25,243 @@ public class PetApi {
|
||||
public ApiInvoker getInvoker() {
|
||||
return apiInvoker;
|
||||
}
|
||||
|
||||
|
||||
public void setBasePath(String basePath) {
|
||||
this.basePath = basePath;
|
||||
}
|
||||
|
||||
|
||||
public String getBasePath() {
|
||||
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
|
||||
if(petId == null ) {
|
||||
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> 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 {
|
||||
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){
|
||||
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 {
|
||||
Object postBody = null;
|
||||
// verify required params are set
|
||||
if(petId == null ) {
|
||||
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> 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 {
|
||||
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){
|
||||
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 {
|
||||
Object postBody = body;
|
||||
// verify required params are set
|
||||
if(petId == null || body == null ) {
|
||||
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> 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 {
|
||||
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){
|
||||
return (List<Pet>) ApiInvoker.deserialize(response, "Array", Pet.class);
|
||||
return (List<Pet>) ApiInvoker.deserialize(response, "List", Pet.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
@@ -119,38 +480,8 @@ public class PetApi {
|
||||
}
|
||||
}
|
||||
}
|
||||
public void updatePetWithForm (String petId, String name, String status) throws ApiException {
|
||||
// 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 uploadFile (String additionalMetadata, File body) throws ApiException {
|
||||
public void uploadFile (String additionalMetadata, File file) throws ApiException {
|
||||
Object postBody = null;
|
||||
// create path and map variables
|
||||
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> 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 {
|
||||
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){
|
||||
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.petstore.model.Order;
|
||||
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 {
|
||||
String basePath = "http://petstore.swagger.wordnik.com/api";
|
||||
@@ -16,16 +25,79 @@ public class StoreApi {
|
||||
public ApiInvoker getInvoker() {
|
||||
return apiInvoker;
|
||||
}
|
||||
|
||||
|
||||
public void setBasePath(String basePath) {
|
||||
this.basePath = basePath;
|
||||
}
|
||||
|
||||
|
||||
public String getBasePath() {
|
||||
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
|
||||
if(orderId == null ) {
|
||||
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> 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 {
|
||||
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){
|
||||
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.petstore.model.User;
|
||||
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 {
|
||||
String basePath = "http://petstore.swagger.wordnik.com/api";
|
||||
@@ -16,47 +25,24 @@ public class UserApi {
|
||||
public ApiInvoker getInvoker() {
|
||||
return apiInvoker;
|
||||
}
|
||||
|
||||
|
||||
public void setBasePath(String basePath) {
|
||||
this.basePath = basePath;
|
||||
}
|
||||
|
||||
|
||||
public String getBasePath() {
|
||||
return basePath;
|
||||
}
|
||||
|
||||
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){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
public void createUsersWithArrayInput (List<User> body) throws ApiException {
|
||||
Object postBody = body;
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
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> 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 {
|
||||
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){
|
||||
return ;
|
||||
}
|
||||
@@ -88,6 +94,7 @@ public class UserApi {
|
||||
}
|
||||
}
|
||||
public void createUsersWithListInput (List<User> body) throws ApiException {
|
||||
Object postBody = body;
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
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> 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 {
|
||||
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){
|
||||
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 {
|
||||
Object postBody = body;
|
||||
// verify required params are set
|
||||
if(username == null || body == null ) {
|
||||
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> 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 {
|
||||
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){
|
||||
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 {
|
||||
Object postBody = null;
|
||||
// verify required params are set
|
||||
if(username == null ) {
|
||||
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> 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 {
|
||||
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){
|
||||
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 {
|
||||
Object postBody = null;
|
||||
// verify required params are set
|
||||
if(username == null ) {
|
||||
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> 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 {
|
||||
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 (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 {
|
||||
Object postBody = null;
|
||||
// verify required params are set
|
||||
if(username == null || password == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
@@ -227,10 +325,30 @@ public class UserApi {
|
||||
queryParams.put("username", String.valueOf(username));
|
||||
if(!"null".equals(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 {
|
||||
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 (String) ApiInvoker.deserialize(response, "", String.class);
|
||||
}
|
||||
@@ -247,6 +365,7 @@ public class UserApi {
|
||||
}
|
||||
}
|
||||
public void logoutUser () throws ApiException {
|
||||
Object postBody = null;
|
||||
// create path and map variables
|
||||
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> 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 {
|
||||
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){
|
||||
return ;
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package com.wordnik.petstore.model;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class Category {
|
||||
/* Category unique identifier */
|
||||
@JsonProperty("id")
|
||||
private Long id = null;
|
||||
/* Name of the category */
|
||||
@JsonProperty("name")
|
||||
private String name = null;
|
||||
public Long getId() {
|
||||
|
||||
@@ -4,19 +4,15 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.Date;
|
||||
public class Order {
|
||||
/* Unique identifier for the order */
|
||||
@JsonProperty("id")
|
||||
private Long id = null;
|
||||
/* ID of pet being ordered */
|
||||
@JsonProperty("petId")
|
||||
private Long petId = null;
|
||||
/* Number of pets ordered */
|
||||
@JsonProperty("quantity")
|
||||
private Integer quantity = null;
|
||||
/* Status of the order */
|
||||
/* Order Status */
|
||||
@JsonProperty("status")
|
||||
private String status = null;
|
||||
/* Date shipped, only if it has been */
|
||||
@JsonProperty("shipDate")
|
||||
private Date shipDate = null;
|
||||
public Long getId() {
|
||||
|
||||
@@ -4,21 +4,16 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.*;
|
||||
import com.wordnik.petstore.model.Category;
|
||||
import com.wordnik.petstore.model.Tag;
|
||||
public class Pet {
|
||||
/* Unique identifier for the Pet */
|
||||
/* unique identifier for the pet */
|
||||
@JsonProperty("id")
|
||||
private Long id = null;
|
||||
/* Category the pet is in */
|
||||
@JsonProperty("category")
|
||||
private Category category = null;
|
||||
/* Friendly name of the pet */
|
||||
@JsonProperty("name")
|
||||
private String name = null;
|
||||
/* Image URLs */
|
||||
@JsonProperty("photoUrls")
|
||||
private List<String> photoUrls = new ArrayList<String>();
|
||||
/* Tags assigned to this pet */
|
||||
@JsonProperty("tags")
|
||||
private List<Tag> tags = new ArrayList<Tag>();
|
||||
/* pet status in the store */
|
||||
|
||||
@@ -3,10 +3,8 @@ package com.wordnik.petstore.model;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class Tag {
|
||||
/* Unique identifier for the tag */
|
||||
@JsonProperty("id")
|
||||
private Long id = null;
|
||||
/* Friendly name for the tag */
|
||||
@JsonProperty("name")
|
||||
private String name = null;
|
||||
public Long getId() {
|
||||
|
||||
@@ -3,25 +3,18 @@ package com.wordnik.petstore.model;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class User {
|
||||
/* Unique identifier for the user */
|
||||
@JsonProperty("id")
|
||||
private Long id = null;
|
||||
/* Unique username */
|
||||
@JsonProperty("username")
|
||||
private String username = null;
|
||||
/* First name of the user */
|
||||
@JsonProperty("firstName")
|
||||
private String firstName = null;
|
||||
/* Last name of the user */
|
||||
@JsonProperty("username")
|
||||
private String username = null;
|
||||
@JsonProperty("lastName")
|
||||
private String lastName = null;
|
||||
/* Email address of the user */
|
||||
@JsonProperty("email")
|
||||
private String email = null;
|
||||
/* Password name of the user */
|
||||
@JsonProperty("password")
|
||||
private String password = null;
|
||||
/* Phone number of the user */
|
||||
@JsonProperty("phone")
|
||||
private String phone = null;
|
||||
/* User Status */
|
||||
@@ -34,13 +27,6 @@ public class User {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
@@ -48,6 +34,13 @@ public class User {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
@@ -88,8 +81,8 @@ public class User {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class User {\n");
|
||||
sb.append(" id: ").append(id).append("\n");
|
||||
sb.append(" username: ").append(username).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(" email: ").append(email).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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -21,38 +21,6 @@
|
||||
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>
|
||||
/// Find pet by ID Returns a pet based on ID
|
||||
/// </summary>
|
||||
@@ -197,6 +165,38 @@
|
||||
}
|
||||
}
|
||||
/// <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
|
||||
/// </summary>
|
||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||
|
||||
@@ -21,41 +21,6 @@
|
||||
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>
|
||||
/// Find purchase order by ID For valid response try integer IDs with value <= 5. Anything above 5 or nonintegers will generate API errors
|
||||
/// </summary>
|
||||
@@ -92,6 +57,41 @@
|
||||
}
|
||||
}
|
||||
/// <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
|
||||
/// </summary>
|
||||
/// <param name="body">order placed for purchasing the pet</param>
|
||||
|
||||
@@ -21,6 +21,42 @@
|
||||
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>
|
||||
/// Delete user This can only be done by the logged in user.
|
||||
/// </summary>
|
||||
@@ -92,42 +128,6 @@
|
||||
}
|
||||
}
|
||||
/// <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
|
||||
/// </summary>
|
||||
/// <param name="username">The user name for login</param>
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
|
||||
var client = WebRequest.Create(host + path + querystring);
|
||||
client.ContentType = "application/json";
|
||||
client.Method = method;
|
||||
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
<arg line="-source-path ${sourcepath}"/>
|
||||
<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.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.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'"/>
|
||||
|
||||
@@ -22,91 +22,16 @@ public class UserApi extends SwaggerApi {
|
||||
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_deleteUser: String = "deleteUser";
|
||||
public static const event_getUserByName: String = "getUserByName";
|
||||
public static const event_loginUser: String = "loginUser";
|
||||
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 */
|
||||
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 {
|
||||
// create path and map variables
|
||||
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 ;
|
||||
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")]
|
||||
public class Category {
|
||||
/* Category unique identifier */
|
||||
[XmlElement(name="id")]
|
||||
public var id: Number = 0.0;
|
||||
|
||||
/* Name of the category */
|
||||
[XmlElement(name="name")]
|
||||
public var name: String = null;
|
||||
|
||||
|
||||
@@ -2,23 +2,19 @@ package com.wordnik.client.model {
|
||||
|
||||
[XmlRootNode(name="Order")]
|
||||
public class Order {
|
||||
/* Unique identifier for the order */
|
||||
[XmlElement(name="id")]
|
||||
public var id: Number = 0.0;
|
||||
|
||||
/* ID of pet being ordered */
|
||||
[XmlElement(name="petId")]
|
||||
public var petId: Number = 0.0;
|
||||
|
||||
/* Number of pets ordered */
|
||||
[XmlElement(name="quantity")]
|
||||
public var quantity: Number = 0.0;
|
||||
|
||||
/* Status of the order */
|
||||
/* Order Status */
|
||||
[XmlElement(name="status")]
|
||||
public var status: String = null;
|
||||
|
||||
/* Date shipped, only if it has been */
|
||||
[XmlElement(name="shipDate")]
|
||||
public var shipDate: Date = null;
|
||||
|
||||
|
||||
@@ -4,26 +4,22 @@ import com.wordnik.client.model.Category;
|
||||
import com.wordnik.client.model.Tag;
|
||||
[XmlRootNode(name="Pet")]
|
||||
public class Pet {
|
||||
/* Unique identifier for the Pet */
|
||||
/* unique identifier for the pet */
|
||||
[XmlElement(name="id")]
|
||||
public var id: Number = 0.0;
|
||||
|
||||
/* Category the pet is in */
|
||||
[XmlElement(name="category")]
|
||||
public var category: Category = null;
|
||||
|
||||
/* Friendly name of the pet */
|
||||
[XmlElement(name="name")]
|
||||
public var name: String = null;
|
||||
|
||||
/* Image URLs */
|
||||
// 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;
|
||||
[XmlElementWrapper(name="photoUrls")]
|
||||
[XmlElements(name="photoUrl", type="com.wordnik.client.model.String")]
|
||||
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
|
||||
private var _tags_obj_class: com.wordnik.client.model.Tag = null;
|
||||
[XmlElementWrapper(name="tags")]
|
||||
|
||||
@@ -2,11 +2,9 @@ package com.wordnik.client.model {
|
||||
|
||||
[XmlRootNode(name="Tag")]
|
||||
public class Tag {
|
||||
/* Unique identifier for the tag */
|
||||
[XmlElement(name="id")]
|
||||
public var id: Number = 0.0;
|
||||
|
||||
/* Friendly name for the tag */
|
||||
[XmlElement(name="name")]
|
||||
public var name: String = null;
|
||||
|
||||
|
||||
@@ -2,31 +2,24 @@ package com.wordnik.client.model {
|
||||
|
||||
[XmlRootNode(name="User")]
|
||||
public class User {
|
||||
/* Unique identifier for the user */
|
||||
[XmlElement(name="id")]
|
||||
public var id: Number = 0.0;
|
||||
|
||||
/* Unique username */
|
||||
[XmlElement(name="username")]
|
||||
public var username: String = null;
|
||||
|
||||
/* First name of the user */
|
||||
[XmlElement(name="firstName")]
|
||||
public var firstName: String = null;
|
||||
|
||||
/* Last name of the user */
|
||||
[XmlElement(name="username")]
|
||||
public var username: String = null;
|
||||
|
||||
[XmlElement(name="lastName")]
|
||||
public var lastName: String = null;
|
||||
|
||||
/* Email address of the user */
|
||||
[XmlElement(name="email")]
|
||||
public var email: String = null;
|
||||
|
||||
/* Password name of the user */
|
||||
[XmlElement(name="password")]
|
||||
public var password: String = null;
|
||||
|
||||
/* Phone number of the user */
|
||||
[XmlElement(name="phone")]
|
||||
public var phone: String = null;
|
||||
|
||||
@@ -37,8 +30,8 @@ package com.wordnik.client.model {
|
||||
public function toString(): String {
|
||||
var str: String = "User: ";
|
||||
str += " (id: " + id + ")";
|
||||
str += " (username: " + username + ")";
|
||||
str += " (firstName: " + firstName + ")";
|
||||
str += " (username: " + username + ")";
|
||||
str += " (lastName: " + lastName + ")";
|
||||
str += " (email: " + email + ")";
|
||||
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");
|
||||
* 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)
|
||||
|
||||
// location of templates
|
||||
override def templateDir = "Java"
|
||||
override def templateDir = "src/main/resources/Java"
|
||||
|
||||
// where to write generated code
|
||||
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"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.wordnik.client</groupId>
|
||||
<artifactId>api-client</artifactId>
|
||||
<groupId>com.wordnik</groupId>
|
||||
<artifactId>swagger-petstore</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>api-client</name>
|
||||
<name>swagger-petstore</name>
|
||||
<version>1.0.0</version>
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:wordnik/swagger-mustache.git</connection>
|
||||
@@ -104,55 +104,8 @@
|
||||
<target>1.6</target>
|
||||
</configuration>
|
||||
</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>
|
||||
</build>
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>net.alchim31.maven</groupId>
|
||||
<artifactId>scala-maven-plugin</artifactId>
|
||||
<version>${scala-maven-plugin-version}</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.sun.jersey</groupId>
|
||||
@@ -160,6 +113,12 @@
|
||||
<version>${jersey-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.jersey.contribs</groupId>
|
||||
<artifactId>jersey-multipart</artifactId>
|
||||
<version>${jersey-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
@@ -178,20 +137,19 @@
|
||||
<version>${jackson-version}</version>
|
||||
<scope>compile</scope>
|
||||
</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 -->
|
||||
<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>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
@@ -203,12 +161,10 @@
|
||||
<properties>
|
||||
<jersey-version>1.7</jersey-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>
|
||||
<maven-plugin-version>1.0.0</maven-plugin-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>
|
||||
</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.filter.LoggingFilter;
|
||||
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.MediaType;
|
||||
@@ -19,11 +20,18 @@ import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
public class ApiInvoker {
|
||||
private static ApiInvoker INSTANCE = new ApiInvoker();
|
||||
private Map<String, Client> hostMap = new HashMap<String, Client>();
|
||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||
private boolean isDebug = false;
|
||||
|
||||
public void enableDebug() {
|
||||
isDebug = true;
|
||||
}
|
||||
|
||||
public static ApiInvoker getInstance() {
|
||||
return INSTANCE;
|
||||
@@ -34,7 +42,12 @@ public class ApiInvoker {
|
||||
}
|
||||
|
||||
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 {
|
||||
@@ -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);
|
||||
|
||||
StringBuilder b = new StringBuilder();
|
||||
@@ -105,21 +118,46 @@ public class ApiInvoker {
|
||||
}
|
||||
else if ("POST".equals(method)) {
|
||||
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
|
||||
response = builder.type("application/json").post(ClientResponse.class, serialize(body));
|
||||
response = builder.type(contentType).post(ClientResponse.class, serialize(body));
|
||||
}
|
||||
else if ("PUT".equals(method)) {
|
||||
if(body == null)
|
||||
response = builder.put(ClientResponse.class, serialize(body));
|
||||
else
|
||||
response = builder.type("application/json").put(ClientResponse.class, serialize(body));
|
||||
else {
|
||||
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)) {
|
||||
if(body == null)
|
||||
response = builder.delete(ClientResponse.class, serialize(body));
|
||||
else
|
||||
response = builder.type("application/json").delete(ClientResponse.class, serialize(body));
|
||||
response = builder.type(contentType).delete(ClientResponse.class, serialize(body));
|
||||
}
|
||||
else {
|
||||
throw new ApiException(500, "unknown method type " + method);
|
||||
@@ -140,7 +178,8 @@ public class ApiInvoker {
|
||||
private Client getClient(String host) {
|
||||
if(!hostMap.containsKey(host)) {
|
||||
Client client = Client.create();
|
||||
client.addFilter(new LoggingFilter());
|
||||
if(isDebug)
|
||||
client.addFilter(new LoggingFilter());
|
||||
hostMap.put(host, client);
|
||||
}
|
||||
return hostMap.get(host);
|
||||
|
||||
@@ -5,6 +5,8 @@ import com.fasterxml.jackson.databind.*;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.core.JsonGenerator.Feature;
|
||||
|
||||
import com.fasterxml.jackson.datatype.joda.*;
|
||||
|
||||
public class JsonUtil {
|
||||
public static ObjectMapper mapper;
|
||||
|
||||
@@ -12,6 +14,7 @@ public class JsonUtil {
|
||||
mapper = new ObjectMapper();
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||
mapper.registerModule(new JodaModule());
|
||||
}
|
||||
|
||||
public static ObjectMapper getJsonMapper() {
|
||||
|
||||
@@ -2,8 +2,13 @@ package com.wordnik.petstore.api;
|
||||
|
||||
import com.wordnik.client.ApiException;
|
||||
import com.wordnik.client.ApiInvoker;
|
||||
import java.io.File;
|
||||
|
||||
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.*;
|
||||
|
||||
public class PetApi {
|
||||
@@ -22,34 +27,10 @@ public class PetApi {
|
||||
return basePath;
|
||||
}
|
||||
|
||||
public void uploadFile (String additionalMetadata, File body) throws ApiException {
|
||||
// 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>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
//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");
|
||||
@@ -60,11 +41,24 @@ public class PetApi {
|
||||
// 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 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 {
|
||||
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 (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
|
||||
if(petId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
@@ -91,11 +87,28 @@ public class PetApi {
|
||||
// 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 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 {
|
||||
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){
|
||||
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 {
|
||||
Object postBody = body;
|
||||
// verify required params are set
|
||||
if(petId == null || body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
@@ -122,13 +183,26 @@ public class PetApi {
|
||||
// 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 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 {
|
||||
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){
|
||||
return (List<Pet>) ApiInvoker.deserialize(response, "Array", Pet.class);
|
||||
return (List<Pet>) ApiInvoker.deserialize(response, "List", Pet.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
@@ -142,38 +216,9 @@ public class PetApi {
|
||||
}
|
||||
}
|
||||
}
|
||||
public void updatePetWithForm (String petId, String name, String status) throws ApiException {
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
//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");
|
||||
@@ -184,11 +229,24 @@ public class PetApi {
|
||||
// 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 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 {
|
||||
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 ;
|
||||
}
|
||||
@@ -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 {
|
||||
Object postBody = body;
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
@@ -215,11 +277,24 @@ public class PetApi {
|
||||
// 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 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 {
|
||||
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){
|
||||
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 {
|
||||
Object postBody = null;
|
||||
// verify required params are set
|
||||
if(status == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
@@ -246,15 +323,28 @@ public class PetApi {
|
||||
// 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>();
|
||||
|
||||
if(!"null".equals(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 {
|
||||
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 (List<Pet>) ApiInvoker.deserialize(response, "Array", Pet.class);
|
||||
return (List<Pet>) ApiInvoker.deserialize(response, "List", Pet.class);
|
||||
}
|
||||
else {
|
||||
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 {
|
||||
Object postBody = null;
|
||||
// verify required params are set
|
||||
if(tags == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
@@ -279,15 +371,28 @@ public class PetApi {
|
||||
// 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>();
|
||||
|
||||
if(!"null".equals(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 {
|
||||
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 (List<Pet>) ApiInvoker.deserialize(response, "Array", Pet.class);
|
||||
return (List<Pet>) ApiInvoker.deserialize(response, "List", Pet.class);
|
||||
}
|
||||
else {
|
||||
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.ApiInvoker;
|
||||
|
||||
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.*;
|
||||
|
||||
public class StoreApi {
|
||||
@@ -21,22 +27,37 @@ public class StoreApi {
|
||||
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
|
||||
if(orderId == null ) {
|
||||
if(body == 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()));
|
||||
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>();
|
||||
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 {
|
||||
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){
|
||||
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
|
||||
if(orderId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
@@ -63,11 +87,71 @@ public class StoreApi {
|
||||
// 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 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 {
|
||||
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){
|
||||
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.ApiInvoker;
|
||||
|
||||
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.*;
|
||||
|
||||
public class UserApi {
|
||||
@@ -21,9 +27,12 @@ public class UserApi {
|
||||
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
|
||||
if(username == null ) {
|
||||
if(username == null || body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
@@ -32,11 +41,24 @@ public class UserApi {
|
||||
// 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 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 {
|
||||
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){
|
||||
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
|
||||
if(username == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
@@ -63,11 +88,71 @@ public class UserApi {
|
||||
// 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 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 {
|
||||
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){
|
||||
return (User) ApiInvoker.deserialize(response, "", User.class);
|
||||
}
|
||||
@@ -83,38 +168,9 @@ public class UserApi {
|
||||
}
|
||||
}
|
||||
}
|
||||
public void updateUser (String username, User body) throws ApiException {
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
//error info- code: 400 reason: "Invalid username and password combination" model: <none>
|
||||
public String loginUser (String username, String password) throws ApiException {
|
||||
Object postBody = null;
|
||||
// verify required params are set
|
||||
if(username == null || password == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
@@ -125,15 +181,28 @@ public class UserApi {
|
||||
// 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>();
|
||||
|
||||
if(!"null".equals(String.valueOf(username)))
|
||||
queryParams.put("username", String.valueOf(username));
|
||||
if(!"null".equals(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 {
|
||||
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 (String) ApiInvoker.deserialize(response, "", String.class);
|
||||
}
|
||||
@@ -150,48 +219,31 @@ public class UserApi {
|
||||
}
|
||||
}
|
||||
public void logoutUser () throws ApiException {
|
||||
Object postBody = null;
|
||||
// create path and map variables
|
||||
String path = "/user/logout".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 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 {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, 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 {
|
||||
// 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);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@@ -208,6 +260,7 @@ public class UserApi {
|
||||
}
|
||||
}
|
||||
public void createUsersWithArrayInput (List<User> body) throws ApiException {
|
||||
Object postBody = body;
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
@@ -218,11 +271,24 @@ public class UserApi {
|
||||
// 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 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 {
|
||||
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 ;
|
||||
}
|
||||
@@ -239,6 +305,7 @@ public class UserApi {
|
||||
}
|
||||
}
|
||||
public void createUsersWithListInput (List<User> body) throws ApiException {
|
||||
Object postBody = body;
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
@@ -249,11 +316,69 @@ public class UserApi {
|
||||
// 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 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 {
|
||||
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){
|
||||
return ;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2012 Wordnik, Inc.
|
||||
* Copyright 2014 Wordnik, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (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/"
|
||||
override def destinationDir = outputFolder + java.io.File.separator + "client"
|
||||
|
||||
// to avoid recompiling ...
|
||||
override def templateDir = "objc"
|
||||
|
||||
additionalParams ++= Map("projectName" -> "PetstoreClient")
|
||||
|
||||
@@ -280,7 +280,7 @@ static bool loggingEnabled = false;
|
||||
}
|
||||
|
||||
if(body != nil) {
|
||||
if([body isKindOfClass:[NSDictionary class]]){
|
||||
if([body isKindOfClass:[NSDictionary class]] || [body isKindOfClass:[NSArray class]]){
|
||||
[request setValue:requestContentType forHTTPHeaderField:@"Content-Type"];
|
||||
}
|
||||
else if ([body isKindOfClass:[SWGFile class]]) {}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SWGObject.h"
|
||||
|
||||
|
||||
@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
|
||||
name: (NSString*) name;
|
||||
|
||||
@@ -2,17 +2,18 @@
|
||||
#import "SWGObject.h"
|
||||
#import "SWGDate.h"
|
||||
|
||||
|
||||
@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
|
||||
petId: (NSNumber*) petId
|
||||
|
||||
@@ -3,17 +3,18 @@
|
||||
#import "SWGCategory.h"
|
||||
#import "SWGTag.h"
|
||||
|
||||
|
||||
@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]*/
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#import "SWGFile.h"
|
||||
|
||||
|
||||
|
||||
@interface SWGPetApi: NSObject
|
||||
|
||||
-(void) addHeader:(NSString*)value forKey:(NSString*)key;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
@implementation SWGPetApi
|
||||
static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
|
||||
@@ -561,4 +562,5 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#import "SWGOrder.h"
|
||||
|
||||
|
||||
|
||||
@interface SWGStoreApi: NSObject
|
||||
|
||||
-(void) addHeader:(NSString*)value forKey:(NSString*)key;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
@implementation SWGStoreApi
|
||||
static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
|
||||
@@ -202,4 +203,5 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SWGObject.h"
|
||||
|
||||
|
||||
@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
|
||||
name: (NSString*) name;
|
||||
|
||||
@@ -1,27 +1,28 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SWGObject.h"
|
||||
|
||||
|
||||
@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]*/
|
||||
|
||||
- (id) _id: (NSNumber*) _id
|
||||
username: (NSString*) username
|
||||
firstName: (NSString*) firstName
|
||||
username: (NSString*) username
|
||||
lastName: (NSString*) lastName
|
||||
email: (NSString*) email
|
||||
password: (NSString*) password
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
@implementation SWGUser
|
||||
|
||||
-(id)_id: (NSNumber*) _id
|
||||
username: (NSString*) username
|
||||
firstName: (NSString*) firstName
|
||||
username: (NSString*) username
|
||||
lastName: (NSString*) lastName
|
||||
email: (NSString*) email
|
||||
password: (NSString*) password
|
||||
@@ -13,8 +13,8 @@
|
||||
userStatus: (NSNumber*) userStatus
|
||||
{
|
||||
__id = _id;
|
||||
_username = username;
|
||||
_firstName = firstName;
|
||||
_username = username;
|
||||
_lastName = lastName;
|
||||
_email = email;
|
||||
_password = password;
|
||||
@@ -28,8 +28,8 @@
|
||||
self = [super init];
|
||||
if(self) {
|
||||
__id = dict[@"id"];
|
||||
_username = dict[@"username"];
|
||||
_firstName = dict[@"firstName"];
|
||||
_username = dict[@"username"];
|
||||
_lastName = dict[@"lastName"];
|
||||
_email = dict[@"email"];
|
||||
_password = dict[@"password"];
|
||||
@@ -44,8 +44,8 @@
|
||||
-(NSDictionary*) asDictionary {
|
||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
||||
if(__id != nil) dict[@"id"] = __id ;
|
||||
if(_username != nil) dict[@"username"] = _username ;
|
||||
if(_firstName != nil) dict[@"firstName"] = _firstName ;
|
||||
if(_username != nil) dict[@"username"] = _username ;
|
||||
if(_lastName != nil) dict[@"lastName"] = _lastName ;
|
||||
if(_email != nil) dict[@"email"] = _email ;
|
||||
if(_password != nil) dict[@"password"] = _password ;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#import "SWGUser.h"
|
||||
|
||||
|
||||
|
||||
@interface SWGUserApi: NSObject
|
||||
|
||||
-(void) addHeader:(NSString*)value forKey:(NSString*)key;
|
||||
@@ -9,33 +10,6 @@
|
||||
+(SWGUserApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
|
||||
+(void) setBasePath:(NSString*)basePath;
|
||||
+(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
|
||||
@@ -83,4 +57,31 @@
|
||||
*/
|
||||
-(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
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
@implementation SWGUserApi
|
||||
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
|
||||
body:(SWGUser*) body
|
||||
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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2012 Wordnik, Inc.
|
||||
* Copyright 2014 Wordnik, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -29,6 +29,7 @@ class PetApi {
|
||||
* getPetById
|
||||
* Find pet by ID
|
||||
* petId, int: ID of pet that needs to be fetched (required)
|
||||
|
||||
* @return Pet
|
||||
*/
|
||||
|
||||
@@ -40,6 +41,8 @@ class PetApi {
|
||||
$method = "GET";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
|
||||
if($petId != null) {
|
||||
$resourcePath = str_replace("{" . "petId" . "}",
|
||||
@@ -67,6 +70,7 @@ class PetApi {
|
||||
* deletePet
|
||||
* Deletes a pet
|
||||
* petId, string: Pet id to delete (required)
|
||||
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -78,6 +82,8 @@ class PetApi {
|
||||
$method = "DELETE";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
|
||||
if($petId != null) {
|
||||
$resourcePath = str_replace("{" . "petId" . "}",
|
||||
@@ -97,7 +103,9 @@ class PetApi {
|
||||
* partialUpdate
|
||||
* partial updates to a pet
|
||||
* petId, string: ID of pet that needs to be fetched (required)
|
||||
|
||||
* body, Pet: Pet object that needs to be added to the store (required)
|
||||
|
||||
* @return Array[Pet]
|
||||
*/
|
||||
|
||||
@@ -109,6 +117,8 @@ class PetApi {
|
||||
$method = "PATCH";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json,application/xml';
|
||||
$headerParams['Content-Type'] = 'application/json,application/xml';
|
||||
|
||||
if($petId != null) {
|
||||
$resourcePath = str_replace("{" . "petId" . "}",
|
||||
@@ -136,8 +146,11 @@ class PetApi {
|
||||
* updatePetWithForm
|
||||
* Updates a pet in the store with form data
|
||||
* petId, string: ID of pet that needs to be updated (required)
|
||||
|
||||
* name, string: Updated name of the pet (optional)
|
||||
|
||||
* status, string: Updated status of the pet (optional)
|
||||
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -149,6 +162,8 @@ class PetApi {
|
||||
$method = "POST";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||
|
||||
if($petId != null) {
|
||||
$resourcePath = str_replace("{" . "petId" . "}",
|
||||
@@ -168,7 +183,9 @@ class PetApi {
|
||||
* uploadFile
|
||||
* uploads an image
|
||||
* additionalMetadata, string: Additional data to pass to server (optional)
|
||||
|
||||
* body, File: file to upload (optional)
|
||||
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -180,6 +197,8 @@ class PetApi {
|
||||
$method = "POST";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'multipart/form-data';
|
||||
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
@@ -195,6 +214,7 @@ class PetApi {
|
||||
* addPet
|
||||
* Add a new pet to the store
|
||||
* body, Pet: Pet object that needs to be added to the store (required)
|
||||
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -206,6 +226,8 @@ class PetApi {
|
||||
$method = "POST";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json,application/xml';
|
||||
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
@@ -221,6 +243,7 @@ class PetApi {
|
||||
* updatePet
|
||||
* Update an existing pet
|
||||
* body, Pet: Pet object that needs to be updated in the store (required)
|
||||
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -232,6 +255,8 @@ class PetApi {
|
||||
$method = "PUT";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
|
||||
//make the API Call
|
||||
if (! isset($body)) {
|
||||
@@ -247,6 +272,7 @@ class PetApi {
|
||||
* findPetsByStatus
|
||||
* Finds Pets by status
|
||||
* status, string: Status values that need to be considered for filter (required)
|
||||
|
||||
* @return Array[Pet]
|
||||
*/
|
||||
|
||||
@@ -258,6 +284,8 @@ class PetApi {
|
||||
$method = "GET";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
|
||||
if($status != null) {
|
||||
$queryParams['status'] = $this->apiClient->toQueryValue($status);
|
||||
@@ -284,6 +312,7 @@ class PetApi {
|
||||
* findPetsByTags
|
||||
* Finds Pets by tags
|
||||
* tags, string: Tags to filter by (required)
|
||||
|
||||
* @return Array[Pet]
|
||||
*/
|
||||
|
||||
@@ -295,6 +324,8 @@ class PetApi {
|
||||
$method = "GET";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
|
||||
if($tags != null) {
|
||||
$queryParams['tags'] = $this->apiClient->toQueryValue($tags);
|
||||
@@ -318,5 +349,6 @@ class PetApi {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ class StoreApi {
|
||||
* getOrderById
|
||||
* Find purchase order by ID
|
||||
* orderId, string: ID of pet that needs to be fetched (required)
|
||||
|
||||
* @return Order
|
||||
*/
|
||||
|
||||
@@ -40,6 +41,8 @@ class StoreApi {
|
||||
$method = "GET";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
|
||||
if($orderId != null) {
|
||||
$resourcePath = str_replace("{" . "orderId" . "}",
|
||||
@@ -67,6 +70,7 @@ class StoreApi {
|
||||
* deleteOrder
|
||||
* Delete purchase order by ID
|
||||
* orderId, string: ID of the order that needs to be deleted (required)
|
||||
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -78,6 +82,8 @@ class StoreApi {
|
||||
$method = "DELETE";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
|
||||
if($orderId != null) {
|
||||
$resourcePath = str_replace("{" . "orderId" . "}",
|
||||
@@ -97,6 +103,7 @@ class StoreApi {
|
||||
* placeOrder
|
||||
* Place an order for a pet
|
||||
* body, Order: order placed for purchasing the pet (required)
|
||||
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -108,6 +115,8 @@ class StoreApi {
|
||||
$method = "POST";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
|
||||
//make the API Call
|
||||
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 $postData parameters to be placed in POST body
|
||||
* @param array $headerParams parameters to be place in request header
|
||||
* @return unknown
|
||||
* @return mixed
|
||||
*/
|
||||
public function callAPI($resourcePath, $method, $queryParams, $postData,
|
||||
$headerParams) {
|
||||
|
||||
$headers = array();
|
||||
$headers[] = "Content-type: application/json";
|
||||
|
||||
# Allow API key from $headerParams to override default
|
||||
$added_api_key = False;
|
||||
@@ -67,7 +66,7 @@ class APIClient {
|
||||
}
|
||||
|
||||
if (is_object($postData) or is_array($postData)) {
|
||||
$postData = json_encode(self::sanitizeForSerialization($postData));
|
||||
$postData = json_encode($this->sanitizeForSerialization($postData));
|
||||
}
|
||||
|
||||
$url = $this->apiServer . $resourcePath;
|
||||
@@ -118,21 +117,35 @@ class APIClient {
|
||||
$response_info['http_code']);
|
||||
}
|
||||
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a JSON POST object
|
||||
*/
|
||||
public static function sanitizeForSerialization($postData) {
|
||||
foreach ($postData as $key => $value) {
|
||||
if (is_a($value, "DateTime")) {
|
||||
$postData->{$key} = $value->format(DateTime::ISO8601);
|
||||
}
|
||||
}
|
||||
return $postData;
|
||||
}
|
||||
protected function sanitizeForSerialization($data)
|
||||
{
|
||||
if (is_scalar($data) || null === $data) {
|
||||
$sanitized = $data;
|
||||
} else if ($data instanceof \DateTime) {
|
||||
$sanitized = $data->format(\DateTime::ISO8601);
|
||||
} 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
|
||||
@@ -170,73 +183,43 @@ class APIClient {
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserialize a JSON string into an object
|
||||
*
|
||||
* @param object $object object or primitive to be deserialized
|
||||
* @param string $class class name is passed as a string
|
||||
* @return object an instance of $class
|
||||
*/
|
||||
public static function deserialize($object, $class) {
|
||||
/**
|
||||
* Deserialize a JSON string into an object
|
||||
*
|
||||
* @param object $object object or primitive to be deserialized
|
||||
* @param string $class class name is passed as a string
|
||||
* @return object an instance of $class
|
||||
*/
|
||||
|
||||
if (gettype($object) == "NULL") {
|
||||
return $object;
|
||||
}
|
||||
|
||||
if (substr($class, 0, 6) == 'array[') {
|
||||
$sub_class = substr($class, 6, -1);
|
||||
$sub_objects = array();
|
||||
foreach ($object as $sub_object) {
|
||||
$sub_objects[] = self::deserialize($sub_object,
|
||||
$sub_class);
|
||||
public static function deserialize($data, $class)
|
||||
{
|
||||
if (null === $data) {
|
||||
$deserialized = null;
|
||||
} else if (substr($class, 0, 6) == 'array[') {
|
||||
$subClass = substr($class, 6, -1);
|
||||
$values = array();
|
||||
foreach ($data as $value) {
|
||||
$values[] = self::deserialize($value, $subClass);
|
||||
}
|
||||
return $sub_objects;
|
||||
$deserialized = $values;
|
||||
} elseif ($class == 'DateTime') {
|
||||
return new DateTime($object);
|
||||
} elseif (in_array($class, array('string', 'int', 'float', 'bool'))) {
|
||||
settype($object, $class);
|
||||
return $object;
|
||||
} else {
|
||||
$instance = new $class(); // this instantiates class named $class
|
||||
$classVars = get_class_vars($class);
|
||||
}
|
||||
$deserialized = new \DateTime($data);
|
||||
} elseif (in_array($class, array('string', 'int', 'float', 'bool'))) {
|
||||
settype($data, $class);
|
||||
$deserialized = $data;
|
||||
} else {
|
||||
$instance = new $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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* Updated user
|
||||
* username, string: name that need to be deleted (required)
|
||||
|
||||
* body, User: Updated user object (required)
|
||||
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -119,6 +43,8 @@ class UserApi {
|
||||
$method = "PUT";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
|
||||
if($username != null) {
|
||||
$resourcePath = str_replace("{" . "username" . "}",
|
||||
@@ -138,6 +64,7 @@ class UserApi {
|
||||
* deleteUser
|
||||
* Delete user
|
||||
* username, string: The name that needs to be deleted (required)
|
||||
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -149,6 +76,8 @@ class UserApi {
|
||||
$method = "DELETE";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
|
||||
if($username != null) {
|
||||
$resourcePath = str_replace("{" . "username" . "}",
|
||||
@@ -168,6 +97,7 @@ class UserApi {
|
||||
* getUserByName
|
||||
* Get user by user name
|
||||
* username, string: The name that needs to be fetched. Use user1 for testing. (required)
|
||||
|
||||
* @return User
|
||||
*/
|
||||
|
||||
@@ -179,6 +109,8 @@ class UserApi {
|
||||
$method = "GET";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
|
||||
if($username != null) {
|
||||
$resourcePath = str_replace("{" . "username" . "}",
|
||||
@@ -206,7 +138,9 @@ class UserApi {
|
||||
* loginUser
|
||||
* Logs user into the system
|
||||
* username, string: The user name for login (required)
|
||||
|
||||
* password, string: The password for login in clear text (required)
|
||||
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -218,6 +152,8 @@ class UserApi {
|
||||
$method = "GET";
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$headerParams['Accept'] = 'application/json';
|
||||
$headerParams['Content-Type'] = 'application/json';
|
||||
|
||||
if($username != null) {
|
||||
$queryParams['username'] = $this->apiClient->toQueryValue($username);
|
||||
@@ -257,6 +193,95 @@ class UserApi {
|
||||
$method = "GET";
|
||||
$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);
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* 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
|
||||
if (! isset($body)) {
|
||||
@@ -269,5 +294,6 @@ class UserApi {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -29,13 +29,7 @@ class Category {
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
* Category unique identifier
|
||||
*/
|
||||
public $id; // int
|
||||
/**
|
||||
* Name of the category
|
||||
*/
|
||||
public $name; // string
|
||||
}
|
||||
|
||||
|
||||
@@ -32,25 +32,13 @@ class Order {
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
* Unique identifier for the order
|
||||
*/
|
||||
public $id; // int
|
||||
/**
|
||||
* ID of pet being ordered
|
||||
*/
|
||||
public $petId; // int
|
||||
/**
|
||||
* Number of pets ordered
|
||||
*/
|
||||
public $quantity; // int
|
||||
/**
|
||||
* Status of the order
|
||||
* Order Status
|
||||
*/
|
||||
public $status; // string
|
||||
/**
|
||||
* Date shipped, only if it has been
|
||||
*/
|
||||
public $shipDate; // DateTime
|
||||
}
|
||||
|
||||
|
||||
@@ -34,24 +34,12 @@ class Pet {
|
||||
);
|
||||
|
||||
/**
|
||||
* Unique identifier for the Pet
|
||||
* unique identifier for the pet
|
||||
*/
|
||||
public $id; // int
|
||||
/**
|
||||
* Category the pet is in
|
||||
*/
|
||||
public $category; // Category
|
||||
/**
|
||||
* Friendly name of the pet
|
||||
*/
|
||||
public $name; // string
|
||||
/**
|
||||
* Image URLs
|
||||
*/
|
||||
public $photoUrls; // array[string]
|
||||
/**
|
||||
* Tags assigned to this pet
|
||||
*/
|
||||
public $tags; // array[Tag]
|
||||
/**
|
||||
* pet status in the store
|
||||
|
||||
@@ -29,13 +29,7 @@ class Tag {
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
* Unique identifier for the tag
|
||||
*/
|
||||
public $id; // int
|
||||
/**
|
||||
* Friendly name for the tag
|
||||
*/
|
||||
public $name; // string
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ class User {
|
||||
|
||||
static $swaggerTypes = array(
|
||||
'id' => 'int',
|
||||
'username' => 'string',
|
||||
'firstName' => 'string',
|
||||
'username' => 'string',
|
||||
'lastName' => 'string',
|
||||
'email' => 'string',
|
||||
'password' => 'string',
|
||||
@@ -35,33 +35,12 @@ class User {
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
* Unique identifier for the user
|
||||
*/
|
||||
public $id; // int
|
||||
/**
|
||||
* Unique username
|
||||
*/
|
||||
public $username; // string
|
||||
/**
|
||||
* First name of the user
|
||||
*/
|
||||
public $firstName; // string
|
||||
/**
|
||||
* Last name of the user
|
||||
*/
|
||||
public $username; // string
|
||||
public $lastName; // string
|
||||
/**
|
||||
* Email address of the user
|
||||
*/
|
||||
public $email; // string
|
||||
/**
|
||||
* Password name of the user
|
||||
*/
|
||||
public $password; // string
|
||||
/**
|
||||
* Phone number of the user
|
||||
*/
|
||||
public $phone; // string
|
||||
/**
|
||||
* User Status
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
WordAPI.py
|
||||
Copyright 2012 Wordnik, Inc.
|
||||
Copyright 2014 Wordnik, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -29,12 +29,15 @@ class PetApi(object):
|
||||
self.apiClient = apiClient
|
||||
|
||||
|
||||
|
||||
def getPetById(self, petId, **kwargs):
|
||||
"""Find pet by ID
|
||||
|
||||
Args:
|
||||
petId, long: ID of pet that needs to be fetched (required)
|
||||
|
||||
|
||||
|
||||
Returns: Pet
|
||||
"""
|
||||
|
||||
@@ -69,13 +72,17 @@ class PetApi(object):
|
||||
responseObject = self.apiClient.deserialize(response, 'Pet')
|
||||
return responseObject
|
||||
|
||||
|
||||
|
||||
|
||||
def deletePet(self, petId, **kwargs):
|
||||
"""Deletes a pet
|
||||
|
||||
Args:
|
||||
petId, str: Pet id to delete (required)
|
||||
|
||||
|
||||
|
||||
Returns:
|
||||
"""
|
||||
|
||||
@@ -105,14 +112,19 @@ class PetApi(object):
|
||||
postData, headerParams)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def partialUpdate(self, petId, body, **kwargs):
|
||||
"""partial updates to a pet
|
||||
|
||||
Args:
|
||||
petId, str: ID of pet that needs to be fetched (required)
|
||||
|
||||
body, Pet: Pet object that needs to be added to the store (required)
|
||||
|
||||
|
||||
|
||||
Returns: Array[Pet]
|
||||
"""
|
||||
|
||||
@@ -147,15 +159,21 @@ class PetApi(object):
|
||||
responseObject = self.apiClient.deserialize(response, 'Array[Pet]')
|
||||
return responseObject
|
||||
|
||||
|
||||
|
||||
|
||||
def updatePetWithForm(self, petId, **kwargs):
|
||||
"""Updates a pet in the store with form data
|
||||
|
||||
Args:
|
||||
petId, str: ID of pet that needs to be updated (required)
|
||||
|
||||
name, str: Updated name of the pet (optional)
|
||||
|
||||
status, str: Updated status of the pet (optional)
|
||||
|
||||
|
||||
|
||||
Returns:
|
||||
"""
|
||||
|
||||
@@ -185,14 +203,19 @@ class PetApi(object):
|
||||
postData, headerParams)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def uploadFile(self, **kwargs):
|
||||
"""uploads an image
|
||||
|
||||
Args:
|
||||
additionalMetadata, str: Additional data to pass to server (optional)
|
||||
|
||||
body, File: file to upload (optional)
|
||||
|
||||
|
||||
|
||||
Returns:
|
||||
"""
|
||||
|
||||
@@ -218,13 +241,17 @@ class PetApi(object):
|
||||
postData, headerParams)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def addPet(self, body, **kwargs):
|
||||
"""Add a new pet to the store
|
||||
|
||||
Args:
|
||||
body, Pet: Pet object that needs to be added to the store (required)
|
||||
|
||||
|
||||
|
||||
Returns:
|
||||
"""
|
||||
|
||||
@@ -250,13 +277,17 @@ class PetApi(object):
|
||||
postData, headerParams)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def updatePet(self, body, **kwargs):
|
||||
"""Update an existing pet
|
||||
|
||||
Args:
|
||||
body, Pet: Pet object that needs to be updated in the store (required)
|
||||
|
||||
|
||||
|
||||
Returns:
|
||||
"""
|
||||
|
||||
@@ -282,13 +313,17 @@ class PetApi(object):
|
||||
postData, headerParams)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def findPetsByStatus(self, status= None, **kwargs):
|
||||
"""Finds Pets by status
|
||||
|
||||
Args:
|
||||
status, str: Status values that need to be considered for filter (required)
|
||||
|
||||
|
||||
|
||||
Returns: Array[Pet]
|
||||
"""
|
||||
|
||||
@@ -321,13 +356,17 @@ class PetApi(object):
|
||||
responseObject = self.apiClient.deserialize(response, 'Array[Pet]')
|
||||
return responseObject
|
||||
|
||||
|
||||
|
||||
|
||||
def findPetsByTags(self, tags, **kwargs):
|
||||
"""Finds Pets by tags
|
||||
|
||||
Args:
|
||||
tags, str: Tags to filter by (required)
|
||||
|
||||
|
||||
|
||||
Returns: Array[Pet]
|
||||
"""
|
||||
|
||||
@@ -360,7 +399,11 @@ class PetApi(object):
|
||||
responseObject = self.apiClient.deserialize(response, 'Array[Pet]')
|
||||
return responseObject
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2012 Wordnik, Inc.
|
||||
* Copyright 2014 Wordnik, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
WordAPI.py
|
||||
Copyright 2012 Wordnik, Inc.
|
||||
Copyright 2014 Wordnik, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -29,12 +29,15 @@ class StoreApi(object):
|
||||
self.apiClient = apiClient
|
||||
|
||||
|
||||
|
||||
def getOrderById(self, orderId, **kwargs):
|
||||
"""Find purchase order by ID
|
||||
|
||||
Args:
|
||||
orderId, str: ID of pet that needs to be fetched (required)
|
||||
|
||||
|
||||
|
||||
Returns: Order
|
||||
"""
|
||||
|
||||
@@ -69,13 +72,17 @@ class StoreApi(object):
|
||||
responseObject = self.apiClient.deserialize(response, 'Order')
|
||||
return responseObject
|
||||
|
||||
|
||||
|
||||
|
||||
def deleteOrder(self, orderId, **kwargs):
|
||||
"""Delete purchase order by ID
|
||||
|
||||
Args:
|
||||
orderId, str: ID of the order that needs to be deleted (required)
|
||||
|
||||
|
||||
|
||||
Returns:
|
||||
"""
|
||||
|
||||
@@ -105,13 +112,17 @@ class StoreApi(object):
|
||||
postData, headerParams)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def placeOrder(self, body, **kwargs):
|
||||
"""Place an order for a pet
|
||||
|
||||
Args:
|
||||
body, Order: order placed for purchasing the pet (required)
|
||||
|
||||
|
||||
|
||||
Returns:
|
||||
"""
|
||||
|
||||
@@ -137,7 +148,11 @@ class StoreApi(object):
|
||||
postData, headerParams)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
WordAPI.py
|
||||
Copyright 2012 Wordnik, Inc.
|
||||
Copyright 2014 Wordnik, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -29,109 +29,17 @@ class UserApi(object):
|
||||
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):
|
||||
"""Updated user
|
||||
|
||||
Args:
|
||||
username, str: name that need to be deleted (required)
|
||||
|
||||
body, User: Updated user object (required)
|
||||
|
||||
|
||||
|
||||
Returns:
|
||||
"""
|
||||
|
||||
@@ -161,13 +69,17 @@ class UserApi(object):
|
||||
postData, headerParams)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def deleteUser(self, username, **kwargs):
|
||||
"""Delete user
|
||||
|
||||
Args:
|
||||
username, str: The name that needs to be deleted (required)
|
||||
|
||||
|
||||
|
||||
Returns:
|
||||
"""
|
||||
|
||||
@@ -197,13 +109,17 @@ class UserApi(object):
|
||||
postData, headerParams)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def getUserByName(self, username, **kwargs):
|
||||
"""Get user by user name
|
||||
|
||||
Args:
|
||||
username, str: The name that needs to be fetched. Use user1 for testing. (required)
|
||||
|
||||
|
||||
|
||||
Returns: User
|
||||
"""
|
||||
|
||||
@@ -238,14 +154,19 @@ class UserApi(object):
|
||||
responseObject = self.apiClient.deserialize(response, 'User')
|
||||
return responseObject
|
||||
|
||||
|
||||
|
||||
|
||||
def loginUser(self, username, password, **kwargs):
|
||||
"""Logs user into the system
|
||||
|
||||
Args:
|
||||
username, str: The user name for login (required)
|
||||
|
||||
password, str: The password for login in clear text (required)
|
||||
|
||||
|
||||
|
||||
Returns: str
|
||||
"""
|
||||
|
||||
@@ -280,12 +201,15 @@ class UserApi(object):
|
||||
responseObject = self.apiClient.deserialize(response, 'str')
|
||||
return responseObject
|
||||
|
||||
|
||||
|
||||
|
||||
def logoutUser(self, **kwargs):
|
||||
"""Logs out current logged in user session
|
||||
|
||||
Args:
|
||||
|
||||
|
||||
Returns:
|
||||
"""
|
||||
|
||||
@@ -311,7 +235,119 @@ class UserApi(object):
|
||||
postData, headerParams)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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
|
||||
"""
|
||||
Copyright 2012 Wordnik, Inc.
|
||||
Copyright 2014 Wordnik, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (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
|
||||
#Name of the category
|
||||
self.name = None # str
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Copyright 2012 Wordnik, Inc.
|
||||
Copyright 2014 Wordnik, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (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
|
||||
#ID of pet being ordered
|
||||
self.petId = None # long
|
||||
#Number of pets ordered
|
||||
self.quantity = None # int
|
||||
#Status of the order
|
||||
#Order Status
|
||||
self.status = None # str
|
||||
#Date shipped, only if it has been
|
||||
self.shipDate = None # datetime
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Copyright 2012 Wordnik, Inc.
|
||||
Copyright 2014 Wordnik, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (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
|
||||
#Category the pet is in
|
||||
self.category = None # Category
|
||||
#Friendly name of the pet
|
||||
self.name = None # str
|
||||
#Image URLs
|
||||
self.photoUrls = None # list[str]
|
||||
#Tags assigned to this pet
|
||||
self.tags = None # list[Tag]
|
||||
#pet status in the store
|
||||
self.status = None # str
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Copyright 2012 Wordnik, Inc.
|
||||
Copyright 2014 Wordnik, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (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
|
||||
#Friendly name for the tag
|
||||
self.name = None # str
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Copyright 2012 Wordnik, Inc.
|
||||
Copyright 2014 Wordnik, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -22,8 +22,8 @@ class User:
|
||||
def __init__(self):
|
||||
self.swaggerTypes = {
|
||||
'id': 'long',
|
||||
'username': 'str',
|
||||
'firstName': 'str',
|
||||
'username': 'str',
|
||||
'lastName': 'str',
|
||||
'email': 'str',
|
||||
'password': 'str',
|
||||
@@ -33,19 +33,12 @@ class User:
|
||||
}
|
||||
|
||||
|
||||
#Unique identifier for the user
|
||||
self.id = None # long
|
||||
#Unique username
|
||||
self.username = None # str
|
||||
#First name of the user
|
||||
self.firstName = None # str
|
||||
#Last name of the user
|
||||
self.username = None # str
|
||||
self.lastName = None # str
|
||||
#Email address of the user
|
||||
self.email = None # str
|
||||
#Password name of the user
|
||||
self.password = None # str
|
||||
#Phone number of the user
|
||||
self.phone = None # str
|
||||
#User Status
|
||||
self.userStatus = None # int
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
WordAPI.py
|
||||
Copyright 2012 Wordnik, Inc.
|
||||
Copyright 2014 Wordnik, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -29,12 +29,15 @@ class PetApi(object):
|
||||
self.apiClient = apiClient
|
||||
|
||||
|
||||
|
||||
def getPetById(self, petId, **kwargs):
|
||||
"""Find pet by ID
|
||||
|
||||
Args:
|
||||
petId, int: ID of pet that needs to be fetched (required)
|
||||
|
||||
|
||||
|
||||
Returns: Pet
|
||||
"""
|
||||
|
||||
@@ -69,13 +72,17 @@ class PetApi(object):
|
||||
responseObject = self.apiClient.deserialize(response, 'Pet')
|
||||
return responseObject
|
||||
|
||||
|
||||
|
||||
|
||||
def deletePet(self, petId, **kwargs):
|
||||
"""Deletes a pet
|
||||
|
||||
Args:
|
||||
petId, str: Pet id to delete (required)
|
||||
|
||||
|
||||
|
||||
Returns:
|
||||
"""
|
||||
|
||||
@@ -105,14 +112,19 @@ class PetApi(object):
|
||||
postData, headerParams)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def partialUpdate(self, petId, body, **kwargs):
|
||||
"""partial updates to a pet
|
||||
|
||||
Args:
|
||||
petId, str: ID of pet that needs to be fetched (required)
|
||||
|
||||
body, Pet: Pet object that needs to be added to the store (required)
|
||||
|
||||
|
||||
|
||||
Returns: Array[Pet]
|
||||
"""
|
||||
|
||||
@@ -147,15 +159,21 @@ class PetApi(object):
|
||||
responseObject = self.apiClient.deserialize(response, 'Array[Pet]')
|
||||
return responseObject
|
||||
|
||||
|
||||
|
||||
|
||||
def updatePetWithForm(self, petId, **kwargs):
|
||||
"""Updates a pet in the store with form data
|
||||
|
||||
Args:
|
||||
petId, str: ID of pet that needs to be updated (required)
|
||||
|
||||
name, str: Updated name of the pet (optional)
|
||||
|
||||
status, str: Updated status of the pet (optional)
|
||||
|
||||
|
||||
|
||||
Returns:
|
||||
"""
|
||||
|
||||
@@ -185,14 +203,19 @@ class PetApi(object):
|
||||
postData, headerParams)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def uploadFile(self, **kwargs):
|
||||
"""uploads an image
|
||||
|
||||
Args:
|
||||
additionalMetadata, str: Additional data to pass to server (optional)
|
||||
|
||||
body, File: file to upload (optional)
|
||||
|
||||
|
||||
|
||||
Returns:
|
||||
"""
|
||||
|
||||
@@ -218,13 +241,17 @@ class PetApi(object):
|
||||
postData, headerParams)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def addPet(self, body, **kwargs):
|
||||
"""Add a new pet to the store
|
||||
|
||||
Args:
|
||||
body, Pet: Pet object that needs to be added to the store (required)
|
||||
|
||||
|
||||
|
||||
Returns:
|
||||
"""
|
||||
|
||||
@@ -250,13 +277,17 @@ class PetApi(object):
|
||||
postData, headerParams)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def updatePet(self, body, **kwargs):
|
||||
"""Update an existing pet
|
||||
|
||||
Args:
|
||||
body, Pet: Pet object that needs to be updated in the store (required)
|
||||
|
||||
|
||||
|
||||
Returns:
|
||||
"""
|
||||
|
||||
@@ -282,13 +313,17 @@ class PetApi(object):
|
||||
postData, headerParams)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def findPetsByStatus(self, status= None, **kwargs):
|
||||
"""Finds Pets by status
|
||||
|
||||
Args:
|
||||
status, str: Status values that need to be considered for filter (required)
|
||||
|
||||
|
||||
|
||||
Returns: Array[Pet]
|
||||
"""
|
||||
|
||||
@@ -321,13 +356,17 @@ class PetApi(object):
|
||||
responseObject = self.apiClient.deserialize(response, 'Array[Pet]')
|
||||
return responseObject
|
||||
|
||||
|
||||
|
||||
|
||||
def findPetsByTags(self, tags, **kwargs):
|
||||
"""Finds Pets by tags
|
||||
|
||||
Args:
|
||||
tags, str: Tags to filter by (required)
|
||||
|
||||
|
||||
|
||||
Returns: Array[Pet]
|
||||
"""
|
||||
|
||||
@@ -360,7 +399,11 @@ class PetApi(object):
|
||||
responseObject = self.apiClient.deserialize(response, 'Array[Pet]')
|
||||
return responseObject
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2012 Wordnik, Inc.
|
||||
* Copyright 2014 Wordnik, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
WordAPI.py
|
||||
Copyright 2012 Wordnik, Inc.
|
||||
Copyright 2014 Wordnik, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -29,12 +29,15 @@ class StoreApi(object):
|
||||
self.apiClient = apiClient
|
||||
|
||||
|
||||
|
||||
def getOrderById(self, orderId, **kwargs):
|
||||
"""Find purchase order by ID
|
||||
|
||||
Args:
|
||||
orderId, str: ID of pet that needs to be fetched (required)
|
||||
|
||||
|
||||
|
||||
Returns: Order
|
||||
"""
|
||||
|
||||
@@ -69,13 +72,17 @@ class StoreApi(object):
|
||||
responseObject = self.apiClient.deserialize(response, 'Order')
|
||||
return responseObject
|
||||
|
||||
|
||||
|
||||
|
||||
def deleteOrder(self, orderId, **kwargs):
|
||||
"""Delete purchase order by ID
|
||||
|
||||
Args:
|
||||
orderId, str: ID of the order that needs to be deleted (required)
|
||||
|
||||
|
||||
|
||||
Returns:
|
||||
"""
|
||||
|
||||
@@ -105,13 +112,17 @@ class StoreApi(object):
|
||||
postData, headerParams)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def placeOrder(self, body, **kwargs):
|
||||
"""Place an order for a pet
|
||||
|
||||
Args:
|
||||
body, Order: order placed for purchasing the pet (required)
|
||||
|
||||
|
||||
|
||||
Returns:
|
||||
"""
|
||||
|
||||
@@ -137,7 +148,11 @@ class StoreApi(object):
|
||||
postData, headerParams)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
WordAPI.py
|
||||
Copyright 2012 Wordnik, Inc.
|
||||
Copyright 2014 Wordnik, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -29,109 +29,17 @@ class UserApi(object):
|
||||
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):
|
||||
"""Updated user
|
||||
|
||||
Args:
|
||||
username, str: name that need to be deleted (required)
|
||||
|
||||
body, User: Updated user object (required)
|
||||
|
||||
|
||||
|
||||
Returns:
|
||||
"""
|
||||
|
||||
@@ -161,13 +69,17 @@ class UserApi(object):
|
||||
postData, headerParams)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def deleteUser(self, username, **kwargs):
|
||||
"""Delete user
|
||||
|
||||
Args:
|
||||
username, str: The name that needs to be deleted (required)
|
||||
|
||||
|
||||
|
||||
Returns:
|
||||
"""
|
||||
|
||||
@@ -197,13 +109,17 @@ class UserApi(object):
|
||||
postData, headerParams)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def getUserByName(self, username, **kwargs):
|
||||
"""Get user by user name
|
||||
|
||||
Args:
|
||||
username, str: The name that needs to be fetched. Use user1 for testing. (required)
|
||||
|
||||
|
||||
|
||||
Returns: User
|
||||
"""
|
||||
|
||||
@@ -238,14 +154,19 @@ class UserApi(object):
|
||||
responseObject = self.apiClient.deserialize(response, 'User')
|
||||
return responseObject
|
||||
|
||||
|
||||
|
||||
|
||||
def loginUser(self, username, password, **kwargs):
|
||||
"""Logs user into the system
|
||||
|
||||
Args:
|
||||
username, str: The user name for login (required)
|
||||
|
||||
password, str: The password for login in clear text (required)
|
||||
|
||||
|
||||
|
||||
Returns: str
|
||||
"""
|
||||
|
||||
@@ -280,12 +201,15 @@ class UserApi(object):
|
||||
responseObject = self.apiClient.deserialize(response, 'str')
|
||||
return responseObject
|
||||
|
||||
|
||||
|
||||
|
||||
def logoutUser(self, **kwargs):
|
||||
"""Logs out current logged in user session
|
||||
|
||||
Args:
|
||||
|
||||
|
||||
Returns:
|
||||
"""
|
||||
|
||||
@@ -311,7 +235,119 @@ class UserApi(object):
|
||||
postData, headerParams)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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