diff --git a/modules/swagger-codegen/src/main/resources/flash/git_push.sh.mustache b/modules/swagger-codegen/src/main/resources/flash/git_push.sh.mustache new file mode 100755 index 00000000000..e153ce23ecf --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/flash/git_push.sh.mustache @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="{{{gitUserId}}}" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="{{{gitRepoId}}}" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="{{{releaseNote}}}" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/modules/swagger-codegen/src/main/resources/flash/gitignore.mustache b/modules/swagger-codegen/src/main/resources/flash/gitignore.mustache new file mode 100644 index 00000000000..f112f7fb78f --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/flash/gitignore.mustache @@ -0,0 +1,11 @@ +# Build and Release Folders +bin/ +bin-debug/ +bin-release/ + +# Other files and folders +.settings/ + +# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties` +# should NOT be excluded as they contain compiler settings and other important +# information for Eclipse / Flash Builder. diff --git a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/ApiResponse.scala b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/ApiResponse.scala new file mode 100644 index 00000000000..d1d2c29d588 --- /dev/null +++ b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/ApiResponse.scala @@ -0,0 +1,11 @@ +package io.swagger.client.model + +import org.joda.time.DateTime +import java.util.UUID + + +case class ApiResponse ( + code: Option[Integer], +_type: Option[String], +message: Option[String] +) diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/ApiResponseTests.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/ApiResponseTests.cs new file mode 100644 index 00000000000..c2535cdadb3 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/ApiResponseTests.cs @@ -0,0 +1,80 @@ +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing ApiResponse + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// + [TestFixture] + public class ApiResponseTests + { + private ApiResponse instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + instance = new ApiResponse(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of ApiResponse + /// + [Test] + public void ApiResponseInstanceTest() + { + Assert.IsInstanceOf (instance, "instance is a ApiResponse"); + } + + /// + /// Test the property 'Code' + /// + [Test] + public void CodeTest() + { + // TODO: unit test for the property 'Code' + } + /// + /// Test the property 'Type' + /// + [Test] + public void TypeTest() + { + // TODO: unit test for the property 'Type' + } + /// + /// Test the property 'Message' + /// + [Test] + public void MessageTest() + { + // TODO: unit test for the property 'Message' + } + + } + +} diff --git a/samples/client/petstore/dart/.gitignore b/samples/client/petstore/dart/.gitignore new file mode 100644 index 00000000000..7c280441649 --- /dev/null +++ b/samples/client/petstore/dart/.gitignore @@ -0,0 +1,27 @@ +# See https://www.dartlang.org/tools/private-files.html + +# Files and directories created by pub +.buildlog +.packages +.project +.pub/ +build/ +**/packages/ + +# Files created by dart2js +# (Most Dart developers will use pub build to compile Dart, use/modify these +# rules if you intend to use dart2js directly +# Convention is to use extension '.dart.js' for Dart compiled to Javascript to +# differentiate from explicit Javascript files) +*.dart.js +*.part.js +*.js.deps +*.js.map +*.info.json + +# Directory created by dartdoc +doc/api/ + +# Don't commit pubspec lock file +# (Library packages only! Remove pattern if developing an application package) +pubspec.lock diff --git a/samples/client/petstore/dart/git_push.sh b/samples/client/petstore/dart/git_push.sh new file mode 100644 index 00000000000..1a36388db02 --- /dev/null +++ b/samples/client/petstore/dart/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="YOUR_GIT_USR_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="YOUR_GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/dart/lib/model/api_response.dart b/samples/client/petstore/dart/lib/model/api_response.dart new file mode 100644 index 00000000000..e9746c587b0 --- /dev/null +++ b/samples/client/petstore/dart/lib/model/api_response.dart @@ -0,0 +1,23 @@ +part of api; + + +@Entity() +class ApiResponse { + + int code = null; + + + String type = null; + + + String message = null; + + ApiResponse(); + + @override + String toString() { + return 'ApiResponse[code=$code, type=$type, message=$message, ]'; + } + +} + diff --git a/samples/client/petstore/dart/test/packages b/samples/client/petstore/dart/test/packages new file mode 120000 index 00000000000..a16c4050155 --- /dev/null +++ b/samples/client/petstore/dart/test/packages @@ -0,0 +1 @@ +../packages \ No newline at end of file diff --git a/samples/client/petstore/flash/.gitignore b/samples/client/petstore/flash/.gitignore new file mode 100644 index 00000000000..f112f7fb78f --- /dev/null +++ b/samples/client/petstore/flash/.gitignore @@ -0,0 +1,11 @@ +# Build and Release Folders +bin/ +bin-debug/ +bin-release/ + +# Other files and folders +.settings/ + +# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties` +# should NOT be excluded as they contain compiler settings and other important +# information for Eclipse / Flash Builder. diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/200Response.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/200Response.as new file mode 100644 index 00000000000..d5319011e3a --- /dev/null +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/200Response.as @@ -0,0 +1,17 @@ +package io.swagger.client.model { + + + [XmlRootNode(name="200Response")] + public class 200Response { + [XmlElement(name="name")] + public var name: Number = 0; + + public function toString(): String { + var str: String = "200Response: "; + str += " (name: " + name + ")"; + return str; + } + +} + +} diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/200ResponseList.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/200ResponseList.as new file mode 100644 index 00000000000..006345f09e6 --- /dev/null +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/200ResponseList.as @@ -0,0 +1,17 @@ +package io.swagger.client.model { + +import io.swagger.common.ListWrapper; + + public class 200ResponseList implements ListWrapper { + // This declaration below of _200_response_obj_class is to force flash compiler to include this class + private var _200Response__obj_class: io.swagger.client.model.200Response = null; + [XmlElements(name="200Response_", type="io.swagger.client.model.200Response")] + public var 200Response_: Array = new Array(); + + public function getList(): Array{ + return 200Response_; + } + +} + +} diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/Animal.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/Animal.as new file mode 100644 index 00000000000..2f3faea88c0 --- /dev/null +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/Animal.as @@ -0,0 +1,17 @@ +package io.swagger.client.model { + + + [XmlRootNode(name="Animal")] + public class Animal { + [XmlElement(name="className")] + public var className: String = null; + + public function toString(): String { + var str: String = "Animal: "; + str += " (className: " + className + ")"; + return str; + } + +} + +} diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/AnimalList.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/AnimalList.as new file mode 100644 index 00000000000..11abdb96952 --- /dev/null +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/AnimalList.as @@ -0,0 +1,17 @@ +package io.swagger.client.model { + +import io.swagger.common.ListWrapper; + + public class AnimalList implements ListWrapper { + // This declaration below of _Animal_obj_class is to force flash compiler to include this class + private var _animal_obj_class: io.swagger.client.model.Animal = null; + [XmlElements(name="animal", type="io.swagger.client.model.Animal")] + public var animal: Array = new Array(); + + public function getList(): Array{ + return animal; + } + +} + +} diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/Cat.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/Cat.as new file mode 100644 index 00000000000..b479c53aae2 --- /dev/null +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/Cat.as @@ -0,0 +1,21 @@ +package io.swagger.client.model { + +import io.swagger.client.model.Animal; + + [XmlRootNode(name="Cat")] + public class Cat { + [XmlElement(name="className")] + public var className: String = null; + [XmlElement(name="declawed")] + public var declawed: Boolean = false; + + public function toString(): String { + var str: String = "Cat: "; + str += " (className: " + className + ")"; + str += " (declawed: " + declawed + ")"; + return str; + } + +} + +} diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/CatList.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/CatList.as new file mode 100644 index 00000000000..ed78fc168d2 --- /dev/null +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/CatList.as @@ -0,0 +1,18 @@ +package io.swagger.client.model { + +import io.swagger.common.ListWrapper; +import io.swagger.client.model.Animal; + + public class CatList implements ListWrapper { + // This declaration below of _Cat_obj_class is to force flash compiler to include this class + private var _cat_obj_class: io.swagger.client.model.Cat = null; + [XmlElements(name="cat", type="io.swagger.client.model.Cat")] + public var cat: Array = new Array(); + + public function getList(): Array{ + return cat; + } + +} + +} diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/Dog.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/Dog.as new file mode 100644 index 00000000000..521ed241a1a --- /dev/null +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/Dog.as @@ -0,0 +1,21 @@ +package io.swagger.client.model { + +import io.swagger.client.model.Animal; + + [XmlRootNode(name="Dog")] + public class Dog { + [XmlElement(name="className")] + public var className: String = null; + [XmlElement(name="breed")] + public var breed: String = null; + + public function toString(): String { + var str: String = "Dog: "; + str += " (className: " + className + ")"; + str += " (breed: " + breed + ")"; + return str; + } + +} + +} diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/DogList.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/DogList.as new file mode 100644 index 00000000000..76cc41fa703 --- /dev/null +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/DogList.as @@ -0,0 +1,18 @@ +package io.swagger.client.model { + +import io.swagger.common.ListWrapper; +import io.swagger.client.model.Animal; + + public class DogList implements ListWrapper { + // This declaration below of _Dog_obj_class is to force flash compiler to include this class + private var _dog_obj_class: io.swagger.client.model.Dog = null; + [XmlElements(name="dog", type="io.swagger.client.model.Dog")] + public var dog: Array = new Array(); + + public function getList(): Array{ + return dog; + } + +} + +} diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/FormatTest.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/FormatTest.as new file mode 100644 index 00000000000..d053a7dde1c --- /dev/null +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/FormatTest.as @@ -0,0 +1,51 @@ +package io.swagger.client.model { + +import io.swagger.client.model.ByteArray; + + [XmlRootNode(name="FormatTest")] + public class FormatTest { + [XmlElement(name="integer")] + public var integer: Number = NaN; + [XmlElement(name="int32")] + public var int32: Number = 0; + [XmlElement(name="int64")] + public var int64: Number = 0; + [XmlElement(name="number")] + public var number: Number = NaN; + [XmlElement(name="float")] + public var float: Number = 0.0; + [XmlElement(name="double")] + public var double: Number = 0.0; + [XmlElement(name="string")] + public var string: String = null; + [XmlElement(name="byte")] + public var byte: ByteArray = NaN; + [XmlElement(name="binary")] + public var binary: String = NaN; + [XmlElement(name="date")] + public var date: Date = null; + [XmlElement(name="dateTime")] + public var dateTime: Date = null; + [XmlElement(name="password")] + public var password: String = null; + + public function toString(): String { + var str: String = "FormatTest: "; + str += " (integer: " + integer + ")"; + str += " (int32: " + int32 + ")"; + str += " (int64: " + int64 + ")"; + str += " (number: " + number + ")"; + str += " (float: " + float + ")"; + str += " (double: " + double + ")"; + str += " (string: " + string + ")"; + str += " (byte: " + byte + ")"; + str += " (binary: " + binary + ")"; + str += " (date: " + date + ")"; + str += " (dateTime: " + dateTime + ")"; + str += " (password: " + password + ")"; + return str; + } + +} + +} diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/FormatTestList.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/FormatTestList.as new file mode 100644 index 00000000000..1f30a511dfc --- /dev/null +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/FormatTestList.as @@ -0,0 +1,18 @@ +package io.swagger.client.model { + +import io.swagger.common.ListWrapper; +import io.swagger.client.model.ByteArray; + + public class FormatTestList implements ListWrapper { + // This declaration below of _format_test_obj_class is to force flash compiler to include this class + private var _formatTest_obj_class: io.swagger.client.model.FormatTest = null; + [XmlElements(name="formatTest", type="io.swagger.client.model.FormatTest")] + public var formatTest: Array = new Array(); + + public function getList(): Array{ + return formatTest; + } + +} + +} diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/InlineResponse200.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/InlineResponse200.as new file mode 100644 index 00000000000..bb9a2848260 --- /dev/null +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/InlineResponse200.as @@ -0,0 +1,41 @@ +package io.swagger.client.model { + +import io.swagger.client.model.Object; +import io.swagger.client.model.Tag; + + [XmlRootNode(name="InlineResponse200")] + public class InlineResponse200 { + // This declaration below of _tags_obj_class is to force flash compiler to include this class + private var _tags_obj_class: Array = null; + [XmlElementWrapper(name="tags")] + [XmlElements(name="tags", type="Array")] + public var tags: Array = new Array(); + [XmlElement(name="id")] + public var id: Number = 0; + [XmlElement(name="category")] + public var category: Object = NaN; + /* pet status in the store */ + [XmlElement(name="status")] + public var status: String = null; + [XmlElement(name="name")] + public var name: String = null; + // This declaration below of _photoUrls_obj_class is to force flash compiler to include this class + private var _photoUrls_obj_class: Array = null; + [XmlElementWrapper(name="photoUrls")] + [XmlElements(name="photoUrls", type="Array")] + public var photoUrls: Array = new Array(); + + public function toString(): String { + var str: String = "InlineResponse200: "; + str += " (tags: " + tags + ")"; + str += " (id: " + id + ")"; + str += " (category: " + category + ")"; + str += " (status: " + status + ")"; + str += " (name: " + name + ")"; + str += " (photoUrls: " + photoUrls + ")"; + return str; + } + +} + +} diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/InlineResponse200List.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/InlineResponse200List.as new file mode 100644 index 00000000000..3ffb8bf7a6b --- /dev/null +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/InlineResponse200List.as @@ -0,0 +1,19 @@ +package io.swagger.client.model { + +import io.swagger.common.ListWrapper; +import io.swagger.client.model.Object; +import io.swagger.client.model.Tag; + + public class InlineResponse200List implements ListWrapper { + // This declaration below of _inline_response_200_obj_class is to force flash compiler to include this class + private var _inlineResponse200_obj_class: io.swagger.client.model.InlineResponse200 = null; + [XmlElements(name="inlineResponse200", type="io.swagger.client.model.InlineResponse200")] + public var inlineResponse200: Array = new Array(); + + public function getList(): Array{ + return inlineResponse200; + } + +} + +} diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/ModelReturn.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/ModelReturn.as new file mode 100644 index 00000000000..d87ae886145 --- /dev/null +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/ModelReturn.as @@ -0,0 +1,17 @@ +package io.swagger.client.model { + + + [XmlRootNode(name="ModelReturn")] + public class ModelReturn { + [XmlElement(name="return")] + public var return_: Number = 0; + + public function toString(): String { + var str: String = "ModelReturn: "; + str += " (return_: " + return_ + ")"; + return str; + } + +} + +} diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/ModelReturnList.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/ModelReturnList.as new file mode 100644 index 00000000000..7d73597b08f --- /dev/null +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/ModelReturnList.as @@ -0,0 +1,17 @@ +package io.swagger.client.model { + +import io.swagger.common.ListWrapper; + + public class ModelReturnList implements ListWrapper { + // This declaration below of _Return_obj_class is to force flash compiler to include this class + private var _return__obj_class: io.swagger.client.model.ModelReturn = null; + [XmlElements(name="return_", type="io.swagger.client.model.ModelReturn")] + public var return_: Array = new Array(); + + public function getList(): Array{ + return return_; + } + +} + +} diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/Name.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/Name.as new file mode 100644 index 00000000000..4dcbc6a68f2 --- /dev/null +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/Name.as @@ -0,0 +1,20 @@ +package io.swagger.client.model { + + + [XmlRootNode(name="Name")] + public class Name { + [XmlElement(name="name")] + public var name: Number = 0; + [XmlElement(name="snake_case")] + public var snakeCase: Number = 0; + + public function toString(): String { + var str: String = "Name: "; + str += " (name: " + name + ")"; + str += " (snakeCase: " + snakeCase + ")"; + return str; + } + +} + +} diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/NameList.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/NameList.as new file mode 100644 index 00000000000..e327f3eff8d --- /dev/null +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/NameList.as @@ -0,0 +1,17 @@ +package io.swagger.client.model { + +import io.swagger.common.ListWrapper; + + public class NameList implements ListWrapper { + // This declaration below of _Name_obj_class is to force flash compiler to include this class + private var _name_obj_class: io.swagger.client.model.Name = null; + [XmlElements(name="name", type="io.swagger.client.model.Name")] + public var name: Array = new Array(); + + public function getList(): Array{ + return name; + } + +} + +} diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/SpecialModelName.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/SpecialModelName.as new file mode 100644 index 00000000000..5834473e027 --- /dev/null +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/SpecialModelName.as @@ -0,0 +1,17 @@ +package io.swagger.client.model { + + + [XmlRootNode(name="SpecialModelName")] + public class SpecialModelName { + [XmlElement(name="$special[property.name]")] + public var $Special[propertyName]: Number = 0; + + public function toString(): String { + var str: String = "SpecialModelName: "; + str += " ($Special[propertyName]: " + $Special[propertyName] + ")"; + return str; + } + +} + +} diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/SpecialModelNameList.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/SpecialModelNameList.as new file mode 100644 index 00000000000..bdbb15aa74a --- /dev/null +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/SpecialModelNameList.as @@ -0,0 +1,17 @@ +package io.swagger.client.model { + +import io.swagger.common.ListWrapper; + + public class SpecialModelNameList implements ListWrapper { + // This declaration below of _$special[model.name]_obj_class is to force flash compiler to include this class + private var _$Special[modelName]_obj_class: io.swagger.client.model.SpecialModelName = null; + [XmlElements(name="$Special[modelName]", type="io.swagger.client.model.SpecialModelName")] + public var $Special[modelName]: Array = new Array(); + + public function getList(): Array{ + return $Special[modelName]; + } + +} + +} diff --git a/samples/client/petstore/flash/git_push.sh b/samples/client/petstore/flash/git_push.sh new file mode 100644 index 00000000000..1a36388db02 --- /dev/null +++ b/samples/client/petstore/flash/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="YOUR_GIT_USR_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="YOUR_GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/perl/docs/ApiResponse.md b/samples/client/petstore/perl/docs/ApiResponse.md new file mode 100644 index 00000000000..914cebf88ed --- /dev/null +++ b/samples/client/petstore/perl/docs/ApiResponse.md @@ -0,0 +1,17 @@ +# WWW::SwaggerClient::Object::ApiResponse + +## Load the model package +```perl +use WWW::SwaggerClient::Object::ApiResponse; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | [optional] +**type** | **string** | | [optional] +**message** | **string** | | [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) + + diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ApiResponse.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ApiResponse.pm new file mode 100644 index 00000000000..9203da585b7 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ApiResponse.pm @@ -0,0 +1,144 @@ +package WWW::SwaggerClient::Object::ApiResponse; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + +use base ("Class::Accessor", "Class::Data::Inheritable"); + + +# +# +# +#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# + +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('swagger_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + foreach my $attribute (keys %{$class->attribute_map}) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } + + return $self; +} + +# return perl hash +sub to_hash { + return decode_json(JSON->new->convert_blessed->encode( shift )); +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use swagger_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->swagger_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::SwaggerClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'ApiResponse', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'code' => { + datatype => 'int', + base_name => 'code', + description => '', + format => '', + read_only => '', + }, + 'type' => { + datatype => 'string', + base_name => 'type', + description => '', + format => '', + read_only => '', + }, + 'message' => { + datatype => 'string', + base_name => 'message', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->swagger_types( { + 'code' => 'int', + 'type' => 'string', + 'message' => 'string' +} ); + +__PACKAGE__->attribute_map( { + 'code' => 'code', + 'type' => 'type', + 'message' => 'message' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/t/ApiResponseTest.t b/samples/client/petstore/perl/t/ApiResponseTest.t new file mode 100644 index 00000000000..24ac730ecb9 --- /dev/null +++ b/samples/client/petstore/perl/t/ApiResponseTest.t @@ -0,0 +1,17 @@ +# NOTE: This class is auto generated by the Swagger Codegen +# Please update the test case below to test the model. + +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::SwaggerClient::Object::ApiResponse'); + +my $instance = WWW::SwaggerClient::Object::ApiResponse->new(); + +isa_ok($instance, 'WWW::SwaggerClient::Object::ApiResponse'); + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/ApiResponse.md b/samples/client/petstore/php/SwaggerClient-php/docs/ApiResponse.md new file mode 100644 index 00000000000..9d351183422 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/ApiResponse.md @@ -0,0 +1,12 @@ +# ApiResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | [optional] +**type** | **string** | | [optional] +**message** | **string** | | [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) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php new file mode 100644 index 00000000000..4f467a5aab5 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php @@ -0,0 +1,254 @@ + 'int', + 'type' => 'string', + 'message' => 'string' + ); + + static function swaggerTypes() { + return self::$swaggerTypes; + } + + /** + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ + static $attributeMap = array( + 'code' => 'code', + 'type' => 'type', + 'message' => 'message' + ); + + static function attributeMap() { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + static $setters = array( + 'code' => 'setCode', + 'type' => 'setType', + 'message' => 'setMessage' + ); + + static function setters() { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + static $getters = array( + 'code' => 'getCode', + 'type' => 'getType', + 'message' => 'getMessage' + ); + + static function getters() { + return self::$getters; + } + + /** + * $code + * @var int + */ + protected $code; + /** + * $type + * @var string + */ + protected $type; + /** + * $message + * @var string + */ + protected $message; + + /** + * Constructor + * @param mixed[] $data Associated array of property value initalizing the model + */ + public function __construct(array $data = null) + { + + + if ($data != null) { + $this->code = $data["code"]; + $this->type = $data["type"]; + $this->message = $data["message"]; + } + } + /** + * Gets code + * @return int + */ + public function getCode() + { + return $this->code; + } + + /** + * Sets code + * @param int $code + * @return $this + */ + public function setCode($code) + { + + $this->code = $code; + return $this; + } + /** + * Gets type + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Sets type + * @param string $type + * @return $this + */ + public function setType($type) + { + + $this->type = $type; + return $this; + } + /** + * Gets message + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Sets message + * @param string $message + * @return $this + */ + public function setMessage($message) + { + + $this->message = $message; + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * @param integer $offset Offset + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->$offset); + } + + /** + * Gets offset. + * @param integer $offset Offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->$offset; + } + + /** + * Sets value based on offset. + * @param integer $offset Offset + * @param mixed $value Value to be set + * @return void + */ + public function offsetSet($offset, $value) + { + $this->$offset = $value; + } + + /** + * Unsets offset. + * @param integer $offset Offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->$offset); + } + + /** + * Gets the string presentation of the object + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + } + + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); + } +} diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/ApiResponseTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/ApiResponseTest.php new file mode 100644 index 00000000000..5cc18107499 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/ApiResponseTest.php @@ -0,0 +1,70 @@ +