diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/ApiResponse.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/ApiResponse.scala new file mode 100644 index 00000000000..31a9325c6f8 --- /dev/null +++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/ApiResponse.scala @@ -0,0 +1,19 @@ +/** + * NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program. + * https://github.com/swagger-api/swagger-codegen + * For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new + */ + +package io.swagger.client.model + +import io.swagger.client.core.ApiModel +import org.joda.time.DateTime + + +case class ApiResponse ( + code: Option[Int], + `type`: Option[String], + message: Option[String]) + extends ApiModel + + diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/ApiResponse.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/ApiResponse.as new file mode 100644 index 00000000000..6f038dcf55f --- /dev/null +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/ApiResponse.as @@ -0,0 +1,23 @@ +package io.swagger.client.model { + + + [XmlRootNode(name="ApiResponse")] + public class ApiResponse { + [XmlElement(name="code")] + public var code: Number = 0; + [XmlElement(name="type")] + public var type: String = null; + [XmlElement(name="message")] + public var message: String = null; + + public function toString(): String { + var str: String = "ApiResponse: "; + str += " (code: " + code + ")"; + str += " (type: " + type + ")"; + str += " (message: " + message + ")"; + return str; + } + +} + +} diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/ApiResponseList.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/ApiResponseList.as new file mode 100644 index 00000000000..64b315a162c --- /dev/null +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/ApiResponseList.as @@ -0,0 +1,17 @@ +package io.swagger.client.model { + +import io.swagger.common.ListWrapper; + + public class ApiResponseList implements ListWrapper { + // This declaration below of _ApiResponse_obj_class is to force flash compiler to include this class + private var _apiResponse_obj_class: io.swagger.client.model.ApiResponse = null; + [XmlElements(name="apiResponse", type="io.swagger.client.model.ApiResponse")] + public var apiResponse: Array = new Array(); + + public function getList(): Array{ + return apiResponse; + } + +} + +} diff --git a/samples/client/petstore/javascript-closure-angular/API/Client/ApiResponse.js b/samples/client/petstore/javascript-closure-angular/API/Client/ApiResponse.js new file mode 100644 index 00000000000..0ec7148bc9a --- /dev/null +++ b/samples/client/petstore/javascript-closure-angular/API/Client/ApiResponse.js @@ -0,0 +1,25 @@ +goog.provide('API.Client.ApiResponse'); + +/** + * @record + */ +API.Client.ApiResponse = function() {} + +/** + * @type {!number} + * @export + */ +API.Client.ApiResponse.prototype.code; + +/** + * @type {!string} + * @export + */ +API.Client.ApiResponse.prototype.type; + +/** + * @type {!string} + * @export + */ +API.Client.ApiResponse.prototype.message; + diff --git a/samples/client/petstore/qt5cpp/client/SWGApiResponse.cpp b/samples/client/petstore/qt5cpp/client/SWGApiResponse.cpp new file mode 100644 index 00000000000..3c813677bf1 --- /dev/null +++ b/samples/client/petstore/qt5cpp/client/SWGApiResponse.cpp @@ -0,0 +1,119 @@ + +#include "SWGApiResponse.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace Swagger { + + +SWGApiResponse::SWGApiResponse(QString* json) { + init(); + this->fromJson(*json); +} + +SWGApiResponse::SWGApiResponse() { + init(); +} + +SWGApiResponse::~SWGApiResponse() { + this->cleanup(); +} + +void +SWGApiResponse::init() { + code = 0; +type = new QString(""); +message = new QString(""); +} + +void +SWGApiResponse::cleanup() { + +if(type != NULL) { + delete type; + } +if(message != NULL) { + delete message; + } +} + +SWGApiResponse* +SWGApiResponse::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGApiResponse::fromJsonObject(QJsonObject &pJson) { + setValue(&code, pJson["code"], "qint32", ""); +setValue(&type, pJson["type"], "QString", "QString"); +setValue(&message, pJson["message"], "QString", "QString"); +} + +QString +SWGApiResponse::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + return QString(bytes); +} + +QJsonObject* +SWGApiResponse::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + obj->insert("code", QJsonValue(code)); + + + toJsonValue(QString("type"), type, obj, QString("QString")); + + + + + toJsonValue(QString("message"), message, obj, QString("QString")); + + + + return obj; +} + +qint32 +SWGApiResponse::getCode() { + return code; +} +void +SWGApiResponse::setCode(qint32 code) { + this->code = code; +} + +QString* +SWGApiResponse::getType() { + return type; +} +void +SWGApiResponse::setType(QString* type) { + this->type = type; +} + +QString* +SWGApiResponse::getMessage() { + return message; +} +void +SWGApiResponse::setMessage(QString* message) { + this->message = message; +} + + + +} /* namespace Swagger */ + diff --git a/samples/client/petstore/qt5cpp/client/SWGApiResponse.h b/samples/client/petstore/qt5cpp/client/SWGApiResponse.h new file mode 100644 index 00000000000..0b9b0c1acac --- /dev/null +++ b/samples/client/petstore/qt5cpp/client/SWGApiResponse.h @@ -0,0 +1,48 @@ +/* + * SWGApiResponse.h + * + * + */ + +#ifndef SWGApiResponse_H_ +#define SWGApiResponse_H_ + +#include + + +#include + +#include "SWGObject.h" + + +namespace Swagger { + +class SWGApiResponse: public SWGObject { +public: + SWGApiResponse(); + SWGApiResponse(QString* json); + virtual ~SWGApiResponse(); + void init(); + void cleanup(); + + QString asJson (); + QJsonObject* asJsonObject(); + void fromJsonObject(QJsonObject &json); + SWGApiResponse* fromJson(QString &jsonString); + + qint32 getCode(); + void setCode(qint32 code); +QString* getType(); + void setType(QString* type); +QString* getMessage(); + void setMessage(QString* message); + +private: + qint32 code; +QString* type; +QString* message; +}; + +} /* namespace Swagger */ + +#endif /* SWGApiResponse_H_ */ diff --git a/samples/client/petstore/tizen/client/SamiApiResponse.cpp b/samples/client/petstore/tizen/client/SamiApiResponse.cpp new file mode 100644 index 00000000000..9df400fff84 --- /dev/null +++ b/samples/client/petstore/tizen/client/SamiApiResponse.cpp @@ -0,0 +1,203 @@ + +#include "SamiApiResponse.h" +#include + +using namespace Tizen::Base; +using namespace Tizen::System; +using namespace Tizen::Base::Utility; +using namespace Tizen::Base::Collection; +using namespace Tizen::Web::Json; +using namespace Tizen::Locales; + + +namespace Swagger { + +SamiApiResponse::SamiApiResponse() { + init(); +} + +SamiApiResponse::~SamiApiResponse() { + this->cleanup(); +} + +void +SamiApiResponse::init() { + pCode = null; +pType = null; +pMessage = null; +} + +void +SamiApiResponse::cleanup() { + if(pCode != null) { + + delete pCode; + pCode = null; + } +if(pType != null) { + + delete pType; + pType = null; + } +if(pMessage != null) { + + delete pMessage; + pMessage = null; + } +} + + +SamiApiResponse* +SamiApiResponse::fromJson(String* json) { + this->cleanup(); + String str(json->GetPointer()); + int length = str.GetLength(); + + ByteBuffer buffer; + buffer.Construct(length); + + for (int i = 0; i < length; ++i) { + byte b = str[i]; + buffer.SetByte(b); + } + + IJsonValue* pJson = JsonParser::ParseN(buffer); + fromJsonObject(pJson); + if (pJson->GetType() == JSON_TYPE_OBJECT) { + JsonObject* pObject = static_cast< JsonObject* >(pJson); + pObject->RemoveAll(true); + } + else if (pJson->GetType() == JSON_TYPE_ARRAY) { + JsonArray* pArray = static_cast< JsonArray* >(pJson); + pArray->RemoveAll(true); + } + delete pJson; + return this; +} + + +void +SamiApiResponse::fromJsonObject(IJsonValue* pJson) { + JsonObject* pJsonObject = static_cast< JsonObject* >(pJson); + + if(pJsonObject != null) { + JsonString* pCodeKey = new JsonString(L"code"); + IJsonValue* pCodeVal = null; + pJsonObject->GetValue(pCodeKey, pCodeVal); + if(pCodeVal != null) { + + pCode = new Integer(); + jsonToValue(pCode, pCodeVal, L"Integer", L"Integer"); + } + delete pCodeKey; +JsonString* pTypeKey = new JsonString(L"type"); + IJsonValue* pTypeVal = null; + pJsonObject->GetValue(pTypeKey, pTypeVal); + if(pTypeVal != null) { + + pType = new String(); + jsonToValue(pType, pTypeVal, L"String", L"String"); + } + delete pTypeKey; +JsonString* pMessageKey = new JsonString(L"message"); + IJsonValue* pMessageVal = null; + pJsonObject->GetValue(pMessageKey, pMessageVal); + if(pMessageVal != null) { + + pMessage = new String(); + jsonToValue(pMessage, pMessageVal, L"String", L"String"); + } + delete pMessageKey; + } +} + +SamiApiResponse::SamiApiResponse(String* json) { + init(); + String str(json->GetPointer()); + int length = str.GetLength(); + + ByteBuffer buffer; + buffer.Construct(length); + + for (int i = 0; i < length; ++i) { + byte b = str[i]; + buffer.SetByte(b); + } + + IJsonValue* pJson = JsonParser::ParseN(buffer); + fromJsonObject(pJson); + if (pJson->GetType() == JSON_TYPE_OBJECT) { + JsonObject* pObject = static_cast< JsonObject* >(pJson); + pObject->RemoveAll(true); + } + else if (pJson->GetType() == JSON_TYPE_ARRAY) { + JsonArray* pArray = static_cast< JsonArray* >(pJson); + pArray->RemoveAll(true); + } + delete pJson; +} + +String +SamiApiResponse::asJson () +{ + JsonObject* pJsonObject = asJsonObject(); + + char *pComposeBuf = new char[256]; + JsonWriter::Compose(pJsonObject, pComposeBuf, 256); + String s = String(pComposeBuf); + + delete pComposeBuf; + pJsonObject->RemoveAll(true); + delete pJsonObject; + + return s; +} + +JsonObject* +SamiApiResponse::asJsonObject() { + JsonObject *pJsonObject = new JsonObject(); + pJsonObject->Construct(); + + JsonString *pCodeKey = new JsonString(L"code"); + pJsonObject->Add(pCodeKey, toJson(getPCode(), "Integer", "")); + + JsonString *pTypeKey = new JsonString(L"type"); + pJsonObject->Add(pTypeKey, toJson(getPType(), "String", "")); + + JsonString *pMessageKey = new JsonString(L"message"); + pJsonObject->Add(pMessageKey, toJson(getPMessage(), "String", "")); + + return pJsonObject; +} + +Integer* +SamiApiResponse::getPCode() { + return pCode; +} +void +SamiApiResponse::setPCode(Integer* pCode) { + this->pCode = pCode; +} + +String* +SamiApiResponse::getPType() { + return pType; +} +void +SamiApiResponse::setPType(String* pType) { + this->pType = pType; +} + +String* +SamiApiResponse::getPMessage() { + return pMessage; +} +void +SamiApiResponse::setPMessage(String* pMessage) { + this->pMessage = pMessage; +} + + + +} /* namespace Swagger */ + diff --git a/samples/client/petstore/tizen/client/SamiApiResponse.h b/samples/client/petstore/tizen/client/SamiApiResponse.h new file mode 100644 index 00000000000..96964cc59bb --- /dev/null +++ b/samples/client/petstore/tizen/client/SamiApiResponse.h @@ -0,0 +1,59 @@ +/* + * SamiApiResponse.h + * + * + */ + +#ifndef SamiApiResponse_H_ +#define SamiApiResponse_H_ + +#include +#include +#include +#include +#include "SamiHelpers.h" +#include "SamiObject.h" + +using namespace Tizen::Web::Json; + + +using Tizen::Base::Integer; +using Tizen::Base::String; + + +namespace Swagger { + +class SamiApiResponse: public SamiObject { +public: + SamiApiResponse(); + SamiApiResponse(String* json); + virtual ~SamiApiResponse(); + + void init(); + + void cleanup(); + + String asJson (); + + JsonObject* asJsonObject(); + + void fromJsonObject(IJsonValue* json); + + SamiApiResponse* fromJson(String* obj); + + Integer* getPCode(); + void setPCode(Integer* pCode); + String* getPType(); + void setPType(String* pType); + String* getPMessage(); + void setPMessage(String* pMessage); + +private: + Integer* pCode; +String* pType; +String* pMessage; +}; + +} /* namespace Swagger */ + +#endif /* SamiApiResponse_H_ */ diff --git a/samples/dynamic-html/docs/models/ApiResponse.html b/samples/dynamic-html/docs/models/ApiResponse.html new file mode 100644 index 00000000000..8e7d4fa4785 --- /dev/null +++ b/samples/dynamic-html/docs/models/ApiResponse.html @@ -0,0 +1,17 @@ + +

ApiResponse

+
    +
  • code : Integer +
    +
  • +
+
    +
  • type : String +
    +
  • +
+
    +
  • message : String +
    +
  • +
diff --git a/samples/server/petstore/aspnet5/src/IO.Swagger/Models/ApiResponse.cs b/samples/server/petstore/aspnet5/src/IO.Swagger/Models/ApiResponse.cs new file mode 100644 index 00000000000..886f22c21bf --- /dev/null +++ b/samples/server/petstore/aspnet5/src/IO.Swagger/Models/ApiResponse.cs @@ -0,0 +1,150 @@ +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; + +namespace IO.Swagger.Models +{ + /// + /// + /// + public partial class ApiResponse : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// Code. + /// Type. + /// Message. + public ApiResponse(int? Code = null, string Type = null, string Message = null) + { + this.Code = Code; + this.Type = Type; + this.Message = Message; + + } + + /// + /// Gets or Sets Code + /// + public int? Code { get; set; } + + /// + /// Gets or Sets Type + /// + public string Type { get; set; } + + /// + /// Gets or Sets Message + /// + public string Message { get; set; } + + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class ApiResponse {\n"); + sb.Append(" Code: ").Append(Code).Append("\n"); +sb.Append(" Type: ").Append(Type).Append("\n"); +sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != GetType()) return false; + return Equals((ApiResponse)obj); + } + + /// + /// Returns true if ApiResponse instances are equal + /// + /// Instance of ApiResponse to be compared + /// Boolean + public bool Equals(ApiResponse other) + { + + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + + return + ( + this.Code == other.Code || + this.Code != null && + this.Code.Equals(other.Code) + ) && + ( + this.Type == other.Type || + this.Type != null && + this.Type.Equals(other.Type) + ) && + ( + this.Message == other.Message || + this.Message != null && + this.Message.Equals(other.Message) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + 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.Code != null) + hash = hash * 59 + this.Code.GetHashCode(); + if (this.Type != null) + hash = hash * 59 + this.Type.GetHashCode(); + if (this.Message != null) + hash = hash * 59 + this.Message.GetHashCode(); + return hash; + } + } + + #region Operators + + public static bool operator ==(ApiResponse left, ApiResponse right) + { + return Equals(left, right); + } + + public static bool operator !=(ApiResponse left, ApiResponse right) + { + return !Equals(left, right); + } + + #endregion Operators + + } +} diff --git a/samples/server/petstore/flaskConnexion/__init__.py b/samples/server/petstore/flaskConnexion/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/server/petstore/flaskConnexion/controllers/__init__.py b/samples/server/petstore/flaskConnexion/controllers/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/server/petstore/flaskConnexion/controllers/init.py b/samples/server/petstore/flaskConnexion/controllers/init.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/server/petstore/flaskConnexion/init.py b/samples/server/petstore/flaskConnexion/init.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/ApiResponse.scala b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/ApiResponse.scala new file mode 100644 index 00000000000..9020d9e3d50 --- /dev/null +++ b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/ApiResponse.scala @@ -0,0 +1,9 @@ +package com.wordnik.client.model + + + +case class ApiResponse ( + code: Option[Int], +type: Option[String], +message: Option[String] +)