Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Anton WIMMER 2016-03-31 16:03:36 +02:00
commit d2f70cf107
111 changed files with 3267 additions and 176 deletions

View File

@ -87,7 +87,7 @@ To build from source, you need the following installed and available in your $PA
* [Java 7 or 8](http://java.oracle.com)
* [Apache maven 3.0.3 or greater](http://maven.apache.org/)
* [Apache maven 3.3.3 or greater](http://maven.apache.org/)
#### OS X Users
Don't forget to install Java 7 or 8. You probably have 1.6.
@ -740,6 +740,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
- [FH Münster - University of Applied Sciences](http://www.fh-muenster.de)
- [LANDR Audio](https://www.landr.com/)
- [LiveAgent](https://www.ladesk.com/)
- [Kuary](https://kuary.com/)
- [nViso](http://www.nviso.ch/)
- [Okiok](https://www.okiok.com)
- [OSDN](https://osdn.jp)

View File

@ -171,7 +171,7 @@
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-annotations-version>1.5.4</swagger-annotations-version>
<swagger-annotations-version>1.5.8</swagger-annotations-version>
<jersey-version>1.18</jersey-version>
<jackson-version>2.4.2</jackson-version>
<jodatime-version>2.3</jodatime-version>

View File

@ -111,7 +111,7 @@
</repositories>
<properties>
<maven-plugin-version>1.0.0</maven-plugin-version>
<swagger-inflector-version>1.0.4-SNAPSHOT</swagger-inflector-version>
<swagger-inflector-version>1.0.4</swagger-inflector-version>
<jetty-version>9.2.9.v20150224</jetty-version>
<logback-version>1.0.1</logback-version>
<junit-version>4.8.2</junit-version>

View File

@ -168,7 +168,7 @@
</repository>
</repositories>
<properties>
<swagger-core-version>1.5.7</swagger-core-version>
<swagger-core-version>1.5.8</swagger-core-version>
<jetty-version>9.2.9.v20150224</jetty-version>
<jersey-version>1.18.1</jersey-version>
<slf4j-version>1.6.3</slf4j-version>

View File

@ -145,7 +145,7 @@
</repository>
</repositories>
<properties>
<swagger-core-version>1.5.7</swagger-core-version>
<swagger-core-version>1.5.8</swagger-core-version>
<jetty-version>9.2.9.v20150224</jetty-version>
<resteasy-version>3.0.11.Final</resteasy-version>
<slf4j-version>1.6.3</slf4j-version>

View File

@ -159,7 +159,7 @@
</repository>
</repositories>
<properties>
<swagger-core-version>1.5.7</swagger-core-version>
<swagger-core-version>1.5.8</swagger-core-version>
<jetty-version>9.2.9.v20150224</jetty-version>
<jersey-version>1.13</jersey-version>
<slf4j-version>1.6.3</slf4j-version>

View File

@ -118,7 +118,7 @@
</dependency>
</dependencies>
<properties>
<swagger-core-version>1.5.7</swagger-core-version>
<swagger-core-version>1.5.8</swagger-core-version>
<jetty-version>9.2.9.v20150224</jetty-version>
<jersey-version>1.13</jersey-version>
<slf4j-version>1.6.3</slf4j-version>

View File

@ -6,7 +6,7 @@
{{/appDescription}}
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API verion: {{appVersion}}
- API version: {{appVersion}}
- Package version: {{projectVersion}}
- Build date: {{generatedDate}}
- Build package: {{generatorClass}}

View File

@ -217,7 +217,7 @@
<akka-version>2.3.9</akka-version>
<joda-version>1.2</joda-version>
<joda-time-version>2.2</joda-time-version>
<swagger-core-version>1.5.7</swagger-core-version>
<swagger-core-version>1.5.8</swagger-core-version>
<maven-plugin.version>1.0.0</maven-plugin.version>
<junit-version>4.8.1</junit-version>

View File

@ -8,9 +8,9 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.2'
classpath 'com.android.tools.build:gradle:1.5.+'
{{#useAndroidMavenGradlePlugin}}
classpath 'com.github.dcendents:android-maven-plugin:1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
{{/useAndroidMavenGradlePlugin}}
}
}
@ -28,11 +28,12 @@ apply plugin: 'com.github.dcendents.android-maven'
{{/useAndroidMavenGradlePlugin}}
android {
compileSdkVersion 22
buildToolsVersion '22.0.0'
compileSdkVersion 23
buildToolsVersion '23.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
targetSdkVersion 23
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
@ -55,16 +56,17 @@ android {
ext {
swagger_annotations_version = "1.5.0"
gson_version = "2.3.1"
httpclient_version = "4.3.3"
junit_version = "4.8.1"
httpclient_version = "4.5.2"
httpcore_version = "4.4.4"
junit_version = "4.12"
}
dependencies {
compile "io.swagger:swagger-annotations:$swagger_annotations_version"
compile "com.google.code.gson:gson:$gson_version"
compile "org.apache.httpcomponents:httpcore:$httpclient_version"
compile "org.apache.httpcomponents:httpcore:$httpcore_version"
compile "org.apache.httpcomponents:httpclient:$httpclient_version"
compile ("org.apache.httpcomponents:httpcore:$httpclient_version") {
compile ("org.apache.httpcomponents:httpcore:$httpcore_version") {
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
}
compile ("org.apache.httpcomponents:httpmime:$httpclient_version") {

View File

@ -197,7 +197,8 @@ public class ApiInvoker {
INSTANCE.authentications.put("{{name}}", new HttpBasicAuth());
{{/isBasic}}
{{#isOAuth}}
INSTANCE.authentications.put("{{name}}", new OAuth());
// TODO: comment out below as OAuth does not exist
//INSTANCE.authentications.put("{{name}}", new OAuth());
{{/isOAuth}}
{{/authMethods}}
// Prevent the authentications from being modified.

View File

@ -8,9 +8,9 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.2'
classpath 'com.android.tools.build:gradle:1.5.+'
{{#useAndroidMavenGradlePlugin}}
classpath 'com.github.dcendents:android-maven-plugin:1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
{{/useAndroidMavenGradlePlugin}}
}
}
@ -59,9 +59,10 @@ android {
ext {
swagger_annotations_version = "1.5.0"
gson_version = "2.3.1"
httpclient_version = "4.3.3"
httpclient_version = "4.5.2"
httpcore_version = "4.4.4"
volley_version = "1.0.19"
junit_version = "4.8.1"
junit_version = "4.12"
robolectric_version = "3.0"
concurrent_unit_version = "0.4.2"
}

View File

@ -25,6 +25,7 @@ namespace {{packageName}}.Client
/// <param name="tempFolderPath">Temp folder path</param>
/// <param name="dateTimeFormat">DateTime format string</param>
/// <param name="timeout">HTTP connection timeout (in milliseconds)</param>
/// <param name="userAgent">HTTP user agent</param>
public Configuration(ApiClient apiClient = null,
Dictionary<String, String> defaultHeader = null,
string username = null,

View File

@ -1,6 +1,6 @@
public enum {{vendorExtensions.plainDatatypeWithEnum}} {
public enum {{vendorExtensions.plainDatatypeWithEnum}} {
{{#allowableValues}}{{#enumVars}}
[EnumMember(Value = "{{jsonname}}")]
{{name}}{{^-last}},
{{/-last}}{{#-last}}{{/-last}}{{/enumVars}}{{/allowableValues}}
}
}

View File

@ -20,9 +20,13 @@ namespace {{packageName}}.Model
public partial class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}} IEquatable<{{classname}}>
{ {{#vars}}{{#isEnum}}
/// <summary>
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
/// </summary>{{#description}}
/// <value>{{{description}}}</value>{{/description}}
[JsonConverter(typeof(StringEnumConverter))]
{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
{{>enumClass}}{{/items}}{{/items.isEnum}}{{/vars}}
{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
{{>enumClass}}{{/items}}{{/items.isEnum}}{{/vars}}
{{#vars}}{{#isEnum}}
/// <summary>
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}

View File

@ -8,7 +8,7 @@
Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API verion: {{appVersion}}
- API version: {{appVersion}}
- Package version: {{moduleVersion}}
- Build date: {{generatedDate}}
- Build package: {{generatorClass}}

View File

@ -5,7 +5,7 @@
This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API verion: {{appVersion}}
- API version: {{appVersion}}
- Package version: {{artifactVersion}}
- Build date: {{generatedDate}}
- Build package: {{generatorClass}}

View File

@ -114,6 +114,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
*/
public function __construct(array $data = null)
{
{{#parent}}parent::__construct($data);{{/parent}}
if ($data != null) {
{{#vars}}$this->{{name}} = $data["{{name}}"];{{#hasMore}}
{{/hasMore}}{{/vars}}

View File

@ -8,7 +8,7 @@
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API verion: {{appVersion}}
- API version: {{appVersion}}
- Package version: {{gemVersion}}
- Build date: {{generatedDate}}
- Build package: {{generatorClass}}

View File

@ -210,7 +210,7 @@
<joda-version>1.2</joda-version>
<joda-time-version>2.2</joda-time-version>
<jersey-version>1.19</jersey-version>
<swagger-core-version>1.5.7</swagger-core-version>
<swagger-core-version>1.5.8</swagger-core-version>
<jersey-async-version>1.0.5</jersey-async-version>
<maven-plugin.version>1.0.0</maven-plugin.version>
<jackson-version>2.4.2</jackson-version>

View File

@ -1339,6 +1339,42 @@
"xml": {
"name": "Name"
}
},
"Dog" : {
"allOf" : [ {
"$ref" : "#/definitions/Animal"
}, {
"type" : "object",
"properties" : {
"breed" : {
"type" : "string"
}
}
} ]
},
"Cat" : {
"allOf" : [ {
"$ref" : "#/definitions/Animal"
}, {
"type" : "object",
"properties" : {
"declawed" : {
"type" : "boolean"
}
}
} ]
},
"Animal" : {
"type" : "object",
"discriminator": "className",
"required": [
"className"
],
"properties" : {
"className" : {
"type" : "string"
}
}
}
}
}

View File

@ -90,10 +90,19 @@ public class Generator {
throw new BadRequestException("The swagger specification supplied was not valid");
}
String destPath = null;
if(opts != null && opts.getOptions() != null) {
destPath = opts.getOptions().get("outputFolder");
}
if(destPath == null) {
destPath = language + "-"
+ type.getTypeName();
}
ClientOptInput clientOptInput = new ClientOptInput();
ClientOpts clientOpts = new ClientOpts();
String outputFolder = getTmpFolder().getAbsolutePath() + File.separator + language + "-"
+ type.getTypeName();
String outputFolder = getTmpFolder().getAbsolutePath() + File.separator + destPath;
String outputFilename = outputFolder + "-bundle.zip";
clientOptInput

View File

@ -559,7 +559,7 @@
</repository>
</repositories>
<properties>
<swagger-parser-version>1.0.18-SNAPSHOT</swagger-parser-version>
<swagger-parser-version>1.0.18</swagger-parser-version>
<scala-version>2.11.1</scala-version>
<felix-version>2.3.4</felix-version>
<swagger-core-version>1.5.8</swagger-core-version>

View File

@ -6,9 +6,9 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.2'
classpath 'com.android.tools.build:gradle:1.5.+'
classpath 'com.github.dcendents:android-maven-plugin:1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}
@ -24,11 +24,12 @@ apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
android {
compileSdkVersion 22
buildToolsVersion '22.0.0'
compileSdkVersion 23
buildToolsVersion '23.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
targetSdkVersion 23
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
@ -51,16 +52,17 @@ android {
ext {
swagger_annotations_version = "1.5.0"
gson_version = "2.3.1"
httpclient_version = "4.3.3"
junit_version = "4.8.1"
httpclient_version = "4.5.2"
httpcore_version = "4.4.4"
junit_version = "4.12"
}
dependencies {
compile "io.swagger:swagger-annotations:$swagger_annotations_version"
compile "com.google.code.gson:gson:$gson_version"
compile "org.apache.httpcomponents:httpcore:$httpclient_version"
compile "org.apache.httpcomponents:httpcore:$httpcore_version"
compile "org.apache.httpcomponents:httpclient:$httpclient_version"
compile ("org.apache.httpcomponents:httpcore:$httpclient_version") {
compile ("org.apache.httpcomponents:httpcore:$httpcore_version") {
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
}
compile ("org.apache.httpcomponents:httpmime:$httpclient_version") {

View File

@ -10,6 +10,8 @@ public class Name {
@SerializedName("name")
private Integer name = null;
@SerializedName("snake_case")
private Integer snakeCase = null;
/**
@ -23,6 +25,17 @@ public class Name {
}
/**
**/
@ApiModelProperty(value = "")
public Integer getSnakeCase() {
return snakeCase;
}
public void setSnakeCase(Integer snakeCase) {
this.snakeCase = snakeCase;
}
@Override
public String toString() {
@ -30,6 +43,7 @@ public class Name {
sb.append("class Name {\n");
sb.append(" name: ").append(name).append("\n");
sb.append(" snakeCase: ").append(snakeCase).append("\n");
sb.append("}\n");
return sb.toString();
}

View File

@ -6,9 +6,9 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.2'
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.github.dcendents:android-maven-plugin:1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}

View File

@ -229,7 +229,8 @@ public class ApiInvoker {
INSTANCE.authentications.put("petstore_auth", new OAuth());
// TODO: comment out below as OAuth does not exist
//INSTANCE.authentications.put("petstore_auth", new OAuth());
// Prevent the authentications from being modified.

View File

@ -10,6 +10,8 @@ public class Name {
@SerializedName("name")
private Integer name = null;
@SerializedName("snake_case")
private Integer snakeCase = null;
/**
@ -23,6 +25,17 @@ public class Name {
}
/**
**/
@ApiModelProperty(value = "")
public Integer getSnakeCase() {
return snakeCase;
}
public void setSnakeCase(Integer snakeCase) {
this.snakeCase = snakeCase;
}
@Override
public String toString() {
@ -30,6 +43,7 @@ public class Name {
sb.append("class Name {\n");
sb.append(" name: ").append(name).append("\n");
sb.append(" snakeCase: ").append(snakeCase).append("\n");
sb.append("}\n");
return sb.toString();
}

View File

@ -60,6 +60,15 @@ namespace IO.Swagger.Test
// TODO: unit test for the property '_Name'
}
/// <summary>
/// Test the property 'SnakeCase'
/// </summary>
[Test]
public void SnakeCaseTest()
{
// TODO: unit test for the property 'SnakeCase'
}
}

View File

@ -25,6 +25,7 @@ namespace IO.Swagger.Client
/// <param name="tempFolderPath">Temp folder path</param>
/// <param name="dateTimeFormat">DateTime format string</param>
/// <param name="timeout">HTTP connection timeout (in milliseconds)</param>
/// <param name="userAgent">HTTP user agent</param>
public Configuration(ApiClient apiClient = null,
Dictionary<String, String> defaultHeader = null,
string username = null,

View File

@ -0,0 +1,121 @@
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace IO.Swagger.Model
{
/// <summary>
///
/// </summary>
[DataContract]
public partial class Animal : IEquatable<Animal>
{
/// <summary>
/// Initializes a new instance of the <see cref="Animal" /> class.
/// Initializes a new instance of the <see cref="Animal" />class.
/// </summary>
/// <param name="ClassName">ClassName (required).</param>
public Animal(string ClassName = null)
{
// to ensure "ClassName" is required (not null)
if (ClassName == null)
{
throw new InvalidDataException("ClassName is a required property for Animal and cannot be null");
}
else
{
this.ClassName = ClassName;
}
}
/// <summary>
/// Gets or Sets ClassName
/// </summary>
[DataMember(Name="className", EmitDefaultValue=false)]
public string ClassName { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class Animal {\n");
sb.Append(" ClassName: ").Append(ClassName).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
// credit: http://stackoverflow.com/a/10454552/677735
return this.Equals(obj as Animal);
}
/// <summary>
/// Returns true if Animal instances are equal
/// </summary>
/// <param name="other">Instance of Animal to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(Animal other)
{
// credit: http://stackoverflow.com/a/10454552/677735
if (other == null)
return false;
return
(
this.ClassName == other.ClassName ||
this.ClassName != null &&
this.ClassName.Equals(other.ClassName)
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
// credit: http://stackoverflow.com/a/263416/677735
unchecked // Overflow is fine, just wrap
{
int hash = 41;
// Suitable nullity checks etc, of course :)
if (this.ClassName != null)
hash = hash * 59 + this.ClassName.GetHashCode();
return hash;
}
}
}
}

View File

@ -0,0 +1,138 @@
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace IO.Swagger.Model
{
/// <summary>
///
/// </summary>
[DataContract]
public partial class Cat : Animal, IEquatable<Cat>
{
/// <summary>
/// Initializes a new instance of the <see cref="Cat" /> class.
/// Initializes a new instance of the <see cref="Cat" />class.
/// </summary>
/// <param name="ClassName">ClassName (required).</param>
/// <param name="Declawed">Declawed.</param>
public Cat(string ClassName = null, bool? Declawed = null)
{
// to ensure "ClassName" is required (not null)
if (ClassName == null)
{
throw new InvalidDataException("ClassName is a required property for Cat and cannot be null");
}
else
{
this.ClassName = ClassName;
}
this.Declawed = Declawed;
}
/// <summary>
/// Gets or Sets ClassName
/// </summary>
[DataMember(Name="className", EmitDefaultValue=false)]
public string ClassName { get; set; }
/// <summary>
/// Gets or Sets Declawed
/// </summary>
[DataMember(Name="declawed", EmitDefaultValue=false)]
public bool? Declawed { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class Cat {\n");
sb.Append(" ClassName: ").Append(ClassName).Append("\n");
sb.Append(" Declawed: ").Append(Declawed).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public new string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
// credit: http://stackoverflow.com/a/10454552/677735
return this.Equals(obj as Cat);
}
/// <summary>
/// Returns true if Cat instances are equal
/// </summary>
/// <param name="other">Instance of Cat to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(Cat other)
{
// credit: http://stackoverflow.com/a/10454552/677735
if (other == null)
return false;
return
(
this.ClassName == other.ClassName ||
this.ClassName != null &&
this.ClassName.Equals(other.ClassName)
) &&
(
this.Declawed == other.Declawed ||
this.Declawed != null &&
this.Declawed.Equals(other.Declawed)
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
// credit: http://stackoverflow.com/a/263416/677735
unchecked // Overflow is fine, just wrap
{
int hash = 41;
// Suitable nullity checks etc, of course :)
if (this.ClassName != null)
hash = hash * 59 + this.ClassName.GetHashCode();
if (this.Declawed != null)
hash = hash * 59 + this.Declawed.GetHashCode();
return hash;
}
}
}
}

View File

@ -0,0 +1,138 @@
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace IO.Swagger.Model
{
/// <summary>
///
/// </summary>
[DataContract]
public partial class Dog : Animal, IEquatable<Dog>
{
/// <summary>
/// Initializes a new instance of the <see cref="Dog" /> class.
/// Initializes a new instance of the <see cref="Dog" />class.
/// </summary>
/// <param name="ClassName">ClassName (required).</param>
/// <param name="Breed">Breed.</param>
public Dog(string ClassName = null, string Breed = null)
{
// to ensure "ClassName" is required (not null)
if (ClassName == null)
{
throw new InvalidDataException("ClassName is a required property for Dog and cannot be null");
}
else
{
this.ClassName = ClassName;
}
this.Breed = Breed;
}
/// <summary>
/// Gets or Sets ClassName
/// </summary>
[DataMember(Name="className", EmitDefaultValue=false)]
public string ClassName { get; set; }
/// <summary>
/// Gets or Sets Breed
/// </summary>
[DataMember(Name="breed", EmitDefaultValue=false)]
public string Breed { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class Dog {\n");
sb.Append(" ClassName: ").Append(ClassName).Append("\n");
sb.Append(" Breed: ").Append(Breed).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public new string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
// credit: http://stackoverflow.com/a/10454552/677735
return this.Equals(obj as Dog);
}
/// <summary>
/// Returns true if Dog instances are equal
/// </summary>
/// <param name="other">Instance of Dog to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(Dog other)
{
// credit: http://stackoverflow.com/a/10454552/677735
if (other == null)
return false;
return
(
this.ClassName == other.ClassName ||
this.ClassName != null &&
this.ClassName.Equals(other.ClassName)
) &&
(
this.Breed == other.Breed ||
this.Breed != null &&
this.Breed.Equals(other.Breed)
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
// credit: http://stackoverflow.com/a/263416/677735
unchecked // Overflow is fine, just wrap
{
int hash = 41;
// Suitable nullity checks etc, of course :)
if (this.ClassName != null)
hash = hash * 59 + this.ClassName.GetHashCode();
if (this.Breed != null)
hash = hash * 59 + this.Breed.GetHashCode();
return hash;
}
}
}
}

View File

@ -18,6 +18,10 @@ namespace IO.Swagger.Model
public partial class InlineResponse200 : IEquatable<InlineResponse200>
{
/// <summary>
/// pet status in the store
/// </summary>
/// <value>pet status in the store</value>
[JsonConverter(typeof(StringEnumConverter))]
public enum StatusEnum {
@ -30,6 +34,7 @@ namespace IO.Swagger.Model
[EnumMember(Value = "sold")]
Sold
}
/// <summary>
/// pet status in the store

View File

@ -23,10 +23,12 @@ namespace IO.Swagger.Model
/// Initializes a new instance of the <see cref="Name" />class.
/// </summary>
/// <param name="_Name">_Name.</param>
/// <param name="SnakeCase">SnakeCase.</param>
public Name(int? _Name = null)
public Name(int? _Name = null, int? SnakeCase = null)
{
this._Name = _Name;
this.SnakeCase = SnakeCase;
}
@ -37,6 +39,12 @@ namespace IO.Swagger.Model
[DataMember(Name="name", EmitDefaultValue=false)]
public int? _Name { get; set; }
/// <summary>
/// Gets or Sets SnakeCase
/// </summary>
[DataMember(Name="snake_case", EmitDefaultValue=false)]
public int? SnakeCase { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
@ -46,6 +54,7 @@ namespace IO.Swagger.Model
var sb = new StringBuilder();
sb.Append("class Name {\n");
sb.Append(" _Name: ").Append(_Name).Append("\n");
sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n");
sb.Append("}\n");
return sb.ToString();
@ -87,6 +96,11 @@ namespace IO.Swagger.Model
this._Name == other._Name ||
this._Name != null &&
this._Name.Equals(other._Name)
) &&
(
this.SnakeCase == other.SnakeCase ||
this.SnakeCase != null &&
this.SnakeCase.Equals(other.SnakeCase)
);
}
@ -105,6 +119,9 @@ namespace IO.Swagger.Model
if (this._Name != null)
hash = hash * 59 + this._Name.GetHashCode();
if (this.SnakeCase != null)
hash = hash * 59 + this.SnakeCase.GetHashCode();
return hash;
}
}

View File

@ -18,6 +18,10 @@ namespace IO.Swagger.Model
public partial class Order : IEquatable<Order>
{
/// <summary>
/// Order Status
/// </summary>
/// <value>Order Status</value>
[JsonConverter(typeof(StringEnumConverter))]
public enum StatusEnum {
@ -30,6 +34,7 @@ namespace IO.Swagger.Model
[EnumMember(Value = "delivered")]
Delivered
}
/// <summary>
/// Order Status

View File

@ -18,6 +18,10 @@ namespace IO.Swagger.Model
public partial class Pet : IEquatable<Pet>
{
/// <summary>
/// pet status in the store
/// </summary>
/// <value>pet status in the store</value>
[JsonConverter(typeof(StringEnumConverter))]
public enum StatusEnum {
@ -30,6 +34,7 @@ namespace IO.Swagger.Model
[EnumMember(Value = "sold")]
Sold
}
/// <summary>
/// pet status in the store

View File

@ -2,7 +2,7 @@
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.Workbench ActiveDocument="TestPet.cs">
<Files>
<File FileName="TestPet.cs" Line="218" Column="47" />
<File FileName="TestPet.cs" Line="23" Column="17" />
<File FileName="TestOrder.cs" Line="1" Column="1" />
</Files>
</MonoDevelop.Ide.Workbench>

View File

@ -1,69 +1,76 @@
# swagger-petstore
SwaggerPetstore - JavaScript client for swagger-petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
Version: 1.0.0
Automatically generated by the JavaScript Swagger Codegen project:
- Build date: 2016-03-18T15:44:17.513Z
- API version: 1.0.0
- Package version: 1.0.0
- Build date: 2016-03-30T20:58:13.565+08:00
- Build package: class io.swagger.codegen.languages.JavascriptClientCodegen
## Installation
### Use in [Node.js](https://nodejs.org/)
### For [Node.js](https://nodejs.org/)
The generated client is valid [npm](https://www.npmjs.com/) package, you can publish it as described
in [Publishing npm packages](https://docs.npmjs.com/getting-started/publishing-npm-packages).
#### npm
After that, you can install it into your project via:
To publish the library as a [npm](https://www.npmjs.com/),
please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.com/getting-started/publishing-npm-packages).
Then install it via:
```shell
npm install swagger-petstore --save
```
You can also host the generated client as a git repository on github, e.g.
https://github.com/YOUR_USERNAME/swagger-petstore
Then you can install it via:
#### git
#
If the library is hosted at a git repository, e.g.
https://github.com/YOUR_USERNAME/YOUR_GIT_REPO_ID
then install it via:
```shell
npm install YOUR_USERNAME/swagger-petstore --save
npm install YOUR_USERNAME/YOUR_GIT_REPO_ID --save
```
### Use in browser with [browserify](http://browserify.org/)
### For browser
The client also works in browser environment via npm and browserify. After following
The library also works in the browser environment via npm and [browserify](http://browserify.org/). After following
the above steps with Node.js and installing browserify with `npm install -g browserify`,
you can do this in your project (assuming *main.js* is your entry file):
perform the following (assuming *main.js* is your entry file):
```shell
browserify main.js > bundle.js
```
The generated *bundle.js* can now be included in your HTML pages.
Then include *bundle.js* in the HTML pages.
## Getting Started
Please follow the [installation](#installation) instruction and execute the following JS code:
```javascript
var SwaggerPetstore = require('swagger-petstore');
var defaultClient = SwaggerPetstore.ApiClient.default;
defaultClient.timeout = 10 * 1000;
defaultClient.defaultHeaders['Test-Header'] = 'test_value';
// Assuming there's a `PetApi` containing a `getPetById` method
// which returns a model object:
var api = new SwaggerPetstore.PetApi();
api.getPetById(2, function(err, pet, resp) {
console.log('HTTP status code: ' + resp.status);
console.log('Response Content-Type: ' + resp.get('Content-Type'));
if (err) {
console.error(err);
} else {
console.log(pet);
}
// Configure OAuth2 access token for authorization: petstore_auth
var petstore_auth = defaultClient.authentications['petstore_auth'];
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
var api = new SwaggerPetstore.PetApi()
var opts = {
'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store
};
api.addPet(opts).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
});
```
## Documentation for API Endpoints
@ -101,7 +108,10 @@ Class | Method | HTTP request | Description
## Documentation for Models
- [SwaggerPetstore.Animal](docs/Animal.md)
- [SwaggerPetstore.Cat](docs/Cat.md)
- [SwaggerPetstore.Category](docs/Category.md)
- [SwaggerPetstore.Dog](docs/Dog.md)
- [SwaggerPetstore.InlineResponse200](docs/InlineResponse200.md)
- [SwaggerPetstore.Model200Response](docs/Model200Response.md)
- [SwaggerPetstore.ModelReturn](docs/ModelReturn.md)

View File

@ -0,0 +1,8 @@
# SwaggerPetstore.Animal
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**className** | **String** | |

View File

@ -0,0 +1,8 @@
# SwaggerPetstore.Cat
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**declawed** | **Boolean** | | [optional]

View File

@ -0,0 +1,8 @@
# SwaggerPetstore.Dog
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**breed** | **String** | | [optional]

View File

@ -1,4 +1,3 @@
# SwaggerPetstore.InlineResponse200
## Properties

View File

@ -4,5 +4,6 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **Integer** | | [optional]
**snakeCase** | **Integer** | | [optional]

View File

@ -1,4 +1,3 @@
# SwaggerPetstore.PetApi
All URIs are relative to *http://petstore.swagger.io/v2*
@ -35,12 +34,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
var petstore_auth = defaultClient.authentications['petstore_auth'];
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
var api = new SwaggerPetstore.PetApi()
var apiInstance = new SwaggerPetstore.PetApi()
var opts = {
'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store
};
api.addPet(opts).then(function() {
apiInstance.addPet(opts).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
@ -84,12 +83,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
var petstore_auth = defaultClient.authentications['petstore_auth'];
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
var api = new SwaggerPetstore.PetApi()
var apiInstance = new SwaggerPetstore.PetApi()
var opts = {
'body': "B" // {String} Pet object in the form of byte array
};
api.addPetUsingByteArray(opts).then(function() {
apiInstance.addPetUsingByteArray(opts).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
@ -133,14 +132,14 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
var petstore_auth = defaultClient.authentications['petstore_auth'];
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
var api = new SwaggerPetstore.PetApi()
var apiInstance = new SwaggerPetstore.PetApi()
var petId = 789; // {Integer} Pet id to delete
var opts = {
'apiKey': "apiKey_example" // {String}
};
api.deletePet(petId, opts).then(function() {
apiInstance.deletePet(petId, opts).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
@ -185,12 +184,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
var petstore_auth = defaultClient.authentications['petstore_auth'];
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
var api = new SwaggerPetstore.PetApi()
var apiInstance = new SwaggerPetstore.PetApi()
var opts = {
'status': ["available"] // {[String]} Status values that need to be considered for query
};
api.findPetsByStatus(opts).then(function(data) {
apiInstance.findPetsByStatus(opts).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
@ -234,12 +233,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
var petstore_auth = defaultClient.authentications['petstore_auth'];
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
var api = new SwaggerPetstore.PetApi()
var apiInstance = new SwaggerPetstore.PetApi()
var opts = {
'tags': ["tags_example"] // {[String]} Tags to filter by
};
api.findPetsByTags(opts).then(function(data) {
apiInstance.findPetsByTags(opts).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
@ -289,11 +288,11 @@ api_key.apiKey = "YOUR API KEY"
var petstore_auth = defaultClient.authentications['petstore_auth'];
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
var api = new SwaggerPetstore.PetApi()
var apiInstance = new SwaggerPetstore.PetApi()
var petId = 789; // {Integer} ID of pet that needs to be fetched
api.getPetById(petId).then(function(data) {
apiInstance.getPetById(petId).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
@ -343,11 +342,11 @@ api_key.apiKey = "YOUR API KEY"
var petstore_auth = defaultClient.authentications['petstore_auth'];
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
var api = new SwaggerPetstore.PetApi()
var apiInstance = new SwaggerPetstore.PetApi()
var petId = 789; // {Integer} ID of pet that needs to be fetched
api.getPetByIdInObject(petId).then(function(data) {
apiInstance.getPetByIdInObject(petId).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
@ -397,11 +396,11 @@ api_key.apiKey = "YOUR API KEY"
var petstore_auth = defaultClient.authentications['petstore_auth'];
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
var api = new SwaggerPetstore.PetApi()
var apiInstance = new SwaggerPetstore.PetApi()
var petId = 789; // {Integer} ID of pet that needs to be fetched
api.petPetIdtestingByteArraytrueGet(petId).then(function(data) {
apiInstance.petPetIdtestingByteArraytrueGet(petId).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
@ -445,12 +444,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
var petstore_auth = defaultClient.authentications['petstore_auth'];
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
var api = new SwaggerPetstore.PetApi()
var apiInstance = new SwaggerPetstore.PetApi()
var opts = {
'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store
};
api.updatePet(opts).then(function() {
apiInstance.updatePet(opts).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
@ -494,7 +493,7 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
var petstore_auth = defaultClient.authentications['petstore_auth'];
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
var api = new SwaggerPetstore.PetApi()
var apiInstance = new SwaggerPetstore.PetApi()
var petId = "petId_example"; // {String} ID of pet that needs to be updated
@ -502,7 +501,7 @@ var opts = {
'name': "name_example", // {String} Updated name of the pet
'status': "status_example" // {String} Updated status of the pet
};
api.updatePetWithForm(petId, opts).then(function() {
apiInstance.updatePetWithForm(petId, opts).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
@ -548,7 +547,7 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
var petstore_auth = defaultClient.authentications['petstore_auth'];
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
var api = new SwaggerPetstore.PetApi()
var apiInstance = new SwaggerPetstore.PetApi()
var petId = 789; // {Integer} ID of pet to update
@ -556,7 +555,7 @@ var opts = {
'additionalMetadata': "additionalMetadata_example", // {String} Additional data to pass to server
'file': "/path/to/file.txt" // {File} file to upload
};
api.uploadFile(petId, opts).then(function() {
apiInstance.uploadFile(petId, opts).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);

View File

@ -1,4 +1,3 @@
# SwaggerPetstore.StoreApi
All URIs are relative to *http://petstore.swagger.io/v2*
@ -25,11 +24,11 @@ For valid response try integer IDs with value &lt; 1000. Anything above 1000 or
```javascript
var SwaggerPetstore = require('swagger-petstore');
var api = new SwaggerPetstore.StoreApi()
var apiInstance = new SwaggerPetstore.StoreApi()
var orderId = "orderId_example"; // {String} ID of the order that needs to be deleted
api.deleteOrder(orderId).then(function() {
apiInstance.deleteOrder(orderId).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
@ -81,12 +80,12 @@ test_api_client_secret.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token"
var api = new SwaggerPetstore.StoreApi()
var apiInstance = new SwaggerPetstore.StoreApi()
var opts = {
'status': "placed" // {String} Status value that needs to be considered for query
};
api.findOrdersByStatus(opts).then(function(data) {
apiInstance.findOrdersByStatus(opts).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
@ -132,8 +131,8 @@ api_key.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix['api_key'] = "Token"
var api = new SwaggerPetstore.StoreApi()
api.getInventory().then(function(data) {
var apiInstance = new SwaggerPetstore.StoreApi()
apiInstance.getInventory().then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
@ -176,8 +175,8 @@ api_key.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix['api_key'] = "Token"
var api = new SwaggerPetstore.StoreApi()
api.getInventoryInObject().then(function(data) {
var apiInstance = new SwaggerPetstore.StoreApi()
apiInstance.getInventoryInObject().then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
@ -226,11 +225,11 @@ test_api_key_query.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//test_api_key_query.apiKeyPrefix['test_api_key_query'] = "Token"
var api = new SwaggerPetstore.StoreApi()
var apiInstance = new SwaggerPetstore.StoreApi()
var orderId = "orderId_example"; // {String} ID of pet that needs to be fetched
api.getOrderById(orderId).then(function(data) {
apiInstance.getOrderById(orderId).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
@ -282,12 +281,12 @@ test_api_client_secret.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token"
var api = new SwaggerPetstore.StoreApi()
var apiInstance = new SwaggerPetstore.StoreApi()
var opts = {
'body': new SwaggerPetstore.Order() // {Order} order placed for purchasing the pet
};
api.placeOrder(opts).then(function(data) {
apiInstance.placeOrder(opts).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);

View File

@ -26,12 +26,12 @@ This can only be done by the logged in user.
```javascript
var SwaggerPetstore = require('swagger-petstore');
var api = new SwaggerPetstore.UserApi()
var apiInstance = new SwaggerPetstore.UserApi()
var opts = {
'body': new SwaggerPetstore.User() // {User} Created user object
};
api.createUser(opts).then(function() {
apiInstance.createUser(opts).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
@ -70,12 +70,12 @@ Creates list of users with given input array
```javascript
var SwaggerPetstore = require('swagger-petstore');
var api = new SwaggerPetstore.UserApi()
var apiInstance = new SwaggerPetstore.UserApi()
var opts = {
'body': [new SwaggerPetstore.User()] // {[User]} List of user object
};
api.createUsersWithArrayInput(opts).then(function() {
apiInstance.createUsersWithArrayInput(opts).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
@ -114,12 +114,12 @@ Creates list of users with given input array
```javascript
var SwaggerPetstore = require('swagger-petstore');
var api = new SwaggerPetstore.UserApi()
var apiInstance = new SwaggerPetstore.UserApi()
var opts = {
'body': [new SwaggerPetstore.User()] // {[User]} List of user object
};
api.createUsersWithListInput(opts).then(function() {
apiInstance.createUsersWithListInput(opts).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
@ -164,11 +164,11 @@ var test_http_basic = defaultClient.authentications['test_http_basic'];
test_http_basic.username = 'YOUR USERNAME'
test_http_basic.password = 'YOUR PASSWORD'
var api = new SwaggerPetstore.UserApi()
var apiInstance = new SwaggerPetstore.UserApi()
var username = "username_example"; // {String} The name that needs to be deleted
api.deleteUser(username).then(function() {
apiInstance.deleteUser(username).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
@ -207,11 +207,11 @@ Get user by user name
```javascript
var SwaggerPetstore = require('swagger-petstore');
var api = new SwaggerPetstore.UserApi()
var apiInstance = new SwaggerPetstore.UserApi()
var username = "username_example"; // {String} The name that needs to be fetched. Use user1 for testing.
api.getUserByName(username).then(function(data) {
apiInstance.getUserByName(username).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
@ -250,13 +250,13 @@ Logs user into the system
```javascript
var SwaggerPetstore = require('swagger-petstore');
var api = new SwaggerPetstore.UserApi()
var apiInstance = new SwaggerPetstore.UserApi()
var opts = {
'username': "username_example", // {String} The user name for login
'password': "password_example" // {String} The password for login in clear text
};
api.loginUser(opts).then(function(data) {
apiInstance.loginUser(opts).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
@ -296,8 +296,8 @@ Logs out current logged in user session
```javascript
var SwaggerPetstore = require('swagger-petstore');
var api = new SwaggerPetstore.UserApi()
api.logoutUser().then(function() {
var apiInstance = new SwaggerPetstore.UserApi()
apiInstance.logoutUser().then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
@ -333,14 +333,14 @@ This can only be done by the logged in user.
```javascript
var SwaggerPetstore = require('swagger-petstore');
var api = new SwaggerPetstore.UserApi()
var apiInstance = new SwaggerPetstore.UserApi()
var username = "username_example"; // {String} name that need to be deleted
var opts = {
'body': new SwaggerPetstore.User() // {User} Updated user object
};
api.updateUser(username, opts).then(function() {
apiInstance.updateUser(username, opts).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);

View File

@ -25,7 +25,7 @@
* Constructs a new PetApi.
* @alias module:api/PetApi
* @class
* @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance}
* @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance}
* if unspecified.
*/
var exports = function(apiClient) {
@ -144,7 +144,7 @@
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.status Status values that need to be considered for query
* @param {Array.<String>} opts.status Status values that need to be considered for query (default to available)
* data is of type: {Array.<module:model/Pet>}
*/
this.findPetsByStatus = function(opts) {

View File

@ -25,7 +25,7 @@
* Constructs a new StoreApi.
* @alias module:api/StoreApi
* @class
* @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance}
* @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance}
* if unspecified.
*/
var exports = function(apiClient) {
@ -40,11 +40,6 @@
*/
this.deleteOrder = function(orderId) {
var postBody = null;
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw "Missing the required parameter 'orderId' when calling deleteOrder";
}
// verify the required parameter 'orderId' is set
if (orderId == undefined || orderId == null) {
@ -79,7 +74,7 @@
* Finds orders by status
* A single status value can be provided as a string
* @param {Object} opts Optional parameters
* @param {module:model/String} opts.status Status value that needs to be considered for query
* @param {module:model/String} opts.status Status value that needs to be considered for query (default to placed)
* data is of type: {Array.<module:model/Order>}
*/
this.findOrdersByStatus = function(opts) {

View File

@ -25,7 +25,7 @@
* Constructs a new UserApi.
* @alias module:api/UserApi
* @class
* @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance}
* @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance}
* if unspecified.
*/
var exports = function(apiClient) {
@ -139,11 +139,6 @@
*/
this.deleteUser = function(username) {
var postBody = null;
// verify the required parameter 'username' is set
if (username == null) {
throw "Missing the required parameter 'username' when calling deleteUser";
}
// verify the required parameter 'username' is set
if (username == undefined || username == null) {
@ -182,11 +177,6 @@
*/
this.getUserByName = function(username) {
var postBody = null;
// verify the required parameter 'username' is set
if (username == null) {
throw "Missing the required parameter 'username' when calling getUserByName";
}
// verify the required parameter 'username' is set
if (username == undefined || username == null) {

View File

@ -1,12 +1,12 @@
(function(factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['./ApiClient', './model/Category', './model/InlineResponse200', './model/Model200Response', './model/ModelReturn', './model/Name', './model/Order', './model/Pet', './model/SpecialModelName', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory);
define(['./ApiClient', './model/Animal', './model/Cat', './model/Category', './model/Dog', './model/InlineResponse200', './model/Model200Response', './model/ModelReturn', './model/Name', './model/Order', './model/Pet', './model/SpecialModelName', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('./ApiClient'), require('./model/Category'), require('./model/InlineResponse200'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi'));
module.exports = factory(require('./ApiClient'), require('./model/Animal'), require('./model/Cat'), require('./model/Category'), require('./model/Dog'), require('./model/InlineResponse200'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi'));
}
}(function(ApiClient, Category, InlineResponse200, Model200Response, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, PetApi, StoreApi, UserApi) {
}(function(ApiClient, Animal, Cat, Category, Dog, InlineResponse200, Model200Response, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, PetApi, StoreApi, UserApi) {
'use strict';
/**
@ -46,11 +46,26 @@
* @property {module:ApiClient}
*/
ApiClient: ApiClient,
/**
* The Animal model constructor.
* @property {module:model/Animal}
*/
Animal: Animal,
/**
* The Cat model constructor.
* @property {module:model/Cat}
*/
Cat: Cat,
/**
* The Category model constructor.
* @property {module:model/Category}
*/
Category: Category,
/**
* The Dog model constructor.
* @property {module:model/Dog}
*/
Dog: Dog,
/**
* The InlineResponse200 model constructor.
* @property {module:model/InlineResponse200}

View File

@ -0,0 +1,63 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['../ApiClient'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'));
} else {
// Browser globals (root is window)
if (!root.SwaggerPetstore) {
root.SwaggerPetstore = {};
}
root.SwaggerPetstore.Animal = factory(root.SwaggerPetstore.ApiClient);
}
}(this, function(ApiClient) {
'use strict';
/**
* The Animal model module.
* @module model/Animal
* @version 1.0.0
*/
/**
* Constructs a new <code>Animal</code>.
* @alias module:model/Animal
* @class
* @param className
*/
var exports = function(className) {
this['className'] = className;
};
/**
* Constructs a <code>Animal</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/Animal} obj Optional instance to populate.
* @return {module:model/Animal} The populated <code>Animal</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();
if (data.hasOwnProperty('className')) {
obj['className'] = ApiClient.convertToType(data['className'], 'String');
}
}
return obj;
}
/**
* @member {String} className
*/
exports.prototype['className'] = undefined;
return exports;
}));

View File

@ -0,0 +1,67 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['../ApiClient', './Animal'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'), require('./Animal'));
} else {
// Browser globals (root is window)
if (!root.SwaggerPetstore) {
root.SwaggerPetstore = {};
}
root.SwaggerPetstore.Cat = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal);
}
}(this, function(ApiClient, Animal) {
'use strict';
/**
* The Cat model module.
* @module model/Cat
* @version 1.0.0
*/
/**
* Constructs a new <code>Cat</code>.
* @alias module:model/Cat
* @class
* @extends module:model/Animal
* @param className
*/
var exports = function(className) {
Animal.call(this, className);
};
/**
* Constructs a <code>Cat</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/Cat} obj Optional instance to populate.
* @return {module:model/Cat} The populated <code>Cat</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();
Animal.constructFromObject(data, obj);
if (data.hasOwnProperty('declawed')) {
obj['declawed'] = ApiClient.convertToType(data['declawed'], 'Boolean');
}
}
return obj;
}
exports.prototype = Object.create(Animal.prototype);
exports.prototype.constructor = exports;
/**
* @member {Boolean} declawed
*/
exports.prototype['declawed'] = undefined;
return exports;
}));

View File

@ -0,0 +1,67 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['../ApiClient', './Animal'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'), require('./Animal'));
} else {
// Browser globals (root is window)
if (!root.SwaggerPetstore) {
root.SwaggerPetstore = {};
}
root.SwaggerPetstore.Dog = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal);
}
}(this, function(ApiClient, Animal) {
'use strict';
/**
* The Dog model module.
* @module model/Dog
* @version 1.0.0
*/
/**
* Constructs a new <code>Dog</code>.
* @alias module:model/Dog
* @class
* @extends module:model/Animal
* @param className
*/
var exports = function(className) {
Animal.call(this, className);
};
/**
* Constructs a <code>Dog</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/Dog} obj Optional instance to populate.
* @return {module:model/Dog} The populated <code>Dog</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();
Animal.constructFromObject(data, obj);
if (data.hasOwnProperty('breed')) {
obj['breed'] = ApiClient.convertToType(data['breed'], 'String');
}
}
return obj;
}
exports.prototype = Object.create(Animal.prototype);
exports.prototype.constructor = exports;
/**
* @member {String} breed
*/
exports.prototype['breed'] = undefined;
return exports;
}));

View File

@ -29,6 +29,7 @@
var exports = function() {
};
/**
@ -45,6 +46,9 @@
if (data.hasOwnProperty('name')) {
obj['name'] = ApiClient.convertToType(data['name'], 'Integer');
}
if (data.hasOwnProperty('snake_case')) {
obj['snake_case'] = ApiClient.convertToType(data['snake_case'], 'Integer');
}
}
return obj;
}
@ -55,6 +59,11 @@
*/
exports.prototype['name'] = undefined;
/**
* @member {Integer} snake_case
*/
exports.prototype['snake_case'] = undefined;

View File

@ -4,9 +4,9 @@ SwaggerPetstore - JavaScript client for swagger-petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API verion: 1.0.0
- API version: 1.0.0
- Package version: 1.0.0
- Build date: 2016-03-18T18:26:17.121+08:00
- Build date: 2016-03-30T20:58:07.996+08:00
- Build package: class io.swagger.codegen.languages.JavascriptClientCodegen
## Installation
@ -111,7 +111,10 @@ Class | Method | HTTP request | Description
## Documentation for Models
- [SwaggerPetstore.Animal](docs/Animal.md)
- [SwaggerPetstore.Cat](docs/Cat.md)
- [SwaggerPetstore.Category](docs/Category.md)
- [SwaggerPetstore.Dog](docs/Dog.md)
- [SwaggerPetstore.InlineResponse200](docs/InlineResponse200.md)
- [SwaggerPetstore.Model200Response](docs/Model200Response.md)
- [SwaggerPetstore.ModelReturn](docs/ModelReturn.md)

View File

@ -0,0 +1,8 @@
# SwaggerPetstore.Animal
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**className** | **String** | |

View File

@ -0,0 +1,8 @@
# SwaggerPetstore.Cat
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**declawed** | **Boolean** | | [optional]

View File

@ -0,0 +1,8 @@
# SwaggerPetstore.Dog
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**breed** | **String** | | [optional]

View File

@ -4,5 +4,6 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **Integer** | | [optional]
**snakeCase** | **Integer** | | [optional]

View File

@ -25,11 +25,7 @@
* Constructs a new PetApi.
* @alias module:api/PetApi
* @class
<<<<<<< HEAD
* @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance}
=======
* @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance}
>>>>>>> update js doc
* if unspecified.
*/
var exports = function(apiClient) {
@ -179,11 +175,7 @@
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* @param {Object} opts Optional parameters
<<<<<<< HEAD
* @param {Array.<String>} opts.status Status values that need to be considered for query
=======
* @param {Array.<String>} opts.status Status values that need to be considered for query (default to available)
>>>>>>> update js doc
* @param {module:api/PetApi~findPetsByStatusCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {Array.<module:model/Pet>}
*/

View File

@ -1,12 +1,12 @@
(function(factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['./ApiClient', './model/Category', './model/InlineResponse200', './model/Model200Response', './model/ModelReturn', './model/Name', './model/Order', './model/Pet', './model/SpecialModelName', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory);
define(['./ApiClient', './model/Animal', './model/Cat', './model/Category', './model/Dog', './model/InlineResponse200', './model/Model200Response', './model/ModelReturn', './model/Name', './model/Order', './model/Pet', './model/SpecialModelName', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('./ApiClient'), require('./model/Category'), require('./model/InlineResponse200'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi'));
module.exports = factory(require('./ApiClient'), require('./model/Animal'), require('./model/Cat'), require('./model/Category'), require('./model/Dog'), require('./model/InlineResponse200'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi'));
}
}(function(ApiClient, Category, InlineResponse200, Model200Response, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, PetApi, StoreApi, UserApi) {
}(function(ApiClient, Animal, Cat, Category, Dog, InlineResponse200, Model200Response, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, PetApi, StoreApi, UserApi) {
'use strict';
/**
@ -46,11 +46,26 @@
* @property {module:ApiClient}
*/
ApiClient: ApiClient,
/**
* The Animal model constructor.
* @property {module:model/Animal}
*/
Animal: Animal,
/**
* The Cat model constructor.
* @property {module:model/Cat}
*/
Cat: Cat,
/**
* The Category model constructor.
* @property {module:model/Category}
*/
Category: Category,
/**
* The Dog model constructor.
* @property {module:model/Dog}
*/
Dog: Dog,
/**
* The InlineResponse200 model constructor.
* @property {module:model/InlineResponse200}

View File

@ -0,0 +1,63 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['../ApiClient'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'));
} else {
// Browser globals (root is window)
if (!root.SwaggerPetstore) {
root.SwaggerPetstore = {};
}
root.SwaggerPetstore.Animal = factory(root.SwaggerPetstore.ApiClient);
}
}(this, function(ApiClient) {
'use strict';
/**
* The Animal model module.
* @module model/Animal
* @version 1.0.0
*/
/**
* Constructs a new <code>Animal</code>.
* @alias module:model/Animal
* @class
* @param className
*/
var exports = function(className) {
this['className'] = className;
};
/**
* Constructs a <code>Animal</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/Animal} obj Optional instance to populate.
* @return {module:model/Animal} The populated <code>Animal</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();
if (data.hasOwnProperty('className')) {
obj['className'] = ApiClient.convertToType(data['className'], 'String');
}
}
return obj;
}
/**
* @member {String} className
*/
exports.prototype['className'] = undefined;
return exports;
}));

View File

@ -0,0 +1,67 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['../ApiClient', './Animal'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'), require('./Animal'));
} else {
// Browser globals (root is window)
if (!root.SwaggerPetstore) {
root.SwaggerPetstore = {};
}
root.SwaggerPetstore.Cat = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal);
}
}(this, function(ApiClient, Animal) {
'use strict';
/**
* The Cat model module.
* @module model/Cat
* @version 1.0.0
*/
/**
* Constructs a new <code>Cat</code>.
* @alias module:model/Cat
* @class
* @extends module:model/Animal
* @param className
*/
var exports = function(className) {
Animal.call(this, className);
};
/**
* Constructs a <code>Cat</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/Cat} obj Optional instance to populate.
* @return {module:model/Cat} The populated <code>Cat</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();
Animal.constructFromObject(data, obj);
if (data.hasOwnProperty('declawed')) {
obj['declawed'] = ApiClient.convertToType(data['declawed'], 'Boolean');
}
}
return obj;
}
exports.prototype = Object.create(Animal.prototype);
exports.prototype.constructor = exports;
/**
* @member {Boolean} declawed
*/
exports.prototype['declawed'] = undefined;
return exports;
}));

View File

@ -0,0 +1,67 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['../ApiClient', './Animal'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'), require('./Animal'));
} else {
// Browser globals (root is window)
if (!root.SwaggerPetstore) {
root.SwaggerPetstore = {};
}
root.SwaggerPetstore.Dog = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Animal);
}
}(this, function(ApiClient, Animal) {
'use strict';
/**
* The Dog model module.
* @module model/Dog
* @version 1.0.0
*/
/**
* Constructs a new <code>Dog</code>.
* @alias module:model/Dog
* @class
* @extends module:model/Animal
* @param className
*/
var exports = function(className) {
Animal.call(this, className);
};
/**
* Constructs a <code>Dog</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/Dog} obj Optional instance to populate.
* @return {module:model/Dog} The populated <code>Dog</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();
Animal.constructFromObject(data, obj);
if (data.hasOwnProperty('breed')) {
obj['breed'] = ApiClient.convertToType(data['breed'], 'String');
}
}
return obj;
}
exports.prototype = Object.create(Animal.prototype);
exports.prototype.constructor = exports;
/**
* @member {String} breed
*/
exports.prototype['breed'] = undefined;
return exports;
}));

View File

@ -29,6 +29,7 @@
var exports = function() {
};
/**
@ -45,6 +46,9 @@
if (data.hasOwnProperty('name')) {
obj['name'] = ApiClient.convertToType(data['name'], 'Integer');
}
if (data.hasOwnProperty('snake_case')) {
obj['snake_case'] = ApiClient.convertToType(data['snake_case'], 'Integer');
}
}
return obj;
}
@ -55,6 +59,11 @@
*/
exports.prototype['name'] = undefined;
/**
* @member {Integer} snake_case
*/
exports.prototype['snake_case'] = undefined;

View File

@ -8,9 +8,9 @@ This is a sample server Petstore server. You can find out more about Swagger at
Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API verion: 1.0.0
- API version: 1.0.0
- Package version: 1.0.0
- Build date: 2016-03-19T17:46:21.048+08:00
- Build date: 2016-03-30T20:57:51.908+08:00
- Build package: class io.swagger.codegen.languages.PerlClientCodegen
## A note on Moose
@ -231,7 +231,10 @@ use WWW::SwaggerClient::UserApi;
To load the models:
```perl
use WWW::SwaggerClient::Object::Animal;
use WWW::SwaggerClient::Object::Cat;
use WWW::SwaggerClient::Object::Category;
use WWW::SwaggerClient::Object::Dog;
use WWW::SwaggerClient::Object::InlineResponse200;
use WWW::SwaggerClient::Object::Model200Response;
use WWW::SwaggerClient::Object::ModelReturn;
@ -257,7 +260,10 @@ use WWW::SwaggerClient::StoreApi;
use WWW::SwaggerClient::UserApi;
# load the models
use WWW::SwaggerClient::Object::Animal;
use WWW::SwaggerClient::Object::Cat;
use WWW::SwaggerClient::Object::Category;
use WWW::SwaggerClient::Object::Dog;
use WWW::SwaggerClient::Object::InlineResponse200;
use WWW::SwaggerClient::Object::Model200Response;
use WWW::SwaggerClient::Object::ModelReturn;
@ -320,7 +326,10 @@ Class | Method | HTTP request | Description
# DOCUMENTATION FOR MODELS
- [WWW::SwaggerClient::Object::Animal](docs/Animal.md)
- [WWW::SwaggerClient::Object::Cat](docs/Cat.md)
- [WWW::SwaggerClient::Object::Category](docs/Category.md)
- [WWW::SwaggerClient::Object::Dog](docs/Dog.md)
- [WWW::SwaggerClient::Object::InlineResponse200](docs/InlineResponse200.md)
- [WWW::SwaggerClient::Object::Model200Response](docs/Model200Response.md)
- [WWW::SwaggerClient::Object::ModelReturn](docs/ModelReturn.md)

View File

@ -0,0 +1,15 @@
# WWW::SwaggerClient::Object::Animal
## Load the model package
```perl
use WWW::SwaggerClient::Object::Animal;
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **string** | |
[[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

@ -0,0 +1,16 @@
# WWW::SwaggerClient::Object::Cat
## Load the model package
```perl
use WWW::SwaggerClient::Object::Cat;
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **string** | |
**declawed** | **boolean** | | [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)

View File

@ -0,0 +1,16 @@
# WWW::SwaggerClient::Object::Dog
## Load the model package
```perl
use WWW::SwaggerClient::Object::Dog;
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **string** | |
**breed** | **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)

View File

@ -0,0 +1,127 @@
package WWW::SwaggerClient::Object::Animal;
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 => 'Animal',
required => [], # TODO
} );
__PACKAGE__->method_documentation({
'class_name' => {
datatype => 'string',
base_name => 'className',
description => '',
format => '',
read_only => '',
},
});
__PACKAGE__->swagger_types( {
'class_name' => 'string'
} );
__PACKAGE__->attribute_map( {
'class_name' => 'className'
} );
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
1;

View File

@ -0,0 +1,136 @@
package WWW::SwaggerClient::Object::Cat;
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 => 'Cat',
required => [], # TODO
} );
__PACKAGE__->method_documentation({
'class_name' => {
datatype => 'string',
base_name => 'className',
description => '',
format => '',
read_only => '',
},
'declawed' => {
datatype => 'boolean',
base_name => 'declawed',
description => '',
format => '',
read_only => '',
},
});
__PACKAGE__->swagger_types( {
'class_name' => 'string',
'declawed' => 'boolean'
} );
__PACKAGE__->attribute_map( {
'class_name' => 'className',
'declawed' => 'declawed'
} );
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
1;

View File

@ -0,0 +1,136 @@
package WWW::SwaggerClient::Object::Dog;
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 => 'Dog',
required => [], # TODO
} );
__PACKAGE__->method_documentation({
'class_name' => {
datatype => 'string',
base_name => 'className',
description => '',
format => '',
read_only => '',
},
'breed' => {
datatype => 'string',
base_name => 'breed',
description => '',
format => '',
read_only => '',
},
});
__PACKAGE__->swagger_types( {
'class_name' => 'string',
'breed' => 'string'
} );
__PACKAGE__->attribute_map( {
'class_name' => 'className',
'breed' => 'breed'
} );
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
1;

View File

@ -37,7 +37,7 @@ has version_info => ( is => 'ro',
default => sub { {
app_name => 'Swagger Petstore',
app_version => '1.0.0',
generated_date => '2016-03-19T17:46:21.048+08:00',
generated_date => '2016-03-30T20:57:51.908+08:00',
generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen',
} },
documentation => 'Information about the application version and the codegen codebase version'
@ -103,7 +103,7 @@ Automatically generated by the Perl Swagger Codegen project:
=over 4
=item Build date: 2016-03-19T17:46:21.048+08:00
=item Build date: 2016-03-30T20:57:51.908+08:00
=item Build package: class io.swagger.codegen.languages.PerlClientCodegen

View File

@ -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::Animal');
my $instance = WWW::SwaggerClient::Object::Animal->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::Animal');

View File

@ -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::Cat');
my $instance = WWW::SwaggerClient::Object::Cat->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::Cat');

View File

@ -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::Dog');
my $instance = WWW::SwaggerClient::Object::Dog->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::Dog');

View File

@ -3,9 +3,9 @@ This is a sample server Petstore server. You can find out more about Swagger at
This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API verion: 1.0.0
- API version: 1.0.0
- Package version: 1.0.0
- Build date: 2016-03-19T16:11:03.465+08:00
- Build date: 2016-03-30T20:57:56.803+08:00
- Build package: class io.swagger.codegen.languages.PhpClientCodegen
## Requirements
@ -108,7 +108,10 @@ Class | Method | HTTP request | Description
## Documentation For Models
- [Animal](docs/Animal.md)
- [Cat](docs/Cat.md)
- [Category](docs/Category.md)
- [Dog](docs/Dog.md)
- [InlineResponse200](docs/InlineResponse200.md)
- [Model200Response](docs/Model200Response.md)
- [ModelReturn](docs/ModelReturn.md)

View File

@ -0,0 +1,10 @@
# 200Response
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **int** | | [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)

View File

@ -0,0 +1,10 @@
# Animal
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **string** | |
[[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

@ -0,0 +1,10 @@
# Cat
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**declawed** | **bool** | | [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)

View File

@ -0,0 +1,10 @@
# Dog
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**breed** | **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)

View File

@ -0,0 +1,191 @@
<?php
/**
* Animal
*
* PHP version 5
*
* @category Class
* @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
* @link https://github.com/swagger-api/swagger-codegen
*/
/**
* Copyright 2016 SmartBear Software
*
* 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.
*/
/**
* 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.
*/
namespace Swagger\Client\Model;
use \ArrayAccess;
/**
* Animal Class Doc Comment
*
* @category Class
* @description
* @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
* @link https://github.com/swagger-api/swagger-codegen
*/
class Animal implements ArrayAccess
{
/**
* Array of property to type mappings. Used for (de)serialization
* @var string[]
*/
static $swaggerTypes = array(
'class_name' => '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(
'class_name' => 'className'
);
static function attributeMap() {
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
* @var string[]
*/
static $setters = array(
'class_name' => 'setClassName'
);
static function setters() {
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
* @var string[]
*/
static $getters = array(
'class_name' => 'getClassName'
);
static function getters() {
return self::$getters;
}
/**
* $class_name
* @var string
*/
protected $class_name;
/**
* Constructor
* @param mixed[] $data Associated array of property value initalizing the model
*/
public function __construct(array $data = null)
{
if ($data != null) {
$this->class_name = $data["class_name"];
}
}
/**
* Gets class_name
* @return string
*/
public function getClassName()
{
return $this->class_name;
}
/**
* Sets class_name
* @param string $class_name
* @return $this
*/
public function setClassName($class_name)
{
$this->class_name = $class_name;
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')) {
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
} else {
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
}
}
}

View File

@ -0,0 +1,191 @@
<?php
/**
* Cat
*
* PHP version 5
*
* @category Class
* @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
* @link https://github.com/swagger-api/swagger-codegen
*/
/**
* Copyright 2016 SmartBear Software
*
* 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.
*/
/**
* 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.
*/
namespace Swagger\Client\Model;
use \ArrayAccess;
/**
* Cat Class Doc Comment
*
* @category Class
* @description
* @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
* @link https://github.com/swagger-api/swagger-codegen
*/
class Cat extends Animal implements ArrayAccess
{
/**
* Array of property to type mappings. Used for (de)serialization
* @var string[]
*/
static $swaggerTypes = array(
'declawed' => 'bool'
);
static function swaggerTypes() {
return self::$swaggerTypes + parent::swaggerTypes();
}
/**
* Array of attributes where the key is the local name, and the value is the original name
* @var string[]
*/
static $attributeMap = array(
'declawed' => 'declawed'
);
static function attributeMap() {
return parent::attributeMap() + self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
* @var string[]
*/
static $setters = array(
'declawed' => 'setDeclawed'
);
static function setters() {
return parent::setters() + self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
* @var string[]
*/
static $getters = array(
'declawed' => 'getDeclawed'
);
static function getters() {
return parent::getters() + self::$getters;
}
/**
* $declawed
* @var bool
*/
protected $declawed;
/**
* Constructor
* @param mixed[] $data Associated array of property value initalizing the model
*/
public function __construct(array $data = null)
{
parent::__construct($data);
if ($data != null) {
$this->declawed = $data["declawed"];
}
}
/**
* Gets declawed
* @return bool
*/
public function getDeclawed()
{
return $this->declawed;
}
/**
* Sets declawed
* @param bool $declawed
* @return $this
*/
public function setDeclawed($declawed)
{
$this->declawed = $declawed;
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')) {
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
} else {
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
}
}
}

View File

@ -118,6 +118,7 @@ class Category implements ArrayAccess
*/
public function __construct(array $data = null)
{
if ($data != null) {
$this->id = $data["id"];
$this->name = $data["name"];

View File

@ -0,0 +1,191 @@
<?php
/**
* Dog
*
* PHP version 5
*
* @category Class
* @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
* @link https://github.com/swagger-api/swagger-codegen
*/
/**
* Copyright 2016 SmartBear Software
*
* 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.
*/
/**
* 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.
*/
namespace Swagger\Client\Model;
use \ArrayAccess;
/**
* Dog Class Doc Comment
*
* @category Class
* @description
* @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
* @link https://github.com/swagger-api/swagger-codegen
*/
class Dog extends Animal implements ArrayAccess
{
/**
* Array of property to type mappings. Used for (de)serialization
* @var string[]
*/
static $swaggerTypes = array(
'breed' => 'string'
);
static function swaggerTypes() {
return self::$swaggerTypes + parent::swaggerTypes();
}
/**
* Array of attributes where the key is the local name, and the value is the original name
* @var string[]
*/
static $attributeMap = array(
'breed' => 'breed'
);
static function attributeMap() {
return parent::attributeMap() + self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
* @var string[]
*/
static $setters = array(
'breed' => 'setBreed'
);
static function setters() {
return parent::setters() + self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
* @var string[]
*/
static $getters = array(
'breed' => 'getBreed'
);
static function getters() {
return parent::getters() + self::$getters;
}
/**
* $breed
* @var string
*/
protected $breed;
/**
* Constructor
* @param mixed[] $data Associated array of property value initalizing the model
*/
public function __construct(array $data = null)
{
parent::__construct($data);
if ($data != null) {
$this->breed = $data["breed"];
}
}
/**
* Gets breed
* @return string
*/
public function getBreed()
{
return $this->breed;
}
/**
* Sets breed
* @param string $breed
* @return $this
*/
public function setBreed($breed)
{
$this->breed = $breed;
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')) {
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
} else {
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
}
}
}

View File

@ -158,6 +158,7 @@ class InlineResponse200 implements ArrayAccess
*/
public function __construct(array $data = null)
{
if ($data != null) {
$this->tags = $data["tags"];
$this->id = $data["id"];

View File

@ -108,6 +108,7 @@ class Model200Response implements ArrayAccess
*/
public function __construct(array $data = null)
{
if ($data != null) {
$this->name = $data["name"];
}

View File

@ -108,6 +108,7 @@ class ModelReturn implements ArrayAccess
*/
public function __construct(array $data = null)
{
if ($data != null) {
$this->return = $data["return"];
}

View File

@ -118,6 +118,7 @@ class Name implements ArrayAccess
*/
public function __construct(array $data = null)
{
if ($data != null) {
$this->name = $data["name"];
$this->snake_case = $data["snake_case"];

View File

@ -158,6 +158,7 @@ class Order implements ArrayAccess
*/
public function __construct(array $data = null)
{
if ($data != null) {
$this->id = $data["id"];
$this->pet_id = $data["pet_id"];

View File

@ -158,6 +158,7 @@ class Pet implements ArrayAccess
*/
public function __construct(array $data = null)
{
if ($data != null) {
$this->id = $data["id"];
$this->category = $data["category"];

View File

@ -108,6 +108,7 @@ class SpecialModelName implements ArrayAccess
*/
public function __construct(array $data = null)
{
if ($data != null) {
$this->special_property_name = $data["special_property_name"];
}

View File

@ -118,6 +118,7 @@ class Tag implements ArrayAccess
*/
public function __construct(array $data = null)
{
if ($data != null) {
$this->id = $data["id"];
$this->name = $data["name"];

View File

@ -178,6 +178,7 @@ class User implements ArrayAccess
*/
public function __construct(array $data = null)
{
if ($data != null) {
$this->id = $data["id"];
$this->username = $data["username"];

View File

@ -0,0 +1,70 @@
<?php
/**
* AnimalTest
*
* PHP version 5
*
* @category Class
* @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
* @link https://github.com/swagger-api/swagger-codegen
*/
/**
* Copyright 2016 SmartBear Software
*
* 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.
*/
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Please update the test case below to test the model.
*/
namespace Swagger\Client\Model;
/**
* AnimalTest Class Doc Comment
*
* @category Class
* @description
* @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
* @link https://github.com/swagger-api/swagger-codegen
*/
class AnimalTest extends \PHPUnit_Framework_TestCase
{
/**
* Setup before running each test case
*/
public static function setUpBeforeClass() {
}
/**
* Clean up after running each test case
*/
public static function tearDownAfterClass() {
}
/**
* Test Animal
*/
public function testAnimal() {
}
}

View File

@ -0,0 +1,70 @@
<?php
/**
* CatTest
*
* PHP version 5
*
* @category Class
* @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
* @link https://github.com/swagger-api/swagger-codegen
*/
/**
* Copyright 2016 SmartBear Software
*
* 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.
*/
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Please update the test case below to test the model.
*/
namespace Swagger\Client\Model;
/**
* CatTest Class Doc Comment
*
* @category Class
* @description
* @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
* @link https://github.com/swagger-api/swagger-codegen
*/
class CatTest extends \PHPUnit_Framework_TestCase
{
/**
* Setup before running each test case
*/
public static function setUpBeforeClass() {
}
/**
* Clean up after running each test case
*/
public static function tearDownAfterClass() {
}
/**
* Test Cat
*/
public function testCat() {
}
}

View File

@ -0,0 +1,70 @@
<?php
/**
* DogTest
*
* PHP version 5
*
* @category Class
* @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
* @link https://github.com/swagger-api/swagger-codegen
*/
/**
* Copyright 2016 SmartBear Software
*
* 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.
*/
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Please update the test case below to test the model.
*/
namespace Swagger\Client\Model;
/**
* DogTest Class Doc Comment
*
* @category Class
* @description
* @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
* @link https://github.com/swagger-api/swagger-codegen
*/
class DogTest extends \PHPUnit_Framework_TestCase
{
/**
* Setup before running each test case
*/
public static function setUpBeforeClass() {
}
/**
* Clean up after running each test case
*/
public static function tearDownAfterClass() {
}
/**
* Test Dog
*/
public function testDog() {
}
}

View File

@ -375,6 +375,33 @@ class PetApiTest extends \PHPUnit_Framework_TestCase
}
// test inheritance in the model
public function testInheritance()
{
$new_dog = new Swagger\Client\Model\Dog;
// the object should be an instance of the derived class
$this->assertInstanceOf('Swagger\Client\Model\Dog', $new_dog);
// the object should also be an instance of the parent class
$this->assertInstanceOf('Swagger\Client\Model\Animal', $new_dog);
}
// test inheritance constructor is working with data
// initialization
public function testInheritanceConstructorDataInitialization()
{
// initialize the object with data in the constructor
$data = array(
'class_name' => 'Dog',
'breed' => 'Great Dane'
);
$new_dog = new Swagger\Client\Model\Dog($data);
// the property on the derived class should be set
$this->assertSame('Great Dane', $new_dog->getBreed());
// the property on the parent class should be set
$this->assertSame('Dog', $new_dog->getClassName());
}
}
?>

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