forked from loafle/openapi-generator-original
Remove security tests from the master branch (#2433)
* remove security tests as these will be test in branch instead * remove openapi3 security script
This commit is contained in:
parent
82700e5958
commit
ed30e85d1e
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1,7 +1,7 @@
|
|||||||
### PR checklist
|
### PR checklist
|
||||||
|
|
||||||
- [ ] Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md).
|
- [ ] Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md).
|
||||||
- [ ] Ran the shell script under `./bin/` to update Petstore sample so that CIs can verify the change. (For instance, only need to run `./bin/{LANG}-petstore.sh`, `./bin/openapi3/{LANG}-petstore.sh`, `./bin/security/{LANG}-petstore.sh` and `./bin/openapi3/security/{LANG}-petstore.sh` if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in `.\bin\windows\`.
|
- [ ] Ran the shell script under `./bin/` to update Petstore sample so that CIs can verify the change. (For instance, only need to run `./bin/{LANG}-petstore.sh`, `./bin/openapi3/{LANG}-petstore.sh` if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in `.\bin\windows\`.
|
||||||
- [ ] Filed the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`~~, `3.4.x`, `4.0.x`~~. Default: `master`.
|
- [ ] Filed the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`~~, `3.4.x`, `4.0.x`~~. Default: `master`.
|
||||||
- [ ] Copied the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) to review the pull request if your PR is targeting a particular programming language.
|
- [ ] Copied the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) to review the pull request if your PR is targeting a particular programming language.
|
||||||
|
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# cleanup tests
|
|
||||||
TEST_DIR="./samples/client/petstore-security-test/php/OpenAPIToolsClient-php/test"
|
|
||||||
if [ -d $TEST_DIR ]; then
|
|
||||||
rm -rf $TEST_DIR
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -t modules/openapi-generator/src/main/resources/php -i modules/openapi-generator/src/test/resources/3_0/petstore-security-test.yaml -g php -o samples/openapi3/client/petstore-security-test/php/OpenAPIClient-php $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,10 +0,0 @@
|
|||||||
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
|
||||||
|
|
||||||
If Not Exist %executable% (
|
|
||||||
mvn clean package
|
|
||||||
)
|
|
||||||
|
|
||||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
|
||||||
set ags=generate -i modules\openapi-generator\src\test\resources\3_0\petstore-security-test.yaml -g php -o samples\openapi3\client\petstore-security-test\php\OpenAPIClient-php
|
|
||||||
|
|
||||||
java %JAVA_OPTS% -jar %executable% %ags%
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -t modules/openapi-generator/src/main/resources/cpp-qt5-client -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g cpp-qt5-client -o samples/client/petstore-security-test/cpp-qt5 $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g csharp -o samples/client/petstore-security-test/csharp/SwaggerClient --additional-properties packageGuid={8CE139DF-64BC-4591-85F8-8506C2B67514} $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,39 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
SPEC="modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml"
|
|
||||||
GENERATOR="go"
|
|
||||||
STUB_DIR="samples/client/petstore-security-test/go"
|
|
||||||
|
|
||||||
echo "Removing files and folders under $STUB_DIR"
|
|
||||||
rm -rf $STUB_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"
|
|
||||||
ags="generate -t modules/openapi-generator/src/main/resources/go -i $SPEC -g $GENERATOR -o $STUB_DIR $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,34 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -t modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore-security-test/java/okhttp-gson -DhideGenerationTimestamp=true $@"
|
|
||||||
|
|
||||||
rm -rf samples/client/petstore-security-test/java/okhttp-gson/src/main
|
|
||||||
find samples/client/petstore-security-test/java/okhttp-gson -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g javascript-closure-angular -o samples/client/petstore-security-test/javascript-closure-angular $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -t modules/openapi-generator/src/main/resources/Javascript -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g javascript -o samples/client/petstore-security-test/javascript -DappName=PetstoreClient $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -t modules/openapi-generator/src/main/resources/lumen -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g php-lumen -o samples/server/petstore-security-test/lumen $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -t modules/openapi-generator/src/main/resources/mysql-schema -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g mysql-schema -o samples/schema/petstore-security-test/mysql $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -t modules/openapi-generator/src/main/resources/objc -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g objc -o samples/client/petstore-security-test/objc $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,35 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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"
|
|
||||||
# complex module name used for testing
|
|
||||||
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g perl -o samples/client/petstore-security-test/perl $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags --additional-properties moduleName=Something::Deep -o samples/client/petstore-security-test/perl/deep_module_test
|
|
@ -1,38 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# cleanup tests
|
|
||||||
TEST_DIR="./samples/client/petstore-security-test/php/OpenAPIToolsClient-php/test"
|
|
||||||
if [ -d $TEST_DIR ]; then
|
|
||||||
rm -rf $TEST_DIR
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -t modules/openapi-generator/src/main/resources/php -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g php -o samples/client/petstore-security-test/php/OpenAPIClient-php $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -t modules/openapi-generator/src/main/resources/php-slim-server -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g php-slim -o samples/server/petstore-security-test/php-slim $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g python -o samples/client/petstore-security-test/python -DpackageName=petstore_api $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -t modules/openapi-generator/src/main/resources/ruby-client -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g ruby -c bin/ruby-petstore.json -o samples/client/petstore-security-test/ruby $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,15 +0,0 @@
|
|||||||
#!/bin/bash -e
|
|
||||||
|
|
||||||
for SCRIPT in ./bin/security/*.sh
|
|
||||||
do
|
|
||||||
if [ -f $SCRIPT -a -x $SCRIPT ]
|
|
||||||
then
|
|
||||||
$SCRIPT
|
|
||||||
rc=$?
|
|
||||||
if [[ $rc != 0 ]]
|
|
||||||
then
|
|
||||||
echo "ERROR!! FAILED TO RUN $SCRIPT"
|
|
||||||
exit $rc;
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -t modules/openapi-generator/src/main/resources/scala-httpclient -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g scala-httpclient -o samples/client/petstore-security-test/scala-httpclient $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -t modules/openapi-generator/src/main/resources/php-silex -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g php-silex -o samples/server/petstore-security-test/silex/SwaggerServer $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -t modules/openapi-generator/src/main/resources/swift -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g swift2-deprecated -o samples/client/petstore-security-test/swift $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -t modules/openapi-generator/src/main/resources/typescript-angular -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g typescript-angular -o samples/client/petstore-security-test/typescript-angular $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g typescript-angular -o samples/client/petstore-security-test/typescript-angular2 $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -t modules/openapi-generator/src/main/resources/typescript-fetch -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g typescript-fetch -o samples/client/petstore-security-test/typescript-fetch $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -t modules/openapi-generator/src/main/resources/typescript-inversify -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g typescript-inversify -o samples/client/petstore-security-test/typescript-inversify $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,37 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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"
|
|
||||||
|
|
||||||
echo "Typescript jquery Petstore API client (default setting)"
|
|
||||||
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g typescript-jquery -o samples/client/petstore-security-test/typescript-jquery/default $@"
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
||||||
|
|
||||||
echo "Typescript jquery Petstore API client with npm setting"
|
|
||||||
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g typescript-jquery -c bin/typescript-petstore-npm.json -o samples/client/petstore-security-test/typescript-jquery/npm $@"
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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="generate -t modules/openapi-generator/src/main/resources/typescript-node -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g typescript-node -o samples/client/petstore-security-test/typescript-node $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -1,10 +0,0 @@
|
|||||||
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
|
||||||
|
|
||||||
If Not Exist %executable% (
|
|
||||||
mvn clean package
|
|
||||||
)
|
|
||||||
|
|
||||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
|
||||||
set ags=generate -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g csharp -o samples/client/petstore-security-test/csharp/SwaggerClient --additional-properties packageGuid={8CE139DF-64BC-4591-85F8-8506C2B67514}
|
|
||||||
|
|
||||||
java %JAVA_OPTS% -jar %executable% %ags%
|
|
@ -1,10 +0,0 @@
|
|||||||
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
|
||||||
|
|
||||||
If Not Exist %executable% (
|
|
||||||
mvn clean package
|
|
||||||
)
|
|
||||||
|
|
||||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
|
||||||
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-security-test.yaml -g php -o samples\client\petstore-security-test\php\OpenAPIClient-php
|
|
||||||
|
|
||||||
java %JAVA_OPTS% -jar %executable% %ags%
|
|
@ -1,10 +0,0 @@
|
|||||||
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
|
||||||
|
|
||||||
If Not Exist %executable% (
|
|
||||||
mvn clean package
|
|
||||||
)
|
|
||||||
|
|
||||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
|
||||||
set ags=generate -t modules/openapi-generator/src/main/resources/cpp-qt5-client -i modules\openapi-generator\src\test\resources\2_0\petstore-security-test.yaml -g qt5cpp -o samples\client\petstore-security-test\qt5cpp
|
|
||||||
|
|
||||||
java %JAVA_OPTS% -jar %executable% %ags%
|
|
@ -1,23 +0,0 @@
|
|||||||
# Swagger Codegen Ignore
|
|
||||||
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
|
||||||
|
|
||||||
# Use this file to prevent files from being overwritten by the generator.
|
|
||||||
# The patterns follow closely to .gitignore or .dockerignore.
|
|
||||||
|
|
||||||
# As an example, the C# client generator defines ApiClient.cs.
|
|
||||||
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
|
||||||
#ApiClient.cs
|
|
||||||
|
|
||||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
|
||||||
#foo/*/qux
|
|
||||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
|
||||||
#foo/**/qux
|
|
||||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can also negate patterns with an exclamation (!).
|
|
||||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
|
||||||
#docs/*.md
|
|
||||||
# Then explicitly reverse the ignore rule for a single file:
|
|
||||||
#!docs/README.md
|
|
@ -1 +0,0 @@
|
|||||||
2.3.0-SNAPSHOT
|
|
@ -1,201 +0,0 @@
|
|||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright {yyyy} {name of copyright owner}
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
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.
|
|
@ -1,84 +0,0 @@
|
|||||||
/**
|
|
||||||
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "SWGFakeApi.h"
|
|
||||||
#include "SWGHelpers.h"
|
|
||||||
#include "SWGModelFactory.h"
|
|
||||||
|
|
||||||
#include <QJsonArray>
|
|
||||||
#include <QJsonDocument>
|
|
||||||
|
|
||||||
namespace Swagger {
|
|
||||||
|
|
||||||
SWGFakeApi::SWGFakeApi() {}
|
|
||||||
|
|
||||||
SWGFakeApi::~SWGFakeApi() {}
|
|
||||||
|
|
||||||
SWGFakeApi::SWGFakeApi(QString host, QString basePath) {
|
|
||||||
this->host = host;
|
|
||||||
this->basePath = basePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
SWGFakeApi::testCodeInject____end__rn_n_r(QString* test_code_inject____end____rn_n_r) {
|
|
||||||
QString fullPath;
|
|
||||||
fullPath.append(this->host).append(this->basePath).append("/fake");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
|
||||||
HttpRequestInput input(fullPath, "PUT");
|
|
||||||
|
|
||||||
if (test_code_inject____end____rn_n_r != nullptr) {
|
|
||||||
input.add_var("test code inject */ ' " =end -- \r\n \n \r", *test_code_inject____end____rn_n_r);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
foreach(QString key, this->defaultHeaders.keys()) {
|
|
||||||
input.headers.insert(key, this->defaultHeaders.value(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(worker,
|
|
||||||
&HttpRequestWorker::on_execution_finished,
|
|
||||||
this,
|
|
||||||
&SWGFakeApi::testCodeInject____end__rn_n_rCallback);
|
|
||||||
|
|
||||||
worker->execute(&input);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
SWGFakeApi::testCodeInject____end__rn_n_rCallback(HttpRequestWorker * worker) {
|
|
||||||
QString msg;
|
|
||||||
QString error_str = worker->error_str;
|
|
||||||
QNetworkReply::NetworkError error_type = worker->error_type;
|
|
||||||
|
|
||||||
if (worker->error_type == QNetworkReply::NoError) {
|
|
||||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
msg = "Error: " + worker->error_str;
|
|
||||||
}
|
|
||||||
|
|
||||||
worker->deleteLater();
|
|
||||||
|
|
||||||
if (worker->error_type == QNetworkReply::NoError) {
|
|
||||||
emit testCodeInject____end__rn_n_rSignal();
|
|
||||||
} else {
|
|
||||||
emit testCodeInject____end__rn_n_rSignalE(error_type, error_str);
|
|
||||||
emit testCodeInject____end__rn_n_rSignalEFull(worker, error_type, error_str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
/**
|
|
||||||
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SWG_SWGFakeApi_H_
|
|
||||||
#define _SWG_SWGFakeApi_H_
|
|
||||||
|
|
||||||
#include "SWGHttpRequest.h"
|
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
namespace Swagger {
|
|
||||||
|
|
||||||
class SWGFakeApi: public QObject {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
SWGFakeApi();
|
|
||||||
SWGFakeApi(QString host, QString basePath);
|
|
||||||
~SWGFakeApi();
|
|
||||||
|
|
||||||
QString host;
|
|
||||||
QString basePath;
|
|
||||||
QMap<QString, QString> defaultHeaders;
|
|
||||||
|
|
||||||
void testCodeInject____end__rn_n_r(QString* test_code_inject____end____rn_n_r);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void testCodeInject____end__rn_n_rCallback (HttpRequestWorker * worker);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void testCodeInject____end__rn_n_rSignal();
|
|
||||||
|
|
||||||
void testCodeInject____end__rn_n_rSignalE(QNetworkReply::NetworkError error_type, QString& error_str);
|
|
||||||
|
|
||||||
void testCodeInject____end__rn_n_rSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
@ -1,295 +0,0 @@
|
|||||||
/**
|
|
||||||
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "SWGHelpers.h"
|
|
||||||
#include "SWGModelFactory.h"
|
|
||||||
#include "SWGObject.h"
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QJsonArray>
|
|
||||||
#include <QJsonValue>
|
|
||||||
#include <QDateTime>
|
|
||||||
|
|
||||||
|
|
||||||
namespace Swagger {
|
|
||||||
|
|
||||||
void
|
|
||||||
setValue(void* value, QJsonValue obj, QString type, QString complexType) {
|
|
||||||
if(value == nullptr) {
|
|
||||||
// can't set value with a null pointer
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(QStringLiteral("bool").compare(type) == 0) {
|
|
||||||
bool * val = static_cast<bool*>(value);
|
|
||||||
*val = obj.toBool();
|
|
||||||
}
|
|
||||||
else if(QStringLiteral("qint32").compare(type) == 0) {
|
|
||||||
qint32 *val = static_cast<qint32*>(value);
|
|
||||||
*val = obj.toInt();
|
|
||||||
}
|
|
||||||
else if(QStringLiteral("qint64").compare(type) == 0) {
|
|
||||||
qint64 *val = static_cast<qint64*>(value);
|
|
||||||
*val = obj.toVariant().toLongLong();
|
|
||||||
}
|
|
||||||
else if(QStringLiteral("float").compare(type) == 0) {
|
|
||||||
float *val = static_cast<float*>(value);
|
|
||||||
*val = obj.toDouble();
|
|
||||||
}
|
|
||||||
else if(QStringLiteral("double").compare(type) == 0) {
|
|
||||||
double *val = static_cast<double*>(value);
|
|
||||||
*val = obj.toDouble();
|
|
||||||
}
|
|
||||||
else if (QStringLiteral("QString").compare(type) == 0) {
|
|
||||||
QString **val = static_cast<QString**>(value);
|
|
||||||
|
|
||||||
if(val != nullptr) {
|
|
||||||
if(!obj.isNull()) {
|
|
||||||
// create a new value and return
|
|
||||||
delete *val;
|
|
||||||
*val = new QString(obj.toString());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// set target to nullptr
|
|
||||||
delete *val;
|
|
||||||
*val = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
qDebug() << "Can't set value because the target pointer is nullptr";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (QStringLiteral("QDateTime").compare(type) == 0) {
|
|
||||||
QDateTime **val = static_cast<QDateTime**>(value);
|
|
||||||
|
|
||||||
if(val != nullptr) {
|
|
||||||
if(!obj.isNull()) {
|
|
||||||
// create a new value and return
|
|
||||||
delete *val;
|
|
||||||
*val = new QDateTime(QDateTime::fromString(obj.toString(), Qt::ISODate));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// set target to nullptr
|
|
||||||
delete *val;
|
|
||||||
*val = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
qDebug() << "Can't set value because the target pointer is nullptr";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (QStringLiteral("QDate").compare(type) == 0) {
|
|
||||||
QDate **val = static_cast<QDate**>(value);
|
|
||||||
|
|
||||||
if(val != nullptr) {
|
|
||||||
if(!obj.isNull()) {
|
|
||||||
// create a new value and return
|
|
||||||
delete *val;
|
|
||||||
*val = new QDate(QDate::fromString(obj.toString(), Qt::ISODate));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// set target to nullptr
|
|
||||||
delete *val;
|
|
||||||
*val = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
qDebug() << "Can't set value because the target pointer is nullptr";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (QStringLiteral("QByteArray").compare(type) == 0) {
|
|
||||||
QByteArray **val = static_cast<QByteArray**>(value);
|
|
||||||
|
|
||||||
if(val != nullptr) {
|
|
||||||
if(!obj.isNull()) {
|
|
||||||
// create a new value and return
|
|
||||||
delete *val;
|
|
||||||
|
|
||||||
*val = new QByteArray(QByteArray::fromBase64(QByteArray::fromStdString(obj.toString().toStdString())));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// set target to nullptr
|
|
||||||
delete *val;
|
|
||||||
*val = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
qDebug() << "Can't set value because the target pointer is nullptr";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(type.startsWith("SWG") && obj.isObject()) {
|
|
||||||
// complex type
|
|
||||||
QJsonObject jsonObj = obj.toObject();
|
|
||||||
SWGObject * so = (SWGObject*)::Swagger::create(type);
|
|
||||||
if(so != nullptr) {
|
|
||||||
so->fromJsonObject(jsonObj);
|
|
||||||
SWGObject **val = static_cast<SWGObject**>(value);
|
|
||||||
delete *val;
|
|
||||||
*val = so;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(type.startsWith("QList") && QString("").compare(complexType) != 0 && obj.isArray()) {
|
|
||||||
// list of values
|
|
||||||
QList<void*>* output = new QList<void*>();
|
|
||||||
QJsonArray arr = obj.toArray();
|
|
||||||
foreach (const QJsonValue & jval, arr) {
|
|
||||||
if(complexType.startsWith("SWG")) {
|
|
||||||
// it's an object
|
|
||||||
SWGObject * val = (SWGObject*)create(complexType);
|
|
||||||
QJsonObject t = jval.toObject();
|
|
||||||
|
|
||||||
val->fromJsonObject(t);
|
|
||||||
output->append(val);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// primitives
|
|
||||||
if(QStringLiteral("qint32").compare(complexType) == 0) {
|
|
||||||
qint32 val;
|
|
||||||
setValue(&val, jval, QStringLiteral("qint32"), QStringLiteral(""));
|
|
||||||
output->append((void*)&val);
|
|
||||||
}
|
|
||||||
else if(QStringLiteral("qint64").compare(complexType) == 0) {
|
|
||||||
qint64 val;
|
|
||||||
setValue(&val, jval, QStringLiteral("qint64"), QStringLiteral(""));
|
|
||||||
output->append((void*)&val);
|
|
||||||
}
|
|
||||||
else if(QStringLiteral("bool").compare(complexType) == 0) {
|
|
||||||
bool val;
|
|
||||||
setValue(&val, jval, QStringLiteral("bool"), QStringLiteral(""));
|
|
||||||
output->append((void*)&val);
|
|
||||||
}
|
|
||||||
else if(QStringLiteral("float").compare(complexType) == 0) {
|
|
||||||
float val;
|
|
||||||
setValue(&val, jval, QStringLiteral("float"), QStringLiteral(""));
|
|
||||||
output->append((void*)&val);
|
|
||||||
}
|
|
||||||
else if(QStringLiteral("double").compare(complexType) == 0) {
|
|
||||||
double val;
|
|
||||||
setValue(&val, jval, QStringLiteral("double"), QStringLiteral(""));
|
|
||||||
output->append((void*)&val);
|
|
||||||
}
|
|
||||||
else if(QStringLiteral("QString").compare(complexType) == 0) {
|
|
||||||
QString * val = new QString();
|
|
||||||
setValue(&val, jval, QStringLiteral("QString"), QStringLiteral(""));
|
|
||||||
output->append((void*)val);
|
|
||||||
}
|
|
||||||
else if(QStringLiteral("QDate").compare(complexType) == 0) {
|
|
||||||
QDate * val = new QDate();
|
|
||||||
setValue(&val, jval, QStringLiteral("QDate"), QStringLiteral(""));
|
|
||||||
output->append((void*)val);
|
|
||||||
}
|
|
||||||
else if(QStringLiteral("QDateTime").compare(complexType) == 0) {
|
|
||||||
QDateTime * val = new QDateTime();
|
|
||||||
setValue(&val, jval, QStringLiteral("QDateTime"), QStringLiteral(""));
|
|
||||||
output->append((void*)val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
QList<void*> **val = static_cast<QList<void*>**>(value);
|
|
||||||
delete *val;
|
|
||||||
*val = output;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
toJsonValue(QString name, void* value, QJsonObject* output, QString type) {
|
|
||||||
if(value == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(type.startsWith("SWG")) {
|
|
||||||
SWGObject *swgObject = reinterpret_cast<SWGObject *>(value);
|
|
||||||
if(swgObject != nullptr) {
|
|
||||||
QJsonObject* o = (*swgObject).asJsonObject();
|
|
||||||
if(name != nullptr) {
|
|
||||||
output->insert(name, *o);
|
|
||||||
delete o;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
output->empty();
|
|
||||||
foreach(QString key, o->keys()) {
|
|
||||||
output->insert(key, o->value(key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(QStringLiteral("QString").compare(type) == 0) {
|
|
||||||
QString* str = static_cast<QString*>(value);
|
|
||||||
output->insert(name, QJsonValue(*str));
|
|
||||||
}
|
|
||||||
else if(QStringLiteral("qint32").compare(type) == 0) {
|
|
||||||
qint32* str = static_cast<qint32*>(value);
|
|
||||||
output->insert(name, QJsonValue(*str));
|
|
||||||
}
|
|
||||||
else if(QStringLiteral("qint64").compare(type) == 0) {
|
|
||||||
qint64* str = static_cast<qint64*>(value);
|
|
||||||
output->insert(name, QJsonValue(*str));
|
|
||||||
}
|
|
||||||
else if(QStringLiteral("bool").compare(type) == 0) {
|
|
||||||
bool* str = static_cast<bool*>(value);
|
|
||||||
output->insert(name, QJsonValue(*str));
|
|
||||||
}
|
|
||||||
else if(QStringLiteral("float").compare(type) == 0) {
|
|
||||||
float* str = static_cast<float*>(value);
|
|
||||||
output->insert(name, QJsonValue((double)*str));
|
|
||||||
}
|
|
||||||
else if(QStringLiteral("double").compare(type) == 0) {
|
|
||||||
double* str = static_cast<double*>(value);
|
|
||||||
output->insert(name, QJsonValue(*str));
|
|
||||||
}
|
|
||||||
else if(QStringLiteral("QDate").compare(type) == 0) {
|
|
||||||
QDate* date = static_cast<QDate*>(value);
|
|
||||||
output->insert(name, QJsonValue(date->toString(Qt::ISODate)));
|
|
||||||
}
|
|
||||||
else if(QStringLiteral("QDateTime").compare(type) == 0) {
|
|
||||||
QDateTime* datetime = static_cast<QDateTime*>(value);
|
|
||||||
output->insert(name, QJsonValue(datetime->toString(Qt::ISODate)));
|
|
||||||
}
|
|
||||||
else if(QStringLiteral("QByteArray").compare(type) == 0) {
|
|
||||||
QByteArray* byteArray = static_cast<QByteArray*>(value);
|
|
||||||
output->insert(name, QJsonValue(QString(byteArray->toBase64())));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
toJsonArray(QList<void*>* value, QJsonArray* output, QString innerName, QString innerType) {
|
|
||||||
foreach(void* obj, *value) {
|
|
||||||
QJsonObject element;
|
|
||||||
|
|
||||||
toJsonValue(nullptr, obj, &element, innerType);
|
|
||||||
output->append(element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString
|
|
||||||
stringValue(QString* value) {
|
|
||||||
QString* str = static_cast<QString*>(value);
|
|
||||||
return QString(*str);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString
|
|
||||||
stringValue(qint32 value) {
|
|
||||||
return QString::number(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString
|
|
||||||
stringValue(qint64 value) {
|
|
||||||
return QString::number(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString
|
|
||||||
stringValue(bool value) {
|
|
||||||
return QString(value ? "true" : "false");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
/**
|
|
||||||
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SWGHELPERS_H
|
|
||||||
#define SWGHELPERS_H
|
|
||||||
|
|
||||||
#include <QJsonValue>
|
|
||||||
|
|
||||||
namespace Swagger {
|
|
||||||
|
|
||||||
void setValue(void* value, QJsonValue obj, QString type, QString complexType);
|
|
||||||
void toJsonArray(QList<void*>* value, QJsonArray* output, QString innerName, QString innerType);
|
|
||||||
void toJsonValue(QString name, void* value, QJsonObject* output, QString type);
|
|
||||||
bool isCompatibleJsonValue(QString type);
|
|
||||||
QString stringValue(QString* value);
|
|
||||||
QString stringValue(qint32 value);
|
|
||||||
QString stringValue(qint64 value);
|
|
||||||
QString stringValue(bool value);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // SWGHELPERS_H
|
|
@ -1,325 +0,0 @@
|
|||||||
/**
|
|
||||||
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "SWGHttpRequest.h"
|
|
||||||
#include <QDateTime>
|
|
||||||
#include <QUrl>
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QBuffer>
|
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
|
|
||||||
namespace Swagger {
|
|
||||||
|
|
||||||
HttpRequestInput::HttpRequestInput() {
|
|
||||||
initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
HttpRequestInput::HttpRequestInput(QString v_url_str, QString v_http_method) {
|
|
||||||
initialize();
|
|
||||||
url_str = v_url_str;
|
|
||||||
http_method = v_http_method;
|
|
||||||
}
|
|
||||||
|
|
||||||
void HttpRequestInput::initialize() {
|
|
||||||
var_layout = NOT_SET;
|
|
||||||
url_str = "";
|
|
||||||
http_method = "GET";
|
|
||||||
}
|
|
||||||
|
|
||||||
void HttpRequestInput::add_var(QString key, QString value) {
|
|
||||||
vars[key] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void HttpRequestInput::add_file(QString variable_name, QString local_filename, QString request_filename, QString mime_type) {
|
|
||||||
SWGHttpRequestInputFileElement file;
|
|
||||||
file.variable_name = variable_name;
|
|
||||||
file.local_filename = local_filename;
|
|
||||||
file.request_filename = request_filename;
|
|
||||||
file.mime_type = mime_type;
|
|
||||||
files.append(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
HttpRequestWorker::HttpRequestWorker(QObject *parent)
|
|
||||||
: QObject(parent), manager(nullptr)
|
|
||||||
{
|
|
||||||
qsrand(QDateTime::currentDateTime().toTime_t());
|
|
||||||
|
|
||||||
manager = new QNetworkAccessManager(this);
|
|
||||||
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(on_manager_finished(QNetworkReply*)));
|
|
||||||
}
|
|
||||||
|
|
||||||
HttpRequestWorker::~HttpRequestWorker() {
|
|
||||||
}
|
|
||||||
|
|
||||||
QString HttpRequestWorker::http_attribute_encode(QString attribute_name, QString input) {
|
|
||||||
// result structure follows RFC 5987
|
|
||||||
bool need_utf_encoding = false;
|
|
||||||
QString result = "";
|
|
||||||
QByteArray input_c = input.toLocal8Bit();
|
|
||||||
char c;
|
|
||||||
for (int i = 0; i < input_c.length(); i++) {
|
|
||||||
c = input_c.at(i);
|
|
||||||
if (c == '\\' || c == '/' || c == '\0' || c < ' ' || c > '~') {
|
|
||||||
// ignore and request utf-8 version
|
|
||||||
need_utf_encoding = true;
|
|
||||||
}
|
|
||||||
else if (c == '"') {
|
|
||||||
result += "\\\"";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
result += c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.length() == 0) {
|
|
||||||
need_utf_encoding = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!need_utf_encoding) {
|
|
||||||
// return simple version
|
|
||||||
return QString("%1=\"%2\"").arg(attribute_name, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString result_utf8 = "";
|
|
||||||
for (int i = 0; i < input_c.length(); i++) {
|
|
||||||
c = input_c.at(i);
|
|
||||||
if (
|
|
||||||
(c >= '0' && c <= '9')
|
|
||||||
|| (c >= 'A' && c <= 'Z')
|
|
||||||
|| (c >= 'a' && c <= 'z')
|
|
||||||
) {
|
|
||||||
result_utf8 += c;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
result_utf8 += "%" + QString::number(static_cast<unsigned char>(input_c.at(i)), 16).toUpper();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// return enhanced version with UTF-8 support
|
|
||||||
return QString("%1=\"%2\"; %1*=utf-8''%3").arg(attribute_name, result, result_utf8);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HttpRequestWorker::execute(HttpRequestInput *input) {
|
|
||||||
|
|
||||||
// reset variables
|
|
||||||
|
|
||||||
QByteArray request_content = "";
|
|
||||||
response = "";
|
|
||||||
error_type = QNetworkReply::NoError;
|
|
||||||
error_str = "";
|
|
||||||
bool isFormData = false;
|
|
||||||
|
|
||||||
|
|
||||||
// decide on the variable layout
|
|
||||||
|
|
||||||
if (input->files.length() > 0) {
|
|
||||||
input->var_layout = MULTIPART;
|
|
||||||
}
|
|
||||||
if (input->var_layout == NOT_SET) {
|
|
||||||
input->var_layout = input->http_method == "GET" || input->http_method == "HEAD" ? ADDRESS : URL_ENCODED;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// prepare request content
|
|
||||||
|
|
||||||
QString boundary = "";
|
|
||||||
|
|
||||||
if (input->var_layout == ADDRESS || input->var_layout == URL_ENCODED) {
|
|
||||||
// variable layout is ADDRESS or URL_ENCODED
|
|
||||||
|
|
||||||
if (input->vars.count() > 0) {
|
|
||||||
bool first = true;
|
|
||||||
isFormData = true;
|
|
||||||
foreach (QString key, input->vars.keys()) {
|
|
||||||
if (!first) {
|
|
||||||
request_content.append("&");
|
|
||||||
}
|
|
||||||
first = false;
|
|
||||||
|
|
||||||
request_content.append(QUrl::toPercentEncoding(key));
|
|
||||||
request_content.append("=");
|
|
||||||
request_content.append(QUrl::toPercentEncoding(input->vars.value(key)));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (input->var_layout == ADDRESS) {
|
|
||||||
input->url_str += "?" + request_content;
|
|
||||||
request_content = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// variable layout is MULTIPART
|
|
||||||
|
|
||||||
boundary = "__-----------------------"
|
|
||||||
+ QString::number(QDateTime::currentDateTime().toTime_t())
|
|
||||||
+ QString::number(qrand());
|
|
||||||
QString boundary_delimiter = "--";
|
|
||||||
QString new_line = "\r\n";
|
|
||||||
|
|
||||||
// add variables
|
|
||||||
foreach (QString key, input->vars.keys()) {
|
|
||||||
// add boundary
|
|
||||||
request_content.append(boundary_delimiter);
|
|
||||||
request_content.append(boundary);
|
|
||||||
request_content.append(new_line);
|
|
||||||
|
|
||||||
// add header
|
|
||||||
request_content.append("Content-Disposition: form-data; ");
|
|
||||||
request_content.append(http_attribute_encode("name", key));
|
|
||||||
request_content.append(new_line);
|
|
||||||
request_content.append("Content-Type: text/plain");
|
|
||||||
request_content.append(new_line);
|
|
||||||
|
|
||||||
// add header to body splitter
|
|
||||||
request_content.append(new_line);
|
|
||||||
|
|
||||||
// add variable content
|
|
||||||
request_content.append(input->vars.value(key));
|
|
||||||
request_content.append(new_line);
|
|
||||||
}
|
|
||||||
|
|
||||||
// add files
|
|
||||||
for (QList<SWGHttpRequestInputFileElement>::iterator file_info = input->files.begin(); file_info != input->files.end(); file_info++) {
|
|
||||||
QFileInfo fi(file_info->local_filename);
|
|
||||||
|
|
||||||
// ensure necessary variables are available
|
|
||||||
if (
|
|
||||||
file_info->local_filename == nullptr || file_info->local_filename.isEmpty()
|
|
||||||
|| file_info->variable_name == nullptr || file_info->variable_name.isEmpty()
|
|
||||||
|| !fi.exists() || !fi.isFile() || !fi.isReadable()
|
|
||||||
) {
|
|
||||||
// silent abort for the current file
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
QFile file(file_info->local_filename);
|
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
|
||||||
// silent abort for the current file
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ensure filename for the request
|
|
||||||
if (file_info->request_filename == nullptr || file_info->request_filename.isEmpty()) {
|
|
||||||
file_info->request_filename = fi.fileName();
|
|
||||||
if (file_info->request_filename.isEmpty()) {
|
|
||||||
file_info->request_filename = "file";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// add boundary
|
|
||||||
request_content.append(boundary_delimiter);
|
|
||||||
request_content.append(boundary);
|
|
||||||
request_content.append(new_line);
|
|
||||||
|
|
||||||
// add header
|
|
||||||
request_content.append(QString("Content-Disposition: form-data; %1; %2").arg(
|
|
||||||
http_attribute_encode("name", file_info->variable_name),
|
|
||||||
http_attribute_encode("filename", file_info->request_filename)
|
|
||||||
));
|
|
||||||
request_content.append(new_line);
|
|
||||||
|
|
||||||
if (file_info->mime_type != nullptr && !file_info->mime_type.isEmpty()) {
|
|
||||||
request_content.append("Content-Type: ");
|
|
||||||
request_content.append(file_info->mime_type);
|
|
||||||
request_content.append(new_line);
|
|
||||||
}
|
|
||||||
|
|
||||||
request_content.append("Content-Transfer-Encoding: binary");
|
|
||||||
request_content.append(new_line);
|
|
||||||
|
|
||||||
// add header to body splitter
|
|
||||||
request_content.append(new_line);
|
|
||||||
|
|
||||||
// add file content
|
|
||||||
request_content.append(file.readAll());
|
|
||||||
request_content.append(new_line);
|
|
||||||
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// add end of body
|
|
||||||
request_content.append(boundary_delimiter);
|
|
||||||
request_content.append(boundary);
|
|
||||||
request_content.append(boundary_delimiter);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(input->request_body.size() > 0) {
|
|
||||||
qDebug() << "got a request body";
|
|
||||||
request_content.clear();
|
|
||||||
request_content.append(input->request_body);
|
|
||||||
}
|
|
||||||
// prepare connection
|
|
||||||
|
|
||||||
QNetworkRequest request = QNetworkRequest(QUrl(input->url_str));
|
|
||||||
if (HttpRequestWorker::sslDefaultConfiguration != nullptr) {
|
|
||||||
request.setSslConfiguration(*HttpRequestWorker::sslDefaultConfiguration);
|
|
||||||
}
|
|
||||||
request.setRawHeader("User-Agent", "Swagger-Client");
|
|
||||||
foreach(QString key, input->headers.keys()) {
|
|
||||||
request.setRawHeader(key.toStdString().c_str(), input->headers.value(key).toStdString().c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (request_content.size() > 0 && !isFormData) {
|
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
|
||||||
}
|
|
||||||
else if (input->var_layout == URL_ENCODED) {
|
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
|
|
||||||
}
|
|
||||||
else if (input->var_layout == MULTIPART) {
|
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "multipart/form-data; boundary=" + boundary);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (input->http_method == "GET") {
|
|
||||||
manager->get(request);
|
|
||||||
}
|
|
||||||
else if (input->http_method == "POST") {
|
|
||||||
manager->post(request, request_content);
|
|
||||||
}
|
|
||||||
else if (input->http_method == "PUT") {
|
|
||||||
manager->put(request, request_content);
|
|
||||||
}
|
|
||||||
else if (input->http_method == "HEAD") {
|
|
||||||
manager->head(request);
|
|
||||||
}
|
|
||||||
else if (input->http_method == "DELETE") {
|
|
||||||
manager->deleteResource(request);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
#if (QT_VERSION >= 0x050800)
|
|
||||||
manager->sendCustomRequest(request, input->http_method.toLatin1(), request_content);
|
|
||||||
#else
|
|
||||||
QBuffer *buffer = new QBuffer;
|
|
||||||
buffer->setData(request_content);
|
|
||||||
buffer->open(QIODevice::ReadOnly);
|
|
||||||
|
|
||||||
QNetworkReply* reply = manager->sendCustomRequest(request, input->http_method.toLatin1(), buffer);
|
|
||||||
buffer->setParent(reply);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void HttpRequestWorker::on_manager_finished(QNetworkReply *reply) {
|
|
||||||
error_type = reply->error();
|
|
||||||
response = reply->readAll();
|
|
||||||
error_str = reply->errorString();
|
|
||||||
|
|
||||||
reply->deleteLater();
|
|
||||||
|
|
||||||
emit on_execution_finished(this);
|
|
||||||
}
|
|
||||||
QSslConfiguration* HttpRequestWorker::sslDefaultConfiguration;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,91 +0,0 @@
|
|||||||
/**
|
|
||||||
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Based on http://www.creativepulse.gr/en/blog/2014/restful-api-requests-using-qt-cpp-for-linux-mac-osx-ms-windows
|
|
||||||
* By Alex Stylianos
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
|
|
||||||
#ifndef HTTPREQUESTWORKER_H
|
|
||||||
#define HTTPREQUESTWORKER_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QString>
|
|
||||||
#include <QMap>
|
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
#include <QNetworkReply>
|
|
||||||
|
|
||||||
enum HttpRequestVarLayout {NOT_SET, ADDRESS, URL_ENCODED, MULTIPART};
|
|
||||||
|
|
||||||
namespace Swagger {
|
|
||||||
|
|
||||||
class SWGHttpRequestInputFileElement {
|
|
||||||
|
|
||||||
public:
|
|
||||||
QString variable_name;
|
|
||||||
QString local_filename;
|
|
||||||
QString request_filename;
|
|
||||||
QString mime_type;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class HttpRequestInput {
|
|
||||||
|
|
||||||
public:
|
|
||||||
QString url_str;
|
|
||||||
QString http_method;
|
|
||||||
HttpRequestVarLayout var_layout;
|
|
||||||
QMap<QString, QString> vars;
|
|
||||||
QMap<QString, QString> headers;
|
|
||||||
QList<SWGHttpRequestInputFileElement> files;
|
|
||||||
QByteArray request_body;
|
|
||||||
|
|
||||||
HttpRequestInput();
|
|
||||||
HttpRequestInput(QString v_url_str, QString v_http_method);
|
|
||||||
void initialize();
|
|
||||||
void add_var(QString key, QString value);
|
|
||||||
void add_file(QString variable_name, QString local_filename, QString request_filename, QString mime_type);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class HttpRequestWorker : public QObject {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
QByteArray response;
|
|
||||||
QNetworkReply::NetworkError error_type;
|
|
||||||
QString error_str;
|
|
||||||
|
|
||||||
explicit HttpRequestWorker(QObject *parent = 0);
|
|
||||||
virtual ~HttpRequestWorker();
|
|
||||||
|
|
||||||
QString http_attribute_encode(QString attribute_name, QString input);
|
|
||||||
void execute(HttpRequestInput *input);
|
|
||||||
static QSslConfiguration* sslDefaultConfiguration;
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void on_execution_finished(HttpRequestWorker *worker);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QNetworkAccessManager *manager;
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void on_manager_finished(QNetworkReply *reply);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // HTTPREQUESTWORKER_H
|
|
@ -1,43 +0,0 @@
|
|||||||
/**
|
|
||||||
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef ModelFactory_H_
|
|
||||||
#define ModelFactory_H_
|
|
||||||
|
|
||||||
|
|
||||||
#include "SWGReturn.h"
|
|
||||||
|
|
||||||
namespace Swagger {
|
|
||||||
|
|
||||||
inline void* create(QString type) {
|
|
||||||
if(QString("SWGReturn").compare(type) == 0) {
|
|
||||||
return new SWGReturn();
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void* create(QString json, QString type) {
|
|
||||||
void* val = create(type);
|
|
||||||
if(val != nullptr) {
|
|
||||||
SWGObject* obj = static_cast<SWGObject*>(val);
|
|
||||||
return obj->fromJson(json);
|
|
||||||
}
|
|
||||||
if(type.startsWith("QString")) {
|
|
||||||
return new QString();
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* ModelFactory_H_ */
|
|
@ -1,40 +0,0 @@
|
|||||||
/**
|
|
||||||
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SWG_OBJECT_H_
|
|
||||||
#define _SWG_OBJECT_H_
|
|
||||||
|
|
||||||
#include <QJsonValue>
|
|
||||||
|
|
||||||
namespace Swagger {
|
|
||||||
|
|
||||||
class SWGObject {
|
|
||||||
public:
|
|
||||||
virtual QJsonObject* asJsonObject() {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
virtual ~SWGObject() {}
|
|
||||||
virtual SWGObject* fromJson(QString &jsonString) {
|
|
||||||
Q_UNUSED(jsonString);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
virtual void fromJsonObject(QJsonObject &json) {
|
|
||||||
Q_UNUSED(json);
|
|
||||||
}
|
|
||||||
virtual QString asJson() {
|
|
||||||
return QString("");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _SWG_OBJECT_H_ */
|
|
@ -1,92 +0,0 @@
|
|||||||
/**
|
|
||||||
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "SWGReturn.h"
|
|
||||||
|
|
||||||
#include "SWGHelpers.h"
|
|
||||||
|
|
||||||
#include <QJsonDocument>
|
|
||||||
#include <QJsonArray>
|
|
||||||
#include <QObject>
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace Swagger {
|
|
||||||
|
|
||||||
SWGReturn::SWGReturn(QString* json) {
|
|
||||||
init();
|
|
||||||
this->fromJson(*json);
|
|
||||||
}
|
|
||||||
|
|
||||||
SWGReturn::SWGReturn() {
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
SWGReturn::~SWGReturn() {
|
|
||||||
this->cleanup();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
SWGReturn::init() {
|
|
||||||
_return = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
SWGReturn::cleanup() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
SWGReturn*
|
|
||||||
SWGReturn::fromJson(QString &json) {
|
|
||||||
QByteArray array (json.toStdString().c_str());
|
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
|
||||||
QJsonObject jsonObject = doc.object();
|
|
||||||
this->fromJsonObject(jsonObject);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
SWGReturn::fromJsonObject(QJsonObject &pJson) {
|
|
||||||
::Swagger::setValue(&_return, pJson["return"], "qint32", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
QString
|
|
||||||
SWGReturn::asJson ()
|
|
||||||
{
|
|
||||||
QJsonObject* obj = this->asJsonObject();
|
|
||||||
|
|
||||||
QJsonDocument doc(*obj);
|
|
||||||
QByteArray bytes = doc.toJson();
|
|
||||||
return QString(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
QJsonObject*
|
|
||||||
SWGReturn::asJsonObject() {
|
|
||||||
QJsonObject* obj = new QJsonObject();
|
|
||||||
|
|
||||||
obj->insert("return", QJsonValue(_return));
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
qint32
|
|
||||||
SWGReturn::getReturn() {
|
|
||||||
return _return;
|
|
||||||
}
|
|
||||||
void
|
|
||||||
SWGReturn::setReturn(qint32 _return) {
|
|
||||||
this->_return = _return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
|||||||
/**
|
|
||||||
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* SWGReturn.h
|
|
||||||
*
|
|
||||||
* Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SWGReturn_H_
|
|
||||||
#define SWGReturn_H_
|
|
||||||
|
|
||||||
#include <QJsonObject>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "SWGObject.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace Swagger {
|
|
||||||
|
|
||||||
class SWGReturn: public SWGObject {
|
|
||||||
public:
|
|
||||||
SWGReturn();
|
|
||||||
SWGReturn(QString* json);
|
|
||||||
virtual ~SWGReturn();
|
|
||||||
void init();
|
|
||||||
void cleanup();
|
|
||||||
|
|
||||||
QString asJson ();
|
|
||||||
QJsonObject* asJsonObject();
|
|
||||||
void fromJsonObject(QJsonObject &json);
|
|
||||||
SWGReturn* fromJson(QString &jsonString);
|
|
||||||
|
|
||||||
qint32 getReturn();
|
|
||||||
void setReturn(qint32 _return);
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
qint32 _return;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* SWGReturn_H_ */
|
|
@ -1,186 +0,0 @@
|
|||||||
# Ref: https://gist.github.com/kmorcinek/2710267
|
|
||||||
# Download this file using PowerShell v3 under Windows with the following comand
|
|
||||||
# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore
|
|
||||||
|
|
||||||
# User-specific files
|
|
||||||
*.suo
|
|
||||||
*.user
|
|
||||||
*.sln.docstates
|
|
||||||
./nuget
|
|
||||||
|
|
||||||
# Build results
|
|
||||||
|
|
||||||
[Dd]ebug/
|
|
||||||
[Rr]elease/
|
|
||||||
x64/
|
|
||||||
build/
|
|
||||||
[Bb]in/
|
|
||||||
[Oo]bj/
|
|
||||||
|
|
||||||
# NuGet Packages
|
|
||||||
*.nupkg
|
|
||||||
# The packages folder can be ignored because of Package Restore
|
|
||||||
**/packages/*
|
|
||||||
# except build/, which is used as an MSBuild target.
|
|
||||||
!**/packages/build/
|
|
||||||
# Uncomment if necessary however generally it will be regenerated when needed
|
|
||||||
#!**/packages/repositories.config
|
|
||||||
|
|
||||||
# MSTest test Results
|
|
||||||
[Tt]est[Rr]esult*/
|
|
||||||
[Bb]uild[Ll]og.*
|
|
||||||
|
|
||||||
*_i.c
|
|
||||||
*_p.c
|
|
||||||
*.ilk
|
|
||||||
*.meta
|
|
||||||
*.obj
|
|
||||||
*.pch
|
|
||||||
*.pdb
|
|
||||||
*.pgc
|
|
||||||
*.pgd
|
|
||||||
*.rsp
|
|
||||||
*.sbr
|
|
||||||
*.tlb
|
|
||||||
*.tli
|
|
||||||
*.tlh
|
|
||||||
*.tmp
|
|
||||||
*.tmp_proj
|
|
||||||
*.log
|
|
||||||
*.vspscc
|
|
||||||
*.vssscc
|
|
||||||
.builds
|
|
||||||
*.pidb
|
|
||||||
*.log
|
|
||||||
*.scc
|
|
||||||
|
|
||||||
# OS generated files #
|
|
||||||
.DS_Store*
|
|
||||||
ehthumbs.db
|
|
||||||
Icon?
|
|
||||||
Thumbs.db
|
|
||||||
|
|
||||||
# Visual C++ cache files
|
|
||||||
ipch/
|
|
||||||
*.aps
|
|
||||||
*.ncb
|
|
||||||
*.opensdf
|
|
||||||
*.sdf
|
|
||||||
*.cachefile
|
|
||||||
|
|
||||||
# Visual Studio profiler
|
|
||||||
*.psess
|
|
||||||
*.vsp
|
|
||||||
*.vspx
|
|
||||||
|
|
||||||
# Guidance Automation Toolkit
|
|
||||||
*.gpState
|
|
||||||
|
|
||||||
# ReSharper is a .NET coding add-in
|
|
||||||
_ReSharper*/
|
|
||||||
*.[Rr]e[Ss]harper
|
|
||||||
|
|
||||||
# TeamCity is a build add-in
|
|
||||||
_TeamCity*
|
|
||||||
|
|
||||||
# DotCover is a Code Coverage Tool
|
|
||||||
*.dotCover
|
|
||||||
|
|
||||||
# NCrunch
|
|
||||||
*.ncrunch*
|
|
||||||
.*crunch*.local.xml
|
|
||||||
|
|
||||||
# Installshield output folder
|
|
||||||
[Ee]xpress/
|
|
||||||
|
|
||||||
# DocProject is a documentation generator add-in
|
|
||||||
DocProject/buildhelp/
|
|
||||||
DocProject/Help/*.HxT
|
|
||||||
DocProject/Help/*.HxC
|
|
||||||
DocProject/Help/*.hhc
|
|
||||||
DocProject/Help/*.hhk
|
|
||||||
DocProject/Help/*.hhp
|
|
||||||
DocProject/Help/Html2
|
|
||||||
DocProject/Help/html
|
|
||||||
|
|
||||||
# Click-Once directory
|
|
||||||
publish/
|
|
||||||
|
|
||||||
# Publish Web Output
|
|
||||||
*.Publish.xml
|
|
||||||
|
|
||||||
# Windows Azure Build Output
|
|
||||||
csx
|
|
||||||
*.build.csdef
|
|
||||||
|
|
||||||
# Windows Store app package directory
|
|
||||||
AppPackages/
|
|
||||||
|
|
||||||
# Others
|
|
||||||
sql/
|
|
||||||
*.Cache
|
|
||||||
ClientBin/
|
|
||||||
[Ss]tyle[Cc]op.*
|
|
||||||
~$*
|
|
||||||
*~
|
|
||||||
*.dbmdl
|
|
||||||
*.[Pp]ublish.xml
|
|
||||||
*.pfx
|
|
||||||
*.publishsettings
|
|
||||||
modulesbin/
|
|
||||||
tempbin/
|
|
||||||
|
|
||||||
# EPiServer Site file (VPP)
|
|
||||||
AppData/
|
|
||||||
|
|
||||||
# RIA/Silverlight projects
|
|
||||||
Generated_Code/
|
|
||||||
|
|
||||||
# Backup & report files from converting an old project file to a newer
|
|
||||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
|
||||||
_UpgradeReport_Files/
|
|
||||||
Backup*/
|
|
||||||
UpgradeLog*.XML
|
|
||||||
UpgradeLog*.htm
|
|
||||||
|
|
||||||
# vim
|
|
||||||
*.txt~
|
|
||||||
*.swp
|
|
||||||
*.swo
|
|
||||||
|
|
||||||
# svn
|
|
||||||
.svn
|
|
||||||
|
|
||||||
# SQL Server files
|
|
||||||
**/App_Data/*.mdf
|
|
||||||
**/App_Data/*.ldf
|
|
||||||
**/App_Data/*.sdf
|
|
||||||
|
|
||||||
|
|
||||||
#LightSwitch generated files
|
|
||||||
GeneratedArtifacts/
|
|
||||||
_Pvt_Extensions/
|
|
||||||
ModelManifest.xml
|
|
||||||
|
|
||||||
# =========================
|
|
||||||
# Windows detritus
|
|
||||||
# =========================
|
|
||||||
|
|
||||||
# Windows image file caches
|
|
||||||
Thumbs.db
|
|
||||||
ehthumbs.db
|
|
||||||
|
|
||||||
# Folder config file
|
|
||||||
Desktop.ini
|
|
||||||
|
|
||||||
# Recycle Bin used on file shares
|
|
||||||
$RECYCLE.BIN/
|
|
||||||
|
|
||||||
# Mac desktop service store files
|
|
||||||
.DS_Store
|
|
||||||
|
|
||||||
# SASS Compiler cache
|
|
||||||
.sass-cache
|
|
||||||
|
|
||||||
# Visual Studio 2014 CTP
|
|
||||||
**/*.sln.ide
|
|
@ -1,23 +0,0 @@
|
|||||||
# Swagger Codegen Ignore
|
|
||||||
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
|
||||||
|
|
||||||
# Use this file to prevent files from being overwritten by the generator.
|
|
||||||
# The patterns follow closely to .gitignore or .dockerignore.
|
|
||||||
|
|
||||||
# As an example, the C# client generator defines ApiClient.cs.
|
|
||||||
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
|
||||||
#ApiClient.cs
|
|
||||||
|
|
||||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
|
||||||
#foo/*/qux
|
|
||||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
|
||||||
#foo/**/qux
|
|
||||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can also negate patterns with an exclamation (!).
|
|
||||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
|
||||||
#docs/*.md
|
|
||||||
# Then explicitly reverse the ignore rule for a single file:
|
|
||||||
#!docs/README.md
|
|
@ -1 +0,0 @@
|
|||||||
2.3.1-SNAPSHOT
|
|
@ -1,9 +0,0 @@
|
|||||||
#
|
|
||||||
# Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
#
|
|
||||||
language: csharp
|
|
||||||
mono:
|
|
||||||
- latest
|
|
||||||
solution: IO.Swagger.sln
|
|
||||||
script:
|
|
||||||
- /bin/sh ./mono_nunit_test.sh
|
|
@ -1,27 +0,0 @@
|
|||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio 2012
|
|
||||||
VisualStudioVersion = 12.0.0.0
|
|
||||||
MinimumVisualStudioVersion = 10.0.0.1
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{8CE139DF-64BC-4591-85F8-8506C2B67514}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{8CE139DF-64BC-4591-85F8-8506C2B67514}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{8CE139DF-64BC-4591-85F8-8506C2B67514}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{8CE139DF-64BC-4591-85F8-8506C2B67514}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{8CE139DF-64BC-4591-85F8-8506C2B67514}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
@ -1,126 +0,0 @@
|
|||||||
# IO.Swagger - the C# library for the Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - -
|
|
||||||
|
|
||||||
This C# SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
|
||||||
|
|
||||||
- API version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
- SDK version: 1.0.0
|
|
||||||
- Build package: io.swagger.codegen.languages.CSharpClientCodegen
|
|
||||||
|
|
||||||
<a name="frameworks-supported"></a>
|
|
||||||
## Frameworks supported
|
|
||||||
- .NET 4.0 or later
|
|
||||||
- Windows Phone 7.1 (Mango)
|
|
||||||
|
|
||||||
<a name="dependencies"></a>
|
|
||||||
## Dependencies
|
|
||||||
- [RestSharp](https://www.nuget.org/packages/RestSharp) - 105.1.0 or later
|
|
||||||
- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later
|
|
||||||
- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.2.0 or later
|
|
||||||
|
|
||||||
The DLLs included in the package may not be the latest version. We recommend using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
|
|
||||||
```
|
|
||||||
Install-Package RestSharp
|
|
||||||
Install-Package Newtonsoft.Json
|
|
||||||
Install-Package JsonSubTypes
|
|
||||||
```
|
|
||||||
|
|
||||||
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)
|
|
||||||
|
|
||||||
<a name="installation"></a>
|
|
||||||
## Installation
|
|
||||||
Run the following command to generate the DLL
|
|
||||||
- [Mac/Linux] `/bin/sh build.sh`
|
|
||||||
- [Windows] `build.bat`
|
|
||||||
|
|
||||||
Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces:
|
|
||||||
```csharp
|
|
||||||
using IO.Swagger.Api;
|
|
||||||
using IO.Swagger.Client;
|
|
||||||
using IO.Swagger.Model;
|
|
||||||
```
|
|
||||||
<a name="packaging"></a>
|
|
||||||
## Packaging
|
|
||||||
|
|
||||||
A `.nuspec` is included with the project. You can follow the Nuget quickstart to [create](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#create-the-package) and [publish](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#publish-the-package) packages.
|
|
||||||
|
|
||||||
This `.nuspec` uses placeholders from the `.csproj`, so build the `.csproj` directly:
|
|
||||||
|
|
||||||
```
|
|
||||||
nuget pack -Build -OutputDirectory out IO.Swagger.csproj
|
|
||||||
```
|
|
||||||
|
|
||||||
Then, publish to a [local feed](https://docs.microsoft.com/en-us/nuget/hosting-packages/local-feeds) or [other host](https://docs.microsoft.com/en-us/nuget/hosting-packages/overview) and consume the new package via Nuget as usual.
|
|
||||||
|
|
||||||
<a name="getting-started"></a>
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
```csharp
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using IO.Swagger.Api;
|
|
||||||
using IO.Swagger.Client;
|
|
||||||
using IO.Swagger.Model;
|
|
||||||
|
|
||||||
namespace Example
|
|
||||||
{
|
|
||||||
public class Example
|
|
||||||
{
|
|
||||||
public void main()
|
|
||||||
{
|
|
||||||
|
|
||||||
var apiInstance = new FakeApi();
|
|
||||||
var testCodeInjectEndRnNR = testCodeInjectEndRnNR_example; // string | To test code injection *_/ ' \" =end - - \\r\\n \\n \\r (optional)
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// To test code injection *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
apiInstance.TestCodeInjectEndRnNR(testCodeInjectEndRnNR);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Debug.Print("Exception when calling FakeApi.TestCodeInjectEndRnNR: " + e.Message );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
<a name="documentation-for-api-endpoints"></a>
|
|
||||||
## Documentation for API Endpoints
|
|
||||||
|
|
||||||
All URIs are relative to *https://petstore.swagger.io *_/ ' \" =end - - \\r\\n \\n \\r/v2 *_/ ' \" =end - - \\r\\n \\n \\r*
|
|
||||||
|
|
||||||
Class | Method | HTTP request | Description
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
*FakeApi* | [**TestCodeInjectEndRnNR**](docs/FakeApi.md#testcodeinjectendrnnr) | **PUT** /fake | To test code injection *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
|
|
||||||
|
|
||||||
<a name="documentation-for-models"></a>
|
|
||||||
## Documentation for Models
|
|
||||||
|
|
||||||
- [Model.Return](docs/Return.md)
|
|
||||||
|
|
||||||
|
|
||||||
<a name="documentation-for-authorization"></a>
|
|
||||||
## Documentation for Authorization
|
|
||||||
|
|
||||||
<a name="api_key"></a>
|
|
||||||
### api_key
|
|
||||||
|
|
||||||
- **Type**: API key
|
|
||||||
- **API key parameter name**: api_key */ ' " =end -- \r\n \n \r
|
|
||||||
- **Location**: HTTP header
|
|
||||||
|
|
||||||
<a name="petstore_auth"></a>
|
|
||||||
### petstore_auth
|
|
||||||
|
|
||||||
- **Type**: OAuth
|
|
||||||
- **Flow**: implicit
|
|
||||||
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
|
|
||||||
- **Scopes**:
|
|
||||||
- write:pets: modify pets in your account *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
- read:pets: read your pets *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
:: Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
::
|
|
||||||
|
|
||||||
@echo off
|
|
||||||
|
|
||||||
SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319
|
|
||||||
|
|
||||||
if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '.\nuget.exe')"
|
|
||||||
.\nuget.exe install src\IO.Swagger\packages.config -o packages
|
|
||||||
|
|
||||||
if not exist ".\bin" mkdir bin
|
|
||||||
|
|
||||||
copy packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll
|
|
||||||
copy packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll bin\JsonSubTypes.dll
|
|
||||||
copy packages\RestSharp.105.1.0\lib\net45\RestSharp.dll bin\RestSharp.dll
|
|
||||||
%CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\JsonSubTypes.dll;bin\RestSharp.dll;System.ComponentModel.DataAnnotations.dll /target:library /out:bin\IO.Swagger.dll /recurse:src\IO.Swagger\*.cs /doc:bin\IO.Swagger.xml
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
#
|
|
||||||
|
|
||||||
frameworkVersion=net45
|
|
||||||
|
|
||||||
# sdk must match installed framworks under PREFIX/lib/mono/[value]
|
|
||||||
sdk=4.5.2-api
|
|
||||||
|
|
||||||
# langversion refers to C# language features. see man mcs for details.
|
|
||||||
langversion=${sdk}
|
|
||||||
nuget_cmd=nuget
|
|
||||||
|
|
||||||
# Match against our known SDK possibilities
|
|
||||||
case "${sdk}" in
|
|
||||||
4)
|
|
||||||
langversion=4
|
|
||||||
;;
|
|
||||||
4.5*)
|
|
||||||
langversion=5
|
|
||||||
;;
|
|
||||||
4.6*)
|
|
||||||
langversion=6
|
|
||||||
;;
|
|
||||||
4.7*)
|
|
||||||
langversion=7 # ignoring 7.1 for now.
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
langversion=6
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo "[INFO] Target framework: ${frameworkVersion}"
|
|
||||||
|
|
||||||
if ! type nuget &>/dev/null; then
|
|
||||||
echo "[INFO] Download nuget and packages"
|
|
||||||
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe;
|
|
||||||
nuget_cmd="mono nuget.exe"
|
|
||||||
fi
|
|
||||||
|
|
||||||
mozroots --import --sync
|
|
||||||
${nuget_cmd} install src/IO.Swagger/packages.config -o packages;
|
|
||||||
|
|
||||||
echo "[INFO] Copy DLLs to the 'bin' folder"
|
|
||||||
mkdir -p bin;
|
|
||||||
cp packages/Newtonsoft.Json.10.0.3/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll;
|
|
||||||
cp packages/RestSharp.105.1.0/lib/net45/RestSharp.dll bin/RestSharp.dll;
|
|
||||||
cp packages/JsonSubTypes.1.2.0/lib/net45/JsonSubTypes.dll bin/JsonSubTypes.dll
|
|
||||||
|
|
||||||
echo "[INFO] Run 'mcs' to build bin/IO.Swagger.dll"
|
|
||||||
mcs -langversion:${langversion} -sdk:${sdk} -r:bin/Newtonsoft.Json.dll,bin/JsonSubTypes.dll,\
|
|
||||||
bin/RestSharp.dll,\
|
|
||||||
System.ComponentModel.DataAnnotations.dll,\
|
|
||||||
System.Runtime.Serialization.dll \
|
|
||||||
-target:library \
|
|
||||||
-out:bin/IO.Swagger.dll \
|
|
||||||
-recurse:'src/IO.Swagger/*.cs' \
|
|
||||||
-doc:bin/IO.Swagger.xml \
|
|
||||||
-platform:anycpu
|
|
||||||
|
|
||||||
if [ $? -ne 0 ]
|
|
||||||
then
|
|
||||||
echo "[ERROR] Compilation failed with exit code $?"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "[INFO] bin/IO.Swagger.dll was created successfully"
|
|
||||||
fi
|
|
@ -1,67 +0,0 @@
|
|||||||
# IO.Swagger.Api.FakeApi
|
|
||||||
|
|
||||||
All URIs are relative to *https://petstore.swagger.io *_/ ' \" =end - - \\r\\n \\n \\r/v2 *_/ ' \" =end - - \\r\\n \\n \\r*
|
|
||||||
|
|
||||||
Method | HTTP request | Description
|
|
||||||
------------- | ------------- | -------------
|
|
||||||
[**TestCodeInjectEndRnNR**](FakeApi.md#testcodeinjectendrnnr) | **PUT** /fake | To test code injection *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
|
|
||||||
|
|
||||||
<a name="testcodeinjectendrnnr"></a>
|
|
||||||
# **TestCodeInjectEndRnNR**
|
|
||||||
> void TestCodeInjectEndRnNR (string testCodeInjectEndRnNR = null)
|
|
||||||
|
|
||||||
To test code injection *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```csharp
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using IO.Swagger.Api;
|
|
||||||
using IO.Swagger.Client;
|
|
||||||
using IO.Swagger.Model;
|
|
||||||
|
|
||||||
namespace Example
|
|
||||||
{
|
|
||||||
public class TestCodeInjectEndRnNRExample
|
|
||||||
{
|
|
||||||
public void main()
|
|
||||||
{
|
|
||||||
var apiInstance = new FakeApi();
|
|
||||||
var testCodeInjectEndRnNR = testCodeInjectEndRnNR_example; // string | To test code injection *_/ ' \" =end - - \\r\\n \\n \\r (optional)
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// To test code injection *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
apiInstance.TestCodeInjectEndRnNR(testCodeInjectEndRnNR);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Debug.Print("Exception when calling FakeApi.TestCodeInjectEndRnNR: " + e.Message );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**testCodeInjectEndRnNR** | **string**| To test code injection *_/ ' \" =end - - \\r\\n \\n \\r | [optional]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: application/json, *_/ ' =end - -
|
|
||||||
- **Accept**: application/json, *_/ ' =end - -
|
|
||||||
|
|
||||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
|||||||
# IO.Swagger.Model.ModelReturn
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**_Return** | **int?** | property description *_/ ' \" =end - - \\r\\n \\n \\r | [optional]
|
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
|||||||
# IO.Swagger.Model.Return
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**_Return** | **int?** | property description *_/ ' \" =end - - \\r\\n \\n \\r | [optional]
|
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
|
||||||
#
|
|
||||||
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
|
||||||
|
|
||||||
git_user_id=$1
|
|
||||||
git_repo_id=$2
|
|
||||||
release_note=$3
|
|
||||||
|
|
||||||
if [ "$git_user_id" = "" ]; then
|
|
||||||
git_user_id="GIT_USER_ID"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$git_repo_id" = "" ]; then
|
|
||||||
git_repo_id="GIT_REPO_ID"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$release_note" = "" ]; then
|
|
||||||
release_note="Minor update"
|
|
||||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Initialize the local directory as a Git repository
|
|
||||||
git init
|
|
||||||
|
|
||||||
# Adds the files in the local repository and stages them for commit.
|
|
||||||
git add .
|
|
||||||
|
|
||||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
|
||||||
git commit -m "$release_note"
|
|
||||||
|
|
||||||
# Sets the new remote
|
|
||||||
git_remote=`git remote`
|
|
||||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
|
||||||
|
|
||||||
if [ "$GIT_TOKEN" = "" ]; then
|
|
||||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
|
||||||
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
|
||||||
else
|
|
||||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
git pull origin master
|
|
||||||
|
|
||||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
|
||||||
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
|
||||||
git push origin master 2>&1 | grep -v 'To https'
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
#
|
|
||||||
|
|
||||||
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
|
|
||||||
mozroots --import --sync
|
|
||||||
|
|
||||||
echo "[INFO] remove bin/Debug/SwaggerClientTest.dll"
|
|
||||||
rm src/IO.Swagger.Test/bin/Debug/IO.Swagger.Test.dll 2> /dev/null
|
|
||||||
|
|
||||||
echo "[INFO] install NUnit runners via NuGet"
|
|
||||||
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
|
|
||||||
mozroots --import --sync
|
|
||||||
mono nuget.exe install src/IO.Swagger.Test/packages.config -o packages
|
|
||||||
|
|
||||||
echo "[INFO] Install NUnit runners via NuGet"
|
|
||||||
mono nuget.exe install NUnit.Runners -Version 2.6.4 -OutputDirectory packages
|
|
||||||
|
|
||||||
echo "[INFO] Build the solution and run the unit test"
|
|
||||||
xbuild IO.Swagger.sln && \
|
|
||||||
mono ./packages/NUnit.Runners.2.6.4/tools/nunit-console.exe src/IO.Swagger.Test/bin/Debug/IO.Swagger.Test.dll
|
|
@ -1,80 +0,0 @@
|
|||||||
/*
|
|
||||||
* Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - -
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using RestSharp;
|
|
||||||
using NUnit.Framework;
|
|
||||||
|
|
||||||
using IO.Swagger.Client;
|
|
||||||
using IO.Swagger.Api;
|
|
||||||
|
|
||||||
namespace IO.Swagger.Test
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Class for testing FakeApi
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// This file is automatically generated by Swagger Codegen.
|
|
||||||
/// Please update the test case below to test the API endpoint.
|
|
||||||
/// </remarks>
|
|
||||||
[TestFixture]
|
|
||||||
public class FakeApiTests
|
|
||||||
{
|
|
||||||
private FakeApi instance;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Setup before each unit test
|
|
||||||
/// </summary>
|
|
||||||
[SetUp]
|
|
||||||
public void Init()
|
|
||||||
{
|
|
||||||
instance = new FakeApi();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up after each unit test
|
|
||||||
/// </summary>
|
|
||||||
[TearDown]
|
|
||||||
public void Cleanup()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Test an instance of FakeApi
|
|
||||||
/// </summary>
|
|
||||||
[Test]
|
|
||||||
public void InstanceTest()
|
|
||||||
{
|
|
||||||
// TODO uncomment below to test 'IsInstanceOfType' FakeApi
|
|
||||||
//Assert.IsInstanceOfType(typeof(FakeApi), instance, "instance is a FakeApi");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Test TestCodeInjectEndRnNR
|
|
||||||
/// </summary>
|
|
||||||
[Test]
|
|
||||||
public void TestCodeInjectEndRnNRTest()
|
|
||||||
{
|
|
||||||
// TODO uncomment below to test the method and replace null with proper value
|
|
||||||
//string testCodeInjectEndRnNR = null;
|
|
||||||
//instance.TestCodeInjectEndRnNR(testCodeInjectEndRnNR);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,89 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - -
|
|
||||||
|
|
||||||
OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
-->
|
|
||||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{19F1DEBC-DE5E-4517-8062-F000CD499087}</ProjectGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>IO.Swagger.Test</RootNamespace>
|
|
||||||
<AssemblyName>IO.Swagger.Test</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Runtime.Serialization" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
<Reference Include="Newtonsoft.Json">
|
|
||||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="JsonSubTypes">
|
|
||||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\packages')">..\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="RestSharp">
|
|
||||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\packages')">..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="nunit.framework">
|
|
||||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\packages')">..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="**\*.cs"
|
|
||||||
Exclude="obj\**"/>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="packages.config" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\IO.Swagger\IO.Swagger.csproj">
|
|
||||||
<Project>{8CE139DF-64BC-4591-85F8-8506C2B67514}</Project>
|
|
||||||
<Name>IO.Swagger</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
|
|
@ -1,80 +0,0 @@
|
|||||||
/*
|
|
||||||
* Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - -
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
using NUnit.Framework;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.IO;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using IO.Swagger.Api;
|
|
||||||
using IO.Swagger.Model;
|
|
||||||
using IO.Swagger.Client;
|
|
||||||
using System.Reflection;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace IO.Swagger.Test
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Class for testing ModelReturn
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// This file is automatically generated by Swagger Codegen.
|
|
||||||
/// Please update the test case below to test the model.
|
|
||||||
/// </remarks>
|
|
||||||
[TestFixture]
|
|
||||||
public class ModelReturnTests
|
|
||||||
{
|
|
||||||
// TODO uncomment below to declare an instance variable for ModelReturn
|
|
||||||
//private ModelReturn instance;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Setup before each test
|
|
||||||
/// </summary>
|
|
||||||
[SetUp]
|
|
||||||
public void Init()
|
|
||||||
{
|
|
||||||
// TODO uncomment below to create an instance of ModelReturn
|
|
||||||
//instance = new ModelReturn();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up after each test
|
|
||||||
/// </summary>
|
|
||||||
[TearDown]
|
|
||||||
public void Cleanup()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Test an instance of ModelReturn
|
|
||||||
/// </summary>
|
|
||||||
[Test]
|
|
||||||
public void ModelReturnInstanceTest()
|
|
||||||
{
|
|
||||||
// TODO uncomment below to test "IsInstanceOfType" ModelReturn
|
|
||||||
//Assert.IsInstanceOfType<ModelReturn> (instance, "variable 'instance' is a ModelReturn");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Test the property '_Return'
|
|
||||||
/// </summary>
|
|
||||||
[Test]
|
|
||||||
public void _ReturnTest()
|
|
||||||
{
|
|
||||||
// TODO unit test for the property '_Return'
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
/*
|
|
||||||
* Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - -
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
using NUnit.Framework;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.IO;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using IO.Swagger.Api;
|
|
||||||
using IO.Swagger.Model;
|
|
||||||
using IO.Swagger.Client;
|
|
||||||
using System.Reflection;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace IO.Swagger.Test
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Class for testing Return
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// This file is automatically generated by Swagger Codegen.
|
|
||||||
/// Please update the test case below to test the model.
|
|
||||||
/// </remarks>
|
|
||||||
[TestFixture]
|
|
||||||
public class ReturnTests
|
|
||||||
{
|
|
||||||
// TODO uncomment below to declare an instance variable for Return
|
|
||||||
//private Return instance;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Setup before each test
|
|
||||||
/// </summary>
|
|
||||||
[SetUp]
|
|
||||||
public void Init()
|
|
||||||
{
|
|
||||||
// TODO uncomment below to create an instance of Return
|
|
||||||
//instance = new Return();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up after each test
|
|
||||||
/// </summary>
|
|
||||||
[TearDown]
|
|
||||||
public void Cleanup()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Test an instance of Return
|
|
||||||
/// </summary>
|
|
||||||
[Test]
|
|
||||||
public void ReturnInstanceTest()
|
|
||||||
{
|
|
||||||
// TODO uncomment below to test "IsInstanceOfType" Return
|
|
||||||
//Assert.IsInstanceOfType<Return> (instance, "variable 'instance' is a Return");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Test the property '_Return'
|
|
||||||
/// </summary>
|
|
||||||
[Test]
|
|
||||||
public void _ReturnTest()
|
|
||||||
{
|
|
||||||
// TODO unit test for the property '_Return'
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="NUnit" version="2.6.4" targetFramework="net45" />
|
|
||||||
<package id="RestSharp" version="105.1.0" targetFramework="net45" developmentDependency="true" />
|
|
||||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" developmentDependency="true" />
|
|
||||||
<package id="JsonSubTypes" version="1.2.0" targetFramework="net45" developmentDependency="true" />
|
|
||||||
</packages>
|
|
@ -1,302 +0,0 @@
|
|||||||
/*
|
|
||||||
* Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - -
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
|
||||||
using RestSharp;
|
|
||||||
using IO.Swagger.Client;
|
|
||||||
|
|
||||||
namespace IO.Swagger.Api
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a collection of functions to interact with the API endpoints
|
|
||||||
/// </summary>
|
|
||||||
public interface IFakeApi : IApiAccessor
|
|
||||||
{
|
|
||||||
#region Synchronous Operations
|
|
||||||
/// <summary>
|
|
||||||
/// To test code injection *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
///
|
|
||||||
/// </remarks>
|
|
||||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
|
||||||
/// <param name="testCodeInjectEndRnNR">To test code injection *_/ ' \" =end - - \\r\\n \\n \\r (optional)</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
void TestCodeInjectEndRnNR (string testCodeInjectEndRnNR = null);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// To test code injection *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
///
|
|
||||||
/// </remarks>
|
|
||||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
|
||||||
/// <param name="testCodeInjectEndRnNR">To test code injection *_/ ' \" =end - - \\r\\n \\n \\r (optional)</param>
|
|
||||||
/// <returns>ApiResponse of Object(void)</returns>
|
|
||||||
ApiResponse<Object> TestCodeInjectEndRnNRWithHttpInfo (string testCodeInjectEndRnNR = null);
|
|
||||||
#endregion Synchronous Operations
|
|
||||||
#region Asynchronous Operations
|
|
||||||
/// <summary>
|
|
||||||
/// To test code injection *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
///
|
|
||||||
/// </remarks>
|
|
||||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
|
||||||
/// <param name="testCodeInjectEndRnNR">To test code injection *_/ ' \" =end - - \\r\\n \\n \\r (optional)</param>
|
|
||||||
/// <returns>Task of void</returns>
|
|
||||||
System.Threading.Tasks.Task TestCodeInjectEndRnNRAsync (string testCodeInjectEndRnNR = null);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// To test code injection *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
///
|
|
||||||
/// </remarks>
|
|
||||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
|
||||||
/// <param name="testCodeInjectEndRnNR">To test code injection *_/ ' \" =end - - \\r\\n \\n \\r (optional)</param>
|
|
||||||
/// <returns>Task of ApiResponse</returns>
|
|
||||||
System.Threading.Tasks.Task<ApiResponse<Object>> TestCodeInjectEndRnNRAsyncWithHttpInfo (string testCodeInjectEndRnNR = null);
|
|
||||||
#endregion Asynchronous Operations
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a collection of functions to interact with the API endpoints
|
|
||||||
/// </summary>
|
|
||||||
public partial class FakeApi : IFakeApi
|
|
||||||
{
|
|
||||||
private IO.Swagger.Client.ExceptionFactory _exceptionFactory = (name, response) => null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="FakeApi"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public FakeApi(String basePath)
|
|
||||||
{
|
|
||||||
this.Configuration = new IO.Swagger.Client.Configuration { BasePath = basePath };
|
|
||||||
|
|
||||||
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="FakeApi"/> class
|
|
||||||
/// using Configuration object
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="configuration">An instance of Configuration</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public FakeApi(IO.Swagger.Client.Configuration configuration = null)
|
|
||||||
{
|
|
||||||
if (configuration == null) // use the default one in Configuration
|
|
||||||
this.Configuration = IO.Swagger.Client.Configuration.Default;
|
|
||||||
else
|
|
||||||
this.Configuration = configuration;
|
|
||||||
|
|
||||||
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the base path of the API client.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The base path</value>
|
|
||||||
public String GetBasePath()
|
|
||||||
{
|
|
||||||
return this.Configuration.ApiClient.RestClient.BaseUrl.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets the base path of the API client.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The base path</value>
|
|
||||||
[Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")]
|
|
||||||
public void SetBasePath(String basePath)
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the configuration object
|
|
||||||
/// </summary>
|
|
||||||
/// <value>An instance of the Configuration</value>
|
|
||||||
public IO.Swagger.Client.Configuration Configuration {get; set;}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Provides a factory method hook for the creation of exceptions.
|
|
||||||
/// </summary>
|
|
||||||
public IO.Swagger.Client.ExceptionFactory ExceptionFactory
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported.");
|
|
||||||
}
|
|
||||||
return _exceptionFactory;
|
|
||||||
}
|
|
||||||
set { _exceptionFactory = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the default header.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Dictionary of HTTP header</returns>
|
|
||||||
[Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
|
|
||||||
public IDictionary<String, String> DefaultHeader()
|
|
||||||
{
|
|
||||||
return new ReadOnlyDictionary<string, string>(this.Configuration.DefaultHeader);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add default header.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key">Header field name.</param>
|
|
||||||
/// <param name="value">Header field value.</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")]
|
|
||||||
public void AddDefaultHeader(string key, string value)
|
|
||||||
{
|
|
||||||
this.Configuration.AddDefaultHeader(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// To test code injection *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
/// </summary>
|
|
||||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
|
||||||
/// <param name="testCodeInjectEndRnNR">To test code injection *_/ ' \" =end - - \\r\\n \\n \\r (optional)</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public void TestCodeInjectEndRnNR (string testCodeInjectEndRnNR = null)
|
|
||||||
{
|
|
||||||
TestCodeInjectEndRnNRWithHttpInfo(testCodeInjectEndRnNR);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// To test code injection *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
/// </summary>
|
|
||||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
|
||||||
/// <param name="testCodeInjectEndRnNR">To test code injection *_/ ' \" =end - - \\r\\n \\n \\r (optional)</param>
|
|
||||||
/// <returns>ApiResponse of Object(void)</returns>
|
|
||||||
public ApiResponse<Object> TestCodeInjectEndRnNRWithHttpInfo (string testCodeInjectEndRnNR = null)
|
|
||||||
{
|
|
||||||
|
|
||||||
var localVarPath = "/fake";
|
|
||||||
var localVarPathParams = new Dictionary<String, String>();
|
|
||||||
var localVarQueryParams = new List<KeyValuePair<String, String>>();
|
|
||||||
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
|
|
||||||
var localVarFormParams = new Dictionary<String, String>();
|
|
||||||
var localVarFileParams = new Dictionary<String, FileParameter>();
|
|
||||||
Object localVarPostBody = null;
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
|
||||||
String[] localVarHttpContentTypes = new String[] {
|
|
||||||
"application/json",
|
|
||||||
"*_/ ' =end - - "
|
|
||||||
};
|
|
||||||
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
|
||||||
|
|
||||||
// to determine the Accept header
|
|
||||||
String[] localVarHttpHeaderAccepts = new String[] {
|
|
||||||
"application/json",
|
|
||||||
"*_/ ' =end - - "
|
|
||||||
};
|
|
||||||
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
|
||||||
if (localVarHttpHeaderAccept != null)
|
|
||||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
|
||||||
|
|
||||||
if (testCodeInjectEndRnNR != null) localVarFormParams.Add("test code inject */ ' " =end -- \r\n \n \r", this.Configuration.ApiClient.ParameterToString(testCodeInjectEndRnNR)); // form parameter
|
|
||||||
|
|
||||||
|
|
||||||
// make the HTTP request
|
|
||||||
IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
|
|
||||||
Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
|
|
||||||
localVarPathParams, localVarHttpContentType);
|
|
||||||
|
|
||||||
int localVarStatusCode = (int) localVarResponse.StatusCode;
|
|
||||||
|
|
||||||
if (ExceptionFactory != null)
|
|
||||||
{
|
|
||||||
Exception exception = ExceptionFactory("TestCodeInjectEndRnNR", localVarResponse);
|
|
||||||
if (exception != null) throw exception;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ApiResponse<Object>(localVarStatusCode,
|
|
||||||
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
|
|
||||||
null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// To test code injection *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
/// </summary>
|
|
||||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
|
||||||
/// <param name="testCodeInjectEndRnNR">To test code injection *_/ ' \" =end - - \\r\\n \\n \\r (optional)</param>
|
|
||||||
/// <returns>Task of void</returns>
|
|
||||||
public async System.Threading.Tasks.Task TestCodeInjectEndRnNRAsync (string testCodeInjectEndRnNR = null)
|
|
||||||
{
|
|
||||||
await TestCodeInjectEndRnNRAsyncWithHttpInfo(testCodeInjectEndRnNR);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// To test code injection *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
/// </summary>
|
|
||||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
|
||||||
/// <param name="testCodeInjectEndRnNR">To test code injection *_/ ' \" =end - - \\r\\n \\n \\r (optional)</param>
|
|
||||||
/// <returns>Task of ApiResponse</returns>
|
|
||||||
public async System.Threading.Tasks.Task<ApiResponse<Object>> TestCodeInjectEndRnNRAsyncWithHttpInfo (string testCodeInjectEndRnNR = null)
|
|
||||||
{
|
|
||||||
|
|
||||||
var localVarPath = "/fake";
|
|
||||||
var localVarPathParams = new Dictionary<String, String>();
|
|
||||||
var localVarQueryParams = new List<KeyValuePair<String, String>>();
|
|
||||||
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
|
|
||||||
var localVarFormParams = new Dictionary<String, String>();
|
|
||||||
var localVarFileParams = new Dictionary<String, FileParameter>();
|
|
||||||
Object localVarPostBody = null;
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
|
||||||
String[] localVarHttpContentTypes = new String[] {
|
|
||||||
"application/json",
|
|
||||||
"*_/ ' =end - - "
|
|
||||||
};
|
|
||||||
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
|
||||||
|
|
||||||
// to determine the Accept header
|
|
||||||
String[] localVarHttpHeaderAccepts = new String[] {
|
|
||||||
"application/json",
|
|
||||||
"*_/ ' =end - - "
|
|
||||||
};
|
|
||||||
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
|
||||||
if (localVarHttpHeaderAccept != null)
|
|
||||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
|
||||||
|
|
||||||
if (testCodeInjectEndRnNR != null) localVarFormParams.Add("test code inject */ ' " =end -- \r\n \n \r", this.Configuration.ApiClient.ParameterToString(testCodeInjectEndRnNR)); // form parameter
|
|
||||||
|
|
||||||
|
|
||||||
// make the HTTP request
|
|
||||||
IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
|
|
||||||
Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
|
|
||||||
localVarPathParams, localVarHttpContentType);
|
|
||||||
|
|
||||||
int localVarStatusCode = (int) localVarResponse.StatusCode;
|
|
||||||
|
|
||||||
if (ExceptionFactory != null)
|
|
||||||
{
|
|
||||||
Exception exception = ExceptionFactory("TestCodeInjectEndRnNR", localVarResponse);
|
|
||||||
if (exception != null) throw exception;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ApiResponse<Object>(localVarStatusCode,
|
|
||||||
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
|
|
||||||
null);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,530 +0,0 @@
|
|||||||
/*
|
|
||||||
* Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - -
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.IO;
|
|
||||||
using System.Web;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
|
||||||
using System.Text;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using RestSharp;
|
|
||||||
|
|
||||||
namespace IO.Swagger.Client
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// API client is mainly responsible for making the HTTP call to the API backend.
|
|
||||||
/// </summary>
|
|
||||||
public partial class ApiClient
|
|
||||||
{
|
|
||||||
private JsonSerializerSettings serializerSettings = new JsonSerializerSettings
|
|
||||||
{
|
|
||||||
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Allows for extending request processing for <see cref="ApiClient"/> generated code.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="request">The RestSharp request object</param>
|
|
||||||
partial void InterceptRequest(IRestRequest request);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Allows for extending response processing for <see cref="ApiClient"/> generated code.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="request">The RestSharp request object</param>
|
|
||||||
/// <param name="response">The RestSharp response object</param>
|
|
||||||
partial void InterceptResponse(IRestRequest request, IRestResponse response);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="ApiClient" /> class
|
|
||||||
/// with default configuration.
|
|
||||||
/// </summary>
|
|
||||||
public ApiClient()
|
|
||||||
{
|
|
||||||
Configuration = IO.Swagger.Client.Configuration.Default;
|
|
||||||
RestClient = new RestClient("https://petstore.swagger.io *_/ ' \" =end - - \\r\\n \\n \\r/v2 *_/ ' \" =end - - \\r\\n \\n \\r");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="ApiClient" /> class
|
|
||||||
/// with default base path (https://petstore.swagger.io *_/ ' \" =end - - \\r\\n \\n \\r/v2 *_/ ' \" =end - - \\r\\n \\n \\r).
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="config">An instance of Configuration.</param>
|
|
||||||
public ApiClient(Configuration config)
|
|
||||||
{
|
|
||||||
Configuration = config ?? IO.Swagger.Client.Configuration.Default;
|
|
||||||
|
|
||||||
RestClient = new RestClient(Configuration.BasePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="ApiClient" /> class
|
|
||||||
/// with default configuration.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="basePath">The base path.</param>
|
|
||||||
public ApiClient(String basePath = "https://petstore.swagger.io *_/ ' \" =end - - \\r\\n \\n \\r/v2 *_/ ' \" =end - - \\r\\n \\n \\r")
|
|
||||||
{
|
|
||||||
if (String.IsNullOrEmpty(basePath))
|
|
||||||
throw new ArgumentException("basePath cannot be empty");
|
|
||||||
|
|
||||||
RestClient = new RestClient(basePath);
|
|
||||||
Configuration = Client.Configuration.Default;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the default API client for making HTTP calls.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The default API client.</value>
|
|
||||||
[Obsolete("ApiClient.Default is deprecated, please use 'Configuration.Default.ApiClient' instead.")]
|
|
||||||
public static ApiClient Default;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets an instance of the IReadableConfiguration.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>An instance of the IReadableConfiguration.</value>
|
|
||||||
/// <remarks>
|
|
||||||
/// <see cref="IReadableConfiguration"/> helps us to avoid modifying possibly global
|
|
||||||
/// configuration values from within a given client. It does not guarantee thread-safety
|
|
||||||
/// of the <see cref="Configuration"/> instance in any way.
|
|
||||||
/// </remarks>
|
|
||||||
public IReadableConfiguration Configuration { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the RestClient.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>An instance of the RestClient</value>
|
|
||||||
public RestClient RestClient { get; set; }
|
|
||||||
|
|
||||||
// Creates and sets up a RestRequest prior to a call.
|
|
||||||
private RestRequest PrepareRequest(
|
|
||||||
String path, RestSharp.Method method, List<KeyValuePair<String, String>> queryParams, Object postBody,
|
|
||||||
Dictionary<String, String> headerParams, Dictionary<String, String> formParams,
|
|
||||||
Dictionary<String, FileParameter> fileParams, Dictionary<String, String> pathParams,
|
|
||||||
String contentType)
|
|
||||||
{
|
|
||||||
var request = new RestRequest(path, method);
|
|
||||||
|
|
||||||
// add path parameter, if any
|
|
||||||
foreach(var param in pathParams)
|
|
||||||
request.AddParameter(param.Key, param.Value, ParameterType.UrlSegment);
|
|
||||||
|
|
||||||
// add header parameter, if any
|
|
||||||
foreach(var param in headerParams)
|
|
||||||
request.AddHeader(param.Key, param.Value);
|
|
||||||
|
|
||||||
// add query parameter, if any
|
|
||||||
foreach(var param in queryParams)
|
|
||||||
request.AddQueryParameter(param.Key, param.Value);
|
|
||||||
|
|
||||||
// add form parameter, if any
|
|
||||||
foreach(var param in formParams)
|
|
||||||
request.AddParameter(param.Key, param.Value);
|
|
||||||
|
|
||||||
// add file parameter, if any
|
|
||||||
foreach(var param in fileParams)
|
|
||||||
{
|
|
||||||
request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentType);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (postBody != null) // http body (model or byte[]) parameter
|
|
||||||
{
|
|
||||||
request.AddParameter(contentType, postBody, ParameterType.RequestBody);
|
|
||||||
}
|
|
||||||
|
|
||||||
return request;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Makes the HTTP request (Sync).
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="path">URL path.</param>
|
|
||||||
/// <param name="method">HTTP method.</param>
|
|
||||||
/// <param name="queryParams">Query parameters.</param>
|
|
||||||
/// <param name="postBody">HTTP body (POST request).</param>
|
|
||||||
/// <param name="headerParams">Header parameters.</param>
|
|
||||||
/// <param name="formParams">Form parameters.</param>
|
|
||||||
/// <param name="fileParams">File parameters.</param>
|
|
||||||
/// <param name="pathParams">Path parameters.</param>
|
|
||||||
/// <param name="contentType">Content Type of the request</param>
|
|
||||||
/// <returns>Object</returns>
|
|
||||||
public Object CallApi(
|
|
||||||
String path, RestSharp.Method method, List<KeyValuePair<String, String>> queryParams, Object postBody,
|
|
||||||
Dictionary<String, String> headerParams, Dictionary<String, String> formParams,
|
|
||||||
Dictionary<String, FileParameter> fileParams, Dictionary<String, String> pathParams,
|
|
||||||
String contentType)
|
|
||||||
{
|
|
||||||
var request = PrepareRequest(
|
|
||||||
path, method, queryParams, postBody, headerParams, formParams, fileParams,
|
|
||||||
pathParams, contentType);
|
|
||||||
|
|
||||||
// set timeout
|
|
||||||
|
|
||||||
RestClient.Timeout = Configuration.Timeout;
|
|
||||||
// set user agent
|
|
||||||
RestClient.UserAgent = Configuration.UserAgent;
|
|
||||||
|
|
||||||
InterceptRequest(request);
|
|
||||||
var response = RestClient.Execute(request);
|
|
||||||
InterceptResponse(request, response);
|
|
||||||
|
|
||||||
return (Object) response;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Makes the asynchronous HTTP request.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="path">URL path.</param>
|
|
||||||
/// <param name="method">HTTP method.</param>
|
|
||||||
/// <param name="queryParams">Query parameters.</param>
|
|
||||||
/// <param name="postBody">HTTP body (POST request).</param>
|
|
||||||
/// <param name="headerParams">Header parameters.</param>
|
|
||||||
/// <param name="formParams">Form parameters.</param>
|
|
||||||
/// <param name="fileParams">File parameters.</param>
|
|
||||||
/// <param name="pathParams">Path parameters.</param>
|
|
||||||
/// <param name="contentType">Content type.</param>
|
|
||||||
/// <returns>The Task instance.</returns>
|
|
||||||
public async System.Threading.Tasks.Task<Object> CallApiAsync(
|
|
||||||
String path, RestSharp.Method method, List<KeyValuePair<String, String>> queryParams, Object postBody,
|
|
||||||
Dictionary<String, String> headerParams, Dictionary<String, String> formParams,
|
|
||||||
Dictionary<String, FileParameter> fileParams, Dictionary<String, String> pathParams,
|
|
||||||
String contentType)
|
|
||||||
{
|
|
||||||
var request = PrepareRequest(
|
|
||||||
path, method, queryParams, postBody, headerParams, formParams, fileParams,
|
|
||||||
pathParams, contentType);
|
|
||||||
InterceptRequest(request);
|
|
||||||
var response = await RestClient.ExecuteTaskAsync(request);
|
|
||||||
InterceptResponse(request, response);
|
|
||||||
return (Object)response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Escape string (url-encoded).
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="str">String to be escaped.</param>
|
|
||||||
/// <returns>Escaped string.</returns>
|
|
||||||
public string EscapeString(string str)
|
|
||||||
{
|
|
||||||
return UrlEncode(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create FileParameter based on Stream.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="name">Parameter name.</param>
|
|
||||||
/// <param name="stream">Input stream.</param>
|
|
||||||
/// <returns>FileParameter.</returns>
|
|
||||||
public FileParameter ParameterToFile(string name, Stream stream)
|
|
||||||
{
|
|
||||||
if (stream is FileStream)
|
|
||||||
return FileParameter.Create(name, ReadAsBytes(stream), Path.GetFileName(((FileStream)stream).Name));
|
|
||||||
else
|
|
||||||
return FileParameter.Create(name, ReadAsBytes(stream), "no_file_name_provided");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
|
|
||||||
/// If parameter is a list, join the list with ",".
|
|
||||||
/// Otherwise just return the string.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="obj">The parameter (header, path, query, form).</param>
|
|
||||||
/// <returns>Formatted string.</returns>
|
|
||||||
public string ParameterToString(object obj)
|
|
||||||
{
|
|
||||||
if (obj is DateTime)
|
|
||||||
// Return a formatted date string - Can be customized with Configuration.DateTimeFormat
|
|
||||||
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
|
|
||||||
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
|
||||||
// For example: 2009-06-15T13:45:30.0000000
|
|
||||||
return ((DateTime)obj).ToString (Configuration.DateTimeFormat);
|
|
||||||
else if (obj is DateTimeOffset)
|
|
||||||
// Return a formatted date string - Can be customized with Configuration.DateTimeFormat
|
|
||||||
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
|
|
||||||
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
|
||||||
// For example: 2009-06-15T13:45:30.0000000
|
|
||||||
return ((DateTimeOffset)obj).ToString (Configuration.DateTimeFormat);
|
|
||||||
else if (obj is IList)
|
|
||||||
{
|
|
||||||
var flattenedString = new StringBuilder();
|
|
||||||
foreach (var param in (IList)obj)
|
|
||||||
{
|
|
||||||
if (flattenedString.Length > 0)
|
|
||||||
flattenedString.Append(",");
|
|
||||||
flattenedString.Append(param);
|
|
||||||
}
|
|
||||||
return flattenedString.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return Convert.ToString (obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Deserialize the JSON string into a proper object.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="response">The HTTP response.</param>
|
|
||||||
/// <param name="type">Object type.</param>
|
|
||||||
/// <returns>Object representation of the JSON string.</returns>
|
|
||||||
public object Deserialize(IRestResponse response, Type type)
|
|
||||||
{
|
|
||||||
IList<Parameter> headers = response.Headers;
|
|
||||||
if (type == typeof(byte[])) // return byte array
|
|
||||||
{
|
|
||||||
return response.RawBytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: ? if (type.IsAssignableFrom(typeof(Stream)))
|
|
||||||
if (type == typeof(Stream))
|
|
||||||
{
|
|
||||||
if (headers != null)
|
|
||||||
{
|
|
||||||
var filePath = String.IsNullOrEmpty(Configuration.TempFolderPath)
|
|
||||||
? Path.GetTempPath()
|
|
||||||
: Configuration.TempFolderPath;
|
|
||||||
var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$");
|
|
||||||
foreach (var header in headers)
|
|
||||||
{
|
|
||||||
var match = regex.Match(header.ToString());
|
|
||||||
if (match.Success)
|
|
||||||
{
|
|
||||||
string fileName = filePath + SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", ""));
|
|
||||||
File.WriteAllBytes(fileName, response.RawBytes);
|
|
||||||
return new FileStream(fileName, FileMode.Open);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var stream = new MemoryStream(response.RawBytes);
|
|
||||||
return stream;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object
|
|
||||||
{
|
|
||||||
return DateTime.Parse(response.Content, null, System.Globalization.DateTimeStyles.RoundtripKind);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == typeof(String) || type.Name.StartsWith("System.Nullable")) // return primitive type
|
|
||||||
{
|
|
||||||
return ConvertType(response.Content, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
// at this point, it must be a model (json)
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return JsonConvert.DeserializeObject(response.Content, type, serializerSettings);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
throw new ApiException(500, e.Message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Serialize an input (model) into JSON string
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="obj">Object.</param>
|
|
||||||
/// <returns>JSON string.</returns>
|
|
||||||
public String Serialize(object obj)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return obj != null ? JsonConvert.SerializeObject(obj) : null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
throw new ApiException(500, e.Message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///Check if the given MIME is a JSON MIME.
|
|
||||||
///JSON MIME examples:
|
|
||||||
/// application/json
|
|
||||||
/// application/json; charset=UTF8
|
|
||||||
/// APPLICATION/JSON
|
|
||||||
/// application/vnd.company+json
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="mime">MIME</param>
|
|
||||||
/// <returns>Returns True if MIME type is json.</returns>
|
|
||||||
public bool IsJsonMime(String mime)
|
|
||||||
{
|
|
||||||
var jsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
|
||||||
return mime != null && (jsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Select the Content-Type header's value from the given content-type array:
|
|
||||||
/// if JSON type exists in the given array, use it;
|
|
||||||
/// otherwise use the first one defined in 'consumes'
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="contentTypes">The Content-Type array to select from.</param>
|
|
||||||
/// <returns>The Content-Type header to use.</returns>
|
|
||||||
public String SelectHeaderContentType(String[] contentTypes)
|
|
||||||
{
|
|
||||||
if (contentTypes.Length == 0)
|
|
||||||
return "application/json";
|
|
||||||
|
|
||||||
foreach (var contentType in contentTypes)
|
|
||||||
{
|
|
||||||
if (IsJsonMime(contentType.ToLower()))
|
|
||||||
return contentType;
|
|
||||||
}
|
|
||||||
|
|
||||||
return contentTypes[0]; // use the first content type specified in 'consumes'
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Select the Accept header's value from the given accepts array:
|
|
||||||
/// if JSON exists in the given array, use it;
|
|
||||||
/// otherwise use all of them (joining into a string)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="accepts">The accepts array to select from.</param>
|
|
||||||
/// <returns>The Accept header to use.</returns>
|
|
||||||
public String SelectHeaderAccept(String[] accepts)
|
|
||||||
{
|
|
||||||
if (accepts.Length == 0)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase))
|
|
||||||
return "application/json";
|
|
||||||
|
|
||||||
return String.Join(",", accepts);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Encode string in base64 format.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="text">String to be encoded.</param>
|
|
||||||
/// <returns>Encoded string.</returns>
|
|
||||||
public static string Base64Encode(string text)
|
|
||||||
{
|
|
||||||
return System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Dynamically cast the object into target type.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fromObject">Object to be casted</param>
|
|
||||||
/// <param name="toObject">Target type</param>
|
|
||||||
/// <returns>Casted object</returns>
|
|
||||||
public static dynamic ConvertType(dynamic fromObject, Type toObject)
|
|
||||||
{
|
|
||||||
return Convert.ChangeType(fromObject, toObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Convert stream to byte array
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="inputStream">Input stream to be converted</param>
|
|
||||||
/// <returns>Byte array</returns>
|
|
||||||
public static byte[] ReadAsBytes(Stream inputStream)
|
|
||||||
{
|
|
||||||
byte[] buf = new byte[16*1024];
|
|
||||||
using (MemoryStream ms = new MemoryStream())
|
|
||||||
{
|
|
||||||
int count;
|
|
||||||
while ((count = inputStream.Read(buf, 0, buf.Length)) > 0)
|
|
||||||
{
|
|
||||||
ms.Write(buf, 0, count);
|
|
||||||
}
|
|
||||||
return ms.ToArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// URL encode a string
|
|
||||||
/// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input">String to be URL encoded</param>
|
|
||||||
/// <returns>Byte array</returns>
|
|
||||||
public static string UrlEncode(string input)
|
|
||||||
{
|
|
||||||
const int maxLength = 32766;
|
|
||||||
|
|
||||||
if (input == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("input");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (input.Length <= maxLength)
|
|
||||||
{
|
|
||||||
return Uri.EscapeDataString(input);
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder(input.Length * 2);
|
|
||||||
int index = 0;
|
|
||||||
|
|
||||||
while (index < input.Length)
|
|
||||||
{
|
|
||||||
int length = Math.Min(input.Length - index, maxLength);
|
|
||||||
string subString = input.Substring(index, length);
|
|
||||||
|
|
||||||
sb.Append(Uri.EscapeDataString(subString));
|
|
||||||
index += subString.Length;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sanitize filename by removing the path
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="filename">Filename</param>
|
|
||||||
/// <returns>Filename</returns>
|
|
||||||
public static string SanitizeFilename(string filename)
|
|
||||||
{
|
|
||||||
Match match = Regex.Match(filename, @".*[/\\](.*)$");
|
|
||||||
|
|
||||||
if (match.Success)
|
|
||||||
{
|
|
||||||
return match.Groups[1].Value;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return filename;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Convert params to key/value pairs.
|
|
||||||
/// Use collectionFormat to properly format lists and collections.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="name">Key name.</param>
|
|
||||||
/// <param name="value">Value object.</param>
|
|
||||||
/// <returns>A list of KeyValuePairs</returns>
|
|
||||||
public IEnumerable<KeyValuePair<string, string>> ParameterToKeyValuePairs(string collectionFormat, string name, object value)
|
|
||||||
{
|
|
||||||
var parameters = new List<KeyValuePair<string, string>>();
|
|
||||||
|
|
||||||
if (IsCollection(value) && collectionFormat == "multi")
|
|
||||||
{
|
|
||||||
var valueCollection = value as IEnumerable;
|
|
||||||
parameters.AddRange(from object item in valueCollection select new KeyValuePair<string, string>(name, ParameterToString(item)));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
parameters.Add(new KeyValuePair<string, string>(name, ParameterToString(value)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return parameters;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Check if generic object is a collection.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="value"></param>
|
|
||||||
/// <returns>True if object is a collection type</returns>
|
|
||||||
private static bool IsCollection(object value)
|
|
||||||
{
|
|
||||||
return value is IList || value is ICollection;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
/*
|
|
||||||
* Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - -
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace IO.Swagger.Client
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// API Exception
|
|
||||||
/// </summary>
|
|
||||||
public class ApiException : Exception
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the error code (HTTP status code)
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The error code (HTTP status code).</value>
|
|
||||||
public int ErrorCode { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the error content (body json object)
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The error content (Http response body).</value>
|
|
||||||
public dynamic ErrorContent { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="ApiException"/> class.
|
|
||||||
/// </summary>
|
|
||||||
public ApiException() {}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="ApiException"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="errorCode">HTTP status code.</param>
|
|
||||||
/// <param name="message">Error message.</param>
|
|
||||||
public ApiException(int errorCode, string message) : base(message)
|
|
||||||
{
|
|
||||||
this.ErrorCode = errorCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="ApiException"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="errorCode">HTTP status code.</param>
|
|
||||||
/// <param name="message">Error message.</param>
|
|
||||||
/// <param name="errorContent">Error content.</param>
|
|
||||||
public ApiException(int errorCode, string message, dynamic errorContent = null) : base(message)
|
|
||||||
{
|
|
||||||
this.ErrorCode = errorCode;
|
|
||||||
this.ErrorContent = errorContent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
/*
|
|
||||||
* Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - -
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace IO.Swagger.Client
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// API Response
|
|
||||||
/// </summary>
|
|
||||||
public class ApiResponse<T>
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the status code (HTTP status code)
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The status code.</value>
|
|
||||||
public int StatusCode { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the HTTP headers
|
|
||||||
/// </summary>
|
|
||||||
/// <value>HTTP headers</value>
|
|
||||||
public IDictionary<string, string> Headers { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the data (parsed HTTP body)
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The data.</value>
|
|
||||||
public T Data { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="ApiResponse<T>" /> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="statusCode">HTTP status code.</param>
|
|
||||||
/// <param name="headers">HTTP headers.</param>
|
|
||||||
/// <param name="data">Data (parsed HTTP body)</param>
|
|
||||||
public ApiResponse(int statusCode, IDictionary<string, string> headers, T data)
|
|
||||||
{
|
|
||||||
this.StatusCode= statusCode;
|
|
||||||
this.Headers = headers;
|
|
||||||
this.Data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,453 +0,0 @@
|
|||||||
/*
|
|
||||||
* Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - -
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace IO.Swagger.Client
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a set of configuration settings
|
|
||||||
/// </summary>
|
|
||||||
public class Configuration : IReadableConfiguration
|
|
||||||
{
|
|
||||||
#region Constants
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Version of the package.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>Version of the package.</value>
|
|
||||||
public const string Version = "1.0.0";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Identifier for ISO 8601 DateTime Format
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information.</remarks>
|
|
||||||
// ReSharper disable once InconsistentNaming
|
|
||||||
public const string ISO8601_DATETIME_FORMAT = "o";
|
|
||||||
|
|
||||||
#endregion Constants
|
|
||||||
|
|
||||||
#region Static Members
|
|
||||||
|
|
||||||
private static readonly object GlobalConfigSync = new { };
|
|
||||||
private static Configuration _globalConfiguration;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Default creation of exceptions for a given method name and response object
|
|
||||||
/// </summary>
|
|
||||||
public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) =>
|
|
||||||
{
|
|
||||||
var status = (int)response.StatusCode;
|
|
||||||
if (status >= 400)
|
|
||||||
{
|
|
||||||
return new ApiException(status,
|
|
||||||
string.Format("Error calling {0}: {1}", methodName, response.Content),
|
|
||||||
response.Content);
|
|
||||||
}
|
|
||||||
if (status == 0)
|
|
||||||
{
|
|
||||||
return new ApiException(status,
|
|
||||||
string.Format("Error calling {0}: {1}", methodName, response.ErrorMessage), response.ErrorMessage);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the default Configuration.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>Configuration.</value>
|
|
||||||
public static Configuration Default
|
|
||||||
{
|
|
||||||
get { return _globalConfiguration; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
lock (GlobalConfigSync)
|
|
||||||
{
|
|
||||||
_globalConfiguration = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion Static Members
|
|
||||||
|
|
||||||
#region Private Members
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the API key based on the authentication name.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The API key.</value>
|
|
||||||
private IDictionary<string, string> _apiKey = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The prefix of the API key.</value>
|
|
||||||
private IDictionary<string, string> _apiKeyPrefix = null;
|
|
||||||
|
|
||||||
private string _dateTimeFormat = ISO8601_DATETIME_FORMAT;
|
|
||||||
private string _tempFolderPath = Path.GetTempPath();
|
|
||||||
|
|
||||||
#endregion Private Members
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
|
|
||||||
static Configuration()
|
|
||||||
{
|
|
||||||
_globalConfiguration = new GlobalConfiguration();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="Configuration" /> class
|
|
||||||
/// </summary>
|
|
||||||
public Configuration()
|
|
||||||
{
|
|
||||||
UserAgent = "Swagger-Codegen/1.0.0/csharp";
|
|
||||||
BasePath = "https://petstore.swagger.io *_/ ' \" =end - - \\r\\n \\n \\r/v2 *_/ ' \" =end - - \\r\\n \\n \\r";
|
|
||||||
DefaultHeader = new ConcurrentDictionary<string, string>();
|
|
||||||
ApiKey = new ConcurrentDictionary<string, string>();
|
|
||||||
ApiKeyPrefix = new ConcurrentDictionary<string, string>();
|
|
||||||
|
|
||||||
// Setting Timeout has side effects (forces ApiClient creation).
|
|
||||||
Timeout = 100000;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="Configuration" /> class
|
|
||||||
/// </summary>
|
|
||||||
public Configuration(
|
|
||||||
IDictionary<string, string> defaultHeader,
|
|
||||||
IDictionary<string, string> apiKey,
|
|
||||||
IDictionary<string, string> apiKeyPrefix,
|
|
||||||
string basePath = "https://petstore.swagger.io *_/ ' \" =end - - \\r\\n \\n \\r/v2 *_/ ' \" =end - - \\r\\n \\n \\r") : this()
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(basePath))
|
|
||||||
throw new ArgumentException("The provided basePath is invalid.", "basePath");
|
|
||||||
if (defaultHeader == null)
|
|
||||||
throw new ArgumentNullException("defaultHeader");
|
|
||||||
if (apiKey == null)
|
|
||||||
throw new ArgumentNullException("apiKey");
|
|
||||||
if (apiKeyPrefix == null)
|
|
||||||
throw new ArgumentNullException("apiKeyPrefix");
|
|
||||||
|
|
||||||
BasePath = basePath;
|
|
||||||
|
|
||||||
foreach (var keyValuePair in defaultHeader)
|
|
||||||
{
|
|
||||||
DefaultHeader.Add(keyValuePair);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var keyValuePair in apiKey)
|
|
||||||
{
|
|
||||||
ApiKey.Add(keyValuePair);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var keyValuePair in apiKeyPrefix)
|
|
||||||
{
|
|
||||||
ApiKeyPrefix.Add(keyValuePair);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="Configuration" /> class with different settings
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="apiClient">Api client</param>
|
|
||||||
/// <param name="defaultHeader">Dictionary of default HTTP header</param>
|
|
||||||
/// <param name="username">Username</param>
|
|
||||||
/// <param name="password">Password</param>
|
|
||||||
/// <param name="accessToken">accessToken</param>
|
|
||||||
/// <param name="apiKey">Dictionary of API key</param>
|
|
||||||
/// <param name="apiKeyPrefix">Dictionary of API key prefix</param>
|
|
||||||
/// <param name="tempFolderPath">Temp folder path</param>
|
|
||||||
/// <param name="dateTimeFormat">DateTime format string</param>
|
|
||||||
/// <param name="timeout">HTTP connection timeout (in milliseconds)</param>
|
|
||||||
/// <param name="userAgent">HTTP user agent</param>
|
|
||||||
[Obsolete("Use explicit object construction and setting of properties.", true)]
|
|
||||||
public Configuration(
|
|
||||||
// ReSharper disable UnusedParameter.Local
|
|
||||||
ApiClient apiClient = null,
|
|
||||||
IDictionary<string, string> defaultHeader = null,
|
|
||||||
string username = null,
|
|
||||||
string password = null,
|
|
||||||
string accessToken = null,
|
|
||||||
IDictionary<string, string> apiKey = null,
|
|
||||||
IDictionary<string, string> apiKeyPrefix = null,
|
|
||||||
string tempFolderPath = null,
|
|
||||||
string dateTimeFormat = null,
|
|
||||||
int timeout = 100000,
|
|
||||||
string userAgent = "Swagger-Codegen/1.0.0/csharp"
|
|
||||||
// ReSharper restore UnusedParameter.Local
|
|
||||||
)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the Configuration class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="apiClient">Api client.</param>
|
|
||||||
[Obsolete("This constructor caused unexpected sharing of static data. It is no longer supported.", true)]
|
|
||||||
// ReSharper disable once UnusedParameter.Local
|
|
||||||
public Configuration(ApiClient apiClient)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion Constructors
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
|
|
||||||
private ApiClient _apiClient = null;
|
|
||||||
/// <summary>
|
|
||||||
/// Gets an instance of an ApiClient for this configuration
|
|
||||||
/// </summary>
|
|
||||||
public virtual ApiClient ApiClient
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_apiClient == null) _apiClient = CreateApiClient();
|
|
||||||
return _apiClient;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String _basePath = null;
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the base path for API access.
|
|
||||||
/// </summary>
|
|
||||||
public virtual string BasePath {
|
|
||||||
get { return _basePath; }
|
|
||||||
set {
|
|
||||||
_basePath = value;
|
|
||||||
// pass-through to ApiClient if it's set.
|
|
||||||
if(_apiClient != null) {
|
|
||||||
_apiClient.RestClient.BaseUrl = new Uri(_basePath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the default header.
|
|
||||||
/// </summary>
|
|
||||||
public virtual IDictionary<string, string> DefaultHeader { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds.
|
|
||||||
/// </summary>
|
|
||||||
public virtual int Timeout
|
|
||||||
{
|
|
||||||
|
|
||||||
get { return ApiClient.RestClient.Timeout; }
|
|
||||||
set { ApiClient.RestClient.Timeout = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the HTTP user agent.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>Http user agent.</value>
|
|
||||||
public virtual string UserAgent { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the username (HTTP basic authentication).
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The username.</value>
|
|
||||||
public virtual string Username { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the password (HTTP basic authentication).
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The password.</value>
|
|
||||||
public virtual string Password { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the API key with prefix.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="apiKeyIdentifier">API key identifier (authentication scheme).</param>
|
|
||||||
/// <returns>API key with prefix.</returns>
|
|
||||||
public string GetApiKeyWithPrefix(string apiKeyIdentifier)
|
|
||||||
{
|
|
||||||
var apiKeyValue = "";
|
|
||||||
ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue);
|
|
||||||
var apiKeyPrefix = "";
|
|
||||||
if (ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix))
|
|
||||||
return apiKeyPrefix + " " + apiKeyValue;
|
|
||||||
else
|
|
||||||
return apiKeyValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the access token for OAuth2 authentication.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The access token.</value>
|
|
||||||
public virtual string AccessToken { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the temporary folder path to store the files downloaded from the server.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>Folder path.</value>
|
|
||||||
public virtual string TempFolderPath
|
|
||||||
{
|
|
||||||
get { return _tempFolderPath; }
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(value))
|
|
||||||
{
|
|
||||||
// Possible breaking change since swagger-codegen 2.2.1, enforce a valid temporary path on set.
|
|
||||||
_tempFolderPath = Path.GetTempPath();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create the directory if it does not exist
|
|
||||||
if (!Directory.Exists(value))
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if the path contains directory separator at the end
|
|
||||||
if (value[value.Length - 1] == Path.DirectorySeparatorChar)
|
|
||||||
{
|
|
||||||
_tempFolderPath = value;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_tempFolderPath = value + Path.DirectorySeparatorChar;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the date time format used when serializing in the ApiClient
|
|
||||||
/// By default, it's set to ISO 8601 - "o", for others see:
|
|
||||||
/// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx
|
|
||||||
/// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx
|
|
||||||
/// No validation is done to ensure that the string you're providing is valid
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The DateTimeFormat string</value>
|
|
||||||
public virtual string DateTimeFormat
|
|
||||||
{
|
|
||||||
get { return _dateTimeFormat; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(value))
|
|
||||||
{
|
|
||||||
// Never allow a blank or null string, go back to the default
|
|
||||||
_dateTimeFormat = ISO8601_DATETIME_FORMAT;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Caution, no validation when you choose date time format other than ISO 8601
|
|
||||||
// Take a look at the above links
|
|
||||||
_dateTimeFormat = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The prefix of the API key.</value>
|
|
||||||
public virtual IDictionary<string, string> ApiKeyPrefix
|
|
||||||
{
|
|
||||||
get { return _apiKeyPrefix; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("ApiKeyPrefix collection may not be null.");
|
|
||||||
}
|
|
||||||
_apiKeyPrefix = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the API key based on the authentication name.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The API key.</value>
|
|
||||||
public virtual IDictionary<string, string> ApiKey
|
|
||||||
{
|
|
||||||
get { return _apiKey; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("ApiKey collection may not be null.");
|
|
||||||
}
|
|
||||||
_apiKey = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion Properties
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add default header.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key">Header field name.</param>
|
|
||||||
/// <param name="value">Header field value.</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public void AddDefaultHeader(string key, string value)
|
|
||||||
{
|
|
||||||
DefaultHeader[key] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a new <see cref="ApiClient" /> based on this <see cref="Configuration" /> instance.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ApiClient CreateApiClient()
|
|
||||||
{
|
|
||||||
return new ApiClient(BasePath) { Configuration = this };
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a string with essential information for debugging.
|
|
||||||
/// </summary>
|
|
||||||
public static String ToDebugReport()
|
|
||||||
{
|
|
||||||
String report = "C# SDK (IO.Swagger) Debug Report:\n";
|
|
||||||
report += " OS: " + System.Environment.OSVersion + "\n";
|
|
||||||
report += " .NET Framework Version: " + System.Environment.Version + "\n";
|
|
||||||
report += " Version of the API: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r\n";
|
|
||||||
report += " SDK Package Version: 1.0.0\n";
|
|
||||||
|
|
||||||
return report;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add Api Key Header.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key">Api Key name.</param>
|
|
||||||
/// <param name="value">Api Key value.</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public void AddApiKey(string key, string value)
|
|
||||||
{
|
|
||||||
ApiKey[key] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets the API key prefix.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key">Api Key name.</param>
|
|
||||||
/// <param name="value">Api Key value.</param>
|
|
||||||
public void AddApiKeyPrefix(string key, string value)
|
|
||||||
{
|
|
||||||
ApiKeyPrefix[key] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion Methods
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
/*
|
|
||||||
* Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - -
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using RestSharp;
|
|
||||||
|
|
||||||
namespace IO.Swagger.Client
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A delegate to ExceptionFactory method
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="methodName">Method name</param>
|
|
||||||
/// <param name="response">Response</param>
|
|
||||||
/// <returns>Exceptions</returns>
|
|
||||||
public delegate Exception ExceptionFactory(string methodName, IRestResponse response);
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
* Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - -
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace IO.Swagger.Client
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// <see cref="GlobalConfiguration"/> provides a compile-time extension point for globally configuring
|
|
||||||
/// API Clients.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// A customized implementation via partial class may reside in another file and may
|
|
||||||
/// be excluded from automatic generation via a .swagger-codegen-ignore file.
|
|
||||||
/// </remarks>
|
|
||||||
public partial class GlobalConfiguration : Configuration
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - -
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
|
||||||
using RestSharp;
|
|
||||||
|
|
||||||
namespace IO.Swagger.Client
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Represents configuration aspects required to interact with the API endpoints.
|
|
||||||
/// </summary>
|
|
||||||
public interface IApiAccessor
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the configuration object
|
|
||||||
/// </summary>
|
|
||||||
/// <value>An instance of the Configuration</value>
|
|
||||||
Configuration Configuration {get; set;}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the base path of the API client.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The base path</value>
|
|
||||||
String GetBasePath();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Provides a factory method hook for the creation of exceptions.
|
|
||||||
/// </summary>
|
|
||||||
ExceptionFactory ExceptionFactory { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,94 +0,0 @@
|
|||||||
/*
|
|
||||||
* Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - -
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace IO.Swagger.Client
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a readable-only configuration contract.
|
|
||||||
/// </summary>
|
|
||||||
public interface IReadableConfiguration
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the access token.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>Access token.</value>
|
|
||||||
string AccessToken { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the API key.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>API key.</value>
|
|
||||||
IDictionary<string, string> ApiKey { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the API key prefix.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>API key prefix.</value>
|
|
||||||
IDictionary<string, string> ApiKeyPrefix { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the base path.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>Base path.</value>
|
|
||||||
string BasePath { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the date time format.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>Date time foramt.</value>
|
|
||||||
string DateTimeFormat { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the default header.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>Default header.</value>
|
|
||||||
IDictionary<string, string> DefaultHeader { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the temp folder path.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>Temp folder path.</value>
|
|
||||||
string TempFolderPath { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the HTTP connection timeout (in milliseconds)
|
|
||||||
/// </summary>
|
|
||||||
/// <value>HTTP connection timeout.</value>
|
|
||||||
int Timeout { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the user agent.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>User agent.</value>
|
|
||||||
string UserAgent { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the username.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>Username.</value>
|
|
||||||
string Username { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the password.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>Password.</value>
|
|
||||||
string Password { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the API key with prefix.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="apiKeyIdentifier">API key identifier (authentication scheme).</param>
|
|
||||||
/// <returns>API key with prefix.</returns>
|
|
||||||
string GetApiKeyWithPrefix(string apiKeyIdentifier);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - -
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
*/
|
|
||||||
|
|
||||||
using Newtonsoft.Json.Converters;
|
|
||||||
|
|
||||||
namespace IO.Swagger.Client
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Formatter for 'date' swagger formats ss defined by full-date - RFC3339
|
|
||||||
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types
|
|
||||||
/// </summary>
|
|
||||||
public class SwaggerDateConverter : IsoDateTimeConverter
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="SwaggerDateConverter" /> class.
|
|
||||||
/// </summary>
|
|
||||||
public SwaggerDateConverter()
|
|
||||||
{
|
|
||||||
// full-date = date-fullyear "-" date-month "-" date-mday
|
|
||||||
DateTimeFormat = "yyyy-MM-dd";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,78 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - -
|
|
||||||
|
|
||||||
OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
-->
|
|
||||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{8CE139DF-64BC-4591-85F8-8506C2B67514}</ProjectGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>IO.Swagger</RootNamespace>
|
|
||||||
<AssemblyName>IO.Swagger</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Runtime.Serialization" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
<Reference Include="Newtonsoft.Json">
|
|
||||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="JsonSubTypes">
|
|
||||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\packages')">..\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="RestSharp">
|
|
||||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\packages')">..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
|
|
||||||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="**\*.cs"
|
|
||||||
Exclude="obj\**" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="packages.config" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
</Project>
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
|
||||||
<metadata>
|
|
||||||
<!-- The identifier that must be unique within the hosting gallery -->
|
|
||||||
<id>$id$</id>
|
|
||||||
<title>Swagger Library</title>
|
|
||||||
|
|
||||||
<!-- The package version number that is used when resolving dependencies -->
|
|
||||||
<version>$version$</version>
|
|
||||||
|
|
||||||
<!-- Authors contain text that appears directly on the gallery -->
|
|
||||||
<authors>$author$</authors>
|
|
||||||
|
|
||||||
<!-- Owners are typically nuget.org identities that allow gallery
|
|
||||||
users to earily find other packages by the same owners. -->
|
|
||||||
<owners>$author$</owners>
|
|
||||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
|
||||||
<developmentDependency>false</developmentDependency>
|
|
||||||
|
|
||||||
<!-- The description can be used in package manager UI. Note that the
|
|
||||||
nuget.org gallery uses information you add in the portal. -->
|
|
||||||
<description>A library generated from a Swagger doc</description>
|
|
||||||
<copyright>http://swagger.io/terms/ *_/ ' \" =end - - \\r\\n \\n \\r</copyright>
|
|
||||||
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html *_/ ' \" =end - - \\r\\n \\n \\r</licenseUrl>
|
|
||||||
|
|
||||||
<!-- Dependencies are automatically installed when the package is installed -->
|
|
||||||
<dependencies>
|
|
||||||
|
|
||||||
<dependency id="NewtonSoft.Json" version="10.0.3" />
|
|
||||||
<dependency id="JsonSubTypes" version="1.2.0" />
|
|
||||||
<dependency id="RestSharp" version="105.1.0" />
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
</metadata>
|
|
||||||
<files>
|
|
||||||
|
|
||||||
<!-- A readme.txt will be displayed when the package is installed -->
|
|
||||||
<file src="..\..\README.md" target="" />
|
|
||||||
<file src="..\..\docs\**\*.*" target="docs" />
|
|
||||||
|
|
||||||
</files>
|
|
||||||
</package>
|
|
@ -1,125 +0,0 @@
|
|||||||
/*
|
|
||||||
* Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - -
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Newtonsoft.Json.Converters;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
|
|
||||||
|
|
||||||
namespace IO.Swagger.Model
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Model for testing reserved words *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
/// </summary>
|
|
||||||
[DataContract]
|
|
||||||
public partial class ModelReturn : IEquatable<ModelReturn>, IValidatableObject
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="ModelReturn" /> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="_Return">property description *_/ ' \" =end - - \\r\\n \\n \\r.</param>
|
|
||||||
public ModelReturn(int? _Return = default(int?))
|
|
||||||
{
|
|
||||||
this._Return = _Return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// property description *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
/// </summary>
|
|
||||||
/// <value>property description *_/ ' \" =end - - \\r\\n \\n \\r</value>
|
|
||||||
[DataMember(Name="return", EmitDefaultValue=false)]
|
|
||||||
public int? _Return { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the string presentation of the object
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>String presentation of the object</returns>
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
var sb = new StringBuilder();
|
|
||||||
sb.Append("class ModelReturn {\n");
|
|
||||||
sb.Append(" _Return: ").Append(_Return).Append("\n");
|
|
||||||
sb.Append("}\n");
|
|
||||||
return sb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the JSON string presentation of the object
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>JSON string presentation of the object</returns>
|
|
||||||
public virtual string ToJson()
|
|
||||||
{
|
|
||||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns true if objects are equal
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input">Object to be compared</param>
|
|
||||||
/// <returns>Boolean</returns>
|
|
||||||
public override bool Equals(object input)
|
|
||||||
{
|
|
||||||
return this.Equals(input as ModelReturn);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns true if ModelReturn instances are equal
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input">Instance of ModelReturn to be compared</param>
|
|
||||||
/// <returns>Boolean</returns>
|
|
||||||
public bool Equals(ModelReturn input)
|
|
||||||
{
|
|
||||||
if (input == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return
|
|
||||||
(
|
|
||||||
this._Return == input._Return ||
|
|
||||||
(this._Return != null &&
|
|
||||||
this._Return.Equals(input._Return))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the hash code
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Hash code</returns>
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
unchecked // Overflow is fine, just wrap
|
|
||||||
{
|
|
||||||
int hashCode = 41;
|
|
||||||
if (this._Return != null)
|
|
||||||
hashCode = hashCode * 59 + this._Return.GetHashCode();
|
|
||||||
return hashCode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// To validate all properties of the instance
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="validationContext">Validation context</param>
|
|
||||||
/// <returns>Validation Result</returns>
|
|
||||||
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
|
||||||
{
|
|
||||||
yield break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,125 +0,0 @@
|
|||||||
/*
|
|
||||||
* Swagger Petstore *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end - -
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Newtonsoft.Json.Converters;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
|
|
||||||
|
|
||||||
namespace IO.Swagger.Model
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Model for testing reserved words *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
/// </summary>
|
|
||||||
[DataContract]
|
|
||||||
public partial class Return : IEquatable<Return>, IValidatableObject
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="Return" /> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="_Return">property description *_/ ' \" =end - - \\r\\n \\n \\r.</param>
|
|
||||||
public Return(int? _Return = default(int?))
|
|
||||||
{
|
|
||||||
this._Return = _Return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// property description *_/ ' \" =end - - \\r\\n \\n \\r
|
|
||||||
/// </summary>
|
|
||||||
/// <value>property description *_/ ' \" =end - - \\r\\n \\n \\r</value>
|
|
||||||
[DataMember(Name="return", EmitDefaultValue=false)]
|
|
||||||
public int? _Return { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the string presentation of the object
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>String presentation of the object</returns>
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
var sb = new StringBuilder();
|
|
||||||
sb.Append("class Return {\n");
|
|
||||||
sb.Append(" _Return: ").Append(_Return).Append("\n");
|
|
||||||
sb.Append("}\n");
|
|
||||||
return sb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the JSON string presentation of the object
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>JSON string presentation of the object</returns>
|
|
||||||
public virtual string ToJson()
|
|
||||||
{
|
|
||||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns true if objects are equal
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input">Object to be compared</param>
|
|
||||||
/// <returns>Boolean</returns>
|
|
||||||
public override bool Equals(object input)
|
|
||||||
{
|
|
||||||
return this.Equals(input as Return);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns true if Return instances are equal
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input">Instance of Return to be compared</param>
|
|
||||||
/// <returns>Boolean</returns>
|
|
||||||
public bool Equals(Return input)
|
|
||||||
{
|
|
||||||
if (input == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return
|
|
||||||
(
|
|
||||||
this._Return == input._Return ||
|
|
||||||
(this._Return != null &&
|
|
||||||
this._Return.Equals(input._Return))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the hash code
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Hash code</returns>
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
unchecked // Overflow is fine, just wrap
|
|
||||||
{
|
|
||||||
int hashCode = 41;
|
|
||||||
if (this._Return != null)
|
|
||||||
hashCode = hashCode * 59 + this._Return.GetHashCode();
|
|
||||||
return hashCode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// To validate all properties of the instance
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="validationContext">Validation context</param>
|
|
||||||
/// <returns>Validation Result</returns>
|
|
||||||
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
|
||||||
{
|
|
||||||
yield break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("Swagger Library")]
|
|
||||||
[assembly: AssemblyDescription("A library generated from a Swagger doc")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("Swagger")]
|
|
||||||
[assembly: AssemblyProduct("SwaggerLibrary")]
|
|
||||||
[assembly: AssemblyCopyright("No Copyright")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0")]
|
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="RestSharp" version="105.1.0" targetFramework="net45" developmentDependency="true" />
|
|
||||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" developmentDependency="true" />
|
|
||||||
<package id="JsonSubTypes" version="1.2.0" targetFramework="net45" developmentDependency="true" />
|
|
||||||
</packages>
|
|
@ -1,24 +0,0 @@
|
|||||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
|
||||||
*.o
|
|
||||||
*.a
|
|
||||||
*.so
|
|
||||||
|
|
||||||
# Folders
|
|
||||||
_obj
|
|
||||||
_test
|
|
||||||
|
|
||||||
# Architecture specific extensions/prefixes
|
|
||||||
*.[568vq]
|
|
||||||
[568vq].out
|
|
||||||
|
|
||||||
*.cgo1.go
|
|
||||||
*.cgo2.c
|
|
||||||
_cgo_defun.c
|
|
||||||
_cgo_gotypes.go
|
|
||||||
_cgo_export.*
|
|
||||||
|
|
||||||
_testmain.go
|
|
||||||
|
|
||||||
*.exe
|
|
||||||
*.test
|
|
||||||
*.prof
|
|
@ -1,23 +0,0 @@
|
|||||||
# OpenAPI Generator Ignore
|
|
||||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
|
||||||
|
|
||||||
# Use this file to prevent files from being overwritten by the generator.
|
|
||||||
# The patterns follow closely to .gitignore or .dockerignore.
|
|
||||||
|
|
||||||
# As an example, the C# client generator defines ApiClient.cs.
|
|
||||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
|
||||||
#ApiClient.cs
|
|
||||||
|
|
||||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
|
||||||
#foo/*/qux
|
|
||||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
|
||||||
#foo/**/qux
|
|
||||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can also negate patterns with an exclamation (!).
|
|
||||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
|
||||||
#docs/*.md
|
|
||||||
# Then explicitly reverse the ignore rule for a single file:
|
|
||||||
#!docs/README.md
|
|
@ -1 +0,0 @@
|
|||||||
4.0.0-SNAPSHOT
|
|
@ -1,8 +0,0 @@
|
|||||||
language: go
|
|
||||||
|
|
||||||
install:
|
|
||||||
- go get -d -v .
|
|
||||||
|
|
||||||
script:
|
|
||||||
- go build -v ./
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
|||||||
# Go API client for openapi
|
|
||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.
|
|
||||||
|
|
||||||
- API version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
- Package version: 1.0.0
|
|
||||||
- Build package: org.openapitools.codegen.languages.GoClientCodegen
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
Install the following dependencies:
|
|
||||||
```
|
|
||||||
go get github.com/stretchr/testify/assert
|
|
||||||
go get golang.org/x/oauth2
|
|
||||||
go get golang.org/x/net/context
|
|
||||||
go get github.com/antihax/optional
|
|
||||||
```
|
|
||||||
|
|
||||||
Put the package under your project folder and add the following in import:
|
|
||||||
```golang
|
|
||||||
import "./openapi"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Documentation for API Endpoints
|
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r*
|
|
||||||
|
|
||||||
Class | Method | HTTP request | Description
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
*FakeApi* | [**TestCodeInjectEndRnNR**](docs/FakeApi.md#testcodeinjectendrnnr) | **Put** /fake | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
|
|
||||||
|
|
||||||
## Documentation For Models
|
|
||||||
|
|
||||||
- [Return](docs/Return.md)
|
|
||||||
|
|
||||||
|
|
||||||
## Documentation For Authorization
|
|
||||||
|
|
||||||
## api_key
|
|
||||||
- **Type**: API key
|
|
||||||
|
|
||||||
Example
|
|
||||||
```golang
|
|
||||||
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
|
|
||||||
Key: "APIKEY",
|
|
||||||
Prefix: "Bearer", // Omit if not necessary.
|
|
||||||
})
|
|
||||||
r, err := client.Service.Operation(auth, args)
|
|
||||||
```
|
|
||||||
## petstore_auth
|
|
||||||
- **Type**: OAuth
|
|
||||||
- **Flow**: implicit
|
|
||||||
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
|
|
||||||
- **Scopes**:
|
|
||||||
- **write:pets**: modify pets in your account *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
- **read:pets**: read your pets *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
|
|
||||||
Example
|
|
||||||
```golang
|
|
||||||
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
|
|
||||||
r, err := client.Service.Operation(auth, args)
|
|
||||||
```
|
|
||||||
|
|
||||||
Or via OAuth2 module to automatically refresh tokens and perform user authentication.
|
|
||||||
```golang
|
|
||||||
import "golang.org/x/oauth2"
|
|
||||||
|
|
||||||
/* Perform OAuth2 round trip request and obtain a token */
|
|
||||||
|
|
||||||
tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
|
|
||||||
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
|
|
||||||
r, err := client.Service.Operation(auth, args)
|
|
||||||
```
|
|
||||||
|
|
||||||
## Author
|
|
||||||
|
|
||||||
something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
|
|
@ -1,75 +0,0 @@
|
|||||||
openapi: 3.0.1
|
|
||||||
info:
|
|
||||||
contact:
|
|
||||||
email: something@something.abc */ ' " =end -- \r\n \n \r
|
|
||||||
description: "This spec is mainly for testing Petstore server and contains fake\
|
|
||||||
\ endpoints, models. Please do not use this for any other purpose. Special characters:\
|
|
||||||
\ \" \\ */ ' \" =end -- \r\n \n \r"
|
|
||||||
license:
|
|
||||||
name: Apache-2.0 */ ' " =end -- \r\n \n \r
|
|
||||||
url: http://www.apache.org/licenses/LICENSE-2.0.html */ ' " =end -- \r\n \n \r
|
|
||||||
termsOfService: http://url.to/terms/ */ ' " =end -- \r\n \n \r
|
|
||||||
title: OpenAPI Petstore */ ' " =end -- \r\n \n \r
|
|
||||||
version: 1.0.0 */ ' " =end -- \r\n \n \r
|
|
||||||
externalDocs:
|
|
||||||
description: Find out more about OpenAPI */ ' " =end -- \r\n \n \r
|
|
||||||
url: https://openapis.org
|
|
||||||
servers:
|
|
||||||
- url: //petstore.swagger.io */ ' " =end -- \r\n \n \r/v2 */ ' " =end -- \r\n \n \r
|
|
||||||
tags:
|
|
||||||
- description: Everything about your Pets */ ' " =end -- \r\n \n \r
|
|
||||||
externalDocs:
|
|
||||||
description: Find out more */ ' " =end -- \r\n \n \r
|
|
||||||
url: https://openapis.org
|
|
||||||
name: fake
|
|
||||||
paths:
|
|
||||||
/fake:
|
|
||||||
put:
|
|
||||||
description: To test code injection */ ' " =end -- \r\n \n \r
|
|
||||||
operationId: testCodeInject */ ' " =end -- \r\n \n \r
|
|
||||||
requestBody:
|
|
||||||
content:
|
|
||||||
application/x-www-form-urlencoded:
|
|
||||||
schema:
|
|
||||||
properties:
|
|
||||||
test code inject */ ' " =end -- \r\n \n \r:
|
|
||||||
description: To test code injection */ ' " =end -- \r\n \n \r
|
|
||||||
type: string
|
|
||||||
? "*/ ' \" =end -- \r\n \n \r"
|
|
||||||
: schema:
|
|
||||||
properties:
|
|
||||||
test code inject */ ' " =end -- \r\n \n \r:
|
|
||||||
description: To test code injection */ ' " =end -- \r\n \n \r
|
|
||||||
type: string
|
|
||||||
responses:
|
|
||||||
400:
|
|
||||||
content: {}
|
|
||||||
description: To test code injection */ ' " =end -- \r\n \n \r
|
|
||||||
summary: To test code injection */ ' " =end -- \r\n \n \r
|
|
||||||
tags:
|
|
||||||
- fake
|
|
||||||
components:
|
|
||||||
schemas:
|
|
||||||
Return:
|
|
||||||
description: Model for testing reserved words */ ' " =end -- \r\n \n \r
|
|
||||||
properties:
|
|
||||||
return:
|
|
||||||
description: property description */ ' " =end -- \r\n \n \r
|
|
||||||
format: int32
|
|
||||||
type: integer
|
|
||||||
type: object
|
|
||||||
xml:
|
|
||||||
name: Return
|
|
||||||
securitySchemes:
|
|
||||||
petstore_auth:
|
|
||||||
flows:
|
|
||||||
implicit:
|
|
||||||
authorizationUrl: http://petstore.swagger.io/api/oauth/dialog
|
|
||||||
scopes:
|
|
||||||
write:pets: modify pets in your account */ ' " =end -- \r\n \n \r
|
|
||||||
read:pets: read your pets */ ' " =end -- \r\n \n \r
|
|
||||||
type: oauth2
|
|
||||||
api_key:
|
|
||||||
in: header
|
|
||||||
name: api_key */ ' " =end -- \r\n \n \r
|
|
||||||
type: apiKey
|
|
@ -1,102 +0,0 @@
|
|||||||
/*
|
|
||||||
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
|
||||||
*
|
|
||||||
* API version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
|
||||||
*/
|
|
||||||
|
|
||||||
package openapi
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
|
||||||
"net/url"
|
|
||||||
"strings"
|
|
||||||
"github.com/antihax/optional"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Linger please
|
|
||||||
var (
|
|
||||||
_ context.Context
|
|
||||||
)
|
|
||||||
|
|
||||||
type FakeApiService service
|
|
||||||
|
|
||||||
/*
|
|
||||||
FakeApiService To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
||||||
* @param optional nil or *TestCodeInjectEndRnNROpts - Optional Parameters:
|
|
||||||
* @param "TestCodeInjectEndRnNR" (optional.String) - To test code injection *_/ ' \\\" =end -- \\\\r\\\\n \\\\n \\\\r
|
|
||||||
*/
|
|
||||||
|
|
||||||
type TestCodeInjectEndRnNROpts struct {
|
|
||||||
TestCodeInjectEndRnNR optional.String
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *FakeApiService) TestCodeInjectEndRnNR(ctx context.Context, localVarOptionals *TestCodeInjectEndRnNROpts) (*http.Response, error) {
|
|
||||||
var (
|
|
||||||
localVarHttpMethod = strings.ToUpper("Put")
|
|
||||||
localVarPostBody interface{}
|
|
||||||
localVarFormFileName string
|
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
localVarPath := a.client.cfg.BasePath + "/fake"
|
|
||||||
|
|
||||||
localVarHeaderParams := make(map[string]string)
|
|
||||||
localVarQueryParams := url.Values{}
|
|
||||||
localVarFormParams := url.Values{}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
|
||||||
localVarHttpContentTypes := []string{"application/x-www-form-urlencoded", "*_/ ' =end -- "}
|
|
||||||
|
|
||||||
// set Content-Type header
|
|
||||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
||||||
if localVarHttpContentType != "" {
|
|
||||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Accept header
|
|
||||||
localVarHttpHeaderAccepts := []string{}
|
|
||||||
|
|
||||||
// set Accept header
|
|
||||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
||||||
if localVarHttpHeaderAccept != "" {
|
|
||||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
||||||
}
|
|
||||||
if localVarOptionals != nil && localVarOptionals.TestCodeInjectEndRnNR.IsSet() {
|
|
||||||
localVarFormParams.Add("test code inject */ ' " =end -- \r\n \n \r", parameterToString(localVarOptionals.TestCodeInjectEndRnNR.Value(), ""))
|
|
||||||
}
|
|
||||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
localVarHttpResponse, err := a.client.callAPI(r)
|
|
||||||
if err != nil || localVarHttpResponse == nil {
|
|
||||||
return localVarHttpResponse, err
|
|
||||||
}
|
|
||||||
|
|
||||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
||||||
localVarHttpResponse.Body.Close()
|
|
||||||
if err != nil {
|
|
||||||
return localVarHttpResponse, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if localVarHttpResponse.StatusCode >= 300 {
|
|
||||||
newErr := GenericOpenAPIError{
|
|
||||||
body: localVarBody,
|
|
||||||
error: localVarHttpResponse.Status,
|
|
||||||
}
|
|
||||||
return localVarHttpResponse, newErr
|
|
||||||
}
|
|
||||||
|
|
||||||
return localVarHttpResponse, nil
|
|
||||||
}
|
|
@ -1,480 +0,0 @@
|
|||||||
/*
|
|
||||||
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
|
||||||
*
|
|
||||||
* API version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
|
||||||
*/
|
|
||||||
|
|
||||||
package openapi
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"context"
|
|
||||||
"encoding/json"
|
|
||||||
"encoding/xml"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"mime/multipart"
|
|
||||||
"net/http"
|
|
||||||
"net/url"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"reflect"
|
|
||||||
"regexp"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
"unicode/utf8"
|
|
||||||
|
|
||||||
"golang.org/x/oauth2"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`)
|
|
||||||
xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`)
|
|
||||||
)
|
|
||||||
|
|
||||||
// APIClient manages communication with the OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r API v1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
// In most cases there should be only one, shared, APIClient.
|
|
||||||
type APIClient struct {
|
|
||||||
cfg *Configuration
|
|
||||||
common service // Reuse a single struct instead of allocating one for each service on the heap.
|
|
||||||
|
|
||||||
// API Services
|
|
||||||
|
|
||||||
FakeApi *FakeApiService
|
|
||||||
}
|
|
||||||
|
|
||||||
type service struct {
|
|
||||||
client *APIClient
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewAPIClient creates a new API client. Requires a userAgent string describing your application.
|
|
||||||
// optionally a custom http.Client to allow for advanced features such as caching.
|
|
||||||
func NewAPIClient(cfg *Configuration) *APIClient {
|
|
||||||
if cfg.HTTPClient == nil {
|
|
||||||
cfg.HTTPClient = http.DefaultClient
|
|
||||||
}
|
|
||||||
|
|
||||||
c := &APIClient{}
|
|
||||||
c.cfg = cfg
|
|
||||||
c.common.client = c
|
|
||||||
|
|
||||||
// API Services
|
|
||||||
c.FakeApi = (*FakeApiService)(&c.common)
|
|
||||||
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
|
|
||||||
func atoi(in string) (int, error) {
|
|
||||||
return strconv.Atoi(in)
|
|
||||||
}
|
|
||||||
|
|
||||||
// selectHeaderContentType select a content type from the available list.
|
|
||||||
func selectHeaderContentType(contentTypes []string) string {
|
|
||||||
if len(contentTypes) == 0 {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
if contains(contentTypes, "application/json") {
|
|
||||||
return "application/json"
|
|
||||||
}
|
|
||||||
return contentTypes[0] // use the first content type specified in 'consumes'
|
|
||||||
}
|
|
||||||
|
|
||||||
// selectHeaderAccept join all accept types and return
|
|
||||||
func selectHeaderAccept(accepts []string) string {
|
|
||||||
if len(accepts) == 0 {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if contains(accepts, "application/json") {
|
|
||||||
return "application/json"
|
|
||||||
}
|
|
||||||
|
|
||||||
return strings.Join(accepts, ",")
|
|
||||||
}
|
|
||||||
|
|
||||||
// contains is a case insenstive match, finding needle in a haystack
|
|
||||||
func contains(haystack []string, needle string) bool {
|
|
||||||
for _, a := range haystack {
|
|
||||||
if strings.ToLower(a) == strings.ToLower(needle) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verify optional parameters are of the correct type.
|
|
||||||
func typeCheckParameter(obj interface{}, expected string, name string) error {
|
|
||||||
// Make sure there is an object.
|
|
||||||
if obj == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check the type is as expected.
|
|
||||||
if reflect.TypeOf(obj).String() != expected {
|
|
||||||
return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String())
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// parameterToString convert interface{} parameters to string, using a delimiter if format is provided.
|
|
||||||
func parameterToString(obj interface{}, collectionFormat string) string {
|
|
||||||
var delimiter string
|
|
||||||
|
|
||||||
switch collectionFormat {
|
|
||||||
case "pipes":
|
|
||||||
delimiter = "|"
|
|
||||||
case "ssv":
|
|
||||||
delimiter = " "
|
|
||||||
case "tsv":
|
|
||||||
delimiter = "\t"
|
|
||||||
case "csv":
|
|
||||||
delimiter = ","
|
|
||||||
}
|
|
||||||
|
|
||||||
if reflect.TypeOf(obj).Kind() == reflect.Slice {
|
|
||||||
return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]")
|
|
||||||
} else if t, ok := obj.(time.Time); ok {
|
|
||||||
return t.Format(time.RFC3339)
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmt.Sprintf("%v", obj)
|
|
||||||
}
|
|
||||||
|
|
||||||
// callAPI do the request.
|
|
||||||
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
|
|
||||||
return c.cfg.HTTPClient.Do(request)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Change base path to allow switching to mocks
|
|
||||||
func (c *APIClient) ChangeBasePath(path string) {
|
|
||||||
c.cfg.BasePath = path
|
|
||||||
}
|
|
||||||
|
|
||||||
// prepareRequest build the request
|
|
||||||
func (c *APIClient) prepareRequest(
|
|
||||||
ctx context.Context,
|
|
||||||
path string, method string,
|
|
||||||
postBody interface{},
|
|
||||||
headerParams map[string]string,
|
|
||||||
queryParams url.Values,
|
|
||||||
formParams url.Values,
|
|
||||||
formFileName string,
|
|
||||||
fileName string,
|
|
||||||
fileBytes []byte) (localVarRequest *http.Request, err error) {
|
|
||||||
|
|
||||||
var body *bytes.Buffer
|
|
||||||
|
|
||||||
// Detect postBody type and post.
|
|
||||||
if postBody != nil {
|
|
||||||
contentType := headerParams["Content-Type"]
|
|
||||||
if contentType == "" {
|
|
||||||
contentType = detectContentType(postBody)
|
|
||||||
headerParams["Content-Type"] = contentType
|
|
||||||
}
|
|
||||||
|
|
||||||
body, err = setBody(postBody, contentType)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// add form parameters and file if available.
|
|
||||||
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") {
|
|
||||||
if body != nil {
|
|
||||||
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
|
|
||||||
}
|
|
||||||
body = &bytes.Buffer{}
|
|
||||||
w := multipart.NewWriter(body)
|
|
||||||
|
|
||||||
for k, v := range formParams {
|
|
||||||
for _, iv := range v {
|
|
||||||
if strings.HasPrefix(k, "@") { // file
|
|
||||||
err = addFile(w, k[1:], iv)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
} else { // form value
|
|
||||||
w.WriteField(k, iv)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(fileBytes) > 0 && fileName != "" {
|
|
||||||
w.Boundary()
|
|
||||||
//_, fileNm := filepath.Split(fileName)
|
|
||||||
part, err := w.CreateFormFile(formFileName, filepath.Base(fileName))
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
_, err = part.Write(fileBytes)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
// Set the Boundary in the Content-Type
|
|
||||||
headerParams["Content-Type"] = w.FormDataContentType()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set Content-Length
|
|
||||||
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
|
|
||||||
w.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 {
|
|
||||||
if body != nil {
|
|
||||||
return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.")
|
|
||||||
}
|
|
||||||
body = &bytes.Buffer{}
|
|
||||||
body.WriteString(formParams.Encode())
|
|
||||||
// Set Content-Length
|
|
||||||
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup path and query parameters
|
|
||||||
url, err := url.Parse(path)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adding Query Param
|
|
||||||
query := url.Query()
|
|
||||||
for k, v := range queryParams {
|
|
||||||
for _, iv := range v {
|
|
||||||
query.Add(k, iv)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Encode the parameters.
|
|
||||||
url.RawQuery = query.Encode()
|
|
||||||
|
|
||||||
// Generate a new request
|
|
||||||
if body != nil {
|
|
||||||
localVarRequest, err = http.NewRequest(method, url.String(), body)
|
|
||||||
} else {
|
|
||||||
localVarRequest, err = http.NewRequest(method, url.String(), nil)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// add header parameters, if any
|
|
||||||
if len(headerParams) > 0 {
|
|
||||||
headers := http.Header{}
|
|
||||||
for h, v := range headerParams {
|
|
||||||
headers.Set(h, v)
|
|
||||||
}
|
|
||||||
localVarRequest.Header = headers
|
|
||||||
}
|
|
||||||
|
|
||||||
// Override request host, if applicable
|
|
||||||
if c.cfg.Host != "" {
|
|
||||||
localVarRequest.Host = c.cfg.Host
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the user agent to the request.
|
|
||||||
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
|
|
||||||
|
|
||||||
if ctx != nil {
|
|
||||||
// add context to the request
|
|
||||||
localVarRequest = localVarRequest.WithContext(ctx)
|
|
||||||
|
|
||||||
// Walk through any authentication.
|
|
||||||
|
|
||||||
// OAuth2 authentication
|
|
||||||
if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok {
|
|
||||||
// We were able to grab an oauth2 token from the context
|
|
||||||
var latestToken *oauth2.Token
|
|
||||||
if latestToken, err = tok.Token(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
latestToken.SetAuthHeader(localVarRequest)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Basic HTTP Authentication
|
|
||||||
if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok {
|
|
||||||
localVarRequest.SetBasicAuth(auth.UserName, auth.Password)
|
|
||||||
}
|
|
||||||
|
|
||||||
// AccessToken Authentication
|
|
||||||
if auth, ok := ctx.Value(ContextAccessToken).(string); ok {
|
|
||||||
localVarRequest.Header.Add("Authorization", "Bearer "+auth)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for header, value := range c.cfg.DefaultHeader {
|
|
||||||
localVarRequest.Header.Add(header, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
return localVarRequest, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
|
|
||||||
if xmlCheck.MatchString(contentType) {
|
|
||||||
if err = xml.Unmarshal(b, v); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if jsonCheck.MatchString(contentType) {
|
|
||||||
if err = json.Unmarshal(b, v); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return errors.New("undefined response type")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add a file to the multipart request
|
|
||||||
func addFile(w *multipart.Writer, fieldName, path string) error {
|
|
||||||
file, err := os.Open(path)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer file.Close()
|
|
||||||
|
|
||||||
part, err := w.CreateFormFile(fieldName, filepath.Base(path))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
_, err = io.Copy(part, file)
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prevent trying to import "fmt"
|
|
||||||
func reportError(format string, a ...interface{}) error {
|
|
||||||
return fmt.Errorf(format, a...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set request body from an interface{}
|
|
||||||
func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) {
|
|
||||||
if bodyBuf == nil {
|
|
||||||
bodyBuf = &bytes.Buffer{}
|
|
||||||
}
|
|
||||||
|
|
||||||
if reader, ok := body.(io.Reader); ok {
|
|
||||||
_, err = bodyBuf.ReadFrom(reader)
|
|
||||||
} else if b, ok := body.([]byte); ok {
|
|
||||||
_, err = bodyBuf.Write(b)
|
|
||||||
} else if s, ok := body.(string); ok {
|
|
||||||
_, err = bodyBuf.WriteString(s)
|
|
||||||
} else if s, ok := body.(*string); ok {
|
|
||||||
_, err = bodyBuf.WriteString(*s)
|
|
||||||
} else if jsonCheck.MatchString(contentType) {
|
|
||||||
err = json.NewEncoder(bodyBuf).Encode(body)
|
|
||||||
} else if xmlCheck.MatchString(contentType) {
|
|
||||||
xml.NewEncoder(bodyBuf).Encode(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if bodyBuf.Len() == 0 {
|
|
||||||
err = fmt.Errorf("Invalid body type %s\n", contentType)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return bodyBuf, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// detectContentType method is used to figure out `Request.Body` content type for request header
|
|
||||||
func detectContentType(body interface{}) string {
|
|
||||||
contentType := "text/plain; charset=utf-8"
|
|
||||||
kind := reflect.TypeOf(body).Kind()
|
|
||||||
|
|
||||||
switch kind {
|
|
||||||
case reflect.Struct, reflect.Map, reflect.Ptr:
|
|
||||||
contentType = "application/json; charset=utf-8"
|
|
||||||
case reflect.String:
|
|
||||||
contentType = "text/plain; charset=utf-8"
|
|
||||||
default:
|
|
||||||
if b, ok := body.([]byte); ok {
|
|
||||||
contentType = http.DetectContentType(b)
|
|
||||||
} else if kind == reflect.Slice {
|
|
||||||
contentType = "application/json; charset=utf-8"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return contentType
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
|
|
||||||
type cacheControl map[string]string
|
|
||||||
|
|
||||||
func parseCacheControl(headers http.Header) cacheControl {
|
|
||||||
cc := cacheControl{}
|
|
||||||
ccHeader := headers.Get("Cache-Control")
|
|
||||||
for _, part := range strings.Split(ccHeader, ",") {
|
|
||||||
part = strings.Trim(part, " ")
|
|
||||||
if part == "" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if strings.ContainsRune(part, '=') {
|
|
||||||
keyval := strings.Split(part, "=")
|
|
||||||
cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",")
|
|
||||||
} else {
|
|
||||||
cc[part] = ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return cc
|
|
||||||
}
|
|
||||||
|
|
||||||
// CacheExpires helper function to determine remaining time before repeating a request.
|
|
||||||
func CacheExpires(r *http.Response) time.Time {
|
|
||||||
// Figure out when the cache expires.
|
|
||||||
var expires time.Time
|
|
||||||
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
|
|
||||||
if err != nil {
|
|
||||||
return time.Now()
|
|
||||||
}
|
|
||||||
respCacheControl := parseCacheControl(r.Header)
|
|
||||||
|
|
||||||
if maxAge, ok := respCacheControl["max-age"]; ok {
|
|
||||||
lifetime, err := time.ParseDuration(maxAge + "s")
|
|
||||||
if err != nil {
|
|
||||||
expires = now
|
|
||||||
} else {
|
|
||||||
expires = now.Add(lifetime)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
expiresHeader := r.Header.Get("Expires")
|
|
||||||
if expiresHeader != "" {
|
|
||||||
expires, err = time.Parse(time.RFC1123, expiresHeader)
|
|
||||||
if err != nil {
|
|
||||||
expires = now
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return expires
|
|
||||||
}
|
|
||||||
|
|
||||||
func strlen(s string) int {
|
|
||||||
return utf8.RuneCountInString(s)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GenericOpenAPIError Provides access to the body, error and model on returned errors.
|
|
||||||
type GenericOpenAPIError struct {
|
|
||||||
body []byte
|
|
||||||
error string
|
|
||||||
model interface{}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error returns non-empty string if there was an error.
|
|
||||||
func (e GenericOpenAPIError) Error() string {
|
|
||||||
return e.error
|
|
||||||
}
|
|
||||||
|
|
||||||
// Body returns the raw bytes of the response
|
|
||||||
func (e GenericOpenAPIError) Body() []byte {
|
|
||||||
return e.body
|
|
||||||
}
|
|
||||||
|
|
||||||
// Model returns the unpacked model of the error
|
|
||||||
func (e GenericOpenAPIError) Model() interface{} {
|
|
||||||
return e.model
|
|
||||||
}
|
|
@ -1,73 +0,0 @@
|
|||||||
/*
|
|
||||||
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
|
||||||
*
|
|
||||||
* API version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
|
||||||
*/
|
|
||||||
|
|
||||||
package openapi
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
// contextKeys are used to identify the type of value in the context.
|
|
||||||
// Since these are string, it is possible to get a short description of the
|
|
||||||
// context key for logging and debugging using key.String().
|
|
||||||
|
|
||||||
type contextKey string
|
|
||||||
|
|
||||||
func (c contextKey) String() string {
|
|
||||||
return "auth " + string(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
|
|
||||||
ContextOAuth2 = contextKey("token")
|
|
||||||
|
|
||||||
// ContextBasicAuth takes BasicAuth as authentication for the request.
|
|
||||||
ContextBasicAuth = contextKey("basic")
|
|
||||||
|
|
||||||
// ContextAccessToken takes a string oauth2 access token as authentication for the request.
|
|
||||||
ContextAccessToken = contextKey("accesstoken")
|
|
||||||
|
|
||||||
// ContextAPIKey takes an APIKey as authentication for the request
|
|
||||||
ContextAPIKey = contextKey("apikey")
|
|
||||||
)
|
|
||||||
|
|
||||||
// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
|
|
||||||
type BasicAuth struct {
|
|
||||||
UserName string `json:"userName,omitempty"`
|
|
||||||
Password string `json:"password,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
|
|
||||||
type APIKey struct {
|
|
||||||
Key string
|
|
||||||
Prefix string
|
|
||||||
}
|
|
||||||
|
|
||||||
type Configuration struct {
|
|
||||||
BasePath string `json:"basePath,omitempty"`
|
|
||||||
Host string `json:"host,omitempty"`
|
|
||||||
Scheme string `json:"scheme,omitempty"`
|
|
||||||
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
|
||||||
UserAgent string `json:"userAgent,omitempty"`
|
|
||||||
HTTPClient *http.Client
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewConfiguration() *Configuration {
|
|
||||||
cfg := &Configuration{
|
|
||||||
BasePath: "http://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r",
|
|
||||||
DefaultHeader: make(map[string]string),
|
|
||||||
UserAgent: "OpenAPI-Generator/1.0.0/go",
|
|
||||||
}
|
|
||||||
return cfg
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Configuration) AddDefaultHeader(key string, value string) {
|
|
||||||
c.DefaultHeader[key] = value
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
# \FakeApi
|
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r*
|
|
||||||
|
|
||||||
Method | HTTP request | Description
|
|
||||||
------------- | ------------- | -------------
|
|
||||||
[**TestCodeInjectEndRnNR**](FakeApi.md#TestCodeInjectEndRnNR) | **Put** /fake | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
|
|
||||||
|
|
||||||
# **TestCodeInjectEndRnNR**
|
|
||||||
> TestCodeInjectEndRnNR(ctx, optional)
|
|
||||||
To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
|
|
||||||
To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
|
|
||||||
### Required Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
|
||||||
**optional** | ***TestCodeInjectEndRnNROpts** | optional parameters | nil if no parameters
|
|
||||||
|
|
||||||
### Optional Parameters
|
|
||||||
Optional parameters are passed through a pointer to a TestCodeInjectEndRnNROpts struct
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**testCodeInjectEndRnNR** | **optional.String**| To test code injection *_/ ' \\\" =end -- \\\\r\\\\n \\\\n \\\\r |
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
(empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: application/x-www-form-urlencoded, *_/ ' =end --
|
|
||||||
- **Accept**: Not defined
|
|
||||||
|
|
||||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
|||||||
# Return
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**Return** | **int32** | property description *_/ ' \" =end -- \\r\\n \\n \\r | [optional]
|
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
||||||
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
|
||||||
#
|
|
||||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
|
|
||||||
|
|
||||||
git_user_id=$1
|
|
||||||
git_repo_id=$2
|
|
||||||
release_note=$3
|
|
||||||
|
|
||||||
if [ "$git_user_id" = "" ]; then
|
|
||||||
git_user_id="GIT_USER_ID"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$git_repo_id" = "" ]; then
|
|
||||||
git_repo_id="GIT_REPO_ID"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$release_note" = "" ]; then
|
|
||||||
release_note="Minor update"
|
|
||||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Initialize the local directory as a Git repository
|
|
||||||
git init
|
|
||||||
|
|
||||||
# Adds the files in the local repository and stages them for commit.
|
|
||||||
git add .
|
|
||||||
|
|
||||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
|
||||||
git commit -m "$release_note"
|
|
||||||
|
|
||||||
# Sets the new remote
|
|
||||||
git_remote=`git remote`
|
|
||||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
|
||||||
|
|
||||||
if [ "$GIT_TOKEN" = "" ]; then
|
|
||||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
|
||||||
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
|
||||||
else
|
|
||||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
git pull origin master
|
|
||||||
|
|
||||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
|
||||||
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
|
||||||
git push origin master 2>&1 | grep -v 'To https'
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
/*
|
|
||||||
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
|
||||||
*
|
|
||||||
* API version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
|
||||||
*/
|
|
||||||
|
|
||||||
package openapi
|
|
||||||
|
|
||||||
// Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
type Return struct {
|
|
||||||
// property description *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
Return int32 `json:"return,omitempty"`
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
|
||||||
*
|
|
||||||
* API version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
|
||||||
*/
|
|
||||||
|
|
||||||
package openapi
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
type APIResponse struct {
|
|
||||||
*http.Response `json:"-"`
|
|
||||||
Message string `json:"message,omitempty"`
|
|
||||||
// Operation is the name of the OpenAPI operation.
|
|
||||||
Operation string `json:"operation,omitempty"`
|
|
||||||
// RequestURL is the request URL. This value is always available, even if the
|
|
||||||
// embedded *http.Response is nil.
|
|
||||||
RequestURL string `json:"url,omitempty"`
|
|
||||||
// Method is the HTTP method used for the request. This value is always
|
|
||||||
// available, even if the embedded *http.Response is nil.
|
|
||||||
Method string `json:"method,omitempty"`
|
|
||||||
// Payload holds the contents of the response body (which may be nil or empty).
|
|
||||||
// This is provided here as the raw response.Body() reader will have already
|
|
||||||
// been drained.
|
|
||||||
Payload []byte `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewAPIResponse(r *http.Response) *APIResponse {
|
|
||||||
|
|
||||||
response := &APIResponse{Response: r}
|
|
||||||
return response
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewAPIResponseWithError(errorMessage string) *APIResponse {
|
|
||||||
|
|
||||||
response := &APIResponse{Message: errorMessage}
|
|
||||||
return response
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
*.class
|
|
||||||
|
|
||||||
# Mobile Tools for Java (J2ME)
|
|
||||||
.mtj.tmp/
|
|
||||||
|
|
||||||
# Package Files #
|
|
||||||
*.jar
|
|
||||||
*.war
|
|
||||||
*.ear
|
|
||||||
|
|
||||||
# exclude jar for gradle wrapper
|
|
||||||
!gradle/wrapper/*.jar
|
|
||||||
|
|
||||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
|
||||||
hs_err_pid*
|
|
||||||
|
|
||||||
# build files
|
|
||||||
**/target
|
|
||||||
target
|
|
||||||
.gradle
|
|
||||||
build
|
|
@ -1,23 +0,0 @@
|
|||||||
# OpenAPI Generator Ignore
|
|
||||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
|
||||||
|
|
||||||
# Use this file to prevent files from being overwritten by the generator.
|
|
||||||
# The patterns follow closely to .gitignore or .dockerignore.
|
|
||||||
|
|
||||||
# As an example, the C# client generator defines ApiClient.cs.
|
|
||||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
|
||||||
#ApiClient.cs
|
|
||||||
|
|
||||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
|
||||||
#foo/*/qux
|
|
||||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
|
||||||
#foo/**/qux
|
|
||||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can also negate patterns with an exclamation (!).
|
|
||||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
|
||||||
#docs/*.md
|
|
||||||
# Then explicitly reverse the ignore rule for a single file:
|
|
||||||
#!docs/README.md
|
|
@ -1 +0,0 @@
|
|||||||
4.0.0-SNAPSHOT
|
|
@ -1,17 +0,0 @@
|
|||||||
#
|
|
||||||
# Generated by: https://openapi-generator.tech
|
|
||||||
#
|
|
||||||
language: java
|
|
||||||
jdk:
|
|
||||||
- oraclejdk8
|
|
||||||
- oraclejdk7
|
|
||||||
before_install:
|
|
||||||
# ensure gradlew has proper permission
|
|
||||||
- chmod a+x ./gradlew
|
|
||||||
script:
|
|
||||||
# test using maven
|
|
||||||
- mvn test
|
|
||||||
# uncomment below to test using gradle
|
|
||||||
# - gradle test
|
|
||||||
# uncomment below to test using sbt
|
|
||||||
# - sbt test
|
|
@ -1,139 +0,0 @@
|
|||||||
# petstore-okhttp-gson
|
|
||||||
|
|
||||||
OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
- API version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
|
||||||
|
|
||||||
|
|
||||||
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
|
|
||||||
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
Building the API client library requires:
|
|
||||||
1. Java 1.7+
|
|
||||||
2. Maven/Gradle
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
To install the API client library to your local Maven repository, simply execute:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
mvn clean install
|
|
||||||
```
|
|
||||||
|
|
||||||
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
mvn clean deploy
|
|
||||||
```
|
|
||||||
|
|
||||||
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
|
|
||||||
|
|
||||||
### Maven users
|
|
||||||
|
|
||||||
Add this dependency to your project's POM:
|
|
||||||
|
|
||||||
```xml
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.openapitools</groupId>
|
|
||||||
<artifactId>petstore-okhttp-gson</artifactId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Gradle users
|
|
||||||
|
|
||||||
Add this dependency to your project's build file:
|
|
||||||
|
|
||||||
```groovy
|
|
||||||
compile "org.openapitools:petstore-okhttp-gson:1.0.0"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Others
|
|
||||||
|
|
||||||
At first generate the JAR by executing:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
mvn clean package
|
|
||||||
```
|
|
||||||
|
|
||||||
Then manually install the following JARs:
|
|
||||||
|
|
||||||
* `target/petstore-okhttp-gson-1.0.0.jar`
|
|
||||||
* `target/lib/*.jar`
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
Please follow the [installation](#installation) instruction and execute the following Java code:
|
|
||||||
|
|
||||||
```java
|
|
||||||
|
|
||||||
import org.openapitools.client.*;
|
|
||||||
import org.openapitools.client.auth.*;
|
|
||||||
import org.openapitools.client.model.*;
|
|
||||||
import org.openapitools.client.api.FakeApi;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class FakeApiExample {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
|
|
||||||
FakeApi apiInstance = new FakeApi();
|
|
||||||
String testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR = "testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR_example"; // String | To test code injection *_/ ' \\\" =end -- \\\\r\\\\n \\\\n \\\\r
|
|
||||||
try {
|
|
||||||
apiInstance.testCodeInjectEndRnNR(testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR);
|
|
||||||
} catch (ApiException e) {
|
|
||||||
System.err.println("Exception when calling FakeApi#testCodeInjectEndRnNR");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
## Documentation for API Endpoints
|
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r*
|
|
||||||
|
|
||||||
Class | Method | HTTP request | Description
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
*FakeApi* | [**testCodeInjectEndRnNR**](docs/FakeApi.md#testCodeInjectEndRnNR) | **PUT** /fake | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
|
|
||||||
|
|
||||||
## Documentation for Models
|
|
||||||
|
|
||||||
- [ModelReturn](docs/ModelReturn.md)
|
|
||||||
|
|
||||||
|
|
||||||
## Documentation for Authorization
|
|
||||||
|
|
||||||
Authentication schemes defined for the API:
|
|
||||||
### api_key
|
|
||||||
|
|
||||||
- **Type**: API key
|
|
||||||
- **API key parameter name**: api_key */ ' " =end -- \r\n \n \r
|
|
||||||
- **Location**: HTTP header
|
|
||||||
|
|
||||||
### petstore_auth
|
|
||||||
|
|
||||||
- **Type**: OAuth
|
|
||||||
- **Flow**: implicit
|
|
||||||
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
|
|
||||||
- **Scopes**:
|
|
||||||
- write:pets: modify pets in your account *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
- read:pets: read your pets *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
|
|
||||||
|
|
||||||
## Recommendation
|
|
||||||
|
|
||||||
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
|
|
||||||
|
|
||||||
## Author
|
|
||||||
|
|
||||||
something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
|
|
@ -1,110 +0,0 @@
|
|||||||
apply plugin: 'idea'
|
|
||||||
apply plugin: 'eclipse'
|
|
||||||
apply plugin: 'java'
|
|
||||||
|
|
||||||
group = 'org.openapitools'
|
|
||||||
version = '1.0.0'
|
|
||||||
|
|
||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
jcenter()
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath 'com.android.tools.build:gradle:2.3.+'
|
|
||||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
jcenter()
|
|
||||||
}
|
|
||||||
sourceSets {
|
|
||||||
main.java.srcDirs = ['src/main/java']
|
|
||||||
}
|
|
||||||
|
|
||||||
if(hasProperty('target') && target == 'android') {
|
|
||||||
|
|
||||||
apply plugin: 'com.android.library'
|
|
||||||
apply plugin: 'com.github.dcendents.android-maven'
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdkVersion 25
|
|
||||||
buildToolsVersion '25.0.2'
|
|
||||||
defaultConfig {
|
|
||||||
minSdkVersion 14
|
|
||||||
targetSdkVersion 25
|
|
||||||
}
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility JavaVersion.VERSION_1_7
|
|
||||||
targetCompatibility JavaVersion.VERSION_1_7
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rename the aar correctly
|
|
||||||
libraryVariants.all { variant ->
|
|
||||||
variant.outputs.each { output ->
|
|
||||||
def outputFile = output.outputFile
|
|
||||||
if (outputFile != null && outputFile.name.endsWith('.aar')) {
|
|
||||||
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
|
|
||||||
output.outputFile = new File(outputFile.parent, fileName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
provided 'javax.annotation:jsr250-api:1.0'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
afterEvaluate {
|
|
||||||
android.libraryVariants.all { variant ->
|
|
||||||
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
|
|
||||||
task.description = "Create jar artifact for ${variant.name}"
|
|
||||||
task.dependsOn variant.javaCompile
|
|
||||||
task.from variant.javaCompile.destinationDir
|
|
||||||
task.destinationDir = project.file("${project.buildDir}/outputs/jar")
|
|
||||||
task.archiveName = "${project.name}-${variant.baseName}-${version}.jar"
|
|
||||||
artifacts.add('archives', task);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task sourcesJar(type: Jar) {
|
|
||||||
from android.sourceSets.main.java.srcDirs
|
|
||||||
classifier = 'sources'
|
|
||||||
}
|
|
||||||
|
|
||||||
artifacts {
|
|
||||||
archives sourcesJar
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
apply plugin: 'java'
|
|
||||||
apply plugin: 'maven'
|
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_7
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_7
|
|
||||||
|
|
||||||
install {
|
|
||||||
repositories.mavenInstaller {
|
|
||||||
pom.artifactId = 'petstore-okhttp-gson'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task execute(type:JavaExec) {
|
|
||||||
main = System.getProperty('mainClass')
|
|
||||||
classpath = sourceSets.main.runtimeClasspath
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compile 'io.swagger:swagger-annotations:1.5.21'
|
|
||||||
compile 'com.squareup.okhttp3:okhttp:3.13.1'
|
|
||||||
compile 'com.squareup.okhttp3:logging-interceptor:3.13.1'
|
|
||||||
compile 'com.google.code.gson:gson:2.8.5'
|
|
||||||
compile 'io.gsonfire:gson-fire:1.8.3'
|
|
||||||
compile group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.1'
|
|
||||||
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1'
|
|
||||||
compile 'org.threeten:threetenbp:1.3.5'
|
|
||||||
testCompile 'junit:junit:4.12'
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
lazy val root = (project in file(".")).
|
|
||||||
settings(
|
|
||||||
organization := "org.openapitools",
|
|
||||||
name := "petstore-okhttp-gson",
|
|
||||||
version := "1.0.0",
|
|
||||||
scalaVersion := "2.11.4",
|
|
||||||
scalacOptions ++= Seq("-feature"),
|
|
||||||
javacOptions in compile ++= Seq("-Xlint:deprecation"),
|
|
||||||
publishArtifact in (Compile, packageDoc) := false,
|
|
||||||
resolvers += Resolver.mavenLocal,
|
|
||||||
libraryDependencies ++= Seq(
|
|
||||||
"io.swagger" % "swagger-annotations" % "1.5.21",
|
|
||||||
"com.squareup.okhttp3" % "okhttp" % "3.13.1",
|
|
||||||
"com.squareup.okhttp3" % "logging-interceptor" % "3.13.1",
|
|
||||||
"com.google.code.gson" % "gson" % "2.8.5",
|
|
||||||
"org.apache.commons" % "commons-lang3" % "3.8.1",
|
|
||||||
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1",
|
|
||||||
"org.threeten" % "threetenbp" % "1.3.5" % "compile",
|
|
||||||
"io.gsonfire" % "gson-fire" % "1.8.3" % "compile",
|
|
||||||
"junit" % "junit" % "4.12" % "test",
|
|
||||||
"com.novocode" % "junit-interface" % "0.10" % "test"
|
|
||||||
)
|
|
||||||
)
|
|
@ -1,53 +0,0 @@
|
|||||||
# FakeApi
|
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r*
|
|
||||||
|
|
||||||
Method | HTTP request | Description
|
|
||||||
------------- | ------------- | -------------
|
|
||||||
[**testCodeInjectEndRnNR**](FakeApi.md#testCodeInjectEndRnNR) | **PUT** /fake | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
|
|
||||||
|
|
||||||
<a name="testCodeInjectEndRnNR"></a>
|
|
||||||
# **testCodeInjectEndRnNR**
|
|
||||||
> testCodeInjectEndRnNR(testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR)
|
|
||||||
|
|
||||||
To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
|
|
||||||
To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```java
|
|
||||||
// Import classes:
|
|
||||||
//import org.openapitools.client.ApiException;
|
|
||||||
//import org.openapitools.client.api.FakeApi;
|
|
||||||
|
|
||||||
|
|
||||||
FakeApi apiInstance = new FakeApi();
|
|
||||||
String testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR = "testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR_example"; // String | To test code injection *_/ ' \\\" =end -- \\\\r\\\\n \\\\n \\\\r
|
|
||||||
try {
|
|
||||||
apiInstance.testCodeInjectEndRnNR(testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR);
|
|
||||||
} catch (ApiException e) {
|
|
||||||
System.err.println("Exception when calling FakeApi#testCodeInjectEndRnNR");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**testCodeInjectStarSlashQuoteDoubleQuoteEqualEndBackSlashRBackSlashNBackSlashNBackSlashR** | **String**| To test code injection *_/ ' \\\" =end -- \\\\r\\\\n \\\\n \\\\r | [optional]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
null (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: application/x-www-form-urlencoded, *_/ ' =end --
|
|
||||||
- **Accept**: Not defined
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
|||||||
|
|
||||||
# ModelReturn
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**_return** | **Integer** | property description *_/ ' \" =end -- \\r\\n \\n \\r | [optional]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user