1/************************************************************************
2 * This file has been generated automatically from                      *
3 *                                                                      *
4 * src/core/network/qgsnetworkcontentfetcherregistry.h                  *
5 *                                                                      *
6 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
7 ************************************************************************/
8
9
10
11
12
13class QgsFetchedContent : QObject
14{
15%Docstring(signature="appended")
16FetchedContent holds useful information about a network content being fetched
17
18.. seealso:: :py:class:`QgsNetworkContentFetcherRegistry`
19
20.. versionadded:: 3.2
21%End
22
23%TypeHeaderCode
24#include "qgsnetworkcontentfetcherregistry.h"
25%End
26  public:
27    enum ContentStatus
28    {
29      NotStarted,
30      Downloading,
31      Finished,
32      Failed
33    };
34
35    explicit QgsFetchedContent( const QString &url, QTemporaryFile *file = 0, ContentStatus status = NotStarted,
36                                const QString &authConfig = QString() );
37%Docstring
38Constructs a FetchedContent with pointer to the downloaded file and status of the download
39%End
40
41    ~QgsFetchedContent();
42
43
44
45    const QString filePath() const;
46%Docstring
47Returns the path to the local file, an empty string if the file is not accessible yet.
48%End
49
50    ContentStatus status() const;
51%Docstring
52Returns the status of the download
53%End
54
55    QNetworkReply::NetworkError error() const;
56%Docstring
57Returns the potential error of the download
58%End
59
60    QString authConfig() const;
61%Docstring
62Returns the authentication configuration id use for this fetched content
63%End
64
65  public slots:
66
67    void download( bool redownload = false );
68%Docstring
69Start the download
70
71:param redownload: if set to ``True``, it will restart any achieved or pending download.
72%End
73
74    void cancel();
75%Docstring
76Cancel the download operation.
77%End
78
79  signals:
80    void fetched();
81%Docstring
82Emitted when the file is fetched and accessible
83%End
84
85    void errorOccurred( QNetworkReply::NetworkError code, const QString &errorMsg );
86%Docstring
87Emitted when an error with ``code`` error occurred while processing the request
88``errorMsg`` is a textual description of the error
89
90.. versionadded:: 3.22
91%End
92
93};
94
95class QgsNetworkContentFetcherRegistry : QObject
96{
97%Docstring(signature="appended")
98Registry for temporary fetched files
99
100This provides a simple way of downloading and accessing
101remote files during QGIS application running.
102
103.. seealso:: :py:class:`QgsFetchedContent`
104
105.. versionadded:: 3.2
106%End
107
108%TypeHeaderCode
109#include "qgsnetworkcontentfetcherregistry.h"
110%End
111  public:
112
113    explicit QgsNetworkContentFetcherRegistry();
114%Docstring
115Create the registry for temporary downloaded files
116%End
117
118    ~QgsNetworkContentFetcherRegistry();
119
120    QgsFetchedContent *fetch( const QString &url, Qgis::ActionStart fetchingMode = Qgis::ActionStart::Deferred, const QString &authConfig = QString() );
121%Docstring
122Initialize a download for the given URL
123
124:param url: the URL to be fetched
125:param fetchingMode: defines if the download will start immediately or shall be manually triggered
126:param authConfig: authentication configuration id to be used while fetching
127
128.. note::
129
130   If the download starts immediately, it will not redownload any already fetched or currently fetching file.
131%End
132
133
134    QString localPath( const QString &filePathOrUrl );
135%Docstring
136Returns the path to a local file or to a temporary file previously fetched by the registry
137
138:param filePathOrUrl: can either be a local file path or a remote content which has previously been fetched
139%End
140
141};
142
143/************************************************************************
144 * This file has been generated automatically from                      *
145 *                                                                      *
146 * src/core/network/qgsnetworkcontentfetcherregistry.h                  *
147 *                                                                      *
148 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
149 ************************************************************************/
150