forked from loafle/openapi-generator-original
update qt5cpp and tizen sample
This commit is contained in:
parent
1d5a0e5b33
commit
e62ba9b35d
@ -27,17 +27,15 @@ SWGCategory::~SWGCategory() {
|
||||
void
|
||||
SWGCategory::init() {
|
||||
id = 0L;
|
||||
name = new QString("");
|
||||
|
||||
name = new QString("");
|
||||
}
|
||||
|
||||
void
|
||||
SWGCategory::cleanup() {
|
||||
|
||||
if(name != NULL) {
|
||||
if(name != NULL) {
|
||||
delete name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SWGCategory*
|
||||
@ -52,8 +50,7 @@ SWGCategory::fromJson(QString &json) {
|
||||
void
|
||||
SWGCategory::fromJsonObject(QJsonObject &pJson) {
|
||||
setValue(&id, pJson["id"], "qint64", "");
|
||||
setValue(&name, pJson["name"], "QString", "QString");
|
||||
|
||||
setValue(&name, pJson["name"], "QString", "QString");
|
||||
}
|
||||
|
||||
QString
|
||||
@ -76,8 +73,6 @@ SWGCategory::asJsonObject() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -32,14 +32,12 @@ public:
|
||||
|
||||
qint64 getId();
|
||||
void setId(qint64 id);
|
||||
QString* getName();
|
||||
QString* getName();
|
||||
void setName(QString* name);
|
||||
|
||||
|
||||
private:
|
||||
qint64 id;
|
||||
QString* name;
|
||||
|
||||
QString* name;
|
||||
};
|
||||
|
||||
} /* namespace Swagger */
|
||||
|
@ -2,28 +2,32 @@
|
||||
#define ModelFactory_H_
|
||||
|
||||
|
||||
#include "SWGUser.h"
|
||||
#include "SWGApiResponse.h"
|
||||
#include "SWGCategory.h"
|
||||
#include "SWGOrder.h"
|
||||
#include "SWGPet.h"
|
||||
#include "SWGTag.h"
|
||||
#include "SWGOrder.h"
|
||||
#include "SWGUser.h"
|
||||
|
||||
namespace Swagger {
|
||||
inline void* create(QString type) {
|
||||
if(QString("SWGUser").compare(type) == 0) {
|
||||
return new SWGUser();
|
||||
if(QString("SWGApiResponse").compare(type) == 0) {
|
||||
return new SWGApiResponse();
|
||||
}
|
||||
if(QString("SWGCategory").compare(type) == 0) {
|
||||
return new SWGCategory();
|
||||
}
|
||||
if(QString("SWGOrder").compare(type) == 0) {
|
||||
return new SWGOrder();
|
||||
}
|
||||
if(QString("SWGPet").compare(type) == 0) {
|
||||
return new SWGPet();
|
||||
}
|
||||
if(QString("SWGTag").compare(type) == 0) {
|
||||
return new SWGTag();
|
||||
}
|
||||
if(QString("SWGOrder").compare(type) == 0) {
|
||||
return new SWGOrder();
|
||||
if(QString("SWGUser").compare(type) == 0) {
|
||||
return new SWGUser();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -27,12 +27,11 @@ SWGOrder::~SWGOrder() {
|
||||
void
|
||||
SWGOrder::init() {
|
||||
id = 0L;
|
||||
petId = 0L;
|
||||
quantity = 0;
|
||||
shipDate = NULL;
|
||||
status = new QString("");
|
||||
complete = false;
|
||||
|
||||
petId = 0L;
|
||||
quantity = 0;
|
||||
shipDate = NULL;
|
||||
status = new QString("");
|
||||
complete = false;
|
||||
}
|
||||
|
||||
void
|
||||
@ -40,14 +39,13 @@ SWGOrder::cleanup() {
|
||||
|
||||
|
||||
|
||||
if(shipDate != NULL) {
|
||||
if(shipDate != NULL) {
|
||||
delete shipDate;
|
||||
}
|
||||
if(status != NULL) {
|
||||
if(status != NULL) {
|
||||
delete status;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
SWGOrder*
|
||||
@ -62,12 +60,11 @@ SWGOrder::fromJson(QString &json) {
|
||||
void
|
||||
SWGOrder::fromJsonObject(QJsonObject &pJson) {
|
||||
setValue(&id, pJson["id"], "qint64", "");
|
||||
setValue(&petId, pJson["petId"], "qint64", "");
|
||||
setValue(&quantity, pJson["quantity"], "qint32", "");
|
||||
setValue(&shipDate, pJson["shipDate"], "QDateTime", "QDateTime");
|
||||
setValue(&status, pJson["status"], "QString", "QString");
|
||||
setValue(&complete, pJson["complete"], "bool", "");
|
||||
|
||||
setValue(&petId, pJson["petId"], "qint64", "");
|
||||
setValue(&quantity, pJson["quantity"], "qint32", "");
|
||||
setValue(&shipDate, pJson["shipDate"], "QDateTime", "QDateTime");
|
||||
setValue(&status, pJson["status"], "QString", "QString");
|
||||
setValue(&complete, pJson["complete"], "bool", "");
|
||||
}
|
||||
|
||||
QString
|
||||
@ -84,8 +81,8 @@ QJsonObject*
|
||||
SWGOrder::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
obj->insert("id", QJsonValue(id));
|
||||
obj->insert("petId", QJsonValue(petId));
|
||||
obj->insert("quantity", QJsonValue(quantity));
|
||||
obj->insert("petId", QJsonValue(petId));
|
||||
obj->insert("quantity", QJsonValue(quantity));
|
||||
|
||||
|
||||
toJsonValue(QString("shipDate"), shipDate, obj, QString("QDateTime"));
|
||||
@ -93,13 +90,10 @@ SWGOrder::asJsonObject() {
|
||||
|
||||
|
||||
|
||||
|
||||
toJsonValue(QString("status"), status, obj, QString("QString"));
|
||||
|
||||
|
||||
|
||||
obj->insert("complete", QJsonValue(complete));
|
||||
|
||||
obj->insert("complete", QJsonValue(complete));
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
@ -33,26 +33,24 @@ public:
|
||||
|
||||
qint64 getId();
|
||||
void setId(qint64 id);
|
||||
qint64 getPetId();
|
||||
qint64 getPetId();
|
||||
void setPetId(qint64 petId);
|
||||
qint32 getQuantity();
|
||||
qint32 getQuantity();
|
||||
void setQuantity(qint32 quantity);
|
||||
QDateTime* getShipDate();
|
||||
QDateTime* getShipDate();
|
||||
void setShipDate(QDateTime* shipDate);
|
||||
QString* getStatus();
|
||||
QString* getStatus();
|
||||
void setStatus(QString* status);
|
||||
bool getComplete();
|
||||
bool getComplete();
|
||||
void setComplete(bool complete);
|
||||
|
||||
|
||||
private:
|
||||
qint64 id;
|
||||
qint64 petId;
|
||||
qint32 quantity;
|
||||
QDateTime* shipDate;
|
||||
QString* status;
|
||||
bool complete;
|
||||
|
||||
qint64 petId;
|
||||
qint32 quantity;
|
||||
QDateTime* shipDate;
|
||||
QString* status;
|
||||
bool complete;
|
||||
};
|
||||
|
||||
} /* namespace Swagger */
|
||||
|
@ -27,41 +27,39 @@ SWGPet::~SWGPet() {
|
||||
void
|
||||
SWGPet::init() {
|
||||
id = 0L;
|
||||
category = new SWGCategory();
|
||||
name = new QString("");
|
||||
photoUrls = new QList<QString*>();
|
||||
tags = new QList<SWGTag*>();
|
||||
status = new QString("");
|
||||
|
||||
category = new SWGCategory();
|
||||
name = new QString("");
|
||||
photoUrls = new QList<QString*>();
|
||||
tags = new QList<SWGTag*>();
|
||||
status = new QString("");
|
||||
}
|
||||
|
||||
void
|
||||
SWGPet::cleanup() {
|
||||
|
||||
if(category != NULL) {
|
||||
if(category != NULL) {
|
||||
delete category;
|
||||
}
|
||||
if(name != NULL) {
|
||||
if(name != NULL) {
|
||||
delete name;
|
||||
}
|
||||
if(photoUrls != NULL) {
|
||||
if(photoUrls != NULL) {
|
||||
QList<QString*>* arr = photoUrls;
|
||||
foreach(QString* o, *arr) {
|
||||
delete o;
|
||||
}
|
||||
delete photoUrls;
|
||||
}
|
||||
if(tags != NULL) {
|
||||
if(tags != NULL) {
|
||||
QList<SWGTag*>* arr = tags;
|
||||
foreach(SWGTag* o, *arr) {
|
||||
delete o;
|
||||
}
|
||||
delete tags;
|
||||
}
|
||||
if(status != NULL) {
|
||||
if(status != NULL) {
|
||||
delete status;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SWGPet*
|
||||
@ -76,12 +74,11 @@ SWGPet::fromJson(QString &json) {
|
||||
void
|
||||
SWGPet::fromJsonObject(QJsonObject &pJson) {
|
||||
setValue(&id, pJson["id"], "qint64", "");
|
||||
setValue(&category, pJson["category"], "SWGCategory", "SWGCategory");
|
||||
setValue(&name, pJson["name"], "QString", "QString");
|
||||
setValue(&photoUrls, pJson["photoUrls"], "QList", "QString");
|
||||
setValue(&tags, pJson["tags"], "QList", "SWGTag");
|
||||
setValue(&status, pJson["status"], "QString", "QString");
|
||||
|
||||
setValue(&category, pJson["category"], "SWGCategory", "SWGCategory");
|
||||
setValue(&name, pJson["name"], "QString", "QString");
|
||||
setValue(&photoUrls, pJson["photoUrls"], "QList", "QString");
|
||||
setValue(&tags, pJson["tags"], "QList", "SWGTag");
|
||||
setValue(&status, pJson["status"], "QString", "QString");
|
||||
}
|
||||
|
||||
QString
|
||||
@ -105,13 +102,11 @@ SWGPet::asJsonObject() {
|
||||
|
||||
|
||||
|
||||
|
||||
toJsonValue(QString("name"), name, obj, QString("QString"));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QList<QString*>* photoUrlsList = photoUrls;
|
||||
QJsonArray photoUrlsJsonArray;
|
||||
toJsonArray((QList<void*>*)photoUrls, &photoUrlsJsonArray, "photoUrls", "QString");
|
||||
@ -120,7 +115,6 @@ SWGPet::asJsonObject() {
|
||||
|
||||
|
||||
|
||||
|
||||
QList<SWGTag*>* tagsList = tags;
|
||||
QJsonArray tagsJsonArray;
|
||||
toJsonArray((QList<void*>*)tags, &tagsJsonArray, "tags", "SWGTag");
|
||||
@ -129,13 +123,10 @@ SWGPet::asJsonObject() {
|
||||
|
||||
|
||||
|
||||
|
||||
toJsonValue(QString("status"), status, obj, QString("QString"));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -35,26 +35,24 @@ public:
|
||||
|
||||
qint64 getId();
|
||||
void setId(qint64 id);
|
||||
SWGCategory* getCategory();
|
||||
SWGCategory* getCategory();
|
||||
void setCategory(SWGCategory* category);
|
||||
QString* getName();
|
||||
QString* getName();
|
||||
void setName(QString* name);
|
||||
QList<QString*>* getPhotoUrls();
|
||||
QList<QString*>* getPhotoUrls();
|
||||
void setPhotoUrls(QList<QString*>* photoUrls);
|
||||
QList<SWGTag*>* getTags();
|
||||
QList<SWGTag*>* getTags();
|
||||
void setTags(QList<SWGTag*>* tags);
|
||||
QString* getStatus();
|
||||
QString* getStatus();
|
||||
void setStatus(QString* status);
|
||||
|
||||
|
||||
private:
|
||||
qint64 id;
|
||||
SWGCategory* category;
|
||||
QString* name;
|
||||
QList<QString*>* photoUrls;
|
||||
QList<SWGTag*>* tags;
|
||||
QString* status;
|
||||
|
||||
SWGCategory* category;
|
||||
QString* name;
|
||||
QList<QString*>* photoUrls;
|
||||
QList<SWGTag*>* tags;
|
||||
QString* status;
|
||||
};
|
||||
|
||||
} /* namespace Swagger */
|
||||
|
@ -15,54 +15,6 @@ SWGPetApi::SWGPetApi(QString host, QString basePath) {
|
||||
this->basePath = basePath;
|
||||
}
|
||||
|
||||
void
|
||||
SWGPetApi::updatePet(SWGPet body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/pet");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "PUT");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QString output = body.asJson();
|
||||
input.request_body.append(output);
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGPetApi::updatePetCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGPetApi::updatePetCallback(HttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
|
||||
emit updatePetSignal();
|
||||
}
|
||||
void
|
||||
SWGPetApi::addPet(SWGPet body) {
|
||||
QString fullPath;
|
||||
@ -70,22 +22,15 @@ SWGPetApi::addPet(SWGPet body) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "POST");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QString output = body.asJson();
|
||||
input.request_body.append(output);
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
@ -112,6 +57,48 @@ SWGPetApi::addPetCallback(HttpRequestWorker * worker) {
|
||||
emit addPetSignal();
|
||||
}
|
||||
void
|
||||
SWGPetApi::deletePet(qint64 petId, QString* apiKey) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/pet/{petId}");
|
||||
|
||||
QString petIdPathParam("{"); petIdPathParam.append("petId").append("}");
|
||||
fullPath.replace(petIdPathParam, stringValue(petId));
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "DELETE");
|
||||
|
||||
|
||||
|
||||
|
||||
// TODO: add header support
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGPetApi::deletePetCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGPetApi::deletePetCallback(HttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
|
||||
emit deletePetSignal();
|
||||
}
|
||||
void
|
||||
SWGPetApi::findPetsByStatus(QList<QString*>* status) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/pet/findByStatus");
|
||||
@ -119,12 +106,8 @@ SWGPetApi::findPetsByStatus(QList<QString*>* status) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (status->size() > 0) {
|
||||
if (QString("multi").indexOf("multi") == 0) {
|
||||
if (QString("csv").indexOf("multi") == 0) {
|
||||
foreach(QString* t, *status) {
|
||||
if (fullPath.indexOf("?") > 0)
|
||||
fullPath.append("&");
|
||||
@ -133,7 +116,7 @@ SWGPetApi::findPetsByStatus(QList<QString*>* status) {
|
||||
fullPath.append("status=").append(stringValue(t));
|
||||
}
|
||||
}
|
||||
else if (QString("multi").indexOf("ssv") == 0) {
|
||||
else if (QString("csv").indexOf("ssv") == 0) {
|
||||
if (fullPath.indexOf("?") > 0)
|
||||
fullPath.append("&");
|
||||
else
|
||||
@ -147,7 +130,7 @@ SWGPetApi::findPetsByStatus(QList<QString*>* status) {
|
||||
fullPath.append(stringValue(t));
|
||||
}
|
||||
}
|
||||
else if (QString("multi").indexOf("tsv") == 0) {
|
||||
else if (QString("csv").indexOf("tsv") == 0) {
|
||||
if (fullPath.indexOf("?") > 0)
|
||||
fullPath.append("&");
|
||||
else
|
||||
@ -164,8 +147,6 @@ SWGPetApi::findPetsByStatus(QList<QString*>* status) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "GET");
|
||||
|
||||
@ -173,8 +154,6 @@ SWGPetApi::findPetsByStatus(QList<QString*>* status) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
@ -210,7 +189,6 @@ SWGPetApi::findPetsByStatusCallback(HttpRequestWorker * worker) {
|
||||
|
||||
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit findPetsByStatusSignal(output);
|
||||
@ -224,12 +202,8 @@ SWGPetApi::findPetsByTags(QList<QString*>* tags) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (tags->size() > 0) {
|
||||
if (QString("multi").indexOf("multi") == 0) {
|
||||
if (QString("csv").indexOf("multi") == 0) {
|
||||
foreach(QString* t, *tags) {
|
||||
if (fullPath.indexOf("?") > 0)
|
||||
fullPath.append("&");
|
||||
@ -238,7 +212,7 @@ SWGPetApi::findPetsByTags(QList<QString*>* tags) {
|
||||
fullPath.append("tags=").append(stringValue(t));
|
||||
}
|
||||
}
|
||||
else if (QString("multi").indexOf("ssv") == 0) {
|
||||
else if (QString("csv").indexOf("ssv") == 0) {
|
||||
if (fullPath.indexOf("?") > 0)
|
||||
fullPath.append("&");
|
||||
else
|
||||
@ -252,7 +226,7 @@ SWGPetApi::findPetsByTags(QList<QString*>* tags) {
|
||||
fullPath.append(stringValue(t));
|
||||
}
|
||||
}
|
||||
else if (QString("multi").indexOf("tsv") == 0) {
|
||||
else if (QString("csv").indexOf("tsv") == 0) {
|
||||
if (fullPath.indexOf("?") > 0)
|
||||
fullPath.append("&");
|
||||
else
|
||||
@ -269,8 +243,6 @@ SWGPetApi::findPetsByTags(QList<QString*>* tags) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "GET");
|
||||
|
||||
@ -278,8 +250,6 @@ SWGPetApi::findPetsByTags(QList<QString*>* tags) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
@ -315,7 +285,6 @@ SWGPetApi::findPetsByTagsCallback(HttpRequestWorker * worker) {
|
||||
|
||||
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit findPetsByTagsSignal(output);
|
||||
@ -326,13 +295,10 @@ SWGPetApi::getPetById(qint64 petId) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/pet/{petId}");
|
||||
|
||||
|
||||
QString petIdPathParam("{"); petIdPathParam.append("petId").append("}");
|
||||
fullPath.replace(petIdPathParam, stringValue(petId));
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "GET");
|
||||
|
||||
@ -340,8 +306,6 @@ SWGPetApi::getPetById(qint64 petId) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
@ -361,48 +325,78 @@ SWGPetApi::getPetByIdCallback(HttpRequestWorker * worker) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGPet* output = static_cast<SWGPet*>(create(json, QString("SWGPet")));
|
||||
|
||||
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit getPetByIdSignal(output);
|
||||
|
||||
}
|
||||
void
|
||||
SWGPetApi::updatePetWithForm(QString* petId, QString* name, QString* status) {
|
||||
SWGPetApi::updatePet(SWGPet body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/pet");
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "PUT");
|
||||
|
||||
|
||||
QString output = body.asJson();
|
||||
input.request_body.append(output);
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGPetApi::updatePetCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGPetApi::updatePetCallback(HttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
|
||||
emit updatePetSignal();
|
||||
}
|
||||
void
|
||||
SWGPetApi::updatePetWithForm(qint64 petId, QString* name, QString* status) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/pet/{petId}");
|
||||
|
||||
|
||||
QString petIdPathParam("{"); petIdPathParam.append("petId").append("}");
|
||||
fullPath.replace(petIdPathParam, stringValue(petId));
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "POST");
|
||||
|
||||
if (name != NULL) {
|
||||
input.add_var("name", *name);
|
||||
}
|
||||
if (status != NULL) {
|
||||
if (status != NULL) {
|
||||
input.add_var("status", *status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
@ -429,80 +423,27 @@ SWGPetApi::updatePetWithFormCallback(HttpRequestWorker * worker) {
|
||||
emit updatePetWithFormSignal();
|
||||
}
|
||||
void
|
||||
SWGPetApi::deletePet(qint64 petId, QString* apiKey) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/pet/{petId}");
|
||||
|
||||
|
||||
QString petIdPathParam("{"); petIdPathParam.append("petId").append("}");
|
||||
fullPath.replace(petIdPathParam, stringValue(petId));
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "DELETE");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// TODO: add header support
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGPetApi::deletePetCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGPetApi::deletePetCallback(HttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
|
||||
emit deletePetSignal();
|
||||
}
|
||||
void
|
||||
SWGPetApi::uploadFile(qint64 petId, QString* additionalMetadata, SWGHttpRequestInputFileElement* file) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/pet/{petId}/uploadImage");
|
||||
|
||||
|
||||
QString petIdPathParam("{"); petIdPathParam.append("petId").append("}");
|
||||
fullPath.replace(petIdPathParam, stringValue(petId));
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "POST");
|
||||
|
||||
if (additionalMetadata != NULL) {
|
||||
input.add_var("additionalMetadata", *additionalMetadata);
|
||||
}
|
||||
if (file != NULL) {
|
||||
if (file != NULL) {
|
||||
input.add_file("file", *file.local_filename, *file.request_filename, *file.mime_type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
@ -522,113 +463,13 @@ SWGPetApi::uploadFileCallback(HttpRequestWorker * worker) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
|
||||
emit uploadFileSignal();
|
||||
}
|
||||
void
|
||||
SWGPetApi::getPetByIdWithByteArray(qint64 petId) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/pet/{petId}?testing_byte_array=true");
|
||||
|
||||
|
||||
QString petIdPathParam("{"); petIdPathParam.append("petId").append("}");
|
||||
fullPath.replace(petIdPathParam, stringValue(petId));
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "GET");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGPetApi::getPetByIdWithByteArrayCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGPetApi::getPetByIdWithByteArrayCallback(HttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
QString* output = static_cast<QString*>(create(json, QString("QString")));
|
||||
|
||||
|
||||
SWGApiResponse* output = static_cast<SWGApiResponse*>(create(json, QString("SWGApiResponse")));
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit getPetByIdWithByteArraySignal(output);
|
||||
emit uploadFileSignal(output);
|
||||
|
||||
}
|
||||
void
|
||||
SWGPetApi::addPetUsingByteArray(QString* body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/pet?testing_byte_array=true");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "POST");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QString output = body.asJson();
|
||||
input.request_body.append(output);
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGPetApi::addPetUsingByteArrayCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGPetApi::addPetUsingByteArrayCallback(HttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
|
||||
emit addPetUsingByteArraySignal();
|
||||
}
|
||||
} /* namespace Swagger */
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "SWGPet.h"
|
||||
#include <QString>
|
||||
#include "SWGApiResponse.h"
|
||||
#include "SWGHttpRequest.h"
|
||||
|
||||
#include <QObject>
|
||||
@ -22,40 +23,34 @@ public:
|
||||
QString host;
|
||||
QString basePath;
|
||||
|
||||
void updatePet(SWGPet body);
|
||||
void addPet(SWGPet body);
|
||||
void deletePet(qint64 petId, QString* apiKey);
|
||||
void findPetsByStatus(QList<QString*>* status);
|
||||
void findPetsByTags(QList<QString*>* tags);
|
||||
void getPetById(qint64 petId);
|
||||
void updatePetWithForm(QString* petId, QString* name, QString* status);
|
||||
void deletePet(qint64 petId, QString* apiKey);
|
||||
void updatePet(SWGPet body);
|
||||
void updatePetWithForm(qint64 petId, QString* name, QString* status);
|
||||
void uploadFile(qint64 petId, QString* additionalMetadata, SWGHttpRequestInputFileElement* file);
|
||||
void getPetByIdWithByteArray(qint64 petId);
|
||||
void addPetUsingByteArray(QString* body);
|
||||
|
||||
private:
|
||||
void updatePetCallback (HttpRequestWorker * worker);
|
||||
void addPetCallback (HttpRequestWorker * worker);
|
||||
void deletePetCallback (HttpRequestWorker * worker);
|
||||
void findPetsByStatusCallback (HttpRequestWorker * worker);
|
||||
void findPetsByTagsCallback (HttpRequestWorker * worker);
|
||||
void getPetByIdCallback (HttpRequestWorker * worker);
|
||||
void updatePetCallback (HttpRequestWorker * worker);
|
||||
void updatePetWithFormCallback (HttpRequestWorker * worker);
|
||||
void deletePetCallback (HttpRequestWorker * worker);
|
||||
void uploadFileCallback (HttpRequestWorker * worker);
|
||||
void getPetByIdWithByteArrayCallback (HttpRequestWorker * worker);
|
||||
void addPetUsingByteArrayCallback (HttpRequestWorker * worker);
|
||||
|
||||
signals:
|
||||
void updatePetSignal();
|
||||
void addPetSignal();
|
||||
void deletePetSignal();
|
||||
void findPetsByStatusSignal(QList<SWGPet*>* summary);
|
||||
void findPetsByTagsSignal(QList<SWGPet*>* summary);
|
||||
void getPetByIdSignal(SWGPet* summary);
|
||||
void updatePetSignal();
|
||||
void updatePetWithFormSignal();
|
||||
void deletePetSignal();
|
||||
void uploadFileSignal();
|
||||
void getPetByIdWithByteArraySignal(QString* summary);
|
||||
void addPetUsingByteArraySignal();
|
||||
void uploadFileSignal(SWGApiResponse* summary);
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -15,193 +15,15 @@ SWGStoreApi::SWGStoreApi(QString host, QString basePath) {
|
||||
this->basePath = basePath;
|
||||
}
|
||||
|
||||
void
|
||||
SWGStoreApi::getInventory() {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/store/inventory");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "GET");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGStoreApi::getInventoryCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGStoreApi::getInventoryCallback(HttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QMap<QString, qint32>* output = new QMap<QString, qint32>();
|
||||
|
||||
QString json(worker->response);
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject obj = doc.object();
|
||||
|
||||
foreach(QString key, obj.keys()) {
|
||||
qint32* val;
|
||||
setValue(&val, obj[key], "QMap", "");
|
||||
output->insert(key, *val);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit getInventorySignal(output);
|
||||
|
||||
}
|
||||
void
|
||||
SWGStoreApi::placeOrder(SWGOrder body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/store/order");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "POST");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QString output = body.asJson();
|
||||
input.request_body.append(output);
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGStoreApi::placeOrderCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGStoreApi::placeOrderCallback(HttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGOrder* output = static_cast<SWGOrder*>(create(json, QString("SWGOrder")));
|
||||
|
||||
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit placeOrderSignal(output);
|
||||
|
||||
}
|
||||
void
|
||||
SWGStoreApi::getOrderById(QString* orderId) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/store/order/{orderId}");
|
||||
|
||||
|
||||
QString orderIdPathParam("{"); orderIdPathParam.append("orderId").append("}");
|
||||
fullPath.replace(orderIdPathParam, stringValue(orderId));
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "GET");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGStoreApi::getOrderByIdCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGStoreApi::getOrderByIdCallback(HttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGOrder* output = static_cast<SWGOrder*>(create(json, QString("SWGOrder")));
|
||||
|
||||
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit getOrderByIdSignal(output);
|
||||
|
||||
}
|
||||
void
|
||||
SWGStoreApi::deleteOrder(QString* orderId) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/store/order/{orderId}");
|
||||
|
||||
|
||||
QString orderIdPathParam("{"); orderIdPathParam.append("orderId").append("}");
|
||||
fullPath.replace(orderIdPathParam, stringValue(orderId));
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "DELETE");
|
||||
|
||||
@ -209,8 +31,6 @@ SWGStoreApi::deleteOrder(QString* orderId) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
@ -236,4 +56,146 @@ SWGStoreApi::deleteOrderCallback(HttpRequestWorker * worker) {
|
||||
|
||||
emit deleteOrderSignal();
|
||||
}
|
||||
void
|
||||
SWGStoreApi::getInventory() {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/store/inventory");
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "GET");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGStoreApi::getInventoryCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGStoreApi::getInventoryCallback(HttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, qint32>* output = new QMap<QString, qint32>();
|
||||
|
||||
QString json(worker->response);
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject obj = doc.object();
|
||||
|
||||
foreach(QString key, obj.keys()) {
|
||||
qint32* val;
|
||||
setValue(&val, obj[key], "QMap", "");
|
||||
output->insert(key, *val);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit getInventorySignal(output);
|
||||
|
||||
}
|
||||
void
|
||||
SWGStoreApi::getOrderById(qint64 orderId) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/store/order/{orderId}");
|
||||
|
||||
QString orderIdPathParam("{"); orderIdPathParam.append("orderId").append("}");
|
||||
fullPath.replace(orderIdPathParam, stringValue(orderId));
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "GET");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGStoreApi::getOrderByIdCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGStoreApi::getOrderByIdCallback(HttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGOrder* output = static_cast<SWGOrder*>(create(json, QString("SWGOrder")));
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit getOrderByIdSignal(output);
|
||||
|
||||
}
|
||||
void
|
||||
SWGStoreApi::placeOrder(SWGOrder body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/store/order");
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "POST");
|
||||
|
||||
|
||||
QString output = body.asJson();
|
||||
input.request_body.append(output);
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGStoreApi::placeOrderCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGStoreApi::placeOrderCallback(HttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGOrder* output = static_cast<SWGOrder*>(create(json, QString("SWGOrder")));
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit placeOrderSignal(output);
|
||||
|
||||
}
|
||||
} /* namespace Swagger */
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
#include "SWGHttpRequest.h"
|
||||
|
||||
#include <QString>
|
||||
#include "QMap.h"
|
||||
#include "SWGOrder.h"
|
||||
#include <QString>
|
||||
|
||||
#include <QObject>
|
||||
|
||||
@ -22,22 +22,22 @@ public:
|
||||
QString host;
|
||||
QString basePath;
|
||||
|
||||
void getInventory();
|
||||
void placeOrder(SWGOrder body);
|
||||
void getOrderById(QString* orderId);
|
||||
void deleteOrder(QString* orderId);
|
||||
void getInventory();
|
||||
void getOrderById(qint64 orderId);
|
||||
void placeOrder(SWGOrder body);
|
||||
|
||||
private:
|
||||
void getInventoryCallback (HttpRequestWorker * worker);
|
||||
void placeOrderCallback (HttpRequestWorker * worker);
|
||||
void getOrderByIdCallback (HttpRequestWorker * worker);
|
||||
void deleteOrderCallback (HttpRequestWorker * worker);
|
||||
void getInventoryCallback (HttpRequestWorker * worker);
|
||||
void getOrderByIdCallback (HttpRequestWorker * worker);
|
||||
void placeOrderCallback (HttpRequestWorker * worker);
|
||||
|
||||
signals:
|
||||
void getInventorySignal(QMap<QString, qint32>* summary);
|
||||
void placeOrderSignal(SWGOrder* summary);
|
||||
void getOrderByIdSignal(SWGOrder* summary);
|
||||
void deleteOrderSignal();
|
||||
void getInventorySignal(QMap<QString, qint32>* summary);
|
||||
void getOrderByIdSignal(SWGOrder* summary);
|
||||
void placeOrderSignal(SWGOrder* summary);
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -27,17 +27,15 @@ SWGTag::~SWGTag() {
|
||||
void
|
||||
SWGTag::init() {
|
||||
id = 0L;
|
||||
name = new QString("");
|
||||
|
||||
name = new QString("");
|
||||
}
|
||||
|
||||
void
|
||||
SWGTag::cleanup() {
|
||||
|
||||
if(name != NULL) {
|
||||
if(name != NULL) {
|
||||
delete name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SWGTag*
|
||||
@ -52,8 +50,7 @@ SWGTag::fromJson(QString &json) {
|
||||
void
|
||||
SWGTag::fromJsonObject(QJsonObject &pJson) {
|
||||
setValue(&id, pJson["id"], "qint64", "");
|
||||
setValue(&name, pJson["name"], "QString", "QString");
|
||||
|
||||
setValue(&name, pJson["name"], "QString", "QString");
|
||||
}
|
||||
|
||||
QString
|
||||
@ -76,8 +73,6 @@ SWGTag::asJsonObject() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -32,14 +32,12 @@ public:
|
||||
|
||||
qint64 getId();
|
||||
void setId(qint64 id);
|
||||
QString* getName();
|
||||
QString* getName();
|
||||
void setName(QString* name);
|
||||
|
||||
|
||||
private:
|
||||
qint64 id;
|
||||
QString* name;
|
||||
|
||||
QString* name;
|
||||
};
|
||||
|
||||
} /* namespace Swagger */
|
||||
|
@ -27,39 +27,37 @@ SWGUser::~SWGUser() {
|
||||
void
|
||||
SWGUser::init() {
|
||||
id = 0L;
|
||||
username = new QString("");
|
||||
firstName = new QString("");
|
||||
lastName = new QString("");
|
||||
email = new QString("");
|
||||
password = new QString("");
|
||||
phone = new QString("");
|
||||
userStatus = 0;
|
||||
|
||||
username = new QString("");
|
||||
firstName = new QString("");
|
||||
lastName = new QString("");
|
||||
email = new QString("");
|
||||
password = new QString("");
|
||||
phone = new QString("");
|
||||
userStatus = 0;
|
||||
}
|
||||
|
||||
void
|
||||
SWGUser::cleanup() {
|
||||
|
||||
if(username != NULL) {
|
||||
if(username != NULL) {
|
||||
delete username;
|
||||
}
|
||||
if(firstName != NULL) {
|
||||
if(firstName != NULL) {
|
||||
delete firstName;
|
||||
}
|
||||
if(lastName != NULL) {
|
||||
if(lastName != NULL) {
|
||||
delete lastName;
|
||||
}
|
||||
if(email != NULL) {
|
||||
if(email != NULL) {
|
||||
delete email;
|
||||
}
|
||||
if(password != NULL) {
|
||||
if(password != NULL) {
|
||||
delete password;
|
||||
}
|
||||
if(phone != NULL) {
|
||||
if(phone != NULL) {
|
||||
delete phone;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
SWGUser*
|
||||
@ -74,14 +72,13 @@ SWGUser::fromJson(QString &json) {
|
||||
void
|
||||
SWGUser::fromJsonObject(QJsonObject &pJson) {
|
||||
setValue(&id, pJson["id"], "qint64", "");
|
||||
setValue(&username, pJson["username"], "QString", "QString");
|
||||
setValue(&firstName, pJson["firstName"], "QString", "QString");
|
||||
setValue(&lastName, pJson["lastName"], "QString", "QString");
|
||||
setValue(&email, pJson["email"], "QString", "QString");
|
||||
setValue(&password, pJson["password"], "QString", "QString");
|
||||
setValue(&phone, pJson["phone"], "QString", "QString");
|
||||
setValue(&userStatus, pJson["userStatus"], "qint32", "");
|
||||
|
||||
setValue(&username, pJson["username"], "QString", "QString");
|
||||
setValue(&firstName, pJson["firstName"], "QString", "QString");
|
||||
setValue(&lastName, pJson["lastName"], "QString", "QString");
|
||||
setValue(&email, pJson["email"], "QString", "QString");
|
||||
setValue(&password, pJson["password"], "QString", "QString");
|
||||
setValue(&phone, pJson["phone"], "QString", "QString");
|
||||
setValue(&userStatus, pJson["userStatus"], "qint32", "");
|
||||
}
|
||||
|
||||
QString
|
||||
@ -105,37 +102,30 @@ SWGUser::asJsonObject() {
|
||||
|
||||
|
||||
|
||||
|
||||
toJsonValue(QString("firstName"), firstName, obj, QString("QString"));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
toJsonValue(QString("lastName"), lastName, obj, QString("QString"));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
toJsonValue(QString("email"), email, obj, QString("QString"));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
toJsonValue(QString("password"), password, obj, QString("QString"));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
toJsonValue(QString("phone"), phone, obj, QString("QString"));
|
||||
|
||||
|
||||
|
||||
obj->insert("userStatus", QJsonValue(userStatus));
|
||||
|
||||
obj->insert("userStatus", QJsonValue(userStatus));
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
@ -32,32 +32,30 @@ public:
|
||||
|
||||
qint64 getId();
|
||||
void setId(qint64 id);
|
||||
QString* getUsername();
|
||||
QString* getUsername();
|
||||
void setUsername(QString* username);
|
||||
QString* getFirstName();
|
||||
QString* getFirstName();
|
||||
void setFirstName(QString* firstName);
|
||||
QString* getLastName();
|
||||
QString* getLastName();
|
||||
void setLastName(QString* lastName);
|
||||
QString* getEmail();
|
||||
QString* getEmail();
|
||||
void setEmail(QString* email);
|
||||
QString* getPassword();
|
||||
QString* getPassword();
|
||||
void setPassword(QString* password);
|
||||
QString* getPhone();
|
||||
QString* getPhone();
|
||||
void setPhone(QString* phone);
|
||||
qint32 getUserStatus();
|
||||
qint32 getUserStatus();
|
||||
void setUserStatus(qint32 userStatus);
|
||||
|
||||
|
||||
private:
|
||||
qint64 id;
|
||||
QString* username;
|
||||
QString* firstName;
|
||||
QString* lastName;
|
||||
QString* email;
|
||||
QString* password;
|
||||
QString* phone;
|
||||
qint32 userStatus;
|
||||
|
||||
QString* username;
|
||||
QString* firstName;
|
||||
QString* lastName;
|
||||
QString* email;
|
||||
QString* password;
|
||||
QString* phone;
|
||||
qint32 userStatus;
|
||||
};
|
||||
|
||||
} /* namespace Swagger */
|
||||
|
@ -22,22 +22,15 @@ SWGUserApi::createUser(SWGUser body) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "POST");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QString output = body.asJson();
|
||||
input.request_body.append(output);
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
@ -70,15 +63,10 @@ SWGUserApi::createUsersWithArrayInput(QList<SWGUser*>* body) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "POST");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QJsonArray* bodyArray = new QJsonArray();
|
||||
toJsonArray((QList<void*>*)body, bodyArray, QString("body"), QString("SWGUser*"));
|
||||
|
||||
@ -89,8 +77,6 @@ SWGUserApi::createUsersWithArrayInput(QList<SWGUser*>* body) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
@ -123,15 +109,10 @@ SWGUserApi::createUsersWithListInput(QList<SWGUser*>* body) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "POST");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QJsonArray* bodyArray = new QJsonArray();
|
||||
toJsonArray((QList<void*>*)body, bodyArray, QString("body"), QString("SWGUser*"));
|
||||
|
||||
@ -142,8 +123,6 @@ SWGUserApi::createUsersWithListInput(QList<SWGUser*>* body) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
@ -170,14 +149,96 @@ SWGUserApi::createUsersWithListInputCallback(HttpRequestWorker * worker) {
|
||||
emit createUsersWithListInputSignal();
|
||||
}
|
||||
void
|
||||
SWGUserApi::deleteUser(QString* username) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/user/{username}");
|
||||
|
||||
QString usernamePathParam("{"); usernamePathParam.append("username").append("}");
|
||||
fullPath.replace(usernamePathParam, stringValue(username));
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "DELETE");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGUserApi::deleteUserCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGUserApi::deleteUserCallback(HttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
|
||||
emit deleteUserSignal();
|
||||
}
|
||||
void
|
||||
SWGUserApi::getUserByName(QString* username) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/user/{username}");
|
||||
|
||||
QString usernamePathParam("{"); usernamePathParam.append("username").append("}");
|
||||
fullPath.replace(usernamePathParam, stringValue(username));
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "GET");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGUserApi::getUserByNameCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGUserApi::getUserByNameCallback(HttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGUser* output = static_cast<SWGUser*>(create(json, QString("SWGUser")));
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit getUserByNameSignal(output);
|
||||
|
||||
}
|
||||
void
|
||||
SWGUserApi::loginUser(QString* username, QString* password) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/user/login");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (fullPath.indexOf("?") > 0)
|
||||
fullPath.append("&");
|
||||
else
|
||||
@ -186,10 +247,6 @@ SWGUserApi::loginUser(QString* username, QString* password) {
|
||||
.append("=")
|
||||
.append(QUrl::toPercentEncoding(stringValue(username)));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (fullPath.indexOf("?") > 0)
|
||||
fullPath.append("&");
|
||||
else
|
||||
@ -199,9 +256,6 @@ SWGUserApi::loginUser(QString* username, QString* password) {
|
||||
.append(QUrl::toPercentEncoding(stringValue(password)));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "GET");
|
||||
|
||||
@ -209,8 +263,6 @@ SWGUserApi::loginUser(QString* username, QString* password) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
@ -230,16 +282,10 @@ SWGUserApi::loginUserCallback(HttpRequestWorker * worker) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
QString* output = static_cast<QString*>(create(json, QString("QString")));
|
||||
|
||||
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit loginUserSignal(output);
|
||||
@ -252,8 +298,6 @@ SWGUserApi::logoutUser() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "GET");
|
||||
|
||||
@ -261,8 +305,6 @@ SWGUserApi::logoutUser() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
@ -289,86 +331,23 @@ SWGUserApi::logoutUserCallback(HttpRequestWorker * worker) {
|
||||
emit logoutUserSignal();
|
||||
}
|
||||
void
|
||||
SWGUserApi::getUserByName(QString* username) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/user/{username}");
|
||||
|
||||
|
||||
QString usernamePathParam("{"); usernamePathParam.append("username").append("}");
|
||||
fullPath.replace(usernamePathParam, stringValue(username));
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "GET");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGUserApi::getUserByNameCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGUserApi::getUserByNameCallback(HttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGUser* output = static_cast<SWGUser*>(create(json, QString("SWGUser")));
|
||||
|
||||
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit getUserByNameSignal(output);
|
||||
|
||||
}
|
||||
void
|
||||
SWGUserApi::updateUser(QString* username, SWGUser body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/user/{username}");
|
||||
|
||||
|
||||
QString usernamePathParam("{"); usernamePathParam.append("username").append("}");
|
||||
fullPath.replace(usernamePathParam, stringValue(username));
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "PUT");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QString output = body.asJson();
|
||||
input.request_body.append(output);
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
@ -394,50 +373,4 @@ SWGUserApi::updateUserCallback(HttpRequestWorker * worker) {
|
||||
|
||||
emit updateUserSignal();
|
||||
}
|
||||
void
|
||||
SWGUserApi::deleteUser(QString* username) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/user/{username}");
|
||||
|
||||
|
||||
QString usernamePathParam("{"); usernamePathParam.append("username").append("}");
|
||||
fullPath.replace(usernamePathParam, stringValue(username));
|
||||
|
||||
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "DELETE");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
connect(worker,
|
||||
&HttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGUserApi::deleteUserCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGUserApi::deleteUserCallback(HttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
|
||||
emit deleteUserSignal();
|
||||
}
|
||||
} /* namespace Swagger */
|
||||
|
@ -25,31 +25,31 @@ public:
|
||||
void createUser(SWGUser body);
|
||||
void createUsersWithArrayInput(QList<SWGUser*>* body);
|
||||
void createUsersWithListInput(QList<SWGUser*>* body);
|
||||
void deleteUser(QString* username);
|
||||
void getUserByName(QString* username);
|
||||
void loginUser(QString* username, QString* password);
|
||||
void logoutUser();
|
||||
void getUserByName(QString* username);
|
||||
void updateUser(QString* username, SWGUser body);
|
||||
void deleteUser(QString* username);
|
||||
|
||||
private:
|
||||
void createUserCallback (HttpRequestWorker * worker);
|
||||
void createUsersWithArrayInputCallback (HttpRequestWorker * worker);
|
||||
void createUsersWithListInputCallback (HttpRequestWorker * worker);
|
||||
void deleteUserCallback (HttpRequestWorker * worker);
|
||||
void getUserByNameCallback (HttpRequestWorker * worker);
|
||||
void loginUserCallback (HttpRequestWorker * worker);
|
||||
void logoutUserCallback (HttpRequestWorker * worker);
|
||||
void getUserByNameCallback (HttpRequestWorker * worker);
|
||||
void updateUserCallback (HttpRequestWorker * worker);
|
||||
void deleteUserCallback (HttpRequestWorker * worker);
|
||||
|
||||
signals:
|
||||
void createUserSignal();
|
||||
void createUsersWithArrayInputSignal();
|
||||
void createUsersWithListInputSignal();
|
||||
void deleteUserSignal();
|
||||
void getUserByNameSignal(SWGUser* summary);
|
||||
void loginUserSignal(QString* summary);
|
||||
void logoutUserSignal();
|
||||
void getUserByNameSignal(SWGUser* summary);
|
||||
void updateUserSignal();
|
||||
void deleteUserSignal();
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -23,8 +23,7 @@ SamiCategory::~SamiCategory() {
|
||||
void
|
||||
SamiCategory::init() {
|
||||
pId = null;
|
||||
pName = null;
|
||||
|
||||
pName = null;
|
||||
}
|
||||
|
||||
void
|
||||
@ -34,12 +33,11 @@ SamiCategory::cleanup() {
|
||||
delete pId;
|
||||
pId = null;
|
||||
}
|
||||
if(pName != null) {
|
||||
if(pName != null) {
|
||||
|
||||
delete pName;
|
||||
pName = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -86,7 +84,7 @@ SamiCategory::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pId, pIdVal, L"Long", L"Long");
|
||||
}
|
||||
delete pIdKey;
|
||||
JsonString* pNameKey = new JsonString(L"name");
|
||||
JsonString* pNameKey = new JsonString(L"name");
|
||||
IJsonValue* pNameVal = null;
|
||||
pJsonObject->GetValue(pNameKey, pNameVal);
|
||||
if(pNameVal != null) {
|
||||
@ -95,7 +93,6 @@ SamiCategory::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pName, pNameVal, L"String", L"String");
|
||||
}
|
||||
delete pNameKey;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,15 +143,12 @@ SamiCategory::asJsonObject() {
|
||||
JsonObject *pJsonObject = new JsonObject();
|
||||
pJsonObject->Construct();
|
||||
|
||||
|
||||
JsonString *pIdKey = new JsonString(L"id");
|
||||
pJsonObject->Add(pIdKey, toJson(getPId(), "Long", ""));
|
||||
|
||||
|
||||
JsonString *pNameKey = new JsonString(L"name");
|
||||
pJsonObject->Add(pNameKey, toJson(getPName(), "String", ""));
|
||||
|
||||
|
||||
return pJsonObject;
|
||||
}
|
||||
|
||||
|
@ -41,18 +41,14 @@ public:
|
||||
|
||||
SamiCategory* fromJson(String* obj);
|
||||
|
||||
|
||||
Long* getPId();
|
||||
void setPId(Long* pId);
|
||||
|
||||
String* getPName();
|
||||
void setPName(String* pName);
|
||||
|
||||
|
||||
private:
|
||||
Long* pId;
|
||||
String* pName;
|
||||
|
||||
String* pName;
|
||||
};
|
||||
|
||||
} /* namespace Swagger */
|
||||
|
@ -3,29 +3,33 @@
|
||||
|
||||
#include "SamiObject.h"
|
||||
|
||||
#include "SamiUser.h"
|
||||
#include "SamiApiResponse.h"
|
||||
#include "SamiCategory.h"
|
||||
#include "SamiOrder.h"
|
||||
#include "SamiPet.h"
|
||||
#include "SamiTag.h"
|
||||
#include "SamiOrder.h"
|
||||
#include "SamiUser.h"
|
||||
|
||||
namespace Swagger {
|
||||
void*
|
||||
create(String type) {
|
||||
if(type.Equals(L"SamiUser", true)) {
|
||||
return new SamiUser();
|
||||
if(type.Equals(L"SamiApiResponse", true)) {
|
||||
return new SamiApiResponse();
|
||||
}
|
||||
if(type.Equals(L"SamiCategory", true)) {
|
||||
return new SamiCategory();
|
||||
}
|
||||
if(type.Equals(L"SamiOrder", true)) {
|
||||
return new SamiOrder();
|
||||
}
|
||||
if(type.Equals(L"SamiPet", true)) {
|
||||
return new SamiPet();
|
||||
}
|
||||
if(type.Equals(L"SamiTag", true)) {
|
||||
return new SamiTag();
|
||||
}
|
||||
if(type.Equals(L"SamiOrder", true)) {
|
||||
return new SamiOrder();
|
||||
if(type.Equals(L"SamiUser", true)) {
|
||||
return new SamiUser();
|
||||
}
|
||||
|
||||
if(type.Equals(L"String", true)) {
|
||||
|
@ -23,12 +23,11 @@ SamiOrder::~SamiOrder() {
|
||||
void
|
||||
SamiOrder::init() {
|
||||
pId = null;
|
||||
pPetId = null;
|
||||
pQuantity = null;
|
||||
pShipDate = null;
|
||||
pStatus = null;
|
||||
pComplete = null;
|
||||
|
||||
pPetId = null;
|
||||
pQuantity = null;
|
||||
pShipDate = null;
|
||||
pStatus = null;
|
||||
pComplete = null;
|
||||
}
|
||||
|
||||
void
|
||||
@ -38,32 +37,31 @@ SamiOrder::cleanup() {
|
||||
delete pId;
|
||||
pId = null;
|
||||
}
|
||||
if(pPetId != null) {
|
||||
if(pPetId != null) {
|
||||
|
||||
delete pPetId;
|
||||
pPetId = null;
|
||||
}
|
||||
if(pQuantity != null) {
|
||||
if(pQuantity != null) {
|
||||
|
||||
delete pQuantity;
|
||||
pQuantity = null;
|
||||
}
|
||||
if(pShipDate != null) {
|
||||
if(pShipDate != null) {
|
||||
|
||||
delete pShipDate;
|
||||
pShipDate = null;
|
||||
}
|
||||
if(pStatus != null) {
|
||||
if(pStatus != null) {
|
||||
|
||||
delete pStatus;
|
||||
pStatus = null;
|
||||
}
|
||||
if(pComplete != null) {
|
||||
if(pComplete != null) {
|
||||
|
||||
delete pComplete;
|
||||
pComplete = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -110,7 +108,7 @@ SamiOrder::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pId, pIdVal, L"Long", L"Long");
|
||||
}
|
||||
delete pIdKey;
|
||||
JsonString* pPetIdKey = new JsonString(L"petId");
|
||||
JsonString* pPetIdKey = new JsonString(L"petId");
|
||||
IJsonValue* pPetIdVal = null;
|
||||
pJsonObject->GetValue(pPetIdKey, pPetIdVal);
|
||||
if(pPetIdVal != null) {
|
||||
@ -119,7 +117,7 @@ SamiOrder::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pPetId, pPetIdVal, L"Long", L"Long");
|
||||
}
|
||||
delete pPetIdKey;
|
||||
JsonString* pQuantityKey = new JsonString(L"quantity");
|
||||
JsonString* pQuantityKey = new JsonString(L"quantity");
|
||||
IJsonValue* pQuantityVal = null;
|
||||
pJsonObject->GetValue(pQuantityKey, pQuantityVal);
|
||||
if(pQuantityVal != null) {
|
||||
@ -128,7 +126,7 @@ SamiOrder::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pQuantity, pQuantityVal, L"Integer", L"Integer");
|
||||
}
|
||||
delete pQuantityKey;
|
||||
JsonString* pShipDateKey = new JsonString(L"shipDate");
|
||||
JsonString* pShipDateKey = new JsonString(L"shipDate");
|
||||
IJsonValue* pShipDateVal = null;
|
||||
pJsonObject->GetValue(pShipDateKey, pShipDateVal);
|
||||
if(pShipDateVal != null) {
|
||||
@ -137,7 +135,7 @@ SamiOrder::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pShipDate, pShipDateVal, L"DateTime", L"DateTime");
|
||||
}
|
||||
delete pShipDateKey;
|
||||
JsonString* pStatusKey = new JsonString(L"status");
|
||||
JsonString* pStatusKey = new JsonString(L"status");
|
||||
IJsonValue* pStatusVal = null;
|
||||
pJsonObject->GetValue(pStatusKey, pStatusVal);
|
||||
if(pStatusVal != null) {
|
||||
@ -146,7 +144,7 @@ SamiOrder::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pStatus, pStatusVal, L"String", L"String");
|
||||
}
|
||||
delete pStatusKey;
|
||||
JsonString* pCompleteKey = new JsonString(L"complete");
|
||||
JsonString* pCompleteKey = new JsonString(L"complete");
|
||||
IJsonValue* pCompleteVal = null;
|
||||
pJsonObject->GetValue(pCompleteKey, pCompleteVal);
|
||||
if(pCompleteVal != null) {
|
||||
@ -155,7 +153,6 @@ SamiOrder::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pComplete, pCompleteVal, L"Boolean", L"Boolean");
|
||||
}
|
||||
delete pCompleteKey;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,31 +203,24 @@ SamiOrder::asJsonObject() {
|
||||
JsonObject *pJsonObject = new JsonObject();
|
||||
pJsonObject->Construct();
|
||||
|
||||
|
||||
JsonString *pIdKey = new JsonString(L"id");
|
||||
pJsonObject->Add(pIdKey, toJson(getPId(), "Long", ""));
|
||||
|
||||
|
||||
JsonString *pPetIdKey = new JsonString(L"petId");
|
||||
pJsonObject->Add(pPetIdKey, toJson(getPPetId(), "Long", ""));
|
||||
|
||||
|
||||
JsonString *pQuantityKey = new JsonString(L"quantity");
|
||||
pJsonObject->Add(pQuantityKey, toJson(getPQuantity(), "Integer", ""));
|
||||
|
||||
|
||||
JsonString *pShipDateKey = new JsonString(L"shipDate");
|
||||
pJsonObject->Add(pShipDateKey, toJson(getPShipDate(), "DateTime", ""));
|
||||
|
||||
|
||||
JsonString *pStatusKey = new JsonString(L"status");
|
||||
pJsonObject->Add(pStatusKey, toJson(getPStatus(), "String", ""));
|
||||
|
||||
|
||||
JsonString *pCompleteKey = new JsonString(L"complete");
|
||||
pJsonObject->Add(pCompleteKey, toJson(getPComplete(), "Boolean", ""));
|
||||
|
||||
|
||||
return pJsonObject;
|
||||
}
|
||||
|
||||
|
@ -17,11 +17,11 @@
|
||||
using namespace Tizen::Web::Json;
|
||||
|
||||
|
||||
using Tizen::Base::Long;
|
||||
using Tizen::Base::DateTime;
|
||||
using Tizen::Base::String;
|
||||
using Tizen::Base::Boolean;
|
||||
using Tizen::Base::DateTime;
|
||||
using Tizen::Base::Integer;
|
||||
using Tizen::Base::Long;
|
||||
using Tizen::Base::String;
|
||||
|
||||
|
||||
namespace Swagger {
|
||||
@ -44,34 +44,26 @@ public:
|
||||
|
||||
SamiOrder* fromJson(String* obj);
|
||||
|
||||
|
||||
Long* getPId();
|
||||
void setPId(Long* pId);
|
||||
|
||||
Long* getPPetId();
|
||||
void setPPetId(Long* pPetId);
|
||||
|
||||
Integer* getPQuantity();
|
||||
void setPQuantity(Integer* pQuantity);
|
||||
|
||||
DateTime* getPShipDate();
|
||||
void setPShipDate(DateTime* pShipDate);
|
||||
|
||||
String* getPStatus();
|
||||
void setPStatus(String* pStatus);
|
||||
|
||||
Boolean* getPComplete();
|
||||
void setPComplete(Boolean* pComplete);
|
||||
|
||||
|
||||
private:
|
||||
Long* pId;
|
||||
Long* pPetId;
|
||||
Integer* pQuantity;
|
||||
DateTime* pShipDate;
|
||||
String* pStatus;
|
||||
Boolean* pComplete;
|
||||
|
||||
Long* pPetId;
|
||||
Integer* pQuantity;
|
||||
DateTime* pShipDate;
|
||||
String* pStatus;
|
||||
Boolean* pComplete;
|
||||
};
|
||||
|
||||
} /* namespace Swagger */
|
||||
|
@ -23,12 +23,11 @@ SamiPet::~SamiPet() {
|
||||
void
|
||||
SamiPet::init() {
|
||||
pId = null;
|
||||
pCategory = null;
|
||||
pName = null;
|
||||
pPhotoUrls = null;
|
||||
pTags = null;
|
||||
pStatus = null;
|
||||
|
||||
pCategory = null;
|
||||
pName = null;
|
||||
pPhotoUrls = null;
|
||||
pTags = null;
|
||||
pStatus = null;
|
||||
}
|
||||
|
||||
void
|
||||
@ -38,32 +37,31 @@ SamiPet::cleanup() {
|
||||
delete pId;
|
||||
pId = null;
|
||||
}
|
||||
if(pCategory != null) {
|
||||
if(pCategory != null) {
|
||||
|
||||
delete pCategory;
|
||||
pCategory = null;
|
||||
}
|
||||
if(pName != null) {
|
||||
if(pName != null) {
|
||||
|
||||
delete pName;
|
||||
pName = null;
|
||||
}
|
||||
if(pPhotoUrls != null) {
|
||||
if(pPhotoUrls != null) {
|
||||
pPhotoUrls->RemoveAll(true);
|
||||
delete pPhotoUrls;
|
||||
pPhotoUrls = null;
|
||||
}
|
||||
if(pTags != null) {
|
||||
if(pTags != null) {
|
||||
pTags->RemoveAll(true);
|
||||
delete pTags;
|
||||
pTags = null;
|
||||
}
|
||||
if(pStatus != null) {
|
||||
if(pStatus != null) {
|
||||
|
||||
delete pStatus;
|
||||
pStatus = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -110,7 +108,7 @@ SamiPet::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pId, pIdVal, L"Long", L"Long");
|
||||
}
|
||||
delete pIdKey;
|
||||
JsonString* pCategoryKey = new JsonString(L"category");
|
||||
JsonString* pCategoryKey = new JsonString(L"category");
|
||||
IJsonValue* pCategoryVal = null;
|
||||
pJsonObject->GetValue(pCategoryKey, pCategoryVal);
|
||||
if(pCategoryVal != null) {
|
||||
@ -119,7 +117,7 @@ SamiPet::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pCategory, pCategoryVal, L"SamiCategory", L"SamiCategory");
|
||||
}
|
||||
delete pCategoryKey;
|
||||
JsonString* pNameKey = new JsonString(L"name");
|
||||
JsonString* pNameKey = new JsonString(L"name");
|
||||
IJsonValue* pNameVal = null;
|
||||
pJsonObject->GetValue(pNameKey, pNameVal);
|
||||
if(pNameVal != null) {
|
||||
@ -128,7 +126,7 @@ SamiPet::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pName, pNameVal, L"String", L"String");
|
||||
}
|
||||
delete pNameKey;
|
||||
JsonString* pPhotoUrlsKey = new JsonString(L"photoUrls");
|
||||
JsonString* pPhotoUrlsKey = new JsonString(L"photoUrls");
|
||||
IJsonValue* pPhotoUrlsVal = null;
|
||||
pJsonObject->GetValue(pPhotoUrlsKey, pPhotoUrlsVal);
|
||||
if(pPhotoUrlsVal != null) {
|
||||
@ -137,7 +135,7 @@ SamiPet::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pPhotoUrls, pPhotoUrlsVal, L"IList", L"String");
|
||||
}
|
||||
delete pPhotoUrlsKey;
|
||||
JsonString* pTagsKey = new JsonString(L"tags");
|
||||
JsonString* pTagsKey = new JsonString(L"tags");
|
||||
IJsonValue* pTagsVal = null;
|
||||
pJsonObject->GetValue(pTagsKey, pTagsVal);
|
||||
if(pTagsVal != null) {
|
||||
@ -146,7 +144,7 @@ SamiPet::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pTags, pTagsVal, L"IList", L"SamiTag");
|
||||
}
|
||||
delete pTagsKey;
|
||||
JsonString* pStatusKey = new JsonString(L"status");
|
||||
JsonString* pStatusKey = new JsonString(L"status");
|
||||
IJsonValue* pStatusVal = null;
|
||||
pJsonObject->GetValue(pStatusKey, pStatusVal);
|
||||
if(pStatusVal != null) {
|
||||
@ -155,7 +153,6 @@ SamiPet::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pStatus, pStatusVal, L"String", L"String");
|
||||
}
|
||||
delete pStatusKey;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,31 +203,24 @@ SamiPet::asJsonObject() {
|
||||
JsonObject *pJsonObject = new JsonObject();
|
||||
pJsonObject->Construct();
|
||||
|
||||
|
||||
JsonString *pIdKey = new JsonString(L"id");
|
||||
pJsonObject->Add(pIdKey, toJson(getPId(), "Long", ""));
|
||||
|
||||
|
||||
JsonString *pCategoryKey = new JsonString(L"category");
|
||||
pJsonObject->Add(pCategoryKey, toJson(getPCategory(), "SamiCategory", ""));
|
||||
|
||||
|
||||
JsonString *pNameKey = new JsonString(L"name");
|
||||
pJsonObject->Add(pNameKey, toJson(getPName(), "String", ""));
|
||||
|
||||
|
||||
JsonString *pPhotoUrlsKey = new JsonString(L"photoUrls");
|
||||
pJsonObject->Add(pPhotoUrlsKey, toJson(getPPhotoUrls(), "String", "array"));
|
||||
|
||||
|
||||
JsonString *pTagsKey = new JsonString(L"tags");
|
||||
pJsonObject->Add(pTagsKey, toJson(getPTags(), "SamiTag", "array"));
|
||||
|
||||
|
||||
JsonString *pStatusKey = new JsonString(L"status");
|
||||
pJsonObject->Add(pStatusKey, toJson(getPStatus(), "String", ""));
|
||||
|
||||
|
||||
return pJsonObject;
|
||||
}
|
||||
|
||||
|
@ -18,10 +18,10 @@ using namespace Tizen::Web::Json;
|
||||
|
||||
|
||||
#include "SamiCategory.h"
|
||||
using Tizen::Base::Long;
|
||||
using Tizen::Base::String;
|
||||
#include "SamiTag.h"
|
||||
using Tizen::Base::Collection::IList;
|
||||
using Tizen::Base::Long;
|
||||
using Tizen::Base::String;
|
||||
|
||||
|
||||
namespace Swagger {
|
||||
@ -44,34 +44,26 @@ public:
|
||||
|
||||
SamiPet* fromJson(String* obj);
|
||||
|
||||
|
||||
Long* getPId();
|
||||
void setPId(Long* pId);
|
||||
|
||||
SamiCategory* getPCategory();
|
||||
void setPCategory(SamiCategory* pCategory);
|
||||
|
||||
String* getPName();
|
||||
void setPName(String* pName);
|
||||
|
||||
IList* getPPhotoUrls();
|
||||
void setPPhotoUrls(IList* pPhotoUrls);
|
||||
|
||||
IList* getPTags();
|
||||
void setPTags(IList* pTags);
|
||||
|
||||
String* getPStatus();
|
||||
void setPStatus(String* pStatus);
|
||||
|
||||
|
||||
private:
|
||||
Long* pId;
|
||||
SamiCategory* pCategory;
|
||||
String* pName;
|
||||
IList* pPhotoUrls;
|
||||
IList* pTags;
|
||||
String* pStatus;
|
||||
|
||||
SamiCategory* pCategory;
|
||||
String* pName;
|
||||
IList* pPhotoUrls;
|
||||
IList* pTags;
|
||||
String* pStatus;
|
||||
};
|
||||
|
||||
} /* namespace Swagger */
|
||||
|
@ -16,55 +16,6 @@ SamiPetApi::~SamiPetApi() {
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
updatePetProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiError*)) {
|
||||
int code = pHttpResponse->GetHttpStatusCode();
|
||||
|
||||
if(code >= 200 && code < 300) {
|
||||
handler(null, null);
|
||||
}
|
||||
else {
|
||||
SamiError* error = new SamiError(code, new String(pHttpResponse->GetStatusText()));
|
||||
|
||||
handler(error, null);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SamiPetApi::updatePetWithCompletion(SamiPet* body, void(*success)(SamiError*)) {
|
||||
client = new SamiApiClient();
|
||||
|
||||
client->success(&updatePetProcessor, (void(*)(void*, SamiError*))success);
|
||||
HashMap* headerParams = new HashMap(SingleObjectDeleter);
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
|
||||
|
||||
if(body != null) {
|
||||
mBody = new String(body->asJson());
|
||||
headerParams->Add(new String("Content-Type"), new String("application/json"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
String url(L"/pet");
|
||||
|
||||
|
||||
|
||||
client->execute(SamiPetApi::getBasePath(), url, "PUT", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
addPetProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiError*)) {
|
||||
int code = pHttpResponse->GetHttpStatusCode();
|
||||
@ -88,32 +39,67 @@ SamiPetApi::addPetWithCompletion(SamiPet* body, void(*success)(SamiError*)) {
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
|
||||
|
||||
if(body != null) {
|
||||
mBody = new String(body->asJson());
|
||||
headerParams->Add(new String("Content-Type"), new String("application/json"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
String url(L"/pet");
|
||||
|
||||
|
||||
|
||||
client->execute(SamiPetApi::getBasePath(), url, "POST", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
deletePetProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiError*)) {
|
||||
int code = pHttpResponse->GetHttpStatusCode();
|
||||
|
||||
if(code >= 200 && code < 300) {
|
||||
handler(null, null);
|
||||
}
|
||||
else {
|
||||
SamiError* error = new SamiError(code, new String(pHttpResponse->GetStatusText()));
|
||||
|
||||
handler(error, null);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SamiPetApi::deletePetWithCompletion(Long* petId, String* apiKey, void(*success)(SamiError*)) {
|
||||
client = new SamiApiClient();
|
||||
|
||||
client->success(&deletePetProcessor, (void(*)(void*, SamiError*))success);
|
||||
HashMap* headerParams = new HashMap(SingleObjectDeleter);
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
headerParams->Add(new String("api_key"), apiKey);
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
String url(L"/pet/{petId}");
|
||||
|
||||
String s_petId(L"{");
|
||||
s_petId.Append(L"petId");
|
||||
s_petId.Append(L"}");
|
||||
url.Replace(s_petId, stringify(petId, L"Long*"));
|
||||
|
||||
client->execute(SamiPetApi::getBasePath(), url, "DELETE", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
findPetsByStatusProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiError*)) {
|
||||
int code = pHttpResponse->GetHttpStatusCode();
|
||||
@ -158,7 +144,6 @@ SamiPetApi::findPetsByStatusWithCompletion(IList* status, void (* success)(IList
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
@ -169,16 +154,12 @@ SamiPetApi::findPetsByStatusWithCompletion(IList* status, void (* success)(IList
|
||||
queryParams->Add(new String("status"), new String(itemAt));
|
||||
}
|
||||
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
|
||||
String url(L"/pet/findByStatus");
|
||||
|
||||
|
||||
|
||||
client->execute(SamiPetApi::getBasePath(), url, "GET", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
return null;
|
||||
}
|
||||
@ -227,7 +208,6 @@ SamiPetApi::findPetsByTagsWithCompletion(IList* tags, void (* success)(IList*, S
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
@ -238,16 +218,12 @@ SamiPetApi::findPetsByTagsWithCompletion(IList* tags, void (* success)(IList*, S
|
||||
queryParams->Add(new String("tags"), new String(itemAt));
|
||||
}
|
||||
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
|
||||
String url(L"/pet/findByTags");
|
||||
|
||||
|
||||
|
||||
client->execute(SamiPetApi::getBasePath(), url, "GET", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
return null;
|
||||
}
|
||||
@ -296,29 +272,65 @@ SamiPetApi::getPetByIdWithCompletion(Long* petId, void (* success)(SamiPet*, Sam
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
|
||||
String url(L"/pet/{petId}");
|
||||
|
||||
|
||||
String s_petId(L"{");
|
||||
s_petId.Append(L"petId");
|
||||
s_petId.Append(L"}");
|
||||
url.Replace(s_petId, stringify(petId, L"Long*"));
|
||||
|
||||
|
||||
client->execute(SamiPetApi::getBasePath(), url, "GET", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
return null;
|
||||
}
|
||||
|
||||
void
|
||||
updatePetProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiError*)) {
|
||||
int code = pHttpResponse->GetHttpStatusCode();
|
||||
|
||||
if(code >= 200 && code < 300) {
|
||||
handler(null, null);
|
||||
}
|
||||
else {
|
||||
SamiError* error = new SamiError(code, new String(pHttpResponse->GetStatusText()));
|
||||
|
||||
handler(error, null);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SamiPetApi::updatePetWithCompletion(SamiPet* body, void(*success)(SamiError*)) {
|
||||
client = new SamiApiClient();
|
||||
|
||||
client->success(&updatePetProcessor, (void(*)(void*, SamiError*))success);
|
||||
HashMap* headerParams = new HashMap(SingleObjectDeleter);
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
if(body != null) {
|
||||
mBody = new String(body->asJson());
|
||||
headerParams->Add(new String("Content-Type"), new String("application/json"));
|
||||
}
|
||||
|
||||
String url(L"/pet");
|
||||
|
||||
|
||||
client->execute(SamiPetApi::getBasePath(), url, "PUT", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
updatePetWithFormProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiError*)) {
|
||||
int code = pHttpResponse->GetHttpStatusCode();
|
||||
@ -334,7 +346,7 @@ updatePetWithFormProcessor(HttpResponse* pHttpResponse, void (* handler)(void*,
|
||||
}
|
||||
|
||||
void
|
||||
SamiPetApi::updatePetWithFormWithCompletion(String* petId, String* name, String* status, void(*success)(SamiError*)) {
|
||||
SamiPetApi::updatePetWithFormWithCompletion(Long* petId, String* name, String* status, void(*success)(SamiError*)) {
|
||||
client = new SamiApiClient();
|
||||
|
||||
client->success(&updatePetWithFormProcessor, (void(*)(void*, SamiError*))success);
|
||||
@ -342,75 +354,21 @@ SamiPetApi::updatePetWithFormWithCompletion(String* petId, String* name, String*
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
|
||||
String url(L"/pet/{petId}");
|
||||
|
||||
|
||||
String s_petId(L"{");
|
||||
s_petId.Append(L"petId");
|
||||
s_petId.Append(L"}");
|
||||
url.Replace(s_petId, stringify(petId, L"String*"));
|
||||
|
||||
|
||||
client->execute(SamiPetApi::getBasePath(), url, "POST", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
deletePetProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiError*)) {
|
||||
int code = pHttpResponse->GetHttpStatusCode();
|
||||
|
||||
if(code >= 200 && code < 300) {
|
||||
handler(null, null);
|
||||
}
|
||||
else {
|
||||
SamiError* error = new SamiError(code, new String(pHttpResponse->GetStatusText()));
|
||||
|
||||
handler(error, null);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SamiPetApi::deletePetWithCompletion(Long* petId, String* apiKey, void(*success)(SamiError*)) {
|
||||
client = new SamiApiClient();
|
||||
|
||||
client->success(&deletePetProcessor, (void(*)(void*, SamiError*))success);
|
||||
HashMap* headerParams = new HashMap(SingleObjectDeleter);
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
headerParams->Add(new String("api_key"), apiKey);
|
||||
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
|
||||
String url(L"/pet/{petId}");
|
||||
|
||||
|
||||
String s_petId(L"{");
|
||||
s_petId.Append(L"petId");
|
||||
s_petId.Append(L"}");
|
||||
url.Replace(s_petId, stringify(petId, L"Long*"));
|
||||
|
||||
|
||||
client->execute(SamiPetApi::getBasePath(), url, "DELETE", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
client->execute(SamiPetApi::getBasePath(), url, "POST", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
|
||||
}
|
||||
|
||||
@ -419,17 +377,38 @@ uploadFileProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiErr
|
||||
int code = pHttpResponse->GetHttpStatusCode();
|
||||
|
||||
if(code >= 200 && code < 300) {
|
||||
handler(null, null);
|
||||
ByteBuffer* pBuffer = pHttpResponse->ReadBodyN();
|
||||
IJsonValue* pJson = JsonParser::ParseN(*pBuffer);
|
||||
|
||||
SamiApiResponse* out = new SamiApiResponse();
|
||||
jsonToValue(out, pJson, L"SamiApiResponse*", L"SamiApiResponse");
|
||||
|
||||
if (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);
|
||||
}
|
||||
handler(out, null);
|
||||
}
|
||||
else {
|
||||
SamiError* error = new SamiError(0, new String(L"No parsable response received"));
|
||||
handler(null, error);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
SamiError* error = new SamiError(code, new String(pHttpResponse->GetStatusText()));
|
||||
handler(null, error);
|
||||
|
||||
handler(error, null);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SamiPetApi::uploadFileWithCompletion(Long* petId, String* additionalMetadata, SamiFile* file, void(*success)(SamiError*)) {
|
||||
SamiApiResponse*
|
||||
SamiPetApi::uploadFileWithCompletion(Long* petId, String* additionalMetadata, SamiFile* file, void (* success)(SamiApiResponse*, SamiError*)) {
|
||||
client = new SamiApiClient();
|
||||
|
||||
client->success(&uploadFileProcessor, (void(*)(void*, SamiError*))success);
|
||||
@ -437,27 +416,22 @@ SamiPetApi::uploadFileWithCompletion(Long* petId, String* additionalMetadata, Sa
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
|
||||
String url(L"/pet/{petId}/uploadImage");
|
||||
|
||||
|
||||
String s_petId(L"{");
|
||||
s_petId.Append(L"petId");
|
||||
s_petId.Append(L"}");
|
||||
url.Replace(s_petId, stringify(petId, L"Long*"));
|
||||
|
||||
|
||||
client->execute(SamiPetApi::getBasePath(), url, "POST", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,9 +6,10 @@
|
||||
#include "SamiError.h"
|
||||
|
||||
#include "SamiPet.h"
|
||||
using Tizen::Base::String;
|
||||
using Tizen::Base::Long;
|
||||
using Tizen::Base::String;
|
||||
#include "SamiFile.h"
|
||||
#include "SamiApiResponse.h"
|
||||
|
||||
using namespace Tizen::Net::Http;
|
||||
|
||||
@ -19,31 +20,22 @@ public:
|
||||
SamiPetApi();
|
||||
virtual ~SamiPetApi();
|
||||
|
||||
|
||||
void
|
||||
updatePetWithCompletion(SamiPet* body, void(* handler)(SamiError*));
|
||||
|
||||
void
|
||||
addPetWithCompletion(SamiPet* body, void(* handler)(SamiError*));
|
||||
|
||||
IList*
|
||||
findPetsByStatusWithCompletion(IList* status, void (* handler)(IList*, SamiError*));
|
||||
|
||||
IList*
|
||||
findPetsByTagsWithCompletion(IList* tags, void (* handler)(IList*, SamiError*));
|
||||
|
||||
SamiPet*
|
||||
getPetByIdWithCompletion(Long* petId, void (* handler)(SamiPet*, SamiError*));
|
||||
|
||||
void
|
||||
updatePetWithFormWithCompletion(String* petId, String* name, String* status, void(* handler)(SamiError*));
|
||||
|
||||
void
|
||||
deletePetWithCompletion(Long* petId, String* apiKey, void(* handler)(SamiError*));
|
||||
|
||||
IList*
|
||||
findPetsByStatusWithCompletion(IList* status, void (* handler)(IList*, SamiError*));
|
||||
IList*
|
||||
findPetsByTagsWithCompletion(IList* tags, void (* handler)(IList*, SamiError*));
|
||||
SamiPet*
|
||||
getPetByIdWithCompletion(Long* petId, void (* handler)(SamiPet*, SamiError*));
|
||||
void
|
||||
uploadFileWithCompletion(Long* petId, String* additionalMetadata, SamiFile* file, void(* handler)(SamiError*));
|
||||
|
||||
updatePetWithCompletion(SamiPet* body, void(* handler)(SamiError*));
|
||||
void
|
||||
updatePetWithFormWithCompletion(Long* petId, String* name, String* status, void(* handler)(SamiError*));
|
||||
SamiApiResponse*
|
||||
uploadFileWithCompletion(Long* petId, String* additionalMetadata, SamiFile* file, void (* handler)(SamiApiResponse*, SamiError*));
|
||||
static String getBasePath() {
|
||||
return L"http://petstore.swagger.io/v2";
|
||||
}
|
||||
|
@ -16,6 +16,47 @@ SamiStoreApi::~SamiStoreApi() {
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
deleteOrderProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiError*)) {
|
||||
int code = pHttpResponse->GetHttpStatusCode();
|
||||
|
||||
if(code >= 200 && code < 300) {
|
||||
handler(null, null);
|
||||
}
|
||||
else {
|
||||
SamiError* error = new SamiError(code, new String(pHttpResponse->GetStatusText()));
|
||||
|
||||
handler(error, null);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SamiStoreApi::deleteOrderWithCompletion(String* orderId, void(*success)(SamiError*)) {
|
||||
client = new SamiApiClient();
|
||||
|
||||
client->success(&deleteOrderProcessor, (void(*)(void*, SamiError*))success);
|
||||
HashMap* headerParams = new HashMap(SingleObjectDeleter);
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
String url(L"/store/order/{orderId}");
|
||||
|
||||
String s_orderId(L"{");
|
||||
s_orderId.Append(L"orderId");
|
||||
s_orderId.Append(L"}");
|
||||
url.Replace(s_orderId, stringify(orderId, L"String*"));
|
||||
|
||||
client->execute(SamiStoreApi::getBasePath(), url, "DELETE", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
getInventoryProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiError*)) {
|
||||
int code = pHttpResponse->GetHttpStatusCode();
|
||||
@ -60,19 +101,77 @@ SamiStoreApi::getInventoryWithCompletion( void (* success)(HashMap*, SamiError*)
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
|
||||
String url(L"/store/inventory");
|
||||
|
||||
|
||||
client->execute(SamiStoreApi::getBasePath(), url, "GET", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
return null;
|
||||
}
|
||||
|
||||
void
|
||||
getOrderByIdProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiError*)) {
|
||||
int code = pHttpResponse->GetHttpStatusCode();
|
||||
|
||||
if(code >= 200 && code < 300) {
|
||||
ByteBuffer* pBuffer = pHttpResponse->ReadBodyN();
|
||||
IJsonValue* pJson = JsonParser::ParseN(*pBuffer);
|
||||
|
||||
SamiOrder* out = new SamiOrder();
|
||||
jsonToValue(out, pJson, L"SamiOrder*", L"SamiOrder");
|
||||
|
||||
if (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);
|
||||
}
|
||||
handler(out, null);
|
||||
}
|
||||
else {
|
||||
SamiError* error = new SamiError(0, new String(L"No parsable response received"));
|
||||
handler(null, error);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
SamiError* error = new SamiError(code, new String(pHttpResponse->GetStatusText()));
|
||||
handler(null, error);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
SamiOrder*
|
||||
SamiStoreApi::getOrderByIdWithCompletion(Long* orderId, void (* success)(SamiOrder*, SamiError*)) {
|
||||
client = new SamiApiClient();
|
||||
|
||||
client->success(&getOrderByIdProcessor, (void(*)(void*, SamiError*))success);
|
||||
HashMap* headerParams = new HashMap(SingleObjectDeleter);
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
String url(L"/store/order/{orderId}");
|
||||
|
||||
String s_orderId(L"{");
|
||||
s_orderId.Append(L"orderId");
|
||||
s_orderId.Append(L"}");
|
||||
url.Replace(s_orderId, stringify(orderId, L"Long*"));
|
||||
|
||||
client->execute(SamiStoreApi::getBasePath(), url, "GET", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
return null;
|
||||
@ -122,144 +221,23 @@ SamiStoreApi::placeOrderWithCompletion(SamiOrder* body, void (* success)(SamiOrd
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
|
||||
|
||||
if(body != null) {
|
||||
mBody = new String(body->asJson());
|
||||
headerParams->Add(new String("Content-Type"), new String("application/json"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
String url(L"/store/order");
|
||||
|
||||
|
||||
|
||||
client->execute(SamiStoreApi::getBasePath(), url, "POST", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
return null;
|
||||
}
|
||||
|
||||
void
|
||||
getOrderByIdProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiError*)) {
|
||||
int code = pHttpResponse->GetHttpStatusCode();
|
||||
|
||||
if(code >= 200 && code < 300) {
|
||||
ByteBuffer* pBuffer = pHttpResponse->ReadBodyN();
|
||||
IJsonValue* pJson = JsonParser::ParseN(*pBuffer);
|
||||
|
||||
SamiOrder* out = new SamiOrder();
|
||||
jsonToValue(out, pJson, L"SamiOrder*", L"SamiOrder");
|
||||
|
||||
if (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);
|
||||
}
|
||||
handler(out, null);
|
||||
}
|
||||
else {
|
||||
SamiError* error = new SamiError(0, new String(L"No parsable response received"));
|
||||
handler(null, error);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
SamiError* error = new SamiError(code, new String(pHttpResponse->GetStatusText()));
|
||||
handler(null, error);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
SamiOrder*
|
||||
SamiStoreApi::getOrderByIdWithCompletion(String* orderId, void (* success)(SamiOrder*, SamiError*)) {
|
||||
client = new SamiApiClient();
|
||||
|
||||
client->success(&getOrderByIdProcessor, (void(*)(void*, SamiError*))success);
|
||||
HashMap* headerParams = new HashMap(SingleObjectDeleter);
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
|
||||
String url(L"/store/order/{orderId}");
|
||||
|
||||
|
||||
String s_orderId(L"{");
|
||||
s_orderId.Append(L"orderId");
|
||||
s_orderId.Append(L"}");
|
||||
url.Replace(s_orderId, stringify(orderId, L"String*"));
|
||||
|
||||
|
||||
client->execute(SamiStoreApi::getBasePath(), url, "GET", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
return null;
|
||||
}
|
||||
|
||||
void
|
||||
deleteOrderProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiError*)) {
|
||||
int code = pHttpResponse->GetHttpStatusCode();
|
||||
|
||||
if(code >= 200 && code < 300) {
|
||||
handler(null, null);
|
||||
}
|
||||
else {
|
||||
SamiError* error = new SamiError(code, new String(pHttpResponse->GetStatusText()));
|
||||
|
||||
handler(error, null);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SamiStoreApi::deleteOrderWithCompletion(String* orderId, void(*success)(SamiError*)) {
|
||||
client = new SamiApiClient();
|
||||
|
||||
client->success(&deleteOrderProcessor, (void(*)(void*, SamiError*))success);
|
||||
HashMap* headerParams = new HashMap(SingleObjectDeleter);
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
|
||||
String url(L"/store/order/{orderId}");
|
||||
|
||||
|
||||
String s_orderId(L"{");
|
||||
s_orderId.Append(L"orderId");
|
||||
s_orderId.Append(L"}");
|
||||
url.Replace(s_orderId, stringify(orderId, L"String*"));
|
||||
|
||||
|
||||
client->execute(SamiStoreApi::getBasePath(), url, "DELETE", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
|
||||
}
|
||||
|
||||
|
||||
} /* namespace Swagger */
|
||||
|
@ -5,9 +5,10 @@
|
||||
#include "SamiApiClient.h"
|
||||
#include "SamiError.h"
|
||||
|
||||
using Tizen::Base::String;
|
||||
using Tizen::Base::Integer;
|
||||
#include "SamiOrder.h"
|
||||
using Tizen::Base::String;
|
||||
using Tizen::Base::Long;
|
||||
|
||||
using namespace Tizen::Net::Http;
|
||||
|
||||
@ -18,19 +19,14 @@ public:
|
||||
SamiStoreApi();
|
||||
virtual ~SamiStoreApi();
|
||||
|
||||
|
||||
HashMap*
|
||||
getInventoryWithCompletion( void (* handler)(HashMap*, SamiError*));
|
||||
|
||||
SamiOrder*
|
||||
placeOrderWithCompletion(SamiOrder* body, void (* handler)(SamiOrder*, SamiError*));
|
||||
|
||||
SamiOrder*
|
||||
getOrderByIdWithCompletion(String* orderId, void (* handler)(SamiOrder*, SamiError*));
|
||||
|
||||
void
|
||||
deleteOrderWithCompletion(String* orderId, void(* handler)(SamiError*));
|
||||
|
||||
HashMap*
|
||||
getInventoryWithCompletion( void (* handler)(HashMap*, SamiError*));
|
||||
SamiOrder*
|
||||
getOrderByIdWithCompletion(Long* orderId, void (* handler)(SamiOrder*, SamiError*));
|
||||
SamiOrder*
|
||||
placeOrderWithCompletion(SamiOrder* body, void (* handler)(SamiOrder*, SamiError*));
|
||||
static String getBasePath() {
|
||||
return L"http://petstore.swagger.io/v2";
|
||||
}
|
||||
|
@ -23,8 +23,7 @@ SamiTag::~SamiTag() {
|
||||
void
|
||||
SamiTag::init() {
|
||||
pId = null;
|
||||
pName = null;
|
||||
|
||||
pName = null;
|
||||
}
|
||||
|
||||
void
|
||||
@ -34,12 +33,11 @@ SamiTag::cleanup() {
|
||||
delete pId;
|
||||
pId = null;
|
||||
}
|
||||
if(pName != null) {
|
||||
if(pName != null) {
|
||||
|
||||
delete pName;
|
||||
pName = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -86,7 +84,7 @@ SamiTag::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pId, pIdVal, L"Long", L"Long");
|
||||
}
|
||||
delete pIdKey;
|
||||
JsonString* pNameKey = new JsonString(L"name");
|
||||
JsonString* pNameKey = new JsonString(L"name");
|
||||
IJsonValue* pNameVal = null;
|
||||
pJsonObject->GetValue(pNameKey, pNameVal);
|
||||
if(pNameVal != null) {
|
||||
@ -95,7 +93,6 @@ SamiTag::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pName, pNameVal, L"String", L"String");
|
||||
}
|
||||
delete pNameKey;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,15 +143,12 @@ SamiTag::asJsonObject() {
|
||||
JsonObject *pJsonObject = new JsonObject();
|
||||
pJsonObject->Construct();
|
||||
|
||||
|
||||
JsonString *pIdKey = new JsonString(L"id");
|
||||
pJsonObject->Add(pIdKey, toJson(getPId(), "Long", ""));
|
||||
|
||||
|
||||
JsonString *pNameKey = new JsonString(L"name");
|
||||
pJsonObject->Add(pNameKey, toJson(getPName(), "String", ""));
|
||||
|
||||
|
||||
return pJsonObject;
|
||||
}
|
||||
|
||||
|
@ -41,18 +41,14 @@ public:
|
||||
|
||||
SamiTag* fromJson(String* obj);
|
||||
|
||||
|
||||
Long* getPId();
|
||||
void setPId(Long* pId);
|
||||
|
||||
String* getPName();
|
||||
void setPName(String* pName);
|
||||
|
||||
|
||||
private:
|
||||
Long* pId;
|
||||
String* pName;
|
||||
|
||||
String* pName;
|
||||
};
|
||||
|
||||
} /* namespace Swagger */
|
||||
|
@ -23,14 +23,13 @@ SamiUser::~SamiUser() {
|
||||
void
|
||||
SamiUser::init() {
|
||||
pId = null;
|
||||
pUsername = null;
|
||||
pFirstName = null;
|
||||
pLastName = null;
|
||||
pEmail = null;
|
||||
pPassword = null;
|
||||
pPhone = null;
|
||||
pUserStatus = null;
|
||||
|
||||
pUsername = null;
|
||||
pFirstName = null;
|
||||
pLastName = null;
|
||||
pEmail = null;
|
||||
pPassword = null;
|
||||
pPhone = null;
|
||||
pUserStatus = null;
|
||||
}
|
||||
|
||||
void
|
||||
@ -40,42 +39,41 @@ SamiUser::cleanup() {
|
||||
delete pId;
|
||||
pId = null;
|
||||
}
|
||||
if(pUsername != null) {
|
||||
if(pUsername != null) {
|
||||
|
||||
delete pUsername;
|
||||
pUsername = null;
|
||||
}
|
||||
if(pFirstName != null) {
|
||||
if(pFirstName != null) {
|
||||
|
||||
delete pFirstName;
|
||||
pFirstName = null;
|
||||
}
|
||||
if(pLastName != null) {
|
||||
if(pLastName != null) {
|
||||
|
||||
delete pLastName;
|
||||
pLastName = null;
|
||||
}
|
||||
if(pEmail != null) {
|
||||
if(pEmail != null) {
|
||||
|
||||
delete pEmail;
|
||||
pEmail = null;
|
||||
}
|
||||
if(pPassword != null) {
|
||||
if(pPassword != null) {
|
||||
|
||||
delete pPassword;
|
||||
pPassword = null;
|
||||
}
|
||||
if(pPhone != null) {
|
||||
if(pPhone != null) {
|
||||
|
||||
delete pPhone;
|
||||
pPhone = null;
|
||||
}
|
||||
if(pUserStatus != null) {
|
||||
if(pUserStatus != null) {
|
||||
|
||||
delete pUserStatus;
|
||||
pUserStatus = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -122,7 +120,7 @@ SamiUser::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pId, pIdVal, L"Long", L"Long");
|
||||
}
|
||||
delete pIdKey;
|
||||
JsonString* pUsernameKey = new JsonString(L"username");
|
||||
JsonString* pUsernameKey = new JsonString(L"username");
|
||||
IJsonValue* pUsernameVal = null;
|
||||
pJsonObject->GetValue(pUsernameKey, pUsernameVal);
|
||||
if(pUsernameVal != null) {
|
||||
@ -131,7 +129,7 @@ SamiUser::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pUsername, pUsernameVal, L"String", L"String");
|
||||
}
|
||||
delete pUsernameKey;
|
||||
JsonString* pFirstNameKey = new JsonString(L"firstName");
|
||||
JsonString* pFirstNameKey = new JsonString(L"firstName");
|
||||
IJsonValue* pFirstNameVal = null;
|
||||
pJsonObject->GetValue(pFirstNameKey, pFirstNameVal);
|
||||
if(pFirstNameVal != null) {
|
||||
@ -140,7 +138,7 @@ SamiUser::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pFirstName, pFirstNameVal, L"String", L"String");
|
||||
}
|
||||
delete pFirstNameKey;
|
||||
JsonString* pLastNameKey = new JsonString(L"lastName");
|
||||
JsonString* pLastNameKey = new JsonString(L"lastName");
|
||||
IJsonValue* pLastNameVal = null;
|
||||
pJsonObject->GetValue(pLastNameKey, pLastNameVal);
|
||||
if(pLastNameVal != null) {
|
||||
@ -149,7 +147,7 @@ SamiUser::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pLastName, pLastNameVal, L"String", L"String");
|
||||
}
|
||||
delete pLastNameKey;
|
||||
JsonString* pEmailKey = new JsonString(L"email");
|
||||
JsonString* pEmailKey = new JsonString(L"email");
|
||||
IJsonValue* pEmailVal = null;
|
||||
pJsonObject->GetValue(pEmailKey, pEmailVal);
|
||||
if(pEmailVal != null) {
|
||||
@ -158,7 +156,7 @@ SamiUser::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pEmail, pEmailVal, L"String", L"String");
|
||||
}
|
||||
delete pEmailKey;
|
||||
JsonString* pPasswordKey = new JsonString(L"password");
|
||||
JsonString* pPasswordKey = new JsonString(L"password");
|
||||
IJsonValue* pPasswordVal = null;
|
||||
pJsonObject->GetValue(pPasswordKey, pPasswordVal);
|
||||
if(pPasswordVal != null) {
|
||||
@ -167,7 +165,7 @@ SamiUser::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pPassword, pPasswordVal, L"String", L"String");
|
||||
}
|
||||
delete pPasswordKey;
|
||||
JsonString* pPhoneKey = new JsonString(L"phone");
|
||||
JsonString* pPhoneKey = new JsonString(L"phone");
|
||||
IJsonValue* pPhoneVal = null;
|
||||
pJsonObject->GetValue(pPhoneKey, pPhoneVal);
|
||||
if(pPhoneVal != null) {
|
||||
@ -176,7 +174,7 @@ SamiUser::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pPhone, pPhoneVal, L"String", L"String");
|
||||
}
|
||||
delete pPhoneKey;
|
||||
JsonString* pUserStatusKey = new JsonString(L"userStatus");
|
||||
JsonString* pUserStatusKey = new JsonString(L"userStatus");
|
||||
IJsonValue* pUserStatusVal = null;
|
||||
pJsonObject->GetValue(pUserStatusKey, pUserStatusVal);
|
||||
if(pUserStatusVal != null) {
|
||||
@ -185,7 +183,6 @@ SamiUser::fromJsonObject(IJsonValue* pJson) {
|
||||
jsonToValue(pUserStatus, pUserStatusVal, L"Integer", L"Integer");
|
||||
}
|
||||
delete pUserStatusKey;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -236,39 +233,30 @@ SamiUser::asJsonObject() {
|
||||
JsonObject *pJsonObject = new JsonObject();
|
||||
pJsonObject->Construct();
|
||||
|
||||
|
||||
JsonString *pIdKey = new JsonString(L"id");
|
||||
pJsonObject->Add(pIdKey, toJson(getPId(), "Long", ""));
|
||||
|
||||
|
||||
JsonString *pUsernameKey = new JsonString(L"username");
|
||||
pJsonObject->Add(pUsernameKey, toJson(getPUsername(), "String", ""));
|
||||
|
||||
|
||||
JsonString *pFirstNameKey = new JsonString(L"firstName");
|
||||
pJsonObject->Add(pFirstNameKey, toJson(getPFirstName(), "String", ""));
|
||||
|
||||
|
||||
JsonString *pLastNameKey = new JsonString(L"lastName");
|
||||
pJsonObject->Add(pLastNameKey, toJson(getPLastName(), "String", ""));
|
||||
|
||||
|
||||
JsonString *pEmailKey = new JsonString(L"email");
|
||||
pJsonObject->Add(pEmailKey, toJson(getPEmail(), "String", ""));
|
||||
|
||||
|
||||
JsonString *pPasswordKey = new JsonString(L"password");
|
||||
pJsonObject->Add(pPasswordKey, toJson(getPPassword(), "String", ""));
|
||||
|
||||
|
||||
JsonString *pPhoneKey = new JsonString(L"phone");
|
||||
pJsonObject->Add(pPhoneKey, toJson(getPPhone(), "String", ""));
|
||||
|
||||
|
||||
JsonString *pUserStatusKey = new JsonString(L"userStatus");
|
||||
pJsonObject->Add(pUserStatusKey, toJson(getPUserStatus(), "Integer", ""));
|
||||
|
||||
|
||||
return pJsonObject;
|
||||
}
|
||||
|
||||
|
@ -17,9 +17,9 @@
|
||||
using namespace Tizen::Web::Json;
|
||||
|
||||
|
||||
using Tizen::Base::Integer;
|
||||
using Tizen::Base::Long;
|
||||
using Tizen::Base::String;
|
||||
using Tizen::Base::Integer;
|
||||
|
||||
|
||||
namespace Swagger {
|
||||
@ -42,42 +42,32 @@ public:
|
||||
|
||||
SamiUser* fromJson(String* obj);
|
||||
|
||||
|
||||
Long* getPId();
|
||||
void setPId(Long* pId);
|
||||
|
||||
String* getPUsername();
|
||||
void setPUsername(String* pUsername);
|
||||
|
||||
String* getPFirstName();
|
||||
void setPFirstName(String* pFirstName);
|
||||
|
||||
String* getPLastName();
|
||||
void setPLastName(String* pLastName);
|
||||
|
||||
String* getPEmail();
|
||||
void setPEmail(String* pEmail);
|
||||
|
||||
String* getPPassword();
|
||||
void setPPassword(String* pPassword);
|
||||
|
||||
String* getPPhone();
|
||||
void setPPhone(String* pPhone);
|
||||
|
||||
Integer* getPUserStatus();
|
||||
void setPUserStatus(Integer* pUserStatus);
|
||||
|
||||
|
||||
private:
|
||||
Long* pId;
|
||||
String* pUsername;
|
||||
String* pFirstName;
|
||||
String* pLastName;
|
||||
String* pEmail;
|
||||
String* pPassword;
|
||||
String* pPhone;
|
||||
Integer* pUserStatus;
|
||||
|
||||
String* pUsername;
|
||||
String* pFirstName;
|
||||
String* pLastName;
|
||||
String* pEmail;
|
||||
String* pPassword;
|
||||
String* pPhone;
|
||||
Integer* pUserStatus;
|
||||
};
|
||||
|
||||
} /* namespace Swagger */
|
||||
|
@ -39,28 +39,20 @@ SamiUserApi::createUserWithCompletion(SamiUser* body, void(*success)(SamiError*)
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
|
||||
|
||||
if(body != null) {
|
||||
mBody = new String(body->asJson());
|
||||
headerParams->Add(new String("Content-Type"), new String("application/json"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
String url(L"/user");
|
||||
|
||||
|
||||
|
||||
client->execute(SamiUserApi::getBasePath(), url, "POST", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
|
||||
}
|
||||
@ -88,16 +80,12 @@ SamiUserApi::createUsersWithArrayInputWithCompletion(IList* body, void(*success)
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
|
||||
if(body != null) {
|
||||
mBody = new String("");
|
||||
int sz = body->GetCount();
|
||||
@ -112,13 +100,9 @@ SamiUserApi::createUsersWithArrayInputWithCompletion(IList* body, void(*success)
|
||||
headerParams->Add(new String("Content-Type"), new String("application/json"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
String url(L"/user/createWithArray");
|
||||
|
||||
|
||||
|
||||
client->execute(SamiUserApi::getBasePath(), url, "POST", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
|
||||
}
|
||||
@ -146,16 +130,12 @@ SamiUserApi::createUsersWithListInputWithCompletion(IList* body, void(*success)(
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
|
||||
if(body != null) {
|
||||
mBody = new String("");
|
||||
int sz = body->GetCount();
|
||||
@ -170,87 +150,15 @@ SamiUserApi::createUsersWithListInputWithCompletion(IList* body, void(*success)(
|
||||
headerParams->Add(new String("Content-Type"), new String("application/json"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
String url(L"/user/createWithList");
|
||||
|
||||
|
||||
|
||||
client->execute(SamiUserApi::getBasePath(), url, "POST", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
loginUserProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiError*)) {
|
||||
int code = pHttpResponse->GetHttpStatusCode();
|
||||
|
||||
if(code >= 200 && code < 300) {
|
||||
ByteBuffer* pBuffer = pHttpResponse->ReadBodyN();
|
||||
IJsonValue* pJson = JsonParser::ParseN(*pBuffer);
|
||||
|
||||
String* out = new String();
|
||||
jsonToValue(out, pJson, L"String*", L"String");
|
||||
|
||||
if (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);
|
||||
}
|
||||
handler(out, null);
|
||||
}
|
||||
else {
|
||||
SamiError* error = new SamiError(0, new String(L"No parsable response received"));
|
||||
handler(null, error);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
SamiError* error = new SamiError(code, new String(pHttpResponse->GetStatusText()));
|
||||
handler(null, error);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
String*
|
||||
SamiUserApi::loginUserWithCompletion(String* username, String* password, void (* success)(String*, SamiError*)) {
|
||||
client = new SamiApiClient();
|
||||
|
||||
client->success(&loginUserProcessor, (void(*)(void*, SamiError*))success);
|
||||
HashMap* headerParams = new HashMap(SingleObjectDeleter);
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
queryParams->Add(new String("username"), username);
|
||||
|
||||
|
||||
queryParams->Add(new String("password"), password);
|
||||
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
|
||||
String url(L"/user/login");
|
||||
|
||||
|
||||
|
||||
client->execute(SamiUserApi::getBasePath(), url, "GET", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
return null;
|
||||
}
|
||||
|
||||
void
|
||||
logoutUserProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiError*)) {
|
||||
deleteUserProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiError*)) {
|
||||
int code = pHttpResponse->GetHttpStatusCode();
|
||||
|
||||
if(code >= 200 && code < 300) {
|
||||
@ -264,29 +172,29 @@ logoutUserProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiErr
|
||||
}
|
||||
|
||||
void
|
||||
SamiUserApi::logoutUserWithCompletion( void(*success)(SamiError*)) {
|
||||
SamiUserApi::deleteUserWithCompletion(String* username, void(*success)(SamiError*)) {
|
||||
client = new SamiApiClient();
|
||||
|
||||
client->success(&logoutUserProcessor, (void(*)(void*, SamiError*))success);
|
||||
client->success(&deleteUserProcessor, (void(*)(void*, SamiError*))success);
|
||||
HashMap* headerParams = new HashMap(SingleObjectDeleter);
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
String url(L"/user/{username}");
|
||||
|
||||
String url(L"/user/logout");
|
||||
String s_username(L"{");
|
||||
s_username.Append(L"username");
|
||||
s_username.Append(L"}");
|
||||
url.Replace(s_username, stringify(username, L"String*"));
|
||||
|
||||
|
||||
|
||||
client->execute(SamiUserApi::getBasePath(), url, "GET", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
client->execute(SamiUserApi::getBasePath(), url, "DELETE", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
|
||||
}
|
||||
|
||||
@ -334,29 +242,123 @@ SamiUserApi::getUserByNameWithCompletion(String* username, void (* success)(Sami
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
|
||||
String url(L"/user/{username}");
|
||||
|
||||
|
||||
String s_username(L"{");
|
||||
s_username.Append(L"username");
|
||||
s_username.Append(L"}");
|
||||
url.Replace(s_username, stringify(username, L"String*"));
|
||||
|
||||
client->execute(SamiUserApi::getBasePath(), url, "GET", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
return null;
|
||||
}
|
||||
|
||||
void
|
||||
loginUserProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiError*)) {
|
||||
int code = pHttpResponse->GetHttpStatusCode();
|
||||
|
||||
if(code >= 200 && code < 300) {
|
||||
ByteBuffer* pBuffer = pHttpResponse->ReadBodyN();
|
||||
IJsonValue* pJson = JsonParser::ParseN(*pBuffer);
|
||||
|
||||
String* out = new String();
|
||||
jsonToValue(out, pJson, L"String*", L"String");
|
||||
|
||||
if (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);
|
||||
}
|
||||
handler(out, null);
|
||||
}
|
||||
else {
|
||||
SamiError* error = new SamiError(0, new String(L"No parsable response received"));
|
||||
handler(null, error);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
SamiError* error = new SamiError(code, new String(pHttpResponse->GetStatusText()));
|
||||
handler(null, error);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
String*
|
||||
SamiUserApi::loginUserWithCompletion(String* username, String* password, void (* success)(String*, SamiError*)) {
|
||||
client = new SamiApiClient();
|
||||
|
||||
client->success(&loginUserProcessor, (void(*)(void*, SamiError*))success);
|
||||
HashMap* headerParams = new HashMap(SingleObjectDeleter);
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
queryParams->Add(new String("username"), username);
|
||||
|
||||
queryParams->Add(new String("password"), password);
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
String url(L"/user/login");
|
||||
|
||||
|
||||
client->execute(SamiUserApi::getBasePath(), url, "GET", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
return null;
|
||||
}
|
||||
|
||||
void
|
||||
logoutUserProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiError*)) {
|
||||
int code = pHttpResponse->GetHttpStatusCode();
|
||||
|
||||
if(code >= 200 && code < 300) {
|
||||
handler(null, null);
|
||||
}
|
||||
else {
|
||||
SamiError* error = new SamiError(code, new String(pHttpResponse->GetStatusText()));
|
||||
|
||||
handler(error, null);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SamiUserApi::logoutUserWithCompletion( void(*success)(SamiError*)) {
|
||||
client = new SamiApiClient();
|
||||
|
||||
client->success(&logoutUserProcessor, (void(*)(void*, SamiError*))success);
|
||||
HashMap* headerParams = new HashMap(SingleObjectDeleter);
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
String url(L"/user/logout");
|
||||
|
||||
|
||||
client->execute(SamiUserApi::getBasePath(), url, "GET", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
updateUserProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiError*)) {
|
||||
int code = pHttpResponse->GetHttpStatusCode();
|
||||
@ -380,82 +382,27 @@ SamiUserApi::updateUserWithCompletion(String* username, SamiUser* body, void(*su
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
|
||||
|
||||
if(body != null) {
|
||||
mBody = new String(body->asJson());
|
||||
headerParams->Add(new String("Content-Type"), new String("application/json"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
String url(L"/user/{username}");
|
||||
|
||||
|
||||
String s_username(L"{");
|
||||
s_username.Append(L"username");
|
||||
s_username.Append(L"}");
|
||||
url.Replace(s_username, stringify(username, L"String*"));
|
||||
|
||||
|
||||
client->execute(SamiUserApi::getBasePath(), url, "PUT", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
deleteUserProcessor(HttpResponse* pHttpResponse, void (* handler)(void*, SamiError*)) {
|
||||
int code = pHttpResponse->GetHttpStatusCode();
|
||||
|
||||
if(code >= 200 && code < 300) {
|
||||
handler(null, null);
|
||||
}
|
||||
else {
|
||||
SamiError* error = new SamiError(code, new String(pHttpResponse->GetStatusText()));
|
||||
|
||||
handler(error, null);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SamiUserApi::deleteUserWithCompletion(String* username, void(*success)(SamiError*)) {
|
||||
client = new SamiApiClient();
|
||||
|
||||
client->success(&deleteUserProcessor, (void(*)(void*, SamiError*))success);
|
||||
HashMap* headerParams = new HashMap(SingleObjectDeleter);
|
||||
headerParams->Construct();
|
||||
|
||||
|
||||
|
||||
HashMap* queryParams = new HashMap(SingleObjectDeleter);
|
||||
queryParams->Construct();
|
||||
|
||||
|
||||
|
||||
String* mBody = null;
|
||||
|
||||
|
||||
|
||||
String url(L"/user/{username}");
|
||||
|
||||
|
||||
String s_username(L"{");
|
||||
s_username.Append(L"username");
|
||||
s_username.Append(L"}");
|
||||
url.Replace(s_username, stringify(username, L"String*"));
|
||||
|
||||
|
||||
client->execute(SamiUserApi::getBasePath(), url, "DELETE", (IMap*)queryParams, mBody, (IMap*)headerParams, null, L"application/json");
|
||||
|
||||
}
|
||||
|
||||
|
||||
} /* namespace Swagger */
|
||||
|
@ -18,31 +18,22 @@ public:
|
||||
SamiUserApi();
|
||||
virtual ~SamiUserApi();
|
||||
|
||||
|
||||
void
|
||||
createUserWithCompletion(SamiUser* body, void(* handler)(SamiError*));
|
||||
|
||||
void
|
||||
createUsersWithArrayInputWithCompletion(IList* body, void(* handler)(SamiError*));
|
||||
|
||||
void
|
||||
createUsersWithListInputWithCompletion(IList* body, void(* handler)(SamiError*));
|
||||
|
||||
String*
|
||||
loginUserWithCompletion(String* username, String* password, void (* handler)(String*, SamiError*));
|
||||
|
||||
void
|
||||
logoutUserWithCompletion( void(* handler)(SamiError*));
|
||||
|
||||
SamiUser*
|
||||
getUserByNameWithCompletion(String* username, void (* handler)(SamiUser*, SamiError*));
|
||||
|
||||
void
|
||||
updateUserWithCompletion(String* username, SamiUser* body, void(* handler)(SamiError*));
|
||||
|
||||
void
|
||||
deleteUserWithCompletion(String* username, void(* handler)(SamiError*));
|
||||
|
||||
SamiUser*
|
||||
getUserByNameWithCompletion(String* username, void (* handler)(SamiUser*, SamiError*));
|
||||
String*
|
||||
loginUserWithCompletion(String* username, String* password, void (* handler)(String*, SamiError*));
|
||||
void
|
||||
logoutUserWithCompletion( void(* handler)(SamiError*));
|
||||
void
|
||||
updateUserWithCompletion(String* username, SamiUser* body, void(* handler)(SamiError*));
|
||||
static String getBasePath() {
|
||||
return L"http://petstore.swagger.io/v2";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user