Merge remote-tracking branch 'origin/master' into 2.3.0

This commit is contained in:
wing328
2017-04-04 15:27:17 +08:00
142 changed files with 2108 additions and 1574 deletions

View File

@@ -70,9 +70,9 @@ Swagger Codegen Version | Release Date | OpenAPI Spec compatibility | Notes
-------------------------- | ------------ | -------------------------- | ----- -------------------------- | ------------ | -------------------------- | -----
2.3.0 (upcoming minor release) | Apr/May 2017 | 1.0, 1.1, 1.2, 2.0 | Minor release with breaking changes 2.3.0 (upcoming minor release) | Apr/May 2017 | 1.0, 1.1, 1.2, 2.0 | Minor release with breaking changes
2.2.3 (upcoming patch release) | TBD | 1.0, 1.1, 1.2, 2.0 | Patch release without breaking changes 2.2.3 (upcoming patch release) | TBD | 1.0, 1.1, 1.2, 2.0 | Patch release without breaking changes
2.2.2 (**current stable**) | 2017-03-01 | 1.0, 1.1, 1.2, 2.0 | [tag v2.2.2](https://github.com/swagger-api/swagger-codegen/tree/v2.2.2) [2.2.2](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.2.2) (**current stable**) | 2017-03-01 | 1.0, 1.1, 1.2, 2.0 | [tag v2.2.2](https://github.com/swagger-api/swagger-codegen/tree/v2.2.2)
2.2.1 | 2016-08-07 | 1.0, 1.1, 1.2, 2.0 | [tag v2.2.1](https://github.com/swagger-api/swagger-codegen/tree/v2.2.1) [2.2.1](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.2.1) | 2016-08-07 | 1.0, 1.1, 1.2, 2.0 | [tag v2.2.1](https://github.com/swagger-api/swagger-codegen/tree/v2.2.1)
2.1.6 | 2016-04-06 | 1.0, 1.1, 1.2, 2.0 | [tag v2.1.6](https://github.com/swagger-api/swagger-codegen/tree/v2.1.6) [2.1.6](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.1.6) | 2016-04-06 | 1.0, 1.1, 1.2, 2.0 | [tag v2.1.6](https://github.com/swagger-api/swagger-codegen/tree/v2.1.6)
2.0.17 | 2014-08-22 | 1.1, 1.2 | [tag v2.0.17](https://github.com/swagger-api/swagger-codegen/tree/v2.0.17) 2.0.17 | 2014-08-22 | 1.1, 1.2 | [tag v2.0.17](https://github.com/swagger-api/swagger-codegen/tree/v2.0.17)
1.0.4 | 2012-04-12 | 1.0, 1.1 | [tag v1.0.4](https://github.com/swagger-api/swagger-codegen/tree/swagger-codegen_2.9.1-1.1) 1.0.4 | 2012-04-12 | 1.0, 1.1 | [tag v1.0.4](https://github.com/swagger-api/swagger-codegen/tree/swagger-codegen_2.9.1-1.1)

View File

@@ -0,0 +1,3 @@
{
"dateLibrary": "joda"
}

View File

@@ -0,0 +1,35 @@
#!/bin/sh
SCRIPT="$0"
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/swagger-codegen-cli/target/swagger-codegen-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 --artifact-id swagger-jaxrs-resteasy-eap-joda-server -t modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs-resteasy-eap -o samples/server/petstore/jaxrs-resteasy/eap-joda -DhideGenerationTimestamp=true -c ./bin/jaxrs-resteasy-eap-joda-petstore-server.json"
echo "Removing files and folders under samples/server/petstore/jaxrs-resteasy/eap-joda/src/main"
rm -rf samples/server/petstore/jaxrs-resteasy/eap-joda/src/main
find samples/server/petstore/jaxrs-resteasy/eap-joda -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
java $JAVA_OPTS -jar $executable $ags

View File

@@ -0,0 +1,35 @@
#!/bin/sh
SCRIPT="$0"
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/swagger-codegen-cli/target/swagger-codegen-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/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs-resteasy-eap -o samples/server/petstore/jaxrs-resteasy/eap -DhideGenerationTimestamp=true"
echo "Removing files and folders under samples/server/petstore/jaxrs-resteasy/eap/src/main"
rm -rf samples/server/petstore/jaxrs-resteasy/eap/src/main
find samples/server/petstore/jaxrs-resteasy/eap -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
java $JAVA_OPTS -jar $executable $ags

View File

@@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead. # if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-security-test.yaml -l csharp -o samples/client/petstore-security-test/csharp/SwaggerClient" ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-security-test.yaml -l csharp -o samples/client/petstore-security-test/csharp/SwaggerClient --additional-properties packageGuid={8CE139DF-64BC-4591-85F8-8506C2B67514}"
java $JAVA_OPTS -jar $executable $ags java $JAVA_OPTS -jar $executable $ags

View File

@@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead. # if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/typescript-fetch -i modules/swagger-codegen/src/test/resources/2_0/petstore-security-test.yaml -l typescript-fetch -o samples/client/petstore-security-test/typescript-fetch" ags="$@ generate -t modules/swagger-codegen/src/main/resources/TypeScript-Fetch -i modules/swagger-codegen/src/test/resources/2_0/petstore-security-test.yaml -l typescript-fetch -o samples/client/petstore-security-test/typescript-fetch"
java $JAVA_OPTS -jar $executable $ags java $JAVA_OPTS -jar $executable $ags

View File

@@ -1,4 +1,4 @@
package io.swagger.api; package {{invokerPackage}};
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;

View File

@@ -11,7 +11,7 @@ import io.swagger.jaxrs.config.BeanConfig;
{{#apiInfo}} {{#apiInfo}}
{{#apis}} {{#apis}}
import {{invokerPackage}}.impl.{{classname}}ServiceImpl; import {{package}}.impl.{{classname}}ServiceImpl;
{{/apis}} {{/apis}}
{{/apiInfo}} {{/apiInfo}}

View File

@@ -4,6 +4,6 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param> <context-param>
<param-name>resteasy.providers</param-name> <param-name>resteasy.providers</param-name>
<param-value>io.swagger.api.JacksonConfig</param-value> <param-value>{{invokerPackage}}.JacksonConfig</param-value>
</context-param> </context-param>
</web-app> </web-app>

26
pom.xml
View File

@@ -542,6 +542,30 @@
<module>samples/server/petstore/jaxrs-resteasy/joda</module> <module>samples/server/petstore/jaxrs-resteasy/joda</module>
</modules> </modules>
</profile> </profile>
<profile>
<id>jaxrs-resteasy-eap-server</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>samples/server/petstore/jaxrs-resteasy/eap</module>
</modules>
</profile>
<profile>
<id>jaxrs-resteasy-eap-server-joda</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>samples/server/petstore/jaxrs-resteasy/eap-joda</module>
</modules>
</profile>
<profile> <profile>
<id>jaxrs-server</id> <id>jaxrs-server</id>
<activation> <activation>
@@ -789,6 +813,8 @@
<module>samples/server/petstore/jaxrs/jersey1</module> <module>samples/server/petstore/jaxrs/jersey1</module>
<module>samples/server/petstore/jaxrs/jersey2</module> <module>samples/server/petstore/jaxrs/jersey2</module>
<module>samples/server/petstore/jaxrs-resteasy/default</module> <module>samples/server/petstore/jaxrs-resteasy/default</module>
<module>samples/server/petstore/jaxrs-resteasy/eap</module>
<module>samples/server/petstore/jaxrs-resteasy/eap-joda</module>
<module>samples/server/petstore/jaxrs-resteasy/joda</module> <module>samples/server/petstore/jaxrs-resteasy/joda</module>
<module>samples/server/petstore/scalatra</module> <module>samples/server/petstore/scalatra</module>
<module>samples/server/petstore/spring-mvc</module> <module>samples/server/petstore/spring-mvc</module>

View File

@@ -147,39 +147,39 @@ UpgradeLog*.htm
*.swp *.swp
*.swo *.swo
# svn # svn
.svn .svn
# SQL Server files # SQL Server files
**/App_Data/*.mdf **/App_Data/*.mdf
**/App_Data/*.ldf **/App_Data/*.ldf
**/App_Data/*.sdf **/App_Data/*.sdf
#LightSwitch generated files #LightSwitch generated files
GeneratedArtifacts/ GeneratedArtifacts/
_Pvt_Extensions/ _Pvt_Extensions/
ModelManifest.xml ModelManifest.xml
# ========================= # =========================
# Windows detritus # Windows detritus
# ========================= # =========================
# Windows image file caches # Windows image file caches
Thumbs.db Thumbs.db
ehthumbs.db ehthumbs.db
# Folder config file # Folder config file
Desktop.ini Desktop.ini
# Recycle Bin used on file shares # Recycle Bin used on file shares
$RECYCLE.BIN/ $RECYCLE.BIN/
# Mac desktop service store files # Mac desktop service store files
.DS_Store .DS_Store
# SASS Compiler cache # SASS Compiler cache
.sass-cache .sass-cache
# Visual Studio 2014 CTP # Visual Studio 2014 CTP
**/*.sln.ide **/*.sln.ide

View File

@@ -1,18 +1,6 @@
# #
# Generated by: https://github.com/swagger-api/swagger-codegen.git # Generated by: https://github.com/swagger-api/swagger-codegen.git
# #
# 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.
#
language: csharp language: csharp
mono: mono:
- latest - latest

View File

@@ -6,18 +6,19 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c
- API version: 1.0.0 *_/ &#39; \&quot; &#x3D;end - - \\r\\n \\n \\r - API version: 1.0.0 *_/ &#39; \&quot; &#x3D;end - - \\r\\n \\n \\r
- SDK version: 1.0.0 - SDK version: 1.0.0
- Build date: 2016-07-13T18:16:08.689+08:00 - Build package: io.swagger.codegen.languages.CSharpClientCodegen
- Build package: class io.swagger.codegen.languages.CSharpClientCodegen
<a name="frameworks-supported"></a>
## Frameworks supported ## Frameworks supported
- .NET 4.0 or later - .NET 4.0 or later
- Windows Phone 7.1 (Mango) - Windows Phone 7.1 (Mango)
<a name="dependencies"></a>
## Dependencies ## Dependencies
- [RestSharp](https://www.nuget.org/packages/RestSharp) - 105.1.0 or later - [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 - [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later
The DLLs included in the package may not be the latest version. We recommned using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: 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 RestSharp
Install-Package Newtonsoft.Json Install-Package Newtonsoft.Json
@@ -25,6 +26,7 @@ Install-Package Newtonsoft.Json
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) 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 ## Installation
Run the following command to generate the DLL Run the following command to generate the DLL
- [Mac/Linux] `/bin/sh build.sh` - [Mac/Linux] `/bin/sh build.sh`
@@ -34,9 +36,22 @@ Then include the DLL (under the `bin` folder) in the C# project, and use the nam
```csharp ```csharp
using IO.Swagger.Api; using IO.Swagger.Api;
using IO.Swagger.Client; using IO.Swagger.Client;
using Model; 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 ## Getting Started
```csharp ```csharp
@@ -44,7 +59,7 @@ using System;
using System.Diagnostics; using System.Diagnostics;
using IO.Swagger.Api; using IO.Swagger.Api;
using IO.Swagger.Client; using IO.Swagger.Client;
using Model; using IO.Swagger.Model;
namespace Example namespace Example
{ {
@@ -86,20 +101,23 @@ Class | Method | HTTP request | Description
- [Model.ModelReturn](docs/ModelReturn.md) - [Model.ModelReturn](docs/ModelReturn.md)
<a name="documentation-for-authorization"></a>
## Documentation for Authorization ## Documentation for Authorization
<a name="api_key"></a>
### api_key ### api_key
- **Type**: API key - **Type**: API key
- **API key parameter name**: api_key */ &#39; &quot; &#x3D;end -- \r\n \n \r - **API key parameter name**: api_key */ &#39; &quot; &#x3D;end -- \r\n \n \r
- **Location**: HTTP header - **Location**: HTTP header
<a name="petstore_auth"></a>
### petstore_auth ### petstore_auth
- **Type**: OAuth - **Type**: OAuth
- **Flow**: implicit - **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**: - **Scopes**:
- write:pets: modify pets in your account */ &#39; &quot; &#x3D;end -- \r\n \n \r - write:pets: modify pets in your account *_/ &#39; \&quot; &#x3D;end - - \\r\\n \\n \\r
- read:pets: read your pets */ &#39; &quot; &#x3D;end -- \r\n \n \r - read:pets: read your pets *_/ &#39; \&quot; &#x3D;end - - \\r\\n \\n \\r

View File

@@ -1,22 +1,10 @@
:: Generated by: https://github.com/swagger-api/swagger-codegen.git :: Generated by: https://github.com/swagger-api/swagger-codegen.git
:: ::
:: 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.
@echo off @echo off
SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319 SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319
if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://nuget.org/nuget.exe', '.\nuget.exe')" if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://nuget.org/nuget.exe', '.\nuget.exe')"
.\nuget.exe install src\IO.Swagger\packages.config -o packages .\nuget.exe install src\IO.Swagger\packages.config -o packages
@@ -24,5 +12,5 @@ if not exist ".\bin" mkdir bin
copy packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll copy packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll
copy packages\RestSharp.105.1.0\lib\net45\RestSharp.dll bin\RestSharp.dll copy packages\RestSharp.105.1.0\lib\net45\RestSharp.dll bin\RestSharp.dll
%CSCPATH%\csc /reference:bin\Newtonsoft.Json.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
%CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\RestSharp.dll /target:library /out:bin\IO.Swagger.dll /recurse:src\IO.Swagger\*.cs /doc:bin\IO.Swagger.xml

View File

@@ -2,17 +2,6 @@
# #
# Generated by: https://github.com/swagger-api/swagger-codegen.git # Generated by: https://github.com/swagger-api/swagger-codegen.git
# #
# 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.
frameworkVersion=net45 frameworkVersion=net45
netfx=${frameworkVersion#net} netfx=${frameworkVersion#net}
@@ -32,6 +21,7 @@ cp packages/RestSharp.105.1.0/lib/net45/RestSharp.dll bin/RestSharp.dll;
echo "[INFO] Run 'mcs' to build bin/IO.Swagger.dll" echo "[INFO] Run 'mcs' to build bin/IO.Swagger.dll"
mcs -sdk:${netfx} -r:bin/Newtonsoft.Json.dll,\ mcs -sdk:${netfx} -r:bin/Newtonsoft.Json.dll,\
bin/RestSharp.dll,\ bin/RestSharp.dll,\
System.ComponentModel.DataAnnotations.dll,\
System.Runtime.Serialization.dll \ System.Runtime.Serialization.dll \
-target:library \ -target:library \
-out:bin/IO.Swagger.dll \ -out:bin/IO.Swagger.dll \

View File

@@ -2,17 +2,6 @@
# #
# Generated by: https://github.com/swagger-api/swagger-codegen.git # Generated by: https://github.com/swagger-api/swagger-codegen.git
# #
# 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.
wget -nc https://nuget.org/nuget.exe wget -nc https://nuget.org/nuget.exe
mozroots --import --sync mozroots --import --sync
@@ -26,8 +15,8 @@ mozroots --import --sync
mono nuget.exe install src/IO.Swagger.Test/packages.config -o packages mono nuget.exe install src/IO.Swagger.Test/packages.config -o packages
echo "[INFO] Install NUnit runners via NuGet" echo "[INFO] Install NUnit runners via NuGet"
mono nuget.exe install NUnit.Runners -Version 3.2.1 -OutputDirectory packages mono nuget.exe install NUnit.Runners -Version 2.6.4 -OutputDirectory packages
echo "[INFO] Build the solution and run the unit test" echo "[INFO] Build the solution and run the unit test"
xbuild IO.Swagger.sln && \ xbuild IO.Swagger.sln && \
mono ./packages/NUnit.ConsoleRunner.3.2.1/tools/nunit3-console.exe src/IO.Swagger.Test/bin/Debug/IO.Swagger.Test.dll mono ./packages/NUnit.Runners.2.6.4/tools/nunit-console.exe src/IO.Swagger.Test/bin/Debug/IO.Swagger.Test.dll

View File

@@ -6,19 +6,6 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod
OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
--> -->
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
@@ -54,6 +41,7 @@ limitations under the License.
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Runtime.Serialization" /> <Reference Include="System.Runtime.Serialization" />
@@ -71,10 +59,10 @@ limitations under the License.
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\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>
<Reference Include="nunit.framework"> <Reference Include="nunit.framework">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\NUnit.3.2.1\lib\nunit.framework.dll</HintPath> <HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\NUnit.3.2.1\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.3.2.1\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.3.2.1\lib\nunit.framework.dll</HintPath> <HintPath Condition="Exists('..\..\vendor')">..\..\vendor\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="NUnit" version="3.2.1" targetFramework="net45" /> <package id="NUnit" version="2.6.4" targetFramework="net45" />
<package id="RestSharp" version="105.1.0" targetFramework="net45" developmentDependency="true" /> <package id="RestSharp" version="105.1.0" targetFramework="net45" developmentDependency="true" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" developmentDependency="true" /> <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" developmentDependency="true" />
</packages> </packages>

View File

@@ -6,18 +6,6 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r * OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git * Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* 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.
*/ */
using System; using System;
@@ -235,9 +223,6 @@ namespace IO.Swagger.Api
if (localVarHttpHeaderAccept != null) if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (testCodeInjectEndRnNR != null) localVarFormParams.Add("test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r", Configuration.ApiClient.ParameterToString(testCodeInjectEndRnNR)); // form parameter if (testCodeInjectEndRnNR != null) localVarFormParams.Add("test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r", Configuration.ApiClient.ParameterToString(testCodeInjectEndRnNR)); // form parameter
@@ -305,9 +290,6 @@ namespace IO.Swagger.Api
if (localVarHttpHeaderAccept != null) if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (testCodeInjectEndRnNR != null) localVarFormParams.Add("test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r", Configuration.ApiClient.ParameterToString(testCodeInjectEndRnNR)); // form parameter if (testCodeInjectEndRnNR != null) localVarFormParams.Add("test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r", Configuration.ApiClient.ParameterToString(testCodeInjectEndRnNR)); // form parameter

View File

@@ -6,18 +6,6 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r * OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git * Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* 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.
*/ */
using System; using System;

View File

@@ -6,18 +6,6 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r * OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git * Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* 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.
*/ */
using System; using System;

View File

@@ -6,18 +6,6 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r * OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git * Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* 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.
*/ */
using System; using System;

View File

@@ -6,18 +6,6 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r * OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git * Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* 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.
*/ */
using System; using System;
@@ -179,7 +167,28 @@ namespace IO.Swagger.Client
/// <returns></returns> /// <returns></returns>
public void AddDefaultHeader(string key, string value) public void AddDefaultHeader(string key, string value)
{ {
_defaultHeaderMap.Add(key, value); _defaultHeaderMap[key] = value;
}
/// <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;
} }
/// <summary> /// <summary>
@@ -234,7 +243,7 @@ namespace IO.Swagger.Client
return apiKeyValue; return apiKeyValue;
} }
private string _tempFolderPath = Path.GetTempPath(); private string _tempFolderPath;
/// <summary> /// <summary>
/// Gets or sets the temporary folder path to store the files downloaded from the server. /// Gets or sets the temporary folder path to store the files downloaded from the server.
@@ -242,7 +251,15 @@ namespace IO.Swagger.Client
/// <value>Folder path.</value> /// <value>Folder path.</value>
public String TempFolderPath public String TempFolderPath
{ {
get { return _tempFolderPath; } get
{
// default to Path.GetTempPath() if _tempFolderPath is not set
if (String.IsNullOrEmpty(_tempFolderPath))
{
_tempFolderPath = Path.GetTempPath();
}
return _tempFolderPath;
}
set set
{ {

View File

@@ -6,18 +6,6 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r * OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git * Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* 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.
*/ */
@@ -31,6 +19,6 @@ namespace IO.Swagger.Client
/// </summary> /// </summary>
/// <param name="methodName">Method name</param> /// <param name="methodName">Method name</param>
/// <param name="response">Response</param> /// <param name="response">Response</param>
/// <returns>Exceptions</returns> /// <returns>Exceptions</returns>
public delegate Exception ExceptionFactory(string methodName, IRestResponse response); public delegate Exception ExceptionFactory(string methodName, IRestResponse response);
} }

View File

@@ -6,18 +6,6 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r * OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git * Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* 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.
*/ */

View File

@@ -6,29 +6,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod
OpenAPI spec version: 1.0.0 *_/ &#39; \&quot; &#x3D;end - - \\r\\n \\n \\r OpenAPI spec version: 1.0.0 *_/ &#39; \&quot; &#x3D;end - - \\r\\n \\n \\r
Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
--> -->
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{8CE139DF-64BC-4591-85F8-8506C2B67514}</ProjectGuid> <ProjectGuid>{8CE139DF-64BC-4591-85F8-8506C2B67514}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Swagger Library</RootNamespace> <RootNamespace>IO.Swagger</RootNamespace>
<AssemblyName>Swagger Library</AssemblyName> <AssemblyName>IO.Swagger</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
</PropertyGroup> </PropertyGroup>
@@ -54,6 +42,7 @@ limitations under the License.
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Runtime.Serialization" /> <Reference Include="System.Runtime.Serialization" />
@@ -70,13 +59,14 @@ limitations under the License.
<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> <HintPath Condition="Exists('..\..\vendor')">..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="**\*.cs"/> <Compile Include="**\*.cs"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" /></Project>
</Project>

View File

@@ -0,0 +1,40 @@
<?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/ *_/ &#39; \&quot; &#x3D;end - - \\r\\n \\n \\r</copyright>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html *_/ &#39; \&quot; &#x3D;end - - \\r\\n \\n \\r</licenseUrl>
<!-- Dependencies are automatically installed when the package is installed -->
<dependencies>
<dependency id="NewtonSoft.Json" version="8.0.3" />
<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>

View File

@@ -6,30 +6,20 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r * OpenAPI spec version: 1.0.0 *_/ ' \" =end - - \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git * Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* 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.
*/ */
using System; using System;
using System.Linq; using System.Linq;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Converters; using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
namespace IO.Swagger.Model namespace IO.Swagger.Model
{ {
@@ -37,13 +27,13 @@ namespace IO.Swagger.Model
/// Model for testing reserved words *_/ &#39; \&quot; &#x3D;end - - \\r\\n \\n \\r /// Model for testing reserved words *_/ &#39; \&quot; &#x3D;end - - \\r\\n \\n \\r
/// </summary> /// </summary>
[DataContract] [DataContract]
public partial class ModelReturn : IEquatable<ModelReturn> public partial class ModelReturn : IEquatable<ModelReturn>, IValidatableObject
{ {
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ModelReturn" /> class. /// Initializes a new instance of the <see cref="ModelReturn" /> class.
/// </summary> /// </summary>
/// <param name="_Return">property description *_/ &#39; \&quot; &#x3D;end - - \\r\\n \\n \\r.</param> /// <param name="_Return">property description *_/ &#39; \&quot; &#x3D;end - - \\r\\n \\n \\r.</param>
public ModelReturn(int? _Return = null) public ModelReturn(int? _Return = default(int?))
{ {
this._Return = _Return; this._Return = _Return;
} }
@@ -122,6 +112,16 @@ namespace IO.Swagger.Model
return hash; return hash;
} }
} }
/// <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;
}
} }
} }

View File

@@ -1,14 +1,13 @@
# Go API client for swagger # Go API client for swagger
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 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 ## Overview
This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client. This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client.
- API version: 1.0.0 *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r - API version: 1.0.0 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
- Package version: 1.0.0 - Package version: 1.0.0
- Build date: 2016-07-12T18:49:24.937+08:00 - Build package: io.swagger.codegen.languages.GoClientCodegen
- Build package: class io.swagger.codegen.languages.GoClientCodegen
## Installation ## Installation
Put the package under your project folder and add the following in import: Put the package under your project folder and add the following in import:
@@ -18,11 +17,11 @@ Put the package under your project folder and add the following in import:
## Documentation for API Endpoints ## Documentation for API Endpoints
All URIs are relative to *https://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r* All URIs are relative to *https://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r*
Class | Method | HTTP request | Description Class | Method | HTTP request | Description
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
*FakeApi* | [**TestCodeInjectEndRnNR**](docs/FakeApi.md#testcodeinjectendrnnr) | **Put** /fake | To test code injection *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r *FakeApi* | [**TestCodeInjectEndRnNR**](docs/FakeApi.md#testcodeinjectendrnnr) | **Put** /fake | To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
## Documentation For Models ## Documentation For Models
@@ -36,7 +35,7 @@ Class | Method | HTTP request | Description
## api_key ## api_key
- **Type**: API key - **Type**: API key
- **API key parameter name**: api_key */ ' " =end \r\n \n \r - **API key parameter name**: api_key */ ' " =end -- \r\n \n \r
- **Location**: HTTP header - **Location**: HTTP header
## petstore_auth ## petstore_auth
@@ -45,11 +44,11 @@ Class | Method | HTTP request | Description
- **Flow**: implicit - **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**: - **Scopes**:
- **write:pets**: modify pets in your account */ ' " =end \r\n \n \r - **write:pets**: modify pets in your account *_/ ' \" =end -- \\r\\n \\n \\r
- **read:pets**: read your pets */ ' " =end \r\n \n \r - **read:pets**: read your pets *_/ ' \" =end -- \\r\\n \\n \\r
## Author ## Author
apiteam@swagger.io *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r apiteam@swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r

View File

@@ -1,23 +1,11 @@
/* /*
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r * 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 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 * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git * Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* 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.
*/ */
package swagger package swagger
@@ -29,10 +17,12 @@ import (
"reflect" "reflect"
"strings" "strings"
"net/url" "net/url"
"io/ioutil"
"github.com/go-resty/resty" "github.com/go-resty/resty"
) )
type APIClient struct { type APIClient struct {
config *Configuration
} }
func (c *APIClient) SelectHeaderContentType(contentTypes []string) string { func (c *APIClient) SelectHeaderContentType(contentTypes []string) string {
@@ -57,9 +47,9 @@ func (c *APIClient) SelectHeaderAccept(accepts []string) string {
return strings.Join(accepts, ",") return strings.Join(accepts, ",")
} }
func contains(source []string, containvalue string) bool { func contains(haystack []string, needle string) bool {
for _, a := range source { for _, a := range haystack {
if strings.ToLower(a) == strings.ToLower(containvalue) { if strings.ToLower(a) == strings.ToLower(needle) {
return true return true
} }
} }
@@ -74,11 +64,8 @@ func (c *APIClient) CallAPI(path string, method string,
fileName string, fileName string,
fileBytes []byte) (*resty.Response, error) { fileBytes []byte) (*resty.Response, error) {
//set debug flag rClient := c.prepareClient()
configuration := NewConfiguration() request := c.prepareRequest(rClient, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
resty.SetDebug(configuration.GetDebug())
request := prepareRequest(postBody, headerParams, queryParams, formParams, fileName, fileBytes)
switch strings.ToUpper(method) { switch strings.ToUpper(method) {
case "GET": case "GET":
@@ -101,33 +88,59 @@ func (c *APIClient) CallAPI(path string, method string,
return nil, fmt.Errorf("invalid method %v", method) return nil, fmt.Errorf("invalid method %v", method)
} }
func (c *APIClient) ParameterToString(obj interface{},collectionFormat string) string { func (c *APIClient) ParameterToString(obj interface{}, collectionFormat string) string {
if reflect.TypeOf(obj).String() == "[]string" { delimiter := ""
switch collectionFormat { switch collectionFormat {
case "pipes": case "pipes":
return strings.Join(obj.([]string), "|") delimiter = "|"
case "ssv": case "ssv":
return strings.Join(obj.([]string), " ") delimiter = " "
case "tsv": case "tsv":
return strings.Join(obj.([]string), "\t") delimiter = "\t"
case "csv" : case "csv":
return strings.Join(obj.([]string), ",") delimiter = ","
}
} }
return obj.(string) if reflect.TypeOf(obj).Kind() == reflect.Slice {
return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]")
}
return fmt.Sprintf("%v", obj)
} }
func prepareRequest(postBody interface{}, func (c *APIClient) prepareClient() *resty.Client {
rClient := resty.New()
rClient.SetDebug(c.config.Debug)
if c.config.Transport != nil {
rClient.SetTransport(c.config.Transport)
}
if c.config.Timeout != nil {
rClient.SetTimeout(*c.config.Timeout)
}
rClient.SetLogger(ioutil.Discard)
return rClient
}
func (c *APIClient) prepareRequest(
rClient *resty.Client,
postBody interface{},
headerParams map[string]string, headerParams map[string]string,
queryParams url.Values, queryParams url.Values,
formParams map[string]string, formParams map[string]string,
fileName string, fileName string,
fileBytes []byte) *resty.Request { fileBytes []byte) *resty.Request {
request := resty.R()
request := rClient.R()
request.SetBody(postBody) request.SetBody(postBody)
if c.config.UserAgent != "" {
request.SetHeader("User-Agent", c.config.UserAgent)
}
// add header parameter, if any // add header parameter, if any
if len(headerParams) > 0 { if len(headerParams) > 0 {
request.SetHeaders(headerParams) request.SetHeaders(headerParams)

View File

@@ -1,23 +1,11 @@
/* /*
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r * 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 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 * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git * Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* 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.
*/ */
package swagger package swagger
@@ -27,8 +15,20 @@ import (
) )
type APIResponse struct { type APIResponse struct {
*http.Response *http.Response `json:"-"`
Message string `json:"message,omitempty"` Message string `json:"message,omitempty"`
// Operation is the name of the swagger 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 { func NewAPIResponse(r *http.Response) *APIResponse {

View File

@@ -1,63 +1,57 @@
/* /*
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r * 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 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 * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git * Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* 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.
*/ */
package swagger package swagger
import ( import (
"encoding/base64" "encoding/base64"
"net/http"
"time"
) )
type Configuration struct { type Configuration struct {
UserName string `json:"userName,omitempty"` Username string `json:"userName,omitempty"`
Password string `json:"password,omitempty"` Password string `json:"password,omitempty"`
APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"` APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"`
APIKey map[string]string `json:"APIKey,omitempty"` APIKey map[string]string `json:"APIKey,omitempty"`
debug bool `json:"debug,omitempty"` Debug bool `json:"debug,omitempty"`
DebugFile string `json:"debugFile,omitempty"` DebugFile string `json:"debugFile,omitempty"`
OAuthToken string `json:"oAuthToken,omitempty"` OAuthToken string `json:"oAuthToken,omitempty"`
Timeout int `json:"timeout,omitempty"`
BasePath string `json:"basePath,omitempty"` BasePath string `json:"basePath,omitempty"`
Host string `json:"host,omitempty"` Host string `json:"host,omitempty"`
Scheme string `json:"scheme,omitempty"` Scheme string `json:"scheme,omitempty"`
AccessToken string `json:"accessToken,omitempty"` AccessToken string `json:"accessToken,omitempty"`
DefaultHeader map[string]string `json:"defaultHeader,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
UserAgent string `json:"userAgent,omitempty"` UserAgent string `json:"userAgent,omitempty"`
APIClient APIClient `json:"APIClient,omitempty"` APIClient *APIClient
Transport *http.Transport
Timeout *time.Duration `json:"timeout,omitempty"`
} }
func NewConfiguration() *Configuration { func NewConfiguration() *Configuration {
return &Configuration{ cfg := &Configuration{
BasePath: "https://petstore.swagger.io *_/ ' \" =end \\r\\n \\n \\r/v2 *_/ ' \" =end \\r\\n \\n \\r", BasePath: "https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r",
UserName: "",
debug: false,
DefaultHeader: make(map[string]string), DefaultHeader: make(map[string]string),
APIKey: make(map[string]string), APIKey: make(map[string]string),
APIKeyPrefix: make(map[string]string), APIKeyPrefix: make(map[string]string),
UserAgent: "Swagger-Codegen/1.0.0/go", UserAgent: "Swagger-Codegen/1.0.0/go",
APIClient: &APIClient{},
} }
cfg.APIClient.config = cfg
return cfg
} }
func (c *Configuration) GetBasicAuthEncodedString() string { func (c *Configuration) GetBasicAuthEncodedString() string {
return base64.StdEncoding.EncodeToString([]byte(c.UserName + ":" + c.Password)) return base64.StdEncoding.EncodeToString([]byte(c.Username + ":" + c.Password))
} }
func (c *Configuration) AddDefaultHeader(key string, value string) { func (c *Configuration) AddDefaultHeader(key string, value string) {
@@ -71,11 +65,3 @@ func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string {
return c.APIKey[APIKeyIdentifier] return c.APIKey[APIKeyIdentifier]
} }
func (c *Configuration) SetDebug(enable bool) {
c.debug = enable
}
func (c *Configuration) GetDebug() bool {
return c.debug
}

View File

@@ -1,23 +1,23 @@
# \FakeApi # \FakeApi
All URIs are relative to *https://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r* All URIs are relative to *https://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r*
Method | HTTP request | Description Method | HTTP request | Description
------------- | ------------- | ------------- ------------- | ------------- | -------------
[**TestCodeInjectEndRnNR**](FakeApi.md#TestCodeInjectEndRnNR) | **Put** /fake | To test code injection *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r [**TestCodeInjectEndRnNR**](FakeApi.md#TestCodeInjectEndRnNR) | **Put** /fake | To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
# **TestCodeInjectEndRnNR** # **TestCodeInjectEndRnNR**
> TestCodeInjectEndRnNR($testCodeInjectEndRnNR) > TestCodeInjectEndRnNR($testCodeInjectEndRnNR)
To test code injection *_/ ' \" =end \\r\\n \\n \\r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
### Parameters ### Parameters
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**testCodeInjectEndRnNR** | **string**| To test code injection *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r | [optional] **testCodeInjectEndRnNR** | **string**| To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r | [optional]
### Return type ### Return type
@@ -29,8 +29,8 @@ No authorization required
### HTTP request headers ### HTTP request headers
- **Content-Type**: application/json, *_/ ' =end - **Content-Type**: application/json, *_/ ' =end --
- **Accept**: 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) [[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)

View File

@@ -3,7 +3,7 @@
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**Return_** | **int32** | property description *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r | [optional] [default to null] **Return_** | **int32** | property description *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -1,42 +1,28 @@
/* /*
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r * 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 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 * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git * Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* 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.
*/ */
package swagger package swagger
import ( import (
"strings"
"fmt"
"errors"
"net/url" "net/url"
) "strings"
)
type FakeApi struct { type FakeApi struct {
Configuration Configuration Configuration *Configuration
} }
func NewFakeApi() *FakeApi { func NewFakeApi() *FakeApi {
configuration := NewConfiguration() configuration := NewConfiguration()
return &FakeApi{ return &FakeApi{
Configuration: *configuration, Configuration: configuration,
} }
} }
@@ -45,63 +31,66 @@ func NewFakeApiWithBasePath(basePath string) *FakeApi {
configuration.BasePath = basePath configuration.BasePath = basePath
return &FakeApi{ return &FakeApi{
Configuration: *configuration, Configuration: configuration,
} }
} }
/** /**
* To test code injection *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r * To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* *
* @param testCodeInjectEndRnNR To test code injection *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r * @param testCodeInjectEndRnNR To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* @return void * @return void
*/ */
func (a FakeApi) TestCodeInjectEndRnNR(testCodeInjectEndRnNR string) (*APIResponse, error) { func (a FakeApi) TestCodeInjectEndRnNR(testCodeInjectEndRnNR string) (*APIResponse, error) {
var httpMethod = "Put" var localVarHttpMethod = strings.ToUpper("Put")
// create path and map variables // create path and map variables
path := a.Configuration.BasePath + "/fake" localVarPath := a.Configuration.BasePath + "/fake"
headerParams := make(map[string]string)
queryParams := url.Values{}
formParams := make(map[string]string)
var postBody interface{}
var fileName string
var fileBytes []byte
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// add default headers if any // add default headers if any
for key := range a.Configuration.DefaultHeader { for key := range a.Configuration.DefaultHeader {
headerParams[key] = a.Configuration.DefaultHeader[key] localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
} }
// to determine the Content-Type header // to determine the Content-Type header
localVarHttpContentTypes := []string{ "application/json", "*_/ ' =end ", } localVarHttpContentTypes := []string{ "application/json", "*_/ ' =end -- ", }
// set Content-Type header // set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" { if localVarHttpContentType != "" {
headerParams["Content-Type"] = localVarHttpContentType localVarHeaderParams["Content-Type"] = localVarHttpContentType
} }
// to determine the Accept header // to determine the Accept header
localVarHttpHeaderAccepts := []string{ localVarHttpHeaderAccepts := []string{
"application/json", "application/json",
"*_/ ' =end ", "*_/ ' =end -- ",
} }
// set Accept header // set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" { if localVarHttpHeaderAccept != "" {
headerParams["Accept"] = localVarHttpHeaderAccept localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
localVarFormParams["testCodeInjectEndRnNR"] = a.Configuration.APIClient.ParameterToString(testCodeInjectEndRnNR, "")
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "TestCodeInjectEndRnNR", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
} }
formParams["testCodeInjectEndRnNR"] = testCodeInjectEndRnNR
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
if err != nil { if err != nil {
return NewAPIResponse(httpResponse.RawResponse), err return localVarAPIResponse, err
} }
return localVarAPIResponse, err
return NewAPIResponse(httpResponse.RawResponse), err
} }

View File

@@ -1,30 +1,18 @@
/* /*
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r * 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 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 * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git * Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* 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.
*/ */
package swagger package swagger
// Model for testing reserved words *_/ ' \" =end \\r\\n \\n \\r // Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r
type ModelReturn struct { type ModelReturn struct {
// property description *_/ ' \" =end \\r\\n \\n \\r // property description *_/ ' \" =end -- \\r\\n \\n \\r
Return_ int32 `json:"return,omitempty"` Return_ int32 `json:"return,omitempty"`
} }

View File

@@ -3,14 +3,13 @@
* Do not edit this file by hand or your changes will be lost next time it is * Do not edit this file by hand or your changes will be lost next time it is
* generated. * generated.
* *
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \&quot; \\ &#39; \&quot; &#x3D;end * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \&quot; \\ *_/ &#39; \&quot; &#x3D;end --
* Version: 1.0.0 &#39; \&quot; &#x3D;end * Version: 1.0.0 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* Generated at: 2016-06-29T22:04:03.401+08:00 * Generated by: io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen
* Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen
*/ */
/** /**
* @license Apache 2.0 &#39; \&quot; &#x3D;end * @license Apache 2.0 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* http://www.apache.org/licenses/LICENSE-2.0.html &#39; \&quot; &#x3D;end * http://www.apache.org/licenses/LICENSE-2.0.html *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
*/ */
goog.provide('API.Client.FakeApi'); goog.provide('API.Client.FakeApi');
@@ -27,7 +26,7 @@ API.Client.FakeApi = function($http, $httpParamSerializer, $injector) {
/** @private {!string} */ /** @private {!string} */
this.basePath_ = $injector.has('FakeApiBasePath') ? this.basePath_ = $injector.has('FakeApiBasePath') ?
/** @type {!string} */ ($injector.get('FakeApiBasePath')) : /** @type {!string} */ ($injector.get('FakeApiBasePath')) :
'https://petstore.swagger.io &#39; \&quot; &#x3D;end/v2 &#39; \&quot; &#x3D;end'; 'https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r';
/** @private {!Object<string, string>} */ /** @private {!Object<string, string>} */
this.defaultHeaders_ = $injector.has('FakeApiDefaultHeaders') ? this.defaultHeaders_ = $injector.has('FakeApiDefaultHeaders') ?
@@ -44,13 +43,13 @@ API.Client.FakeApi = function($http, $httpParamSerializer, $injector) {
API.Client.FakeApi.$inject = ['$http', '$httpParamSerializer', '$injector']; API.Client.FakeApi.$inject = ['$http', '$httpParamSerializer', '$injector'];
/** /**
* To test code injection &#39; \&quot; &#x3D;end * To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* *
* @param {!string=} opt_testCodeInjectEnd To test code injection &#39; \&quot; &#x3D;end * @param {!string=} opt_testCodeInjectEndRnNR To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise} * @return {!angular.$q.Promise}
*/ */
API.Client.FakeApi.prototype.testCodeInjectEnd = function(opt_testCodeInjectEnd, opt_extraHttpRequestParams) { API.Client.FakeApi.prototype.testCodeInjectEndRnNR = function(opt_testCodeInjectEndRnNR, opt_extraHttpRequestParams) {
/** @const {string} */ /** @const {string} */
var path = this.basePath_ + '/fake'; var path = this.basePath_ + '/fake';
@@ -64,7 +63,7 @@ API.Client.FakeApi.prototype.testCodeInjectEnd = function(opt_testCodeInjectEnd,
headerParams['Content-Type'] = 'application/x-www-form-urlencoded'; headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
formParams['test code inject */ &#39; &quot; &#x3D;end'] = opt_testCodeInjectEnd; formParams['test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r'] = opt_testCodeInjectEndRnNR;
/** @type {!Object} */ /** @type {!Object} */
var httpRequestParams = { var httpRequestParams = {

View File

@@ -1,13 +1,13 @@
goog.provide('API.Client.Return'); goog.provide('API.Client.Return');
/** /**
* Model for testing reserved words ' \" =end * Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r
* @record * @record
*/ */
API.Client.ModelReturn = function() {} API.Client.ModelReturn = function() {}
/** /**
* property description ' \" =end * property description *_/ ' \" =end -- \\r\\n \\n \\r
* @type {!number} * @type {!number}
* @export * @export
*/ */

View File

@@ -6,7 +6,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/
- API version: 1.0.0 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r - API version: 1.0.0 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
- Package version: 1.0.0 *_/ &#x3D;end -- \r\n \n \r - Package version: 1.0.0 *_/ &#x3D;end -- \r\n \n \r
- Build package: class io.swagger.codegen.languages.JavascriptClientCodegen - Build package: io.swagger.codegen.languages.JavascriptClientCodegen
## Installation ## Installation

View File

@@ -2,13 +2,13 @@
"name": "swagger_petstore____end____rn_n_r", "name": "swagger_petstore____end____rn_n_r",
"version": "1.0.0 *_/ =end -- \r\n \n \r", "version": "1.0.0 *_/ =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______", "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______",
"license": "Apache-2.0", "license": "Unlicense",
"main": "src/index.js", "main": "src/index.js",
"scripts": { "scripts": {
"test": "./node_modules/mocha/bin/mocha --recursive" "test": "./node_modules/mocha/bin/mocha --recursive"
}, },
"dependencies": { "dependencies": {
"superagent": "1.7.1" "superagent": "3.5.2"
}, },
"devDependencies": { "devDependencies": {
"mocha": "~2.3.4", "mocha": "~2.3.4",

View File

@@ -9,34 +9,23 @@
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
* *
* 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.
*/ */
(function(root, factory) { (function(root, factory) {
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define(['superagent'], factory); define(['superagent', 'querystring'], factory);
} else if (typeof module === 'object' && module.exports) { } else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node. // CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('superagent')); module.exports = factory(require('superagent'), require('querystring'));
} else { } else {
// Browser globals (root is window) // Browser globals (root is window)
if (!root.SwaggerPetstoreEndRnNR) { if (!root.SwaggerPetstoreEndRnNR) {
root.SwaggerPetstoreEndRnNR = {}; root.SwaggerPetstoreEndRnNR = {};
} }
root.SwaggerPetstoreEndRnNR.ApiClient = factory(root.superagent); root.SwaggerPetstoreEndRnNR.ApiClient = factory(root.superagent, root.querystring);
} }
}(this, function(superagent) { }(this, function(superagent, querystring) {
'use strict'; 'use strict';
/** /**
@@ -55,9 +44,9 @@
/** /**
* The base URL against which to resolve every API call's (relative) path. * The base URL against which to resolve every API call's (relative) path.
* @type {String} * @type {String}
* @default https://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r * @default https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r
*/ */
this.basePath = 'https://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r'.replace(/\/+$/, ''); this.basePath = 'https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r'.replace(/\/+$/, '');
/** /**
* The authentication methods to be included for all API calls. * The authentication methods to be included for all API calls.
@@ -80,6 +69,30 @@
* @default 60000 * @default 60000
*/ */
this.timeout = 60000; this.timeout = 60000;
/**
* If set to false an additional timestamp parameter is added to all API GET calls to
* prevent browser caching
* @type {Boolean}
* @default true
*/
this.cache = true;
/**
* If set to true, the client will save the cookies from each server
* response, and return them in the next request.
* @default false
*/
this.enableCookies = false;
/*
* Used to save and return cookies in a node.js (non-browser) setting,
* if this.enableCookies is set to true.
*/
if (typeof window === 'undefined') {
this.agent = new superagent.agent();
}
}; };
/** /**
@@ -316,13 +329,13 @@
* @returns A value of the specified type. * @returns A value of the specified type.
*/ */
exports.prototype.deserialize = function deserialize(response, returnType) { exports.prototype.deserialize = function deserialize(response, returnType) {
if (response == null || returnType == null) { if (response == null || returnType == null || response.status == 204) {
return null; return null;
} }
// Rely on SuperAgent for parsing response body. // Rely on SuperAgent for parsing response body.
// See http://visionmedia.github.io/superagent/#parsing-response-bodies // See http://visionmedia.github.io/superagent/#parsing-response-bodies
var data = response.body; var data = response.body;
if (data == null) { if (data == null || (typeof data === 'object' && typeof data.length === 'undefined' && !Object.keys(data).length)) {
// SuperAgent does not always produce a body; use the unparsed response as a fallback // SuperAgent does not always produce a body; use the unparsed response as a fallback
data = response.text; data = response.text;
} }
@@ -366,6 +379,9 @@
this.applyAuthToRequest(request, authNames); this.applyAuthToRequest(request, authNames);
// set query parameters // set query parameters
if (httpMethod.toUpperCase() === 'GET' && this.cache === false) {
queryParams['_'] = new Date().getTime();
}
request.query(this.normalizeParams(queryParams)); request.query(this.normalizeParams(queryParams));
// set header parameters // set header parameters
@@ -385,7 +401,7 @@
} }
if (contentType === 'application/x-www-form-urlencoded') { if (contentType === 'application/x-www-form-urlencoded') {
request.send(this.normalizeParams(formParams)); request.send(querystring.stringify(this.normalizeParams(formParams)));
} else if (contentType == 'multipart/form-data') { } else if (contentType == 'multipart/form-data') {
var _formParams = this.normalizeParams(formParams); var _formParams = this.normalizeParams(formParams);
for (var key in _formParams) { for (var key in _formParams) {
@@ -407,12 +423,33 @@
request.accept(accept); request.accept(accept);
} }
if (returnType === 'Blob') {
request.responseType('blob');
}
// Attach previously saved cookies, if enabled
if (this.enableCookies){
if (typeof window === 'undefined') {
this.agent.attachCookies(request);
}
else {
request.withCredentials();
}
}
request.end(function(error, response) { request.end(function(error, response) {
if (callback) { if (callback) {
var data = null; var data = null;
if (!error) { if (!error) {
data = _this.deserialize(response, returnType); try {
data = _this.deserialize(response, returnType);
if (_this.enableCookies && typeof window === 'undefined'){
_this.agent.saveCookies(response);
}
} catch (err) {
error = err;
}
} }
callback(error, data, response); callback(error, data, response);
} }
@@ -437,9 +474,12 @@
* or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To * or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
* return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type: * return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
* all properties on <code>data<code> will be converted to this type. * all properties on <code>data<code> will be converted to this type.
* @returns An instance of the specified type. * @returns An instance of the specified type or null or undefined if data is null or undefined.
*/ */
exports.convertToType = function(data, type) { exports.convertToType = function(data, type) {
if (data === null || data === undefined)
return data
switch (type) { switch (type) {
case 'Boolean': case 'Boolean':
return Boolean(data); return Boolean(data);
@@ -451,6 +491,8 @@
return String(data); return String(data);
case 'Date': case 'Date':
return this.parseDate(String(data)); return this.parseDate(String(data));
case 'Blob':
return data;
default: default:
if (type === Object) { if (type === Object) {
// generic object, return directly // generic object, return directly

View File

@@ -9,17 +9,6 @@
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
* *
* 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.
*/ */
(function(root, factory) { (function(root, factory) {

View File

@@ -9,17 +9,6 @@
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
* *
* 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.
*/ */
(function(factory) { (function(factory) {

View File

@@ -9,17 +9,6 @@
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
* *
* 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.
*/ */
(function(root, factory) { (function(root, factory) {

View File

@@ -59,9 +59,6 @@ NSInteger kSWGFakeApiMissingParamErrorCode = 234513;
completionHandler: (void (^)(NSError* error)) handler { completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/fake"]; NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/fake"];
// remove format in URL if needed
[resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];

View File

@@ -0,0 +1,14 @@
/** The `SWGBasicAuthTokenProvider` class creates a basic auth token from username and password.
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
#import <Foundation/Foundation.h>
@interface SWGBasicAuthTokenProvider : NSObject
+ (NSString *)createBasicAuthTokenWithUsername:(NSString *)username password:(NSString *)password;
@end

View File

@@ -0,0 +1,19 @@
#import "SWGBasicAuthTokenProvider.h"
@implementation SWGBasicAuthTokenProvider
+ (NSString *)createBasicAuthTokenWithUsername:(NSString *)username password:(NSString *)password {
// return empty string if username and password are empty
if (username.length == 0 && password.length == 0){
return @"";
}
NSString *basicAuthCredentials = [NSString stringWithFormat:@"%@:%@", username, password];
NSData *data = [basicAuthCredentials dataUsingEncoding:NSUTF8StringEncoding];
basicAuthCredentials = [NSString stringWithFormat:@"Basic %@", [data base64EncodedStringWithOptions:0]];
return basicAuthCredentials;
}
@end

View File

@@ -0,0 +1,166 @@
#import <Foundation/Foundation.h>
#import "SWGConfiguration.h"
/**
* 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.
*/
@class SWGApiClient;
@interface SWGDefaultConfiguration : NSObject <SWGConfiguration>
/**
* Default api logger
*/
@property (nonatomic, strong) SWGLogger * logger;
/**
* Default base url
*/
@property (nonatomic) NSString *host;
/**
* Api key values for Api Key type Authentication
*
* To add or remove api key, use `setApiKey:forApiKeyIdentifier:`.
*/
@property (readonly, nonatomic, strong) NSDictionary *apiKey;
/**
* Api key prefix values to be prepend to the respective api key
*
* To add or remove prefix, use `setApiKeyPrefix:forApiKeyPrefixIdentifier:`.
*/
@property (readonly, nonatomic, strong) NSDictionary *apiKeyPrefix;
/**
* Username for HTTP Basic Authentication
*/
@property (nonatomic) NSString *username;
/**
* Password for HTTP Basic Authentication
*/
@property (nonatomic) NSString *password;
/**
* Access token for OAuth
*/
@property (nonatomic) NSString *accessToken;
/**
* Temp folder for file download
*/
@property (nonatomic) NSString *tempFolderPath;
/**
* Debug switch, default false
*/
@property (nonatomic) BOOL debug;
/**
* Gets configuration singleton instance
*/
+ (instancetype) sharedConfig;
/**
* SSL/TLS verification
* Set this to NO to skip verifying SSL certificate when calling API from https server
*/
@property (nonatomic) BOOL verifySSL;
/**
* SSL/TLS verification
* Set this to customize the certificate file to verify the peer
*/
@property (nonatomic) NSString *sslCaCert;
/**
* Sets API key
*
* To remove a apiKey for an identifier, just set the apiKey to nil.
*
* @param apiKey API key or token.
* @param identifier API key identifier (authentication schema).
*
*/
- (void) setApiKey:(NSString *)apiKey forApiKeyIdentifier:(NSString*)identifier;
/**
* Removes api key
*
* @param identifier API key identifier.
*/
- (void) removeApiKey:(NSString *)identifier;
/**
* Sets the prefix for API key
*
* @param prefix API key prefix.
* @param identifier API key identifier.
*/
- (void) setApiKeyPrefix:(NSString *)prefix forApiKeyPrefixIdentifier:(NSString *)identifier;
/**
* Removes api key prefix
*
* @param identifier API key identifier.
*/
- (void) removeApiKeyPrefix:(NSString *)identifier;
/**
* Gets API key (with prefix if set)
*/
- (NSString *) getApiKeyWithPrefix:(NSString *) key;
/**
* Gets Basic Auth token
*/
- (NSString *) getBasicAuthToken;
/**
* Gets OAuth access token
*/
- (NSString *) getAccessToken;
/**
* Gets Authentication Settings
*/
- (NSDictionary *) authSettings;
/**
* Default headers for all services
*/
@property (readonly, nonatomic, strong) NSDictionary *defaultHeaders;
/**
* Removes header from defaultHeaders
*
* @param key Header name.
*/
-(void) removeDefaultHeaderForKey:(NSString*)key;
/**
* Sets the header for key
*
* @param value Value for header name
* @param key Header name
*/
-(void) setDefaultHeaderValue:(NSString*) value forKey:(NSString*)key;
/**
* @param key Header key name.
*/
-(NSString*) defaultHeaderForKey:(NSString*)key;
@end

View File

@@ -0,0 +1,152 @@
#import "SWGDefaultConfiguration.h"
#import "SWGBasicAuthTokenProvider.h"
#import "SWGLogger.h"
@interface SWGDefaultConfiguration ()
@property (nonatomic, strong) NSMutableDictionary *mutableDefaultHeaders;
@property (nonatomic, strong) NSMutableDictionary *mutableApiKey;
@property (nonatomic, strong) NSMutableDictionary *mutableApiKeyPrefix;
@end
@implementation SWGDefaultConfiguration
#pragma mark - Singleton Methods
+ (instancetype) sharedConfig {
static SWGDefaultConfiguration *shardConfig = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
shardConfig = [[self alloc] init];
});
return shardConfig;
}
#pragma mark - Initialize Methods
- (instancetype) init {
self = [super init];
if (self) {
_host = @"https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r";
_username = @"";
_password = @"";
_accessToken= @"";
_verifySSL = YES;
_mutableApiKey = [NSMutableDictionary dictionary];
_mutableApiKeyPrefix = [NSMutableDictionary dictionary];
_mutableDefaultHeaders = [NSMutableDictionary dictionary];
_logger = [SWGLogger sharedLogger];
}
return self;
}
#pragma mark - Instance Methods
- (NSString *) getApiKeyWithPrefix:(NSString *)key {
NSString *prefix = self.apiKeyPrefix[key];
NSString *apiKey = self.apiKey[key];
if (prefix && apiKey != (id)[NSNull null] && apiKey.length > 0) { // both api key prefix and api key are set
return [NSString stringWithFormat:@"%@ %@", prefix, apiKey];
}
else if (apiKey != (id)[NSNull null] && apiKey.length > 0) { // only api key, no api key prefix
return [NSString stringWithFormat:@"%@", self.apiKey[key]];
}
else { // return empty string if nothing is set
return @"";
}
}
- (NSString *) getBasicAuthToken {
NSString *basicAuthToken = [SWGBasicAuthTokenProvider createBasicAuthTokenWithUsername:self.username password:self.password];
return basicAuthToken;
}
- (NSString *) getAccessToken {
if (self.accessToken.length == 0) { // token not set, return empty string
return @"";
} else {
return [NSString stringWithFormat:@"Bearer %@", self.accessToken];
}
}
#pragma mark - Setter Methods
- (void) setApiKey:(NSString *)apiKey forApiKeyIdentifier:(NSString *)identifier {
[self.mutableApiKey setValue:apiKey forKey:identifier];
}
- (void) removeApiKey:(NSString *)identifier {
[self.mutableApiKey removeObjectForKey:identifier];
}
- (void) setApiKeyPrefix:(NSString *)prefix forApiKeyPrefixIdentifier:(NSString *)identifier {
[self.mutableApiKeyPrefix setValue:prefix forKey:identifier];
}
- (void) removeApiKeyPrefix:(NSString *)identifier {
[self.mutableApiKeyPrefix removeObjectForKey:identifier];
}
#pragma mark - Getter Methods
- (NSDictionary *) apiKey {
return [NSDictionary dictionaryWithDictionary:self.mutableApiKey];
}
- (NSDictionary *) apiKeyPrefix {
return [NSDictionary dictionaryWithDictionary:self.mutableApiKeyPrefix];
}
#pragma mark -
- (NSDictionary *) authSettings {
return @{
@"api_key":
@{
@"type": @"api_key",
@"in": @"header",
@"key": @"api_key */ &#39; &quot; &#x3D;end -- \r\n \n \r",
@"value": [self getApiKeyWithPrefix:@"api_key */ &#39; &quot; &#x3D;end -- \r\n \n \r"]
},
@"petstore_auth":
@{
@"type": @"oauth",
@"in": @"header",
@"key": @"Authorization",
@"value": [self getAccessToken]
},
};
}
-(BOOL)debug {
return self.logger.isEnabled;
}
-(void)setDebug:(BOOL)debug {
self.logger.enabled = debug;
}
- (void)setDefaultHeaderValue:(NSString *)value forKey:(NSString *)key {
if(!value) {
[self.mutableDefaultHeaders removeObjectForKey:key];
return;
}
self.mutableDefaultHeaders[key] = value;
}
-(void) removeDefaultHeaderForKey:(NSString*)key {
[self.mutableDefaultHeaders removeObjectForKey:key];
}
- (NSString *)defaultHeaderForKey:(NSString *)key {
return self.mutableDefaultHeaders[key];
}
- (NSDictionary *)defaultHeaders {
return [self.mutableDefaultHeaders copy];
}
@end

View File

@@ -1,57 +1,56 @@
# NAME # NAME
WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore */ &#39; \&quot; WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore */ &#39; \&quot; &#x3D;_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: \" \\ */ ' \" 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 --
# VERSION # VERSION
Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API version: 1.0.0 */ &#39; \&quot; - API version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
- Package version: 1.0.0 - Package version: 1.0.0
- Build date: 2016-06-28T16:32:36.006+08:00 - Build package: io.swagger.codegen.languages.PerlClientCodegen
- Build package: class io.swagger.codegen.languages.PerlClientCodegen
## A note on Moose ## A note on Moose
This role is the only component of the library that uses Moose. See This role is the only component of the library that uses Moose. See
WWW::SwaggerClient::ApiFactory for non-Moosey usage. WWW::SwaggerClient::ApiFactory for non-Moosey usage.
# SYNOPSIS # SYNOPSIS
The Perl Swagger Codegen project builds a library of Perl modules to interact with The Perl Swagger Codegen project builds a library of Perl modules to interact with
a web service defined by a OpenAPI Specification. See below for how to build the a web service defined by a OpenAPI Specification. See below for how to build the
library. library.
This module provides an interface to the generated library. All the classes, This module provides an interface to the generated library. All the classes,
objects, and methods (well, not quite \*all\*, see below) are flattened into this objects, and methods (well, not quite \*all\*, see below) are flattened into this
role. role.
package MyApp; package MyApp;
use Moose; use Moose;
with 'WWW::SwaggerClient::Role'; with 'WWW::SwaggerClient::Role';
package main; package main;
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
my $pet = $api->get_pet_by_id(pet_id => $pet_id); my $pet = $api->get_pet_by_id(pet_id => $pet_id);
## Structure of the library ## Structure of the library
The library consists of a set of API classes, one for each endpoint. These APIs The library consists of a set of API classes, one for each endpoint. These APIs
implement the method calls available on each endpoint. implement the method calls available on each endpoint.
Additionally, there is a set of "object" classes, which represent the objects Additionally, there is a set of "object" classes, which represent the objects
returned by and sent to the methods on the endpoints. returned by and sent to the methods on the endpoints.
An API factory class is provided, which builds instances of each endpoint API. An API factory class is provided, which builds instances of each endpoint API.
This Moose role flattens all the methods from the endpoint APIs onto the consuming This Moose role flattens all the methods from the endpoint APIs onto the consuming
class. It also provides methods to retrieve the endpoint API objects, and the API class. It also provides methods to retrieve the endpoint API objects, and the API
factory object, should you need it. factory object, should you need it.
For documentation of all these methods, see AUTOMATIC DOCUMENTATION below. For documentation of all these methods, see AUTOMATIC DOCUMENTATION below.
@@ -64,33 +63,33 @@ required and where to put them. You just need to supply the tokens.
# basic # basic
username => $username, username => $username,
password => $password, password => $password,
# oauth # oauth
access_token => $oauth_token, access_token => $oauth_token,
# keys # keys
$some_key => { token => $token, $some_key => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
$another => { token => $token, $another => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
..., ...,
}; };
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
Note these are all optional, as are `prefix` and `in`, and depend on the API Note these are all optional, as are `prefix` and `in`, and depend on the API
you are accessing. Usually `prefix` and `in` will be determined by the code generator from you are accessing. Usually `prefix` and `in` will be determined by the code generator from
the spec and you will not need to set them at run time. If not, `in` will the spec and you will not need to set them at run time. If not, `in` will
default to 'head' and `prefix` to the empty string. default to 'head' and `prefix` to the empty string.
The tokens will be placed in the `WWW::SwaggerClient::Configuration` namespace The tokens will be placed in the `WWW::SwaggerClient::Configuration` namespace
as follows, but you don't need to know about this. as follows, but you don't need to know about this.
- `$WWW::SwaggerClient::Configuration::username` - `$WWW::SwaggerClient::Configuration::username`
@@ -121,22 +120,22 @@ as follows, but you don't need to know about this.
- `$WWW::SwaggerClient::Configuration::access_token` - `$WWW::SwaggerClient::Configuration::access_token`
String. The OAuth access token. String. The OAuth access token.
# METHODS # METHODS
## `base_url` ## `base_url`
The generated code has the `base_url` already set as a default value. This method The generated code has the `base_url` already set as a default value. This method
returns (and optionally sets, but only if the API client has not been returns (and optionally sets, but only if the API client has not been
created yet) the current value of `base_url`. created yet) the current value of `base_url`.
## `api_factory` ## `api_factory`
Returns an API factory object. You probably won't need to call this directly. Returns an API factory object. You probably won't need to call this directly.
$self->api_factory('Pet'); # returns a WWW::SwaggerClient::PetApi instance $self->api_factory('Pet'); # returns a WWW::SwaggerClient::PetApi instance
$self->pet_api; # the same $self->pet_api; # the same
# MISSING METHODS # MISSING METHODS
@@ -146,9 +145,9 @@ Most of the methods on the API are delegated to individual endpoint API objects
same method name (e.g. `new()`), these methods can't be delegated. So you need same method name (e.g. `new()`), these methods can't be delegated. So you need
to call `$api->pet_api->new()`. to call `$api->pet_api->new()`.
In principle, every API is susceptible to the presence of a few, random, undelegatable In principle, every API is susceptible to the presence of a few, random, undelegatable
method names. In practice, because of the way method names are constructed, it's method names. In practice, because of the way method names are constructed, it's
unlikely in general that any methods will be undelegatable, except for: unlikely in general that any methods will be undelegatable, except for:
new() new()
class_documentation() class_documentation()
@@ -161,12 +160,12 @@ you could also call them on class names.
# BUILDING YOUR LIBRARY # BUILDING YOUR LIBRARY
See the homepage `https://github.com/swagger-api/swagger-codegen` for full details. See the homepage `https://github.com/swagger-api/swagger-codegen` for full details.
But briefly, clone the git repository, build the codegen codebase, set up your build But briefly, clone the git repository, build the codegen codebase, set up your build
config file, then run the API build script. You will need git, Java 7 or 8 and Apache config file, then run the API build script. You will need git, Java 7 or 8 and Apache
maven 3.0.3 or better already installed. maven 3.0.3 or better already installed.
The config file should specify the project name for the generated library: The config file should specify the project name for the generated library:
{"moduleName":"WWW::MyProjectName"} {"moduleName":"WWW::MyProjectName"}
@@ -181,8 +180,8 @@ Your library files will be built under `WWW::MyProjectName`.
-c /path/to/config/file.json \ -c /path/to/config/file.json \
-o /path/to/output/folder -o /path/to/output/folder
Bang, all done. Run the `autodoc` script in the `bin` directory to see the API Bang, all done. Run the `autodoc` script in the `bin` directory to see the API
you just built. you just built.
# AUTOMATIC DOCUMENTATION # AUTOMATIC DOCUMENTATION
@@ -194,28 +193,28 @@ output formats are supported:
-w wide format (default) -w wide format (default)
-n narrow format -n narrow format
-p POD format -p POD format
-H HTML format -H HTML format
-m Markdown format -m Markdown format
-h print this help message -h print this help message
-c your application class -c your application class
The `-c` option allows you to load and inspect your own application. A dummy The `-c` option allows you to load and inspect your own application. A dummy
namespace is used if you don't supply your own class. namespace is used if you don't supply your own class.
# DOCUMENTATION FROM THE OpenAPI Spec # DOCUMENTATION FROM THE OpenAPI Spec
Additional documentation for each class and method may be provided by the Swagger Additional documentation for each class and method may be provided by the Swagger
spec. If so, this is available via the `class_documentation()` and spec. If so, this is available via the `class_documentation()` and
`method_documentation()` methods on each generated object class, and the `method_documentation()` methods on each generated object class, and the
`method_documentation()` method on the endpoint API classes: `method_documentation()` method on the endpoint API classes:
my $cmdoc = $api->pet_api->method_documentation->{$method_name};
my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation;
my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name};
my $cmdoc = $api->pet_api->method_documentation->{$method_name};
my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation;
my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name};
Each of these calls returns a hashref with various useful pieces of information. Each of these calls returns a hashref with various useful pieces of information.
@@ -248,38 +247,40 @@ use WWW::SwaggerClient::Object::ModelReturn;
# for displaying the API response data # for displaying the API response data
use Data::Dumper; use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::;
my $api_instance = WWW::SwaggerClient::FakeApi->new(); my $api_instance = WWW::SwaggerClient::FakeApi->new();
my $test code inject */ &#39; &quot; &#x3D;end = 'test code inject */ ' " =end_example'; # string | To test code injection */ ' \" my $test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r = 'test code inject */ ' " =end __ \r\n \n \r_example'; # string | To test code injection */ ' \" =_end -- \\r\\n \\n \\r
eval { eval {
$api_instance->test_code_inject____end(test code inject */ &#39; &quot; &#x3D;end => $test code inject */ &#39; &quot; &#x3D;end); $api_instance->test_code_inject____end__rn_n_r(test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r => $test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r);
}; };
if ($@) { if ($@) {
warn "Exception when calling FakeApi->test_code_inject____end: $@\n"; warn "Exception when calling FakeApi->test_code_inject____end__rn_n_r: $@\n";
} }
``` ```
# DOCUMENTATION FOR API ENDPOINTS # DOCUMENTATION FOR API ENDPOINTS
All URIs are relative to *https://petstore.swagger.io */ &#39; &quot; &#x3D;end/v2 */ &#39; &quot; &#x3D;end* All URIs are relative to *https://petstore.swagger.io */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r/v2 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r*
Class | Method | HTTP request | Description Class | Method | HTTP request | Description
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
*FakeApi* | [**test_code_inject____end**](docs/FakeApi.md#test_code_inject____end) | **PUT** /fake | To test code injection */ &#39; \&quot; *FakeApi* | [**test_code_inject____end__rn_n_r**](docs/FakeApi.md#test_code_inject____end__rn_n_r) | **PUT** /fake | To test code injection */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
# DOCUMENTATION FOR MODELS # DOCUMENTATION FOR MODELS
- [WWW::SwaggerClient::Object::ModelReturn](docs/ModelReturn.md) - [WWW::SwaggerClient::Object::ModelReturn](docs/ModelReturn.md)
# DOCUMENTATION FOR AUTHORIATION # DOCUMENTATION FOR AUTHORIZATION
## api_key ## api_key
- **Type**: API key - **Type**: API key
- **API key parameter name**: api_key */ ' " =end - **API key parameter name**: api_key */ ' " =end -- \r\n \n \r
- **Location**: HTTP header - **Location**: HTTP header
## petstore_auth ## petstore_auth
@@ -288,8 +289,6 @@ Class | Method | HTTP request | Description
- **Flow**: implicit - **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**: - **Scopes**:
- **write:pets**: modify pets in your account */ ' " =end - **write:pets**: modify pets in your account */ ' \" =_end -- \\r\\n \\n \\r
- **read:pets**: read your pets */ ' " =end - **read:pets**: read your pets */ ' \" =_end -- \\r\\n \\n \\r

View File

@@ -1,57 +1,56 @@
# NAME # NAME
Something::Deep::Role - a Moose role for the Swagger Petstore */ &#39; \&quot; Something::Deep::Role - a Moose role for the Swagger Petstore */ &#39; \&quot; &#x3D;_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: \" \\ */ ' \" 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 --
# VERSION # VERSION
Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API version: 1.0.0 */ &#39; \&quot; - API version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
- Package version: 1.0.0 - Package version: 1.0.0
- Build date: 2016-06-28T16:32:37.043+08:00 - Build package: io.swagger.codegen.languages.PerlClientCodegen
- Build package: class io.swagger.codegen.languages.PerlClientCodegen
## A note on Moose ## A note on Moose
This role is the only component of the library that uses Moose. See This role is the only component of the library that uses Moose. See
Something::Deep::ApiFactory for non-Moosey usage. Something::Deep::ApiFactory for non-Moosey usage.
# SYNOPSIS # SYNOPSIS
The Perl Swagger Codegen project builds a library of Perl modules to interact with The Perl Swagger Codegen project builds a library of Perl modules to interact with
a web service defined by a OpenAPI Specification. See below for how to build the a web service defined by a OpenAPI Specification. See below for how to build the
library. library.
This module provides an interface to the generated library. All the classes, This module provides an interface to the generated library. All the classes,
objects, and methods (well, not quite \*all\*, see below) are flattened into this objects, and methods (well, not quite \*all\*, see below) are flattened into this
role. role.
package MyApp; package MyApp;
use Moose; use Moose;
with 'Something::Deep::Role'; with 'Something::Deep::Role';
package main; package main;
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
my $pet = $api->get_pet_by_id(pet_id => $pet_id); my $pet = $api->get_pet_by_id(pet_id => $pet_id);
## Structure of the library ## Structure of the library
The library consists of a set of API classes, one for each endpoint. These APIs The library consists of a set of API classes, one for each endpoint. These APIs
implement the method calls available on each endpoint. implement the method calls available on each endpoint.
Additionally, there is a set of "object" classes, which represent the objects Additionally, there is a set of "object" classes, which represent the objects
returned by and sent to the methods on the endpoints. returned by and sent to the methods on the endpoints.
An API factory class is provided, which builds instances of each endpoint API. An API factory class is provided, which builds instances of each endpoint API.
This Moose role flattens all the methods from the endpoint APIs onto the consuming This Moose role flattens all the methods from the endpoint APIs onto the consuming
class. It also provides methods to retrieve the endpoint API objects, and the API class. It also provides methods to retrieve the endpoint API objects, and the API
factory object, should you need it. factory object, should you need it.
For documentation of all these methods, see AUTOMATIC DOCUMENTATION below. For documentation of all these methods, see AUTOMATIC DOCUMENTATION below.
@@ -64,33 +63,33 @@ required and where to put them. You just need to supply the tokens.
# basic # basic
username => $username, username => $username,
password => $password, password => $password,
# oauth # oauth
access_token => $oauth_token, access_token => $oauth_token,
# keys # keys
$some_key => { token => $token, $some_key => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
$another => { token => $token, $another => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
..., ...,
}; };
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
Note these are all optional, as are `prefix` and `in`, and depend on the API Note these are all optional, as are `prefix` and `in`, and depend on the API
you are accessing. Usually `prefix` and `in` will be determined by the code generator from you are accessing. Usually `prefix` and `in` will be determined by the code generator from
the spec and you will not need to set them at run time. If not, `in` will the spec and you will not need to set them at run time. If not, `in` will
default to 'head' and `prefix` to the empty string. default to 'head' and `prefix` to the empty string.
The tokens will be placed in the `Something::Deep::Configuration` namespace The tokens will be placed in the `Something::Deep::Configuration` namespace
as follows, but you don't need to know about this. as follows, but you don't need to know about this.
- `$Something::Deep::Configuration::username` - `$Something::Deep::Configuration::username`
@@ -121,22 +120,22 @@ as follows, but you don't need to know about this.
- `$Something::Deep::Configuration::access_token` - `$Something::Deep::Configuration::access_token`
String. The OAuth access token. String. The OAuth access token.
# METHODS # METHODS
## `base_url` ## `base_url`
The generated code has the `base_url` already set as a default value. This method The generated code has the `base_url` already set as a default value. This method
returns (and optionally sets, but only if the API client has not been returns (and optionally sets, but only if the API client has not been
created yet) the current value of `base_url`. created yet) the current value of `base_url`.
## `api_factory` ## `api_factory`
Returns an API factory object. You probably won't need to call this directly. Returns an API factory object. You probably won't need to call this directly.
$self->api_factory('Pet'); # returns a Something::Deep::PetApi instance $self->api_factory('Pet'); # returns a Something::Deep::PetApi instance
$self->pet_api; # the same $self->pet_api; # the same
# MISSING METHODS # MISSING METHODS
@@ -146,9 +145,9 @@ Most of the methods on the API are delegated to individual endpoint API objects
same method name (e.g. `new()`), these methods can't be delegated. So you need same method name (e.g. `new()`), these methods can't be delegated. So you need
to call `$api->pet_api->new()`. to call `$api->pet_api->new()`.
In principle, every API is susceptible to the presence of a few, random, undelegatable In principle, every API is susceptible to the presence of a few, random, undelegatable
method names. In practice, because of the way method names are constructed, it's method names. In practice, because of the way method names are constructed, it's
unlikely in general that any methods will be undelegatable, except for: unlikely in general that any methods will be undelegatable, except for:
new() new()
class_documentation() class_documentation()
@@ -161,12 +160,12 @@ you could also call them on class names.
# BUILDING YOUR LIBRARY # BUILDING YOUR LIBRARY
See the homepage `https://github.com/swagger-api/swagger-codegen` for full details. See the homepage `https://github.com/swagger-api/swagger-codegen` for full details.
But briefly, clone the git repository, build the codegen codebase, set up your build But briefly, clone the git repository, build the codegen codebase, set up your build
config file, then run the API build script. You will need git, Java 7 or 8 and Apache config file, then run the API build script. You will need git, Java 7 or 8 and Apache
maven 3.0.3 or better already installed. maven 3.0.3 or better already installed.
The config file should specify the project name for the generated library: The config file should specify the project name for the generated library:
{"moduleName":"WWW::MyProjectName"} {"moduleName":"WWW::MyProjectName"}
@@ -181,8 +180,8 @@ Your library files will be built under `WWW::MyProjectName`.
-c /path/to/config/file.json \ -c /path/to/config/file.json \
-o /path/to/output/folder -o /path/to/output/folder
Bang, all done. Run the `autodoc` script in the `bin` directory to see the API Bang, all done. Run the `autodoc` script in the `bin` directory to see the API
you just built. you just built.
# AUTOMATIC DOCUMENTATION # AUTOMATIC DOCUMENTATION
@@ -194,28 +193,28 @@ output formats are supported:
-w wide format (default) -w wide format (default)
-n narrow format -n narrow format
-p POD format -p POD format
-H HTML format -H HTML format
-m Markdown format -m Markdown format
-h print this help message -h print this help message
-c your application class -c your application class
The `-c` option allows you to load and inspect your own application. A dummy The `-c` option allows you to load and inspect your own application. A dummy
namespace is used if you don't supply your own class. namespace is used if you don't supply your own class.
# DOCUMENTATION FROM THE OpenAPI Spec # DOCUMENTATION FROM THE OpenAPI Spec
Additional documentation for each class and method may be provided by the Swagger Additional documentation for each class and method may be provided by the Swagger
spec. If so, this is available via the `class_documentation()` and spec. If so, this is available via the `class_documentation()` and
`method_documentation()` methods on each generated object class, and the `method_documentation()` methods on each generated object class, and the
`method_documentation()` method on the endpoint API classes: `method_documentation()` method on the endpoint API classes:
my $cmdoc = $api->pet_api->method_documentation->{$method_name};
my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation;
my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name};
my $cmdoc = $api->pet_api->method_documentation->{$method_name};
my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation;
my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name};
Each of these calls returns a hashref with various useful pieces of information. Each of these calls returns a hashref with various useful pieces of information.
@@ -248,38 +247,40 @@ use Something::Deep::Object::ModelReturn;
# for displaying the API response data # for displaying the API response data
use Data::Dumper; use Data::Dumper;
use Something::Deep::Configuration;
use Something::Deep::;
my $api_instance = Something::Deep::FakeApi->new(); my $api_instance = Something::Deep::FakeApi->new();
my $test code inject */ &#39; &quot; &#x3D;end = 'test code inject */ ' " =end_example'; # string | To test code injection */ ' \" my $test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r = 'test code inject */ ' " =end __ \r\n \n \r_example'; # string | To test code injection */ ' \" =_end -- \\r\\n \\n \\r
eval { eval {
$api_instance->test_code_inject____end(test code inject */ &#39; &quot; &#x3D;end => $test code inject */ &#39; &quot; &#x3D;end); $api_instance->test_code_inject____end__rn_n_r(test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r => $test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r);
}; };
if ($@) { if ($@) {
warn "Exception when calling FakeApi->test_code_inject____end: $@\n"; warn "Exception when calling FakeApi->test_code_inject____end__rn_n_r: $@\n";
} }
``` ```
# DOCUMENTATION FOR API ENDPOINTS # DOCUMENTATION FOR API ENDPOINTS
All URIs are relative to *https://petstore.swagger.io */ &#39; &quot; &#x3D;end/v2 */ &#39; &quot; &#x3D;end* All URIs are relative to *https://petstore.swagger.io */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r/v2 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r*
Class | Method | HTTP request | Description Class | Method | HTTP request | Description
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
*FakeApi* | [**test_code_inject____end**](docs/FakeApi.md#test_code_inject____end) | **PUT** /fake | To test code injection */ &#39; \&quot; *FakeApi* | [**test_code_inject____end__rn_n_r**](docs/FakeApi.md#test_code_inject____end__rn_n_r) | **PUT** /fake | To test code injection */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
# DOCUMENTATION FOR MODELS # DOCUMENTATION FOR MODELS
- [Something::Deep::Object::ModelReturn](docs/ModelReturn.md) - [Something::Deep::Object::ModelReturn](docs/ModelReturn.md)
# DOCUMENTATION FOR AUTHORIATION # DOCUMENTATION FOR AUTHORIZATION
## api_key ## api_key
- **Type**: API key - **Type**: API key
- **API key parameter name**: api_key */ ' " =end - **API key parameter name**: api_key */ ' " =end -- \r\n \n \r
- **Location**: HTTP header - **Location**: HTTP header
## petstore_auth ## petstore_auth
@@ -288,8 +289,6 @@ Class | Method | HTTP request | Description
- **Flow**: implicit - **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**: - **Scopes**:
- **write:pets**: modify pets in your account */ ' " =end - **write:pets**: modify pets in your account */ ' \" =_end -- \\r\\n \\n \\r
- **read:pets**: read your pets */ ' " =end - **read:pets**: read your pets */ ' \" =_end -- \\r\\n \\n \\r

View File

@@ -5,30 +5,32 @@
use Something::Deep::Object::FakeApi; use Something::Deep::Object::FakeApi;
``` ```
All URIs are relative to *https://petstore.swagger.io */ &#39; &quot; &#x3D;end/v2 */ &#39; &quot; &#x3D;end* All URIs are relative to *https://petstore.swagger.io */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r/v2 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r*
Method | HTTP request | Description Method | HTTP request | Description
------------- | ------------- | ------------- ------------- | ------------- | -------------
[**test_code_inject____end**](FakeApi.md#test_code_inject____end) | **PUT** /fake | To test code injection */ &#39; \&quot; [**test_code_inject____end__rn_n_r**](FakeApi.md#test_code_inject____end__rn_n_r) | **PUT** /fake | To test code injection */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
# **test_code_inject____end** # **test_code_inject____end__rn_n_r**
> test_code_inject____end(test code inject */ &#39; &quot; &#x3D;end => $test code inject */ &#39; &quot; &#x3D;end) > test_code_inject____end__rn_n_r(test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r => $test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r)
To test code injection */ ' \" To test code injection */ ' \" =_end -- \\r\\n \\n \\r
### Example ### Example
```perl ```perl
use Data::Dumper; use Data::Dumper;
use Something::Deep::Configuration;
use Something::Deep::FakeApi;
my $api_instance = Something::Deep::FakeApi->new(); my $api_instance = Something::Deep::FakeApi->new();
my $test code inject */ &#39; &quot; &#x3D;end = 'test code inject */ ' " =end_example'; # string | To test code injection */ ' \" my $test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r = 'test code inject */ ' " =end __ \r\n \n \r_example'; # string | To test code injection */ ' \" =_end -- \\r\\n \\n \\r
eval { eval {
$api_instance->test_code_inject____end(test code inject */ &#39; &quot; &#x3D;end => $test code inject */ &#39; &quot; &#x3D;end); $api_instance->test_code_inject____end__rn_n_r(test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r => $test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r);
}; };
if ($@) { if ($@) {
warn "Exception when calling FakeApi->test_code_inject____end: $@\n"; warn "Exception when calling FakeApi->test_code_inject____end__rn_n_r: $@\n";
} }
``` ```
@@ -36,7 +38,7 @@ if ($@) {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**test code inject */ &#39; &quot; &#x3D;end** | **string**| To test code injection */ &#39; \&quot; | [optional] **test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r** | **string**| To test code injection */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r | [optional]
### Return type ### Return type
@@ -48,8 +50,8 @@ No authorization required
### HTTP request headers ### HTTP request headers
- **Content-Type**: application/json, */ " =end - **Content-Type**: application/json, */ \" =_end --
- **Accept**: 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) [[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)

View File

@@ -8,7 +8,7 @@ use Something::Deep::Object::ModelReturn;
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**return** | **int** | property description */ &#39; \&quot; | [optional] **return** | **int** | property description */ &#39; \&quot; &#x3D;_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) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" 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: \" \\ */ ' \" 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 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end comment =end comment
=cut =cut
@@ -58,7 +46,7 @@ sub _new_instance
my $class = shift; my $class = shift;
my (%args) = ( my (%args) = (
'ua' => LWP::UserAgent->new, 'ua' => LWP::UserAgent->new,
'base_url' => 'https://petstore.swagger.io */ &#39; &quot; &#x3D;end/v2 */ &#39; &quot; &#x3D;end', 'base_url' => 'https://petstore.swagger.io */ ' \" =_end -- \\r\\n \\n \\r/v2 */ ' \" =_end -- \\r\\n \\n \\r',
@_ @_
); );
@@ -352,9 +340,9 @@ sub update_params_for_auth {
} }
elsif ($auth eq 'api_key') { elsif ($auth eq 'api_key') {
my $api_key = $self->get_api_key_with_prefix('api_key */ &#39; &quot; &#x3D;end'); my $api_key = $self->get_api_key_with_prefix('api_key */ &#39; &quot; &#x3D;end -- \r\n \n \r');
if ($api_key) { if ($api_key) {
$header_params->{'api_key */ &#39; &quot; &#x3D;end'} = $api_key; $header_params->{'api_key */ &#39; &quot; &#x3D;end -- \r\n \n \r'} = $api_key;
} }
} }
elsif ($auth eq 'petstore_auth') { elsif ($auth eq 'petstore_auth') {

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" 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: \" \\ */ ' \" 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 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end comment =end comment
=cut =cut

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" 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: \" \\ */ ' \" 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 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end comment =end comment
=cut =cut
@@ -42,7 +30,7 @@ use constant VERSION => '1.0.0';
# class/static variables # class/static variables
our $http_timeout = 180; our $http_timeout = 180;
our $http_user_agent = 'Perl-Swagger'; our $http_user_agent = 'Swagger-Codegen/1.0.0/perl';
# authentication setting # authentication setting
our $api_key = {}; our $api_key = {};

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" 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: \" \\ */ ' \" 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 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end comment =end comment
=cut =cut
@@ -64,33 +52,32 @@ sub new {
# #
# test_code_inject____end # test_code_inject____end__rn_n_r
# #
# To test code injection */ ' \" # To test code injection */ ' \" =_end -- \\r\\n \\n \\r
# #
# @param string $test code inject */ &#39; &quot; &#x3D;end To test code injection */ &#39; \&quot; (optional) # @param string $test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r To test code injection */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r (optional)
{ {
my $params = { my $params = {
'test code inject */ &#39; &quot; &#x3D;end' => { 'test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r' => {
data_type => 'string', data_type => 'string',
description => 'To test code injection */ &#39; \&quot; ', description => 'To test code injection */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r',
required => '0', required => '0',
}, },
}; };
__PACKAGE__->method_documentation->{ 'test_code_inject____end' } = { __PACKAGE__->method_documentation->{ 'test_code_inject____end__rn_n_r' } = {
summary => 'To test code injection */ &#39; \&quot; ', summary => 'To test code injection */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r',
params => $params, params => $params,
returns => undef, returns => undef,
}; };
} }
# @return void # @return void
# #
sub test_code_inject____end { sub test_code_inject____end__rn_n_r {
my ($self, %args) = @_; my ($self, %args) = @_;
# parse inputs # parse inputs
my $_resource_path = '/fake'; my $_resource_path = '/fake';
$_resource_path =~ s/{format}/json/; # default format to json
my $_method = 'PUT'; my $_method = 'PUT';
my $query_params = {}; my $query_params = {};
@@ -98,15 +85,15 @@ sub test_code_inject____end {
my $form_params = {}; my $form_params = {};
# 'Accept' and 'Content-Type' header # 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/json', '*/ " =end'); my $_header_accept = $self->{api_client}->select_header_accept('application/json', '*/ \" =_end -- ');
if ($_header_accept) { if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept; $header_params->{'Accept'} = $_header_accept;
} }
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json', '*/ " =end'); $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json', '*/ \" =_end -- ');
# form params # form params
if ( exists $args{'test code inject */ &#39; &quot; &#x3D;end'} ) { if ( exists $args{'test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r'} ) {
$form_params->{'test code inject */ &#39; &quot; &#x3D;end'} = $self->{api_client}->to_form_value($args{'test code inject */ &#39; &quot; &#x3D;end'}); $form_params->{'test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r'} = $self->{api_client}->to_form_value($args{'test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r'});
} }
my $_body_data; my $_body_data;

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" 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: \" \\ */ ' \" 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 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end comment =end comment
=cut =cut
@@ -46,7 +34,7 @@ use base ("Class::Accessor", "Class::Data::Inheritable");
# #
#Model for testing reserved words */ &#39; \&quot; #Model for testing reserved words */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
# #
# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. # NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
# REF: https://github.com/swagger-api/swagger-codegen # REF: https://github.com/swagger-api/swagger-codegen
@@ -54,26 +42,14 @@ use base ("Class::Accessor", "Class::Data::Inheritable");
=begin comment =begin comment
Swagger Petstore */ ' \" 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: \" \\ */ ' \" 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 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end comment =end comment
=cut =cut
@@ -160,7 +136,7 @@ sub _deserialize {
__PACKAGE__->class_documentation({description => 'Model for testing reserved words */ &#39; \&quot; ', __PACKAGE__->class_documentation({description => 'Model for testing reserved words */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r',
class => 'ModelReturn', class => 'ModelReturn',
required => [], # TODO required => [], # TODO
} ); } );
@@ -169,7 +145,7 @@ __PACKAGE__->method_documentation({
'return' => { 'return' => {
datatype => 'int', datatype => 'int',
base_name => 'return', base_name => 'return',
description => 'property description */ &#39; \&quot; ', description => 'property description */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r',
format => '', format => '',
read_only => '', read_only => '',
}, },

View File

@@ -1,31 +1,19 @@
=begin comment =begin comment
Swagger Petstore */ ' \" 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: \" \\ */ ' \" 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 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end comment =end comment
=cut =cut
# #
# NOTE: This class is auto generated by the swagger code generator program. # NOTE: This class is auto generated by the swagger code generator program.
# Do not edit the class manually. # Do not edit the class manually.
# Ref: https://github.com/swagger-api/swagger-codegen # Ref: https://github.com/swagger-api/swagger-codegen
# #
@@ -46,7 +34,7 @@ has base_url => ( is => 'ro',
has api_factory => ( is => 'ro', has api_factory => ( is => 'ro',
isa => 'Something::Deep::ApiFactory', isa => 'Something::Deep::ApiFactory',
builder => '_build_af', builder => '_build_af',
lazy => 1, lazy => 1,
documentation => 'Builds an instance of the endpoint API class', documentation => 'Builds an instance of the endpoint API class',
); );
@@ -63,49 +51,48 @@ has _cfg => ( is => 'ro',
default => 'Something::Deep::Configuration', default => 'Something::Deep::Configuration',
); );
has version_info => ( is => 'ro', has version_info => ( is => 'ro',
isa => 'HashRef', isa => 'HashRef',
default => sub { { default => sub { {
app_name => 'Swagger Petstore */ &#39; \&quot; ', app_name => 'Swagger Petstore */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r',
app_version => '1.0.0 */ &#39; \&quot; ', app_version => '1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r',
generated_date => '2016-06-28T16:32:37.043+08:00', generator_class => 'io.swagger.codegen.languages.PerlClientCodegen',
generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen',
} }, } },
documentation => 'Information about the application version and the codegen codebase version' documentation => 'Information about the application version and the codegen codebase version'
); );
sub BUILD { sub BUILD {
my $self = shift; my $self = shift;
$self->_cfg->accept_tokens( $self->tokens ) if keys %{$self->tokens}; $self->_cfg->accept_tokens( $self->tokens ) if keys %{$self->tokens};
# ignore these symbols imported into API namespaces # ignore these symbols imported into API namespaces
my %outsiders = map {$_ => 1} qw( croak ); my %outsiders = map {$_ => 1} qw( croak );
my %delegates; my %delegates;
# collect the methods callable on each API # collect the methods callable on each API
foreach my $api_name ($self->api_factory->apis_available) { foreach my $api_name ($self->api_factory->apis_available) {
my $api_class = $self->api_factory->classname_for($api_name); my $api_class = $self->api_factory->classname_for($api_name);
my $methods = Class::Inspector->methods($api_class, 'expanded'); # not Moose, so use CI instead my $methods = Class::Inspector->methods($api_class, 'expanded'); # not Moose, so use CI instead
my @local_methods = grep {! /^_/} grep {! $outsiders{$_}} map {$_->[2]} grep {$_->[1] eq $api_class} @$methods; my @local_methods = grep {! /^_/} grep {! $outsiders{$_}} map {$_->[2]} grep {$_->[1] eq $api_class} @$methods;
push( @{$delegates{$_}}, {api_name => $api_name, api_class => $api_class} ) for @local_methods; push( @{$delegates{$_}}, {api_name => $api_name, api_class => $api_class} ) for @local_methods;
} }
# remove clashes # remove clashes
foreach my $method (keys %delegates) { foreach my $method (keys %delegates) {
if ( @{$delegates{$method}} > 1 ) { if ( @{$delegates{$method}} > 1 ) {
my ($apis) = delete $delegates{$method}; my ($apis) = delete $delegates{$method};
} }
} }
# build the flattened API # build the flattened API
foreach my $api_name ($self->api_factory->apis_available) { foreach my $api_name ($self->api_factory->apis_available) {
my $att_name = sprintf "%s_api", lc($api_name); my $att_name = sprintf "%s_api", lc($api_name);
my $api_class = $self->api_factory->classname_for($api_name); my $api_class = $self->api_factory->classname_for($api_name);
my @delegated = grep { $delegates{$_}->[0]->{api_name} eq $api_name } keys %delegates; my @delegated = grep { $delegates{$_}->[0]->{api_name} eq $api_name } keys %delegates;
$log->debugf("Adding API: '%s' handles %s", $att_name, join ', ', @delegated); $log->debugf("Adding API: '%s' handles %s", $att_name, join ', ', @delegated);
$self->meta->add_attribute( $att_name => ( $self->meta->add_attribute( $att_name => (
is => 'ro', is => 'ro',
isa => $api_class, isa => $api_class,
default => sub {$self->api_factory->get_api($api_name)}, default => sub {$self->api_factory->get_api($api_name)},
@@ -124,62 +111,59 @@ sub _build_af {
=head1 NAME =head1 NAME
Something::Deep::Role - a Moose role for the Swagger Petstore */ &#39; \&quot; Something::Deep::Role - a Moose role for the Swagger Petstore */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
=head2 Swagger Petstore */ &#39; \&quot; version: 1.0.0 */ &#39; \&quot; =head2 Swagger Petstore */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
=head1 VERSION =head1 VERSION
Automatically generated by the Perl Swagger Codegen project: Automatically generated by the Perl Swagger Codegen project:
=over 4 =over 4
=item Build package: io.swagger.codegen.languages.PerlClientCodegen
=item Build date: 2016-06-28T16:32:37.043+08:00 =item Codegen version:
=item Build package: class io.swagger.codegen.languages.PerlClientCodegen
=item Codegen version:
=back =back
=head2 A note on Moose =head2 A note on Moose
This role is the only component of the library that uses Moose. See This role is the only component of the library that uses Moose. See
Something::Deep::ApiFactory for non-Moosey usage. Something::Deep::ApiFactory for non-Moosey usage.
=head1 SYNOPSIS =head1 SYNOPSIS
The Perl Swagger Codegen project builds a library of Perl modules to interact with The Perl Swagger Codegen project builds a library of Perl modules to interact with
a web service defined by a OpenAPI Specification. See below for how to build the a web service defined by a OpenAPI Specification. See below for how to build the
library. library.
This module provides an interface to the generated library. All the classes, This module provides an interface to the generated library. All the classes,
objects, and methods (well, not quite *all*, see below) are flattened into this objects, and methods (well, not quite *all*, see below) are flattened into this
role. role.
package MyApp; package MyApp;
use Moose; use Moose;
with 'Something::Deep::Role'; with 'Something::Deep::Role';
package main; package main;
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
my $pet = $api->get_pet_by_id(pet_id => $pet_id); my $pet = $api->get_pet_by_id(pet_id => $pet_id);
=head2 Structure of the library =head2 Structure of the library
The library consists of a set of API classes, one for each endpoint. These APIs The library consists of a set of API classes, one for each endpoint. These APIs
implement the method calls available on each endpoint. implement the method calls available on each endpoint.
Additionally, there is a set of "object" classes, which represent the objects Additionally, there is a set of "object" classes, which represent the objects
returned by and sent to the methods on the endpoints. returned by and sent to the methods on the endpoints.
An API factory class is provided, which builds instances of each endpoint API. An API factory class is provided, which builds instances of each endpoint API.
This Moose role flattens all the methods from the endpoint APIs onto the consuming This Moose role flattens all the methods from the endpoint APIs onto the consuming
class. It also provides methods to retrieve the endpoint API objects, and the API class. It also provides methods to retrieve the endpoint API objects, and the API
factory object, should you need it. factory object, should you need it.
For documentation of all these methods, see AUTOMATIC DOCUMENTATION below. For documentation of all these methods, see AUTOMATIC DOCUMENTATION below.
@@ -192,33 +176,33 @@ required and where to put them. You just need to supply the tokens.
# basic # basic
username => $username, username => $username,
password => $password, password => $password,
# oauth # oauth
access_token => $oauth_token, access_token => $oauth_token,
# keys # keys
$some_key => { token => $token, $some_key => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
$another => { token => $token, $another => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
..., ...,
}; };
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
Note these are all optional, as are C<prefix> and C<in>, and depend on the API Note these are all optional, as are C<prefix> and C<in>, and depend on the API
you are accessing. Usually C<prefix> and C<in> will be determined by the code generator from you are accessing. Usually C<prefix> and C<in> will be determined by the code generator from
the spec and you will not need to set them at run time. If not, C<in> will the spec and you will not need to set them at run time. If not, C<in> will
default to 'head' and C<prefix> to the empty string. default to 'head' and C<prefix> to the empty string.
The tokens will be placed in the C<Something::Deep::Configuration> namespace The tokens will be placed in the C<Something::Deep::Configuration> namespace
as follows, but you don't need to know about this. as follows, but you don't need to know about this.
=over 4 =over 4
@@ -251,7 +235,7 @@ all api keys require a prefix.
=item C<$Something::Deep::Configuration::access_token> =item C<$Something::Deep::Configuration::access_token>
String. The OAuth access token. String. The OAuth access token.
=back =back
@@ -259,16 +243,16 @@ String. The OAuth access token.
=head2 C<base_url> =head2 C<base_url>
The generated code has the C<base_url> already set as a default value. This method The generated code has the C<base_url> already set as a default value. This method
returns (and optionally sets, but only if the API client has not been returns (and optionally sets, but only if the API client has not been
created yet) the current value of C<base_url>. created yet) the current value of C<base_url>.
=head2 C<api_factory> =head2 C<api_factory>
Returns an API factory object. You probably won't need to call this directly. Returns an API factory object. You probably won't need to call this directly.
$self->api_factory('Pet'); # returns a Something::Deep::PetApi instance $self->api_factory('Pet'); # returns a Something::Deep::PetApi instance
$self->pet_api; # the same $self->pet_api; # the same
=head1 MISSING METHODS =head1 MISSING METHODS
@@ -278,9 +262,9 @@ Most of the methods on the API are delegated to individual endpoint API objects
same method name (e.g. C<new()>), these methods can't be delegated. So you need same method name (e.g. C<new()>), these methods can't be delegated. So you need
to call C<$api-E<gt>pet_api-E<gt>new()>. to call C<$api-E<gt>pet_api-E<gt>new()>.
In principle, every API is susceptible to the presence of a few, random, undelegatable In principle, every API is susceptible to the presence of a few, random, undelegatable
method names. In practice, because of the way method names are constructed, it's method names. In practice, because of the way method names are constructed, it's
unlikely in general that any methods will be undelegatable, except for: unlikely in general that any methods will be undelegatable, except for:
new() new()
class_documentation() class_documentation()
@@ -293,12 +277,12 @@ you could also call them on class names.
=head1 BUILDING YOUR LIBRARY =head1 BUILDING YOUR LIBRARY
See the homepage C<https://github.com/swagger-api/swagger-codegen> for full details. See the homepage C<https://github.com/swagger-api/swagger-codegen> for full details.
But briefly, clone the git repository, build the codegen codebase, set up your build But briefly, clone the git repository, build the codegen codebase, set up your build
config file, then run the API build script. You will need git, Java 7 or 8 and Apache config file, then run the API build script. You will need git, Java 7 or 8 and Apache
maven 3.0.3 or better already installed. maven 3.0.3 or better already installed.
The config file should specify the project name for the generated library: The config file should specify the project name for the generated library:
{"moduleName":"WWW::MyProjectName"} {"moduleName":"WWW::MyProjectName"}
@@ -313,8 +297,8 @@ Your library files will be built under C<WWW::MyProjectName>.
-c /path/to/config/file.json \ -c /path/to/config/file.json \
-o /path/to/output/folder -o /path/to/output/folder
Bang, all done. Run the C<autodoc> script in the C<bin> directory to see the API Bang, all done. Run the C<autodoc> script in the C<bin> directory to see the API
you just built. you just built.
=head1 AUTOMATIC DOCUMENTATION =head1 AUTOMATIC DOCUMENTATION
@@ -326,28 +310,28 @@ output formats are supported:
-w wide format (default) -w wide format (default)
-n narrow format -n narrow format
-p POD format -p POD format
-H HTML format -H HTML format
-m Markdown format -m Markdown format
-h print this help message -h print this help message
-c your application class -c your application class
The C<-c> option allows you to load and inspect your own application. A dummy The C<-c> option allows you to load and inspect your own application. A dummy
namespace is used if you don't supply your own class. namespace is used if you don't supply your own class.
=head1 DOCUMENTATION FROM THE OpenAPI Spec =head1 DOCUMENTATION FROM THE OpenAPI Spec
Additional documentation for each class and method may be provided by the Swagger Additional documentation for each class and method may be provided by the Swagger
spec. If so, this is available via the C<class_documentation()> and spec. If so, this is available via the C<class_documentation()> and
C<method_documentation()> methods on each generated object class, and the C<method_documentation()> methods on each generated object class, and the
C<method_documentation()> method on the endpoint API classes: C<method_documentation()> method on the endpoint API classes:
my $cmdoc = $api->pet_api->method_documentation->{$method_name}; my $cmdoc = $api->pet_api->method_documentation->{$method_name};
my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation; my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation;
my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name}; my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name};
Each of these calls returns a hashref with various useful pieces of information. Each of these calls returns a hashref with various useful pieces of information.
=cut =cut

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" 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: \" \\ */ ' \" 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 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end comment =end comment
=cut =cut

View File

@@ -5,30 +5,32 @@
use WWW::SwaggerClient::Object::FakeApi; use WWW::SwaggerClient::Object::FakeApi;
``` ```
All URIs are relative to *https://petstore.swagger.io */ &#39; &quot; &#x3D;end/v2 */ &#39; &quot; &#x3D;end* All URIs are relative to *https://petstore.swagger.io */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r/v2 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r*
Method | HTTP request | Description Method | HTTP request | Description
------------- | ------------- | ------------- ------------- | ------------- | -------------
[**test_code_inject____end**](FakeApi.md#test_code_inject____end) | **PUT** /fake | To test code injection */ &#39; \&quot; [**test_code_inject____end__rn_n_r**](FakeApi.md#test_code_inject____end__rn_n_r) | **PUT** /fake | To test code injection */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
# **test_code_inject____end** # **test_code_inject____end__rn_n_r**
> test_code_inject____end(test code inject */ &#39; &quot; &#x3D;end => $test code inject */ &#39; &quot; &#x3D;end) > test_code_inject____end__rn_n_r(test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r => $test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r)
To test code injection */ ' \" To test code injection */ ' \" =_end -- \\r\\n \\n \\r
### Example ### Example
```perl ```perl
use Data::Dumper; use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::FakeApi;
my $api_instance = WWW::SwaggerClient::FakeApi->new(); my $api_instance = WWW::SwaggerClient::FakeApi->new();
my $test code inject */ &#39; &quot; &#x3D;end = 'test code inject */ ' " =end_example'; # string | To test code injection */ ' \" my $test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r = 'test code inject */ ' " =end __ \r\n \n \r_example'; # string | To test code injection */ ' \" =_end -- \\r\\n \\n \\r
eval { eval {
$api_instance->test_code_inject____end(test code inject */ &#39; &quot; &#x3D;end => $test code inject */ &#39; &quot; &#x3D;end); $api_instance->test_code_inject____end__rn_n_r(test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r => $test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r);
}; };
if ($@) { if ($@) {
warn "Exception when calling FakeApi->test_code_inject____end: $@\n"; warn "Exception when calling FakeApi->test_code_inject____end__rn_n_r: $@\n";
} }
``` ```
@@ -36,7 +38,7 @@ if ($@) {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**test code inject */ &#39; &quot; &#x3D;end** | **string**| To test code injection */ &#39; \&quot; | [optional] **test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r** | **string**| To test code injection */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r | [optional]
### Return type ### Return type
@@ -48,8 +50,8 @@ No authorization required
### HTTP request headers ### HTTP request headers
- **Content-Type**: application/json, */ " =end - **Content-Type**: application/json, */ \" =_end --
- **Accept**: 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) [[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)

View File

@@ -8,7 +8,7 @@ use WWW::SwaggerClient::Object::ModelReturn;
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**return** | **int** | property description */ &#39; \&quot; | [optional] **return** | **int** | property description */ &#39; \&quot; &#x3D;_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) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" 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: \" \\ */ ' \" 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 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end comment =end comment
=cut =cut
@@ -58,7 +46,7 @@ sub _new_instance
my $class = shift; my $class = shift;
my (%args) = ( my (%args) = (
'ua' => LWP::UserAgent->new, 'ua' => LWP::UserAgent->new,
'base_url' => 'https://petstore.swagger.io */ &#39; &quot; &#x3D;end/v2 */ &#39; &quot; &#x3D;end', 'base_url' => 'https://petstore.swagger.io */ ' \" =_end -- \\r\\n \\n \\r/v2 */ ' \" =_end -- \\r\\n \\n \\r',
@_ @_
); );
@@ -352,9 +340,9 @@ sub update_params_for_auth {
} }
elsif ($auth eq 'api_key') { elsif ($auth eq 'api_key') {
my $api_key = $self->get_api_key_with_prefix('api_key */ &#39; &quot; &#x3D;end'); my $api_key = $self->get_api_key_with_prefix('api_key */ &#39; &quot; &#x3D;end -- \r\n \n \r');
if ($api_key) { if ($api_key) {
$header_params->{'api_key */ &#39; &quot; &#x3D;end'} = $api_key; $header_params->{'api_key */ &#39; &quot; &#x3D;end -- \r\n \n \r'} = $api_key;
} }
} }
elsif ($auth eq 'petstore_auth') { elsif ($auth eq 'petstore_auth') {

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" 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: \" \\ */ ' \" 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 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end comment =end comment
=cut =cut

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" 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: \" \\ */ ' \" 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 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end comment =end comment
=cut =cut
@@ -42,7 +30,7 @@ use constant VERSION => '1.0.0';
# class/static variables # class/static variables
our $http_timeout = 180; our $http_timeout = 180;
our $http_user_agent = 'Perl-Swagger'; our $http_user_agent = 'Swagger-Codegen/1.0.0/perl';
# authentication setting # authentication setting
our $api_key = {}; our $api_key = {};

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" 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: \" \\ */ ' \" 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 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end comment =end comment
=cut =cut
@@ -64,33 +52,32 @@ sub new {
# #
# test_code_inject____end # test_code_inject____end__rn_n_r
# #
# To test code injection */ ' \" # To test code injection */ ' \" =_end -- \\r\\n \\n \\r
# #
# @param string $test code inject */ &#39; &quot; &#x3D;end To test code injection */ &#39; \&quot; (optional) # @param string $test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r To test code injection */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r (optional)
{ {
my $params = { my $params = {
'test code inject */ &#39; &quot; &#x3D;end' => { 'test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r' => {
data_type => 'string', data_type => 'string',
description => 'To test code injection */ &#39; \&quot; ', description => 'To test code injection */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r',
required => '0', required => '0',
}, },
}; };
__PACKAGE__->method_documentation->{ 'test_code_inject____end' } = { __PACKAGE__->method_documentation->{ 'test_code_inject____end__rn_n_r' } = {
summary => 'To test code injection */ &#39; \&quot; ', summary => 'To test code injection */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r',
params => $params, params => $params,
returns => undef, returns => undef,
}; };
} }
# @return void # @return void
# #
sub test_code_inject____end { sub test_code_inject____end__rn_n_r {
my ($self, %args) = @_; my ($self, %args) = @_;
# parse inputs # parse inputs
my $_resource_path = '/fake'; my $_resource_path = '/fake';
$_resource_path =~ s/{format}/json/; # default format to json
my $_method = 'PUT'; my $_method = 'PUT';
my $query_params = {}; my $query_params = {};
@@ -98,15 +85,15 @@ sub test_code_inject____end {
my $form_params = {}; my $form_params = {};
# 'Accept' and 'Content-Type' header # 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/json', '*/ " =end'); my $_header_accept = $self->{api_client}->select_header_accept('application/json', '*/ \" =_end -- ');
if ($_header_accept) { if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept; $header_params->{'Accept'} = $_header_accept;
} }
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json', '*/ " =end'); $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json', '*/ \" =_end -- ');
# form params # form params
if ( exists $args{'test code inject */ &#39; &quot; &#x3D;end'} ) { if ( exists $args{'test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r'} ) {
$form_params->{'test code inject */ &#39; &quot; &#x3D;end'} = $self->{api_client}->to_form_value($args{'test code inject */ &#39; &quot; &#x3D;end'}); $form_params->{'test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r'} = $self->{api_client}->to_form_value($args{'test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r'});
} }
my $_body_data; my $_body_data;

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" 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: \" \\ */ ' \" 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 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end comment =end comment
=cut =cut
@@ -46,7 +34,7 @@ use base ("Class::Accessor", "Class::Data::Inheritable");
# #
#Model for testing reserved words */ &#39; \&quot; #Model for testing reserved words */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
# #
# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. # NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
# REF: https://github.com/swagger-api/swagger-codegen # REF: https://github.com/swagger-api/swagger-codegen
@@ -54,26 +42,14 @@ use base ("Class::Accessor", "Class::Data::Inheritable");
=begin comment =begin comment
Swagger Petstore */ ' \" 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: \" \\ */ ' \" 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 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end comment =end comment
=cut =cut
@@ -160,7 +136,7 @@ sub _deserialize {
__PACKAGE__->class_documentation({description => 'Model for testing reserved words */ &#39; \&quot; ', __PACKAGE__->class_documentation({description => 'Model for testing reserved words */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r',
class => 'ModelReturn', class => 'ModelReturn',
required => [], # TODO required => [], # TODO
} ); } );
@@ -169,7 +145,7 @@ __PACKAGE__->method_documentation({
'return' => { 'return' => {
datatype => 'int', datatype => 'int',
base_name => 'return', base_name => 'return',
description => 'property description */ &#39; \&quot; ', description => 'property description */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r',
format => '', format => '',
read_only => '', read_only => '',
}, },

View File

@@ -1,31 +1,19 @@
=begin comment =begin comment
Swagger Petstore */ ' \" 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: \" \\ */ ' \" 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 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end comment =end comment
=cut =cut
# #
# NOTE: This class is auto generated by the swagger code generator program. # NOTE: This class is auto generated by the swagger code generator program.
# Do not edit the class manually. # Do not edit the class manually.
# Ref: https://github.com/swagger-api/swagger-codegen # Ref: https://github.com/swagger-api/swagger-codegen
# #
@@ -46,7 +34,7 @@ has base_url => ( is => 'ro',
has api_factory => ( is => 'ro', has api_factory => ( is => 'ro',
isa => 'WWW::SwaggerClient::ApiFactory', isa => 'WWW::SwaggerClient::ApiFactory',
builder => '_build_af', builder => '_build_af',
lazy => 1, lazy => 1,
documentation => 'Builds an instance of the endpoint API class', documentation => 'Builds an instance of the endpoint API class',
); );
@@ -63,49 +51,48 @@ has _cfg => ( is => 'ro',
default => 'WWW::SwaggerClient::Configuration', default => 'WWW::SwaggerClient::Configuration',
); );
has version_info => ( is => 'ro', has version_info => ( is => 'ro',
isa => 'HashRef', isa => 'HashRef',
default => sub { { default => sub { {
app_name => 'Swagger Petstore */ &#39; \&quot; ', app_name => 'Swagger Petstore */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r',
app_version => '1.0.0 */ &#39; \&quot; ', app_version => '1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r',
generated_date => '2016-06-28T16:32:36.006+08:00', generator_class => 'io.swagger.codegen.languages.PerlClientCodegen',
generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen',
} }, } },
documentation => 'Information about the application version and the codegen codebase version' documentation => 'Information about the application version and the codegen codebase version'
); );
sub BUILD { sub BUILD {
my $self = shift; my $self = shift;
$self->_cfg->accept_tokens( $self->tokens ) if keys %{$self->tokens}; $self->_cfg->accept_tokens( $self->tokens ) if keys %{$self->tokens};
# ignore these symbols imported into API namespaces # ignore these symbols imported into API namespaces
my %outsiders = map {$_ => 1} qw( croak ); my %outsiders = map {$_ => 1} qw( croak );
my %delegates; my %delegates;
# collect the methods callable on each API # collect the methods callable on each API
foreach my $api_name ($self->api_factory->apis_available) { foreach my $api_name ($self->api_factory->apis_available) {
my $api_class = $self->api_factory->classname_for($api_name); my $api_class = $self->api_factory->classname_for($api_name);
my $methods = Class::Inspector->methods($api_class, 'expanded'); # not Moose, so use CI instead my $methods = Class::Inspector->methods($api_class, 'expanded'); # not Moose, so use CI instead
my @local_methods = grep {! /^_/} grep {! $outsiders{$_}} map {$_->[2]} grep {$_->[1] eq $api_class} @$methods; my @local_methods = grep {! /^_/} grep {! $outsiders{$_}} map {$_->[2]} grep {$_->[1] eq $api_class} @$methods;
push( @{$delegates{$_}}, {api_name => $api_name, api_class => $api_class} ) for @local_methods; push( @{$delegates{$_}}, {api_name => $api_name, api_class => $api_class} ) for @local_methods;
} }
# remove clashes # remove clashes
foreach my $method (keys %delegates) { foreach my $method (keys %delegates) {
if ( @{$delegates{$method}} > 1 ) { if ( @{$delegates{$method}} > 1 ) {
my ($apis) = delete $delegates{$method}; my ($apis) = delete $delegates{$method};
} }
} }
# build the flattened API # build the flattened API
foreach my $api_name ($self->api_factory->apis_available) { foreach my $api_name ($self->api_factory->apis_available) {
my $att_name = sprintf "%s_api", lc($api_name); my $att_name = sprintf "%s_api", lc($api_name);
my $api_class = $self->api_factory->classname_for($api_name); my $api_class = $self->api_factory->classname_for($api_name);
my @delegated = grep { $delegates{$_}->[0]->{api_name} eq $api_name } keys %delegates; my @delegated = grep { $delegates{$_}->[0]->{api_name} eq $api_name } keys %delegates;
$log->debugf("Adding API: '%s' handles %s", $att_name, join ', ', @delegated); $log->debugf("Adding API: '%s' handles %s", $att_name, join ', ', @delegated);
$self->meta->add_attribute( $att_name => ( $self->meta->add_attribute( $att_name => (
is => 'ro', is => 'ro',
isa => $api_class, isa => $api_class,
default => sub {$self->api_factory->get_api($api_name)}, default => sub {$self->api_factory->get_api($api_name)},
@@ -124,62 +111,59 @@ sub _build_af {
=head1 NAME =head1 NAME
WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore */ &#39; \&quot; WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
=head2 Swagger Petstore */ &#39; \&quot; version: 1.0.0 */ &#39; \&quot; =head2 Swagger Petstore */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
=head1 VERSION =head1 VERSION
Automatically generated by the Perl Swagger Codegen project: Automatically generated by the Perl Swagger Codegen project:
=over 4 =over 4
=item Build package: io.swagger.codegen.languages.PerlClientCodegen
=item Build date: 2016-06-28T16:32:36.006+08:00 =item Codegen version:
=item Build package: class io.swagger.codegen.languages.PerlClientCodegen
=item Codegen version:
=back =back
=head2 A note on Moose =head2 A note on Moose
This role is the only component of the library that uses Moose. See This role is the only component of the library that uses Moose. See
WWW::SwaggerClient::ApiFactory for non-Moosey usage. WWW::SwaggerClient::ApiFactory for non-Moosey usage.
=head1 SYNOPSIS =head1 SYNOPSIS
The Perl Swagger Codegen project builds a library of Perl modules to interact with The Perl Swagger Codegen project builds a library of Perl modules to interact with
a web service defined by a OpenAPI Specification. See below for how to build the a web service defined by a OpenAPI Specification. See below for how to build the
library. library.
This module provides an interface to the generated library. All the classes, This module provides an interface to the generated library. All the classes,
objects, and methods (well, not quite *all*, see below) are flattened into this objects, and methods (well, not quite *all*, see below) are flattened into this
role. role.
package MyApp; package MyApp;
use Moose; use Moose;
with 'WWW::SwaggerClient::Role'; with 'WWW::SwaggerClient::Role';
package main; package main;
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
my $pet = $api->get_pet_by_id(pet_id => $pet_id); my $pet = $api->get_pet_by_id(pet_id => $pet_id);
=head2 Structure of the library =head2 Structure of the library
The library consists of a set of API classes, one for each endpoint. These APIs The library consists of a set of API classes, one for each endpoint. These APIs
implement the method calls available on each endpoint. implement the method calls available on each endpoint.
Additionally, there is a set of "object" classes, which represent the objects Additionally, there is a set of "object" classes, which represent the objects
returned by and sent to the methods on the endpoints. returned by and sent to the methods on the endpoints.
An API factory class is provided, which builds instances of each endpoint API. An API factory class is provided, which builds instances of each endpoint API.
This Moose role flattens all the methods from the endpoint APIs onto the consuming This Moose role flattens all the methods from the endpoint APIs onto the consuming
class. It also provides methods to retrieve the endpoint API objects, and the API class. It also provides methods to retrieve the endpoint API objects, and the API
factory object, should you need it. factory object, should you need it.
For documentation of all these methods, see AUTOMATIC DOCUMENTATION below. For documentation of all these methods, see AUTOMATIC DOCUMENTATION below.
@@ -192,33 +176,33 @@ required and where to put them. You just need to supply the tokens.
# basic # basic
username => $username, username => $username,
password => $password, password => $password,
# oauth # oauth
access_token => $oauth_token, access_token => $oauth_token,
# keys # keys
$some_key => { token => $token, $some_key => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
$another => { token => $token, $another => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
..., ...,
}; };
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
Note these are all optional, as are C<prefix> and C<in>, and depend on the API Note these are all optional, as are C<prefix> and C<in>, and depend on the API
you are accessing. Usually C<prefix> and C<in> will be determined by the code generator from you are accessing. Usually C<prefix> and C<in> will be determined by the code generator from
the spec and you will not need to set them at run time. If not, C<in> will the spec and you will not need to set them at run time. If not, C<in> will
default to 'head' and C<prefix> to the empty string. default to 'head' and C<prefix> to the empty string.
The tokens will be placed in the C<WWW::SwaggerClient::Configuration> namespace The tokens will be placed in the C<WWW::SwaggerClient::Configuration> namespace
as follows, but you don't need to know about this. as follows, but you don't need to know about this.
=over 4 =over 4
@@ -251,7 +235,7 @@ all api keys require a prefix.
=item C<$WWW::SwaggerClient::Configuration::access_token> =item C<$WWW::SwaggerClient::Configuration::access_token>
String. The OAuth access token. String. The OAuth access token.
=back =back
@@ -259,16 +243,16 @@ String. The OAuth access token.
=head2 C<base_url> =head2 C<base_url>
The generated code has the C<base_url> already set as a default value. This method The generated code has the C<base_url> already set as a default value. This method
returns (and optionally sets, but only if the API client has not been returns (and optionally sets, but only if the API client has not been
created yet) the current value of C<base_url>. created yet) the current value of C<base_url>.
=head2 C<api_factory> =head2 C<api_factory>
Returns an API factory object. You probably won't need to call this directly. Returns an API factory object. You probably won't need to call this directly.
$self->api_factory('Pet'); # returns a WWW::SwaggerClient::PetApi instance $self->api_factory('Pet'); # returns a WWW::SwaggerClient::PetApi instance
$self->pet_api; # the same $self->pet_api; # the same
=head1 MISSING METHODS =head1 MISSING METHODS
@@ -278,9 +262,9 @@ Most of the methods on the API are delegated to individual endpoint API objects
same method name (e.g. C<new()>), these methods can't be delegated. So you need same method name (e.g. C<new()>), these methods can't be delegated. So you need
to call C<$api-E<gt>pet_api-E<gt>new()>. to call C<$api-E<gt>pet_api-E<gt>new()>.
In principle, every API is susceptible to the presence of a few, random, undelegatable In principle, every API is susceptible to the presence of a few, random, undelegatable
method names. In practice, because of the way method names are constructed, it's method names. In practice, because of the way method names are constructed, it's
unlikely in general that any methods will be undelegatable, except for: unlikely in general that any methods will be undelegatable, except for:
new() new()
class_documentation() class_documentation()
@@ -293,12 +277,12 @@ you could also call them on class names.
=head1 BUILDING YOUR LIBRARY =head1 BUILDING YOUR LIBRARY
See the homepage C<https://github.com/swagger-api/swagger-codegen> for full details. See the homepage C<https://github.com/swagger-api/swagger-codegen> for full details.
But briefly, clone the git repository, build the codegen codebase, set up your build But briefly, clone the git repository, build the codegen codebase, set up your build
config file, then run the API build script. You will need git, Java 7 or 8 and Apache config file, then run the API build script. You will need git, Java 7 or 8 and Apache
maven 3.0.3 or better already installed. maven 3.0.3 or better already installed.
The config file should specify the project name for the generated library: The config file should specify the project name for the generated library:
{"moduleName":"WWW::MyProjectName"} {"moduleName":"WWW::MyProjectName"}
@@ -313,8 +297,8 @@ Your library files will be built under C<WWW::MyProjectName>.
-c /path/to/config/file.json \ -c /path/to/config/file.json \
-o /path/to/output/folder -o /path/to/output/folder
Bang, all done. Run the C<autodoc> script in the C<bin> directory to see the API Bang, all done. Run the C<autodoc> script in the C<bin> directory to see the API
you just built. you just built.
=head1 AUTOMATIC DOCUMENTATION =head1 AUTOMATIC DOCUMENTATION
@@ -326,28 +310,28 @@ output formats are supported:
-w wide format (default) -w wide format (default)
-n narrow format -n narrow format
-p POD format -p POD format
-H HTML format -H HTML format
-m Markdown format -m Markdown format
-h print this help message -h print this help message
-c your application class -c your application class
The C<-c> option allows you to load and inspect your own application. A dummy The C<-c> option allows you to load and inspect your own application. A dummy
namespace is used if you don't supply your own class. namespace is used if you don't supply your own class.
=head1 DOCUMENTATION FROM THE OpenAPI Spec =head1 DOCUMENTATION FROM THE OpenAPI Spec
Additional documentation for each class and method may be provided by the Swagger Additional documentation for each class and method may be provided by the Swagger
spec. If so, this is available via the C<class_documentation()> and spec. If so, this is available via the C<class_documentation()> and
C<method_documentation()> methods on each generated object class, and the C<method_documentation()> methods on each generated object class, and the
C<method_documentation()> method on the endpoint API classes: C<method_documentation()> method on the endpoint API classes:
my $cmdoc = $api->pet_api->method_documentation->{$method_name}; my $cmdoc = $api->pet_api->method_documentation->{$method_name};
my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation; my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation;
my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name}; my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name};
Each of these calls returns a hashref with various useful pieces of information. Each of these calls returns a hashref with various useful pieces of information.
=cut =cut

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" 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: \" \\ */ ' \" 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 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end comment =end comment
=cut =cut

View File

@@ -98,7 +98,6 @@ class FakeApi(object):
collection_formats = {} collection_formats = {}
resource_path = '/fake'.replace('{format}', 'json')
path_params = {} path_params = {}
query_params = {} query_params = {}
@@ -122,7 +121,7 @@ class FakeApi(object):
# Authentication setting # Authentication setting
auth_settings = [] auth_settings = []
return self.api_client.call_api(resource_path, 'PUT', return self.api_client.call_api('/fake', 'PUT',
path_params, path_params,
query_params, query_params,
header_params, header_params,

View File

@@ -34,8 +34,7 @@ class Configuration(object):
Constructor Constructor
""" """
# Default Base url # Default Base url
self.host = "https://petstore.swagger.io */ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r/v2 */ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r" self.host = "https://petstore.swagger.io */ ' \" =end -- \\r\\n \\n \\r/v2 */ ' \" =end -- \\r\\n \\n \\r"
# Temp file folder for downloading files # Temp file folder for downloading files
self.temp_folder_path = None self.temp_folder_path = None

View File

@@ -1,25 +1,13 @@
/** /**
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r * 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 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 * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =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. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*
* 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.
*/ */
#include "SWGFakeApi.h" #include "SWGFakeApi.h"
@@ -40,7 +28,7 @@ SWGFakeApi::SWGFakeApi(QString host, QString basePath) {
} }
void void
SWGFakeApi::testCodeInject */ &#39; &quot; &#x3D;end \r\n \n \r(QString* test code inject */ &#39; &quot; &#x3D;end \r\n \n \r) { SWGFakeApi::testCodeInject */ &#39; &quot; &#x3D;end \r\n \n \r(QString* test_code_inject____end____rn_n_r) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/fake"); fullPath.append(this->host).append(this->basePath).append("/fake");
@@ -49,8 +37,8 @@ SWGFakeApi::testCodeInject */ &#39; &quot; &#x3D;end \r\n \n \r(QString* test co
HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "PUT"); HttpRequestInput input(fullPath, "PUT");
if (test code inject */ &#39; &quot; &#x3D;end \r\n \n \r != NULL) { if (test_code_inject____end____rn_n_r != nullptr) {
input.add_var("test code inject */ &#39; &quot; &#x3D;end \r\n \n \r", *test code inject */ &#39; &quot; &#x3D;end \r\n \n \r); input.add_var("test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r", *test_code_inject____end____rn_n_r);
} }
@@ -59,13 +47,13 @@ SWGFakeApi::testCodeInject */ &#39; &quot; &#x3D;end \r\n \n \r(QString* test co
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &HttpRequestWorker::on_execution_finished,
this, this,
&SWGFakeApi::testCodeInject */ &#39; &quot; &#x3D;end \r\n \n \rCallback); &SWGFakeApi::testCodeInject */ &#39; &quot; &#x3D;end \r\n \n \rCallback);
worker->execute(&input); worker->execute(&input);
} }
void void
SWGFakeApi::testCodeInject */ &#39; &quot; &#x3D;end \r\n \n \rCallback(HttpRequestWorker * worker) { SWGFakeApi::testCodeInject */ &#39; &quot; &#x3D;end \r\n \n \rCallback(HttpRequestWorker * worker) {
QString msg; QString msg;
if (worker->error_type == QNetworkReply::NoError) { if (worker->error_type == QNetworkReply::NoError) {
msg = QString("Success! %1 bytes").arg(worker->response.length()); msg = QString("Success! %1 bytes").arg(worker->response.length());
@@ -79,6 +67,6 @@ SWGFakeApi::testCodeInject */ &#39; &quot; &#x3D;end \r\n \n \rCallback(HttpRequ
worker->deleteLater(); worker->deleteLater();
emit testCodeInject */ &#39; &quot; &#x3D;end \r\n \n \rSignal(); emit testCodeInject */ &#39; &quot; &#x3D;end \r\n \n \rSignal();
} }
} /* namespace Swagger */ } /* namespace Swagger */

View File

@@ -1,25 +1,13 @@
/** /**
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r * 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 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 * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =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. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*
* 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.
*/ */
#ifndef _SWG_SWGFakeApi_H_ #ifndef _SWG_SWGFakeApi_H_
@@ -44,13 +32,13 @@ public:
QString host; QString host;
QString basePath; QString basePath;
void testCodeInject */ &#39; &quot; &#x3D;end \r\n \n \r(QString* test code inject */ &#39; &quot; &#x3D;end \r\n \n \r); void testCodeInject */ &#39; &quot; &#x3D;end \r\n \n \r(QString* test_code_inject____end____rn_n_r);
private: private:
void testCodeInject */ &#39; &quot; &#x3D;end \r\n \n \rCallback (HttpRequestWorker * worker); void testCodeInject */ &#39; &quot; &#x3D;end \r\n \n \rCallback (HttpRequestWorker * worker);
signals: signals:
void testCodeInject */ &#39; &quot; &#x3D;end \r\n \n \rSignal(); void testCodeInject */ &#39; &quot; &#x3D;end \r\n \n \rSignal();
}; };
} }

View File

@@ -1,25 +1,13 @@
/** /**
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r * 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 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 * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =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. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*
* 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.
*/ */
#include "SWGHelpers.h" #include "SWGHelpers.h"
@@ -28,12 +16,13 @@
#include <QDebug> #include <QDebug>
#include <QJsonArray> #include <QJsonArray>
#include <QJsonValue> #include <QJsonValue>
#include <QDateTime>
namespace Swagger { namespace Swagger {
void void
setValue(void* value, QJsonValue obj, QString type, QString complexType) { setValue(void* value, QJsonValue obj, QString type, QString complexType) {
if(value == NULL) { if(value == nullptr) {
// can't set value with a null pointer // can't set value with a null pointer
return; return;
} }
@@ -60,7 +49,7 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
else if (QStringLiteral("QString").compare(type) == 0) { else if (QStringLiteral("QString").compare(type) == 0) {
QString **val = static_cast<QString**>(value); QString **val = static_cast<QString**>(value);
if(val != NULL) { if(val != nullptr) {
if(!obj.isNull()) { if(!obj.isNull()) {
// create a new value and return // create a new value and return
delete *val; delete *val;
@@ -68,19 +57,19 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
return; return;
} }
else { else {
// set target to NULL // set target to nullptr
delete *val; delete *val;
*val = NULL; *val = nullptr;
} }
} }
else { else {
qDebug() << "Can't set value because the target pointer is NULL"; qDebug() << "Can't set value because the target pointer is nullptr";
} }
} }
else if (QStringLiteral("QDateTime").compare(type) == 0) { else if (QStringLiteral("QDateTime").compare(type) == 0) {
QDateTime **val = static_cast<QDateTime**>(value); QDateTime **val = static_cast<QDateTime**>(value);
if(val != NULL) { if(val != nullptr) {
if(!obj.isNull()) { if(!obj.isNull()) {
// create a new value and return // create a new value and return
delete *val; delete *val;
@@ -88,19 +77,19 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
return; return;
} }
else { else {
// set target to NULL // set target to nullptr
delete *val; delete *val;
*val = NULL; *val = nullptr;
} }
} }
else { else {
qDebug() << "Can't set value because the target pointer is NULL"; qDebug() << "Can't set value because the target pointer is nullptr";
} }
} }
else if (QStringLiteral("QDate").compare(type) == 0) { else if (QStringLiteral("QDate").compare(type) == 0) {
QDate **val = static_cast<QDate**>(value); QDate **val = static_cast<QDate**>(value);
if(val != NULL) { if(val != nullptr) {
if(!obj.isNull()) { if(!obj.isNull()) {
// create a new value and return // create a new value and return
delete *val; delete *val;
@@ -108,20 +97,41 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
return; return;
} }
else { else {
// set target to NULL // set target to nullptr
delete *val; delete *val;
*val = NULL; *val = nullptr;
} }
} }
else { else {
qDebug() << "Can't set value because the target pointer is NULL"; 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()) { else if(type.startsWith("SWG") && obj.isObject()) {
// complex type // complex type
QJsonObject jsonObj = obj.toObject(); QJsonObject jsonObj = obj.toObject();
SWGObject * so = (SWGObject*)Swagger::create(type); SWGObject * so = (SWGObject*)Swagger::create(type);
if(so != NULL) { if(so != nullptr) {
so->fromJsonObject(jsonObj); so->fromJsonObject(jsonObj);
SWGObject **val = static_cast<SWGObject**>(value); SWGObject **val = static_cast<SWGObject**>(value);
delete *val; delete *val;
@@ -169,19 +179,19 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
output->append((void*)&val); output->append((void*)&val);
} }
else if(QStringLiteral("QString").compare(complexType) == 0) { else if(QStringLiteral("QString").compare(complexType) == 0) {
QString val; QString * val = new QString();
setValue(&val, jval, QStringLiteral("QString"), QStringLiteral("")); setValue(&val, jval, QStringLiteral("QString"), QStringLiteral(""));
output->append((void*)&val); output->append((void*)val);
} }
else if(QStringLiteral("QDate").compare(complexType) == 0) { else if(QStringLiteral("QDate").compare(complexType) == 0) {
QDate val; QDate * val = new QDate();
setValue(&val, jval, QStringLiteral("QDate"), QStringLiteral("")); setValue(&val, jval, QStringLiteral("QDate"), QStringLiteral(""));
output->append((void*)&val); output->append((void*)val);
} }
else if(QStringLiteral("QDateTime").compare(complexType) == 0) { else if(QStringLiteral("QDateTime").compare(complexType) == 0) {
QDateTime val; QDateTime * val = new QDateTime();
setValue(&val, jval, QStringLiteral("QDateTime"), QStringLiteral("")); setValue(&val, jval, QStringLiteral("QDateTime"), QStringLiteral(""));
output->append((void*)&val); output->append((void*)val);
} }
} }
} }
@@ -193,14 +203,14 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
void void
toJsonValue(QString name, void* value, QJsonObject* output, QString type) { toJsonValue(QString name, void* value, QJsonObject* output, QString type) {
if(value == NULL) { if(value == nullptr) {
return; return;
} }
if(type.startsWith("SWG")) { if(type.startsWith("SWG")) {
SWGObject *swgObject = reinterpret_cast<SWGObject *>(value); SWGObject *swgObject = reinterpret_cast<SWGObject *>(value);
if(swgObject != NULL) { if(swgObject != nullptr) {
QJsonObject* o = (*swgObject).asJsonObject(); QJsonObject* o = (*swgObject).asJsonObject();
if(name != NULL) { if(name != nullptr) {
output->insert(name, *o); output->insert(name, *o);
delete o; delete o;
} }
@@ -244,6 +254,10 @@ toJsonValue(QString name, void* value, QJsonObject* output, QString type) {
QDateTime* datetime = static_cast<QDateTime*>(value); QDateTime* datetime = static_cast<QDateTime*>(value);
output->insert(name, QJsonValue(datetime->toString(Qt::ISODate))); 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 void
@@ -251,7 +265,7 @@ toJsonArray(QList<void*>* value, QJsonArray* output, QString innerName, QString
foreach(void* obj, *value) { foreach(void* obj, *value) {
QJsonObject element; QJsonObject element;
toJsonValue(NULL, obj, &element, innerType); toJsonValue(nullptr, obj, &element, innerType);
output->append(element); output->append(element);
} }
} }

View File

@@ -1,25 +1,13 @@
/** /**
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r * 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 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 * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =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. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*
* 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.
*/ */
#ifndef SWGHELPERS_H #ifndef SWGHELPERS_H

View File

@@ -1,25 +1,13 @@
/** /**
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r * 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 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 * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =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. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*
* 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.
*/ */
#include "SWGHttpRequest.h" #include "SWGHttpRequest.h"
@@ -60,7 +48,7 @@ void HttpRequestInput::add_file(QString variable_name, QString local_filename, Q
HttpRequestWorker::HttpRequestWorker(QObject *parent) HttpRequestWorker::HttpRequestWorker(QObject *parent)
: QObject(parent), manager(NULL) : QObject(parent), manager(nullptr)
{ {
qsrand(QDateTime::currentDateTime().toTime_t()); qsrand(QDateTime::currentDateTime().toTime_t());
@@ -204,8 +192,8 @@ void HttpRequestWorker::execute(HttpRequestInput *input) {
// ensure necessary variables are available // ensure necessary variables are available
if ( if (
file_info->local_filename == NULL || file_info->local_filename.isEmpty() file_info->local_filename == nullptr || file_info->local_filename.isEmpty()
|| file_info->variable_name == NULL || file_info->variable_name.isEmpty() || file_info->variable_name == nullptr || file_info->variable_name.isEmpty()
|| !fi.exists() || !fi.isFile() || !fi.isReadable() || !fi.exists() || !fi.isFile() || !fi.isReadable()
) { ) {
// silent abort for the current file // silent abort for the current file
@@ -219,7 +207,7 @@ void HttpRequestWorker::execute(HttpRequestInput *input) {
} }
// ensure filename for the request // ensure filename for the request
if (file_info->request_filename == NULL || file_info->request_filename.isEmpty()) { if (file_info->request_filename == nullptr || file_info->request_filename.isEmpty()) {
file_info->request_filename = fi.fileName(); file_info->request_filename = fi.fileName();
if (file_info->request_filename.isEmpty()) { if (file_info->request_filename.isEmpty()) {
file_info->request_filename = "file"; file_info->request_filename = "file";
@@ -238,7 +226,7 @@ void HttpRequestWorker::execute(HttpRequestInput *input) {
)); ));
request_content.append(new_line); request_content.append(new_line);
if (file_info->mime_type != NULL && !file_info->mime_type.isEmpty()) { if (file_info->mime_type != nullptr && !file_info->mime_type.isEmpty()) {
request_content.append("Content-Type: "); request_content.append("Content-Type: ");
request_content.append(file_info->mime_type); request_content.append(file_info->mime_type);
request_content.append(new_line); request_content.append(new_line);

View File

@@ -1,25 +1,13 @@
/** /**
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r * 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 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 * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =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. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*
* 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.
*/ */
/** /**

View File

@@ -1,25 +1,13 @@
/** /**
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r * 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 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 * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =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. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*
* 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.
*/ */
#ifndef ModelFactory_H_ #ifndef ModelFactory_H_
@@ -34,19 +22,19 @@ namespace Swagger {
return new SWGReturn(); return new SWGReturn();
} }
return NULL; return nullptr;
} }
inline void* create(QString json, QString type) { inline void* create(QString json, QString type) {
void* val = create(type); void* val = create(type);
if(val != NULL) { if(val != nullptr) {
SWGObject* obj = static_cast<SWGObject*>(val); SWGObject* obj = static_cast<SWGObject*>(val);
return obj->fromJson(json); return obj->fromJson(json);
} }
if(type.startsWith("QString")) { if(type.startsWith("QString")) {
return new QString(); return new QString();
} }
return NULL; return nullptr;
} }
} /* namespace Swagger */ } /* namespace Swagger */

View File

@@ -1,25 +1,13 @@
/** /**
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r * 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 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 * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =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. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*
* 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.
*/ */
#ifndef _SWG_OBJECT_H_ #ifndef _SWG_OBJECT_H_
@@ -30,12 +18,12 @@
class SWGObject { class SWGObject {
public: public:
virtual QJsonObject* asJsonObject() { virtual QJsonObject* asJsonObject() {
return NULL; return nullptr;
} }
virtual ~SWGObject() {} virtual ~SWGObject() {}
virtual SWGObject* fromJson(QString &jsonString) { virtual SWGObject* fromJson(QString &jsonString) {
Q_UNUSED(jsonString); Q_UNUSED(jsonString);
return NULL; return nullptr;
} }
virtual void fromJsonObject(QJsonObject &json) { virtual void fromJsonObject(QJsonObject &json) {
Q_UNUSED(json); Q_UNUSED(json);

View File

@@ -1,25 +1,13 @@
/** /**
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r * 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 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 * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =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. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*
* 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.
*/ */
@@ -69,7 +57,7 @@ SWGReturn::fromJson(QString &json) {
void void
SWGReturn::fromJsonObject(QJsonObject &pJson) { SWGReturn::fromJsonObject(QJsonObject &pJson) {
setValue(&return, pJson["return"], "qint32", ""); ::Swagger::setValue(&return, pJson["return"], "qint32", "");
} }
QString QString
@@ -85,6 +73,7 @@ SWGReturn::asJson ()
QJsonObject* QJsonObject*
SWGReturn::asJsonObject() { SWGReturn::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject* obj = new QJsonObject();
obj->insert("return", QJsonValue(return)); obj->insert("return", QJsonValue(return));
return obj; return obj;

View File

@@ -1,31 +1,19 @@
/** /**
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r * 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 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 * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =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. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*
* 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.
*/ */
/* /*
* SWGReturn.h * SWGReturn.h
* *
* Model for testing reserved words *_/ &#39; \&quot; &#x3D;end \\r\\n \\n \\r * Model for testing reserved words *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
*/ */
#ifndef SWGReturn_H_ #ifndef SWGReturn_H_
@@ -56,6 +44,7 @@ public:
qint32 getReturn(); qint32 getReturn();
void setReturn(qint32 return); void setReturn(qint32 return);
private: private:
qint32 return; qint32 return;
}; };

View File

@@ -1,16 +1,5 @@
# Generated by: https://github.com/swagger-api/swagger-codegen.git # Generated by: https://github.com/swagger-api/swagger-codegen.git
# #
# 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.
*.gem *.gem
*.rbc *.rbc

View File

@@ -0,0 +1,7 @@
source 'https://rubygems.org'
gemspec
group :development, :test do
gem 'rake', '~> 12.0.0'
end

View File

@@ -8,8 +8,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/
- API version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r - API version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
- Package version: 1.0.0 - Package version: 1.0.0
- Build date: 2016-08-29T14:24:34.432-07:00 - Build package: io.swagger.codegen.languages.RubyClientCodegen
- Build package: class io.swagger.codegen.languages.RubyClientCodegen
## Installation ## Installation
@@ -87,6 +86,12 @@ Class | Method | HTTP request | Description
## Documentation for Authorization ## Documentation for Authorization
### api_key
- **Type**: API key
- **API key parameter name**: api_key */ &#39; &quot; &#x3D;end -- \r\n \n \r
- **Location**: HTTP header
### petstore_auth ### petstore_auth
- **Type**: OAuth - **Type**: OAuth
@@ -96,9 +101,3 @@ Class | Method | HTTP request | Description
- write:pets: modify pets in your account */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r - write:pets: modify pets in your account */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
- read:pets: read your pets */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r - read:pets: read your pets */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
### api_key
- **Type**: API key
- **API key parameter name**: api_key */ &#39; &quot; &#x3D;end -- \r\n \n \r
- **Location**: HTTP header

View File

@@ -0,0 +1,8 @@
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task default: :spec
rescue LoadError
# no rspec available
end

View File

@@ -2,18 +2,6 @@
# #
# Generated by: https://github.com/swagger-api/swagger-codegen.git # Generated by: https://github.com/swagger-api/swagger-codegen.git
# #
# 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.
#
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ # 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" # Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"

View File

@@ -7,18 +7,6 @@ OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end =end
# Common files # Common files

View File

@@ -7,18 +7,6 @@ OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end =end
require "uri" require "uri"
@@ -51,21 +39,17 @@ module Petstore
@api_client.config.logger.debug "Calling API: FakeApi.test_code_inject____end__rn_n_r ..." @api_client.config.logger.debug "Calling API: FakeApi.test_code_inject____end__rn_n_r ..."
end end
# resource path # resource path
local_var_path = "/fake".sub('{format}','json') local_var_path = "/fake"
# query parameters # query parameters
query_params = {} query_params = {}
# header parameters # header parameters
header_params = {} header_params = {}
# HTTP header 'Accept' (if needed) # HTTP header 'Accept' (if needed)
local_header_accept = ['application/json', '*/ \" =_end -- '] header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/ \" =_end -- '])
local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
# HTTP header 'Content-Type' # HTTP header 'Content-Type'
local_header_content_type = ['application/json', '*/ \" =_end -- '] header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', '*/ \" =_end -- '])
header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
# form parameters # form parameters
form_params = {} form_params = {}

View File

@@ -7,18 +7,6 @@ OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end =end
require 'date' require 'date'
@@ -142,10 +130,11 @@ module Petstore
# application/json # application/json
# application/json; charset=UTF8 # application/json; charset=UTF8
# APPLICATION/JSON # APPLICATION/JSON
# */*
# @param [String] mime MIME # @param [String] mime MIME
# @return [Boolean] True if the MIME is application/json # @return [Boolean] True if the MIME is application/json
def json_mime?(mime) def json_mime?(mime)
!(mime =~ /\Aapplication\/json(;.*)?\z/i).nil? (mime == "*/*") || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
end end
# Deserialize the response to the given return type. # Deserialize the response to the given return type.

View File

@@ -7,18 +7,6 @@ OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end =end
module Petstore module Petstore
@@ -32,12 +20,14 @@ module Petstore
# ApiError.new(:code => 404, :message => "Not Found") # ApiError.new(:code => 404, :message => "Not Found")
def initialize(arg = nil) def initialize(arg = nil)
if arg.is_a? Hash if arg.is_a? Hash
if arg.key?(:message) || arg.key?('message')
super(arg[:message] || arg['message'])
else
super arg
end
arg.each do |k, v| arg.each do |k, v|
if k.to_s == 'message' instance_variable_set "@#{k}", v
super v
else
instance_variable_set "@#{k}", v
end
end end
else else
super arg super arg

View File

@@ -7,18 +7,6 @@ OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end =end
require 'uri' require 'uri'
@@ -201,13 +189,6 @@ module Petstore
# Returns Auth Settings hash for api client. # Returns Auth Settings hash for api client.
def auth_settings def auth_settings
{ {
'petstore_auth' =>
{
type: 'oauth2',
in: 'header',
key: 'Authorization',
value: "Bearer #{access_token}"
},
'api_key' => 'api_key' =>
{ {
type: 'api_key', type: 'api_key',
@@ -215,6 +196,13 @@ module Petstore
key: 'api_key */ &#39; &quot; &#x3D;end -- \r\n \n \r', key: 'api_key */ &#39; &quot; &#x3D;end -- \r\n \n \r',
value: api_key_with_prefix('api_key */ &#39; &quot; &#x3D;end -- \r\n \n \r') value: api_key_with_prefix('api_key */ &#39; &quot; &#x3D;end -- \r\n \n \r')
}, },
'petstore_auth' =>
{
type: 'oauth2',
in: 'header',
key: 'Authorization',
value: "Bearer #{access_token}"
},
} }
end end
end end

View File

@@ -7,18 +7,6 @@ OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end =end
require 'date' require 'date'
@@ -97,7 +85,7 @@ module Petstore
def build_from_hash(attributes) def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash) return nil unless attributes.is_a?(Hash)
self.class.swagger_types.each_pair do |key, type| self.class.swagger_types.each_pair do |key, type|
if type =~ /^Array<(.*)>/i if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the the attribute # check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not # is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array) if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -128,7 +116,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false
@@ -139,7 +127,7 @@ module Petstore
when /\AArray<(?<inner_type>.+)>\z/ when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type] inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) } value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type] k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type] v_type = Regexp.last_match[:v_type]
{}.tap do |hash| {}.tap do |hash|

View File

@@ -7,18 +7,6 @@ OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end =end
module Petstore module Petstore

View File

@@ -9,18 +9,6 @@ OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
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.
=end =end
$:.push File.expand_path("../lib", __FILE__) $:.push File.expand_path("../lib", __FILE__)
@@ -35,7 +23,9 @@ Gem::Specification.new do |s|
s.homepage = "https://github.com/swagger-api/swagger-codegen" s.homepage = "https://github.com/swagger-api/swagger-codegen"
s.summary = "Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r Ruby Gem" s.summary = "Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r Ruby Gem"
s.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 -- " s.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 -- "
s.license = "Apache 2.0 */ ' \" =_end -- \\r\\n \\n \\r" # TODO uncommnet and update below with a proper license
#s.license = "Apache 2.0"
s.required_ruby_version = ">= 1.9"
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
s.add_runtime_dependency 'json', '~> 1.8', '>= 1.8.3' s.add_runtime_dependency 'json', '~> 1.8', '>= 1.8.3'

View File

@@ -156,6 +156,11 @@
<artifactId>jackson-module-scala_2.10</artifactId> <artifactId>jackson-module-scala_2.10</artifactId>
<version>${jackson-version}</version> <version>${jackson-version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency> <dependency>
<groupId>com.sun.jersey</groupId> <groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId> <artifactId>jersey-client</artifactId>
@@ -210,7 +215,7 @@
<joda-version>1.2</joda-version> <joda-version>1.2</joda-version>
<joda-time-version>2.2</joda-time-version> <joda-time-version>2.2</joda-time-version>
<jersey-version>1.19</jersey-version> <jersey-version>1.19</jersey-version>
<swagger-core-version>1.5.9</swagger-core-version> <swagger-core-version>1.5.12</swagger-core-version>
<jersey-async-version>1.0.5</jersey-async-version> <jersey-async-version>1.0.5</jersey-async-version>
<maven-plugin.version>1.0.0</maven-plugin.version> <maven-plugin.version>1.0.0</maven-plugin.version>
<jackson-version>2.4.2</jackson-version> <jackson-version>2.4.2</jackson-version>

View File

@@ -24,6 +24,7 @@ import com.sun.jersey.multipart.file.FileDataBodyPart
import java.io.File import java.io.File
import java.net.URLEncoder import java.net.URLEncoder
import java.util.UUID
import javax.ws.rs.core.MediaType import javax.ws.rs.core.MediaType
import scala.collection.JavaConverters._ import scala.collection.JavaConverters._
@@ -66,6 +67,7 @@ class ApiInvoker(val mapper: ObjectMapper = ScalaJsonUtil.getJsonMapper,
def escape(value: Long): String = value.toString def escape(value: Long): String = value.toString
def escape(value: Double): String = value.toString def escape(value: Double): String = value.toString
def escape(value: Float): String = value.toString def escape(value: Float): String = value.toString
def escape(value: UUID): String = value.toString
def deserialize(json: String, containerType: String, cls: Class[_]) = { def deserialize(json: String, containerType: String, cls: Class[_]) = {
if (cls == classOf[String]) { if (cls == classOf[String]) {

View File

@@ -25,7 +25,7 @@ import java.util.Date
import scala.collection.mutable.HashMap import scala.collection.mutable.HashMap
class FakeApi(val defBasePath: String = "https://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r", class FakeApi(val defBasePath: String = "https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r",
defApiInvoker: ApiInvoker = ApiInvoker) { defApiInvoker: ApiInvoker = ApiInvoker) {
var basePath = defBasePath var basePath = defBasePath
var apiInvoker = defApiInvoker var apiInvoker = defApiInvoker

View File

@@ -15,5 +15,6 @@ package io.swagger.client.model
case class ModelReturn ( case class ModelReturn (
/* property description *_/ ' \" =end -- \\r\\n \\n \\r */ /* property description *_/ ' \" =end -- \\r\\n \\n \\r */
_return: Integer _return: Option[Integer]
) )

View File

@@ -0,0 +1,7 @@
import * as api from './api/api';
import * as angular from 'angular';
const apiModule = angular.module('api', [])
.service('FakeApi', api.FakeApi)
export default apiModule;

View File

@@ -0,0 +1,59 @@
/**
* 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.
*/
import * as models from '../model/models';
/* tslint:disable:no-unused-variable member-ordering */
export class FakeApi {
protected basePath = 'https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r';
public defaultHeaders : any = {};
static $inject: string[] = ['$http', '$httpParamSerializer', 'basePath'];
constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) {
if (basePath !== undefined) {
this.basePath = basePath;
}
}
/**
* To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
*
* @param test code inject * &#39; &quot; &#x3D;end rn n r To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
*/
public testCodeInjectEndRnNR (test code inject * &#39; &quot; &#x3D;end rn n r?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const localVarPath = this.basePath + '/fake';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: any = {};
headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
formParams['test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r'] = test code inject * &#39; &quot; &#x3D;end rn n r;
let httpRequestParams: ng.IRequestConfig = {
method: 'PUT',
url: localVarPath,
data: this.$httpParamSerializer(formParams),
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
}

Some files were not shown because too many files have changed in this diff Show More