add new fles

This commit is contained in:
wing328 2016-04-16 18:19:23 +08:00
parent e62ba9b35d
commit 8e85476cbb
15 changed files with 689 additions and 0 deletions

View File

@ -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

View File

@ -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;
}
}
}

View File

@ -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;
}
}
}

View File

@ -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;

View File

@ -0,0 +1,119 @@
#include "SWGApiResponse.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
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 */

View File

@ -0,0 +1,48 @@
/*
* SWGApiResponse.h
*
*
*/
#ifndef SWGApiResponse_H_
#define SWGApiResponse_H_
#include <QJsonObject>
#include <QString>
#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_ */

View File

@ -0,0 +1,203 @@
#include "SamiApiResponse.h"
#include <FLocales.h>
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 */

View File

@ -0,0 +1,59 @@
/*
* SamiApiResponse.h
*
*
*/
#ifndef SamiApiResponse_H_
#define SamiApiResponse_H_
#include <FApp.h>
#include <FBase.h>
#include <FSystem.h>
#include <FWebJson.h>
#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_ */

View File

@ -0,0 +1,17 @@
<h2>ApiResponse</h2>
<ul class="parameter">
<li class="param-required-">code : Integer
<br/>
</li>
</ul>
<ul class="parameter">
<li class="param-required-">type : String
<br/>
</li>
</ul>
<ul class="parameter">
<li class="param-required-">message : String
<br/>
</li>
</ul>

View File

@ -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
{
/// <summary>
///
/// </summary>
public partial class ApiResponse : IEquatable<ApiResponse>
{
/// <summary>
/// Initializes a new instance of the <see cref="ApiResponse" /> class.
/// </summary>
/// <param name="Code">Code.</param>
/// <param name="Type">Type.</param>
/// <param name="Message">Message.</param>
public ApiResponse(int? Code = null, string Type = null, string Message = null)
{
this.Code = Code;
this.Type = Type;
this.Message = Message;
}
/// <summary>
/// Gets or Sets Code
/// </summary>
public int? Code { get; set; }
/// <summary>
/// Gets or Sets Type
/// </summary>
public string Type { get; set; }
/// <summary>
/// Gets or Sets Message
/// </summary>
public string Message { 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 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();
}
/// <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)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != GetType()) return false;
return Equals((ApiResponse)obj);
}
/// <summary>
/// Returns true if ApiResponse instances are equal
/// </summary>
/// <param name="other">Instance of ApiResponse to be compared</param>
/// <returns>Boolean</returns>
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)
);
}
/// <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.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
}
}

View File

@ -0,0 +1,9 @@
package com.wordnik.client.model
case class ApiResponse (
code: Option[Int],
type: Option[String],
message: Option[String]
)