Warning, file /network/ruqola/src/rocketchatrestapi-qt/restapimethod.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2018-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "restapimethod.h" 0008 #include "rocketchatqtrestapi_debug.h" 0009 using namespace RocketChatRestApi; 0010 RestApiMethod::RestApiMethod() = default; 0011 0012 QString RestApiMethod::serverUrl() const 0013 { 0014 return mServerUrl; 0015 } 0016 0017 void RestApiMethod::setServerUrl(const QString &serverUrl) 0018 { 0019 mServerUrl = serverUrl; 0020 } 0021 0022 QUrl RestApiMethod::generateUrl(RestApiUtil::RestApiUrlType type, const QString &urlExtension, bool useV1Extension) 0023 { 0024 if (mServerUrl.isEmpty()) { 0025 qCWarning(ROCKETCHATQTRESTAPI_LOG) << "Server url is empty"; 0026 return {}; 0027 } 0028 QString urlStr = RestApiUtil::adaptUrl(mServerUrl) + (useV1Extension ? RestApiUtil::apiUri() : QStringLiteral("/api/")) + RestApiUtil::restUrl(type); 0029 if (!urlExtension.isEmpty()) { 0030 urlStr += QLatin1Char('/') + urlExtension; 0031 } 0032 return QUrl(urlStr); 0033 }