diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/petstore b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/petstore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Animal.java new file mode 100644 index 00000000000..e1e3604ad6b --- /dev/null +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Animal.java @@ -0,0 +1,73 @@ +package io.swagger.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + + + + + + +public class Animal { + + private String className = null; + + + /** + **/ + public Animal className(String className) { + this.className = className; + return this; + } + + @ApiModelProperty(example = "null", required = true, value = "") + @JsonProperty("className") + public String getClassName() { + return className; + } + public void setClassName(String className) { + this.className = className; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Animal animal = (Animal) o; + return Objects.equals(this.className, animal.className); + } + + @Override + public int hashCode() { + return Objects.hash(className); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Animal {\n"); + + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Cat.java new file mode 100644 index 00000000000..6b4875cda38 --- /dev/null +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Cat.java @@ -0,0 +1,95 @@ +package io.swagger.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.client.model.Animal; + + + + + + +public class Cat extends Animal { + + private String className = null; + private Boolean declawed = null; + + + /** + **/ + public Cat className(String className) { + this.className = className; + return this; + } + + @ApiModelProperty(example = "null", required = true, value = "") + @JsonProperty("className") + public String getClassName() { + return className; + } + public void setClassName(String className) { + this.className = className; + } + + + /** + **/ + public Cat declawed(Boolean declawed) { + this.declawed = declawed; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("declawed") + public Boolean getDeclawed() { + return declawed; + } + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(this.className, cat.className) && + Objects.equals(this.declawed, cat.declawed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(className, declawed, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Dog.java new file mode 100644 index 00000000000..5aa51687996 --- /dev/null +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Dog.java @@ -0,0 +1,95 @@ +package io.swagger.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.client.model.Animal; + + + + + + +public class Dog extends Animal { + + private String className = null; + private String breed = null; + + + /** + **/ + public Dog className(String className) { + this.className = className; + return this; + } + + @ApiModelProperty(example = "null", required = true, value = "") + @JsonProperty("className") + public String getClassName() { + return className; + } + public void setClassName(String className) { + this.className = className; + } + + + /** + **/ + public Dog breed(String breed) { + this.breed = breed; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("breed") + public String getBreed() { + return breed; + } + public void setBreed(String breed) { + this.breed = breed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(this.className, dog.className) && + Objects.equals(this.breed, dog.breed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(className, breed, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/FormatTest.java new file mode 100644 index 00000000000..78c76501e0a --- /dev/null +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/FormatTest.java @@ -0,0 +1,275 @@ +package io.swagger.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.Date; + + + + + + +public class FormatTest { + + private Integer integer = null; + private Integer int32 = null; + private Long int64 = null; + private BigDecimal number = null; + private Float _float = null; + private Double _double = null; + private String string = null; + private byte[] _byte = null; + private byte[] binary = null; + private Date date = null; + private String dateTime = null; + + + /** + **/ + public FormatTest integer(Integer integer) { + this.integer = integer; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("integer") + public Integer getInteger() { + return integer; + } + public void setInteger(Integer integer) { + this.integer = integer; + } + + + /** + **/ + public FormatTest int32(Integer int32) { + this.int32 = int32; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("int32") + public Integer getInt32() { + return int32; + } + public void setInt32(Integer int32) { + this.int32 = int32; + } + + + /** + **/ + public FormatTest int64(Long int64) { + this.int64 = int64; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("int64") + public Long getInt64() { + return int64; + } + public void setInt64(Long int64) { + this.int64 = int64; + } + + + /** + **/ + public FormatTest number(BigDecimal number) { + this.number = number; + return this; + } + + @ApiModelProperty(example = "null", required = true, value = "") + @JsonProperty("number") + public BigDecimal getNumber() { + return number; + } + public void setNumber(BigDecimal number) { + this.number = number; + } + + + /** + **/ + public FormatTest _float(Float _float) { + this._float = _float; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("float") + public Float getFloat() { + return _float; + } + public void setFloat(Float _float) { + this._float = _float; + } + + + /** + **/ + public FormatTest _double(Double _double) { + this._double = _double; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("double") + public Double getDouble() { + return _double; + } + public void setDouble(Double _double) { + this._double = _double; + } + + + /** + **/ + public FormatTest string(String string) { + this.string = string; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("string") + public String getString() { + return string; + } + public void setString(String string) { + this.string = string; + } + + + /** + **/ + public FormatTest _byte(byte[] _byte) { + this._byte = _byte; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("byte") + public byte[] getByte() { + return _byte; + } + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + + /** + **/ + public FormatTest binary(byte[] binary) { + this.binary = binary; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("binary") + public byte[] getBinary() { + return binary; + } + public void setBinary(byte[] binary) { + this.binary = binary; + } + + + /** + **/ + public FormatTest date(Date date) { + this.date = date; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("date") + public Date getDate() { + return date; + } + public void setDate(Date date) { + this.date = date; + } + + + /** + **/ + public FormatTest dateTime(String dateTime) { + this.dateTime = dateTime; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("dateTime") + public String getDateTime() { + return dateTime; + } + public void setDateTime(String dateTime) { + this.dateTime = dateTime; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormatTest formatTest = (FormatTest) o; + return Objects.equals(this.integer, formatTest.integer) && + Objects.equals(this.int32, formatTest.int32) && + Objects.equals(this.int64, formatTest.int64) && + Objects.equals(this.number, formatTest.number) && + Objects.equals(this._float, formatTest._float) && + Objects.equals(this._double, formatTest._double) && + Objects.equals(this.string, formatTest.string) && + Objects.equals(this._byte, formatTest._byte) && + Objects.equals(this.binary, formatTest.binary) && + Objects.equals(this.date, formatTest.date) && + Objects.equals(this.dateTime, formatTest.dateTime); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormatTest {\n"); + + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/perl/docs/FormatTest.md b/samples/client/petstore/perl/docs/FormatTest.md new file mode 100644 index 00000000000..c99370c0040 --- /dev/null +++ b/samples/client/petstore/perl/docs/FormatTest.md @@ -0,0 +1,25 @@ +# WWW::SwaggerClient::Object::FormatTest + +## Load the model package +```perl +use WWW::SwaggerClient::Object::FormatTest; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **int** | | [optional] +**int32** | **int** | | [optional] +**int64** | **int** | | [optional] +**number** | [**Number**](Number.md) | | +**float** | **double** | | [optional] +**double** | **double** | | [optional] +**string** | **string** | | [optional] +**byte** | **string** | | [optional] +**binary** | **string** | | [optional] +**date** | **DateTime** | | [optional] +**date_time** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/FormatTest.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/FormatTest.pm new file mode 100644 index 00000000000..3bc403453c5 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/FormatTest.pm @@ -0,0 +1,216 @@ +package WWW::SwaggerClient::Object::FormatTest; + +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 => 'FormatTest', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'integer' => { + datatype => 'int', + base_name => 'integer', + description => '', + format => '', + read_only => '', + }, + 'int32' => { + datatype => 'int', + base_name => 'int32', + description => '', + format => '', + read_only => '', + }, + 'int64' => { + datatype => 'int', + base_name => 'int64', + description => '', + format => '', + read_only => '', + }, + 'number' => { + datatype => 'Number', + base_name => 'number', + description => '', + format => '', + read_only => '', + }, + 'float' => { + datatype => 'double', + base_name => 'float', + description => '', + format => '', + read_only => '', + }, + 'double' => { + datatype => 'double', + base_name => 'double', + description => '', + format => '', + read_only => '', + }, + 'string' => { + datatype => 'string', + base_name => 'string', + description => '', + format => '', + read_only => '', + }, + 'byte' => { + datatype => 'string', + base_name => 'byte', + description => '', + format => '', + read_only => '', + }, + 'binary' => { + datatype => 'string', + base_name => 'binary', + description => '', + format => '', + read_only => '', + }, + 'date' => { + datatype => 'DateTime', + base_name => 'date', + description => '', + format => '', + read_only => '', + }, + 'date_time' => { + datatype => 'string', + base_name => 'dateTime', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->swagger_types( { + 'integer' => 'int', + 'int32' => 'int', + 'int64' => 'int', + 'number' => 'Number', + 'float' => 'double', + 'double' => 'double', + 'string' => 'string', + 'byte' => 'string', + 'binary' => 'string', + 'date' => 'DateTime', + 'date_time' => 'string' +} ); + +__PACKAGE__->attribute_map( { + 'integer' => 'integer', + 'int32' => 'int32', + 'int64' => 'int64', + 'number' => 'number', + 'float' => 'float', + 'double' => 'double', + 'string' => 'string', + 'byte' => 'byte', + 'binary' => 'binary', + 'date' => 'date', + 'date_time' => 'dateTime' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/t/FormatTestTest.t b/samples/client/petstore/perl/t/FormatTestTest.t new file mode 100644 index 00000000000..4d1521f906c --- /dev/null +++ b/samples/client/petstore/perl/t/FormatTestTest.t @@ -0,0 +1,17 @@ +# NOTE: This class is auto generated by the Swagger Codegen +# Please update the test case below to test the model. + +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::SwaggerClient::Object::FormatTest'); + +my $instance = WWW::SwaggerClient::Object::FormatTest->new(); + +isa_ok($instance, 'WWW::SwaggerClient::Object::FormatTest'); + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md b/samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md new file mode 100644 index 00000000000..7ea1a17404f --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md @@ -0,0 +1,20 @@ +# FormatTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **int** | | [optional] +**int32** | **int** | | [optional] +**int64** | **int** | | [optional] +**number** | **float** | | +**float** | **float** | | [optional] +**double** | **double** | | [optional] +**string** | **string** | | [optional] +**byte** | **string** | | [optional] +**binary** | **string** | | [optional] +**date** | [**\DateTime**](Date.md) | | [optional] +**date_time** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php new file mode 100644 index 00000000000..949603d7d0a --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php @@ -0,0 +1,494 @@ + 'int', + 'int32' => 'int', + 'int64' => 'int', + 'number' => 'float', + 'float' => 'float', + 'double' => 'double', + 'string' => 'string', + 'byte' => 'string', + 'binary' => 'string', + 'date' => '\DateTime', + 'date_time' => '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( + 'integer' => 'integer', + 'int32' => 'int32', + 'int64' => 'int64', + 'number' => 'number', + 'float' => 'float', + 'double' => 'double', + 'string' => 'string', + 'byte' => 'byte', + 'binary' => 'binary', + 'date' => 'date', + 'date_time' => 'dateTime' + ); + + static function attributeMap() { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + static $setters = array( + 'integer' => 'setInteger', + 'int32' => 'setInt32', + 'int64' => 'setInt64', + 'number' => 'setNumber', + 'float' => 'setFloat', + 'double' => 'setDouble', + 'string' => 'setString', + 'byte' => 'setByte', + 'binary' => 'setBinary', + 'date' => 'setDate', + 'date_time' => 'setDateTime' + ); + + static function setters() { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + static $getters = array( + 'integer' => 'getInteger', + 'int32' => 'getInt32', + 'int64' => 'getInt64', + 'number' => 'getNumber', + 'float' => 'getFloat', + 'double' => 'getDouble', + 'string' => 'getString', + 'byte' => 'getByte', + 'binary' => 'getBinary', + 'date' => 'getDate', + 'date_time' => 'getDateTime' + ); + + static function getters() { + return self::$getters; + } + + /** + * $integer + * @var int + */ + protected $integer; + /** + * $int32 + * @var int + */ + protected $int32; + /** + * $int64 + * @var int + */ + protected $int64; + /** + * $number + * @var float + */ + protected $number; + /** + * $float + * @var float + */ + protected $float; + /** + * $double + * @var double + */ + protected $double; + /** + * $string + * @var string + */ + protected $string; + /** + * $byte + * @var string + */ + protected $byte; + /** + * $binary + * @var string + */ + protected $binary; + /** + * $date + * @var \DateTime + */ + protected $date; + /** + * $date_time + * @var string + */ + protected $date_time; + + /** + * Constructor + * @param mixed[] $data Associated array of property value initalizing the model + */ + public function __construct(array $data = null) + { + + + if ($data != null) { + $this->integer = $data["integer"]; + $this->int32 = $data["int32"]; + $this->int64 = $data["int64"]; + $this->number = $data["number"]; + $this->float = $data["float"]; + $this->double = $data["double"]; + $this->string = $data["string"]; + $this->byte = $data["byte"]; + $this->binary = $data["binary"]; + $this->date = $data["date"]; + $this->date_time = $data["date_time"]; + } + } + /** + * Gets integer + * @return int + */ + public function getInteger() + { + return $this->integer; + } + + /** + * Sets integer + * @param int $integer + * @return $this + */ + public function setInteger($integer) + { + + $this->integer = $integer; + return $this; + } + /** + * Gets int32 + * @return int + */ + public function getInt32() + { + return $this->int32; + } + + /** + * Sets int32 + * @param int $int32 + * @return $this + */ + public function setInt32($int32) + { + + $this->int32 = $int32; + return $this; + } + /** + * Gets int64 + * @return int + */ + public function getInt64() + { + return $this->int64; + } + + /** + * Sets int64 + * @param int $int64 + * @return $this + */ + public function setInt64($int64) + { + + $this->int64 = $int64; + return $this; + } + /** + * Gets number + * @return float + */ + public function getNumber() + { + return $this->number; + } + + /** + * Sets number + * @param float $number + * @return $this + */ + public function setNumber($number) + { + + $this->number = $number; + return $this; + } + /** + * Gets float + * @return float + */ + public function getFloat() + { + return $this->float; + } + + /** + * Sets float + * @param float $float + * @return $this + */ + public function setFloat($float) + { + + $this->float = $float; + return $this; + } + /** + * Gets double + * @return double + */ + public function getDouble() + { + return $this->double; + } + + /** + * Sets double + * @param double $double + * @return $this + */ + public function setDouble($double) + { + + $this->double = $double; + return $this; + } + /** + * Gets string + * @return string + */ + public function getString() + { + return $this->string; + } + + /** + * Sets string + * @param string $string + * @return $this + */ + public function setString($string) + { + + $this->string = $string; + return $this; + } + /** + * Gets byte + * @return string + */ + public function getByte() + { + return $this->byte; + } + + /** + * Sets byte + * @param string $byte + * @return $this + */ + public function setByte($byte) + { + + $this->byte = $byte; + return $this; + } + /** + * Gets binary + * @return string + */ + public function getBinary() + { + return $this->binary; + } + + /** + * Sets binary + * @param string $binary + * @return $this + */ + public function setBinary($binary) + { + + $this->binary = $binary; + return $this; + } + /** + * Gets date + * @return \DateTime + */ + public function getDate() + { + return $this->date; + } + + /** + * Sets date + * @param \DateTime $date + * @return $this + */ + public function setDate($date) + { + + $this->date = $date; + return $this; + } + /** + * Gets date_time + * @return string + */ + public function getDateTime() + { + return $this->date_time; + } + + /** + * Sets date_time + * @param string $date_time + * @return $this + */ + public function setDateTime($date_time) + { + + $this->date_time = $date_time; + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * @param integer $offset Offset + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->$offset); + } + + /** + * Gets offset. + * @param integer $offset Offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->$offset; + } + + /** + * Sets value based on offset. + * @param integer $offset Offset + * @param mixed $value Value to be set + * @return void + */ + public function offsetSet($offset, $value) + { + $this->$offset = $value; + } + + /** + * Unsets offset. + * @param integer $offset Offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->$offset); + } + + /** + * Gets the string presentation of the object + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + } + + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); + } +} diff --git a/samples/client/petstore/python/docs/FormatTest.md b/samples/client/petstore/python/docs/FormatTest.md new file mode 100644 index 00000000000..00244bcbeaf --- /dev/null +++ b/samples/client/petstore/python/docs/FormatTest.md @@ -0,0 +1,20 @@ +# FormatTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **int** | | [optional] +**int32** | **int** | | [optional] +**int64** | **int** | | [optional] +**number** | **float** | | +**float** | **float** | | [optional] +**double** | **float** | | [optional] +**string** | **str** | | [optional] +**byte** | **str** | | [optional] +**binary** | **str** | | [optional] +**date** | **date** | | [optional] +**date_time** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python/petstore b/samples/client/petstore/python/petstore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/client/petstore/python/swagger_client/models/format_test.py b/samples/client/petstore/python/swagger_client/models/format_test.py new file mode 100644 index 00000000000..891b8fd0991 --- /dev/null +++ b/samples/client/petstore/python/swagger_client/models/format_test.py @@ -0,0 +1,370 @@ +# coding: utf-8 + +""" +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. + + Ref: https://github.com/swagger-api/swagger-codegen +""" + +from pprint import pformat +from six import iteritems + + +class FormatTest(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + def __init__(self): + """ + FormatTest - a model defined in Swagger + + :param dict swaggerTypes: The key is attribute name + and the value is attribute type. + :param dict attributeMap: The key is attribute name + and the value is json key in definition. + """ + self.swagger_types = { + 'integer': 'int', + 'int32': 'int', + 'int64': 'int', + 'number': 'float', + 'float': 'float', + 'double': 'float', + 'string': 'str', + 'byte': 'str', + 'binary': 'str', + 'date': 'date', + 'date_time': 'str' + } + + self.attribute_map = { + 'integer': 'integer', + 'int32': 'int32', + 'int64': 'int64', + 'number': 'number', + 'float': 'float', + 'double': 'double', + 'string': 'string', + 'byte': 'byte', + 'binary': 'binary', + 'date': 'date', + 'date_time': 'dateTime' + } + + self._integer = None + self._int32 = None + self._int64 = None + self._number = None + self._float = None + self._double = None + self._string = None + self._byte = None + self._binary = None + self._date = None + self._date_time = None + + @property + def integer(self): + """ + Gets the integer of this FormatTest. + + + :return: The integer of this FormatTest. + :rtype: int + """ + return self._integer + + @integer.setter + def integer(self, integer): + """ + Sets the integer of this FormatTest. + + + :param integer: The integer of this FormatTest. + :type: int + """ + self._integer = integer + + @property + def int32(self): + """ + Gets the int32 of this FormatTest. + + + :return: The int32 of this FormatTest. + :rtype: int + """ + return self._int32 + + @int32.setter + def int32(self, int32): + """ + Sets the int32 of this FormatTest. + + + :param int32: The int32 of this FormatTest. + :type: int + """ + self._int32 = int32 + + @property + def int64(self): + """ + Gets the int64 of this FormatTest. + + + :return: The int64 of this FormatTest. + :rtype: int + """ + return self._int64 + + @int64.setter + def int64(self, int64): + """ + Sets the int64 of this FormatTest. + + + :param int64: The int64 of this FormatTest. + :type: int + """ + self._int64 = int64 + + @property + def number(self): + """ + Gets the number of this FormatTest. + + + :return: The number of this FormatTest. + :rtype: float + """ + return self._number + + @number.setter + def number(self, number): + """ + Sets the number of this FormatTest. + + + :param number: The number of this FormatTest. + :type: float + """ + self._number = number + + @property + def float(self): + """ + Gets the float of this FormatTest. + + + :return: The float of this FormatTest. + :rtype: float + """ + return self._float + + @float.setter + def float(self, float): + """ + Sets the float of this FormatTest. + + + :param float: The float of this FormatTest. + :type: float + """ + self._float = float + + @property + def double(self): + """ + Gets the double of this FormatTest. + + + :return: The double of this FormatTest. + :rtype: float + """ + return self._double + + @double.setter + def double(self, double): + """ + Sets the double of this FormatTest. + + + :param double: The double of this FormatTest. + :type: float + """ + self._double = double + + @property + def string(self): + """ + Gets the string of this FormatTest. + + + :return: The string of this FormatTest. + :rtype: str + """ + return self._string + + @string.setter + def string(self, string): + """ + Sets the string of this FormatTest. + + + :param string: The string of this FormatTest. + :type: str + """ + self._string = string + + @property + def byte(self): + """ + Gets the byte of this FormatTest. + + + :return: The byte of this FormatTest. + :rtype: str + """ + return self._byte + + @byte.setter + def byte(self, byte): + """ + Sets the byte of this FormatTest. + + + :param byte: The byte of this FormatTest. + :type: str + """ + self._byte = byte + + @property + def binary(self): + """ + Gets the binary of this FormatTest. + + + :return: The binary of this FormatTest. + :rtype: str + """ + return self._binary + + @binary.setter + def binary(self, binary): + """ + Sets the binary of this FormatTest. + + + :param binary: The binary of this FormatTest. + :type: str + """ + self._binary = binary + + @property + def date(self): + """ + Gets the date of this FormatTest. + + + :return: The date of this FormatTest. + :rtype: date + """ + return self._date + + @date.setter + def date(self, date): + """ + Sets the date of this FormatTest. + + + :param date: The date of this FormatTest. + :type: date + """ + self._date = date + + @property + def date_time(self): + """ + Gets the date_time of this FormatTest. + + + :return: The date_time of this FormatTest. + :rtype: str + """ + return self._date_time + + @date_time.setter + def date_time(self, date_time): + """ + Sets the date_time of this FormatTest. + + + :param date_time: The date_time of this FormatTest. + :type: str + """ + self._date_time = date_time + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other + diff --git a/samples/client/petstore/ruby/docs/FormatTest.md b/samples/client/petstore/ruby/docs/FormatTest.md new file mode 100644 index 00000000000..02c44df9b66 --- /dev/null +++ b/samples/client/petstore/ruby/docs/FormatTest.md @@ -0,0 +1,18 @@ +# Petstore::FormatTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **Integer** | | [optional] +**int32** | **Integer** | | [optional] +**int64** | **Integer** | | [optional] +**number** | **Float** | | +**float** | **Float** | | [optional] +**double** | **Float** | | [optional] +**string** | **String** | | [optional] +**byte** | **String** | | [optional] +**binary** | **String** | | [optional] +**date** | **Date** | | [optional] +**date_time** | **String** | | [optional] + + diff --git a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb new file mode 100644 index 00000000000..c688c1f7841 --- /dev/null +++ b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb @@ -0,0 +1,255 @@ +=begin +Swagger Petstore + +This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +License: Apache 2.0 +http://www.apache.org/licenses/LICENSE-2.0.html + +Terms of Service: http://swagger.io/terms/ + +=end + +require 'date' + +module Petstore + class FormatTest + attr_accessor :integer + + attr_accessor :int32 + + attr_accessor :int64 + + attr_accessor :number + + attr_accessor :float + + attr_accessor :double + + attr_accessor :string + + attr_accessor :byte + + attr_accessor :binary + + attr_accessor :date + + attr_accessor :date_time + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'integer' => :'integer', + :'int32' => :'int32', + :'int64' => :'int64', + :'number' => :'number', + :'float' => :'float', + :'double' => :'double', + :'string' => :'string', + :'byte' => :'byte', + :'binary' => :'binary', + :'date' => :'date', + :'date_time' => :'dateTime' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'integer' => :'Integer', + :'int32' => :'Integer', + :'int64' => :'Integer', + :'number' => :'Float', + :'float' => :'Float', + :'double' => :'Float', + :'string' => :'String', + :'byte' => :'String', + :'binary' => :'String', + :'date' => :'Date', + :'date_time' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes[:'integer'] + self.integer = attributes[:'integer'] + end + if attributes[:'int32'] + self.int32 = attributes[:'int32'] + end + if attributes[:'int64'] + self.int64 = attributes[:'int64'] + end + if attributes[:'number'] + self.number = attributes[:'number'] + end + if attributes[:'float'] + self.float = attributes[:'float'] + end + if attributes[:'double'] + self.double = attributes[:'double'] + end + if attributes[:'string'] + self.string = attributes[:'string'] + end + if attributes[:'byte'] + self.byte = attributes[:'byte'] + end + if attributes[:'binary'] + self.binary = attributes[:'binary'] + end + if attributes[:'date'] + self.date = attributes[:'date'] + end + if attributes[:'dateTime'] + self.date_time = attributes[:'dateTime'] + end + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + integer == o.integer && + int32 == o.int32 && + int64 == o.int64 && + number == o.number && + float == o.float && + double == o.double && + string == o.string && + byte == o.byte && + binary == o.binary && + date == o.date && + date_time == o.date_time + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [integer, int32, int64, number, float, double, string, byte, binary, date, date_time].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /^Array<(.*)>/i + # check to ensure the input is an array given that the the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /^(true|t|yes|y|1)$/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = Petstore.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map{ |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/samples/client/petstore/ruby/spec/models/format_test_spec.rb b/samples/client/petstore/ruby/spec/models/format_test_spec.rb new file mode 100644 index 00000000000..e59d956fd37 --- /dev/null +++ b/samples/client/petstore/ruby/spec/models/format_test_spec.rb @@ -0,0 +1,150 @@ +=begin +Swagger Petstore + +This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +License: Apache 2.0 +http://www.apache.org/licenses/LICENSE-2.0.html + +Terms of Service: http://swagger.io/terms/ + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::FormatTest +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'FormatTest' do + before do + # run before each test + @instance = Petstore::FormatTest.new + end + + after do + # run after each test + end + + describe 'test an instance of FormatTest' do + it 'should create an instact of FormatTest' do + @instance.should be_a(Petstore::FormatTest) + end + end + describe 'test attribute "integer"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + + describe 'test attribute "int32"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + + describe 'test attribute "int64"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + + describe 'test attribute "number"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + + describe 'test attribute "float"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + + describe 'test attribute "double"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + + describe 'test attribute "string"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + + describe 'test attribute "byte"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + + describe 'test attribute "binary"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + + describe 'test attribute "date"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + + describe 'test attribute "date_time"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + +end + diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Animal.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Animal.swift new file mode 100644 index 00000000000..586b10f5931 --- /dev/null +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Animal.swift @@ -0,0 +1,23 @@ +// +// Animal.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + +public class Animal: JSONEncodable { + public var className: String? + + public init() {} + + // MARK: JSONEncodable + func encodeToJSON() -> AnyObject { + var nillableDictionary = [String:AnyObject?]() + nillableDictionary["className"] = self.className + let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:] + return dictionary + } +} diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Cat.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Cat.swift new file mode 100644 index 00000000000..bdf66b563d2 --- /dev/null +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Cat.swift @@ -0,0 +1,25 @@ +// +// Cat.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + +public class Cat: JSONEncodable { + public var className: String? + public var declawed: Bool? + + public init() {} + + // MARK: JSONEncodable + func encodeToJSON() -> AnyObject { + var nillableDictionary = [String:AnyObject?]() + nillableDictionary["className"] = self.className + nillableDictionary["declawed"] = self.declawed + let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:] + return dictionary + } +} diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Dog.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Dog.swift new file mode 100644 index 00000000000..8a1fafdfc67 --- /dev/null +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/Dog.swift @@ -0,0 +1,25 @@ +// +// Dog.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + +public class Dog: JSONEncodable { + public var className: String? + public var breed: String? + + public init() {} + + // MARK: JSONEncodable + func encodeToJSON() -> AnyObject { + var nillableDictionary = [String:AnyObject?]() + nillableDictionary["className"] = self.className + nillableDictionary["breed"] = self.breed + let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:] + return dictionary + } +} diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift new file mode 100644 index 00000000000..ee2547d3e89 --- /dev/null +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift @@ -0,0 +1,44 @@ +// +// FormatTest.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + +public class FormatTest: JSONEncodable { + public var integer: Int32? + public var _int32: Int32? + public var _int64: Int64? + public var number: Double? + public var _float: Float? + public var _double: Double? + public var _string: String? + public var byte: String? + public var binary: String? + public var date: NSDate? + public var dateTime: String? + + public init() {} + + // MARK: JSONEncodable + func encodeToJSON() -> AnyObject { + var nillableDictionary = [String:AnyObject?]() + nillableDictionary["integer"] = self.integer?.encodeToJSON() + nillableDictionary["int32"] = self._int32?.encodeToJSON() + nillableDictionary["int64"] = self._int64?.encodeToJSON() + nillableDictionary["int64"] = self._int64?.encodeToJSON() + nillableDictionary["number"] = self.number + nillableDictionary["float"] = self._float + nillableDictionary["double"] = self._double + nillableDictionary["string"] = self._string + nillableDictionary["byte"] = self.byte + nillableDictionary["binary"] = self.binary + nillableDictionary["date"] = self.date?.encodeToJSON() + nillableDictionary["dateTime"] = self.dateTime + let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:] + return dictionary + } +}