Merge remote-tracking branch 'origin/4.2.x' into 5.0.x

This commit is contained in:
William Cheng
2019-09-22 21:00:38 +08:00
2432 changed files with 40079 additions and 14159 deletions

View File

@@ -84,7 +84,7 @@ Pet <- R6::R6Class(
}
if (!is.null(self$`tags`)) {
PetObject[['tags']] <-
sapply(self$`tags`, function(x) x$toJSON())
lapply(self$`tags`, function(x) x$toJSON())
}
if (!is.null(self$`status`)) {
PetObject[['status']] <-
@@ -151,7 +151,7 @@ Pet <- R6::R6Class(
'"tags":
[%s]
',
paste(unlist(lapply(self$`tags`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA))), collapse=",")
paste(sapply(self$`tags`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
)},
if (!is.null(self$`status`)) {
sprintf(

View File

@@ -336,6 +336,8 @@ PetApi <- R6::R6Class(
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -384,6 +386,8 @@ PetApi <- R6::R6Class(
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -432,6 +436,8 @@ PetApi <- R6::R6Class(
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -482,6 +488,8 @@ PetApi <- R6::R6Class(
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -532,6 +540,8 @@ PetApi <- R6::R6Class(
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -586,6 +596,8 @@ PetApi <- R6::R6Class(
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -634,6 +646,8 @@ PetApi <- R6::R6Class(
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -685,6 +699,8 @@ PetApi <- R6::R6Class(
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {

View File

@@ -179,6 +179,8 @@ StoreApi <- R6::R6Class(
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -223,6 +225,8 @@ StoreApi <- R6::R6Class(
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -269,6 +273,8 @@ StoreApi <- R6::R6Class(
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -319,6 +325,8 @@ StoreApi <- R6::R6Class(
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {

View File

@@ -296,6 +296,8 @@ UserApi <- R6::R6Class(
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -342,6 +344,8 @@ UserApi <- R6::R6Class(
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -389,6 +393,8 @@ UserApi <- R6::R6Class(
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -436,6 +442,8 @@ UserApi <- R6::R6Class(
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -480,6 +488,8 @@ UserApi <- R6::R6Class(
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -530,6 +540,8 @@ UserApi <- R6::R6Class(
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -584,6 +596,8 @@ UserApi <- R6::R6Class(
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
@@ -620,6 +634,8 @@ UserApi <- R6::R6Class(
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {

View File

@@ -1,11 +1,17 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4
if [ "$git_host" = "" ]; then
git_host="github.com"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
@@ -37,9 +43,9 @@ if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
@@ -47,6 +53,6 @@ fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@@ -47,7 +47,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<version>3.8.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>

View File

@@ -1 +1 @@
4.1.0-SNAPSHOT
4.1.2-SNAPSHOT

View File

@@ -13,13 +13,13 @@
#include "OAIApiResponse.h"
#include "OAIHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
#include "OAIHelpers.h"
namespace OpenAPI {
OAIApiResponse::OAIApiResponse(QString json) {
@@ -81,13 +81,13 @@ OAIApiResponse::asJson () const {
QJsonObject
OAIApiResponse::asJsonObject() const {
QJsonObject obj;
if(m_code_isSet){
if(m_code_isSet){
obj.insert(QString("code"), ::OpenAPI::toJsonValue(code));
}
if(m_type_isSet){
if(m_type_isSet){
obj.insert(QString("type"), ::OpenAPI::toJsonValue(type));
}
if(m_message_isSet){
if(m_message_isSet){
obj.insert(QString("message"), ::OpenAPI::toJsonValue(message));
}
return obj;

View File

@@ -27,6 +27,7 @@
#include "OAIObject.h"
#include "OAIEnum.h"
namespace OpenAPI {
class OAIApiResponse: public OAIObject {

View File

@@ -13,13 +13,13 @@
#include "OAICategory.h"
#include "OAIHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
#include "OAIHelpers.h"
namespace OpenAPI {
OAICategory::OAICategory(QString json) {
@@ -75,10 +75,10 @@ OAICategory::asJson () const {
QJsonObject
OAICategory::asJsonObject() const {
QJsonObject obj;
if(m_id_isSet){
if(m_id_isSet){
obj.insert(QString("id"), ::OpenAPI::toJsonValue(id));
}
if(m_name_isSet){
if(m_name_isSet){
obj.insert(QString("name"), ::OpenAPI::toJsonValue(name));
}
return obj;

View File

@@ -27,6 +27,7 @@
#include "OAIObject.h"
#include "OAIEnum.h"
namespace OpenAPI {
class OAICategory: public OAIObject {

View File

@@ -64,11 +64,23 @@ toStringValue(const double &value){
return QString::number(value);
}
QString
toStringValue(const OAIObject &value){
return value.asJson();
}
QString
toStringValue(const OAIEnum &value){
return value.asJson();
}
QString
toStringValue(const OAIHttpFileElement &value){
return value.asJson();
}
QJsonValue
toJsonValue(const QString &value){
return QJsonValue(value);
@@ -124,6 +136,12 @@ toJsonValue(const OAIEnum &value){
return value.asJsonValue();
}
QJsonValue
toJsonValue(const OAIHttpFileElement &value){
return value.asJsonValue();
}
bool
fromStringValue(const QString &inStr, QString &value){
value.clear();
@@ -218,6 +236,11 @@ fromStringValue(const QString &inStr, OAIEnum &value){
return true;
}
bool
fromStringValue(const QString &inStr, OAIHttpFileElement &value){
return value.fromStringValue(inStr);
}
bool
fromJsonValue(QString &value, const QJsonValue &jval){
bool ok = true;
@@ -346,4 +369,9 @@ fromJsonValue(OAIEnum &value, const QJsonValue &jval){
return true;
}
bool
fromJsonValue(OAIHttpFileElement &value, const QJsonValue &jval){
return value.fromJsonValue(jval);
}
}

View File

@@ -22,8 +22,10 @@
#include <QByteArray>
#include <QDate>
#include <QVariant>
#include "OAIObject.h"
#include "OAIEnum.h"
#include "OAIHttpFileElement.h"
namespace OpenAPI {
@@ -36,7 +38,9 @@ namespace OpenAPI {
QString toStringValue(const bool &value);
QString toStringValue(const float &value);
QString toStringValue(const double &value);
QString toStringValue(const OAIEnum &value);
QString toStringValue(const OAIObject &value);
QString toStringValue(const OAIEnum &value);
QString toStringValue(const OAIHttpFileElement &value);
template <typename T>
QString toStringValue(const QList<T> &val) {
@@ -61,6 +65,7 @@ namespace OpenAPI {
QJsonValue toJsonValue(const double &value);
QJsonValue toJsonValue(const OAIObject &value);
QJsonValue toJsonValue(const OAIEnum &value);
QJsonValue toJsonValue(const OAIHttpFileElement &value);
template <typename T>
QJsonValue toJsonValue(const QList<T> &val) {
@@ -89,7 +94,9 @@ namespace OpenAPI {
bool fromStringValue(const QString &inStr, bool &value);
bool fromStringValue(const QString &inStr, float &value);
bool fromStringValue(const QString &inStr, double &value);
bool fromStringValue(const QString &inStr, OAIEnum &value);
bool fromStringValue(const QString &inStr, OAIObject &value);
bool fromStringValue(const QString &inStr, OAIEnum &value);
bool fromStringValue(const QString &inStr, OAIHttpFileElement &value);
template <typename T>
bool fromStringValue(const QList<QString> &inStr, QList<T> &val) {
@@ -124,6 +131,7 @@ namespace OpenAPI {
bool fromJsonValue(double &value, const QJsonValue &jval);
bool fromJsonValue(OAIObject &value, const QJsonValue &jval);
bool fromJsonValue(OAIEnum &value, const QJsonValue &jval);
bool fromJsonValue(OAIHttpFileElement &value, const QJsonValue &jval);
template <typename T>
bool fromJsonValue(QList<T> &val, const QJsonValue &jval) {

View File

@@ -0,0 +1,162 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include <QDebug>
#include <QFile>
#include <QJsonDocument>
#include <QJsonObject>
#include "OAIHttpFileElement.h"
namespace OpenAPI {
void
OAIHttpFileElement::setMimeType(const QString &mime){
mime_type = mime;
}
void
OAIHttpFileElement::setFileName(const QString &name){
local_filename = name;
}
void
OAIHttpFileElement::setVariableName(const QString &name){
variable_name = name;
}
void
OAIHttpFileElement::setRequestFileName(const QString &name){
request_filename = name;
}
bool
OAIHttpFileElement::isSet() const {
return !local_filename.isEmpty() || !request_filename.isEmpty();
}
QString
OAIHttpFileElement::asJson() const{
QFile file(local_filename);
QByteArray bArray;
bool result = false;
if(file.exists()) {
result = file.open(QIODevice::ReadOnly);
bArray = file.readAll();
file.close();
}
if(!result) {
qDebug() << "Error opening file " << local_filename;
}
return QString(bArray);
}
QJsonValue
OAIHttpFileElement::asJsonValue() const{
QFile file(local_filename);
QByteArray bArray;
bool result = false;
if(file.exists()) {
result = file.open(QIODevice::ReadOnly);
bArray = file.readAll();
file.close();
}
if(!result) {
qDebug() << "Error opening file " << local_filename;
}
return QJsonDocument::fromBinaryData(bArray.data()).object();
}
bool
OAIHttpFileElement::fromStringValue(const QString &instr){
QFile file(local_filename);
bool result = false;
if(file.exists()) {
file.remove();
}
result = file.open(QIODevice::WriteOnly);
file.write(instr.toUtf8());
file.close();
if(!result) {
qDebug() << "Error creating file " << local_filename;
}
return result;
}
bool
OAIHttpFileElement::fromJsonValue(const QJsonValue &jval) {
QFile file(local_filename);
bool result = false;
if(file.exists()) {
file.remove();
}
result = file.open(QIODevice::WriteOnly);
file.write(QJsonDocument(jval.toObject()).toBinaryData());
file.close();
if(!result) {
qDebug() << "Error creating file " << local_filename;
}
return result;
}
QByteArray
OAIHttpFileElement::asByteArray() const {
QFile file(local_filename);
QByteArray bArray;
bool result = false;
if(file.exists()) {
result = file.open(QIODevice::ReadOnly);
bArray = file.readAll();
file.close();
}
if(!result) {
qDebug() << "Error opening file " << local_filename;
}
return bArray;
}
bool
OAIHttpFileElement::fromByteArray(const QByteArray& bytes){
QFile file(local_filename);
bool result = false;
if(file.exists()){
file.remove();
}
result = file.open(QIODevice::WriteOnly);
file.write(bytes);
file.close();
if(!result) {
qDebug() << "Error creating file " << local_filename;
}
return result;
}
bool
OAIHttpFileElement::saveToFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime, const QByteArray& bytes){
setMimeType(mime);
setFileName(localFName);
setVariableName(varName);
setRequestFileName(reqFname);
return fromByteArray(bytes);
}
QByteArray
OAIHttpFileElement::loadFromFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime){
setMimeType(mime);
setFileName(localFName);
setVariableName(varName);
setRequestFileName(reqFname);
return asByteArray();
}
}

View File

@@ -0,0 +1,49 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#ifndef OAI_HTTP_FILE_ELEMENT_H
#define OAI_HTTP_FILE_ELEMENT_H
#include <QJsonValue>
#include <QMetaType>
#include <QString>
namespace OpenAPI {
class OAIHttpFileElement {
public:
QString variable_name;
QString local_filename;
QString request_filename;
QString mime_type;
void setMimeType(const QString &mime);
void setFileName(const QString &name);
void setVariableName(const QString &name);
void setRequestFileName(const QString &name);
bool isSet() const;
bool fromStringValue(const QString &instr);
bool fromJsonValue(const QJsonValue &jval);
bool fromByteArray(const QByteArray& bytes);
bool saveToFile(const QString &variable_name, const QString &local_filename, const QString &request_filename, const QString &mime, const QByteArray& bytes);
QString asJson() const;
QJsonValue asJsonValue() const;
QByteArray asByteArray() const;
QByteArray loadFromFile(const QString &variable_name, const QString &local_filename, const QString &request_filename, const QString &mime);
};
}
Q_DECLARE_METATYPE(OpenAPI::OAIHttpFileElement)
#endif // OAI_HTTP_FILE_ELEMENT_H

View File

@@ -10,13 +10,18 @@
* Do not edit the class manually.
*/
#include "OAIHttpRequest.h"
#include <QDateTime>
#include <QDir>
#include <QUuid>
#include <QUrl>
#include <QFileInfo>
#include <QBuffer>
#include <QtGlobal>
#include "OAIHttpRequest.h"
namespace OpenAPI {
@@ -41,7 +46,7 @@ void OAIHttpRequestInput::add_var(QString key, QString value) {
}
void OAIHttpRequestInput::add_file(QString variable_name, QString local_filename, QString request_filename, QString mime_type) {
OAIHttpRequestInputFileElement file;
OAIHttpFileElement file;
file.variable_name = variable_name;
file.local_filename = local_filename;
file.request_filename = request_filename;
@@ -57,6 +62,7 @@ OAIHttpRequestWorker::OAIHttpRequestWorker(QObject *parent)
timeout = 0;
timer = new QTimer();
manager = new QNetworkAccessManager(this);
workingDirectory = QDir::currentPath();
connect(manager, &QNetworkAccessManager::finished, this, &OAIHttpRequestWorker::on_manager_finished);
}
@@ -67,16 +73,50 @@ OAIHttpRequestWorker::~OAIHttpRequestWorker() {
}
timer->deleteLater();
}
for (const auto & item: multiPartFields) {
if(item != nullptr) {
delete item;
}
}
}
QMap<QByteArray, QByteArray> OAIHttpRequestWorker::getResponseHeaders() const {
QMap<QString, QString> OAIHttpRequestWorker::getResponseHeaders() const {
return headers;
}
OAIHttpFileElement OAIHttpRequestWorker::getHttpFileElement(const QString &fieldname){
if(!files.isEmpty()){
if(fieldname.isEmpty()){
return files.first();
}else if (files.contains(fieldname)){
return files[fieldname];
}
}
return OAIHttpFileElement();
}
QByteArray *OAIHttpRequestWorker::getMultiPartField(const QString &fieldname){
if(!multiPartFields.isEmpty()){
if(fieldname.isEmpty()){
return multiPartFields.first();
}else if (multiPartFields.contains(fieldname)){
return multiPartFields[fieldname];
}
}
return nullptr;
}
void OAIHttpRequestWorker::setTimeOut(int tout){
timeout = tout;
}
void OAIHttpRequestWorker::setWorkingDirectory(const QString &path){
if(!path.isEmpty()){
workingDirectory = path;
}
}
QString OAIHttpRequestWorker::http_attribute_encode(QString attribute_name, QString input) {
// result structure follows RFC 5987
bool need_utf_encoding = false;
@@ -205,7 +245,7 @@ void OAIHttpRequestWorker::execute(OAIHttpRequestInput *input) {
}
// add files
for (QList<OAIHttpRequestInputFileElement>::iterator file_info = input->files.begin(); file_info != input->files.end(); file_info++) {
for (QList<OAIHttpFileElement>::iterator file_info = input->files.begin(); file_info != input->files.end(); file_info++) {
QFileInfo fi(file_info->local_filename);
// ensure necessary variables are available
@@ -285,8 +325,13 @@ void OAIHttpRequestWorker::execute(OAIHttpRequestInput *input) {
request.setRawHeader(key.toStdString().c_str(), input->headers.value(key).toStdString().c_str());
}
if (request_content.size() > 0 && !isFormData) {
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
if (request_content.size() > 0 && !isFormData && (input->var_layout != MULTIPART)) {
if(!input->headers.contains("Content-Type")){
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
}
else {
request.setHeader(QNetworkRequest::ContentTypeHeader, input->headers.value("Content-Type"));
}
}
else if (input->var_layout == URL_ENCODED) {
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
@@ -340,9 +385,10 @@ void OAIHttpRequestWorker::on_manager_finished(QNetworkReply *reply) {
}
}
reply->deleteLater();
process_form_response();
emit on_execution_finished(this);
}
void OAIHttpRequestWorker::on_manager_timeout(QNetworkReply *reply) {
error_type = QNetworkReply::TimeoutError;
response = "";
@@ -350,9 +396,37 @@ void OAIHttpRequestWorker::on_manager_timeout(QNetworkReply *reply) {
disconnect(manager, nullptr, nullptr, nullptr);
reply->abort();
reply->deleteLater();
emit on_execution_finished(this);
}
void OAIHttpRequestWorker::process_form_response() {
if(getResponseHeaders().contains(QString("Content-Disposition")) ) {
auto contentDisposition = getResponseHeaders().value(QString("Content-Disposition").toUtf8()).split(QString(";"), QString::SkipEmptyParts);
auto contentType = getResponseHeaders().contains(QString("Content-Type")) ? getResponseHeaders().value(QString("Content-Type").toUtf8()).split(QString(";"), QString::SkipEmptyParts).first() : QString();
if((contentDisposition.count() > 0) && (contentDisposition.first() == QString("attachment"))){
QString filename = QUuid::createUuid().toString();
for(const auto &file : contentDisposition){
if(file.contains(QString("filename"))){
filename = file.split(QString("="), QString::SkipEmptyParts).at(1);
break;
}
}
OAIHttpFileElement felement;
felement.saveToFile(QString(), workingDirectory + QDir::separator() + filename, filename, contentType, response.data());
files.insert(filename, felement);
}
} else if(getResponseHeaders().contains(QString("Content-Type")) ) {
auto contentType = getResponseHeaders().value(QString("Content-Type").toUtf8()).split(QString(";"), QString::SkipEmptyParts);
if((contentType.count() > 0) && (contentType.first() == QString("multipart/form-data"))){
}
else {
}
}
}
QSslConfiguration* OAIHttpRequestWorker::sslDefaultConfiguration;

View File

@@ -27,21 +27,12 @@
#include <QNetworkReply>
#include "OAIHttpFileElement.h"
namespace OpenAPI {
enum OAIHttpRequestVarLayout {NOT_SET, ADDRESS, URL_ENCODED, MULTIPART};
class OAIHttpRequestInputFileElement {
public:
QString variable_name;
QString local_filename;
QString request_filename;
QString mime_type;
};
class OAIHttpRequestInput {
@@ -51,7 +42,7 @@ public:
OAIHttpRequestVarLayout var_layout;
QMap<QString, QString> vars;
QMap<QString, QString> headers;
QList<OAIHttpRequestInputFileElement> files;
QList<OAIHttpFileElement> files;
QByteArray request_body;
OAIHttpRequestInput();
@@ -74,19 +65,26 @@ public:
explicit OAIHttpRequestWorker(QObject *parent = nullptr);
virtual ~OAIHttpRequestWorker();
QMap<QByteArray, QByteArray> getResponseHeaders() const;
QMap<QString, QString> getResponseHeaders() const;
QString http_attribute_encode(QString attribute_name, QString input);
void execute(OAIHttpRequestInput *input);
static QSslConfiguration* sslDefaultConfiguration;
void setTimeOut(int tout);
void setWorkingDirectory(const QString &path);
OAIHttpFileElement getHttpFileElement(const QString &fieldname = QString());
QByteArray* getMultiPartField(const QString &fieldname = QString());
signals:
void on_execution_finished(OAIHttpRequestWorker *worker);
private:
QNetworkAccessManager *manager;
QMap<QByteArray, QByteArray> headers;
QMap<QString, QString> headers;
QMap<QString, OAIHttpFileElement> files;
QMap<QString, QByteArray*> multiPartFields;
QString workingDirectory;
int timeout;
void on_manager_timeout(QNetworkReply *reply);
void process_form_response();
private slots:
void on_manager_finished(QNetworkReply *reply);
};

View File

@@ -13,13 +13,13 @@
#include "OAIOrder.h"
#include "OAIHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
#include "OAIHelpers.h"
namespace OpenAPI {
OAIOrder::OAIOrder(QString json) {
@@ -99,22 +99,22 @@ OAIOrder::asJson () const {
QJsonObject
OAIOrder::asJsonObject() const {
QJsonObject obj;
if(m_id_isSet){
if(m_id_isSet){
obj.insert(QString("id"), ::OpenAPI::toJsonValue(id));
}
if(m_pet_id_isSet){
if(m_pet_id_isSet){
obj.insert(QString("petId"), ::OpenAPI::toJsonValue(pet_id));
}
if(m_quantity_isSet){
if(m_quantity_isSet){
obj.insert(QString("quantity"), ::OpenAPI::toJsonValue(quantity));
}
if(m_ship_date_isSet){
if(m_ship_date_isSet){
obj.insert(QString("shipDate"), ::OpenAPI::toJsonValue(ship_date));
}
if(m_status_isSet){
if(m_status_isSet){
obj.insert(QString("status"), ::OpenAPI::toJsonValue(status));
}
if(m_complete_isSet){
if(m_complete_isSet){
obj.insert(QString("complete"), ::OpenAPI::toJsonValue(complete));
}
return obj;

View File

@@ -28,6 +28,7 @@
#include "OAIObject.h"
#include "OAIEnum.h"
namespace OpenAPI {
class OAIOrder: public OAIObject {

View File

@@ -13,13 +13,13 @@
#include "OAIPet.h"
#include "OAIHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
#include "OAIHelpers.h"
namespace OpenAPI {
OAIPet::OAIPet(QString json) {
@@ -99,24 +99,24 @@ OAIPet::asJson () const {
QJsonObject
OAIPet::asJsonObject() const {
QJsonObject obj;
if(m_id_isSet){
if(m_id_isSet){
obj.insert(QString("id"), ::OpenAPI::toJsonValue(id));
}
if(category.isSet()){
if(category.isSet()){
obj.insert(QString("category"), ::OpenAPI::toJsonValue(category));
}
if(m_name_isSet){
if(m_name_isSet){
obj.insert(QString("name"), ::OpenAPI::toJsonValue(name));
}
if(photo_urls.size() > 0){
obj.insert(QString("photoUrls"), ::OpenAPI::toJsonValue(photo_urls));
}
if(tags.size() > 0){
obj.insert(QString("tags"), ::OpenAPI::toJsonValue(tags));
}
if(m_status_isSet){
if(m_status_isSet){
obj.insert(QString("status"), ::OpenAPI::toJsonValue(status));
}
return obj;

View File

@@ -30,6 +30,7 @@
#include "OAIObject.h"
#include "OAIEnum.h"
namespace OpenAPI {
class OAIPet: public OAIObject {

View File

@@ -46,6 +46,10 @@ void OAIPetApi::setApiTimeOutMs(const int tout){
timeout = tout;
}
void OAIPetApi::setWorkingDirectory(const QString& path){
workingDirectory = path;
}
void OAIPetApi::addHeaders(const QString& key, const QString& value){
defaultHeaders.insert(key, value);
}
@@ -58,8 +62,9 @@ OAIPetApi::addPet(const OAIPet& body) {
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout);
worker->setWorkingDirectory(workingDirectory);
OAIHttpRequestInput input(fullPath, "POST");
QString output = body.asJson();
input.request_body.append(output);
@@ -110,7 +115,9 @@ OAIPetApi::deletePet(const qint64& pet_id, const QString& api_key) {
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout);
worker->setWorkingDirectory(workingDirectory);
OAIHttpRequestInput input(fullPath, "DELETE");
if (api_key != nullptr) {
input.headers.insert("api_key", api_key);
@@ -198,7 +205,9 @@ OAIPetApi::findPetsByStatus(const QList<QString>& status) {
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout);
worker->setWorkingDirectory(workingDirectory);
OAIHttpRequestInput input(fullPath, "GET");
foreach(QString key, this->defaultHeaders.keys()) {
@@ -293,7 +302,9 @@ OAIPetApi::findPetsByTags(const QList<QString>& tags) {
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout);
worker->setWorkingDirectory(workingDirectory);
OAIHttpRequestInput input(fullPath, "GET");
foreach(QString key, this->defaultHeaders.keys()) {
@@ -351,7 +362,9 @@ OAIPetApi::getPetById(const qint64& pet_id) {
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout);
worker->setWorkingDirectory(workingDirectory);
OAIHttpRequestInput input(fullPath, "GET");
foreach(QString key, this->defaultHeaders.keys()) {
@@ -397,8 +410,9 @@ OAIPetApi::updatePet(const OAIPet& body) {
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout);
worker->setWorkingDirectory(workingDirectory);
OAIHttpRequestInput input(fullPath, "PUT");
QString output = body.asJson();
input.request_body.append(output);
@@ -449,14 +463,12 @@ OAIPetApi::updatePetWithForm(const qint64& pet_id, const QString& name, const QS
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout);
worker->setWorkingDirectory(workingDirectory);
OAIHttpRequestInput input(fullPath, "POST");
if (name != nullptr) {
input.add_var("name", name);
}
if (status != nullptr) {
input.add_var("status", status);
}
input.add_var("name", ::OpenAPI::toStringValue(name));
input.add_var("status", ::OpenAPI::toStringValue(status));
foreach(QString key, this->defaultHeaders.keys()) {
input.headers.insert(key, this->defaultHeaders.value(key));
@@ -494,7 +506,7 @@ OAIPetApi::updatePetWithFormCallback(OAIHttpRequestWorker * worker) {
}
void
OAIPetApi::uploadFile(const qint64& pet_id, const QString& additional_metadata, const OAIHttpRequestInputFileElement*& file) {
OAIPetApi::uploadFile(const qint64& pet_id, const QString& additional_metadata, const OAIHttpFileElement& file) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/pet/{petId}/uploadImage");
QString pet_idPathParam("{");
@@ -503,14 +515,12 @@ OAIPetApi::uploadFile(const qint64& pet_id, const QString& additional_metadata,
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout);
worker->setWorkingDirectory(workingDirectory);
OAIHttpRequestInput input(fullPath, "POST");
if (additional_metadata != nullptr) {
input.add_var("additionalMetadata", additional_metadata);
}
if (file != nullptr) {
input.add_file("file", (*file).local_filename, (*file).request_filename, (*file).mime_type);
}
input.add_var("additionalMetadata", ::OpenAPI::toStringValue(additional_metadata));
input.add_file("file", file.local_filename, file.request_filename, file.mime_type);
foreach(QString key, this->defaultHeaders.keys()) {
input.headers.insert(key, this->defaultHeaders.value(key));

View File

@@ -16,7 +16,7 @@
#include "OAIHttpRequest.h"
#include "OAIApiResponse.h"
#include "OAIHttpRequest.h"
#include "OAIHttpFileElement.h"
#include "OAIPet.h"
#include <QString>
@@ -35,6 +35,7 @@ public:
void setBasePath(const QString& basePath);
void setHost(const QString& host);
void setApiTimeOutMs(const int tout);
void setWorkingDirectory(const QString& path);
void addHeaders(const QString& key, const QString& value);
void addPet(const OAIPet& body);
@@ -44,11 +45,12 @@ public:
void getPetById(const qint64& pet_id);
void updatePet(const OAIPet& body);
void updatePetWithForm(const qint64& pet_id, const QString& name, const QString& status);
void uploadFile(const qint64& pet_id, const QString& additional_metadata, const OAIHttpRequestInputFileElement*& file);
void uploadFile(const qint64& pet_id, const QString& additional_metadata, const OAIHttpFileElement& file);
private:
QString basePath;
QString host;
QString workingDirectory;
int timeout;
QMap<QString, QString> defaultHeaders;
void addPetCallback (OAIHttpRequestWorker * worker);

View File

@@ -46,6 +46,10 @@ void OAIStoreApi::setApiTimeOutMs(const int tout){
timeout = tout;
}
void OAIStoreApi::setWorkingDirectory(const QString& path){
workingDirectory = path;
}
void OAIStoreApi::addHeaders(const QString& key, const QString& value){
defaultHeaders.insert(key, value);
}
@@ -61,7 +65,9 @@ OAIStoreApi::deleteOrder(const QString& order_id) {
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout);
worker->setWorkingDirectory(workingDirectory);
OAIHttpRequestInput input(fullPath, "DELETE");
foreach(QString key, this->defaultHeaders.keys()) {
@@ -106,7 +112,9 @@ OAIStoreApi::getInventory() {
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout);
worker->setWorkingDirectory(workingDirectory);
OAIHttpRequestInput input(fullPath, "GET");
foreach(QString key, this->defaultHeaders.keys()) {
@@ -164,7 +172,9 @@ OAIStoreApi::getOrderById(const qint64& order_id) {
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout);
worker->setWorkingDirectory(workingDirectory);
OAIHttpRequestInput input(fullPath, "GET");
foreach(QString key, this->defaultHeaders.keys()) {
@@ -210,8 +220,9 @@ OAIStoreApi::placeOrder(const OAIOrder& body) {
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout);
worker->setWorkingDirectory(workingDirectory);
OAIHttpRequestInput input(fullPath, "POST");
QString output = body.asJson();
input.request_body.append(output);

View File

@@ -34,6 +34,7 @@ public:
void setBasePath(const QString& basePath);
void setHost(const QString& host);
void setApiTimeOutMs(const int tout);
void setWorkingDirectory(const QString& path);
void addHeaders(const QString& key, const QString& value);
void deleteOrder(const QString& order_id);
@@ -44,6 +45,7 @@ public:
private:
QString basePath;
QString host;
QString workingDirectory;
int timeout;
QMap<QString, QString> defaultHeaders;
void deleteOrderCallback (OAIHttpRequestWorker * worker);

View File

@@ -13,13 +13,13 @@
#include "OAITag.h"
#include "OAIHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
#include "OAIHelpers.h"
namespace OpenAPI {
OAITag::OAITag(QString json) {
@@ -75,10 +75,10 @@ OAITag::asJson () const {
QJsonObject
OAITag::asJsonObject() const {
QJsonObject obj;
if(m_id_isSet){
if(m_id_isSet){
obj.insert(QString("id"), ::OpenAPI::toJsonValue(id));
}
if(m_name_isSet){
if(m_name_isSet){
obj.insert(QString("name"), ::OpenAPI::toJsonValue(name));
}
return obj;

View File

@@ -27,6 +27,7 @@
#include "OAIObject.h"
#include "OAIEnum.h"
namespace OpenAPI {
class OAITag: public OAIObject {

View File

@@ -13,13 +13,13 @@
#include "OAIUser.h"
#include "OAIHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
#include "OAIHelpers.h"
namespace OpenAPI {
OAIUser::OAIUser(QString json) {
@@ -111,28 +111,28 @@ OAIUser::asJson () const {
QJsonObject
OAIUser::asJsonObject() const {
QJsonObject obj;
if(m_id_isSet){
if(m_id_isSet){
obj.insert(QString("id"), ::OpenAPI::toJsonValue(id));
}
if(m_username_isSet){
if(m_username_isSet){
obj.insert(QString("username"), ::OpenAPI::toJsonValue(username));
}
if(m_first_name_isSet){
if(m_first_name_isSet){
obj.insert(QString("firstName"), ::OpenAPI::toJsonValue(first_name));
}
if(m_last_name_isSet){
if(m_last_name_isSet){
obj.insert(QString("lastName"), ::OpenAPI::toJsonValue(last_name));
}
if(m_email_isSet){
if(m_email_isSet){
obj.insert(QString("email"), ::OpenAPI::toJsonValue(email));
}
if(m_password_isSet){
if(m_password_isSet){
obj.insert(QString("password"), ::OpenAPI::toJsonValue(password));
}
if(m_phone_isSet){
if(m_phone_isSet){
obj.insert(QString("phone"), ::OpenAPI::toJsonValue(phone));
}
if(m_user_status_isSet){
if(m_user_status_isSet){
obj.insert(QString("userStatus"), ::OpenAPI::toJsonValue(user_status));
}
return obj;

View File

@@ -27,6 +27,7 @@
#include "OAIObject.h"
#include "OAIEnum.h"
namespace OpenAPI {
class OAIUser: public OAIObject {

View File

@@ -46,6 +46,10 @@ void OAIUserApi::setApiTimeOutMs(const int tout){
timeout = tout;
}
void OAIUserApi::setWorkingDirectory(const QString& path){
workingDirectory = path;
}
void OAIUserApi::addHeaders(const QString& key, const QString& value){
defaultHeaders.insert(key, value);
}
@@ -58,8 +62,9 @@ OAIUserApi::createUser(const OAIUser& body) {
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout);
worker->setWorkingDirectory(workingDirectory);
OAIHttpRequestInput input(fullPath, "POST");
QString output = body.asJson();
input.request_body.append(output);
@@ -107,8 +112,9 @@ OAIUserApi::createUsersWithArrayInput(const QList<OAIUser>& body) {
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout);
worker->setWorkingDirectory(workingDirectory);
OAIHttpRequestInput input(fullPath, "POST");
QJsonDocument doc(::OpenAPI::toJsonValue(body).toArray());
QByteArray bytes = doc.toJson();
@@ -157,8 +163,9 @@ OAIUserApi::createUsersWithListInput(const QList<OAIUser>& body) {
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout);
worker->setWorkingDirectory(workingDirectory);
OAIHttpRequestInput input(fullPath, "POST");
QJsonDocument doc(::OpenAPI::toJsonValue(body).toArray());
QByteArray bytes = doc.toJson();
@@ -210,7 +217,9 @@ OAIUserApi::deleteUser(const QString& username) {
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout);
worker->setWorkingDirectory(workingDirectory);
OAIHttpRequestInput input(fullPath, "DELETE");
foreach(QString key, this->defaultHeaders.keys()) {
@@ -258,7 +267,9 @@ OAIUserApi::getUserByName(const QString& username) {
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout);
worker->setWorkingDirectory(workingDirectory);
OAIHttpRequestInput input(fullPath, "GET");
foreach(QString key, this->defaultHeaders.keys()) {
@@ -320,7 +331,9 @@ OAIUserApi::loginUser(const QString& username, const QString& password) {
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout);
worker->setWorkingDirectory(workingDirectory);
OAIHttpRequestInput input(fullPath, "GET");
foreach(QString key, this->defaultHeaders.keys()) {
@@ -367,7 +380,9 @@ OAIUserApi::logoutUser() {
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout);
worker->setWorkingDirectory(workingDirectory);
OAIHttpRequestInput input(fullPath, "GET");
foreach(QString key, this->defaultHeaders.keys()) {
@@ -415,8 +430,9 @@ OAIUserApi::updateUser(const QString& username, const OAIUser& body) {
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout);
worker->setWorkingDirectory(workingDirectory);
OAIHttpRequestInput input(fullPath, "PUT");
QString output = body.asJson();
input.request_body.append(output);

View File

@@ -34,6 +34,7 @@ public:
void setBasePath(const QString& basePath);
void setHost(const QString& host);
void setApiTimeOutMs(const int tout);
void setWorkingDirectory(const QString& path);
void addHeaders(const QString& key, const QString& value);
void createUser(const OAIUser& body);
@@ -48,6 +49,7 @@ public:
private:
QString basePath;
QString host;
QString workingDirectory;
int timeout;
QMap<QString, QString> defaultHeaders;
void createUserCallback (OAIHttpRequestWorker * worker);

View File

@@ -15,8 +15,9 @@ HEADERS += \
# Others
$${PWD}/OAIHelpers.h \
$${PWD}/OAIHttpRequest.h \
$${PWD}/OAIObject.h
$${PWD}/OAIEnum.h
$${PWD}/OAIObject.h \
$${PWD}/OAIEnum.h \
$${PWD}/OAIHttpFileElement.h
SOURCES += \
# Models
@@ -32,5 +33,6 @@ SOURCES += \
$${PWD}/OAIUserApi.cpp \
# Others
$${PWD}/OAIHelpers.cpp \
$${PWD}/OAIHttpRequest.cpp
$${PWD}/OAIHttpRequest.cpp \
$${PWD}/OAIHttpFileElement.cpp

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -129,8 +129,8 @@ std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t&
content->setName( name );
content->setContentDisposition( utility::conversions::to_string_t("form-data") );
content->setContentType( contentType );
std::stringstream* valueAsStringStream = new std::stringstream();
(*valueAsStringStream) << value;
std::stringstream* valueAsStringStream = new std::stringstream();
(*valueAsStringStream) << value;
content->setData( std::shared_ptr<std::istream>( valueAsStringStream ) );
return content;
}
@@ -140,8 +140,8 @@ std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t&
content->setName( name );
content->setContentDisposition( utility::conversions::to_string_t("form-data") );
content->setContentType( contentType );
std::stringstream* valueAsStringStream = new std::stringstream();
(*valueAsStringStream) << value;
std::stringstream* valueAsStringStream = new std::stringstream();
(*valueAsStringStream) << value;
content->setData( std::shared_ptr<std::istream>( valueAsStringStream) ) ;
return content;
}
@@ -151,8 +151,8 @@ std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t&
content->setName( name );
content->setContentDisposition( utility::conversions::to_string_t("form-data") );
content->setContentType( contentType );
std::stringstream* valueAsStringStream = new std::stringstream();
(*valueAsStringStream) << value;
std::stringstream* valueAsStringStream = new std::stringstream();
(*valueAsStringStream) << value;
content->setData( std::shared_ptr<std::istream>( valueAsStringStream ) );
return content;
}
@@ -296,7 +296,7 @@ utility::string_t ModelBase::stringFromJson(const web::json::value& val)
utility::datetime ModelBase::dateFromJson(const web::json::value& val)
{
return val.is_null() ? utility::datetime::from_string(L"NULL", utility::datetime::ISO_8601) : utility::datetime::from_string(val.as_string(), utility::datetime::ISO_8601);
return val.is_null() ? utility::datetime::from_string(utility::conversions::to_string_t("NULL"), utility::datetime::ISO_8601) : utility::datetime::from_string(val.as_string(), utility::datetime::ISO_8601);
}
bool ModelBase::boolFromJson(const web::json::value& val)
{

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -4,7 +4,7 @@
*
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -5,6 +5,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**StringItem** | **string** | |
**NumberItem** | **decimal** | |
**FloatItem** | **float** | |
**IntegerItem** | **int** | |
**BoolItem** | **bool** | |
**ArrayItem** | **List&lt;int&gt;** | |

View File

@@ -1,11 +1,17 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update"
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4
if [ "$git_host" = "" ]; then
git_host="github.com"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
@@ -37,9 +43,9 @@ if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
@@ -47,6 +53,6 @@ fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@@ -279,11 +279,11 @@ namespace Org.OpenAPITools.Test
Stream _imageStream = _assembly.GetManifestResourceStream("Org.OpenAPITools.Test.linux-logo.png");
PetApi petApi = new PetApi();
// test file upload with form parameters
//petApi.UploadFile(petId, "new form name", _imageStream);
petApi.UploadFile(petId, "new form name", _imageStream);
// test file upload without any form parameters
// using optional parameter syntax introduced at .net 4.0
//petApi.UploadFile(petId: petId, file: _imageStream);
petApi.UploadFile(petId: petId, file: _imageStream);
}
/// <summary>

View File

@@ -320,7 +320,7 @@ namespace Org.OpenAPITools.Client
request.RequestFormat = DataFormat.Json;
}
request.AddBody(options.Data);
request.AddJsonBody(options.Data);
}
if (options.FileParameters != null)
@@ -330,9 +330,9 @@ namespace Org.OpenAPITools.Client
var bytes = ClientUtils.ReadAsBytes(fileParam.Value);
var fileStream = fileParam.Value as FileStream;
if (fileStream != null)
FileParameter.Create(fileParam.Key, bytes, System.IO.Path.GetFileName(fileStream.Name));
request.Files.Add(FileParameter.Create(fileParam.Key, bytes, System.IO.Path.GetFileName(fileStream.Name)));
else
FileParameter.Create(fileParam.Key, bytes, "no_file_name_provided");
request.Files.Add(FileParameter.Create(fileParam.Key, bytes, "no_file_name_provided"));
}
}

View File

@@ -395,7 +395,7 @@ namespace Org.OpenAPITools.Client
{
ApiKey = apiKey,
ApiKeyPrefix = apiKeyPrefix,
DefaultHeader = defaultHeaders,
DefaultHeaders = defaultHeaders,
BasePath = second.BasePath ?? first.BasePath,
Timeout = second.Timeout,
UserAgent = second.UserAgent ?? first.UserAgent,

View File

@@ -42,10 +42,11 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="stringItem">stringItem (required).</param>
/// <param name="numberItem">numberItem (required).</param>
/// <param name="floatItem">floatItem (required).</param>
/// <param name="integerItem">integerItem (required).</param>
/// <param name="boolItem">boolItem (required).</param>
/// <param name="arrayItem">arrayItem (required).</param>
public TypeHolderExample(string stringItem = default(string), decimal numberItem = default(decimal), int integerItem = default(int), bool boolItem = default(bool), List<int> arrayItem = default(List<int>))
public TypeHolderExample(string stringItem = default(string), decimal numberItem = default(decimal), float floatItem = default(float), int integerItem = default(int), bool boolItem = default(bool), List<int> arrayItem = default(List<int>))
{
// to ensure "stringItem" is required (not null)
if (stringItem == null)
@@ -67,6 +68,16 @@ namespace Org.OpenAPITools.Model
this.NumberItem = numberItem;
}
// to ensure "floatItem" is required (not null)
if (floatItem == null)
{
throw new InvalidDataException("floatItem is a required property for TypeHolderExample and cannot be null");
}
else
{
this.FloatItem = floatItem;
}
// to ensure "integerItem" is required (not null)
if (integerItem == null)
{
@@ -111,6 +122,12 @@ namespace Org.OpenAPITools.Model
[DataMember(Name="number_item", EmitDefaultValue=false)]
public decimal NumberItem { get; set; }
/// <summary>
/// Gets or Sets FloatItem
/// </summary>
[DataMember(Name="float_item", EmitDefaultValue=false)]
public float FloatItem { get; set; }
/// <summary>
/// Gets or Sets IntegerItem
/// </summary>
@@ -139,6 +156,7 @@ namespace Org.OpenAPITools.Model
sb.Append("class TypeHolderExample {\n");
sb.Append(" StringItem: ").Append(StringItem).Append("\n");
sb.Append(" NumberItem: ").Append(NumberItem).Append("\n");
sb.Append(" FloatItem: ").Append(FloatItem).Append("\n");
sb.Append(" IntegerItem: ").Append(IntegerItem).Append("\n");
sb.Append(" BoolItem: ").Append(BoolItem).Append("\n");
sb.Append(" ArrayItem: ").Append(ArrayItem).Append("\n");
@@ -187,6 +205,7 @@ namespace Org.OpenAPITools.Model
if (this.StringItem != null)
hashCode = hashCode * 59 + this.StringItem.GetHashCode();
hashCode = hashCode * 59 + this.NumberItem.GetHashCode();
hashCode = hashCode * 59 + this.FloatItem.GetHashCode();
hashCode = hashCode * 59 + this.IntegerItem.GetHashCode();
hashCode = hashCode * 59 + this.BoolItem.GetHashCode();
if (this.ArrayItem != null)

View File

@@ -5,6 +5,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**StringItem** | **string** | |
**NumberItem** | **decimal** | |
**FloatItem** | **float** | |
**IntegerItem** | **int** | |
**BoolItem** | **bool** | |
**ArrayItem** | **List&lt;int&gt;** | |

View File

@@ -1,11 +1,17 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update"
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4
if [ "$git_host" = "" ]; then
git_host="github.com"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
@@ -37,9 +43,9 @@ if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
@@ -47,6 +53,6 @@ fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@@ -321,7 +321,7 @@ namespace Org.OpenAPITools.Client
request.RequestFormat = DataFormat.Json;
}
request.AddBody(options.Data);
request.AddJsonBody(options.Data);
}
if (options.FileParameters != null)
@@ -331,9 +331,9 @@ namespace Org.OpenAPITools.Client
var bytes = ClientUtils.ReadAsBytes(fileParam.Value);
var fileStream = fileParam.Value as FileStream;
if (fileStream != null)
FileParameter.Create(fileParam.Key, bytes, System.IO.Path.GetFileName(fileStream.Name));
request.Files.Add(FileParameter.Create(fileParam.Key, bytes, System.IO.Path.GetFileName(fileStream.Name)));
else
FileParameter.Create(fileParam.Key, bytes, "no_file_name_provided");
request.Files.Add(FileParameter.Create(fileParam.Key, bytes, "no_file_name_provided"));
}
}

View File

@@ -400,7 +400,7 @@ namespace Org.OpenAPITools.Client
{
ApiKey = apiKey,
ApiKeyPrefix = apiKeyPrefix,
DefaultHeader = defaultHeaders,
DefaultHeaders = defaultHeaders,
BasePath = second.BasePath ?? first.BasePath,
Timeout = second.Timeout,
UserAgent = second.UserAgent ?? first.UserAgent,

View File

@@ -42,10 +42,11 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="stringItem">stringItem (required).</param>
/// <param name="numberItem">numberItem (required).</param>
/// <param name="floatItem">floatItem (required).</param>
/// <param name="integerItem">integerItem (required).</param>
/// <param name="boolItem">boolItem (required).</param>
/// <param name="arrayItem">arrayItem (required).</param>
public TypeHolderExample(string stringItem = default(string), decimal numberItem = default(decimal), int integerItem = default(int), bool boolItem = default(bool), List<int> arrayItem = default(List<int>))
public TypeHolderExample(string stringItem = default(string), decimal numberItem = default(decimal), float floatItem = default(float), int integerItem = default(int), bool boolItem = default(bool), List<int> arrayItem = default(List<int>))
{
// to ensure "stringItem" is required (not null)
if (stringItem == null)
@@ -67,6 +68,16 @@ namespace Org.OpenAPITools.Model
this.NumberItem = numberItem;
}
// to ensure "floatItem" is required (not null)
if (floatItem == null)
{
throw new InvalidDataException("floatItem is a required property for TypeHolderExample and cannot be null");
}
else
{
this.FloatItem = floatItem;
}
// to ensure "integerItem" is required (not null)
if (integerItem == null)
{
@@ -111,6 +122,12 @@ namespace Org.OpenAPITools.Model
[DataMember(Name="number_item", EmitDefaultValue=false)]
public decimal NumberItem { get; set; }
/// <summary>
/// Gets or Sets FloatItem
/// </summary>
[DataMember(Name="float_item", EmitDefaultValue=false)]
public float FloatItem { get; set; }
/// <summary>
/// Gets or Sets IntegerItem
/// </summary>
@@ -139,6 +156,7 @@ namespace Org.OpenAPITools.Model
sb.Append("class TypeHolderExample {\n");
sb.Append(" StringItem: ").Append(StringItem).Append("\n");
sb.Append(" NumberItem: ").Append(NumberItem).Append("\n");
sb.Append(" FloatItem: ").Append(FloatItem).Append("\n");
sb.Append(" IntegerItem: ").Append(IntegerItem).Append("\n");
sb.Append(" BoolItem: ").Append(BoolItem).Append("\n");
sb.Append(" ArrayItem: ").Append(ArrayItem).Append("\n");
@@ -187,6 +205,7 @@ namespace Org.OpenAPITools.Model
if (this.StringItem != null)
hashCode = hashCode * 59 + this.StringItem.GetHashCode();
hashCode = hashCode * 59 + this.NumberItem.GetHashCode();
hashCode = hashCode * 59 + this.FloatItem.GetHashCode();
hashCode = hashCode * 59 + this.IntegerItem.GetHashCode();
hashCode = hashCode * 59 + this.BoolItem.GetHashCode();
if (this.ArrayItem != null)

View File

@@ -7,6 +7,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**StringItem** | **string** | |
**NumberItem** | **decimal** | |
**FloatItem** | **float** | |
**IntegerItem** | **int** | |
**BoolItem** | **bool** | |
**ArrayItem** | **List&lt;int&gt;** | |

View File

@@ -1,11 +1,17 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update"
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4
if [ "$git_host" = "" ]; then
git_host="github.com"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
@@ -37,9 +43,9 @@ if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
@@ -47,6 +53,6 @@ fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@@ -40,10 +40,11 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="stringItem">stringItem (required).</param>
/// <param name="numberItem">numberItem (required).</param>
/// <param name="floatItem">floatItem (required).</param>
/// <param name="integerItem">integerItem (required).</param>
/// <param name="boolItem">boolItem (required).</param>
/// <param name="arrayItem">arrayItem (required).</param>
public TypeHolderExample(string stringItem = default(string), decimal numberItem = default(decimal), int integerItem = default(int), bool boolItem = default(bool), List<int> arrayItem = default(List<int>))
public TypeHolderExample(string stringItem = default(string), decimal numberItem = default(decimal), float floatItem = default(float), int integerItem = default(int), bool boolItem = default(bool), List<int> arrayItem = default(List<int>))
{
// to ensure "stringItem" is required (not null)
if (stringItem == null)
@@ -65,6 +66,16 @@ namespace Org.OpenAPITools.Model
this.NumberItem = numberItem;
}
// to ensure "floatItem" is required (not null)
if (floatItem == null)
{
throw new InvalidDataException("floatItem is a required property for TypeHolderExample and cannot be null");
}
else
{
this.FloatItem = floatItem;
}
// to ensure "integerItem" is required (not null)
if (integerItem == null)
{
@@ -109,6 +120,12 @@ namespace Org.OpenAPITools.Model
[DataMember(Name="number_item", EmitDefaultValue=false)]
public decimal NumberItem { get; set; }
/// <summary>
/// Gets or Sets FloatItem
/// </summary>
[DataMember(Name="float_item", EmitDefaultValue=false)]
public float FloatItem { get; set; }
/// <summary>
/// Gets or Sets IntegerItem
/// </summary>
@@ -137,6 +154,7 @@ namespace Org.OpenAPITools.Model
sb.Append("class TypeHolderExample {\n");
sb.Append(" StringItem: ").Append(StringItem).Append("\n");
sb.Append(" NumberItem: ").Append(NumberItem).Append("\n");
sb.Append(" FloatItem: ").Append(FloatItem).Append("\n");
sb.Append(" IntegerItem: ").Append(IntegerItem).Append("\n");
sb.Append(" BoolItem: ").Append(BoolItem).Append("\n");
sb.Append(" ArrayItem: ").Append(ArrayItem).Append("\n");
@@ -184,6 +202,11 @@ namespace Org.OpenAPITools.Model
(this.NumberItem != null &&
this.NumberItem.Equals(input.NumberItem))
) &&
(
this.FloatItem == input.FloatItem ||
(this.FloatItem != null &&
this.FloatItem.Equals(input.FloatItem))
) &&
(
this.IntegerItem == input.IntegerItem ||
(this.IntegerItem != null &&
@@ -215,6 +238,8 @@ namespace Org.OpenAPITools.Model
hashCode = hashCode * 59 + this.StringItem.GetHashCode();
if (this.NumberItem != null)
hashCode = hashCode * 59 + this.NumberItem.GetHashCode();
if (this.FloatItem != null)
hashCode = hashCode * 59 + this.FloatItem.GetHashCode();
if (this.IntegerItem != null)
hashCode = hashCode * 59 + this.IntegerItem.GetHashCode();
if (this.BoolItem != null)

View File

@@ -1,11 +1,17 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore "minor update"
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4
if [ "$git_host" = "" ]; then
git_host="github.com"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
@@ -28,7 +34,7 @@ git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
@@ -37,9 +43,9 @@ if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
@@ -47,6 +53,6 @@ fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@@ -1,6 +1,6 @@
library openapi.api;
import 'package:http/io_client.dart';
import 'package:http/http.dart' as http;
import 'package:jaguar_serializer/jaguar_serializer.dart';
import 'package:jaguar_retrofit/jaguar_retrofit.dart';
import 'package:openapi/auth/api_key_auth.dart';
@@ -47,7 +47,7 @@ class Openapi {
* Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added)
*/
Openapi({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) {
_baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? IOClient());
_baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? http.Client());
if(interceptors == null) {
this.interceptors = _defaultInterceptors;
}
@@ -122,4 +122,4 @@ class Openapi {
}
}
}

View File

@@ -6,7 +6,6 @@ import 'dart:async';
import 'package:openapi/model/pet.dart';
import 'package:openapi/model/api_response.dart';
import 'dart:typed_data';
part 'pet_api.jretro.dart';

View File

@@ -5,13 +5,13 @@ part 'api_response.jser.dart';
class ApiResponse {
@Alias('code', isNullable: false)
@Alias('code', isNullable: false, )
final int code;
@Alias('type', isNullable: false)
@Alias('type', isNullable: false, )
final String type;
@Alias('message', isNullable: false)
@Alias('message', isNullable: false, )
final String message;

View File

@@ -5,10 +5,10 @@ part 'category.jser.dart';
class Category {
@Alias('id', isNullable: false)
@Alias('id', isNullable: false, )
final int id;
@Alias('name', isNullable: false)
@Alias('name', isNullable: false, )
final String name;

View File

@@ -5,22 +5,24 @@ part 'order.jser.dart';
class Order {
@Alias('id', isNullable: false)
@Alias('id', isNullable: false, )
final int id;
@Alias('petId', isNullable: false)
@Alias('petId', isNullable: false, )
final int petId;
@Alias('quantity', isNullable: false)
@Alias('quantity', isNullable: false, )
final int quantity;
@Alias('shipDate', isNullable: false)
@Alias('shipDate', isNullable: false, )
final DateTime shipDate;
/* Order Status */
@Alias('status', isNullable: false)
@Alias('status', isNullable: false,
)
final String status;
//enum statusEnum { placed, approved, delivered, };
@Alias('complete', isNullable: false)
@Alias('complete', isNullable: false, )
final bool complete;

View File

@@ -9,22 +9,24 @@ part 'pet.jser.dart';
class Pet {
@Alias('id', isNullable: false)
@Alias('id', isNullable: false, )
final int id;
@Alias('category', isNullable: false)
@Alias('category', isNullable: false, )
final Category category;
@Alias('name', isNullable: false)
@Alias('name', isNullable: false, )
final String name;
@Alias('photoUrls', isNullable: false)
@Alias('photoUrls', isNullable: false, )
final List<String> photoUrls;
@Alias('tags', isNullable: false)
@Alias('tags', isNullable: false, )
final List<Tag> tags;
/* pet status in the store */
@Alias('status', isNullable: false)
@Alias('status', isNullable: false,
)
final String status;
//enum statusEnum { available, pending, sold, };

View File

@@ -5,10 +5,10 @@ part 'tag.jser.dart';
class Tag {
@Alias('id', isNullable: false)
@Alias('id', isNullable: false, )
final int id;
@Alias('name', isNullable: false)
@Alias('name', isNullable: false, )
final String name;

View File

@@ -5,28 +5,28 @@ part 'user.jser.dart';
class User {
@Alias('id', isNullable: false)
@Alias('id', isNullable: false, )
final int id;
@Alias('username', isNullable: false)
@Alias('username', isNullable: false, )
final String username;
@Alias('firstName', isNullable: false)
@Alias('firstName', isNullable: false, )
final String firstName;
@Alias('lastName', isNullable: false)
@Alias('lastName', isNullable: false, )
final String lastName;
@Alias('email', isNullable: false)
@Alias('email', isNullable: false, )
final String email;
@Alias('password', isNullable: false)
@Alias('password', isNullable: false, )
final String password;
@Alias('phone', isNullable: false)
@Alias('phone', isNullable: false, )
final String phone;
/* User Status */
@Alias('userStatus', isNullable: false)
@Alias('userStatus', isNullable: false, )
final int userStatus;

View File

@@ -1,11 +1,17 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore "minor update"
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4
if [ "$git_host" = "" ]; then
git_host="github.com"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
@@ -28,7 +34,7 @@ git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
@@ -37,9 +43,9 @@ if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
@@ -47,6 +53,6 @@ fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@@ -1,6 +1,6 @@
library openapi.api;
import 'package:http/io_client.dart';
import 'package:http/http.dart' as http;
import 'package:jaguar_serializer/jaguar_serializer.dart';
import 'package:jaguar_serializer_protobuf/proto_repo.dart';
import 'package:jaguar_retrofit/jaguar_retrofit.dart';
@@ -57,7 +57,7 @@ class Openapi {
* Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added)
*/
Openapi({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) {
_baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? IOClient());
_baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? http.Client());
if(interceptors == null) {
this.interceptors = _defaultInterceptors;
}
@@ -132,4 +132,4 @@ class Openapi {
}
}
}

View File

@@ -6,7 +6,6 @@ import 'dart:async';
import 'package:openapi/model/pet.pb.dart';
import 'package:openapi/model/api_response.pb.dart';
import 'dart:typed_data';
part 'pet_api.jretro.dart';

View File

@@ -1,11 +1,17 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore "minor update"
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4
if [ "$git_host" = "" ]; then
git_host="github.com"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
@@ -28,7 +34,7 @@ git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
@@ -37,9 +43,9 @@ if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
@@ -47,6 +53,6 @@ fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@@ -1,6 +1,6 @@
library openapi.api;
import 'package:http/io_client.dart';
import 'package:http/http.dart' as http;
import 'package:jaguar_serializer/jaguar_serializer.dart';
import 'package:jaguar_retrofit/jaguar_retrofit.dart';
import 'package:openapi/auth/api_key_auth.dart';
@@ -47,7 +47,7 @@ class Openapi {
* Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added)
*/
Openapi({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) {
_baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? IOClient());
_baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? http.Client());
if(interceptors == null) {
this.interceptors = _defaultInterceptors;
}
@@ -122,4 +122,4 @@ class Openapi {
}
}
}

View File

@@ -6,7 +6,6 @@ import 'dart:async';
import 'package:openapi/model/pet.dart';
import 'package:openapi/model/api_response.dart';
import 'dart:typed_data';
part 'pet_api.jretro.dart';

View File

@@ -5,13 +5,13 @@ part 'api_response.jser.dart';
class ApiResponse {
@Alias('code', isNullable: false)
@Alias('code', isNullable: false, )
final int code;
@Alias('type', isNullable: false)
@Alias('type', isNullable: false, )
final String type;
@Alias('message', isNullable: false)
@Alias('message', isNullable: false, )
final String message;

View File

@@ -5,10 +5,10 @@ part 'category.jser.dart';
class Category {
@Alias('id', isNullable: false)
@Alias('id', isNullable: false, )
final int id;
@Alias('name', isNullable: false)
@Alias('name', isNullable: false, )
final String name;

View File

@@ -5,22 +5,24 @@ part 'order.jser.dart';
class Order {
@Alias('id', isNullable: false)
@Alias('id', isNullable: false, )
final int id;
@Alias('petId', isNullable: false)
@Alias('petId', isNullable: false, )
final int petId;
@Alias('quantity', isNullable: false)
@Alias('quantity', isNullable: false, )
final int quantity;
@Alias('shipDate', isNullable: false)
@Alias('shipDate', isNullable: false, )
final DateTime shipDate;
/* Order Status */
@Alias('status', isNullable: false)
@Alias('status', isNullable: false,
)
final String status;
//enum statusEnum { placed, approved, delivered, };
@Alias('complete', isNullable: false)
@Alias('complete', isNullable: false, )
final bool complete;

View File

@@ -9,22 +9,24 @@ part 'pet.jser.dart';
class Pet {
@Alias('id', isNullable: false)
@Alias('id', isNullable: false, )
final int id;
@Alias('category', isNullable: false)
@Alias('category', isNullable: false, )
final Category category;
@Alias('name', isNullable: false)
@Alias('name', isNullable: false, )
final String name;
@Alias('photoUrls', isNullable: false)
@Alias('photoUrls', isNullable: false, )
final List<String> photoUrls;
@Alias('tags', isNullable: false)
@Alias('tags', isNullable: false, )
final List<Tag> tags;
/* pet status in the store */
@Alias('status', isNullable: false)
@Alias('status', isNullable: false,
)
final String status;
//enum statusEnum { available, pending, sold, };

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