libQuotient
A Qt library for building matrix clients
downloadfilejob.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2018 Kitsune Ral <Kitsune-Ral@users.sf.net>
2 // SPDX-License-Identifier: LGPL-2.1-or-later
3 
4 #pragma once
5 
6 #include "basejob.h"
7 
8 namespace Quotient {
9 struct EncryptedFileMetadata;
10 
11 class QUOTIENT_API DownloadFileJob : public BaseJob {
12 public:
13  static QUrl makeRequestUrl(const HomeserverData& hsData, const QUrl& mxcUri);
14  static QUrl makeRequestUrl(const HomeserverData& hsData, const QString& serverName,
15  const QString& mediaId);
16 
17  DownloadFileJob(QString serverName, QString mediaId, const QString& localFilename = {});
18 
19  DownloadFileJob(QString serverName, QString mediaId, const EncryptedFileMetadata& file,
20  const QString& localFilename = {});
21  QString targetFileName() const;
22 
23 private:
24  class Private;
25  ImplPtr<Private> d;
26 
27  void doPrepare(const ConnectionData* connectionData) override;
28  void onSentRequest(QNetworkReply* reply) override;
29  void beforeAbandon() override;
30  Status prepareResult() override;
31 };
32 } // namespace Quotient