mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-24 02:00:24 +07:00
40 lines
1.5 KiB
C++
40 lines
1.5 KiB
C++
#ifndef APIUTILS_H
|
|
#define APIUTILS_H
|
|
|
|
#include <QJsonObject>
|
|
#include <QNetworkReply>
|
|
#include <QObject>
|
|
|
|
#include "core/utils/api/apiEnums.h"
|
|
#include "core/utils/constants/apiKeys.h"
|
|
#include "core/utils/constants/apiConstants.h"
|
|
#include "core/utils/errorCodes.h"
|
|
#include "core/utils/routeModes.h"
|
|
#include "core/utils/commonStructs.h"
|
|
|
|
namespace apiUtils
|
|
{
|
|
bool isServerFromApi(const QJsonObject &serverConfigObject);
|
|
|
|
bool isSubscriptionExpired(const QString &subscriptionEndDate);
|
|
|
|
bool isSubscriptionExpiringSoon(const QString &subscriptionEndDate, int withinDays = 30);
|
|
|
|
bool isPremiumServer(const QJsonObject &serverConfigObject);
|
|
|
|
apiDefs::ConfigType getConfigType(const QJsonObject &serverConfigObject);
|
|
apiDefs::ConfigSource getConfigSource(const QJsonObject &serverConfigObject);
|
|
|
|
amnezia::ErrorCode checkNetworkReplyErrors(const QList<QSslError> &sslErrors, const QString &replyErrorString,
|
|
const QNetworkReply::NetworkError &replyError, const int httpStatusCode,
|
|
const QByteArray &responseBody);
|
|
|
|
/** Maps gateway JSON `http_status` field (when present) to ErrorCode. Returns NoError if field is missing. */
|
|
amnezia::ErrorCode errorCodeFromGatewayJsonHttpStatus(const QJsonObject &jsonObj);
|
|
|
|
QString getPremiumV1VpnKey(const QJsonObject &serverConfigObject);
|
|
QString getPremiumV2VpnKey(const QJsonObject &serverConfigObject);
|
|
}
|
|
|
|
#endif // APIUTILS_H
|