aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/content-repo.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-06-02 13:32:47 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-06-02 13:32:47 +0900
commit0dd491fbd189baaabadcab2344a05e3cf3898287 (patch)
tree13b8ebe63ba8b156ddd6ddab8b0ad2845d7c9c42 /lib/csapi/content-repo.cpp
parente7ac6f3480358fd989c8a3090590d665d18e1cec (diff)
downloadlibquotient-0dd491fbd189baaabadcab2344a05e3cf3898287.tar.gz
libquotient-0dd491fbd189baaabadcab2344a05e3cf3898287.zip
csapi: Use Omittable<> container instead of intrusive 'omitted' field
Also: use the latest feature of GTAD, +set/+on, to make gtad.yaml more compact.
Diffstat (limited to 'lib/csapi/content-repo.cpp')
-rw-r--r--lib/csapi/content-repo.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/csapi/content-repo.cpp b/lib/csapi/content-repo.cpp
index 95fc5aed..101f0ee9 100644
--- a/lib/csapi/content-repo.cpp
+++ b/lib/csapi/content-repo.cpp
@@ -156,7 +156,7 @@ class GetContentThumbnailJob::Private
QIODevice* content;
};
-BaseJob::Query queryToGetContentThumbnail(int width, int height, const QString& method)
+BaseJob::Query queryToGetContentThumbnail(Omittable<int> width, Omittable<int> height, const QString& method)
{
BaseJob::Query _q;
_q.addQueryItem("width", QString("%1").arg(width));
@@ -166,14 +166,14 @@ BaseJob::Query queryToGetContentThumbnail(int width, int height, const QString&
return _q;
}
-QUrl GetContentThumbnailJob::makeRequestUrl(QUrl baseUrl, const QString& serverName, const QString& mediaId, int width, int height, const QString& method)
+QUrl GetContentThumbnailJob::makeRequestUrl(QUrl baseUrl, const QString& serverName, const QString& mediaId, Omittable<int> width, Omittable<int> height, const QString& method)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
basePath % "/thumbnail/" % serverName % "/" % mediaId,
queryToGetContentThumbnail(width, height, method));
}
-GetContentThumbnailJob::GetContentThumbnailJob(const QString& serverName, const QString& mediaId, int width, int height, const QString& method)
+GetContentThumbnailJob::GetContentThumbnailJob(const QString& serverName, const QString& mediaId, Omittable<int> width, Omittable<int> height, const QString& method)
: BaseJob(HttpVerb::Get, "GetContentThumbnailJob",
basePath % "/thumbnail/" % serverName % "/" % mediaId,
queryToGetContentThumbnail(width, height, method),
@@ -205,11 +205,11 @@ BaseJob::Status GetContentThumbnailJob::parseReply(QNetworkReply* reply)
class GetUrlPreviewJob::Private
{
public:
- qint64 matrixImageSize;
+ Omittable<qint64> matrixImageSize;
QString ogImage;
};
-BaseJob::Query queryToGetUrlPreview(const QString& url, qint64 ts)
+BaseJob::Query queryToGetUrlPreview(const QString& url, Omittable<qint64> ts)
{
BaseJob::Query _q;
_q.addQueryItem("url", url);
@@ -217,14 +217,14 @@ BaseJob::Query queryToGetUrlPreview(const QString& url, qint64 ts)
return _q;
}
-QUrl GetUrlPreviewJob::makeRequestUrl(QUrl baseUrl, const QString& url, qint64 ts)
+QUrl GetUrlPreviewJob::makeRequestUrl(QUrl baseUrl, const QString& url, Omittable<qint64> ts)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
basePath % "/preview_url",
queryToGetUrlPreview(url, ts));
}
-GetUrlPreviewJob::GetUrlPreviewJob(const QString& url, qint64 ts)
+GetUrlPreviewJob::GetUrlPreviewJob(const QString& url, Omittable<qint64> ts)
: BaseJob(HttpVerb::Get, "GetUrlPreviewJob",
basePath % "/preview_url",
queryToGetUrlPreview(url, ts))
@@ -234,7 +234,7 @@ GetUrlPreviewJob::GetUrlPreviewJob(const QString& url, qint64 ts)
GetUrlPreviewJob::~GetUrlPreviewJob() = default;
-qint64 GetUrlPreviewJob::matrixImageSize() const
+Omittable<qint64> GetUrlPreviewJob::matrixImageSize() const
{
return d->matrixImageSize;
}