forked from qt-creator/qt-creator
Axivion: Update Dashboard API (DTOs)
Change-Id: Ice8d1746cddad1cb6f0c9a7ab2778b8d9dc26ca9 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -16,6 +16,9 @@
|
|||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
namespace Axivion::Internal::Dto
|
||||||
|
{
|
||||||
|
|
||||||
template<typename Input, typename Output>
|
template<typename Input, typename Output>
|
||||||
static Output concat(const std::initializer_list<const Input> &args)
|
static Output concat(const std::initializer_list<const Input> &args)
|
||||||
{
|
{
|
||||||
@@ -43,3 +46,5 @@ QByteArray concat_bytes(const std::initializer_list<const QByteArrayView> &args)
|
|||||||
{
|
{
|
||||||
return concat<QByteArrayView, QByteArray>(args);
|
return concat<QByteArrayView, QByteArray>(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Axivion::Internal::Dto
|
||||||
|
|||||||
@@ -22,9 +22,12 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
|
namespace Axivion::Internal::Dto
|
||||||
|
{
|
||||||
std::string concat(const std::initializer_list<const std::string_view> &args);
|
std::string concat(const std::initializer_list<const std::string_view> &args);
|
||||||
|
|
||||||
QString concat(const std::initializer_list<const QStringView> &args);
|
QString concat(const std::initializer_list<const QStringView> &args);
|
||||||
|
|
||||||
QByteArray concat_bytes(const std::initializer_list<const QByteArrayView> &args);
|
QByteArray concat_bytes(const std::initializer_list<const QByteArrayView> &args);
|
||||||
|
|
||||||
|
} // namespace Axivion::Internal::Dto
|
||||||
|
|||||||
@@ -749,10 +749,10 @@ namespace Axivion::Internal::Dto {
|
|||||||
|
|
||||||
// version
|
// version
|
||||||
|
|
||||||
constexpr std::array<qint32, 4> ApiVersion::number{7,6,2,12725};
|
constexpr std::array<qint32, 4> ApiVersion::number{7,6,3,12797};
|
||||||
const QLatin1String ApiVersion::string{"7.6.2.12725"};
|
const QLatin1String ApiVersion::string{"7.6.3.12797"};
|
||||||
const QLatin1String ApiVersion::name{"7.6.2"};
|
const QLatin1String ApiVersion::name{"7.6.3"};
|
||||||
const QLatin1String ApiVersion::timestamp{"2023-08-07 14:38:01 +00:00"};
|
const QLatin1String ApiVersion::timestamp{"2023-08-30 15:49:00 +00:00"};
|
||||||
|
|
||||||
// AnalyzedFileDto
|
// AnalyzedFileDto
|
||||||
|
|
||||||
@@ -1011,6 +1011,50 @@ namespace Axivion::Internal::Dto {
|
|||||||
return serialize_bytes(*this);
|
return serialize_bytes(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CsrfTokenDto
|
||||||
|
|
||||||
|
static const QLatin1String csrfTokenKeyCsrfToken{"csrfToken"};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
class de_serializer<CsrfTokenDto> final
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// throws Axivion::Internal::Dto::invalid_dto_exception
|
||||||
|
static CsrfTokenDto deserialize(const QJsonValue &json) {
|
||||||
|
const QJsonObject jo = toJsonObject<CsrfTokenDto>(json);
|
||||||
|
return {
|
||||||
|
deserialize_field<QString>(jo, csrfTokenKeyCsrfToken)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
static QJsonValue serialize(const CsrfTokenDto &value) {
|
||||||
|
QJsonObject jo;
|
||||||
|
serialize_field(jo, csrfTokenKeyCsrfToken, value.csrfToken);
|
||||||
|
return { jo };
|
||||||
|
}
|
||||||
|
|
||||||
|
de_serializer() = delete;
|
||||||
|
~de_serializer() = delete;
|
||||||
|
};
|
||||||
|
|
||||||
|
// throws Axivion::Internal::Dto::invalid_dto_exception
|
||||||
|
CsrfTokenDto CsrfTokenDto::deserialize(const QByteArray &json)
|
||||||
|
{
|
||||||
|
return deserialize_bytes<CsrfTokenDto>(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
CsrfTokenDto::CsrfTokenDto(
|
||||||
|
QString csrfToken
|
||||||
|
) :
|
||||||
|
csrfToken(std::move(csrfToken))
|
||||||
|
{ }
|
||||||
|
|
||||||
|
// throws Axivion::Internal::Dto::invalid_dto_exception
|
||||||
|
QByteArray CsrfTokenDto::serialize() const
|
||||||
|
{
|
||||||
|
return serialize_bytes(*this);
|
||||||
|
}
|
||||||
|
|
||||||
// EntityDto
|
// EntityDto
|
||||||
|
|
||||||
static const QLatin1String entityKeyId{"id"};
|
static const QLatin1String entityKeyId{"id"};
|
||||||
@@ -2186,7 +2230,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
deserialize_field<QString>(jo, analysisVersionKeyDate),
|
deserialize_field<QString>(jo, analysisVersionKeyDate),
|
||||||
deserialize_field<std::optional<QString>>(jo, analysisVersionKeyLabel),
|
deserialize_field<std::optional<QString>>(jo, analysisVersionKeyLabel),
|
||||||
deserialize_field<qint32>(jo, analysisVersionKeyIndex),
|
deserialize_field<qint32>(jo, analysisVersionKeyIndex),
|
||||||
deserialize_field<std::optional<QString>>(jo, analysisVersionKeyName),
|
deserialize_field<QString>(jo, analysisVersionKeyName),
|
||||||
deserialize_field<qint64>(jo, analysisVersionKeyMillis),
|
deserialize_field<qint64>(jo, analysisVersionKeyMillis),
|
||||||
deserialize_field<Any>(jo, analysisVersionKeyIssueCounts),
|
deserialize_field<Any>(jo, analysisVersionKeyIssueCounts),
|
||||||
deserialize_field<std::optional<ToolsVersionDto>>(jo, analysisVersionKeyToolsVersion),
|
deserialize_field<std::optional<ToolsVersionDto>>(jo, analysisVersionKeyToolsVersion),
|
||||||
@@ -2223,7 +2267,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
QString date,
|
QString date,
|
||||||
std::optional<QString> label,
|
std::optional<QString> label,
|
||||||
qint32 index,
|
qint32 index,
|
||||||
std::optional<QString> name,
|
QString name,
|
||||||
qint64 millis,
|
qint64 millis,
|
||||||
Any issueCounts,
|
Any issueCounts,
|
||||||
std::optional<ToolsVersionDto> toolsVersion,
|
std::optional<ToolsVersionDto> toolsVersion,
|
||||||
@@ -2614,6 +2658,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
static const QLatin1String dashboardInfoKeyUserNamedFiltersUrl{"userNamedFiltersUrl"};
|
static const QLatin1String dashboardInfoKeyUserNamedFiltersUrl{"userNamedFiltersUrl"};
|
||||||
static const QLatin1String dashboardInfoKeySupportAddress{"supportAddress"};
|
static const QLatin1String dashboardInfoKeySupportAddress{"supportAddress"};
|
||||||
static const QLatin1String dashboardInfoKeyIssueFilterHelp{"issueFilterHelp"};
|
static const QLatin1String dashboardInfoKeyIssueFilterHelp{"issueFilterHelp"};
|
||||||
|
static const QLatin1String dashboardInfoKeyCsrfTokenUrl{"csrfTokenUrl"};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
class de_serializer<DashboardInfoDto> final
|
class de_serializer<DashboardInfoDto> final
|
||||||
@@ -2628,7 +2673,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
deserialize_field<std::optional<QString>>(jo, dashboardInfoKeyDashboardVersionNumber),
|
deserialize_field<std::optional<QString>>(jo, dashboardInfoKeyDashboardVersionNumber),
|
||||||
deserialize_field<QString>(jo, dashboardInfoKeyDashboardBuildDate),
|
deserialize_field<QString>(jo, dashboardInfoKeyDashboardBuildDate),
|
||||||
deserialize_field<std::optional<QString>>(jo, dashboardInfoKeyUsername),
|
deserialize_field<std::optional<QString>>(jo, dashboardInfoKeyUsername),
|
||||||
deserialize_field<QString>(jo, dashboardInfoKeyCsrfTokenHeader),
|
deserialize_field<std::optional<QString>>(jo, dashboardInfoKeyCsrfTokenHeader),
|
||||||
deserialize_field<QString>(jo, dashboardInfoKeyCsrfToken),
|
deserialize_field<QString>(jo, dashboardInfoKeyCsrfToken),
|
||||||
deserialize_field<std::optional<QString>>(jo, dashboardInfoKeyCheckCredentialsUrl),
|
deserialize_field<std::optional<QString>>(jo, dashboardInfoKeyCheckCredentialsUrl),
|
||||||
deserialize_field<std::optional<QString>>(jo, dashboardInfoKeyNamedFiltersUrl),
|
deserialize_field<std::optional<QString>>(jo, dashboardInfoKeyNamedFiltersUrl),
|
||||||
@@ -2636,7 +2681,8 @@ namespace Axivion::Internal::Dto {
|
|||||||
deserialize_field<std::optional<QString>>(jo, dashboardInfoKeyUserApiTokenUrl),
|
deserialize_field<std::optional<QString>>(jo, dashboardInfoKeyUserApiTokenUrl),
|
||||||
deserialize_field<std::optional<QString>>(jo, dashboardInfoKeyUserNamedFiltersUrl),
|
deserialize_field<std::optional<QString>>(jo, dashboardInfoKeyUserNamedFiltersUrl),
|
||||||
deserialize_field<std::optional<QString>>(jo, dashboardInfoKeySupportAddress),
|
deserialize_field<std::optional<QString>>(jo, dashboardInfoKeySupportAddress),
|
||||||
deserialize_field<std::optional<QString>>(jo, dashboardInfoKeyIssueFilterHelp)
|
deserialize_field<std::optional<QString>>(jo, dashboardInfoKeyIssueFilterHelp),
|
||||||
|
deserialize_field<std::optional<QString>>(jo, dashboardInfoKeyCsrfTokenUrl)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2656,6 +2702,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
serialize_field(jo, dashboardInfoKeyUserNamedFiltersUrl, value.userNamedFiltersUrl);
|
serialize_field(jo, dashboardInfoKeyUserNamedFiltersUrl, value.userNamedFiltersUrl);
|
||||||
serialize_field(jo, dashboardInfoKeySupportAddress, value.supportAddress);
|
serialize_field(jo, dashboardInfoKeySupportAddress, value.supportAddress);
|
||||||
serialize_field(jo, dashboardInfoKeyIssueFilterHelp, value.issueFilterHelp);
|
serialize_field(jo, dashboardInfoKeyIssueFilterHelp, value.issueFilterHelp);
|
||||||
|
serialize_field(jo, dashboardInfoKeyCsrfTokenUrl, value.csrfTokenUrl);
|
||||||
return { jo };
|
return { jo };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2675,7 +2722,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
std::optional<QString> dashboardVersionNumber,
|
std::optional<QString> dashboardVersionNumber,
|
||||||
QString dashboardBuildDate,
|
QString dashboardBuildDate,
|
||||||
std::optional<QString> username,
|
std::optional<QString> username,
|
||||||
QString csrfTokenHeader,
|
std::optional<QString> csrfTokenHeader,
|
||||||
QString csrfToken,
|
QString csrfToken,
|
||||||
std::optional<QString> checkCredentialsUrl,
|
std::optional<QString> checkCredentialsUrl,
|
||||||
std::optional<QString> namedFiltersUrl,
|
std::optional<QString> namedFiltersUrl,
|
||||||
@@ -2683,7 +2730,8 @@ namespace Axivion::Internal::Dto {
|
|||||||
std::optional<QString> userApiTokenUrl,
|
std::optional<QString> userApiTokenUrl,
|
||||||
std::optional<QString> userNamedFiltersUrl,
|
std::optional<QString> userNamedFiltersUrl,
|
||||||
std::optional<QString> supportAddress,
|
std::optional<QString> supportAddress,
|
||||||
std::optional<QString> issueFilterHelp
|
std::optional<QString> issueFilterHelp,
|
||||||
|
std::optional<QString> csrfTokenUrl
|
||||||
) :
|
) :
|
||||||
mainUrl(std::move(mainUrl)),
|
mainUrl(std::move(mainUrl)),
|
||||||
dashboardVersion(std::move(dashboardVersion)),
|
dashboardVersion(std::move(dashboardVersion)),
|
||||||
@@ -2698,7 +2746,8 @@ namespace Axivion::Internal::Dto {
|
|||||||
userApiTokenUrl(std::move(userApiTokenUrl)),
|
userApiTokenUrl(std::move(userApiTokenUrl)),
|
||||||
userNamedFiltersUrl(std::move(userNamedFiltersUrl)),
|
userNamedFiltersUrl(std::move(userNamedFiltersUrl)),
|
||||||
supportAddress(std::move(supportAddress)),
|
supportAddress(std::move(supportAddress)),
|
||||||
issueFilterHelp(std::move(issueFilterHelp))
|
issueFilterHelp(std::move(issueFilterHelp)),
|
||||||
|
csrfTokenUrl(std::move(csrfTokenUrl))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
// throws Axivion::Internal::Dto::invalid_dto_exception
|
// throws Axivion::Internal::Dto::invalid_dto_exception
|
||||||
|
|||||||
@@ -317,6 +317,34 @@ namespace Axivion::Internal::Dto
|
|||||||
virtual QByteArray serialize() const override;
|
virtual QByteArray serialize() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CSRF token
|
||||||
|
*
|
||||||
|
* @since 7.7.0
|
||||||
|
*/
|
||||||
|
class CsrfTokenDto : public Serializable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>The value expected to be sent along the ``csrfTokenHeader`` for all HTTP requests that are not GET, HEAD, OPTIONS or TRACE.
|
||||||
|
*
|
||||||
|
* <p>Note, that this does not replace authentication of subsequent requests. Also the token is combined with the authentication
|
||||||
|
* data, so will not work when authenticating as another user. Its lifetime is limited, so when creating a very long-running
|
||||||
|
* application you should consider refreshing this token from time to time.
|
||||||
|
*/
|
||||||
|
QString csrfToken;
|
||||||
|
|
||||||
|
// Throws Axivion::Internal::Dto::invalid_dto_exception
|
||||||
|
static CsrfTokenDto deserialize(const QByteArray &json);
|
||||||
|
|
||||||
|
CsrfTokenDto(
|
||||||
|
QString csrfToken
|
||||||
|
);
|
||||||
|
|
||||||
|
virtual QByteArray serialize() const override;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Project Entity such as a Class, a Method, a File or a Module
|
* A Project Entity such as a Class, a Method, a File or a Module
|
||||||
* or the System Entity.
|
* or the System Entity.
|
||||||
@@ -1261,21 +1289,10 @@ namespace Axivion::Internal::Dto
|
|||||||
qint32 index;
|
qint32 index;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>The legacy display name of a version.
|
* <p>The display name of the analysis version consisting of the date formatted with the
|
||||||
*
|
* preferred time zone of the user making the request and the label in parentheses.
|
||||||
* <p>It is not recommended to use this anymore. It contains the
|
|
||||||
* date of the analysis version creation in an arbitrary time zone which is not
|
|
||||||
* indicated in the timestamp. In recent versions most probably UTC is used but
|
|
||||||
* this can change at any time - which would be regarded as a non-breaking
|
|
||||||
* change.
|
|
||||||
*
|
|
||||||
* <p>Instead, clients should craft their own display name from the other
|
|
||||||
* available properties (date, label) and maybe adjust displayed dates
|
|
||||||
* according to their system timezone.
|
|
||||||
*
|
|
||||||
* @deprecated
|
|
||||||
*/
|
*/
|
||||||
std::optional<QString> name;
|
QString name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Analysis version timestamp in milliseconds
|
* <p>Analysis version timestamp in milliseconds
|
||||||
@@ -1333,7 +1350,7 @@ namespace Axivion::Internal::Dto
|
|||||||
QString date,
|
QString date,
|
||||||
std::optional<QString> label,
|
std::optional<QString> label,
|
||||||
qint32 index,
|
qint32 index,
|
||||||
std::optional<QString> name,
|
QString name,
|
||||||
qint64 millis,
|
qint64 millis,
|
||||||
Any issueCounts,
|
Any issueCounts,
|
||||||
std::optional<ToolsVersionDto> toolsVersion,
|
std::optional<ToolsVersionDto> toolsVersion,
|
||||||
@@ -1708,8 +1725,12 @@ namespace Axivion::Internal::Dto
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>The HTTP-Request Header expected present for all HTTP requests that are not GET, HEAD, OPTIONS or TRACE.
|
* <p>The HTTP-Request Header expected present for all HTTP requests that are not GET, HEAD, OPTIONS or TRACE.
|
||||||
|
*
|
||||||
|
* <p>Deprecated since 7.7.0: the header name is always ``AX-CSRF-Token``.
|
||||||
|
*
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
QString csrfTokenHeader;
|
std::optional<QString> csrfTokenHeader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>The value expected to be sent along the ``csrfTokenHeader`` for all HTTP requests that are not GET, HEAD, OPTIONS or TRACE.
|
* <p>The value expected to be sent along the ``csrfTokenHeader`` for all HTTP requests that are not GET, HEAD, OPTIONS or TRACE.
|
||||||
@@ -1767,6 +1788,13 @@ namespace Axivion::Internal::Dto
|
|||||||
*/
|
*/
|
||||||
std::optional<QString> issueFilterHelp;
|
std::optional<QString> issueFilterHelp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Endoint for creating new CSRF tokens.
|
||||||
|
*
|
||||||
|
* @since 7.7.0
|
||||||
|
*/
|
||||||
|
std::optional<QString> csrfTokenUrl;
|
||||||
|
|
||||||
// Throws Axivion::Internal::Dto::invalid_dto_exception
|
// Throws Axivion::Internal::Dto::invalid_dto_exception
|
||||||
static DashboardInfoDto deserialize(const QByteArray &json);
|
static DashboardInfoDto deserialize(const QByteArray &json);
|
||||||
|
|
||||||
@@ -1776,7 +1804,7 @@ namespace Axivion::Internal::Dto
|
|||||||
std::optional<QString> dashboardVersionNumber,
|
std::optional<QString> dashboardVersionNumber,
|
||||||
QString dashboardBuildDate,
|
QString dashboardBuildDate,
|
||||||
std::optional<QString> username,
|
std::optional<QString> username,
|
||||||
QString csrfTokenHeader,
|
std::optional<QString> csrfTokenHeader,
|
||||||
QString csrfToken,
|
QString csrfToken,
|
||||||
std::optional<QString> checkCredentialsUrl,
|
std::optional<QString> checkCredentialsUrl,
|
||||||
std::optional<QString> namedFiltersUrl,
|
std::optional<QString> namedFiltersUrl,
|
||||||
@@ -1784,7 +1812,8 @@ namespace Axivion::Internal::Dto
|
|||||||
std::optional<QString> userApiTokenUrl,
|
std::optional<QString> userApiTokenUrl,
|
||||||
std::optional<QString> userNamedFiltersUrl,
|
std::optional<QString> userNamedFiltersUrl,
|
||||||
std::optional<QString> supportAddress,
|
std::optional<QString> supportAddress,
|
||||||
std::optional<QString> issueFilterHelp
|
std::optional<QString> issueFilterHelp,
|
||||||
|
std::optional<QString> csrfTokenUrl
|
||||||
);
|
);
|
||||||
|
|
||||||
virtual QByteArray serialize() const override;
|
virtual QByteArray serialize() const override;
|
||||||
|
|||||||
Reference in New Issue
Block a user