This file is indexed.

/usr/include/mygpo-qt/ApiRequest.h is in libmygpo-qt-dev 1.0.9-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
/***************************************************************************
* This file is part of libmygpo-qt                                         *
* Copyright (c) 2010 - 2014 Stefan Derkits <stefan@derkits.at>             *
* Copyright (c) 2010 - 2011 Christian Wagner <christian.wagner86@gmx.at>   *
* Copyright (c) 2010 - 2011 Felix Winter <ixos01@gmail.com>                *
*                                                                          *
* This library is free software; you can redistribute it and/or            *
* modify it under the terms of the GNU Lesser General Public               *
* License as published by the Free Software Foundation; either             *
* version 2.1 of the License, or (at your option) any later version.       *
*                                                                          *
* This library is distributed in the hope that it will be useful,          *
* but WITHOUT ANY WARRANTY; without even the implied warranty of           *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        *
* Lesser General Public License for more details.                          *
*                                                                          *
* You should have received a copy of the GNU Lesser General Public         *
* License along with this library; if not, write to the Free Software      *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 *
* USA                                                                      *
***************************************************************************/

#ifndef LIBMYGPO_QT_APIREQUEST_H
#define LIBMYGPO_QT_APIREQUEST_H

#include "mygpo_export.h"
#include "AddRemoveResult.h"
#include "EpisodeList.h"
#include "EpisodeActionList.h"
#include "PodcastList.h"
#include "TagList.h"
#include "Settings.h"
#include "DeviceUpdates.h"
#include "DeviceList.h"
#include "DeviceSyncResult.h"

class QByteArray;
class QString;

namespace mygpo
{

class ApiRequestPrivate;

/**
 * This Class is the Frontend of libmygpo-qt.
 * Methods from this Class map the Web API of gpodder.net
 * and return the Results of the Requests.
 * Web API Documentation can be found here: http://wiki.gpodder.org/wiki/Web_Services/API_2
 */

class MYGPO_EXPORT ApiRequest
{
public:

    ApiRequest( const QString& username, const QString& password, QNetworkAccessManager* nam );
    ApiRequest( QNetworkAccessManager* nam );
    ~ApiRequest( );

    //SIMPLE API

    /**
     * Returns the OPML Result for the Simple API Call "Downloading Podcast Toplists"
     * @param count The number of Podcasts that should be returned - will be set to to 100 if > 100 or < 1
     * @return A Pointer to a QNetworkReply which receives network signals and will contain the data
     *
     */
    QNetworkReply* toplistOpml( uint count );

    /**
     * Returns the OPML Result for the Simple API Call "Searching for Podcasts"
     * @param query The String you want to search for
     * @return A Pointer to a QNetworkReply which receives network signals and will contain the data
     *
     */
    QNetworkReply* searchOpml( const QString& query );

    /**
     * Returns the OPML Result for the Simple API Call "Downloading podcast suggestions"
     * Requires Authentication
     * @param count The maximum number of Podcasts that should be returned - will be set to to 100 if > 100 or < 1
     * @return A Pointer to a QNetworkReply which receives network signals and will contain the data
     *
     */
    QNetworkReply* suggestionsOpml( uint count );

    QNetworkReply* downloadSubscriptionsOpml( const QString& username, const QString& device = QString() );

    /**
     * Returns the TXT Result for the Simple API Call "Downloading Podcast Toplists"
     * @param count The number of Podcasts that should be returned - will be set to to 100 if > 100 or < 1
     * @return A Pointer to a QNetworkReply which receives network signals and will contain the data
     *
     */
    QNetworkReply* toplistTxt( uint count );

    /**
     * Returns the TXT Result for the Simple API Call "Searching for Podcasts"
     * @param query The String you want to search for
     * @return A Pointer to a QNetworkReply which receives network signals and will contain the data
     *
     */
    QNetworkReply* searchTxt( const QString& query );

    /**
     * Returns the TXT Result for the Simple API Call "Downloading podcast suggestions"
     * Requires Authentication
     * @param count The maximum number of Podcasts that should be returned - will be set to to 100 if > 100 or < 1
     * @return A Pointer to a QNetworkReply which receives network signals and will contain the data
     *
     */
    QNetworkReply* suggestionsTxt( uint count );

    QNetworkReply* downloadSubscriptionsTxt( const QString& username, const QString& device = QString() );

    /**
     * Returns the TXT Result for the Simple API Call "Downloading Podcast Toplists"
     * @param count The number of Podcasts that should be returned - will be set to to 100 if > 100 or < 1
     * @return A Pointer to a QNetworkReply which receives network signals and will contain the data
     *
     */
    QNetworkReply* toplistXml( uint count );

    /**
     * Returns the XML Result for the Simple API Call "Searching for Podcasts"
     * @param query The String you want to search for
     * @return A Pointer to a QNetworkReply which receives network signals and will contain the data
     *
     */
    QNetworkReply* searchXml( const QString& query );

    /**
     * Returns the Result for the Simple API Call "Downloading Podcast Toplists"
     * @param count The number of Podcasts that should be returned - will be set to to 100 if > 100 or < 1
     * @return List of Podcast Objects containing the Data from gPodder
     *
     */
    PodcastListPtr toplist( uint count );

    /**
     * Returns the Result for the Simple API Call "Searching for Podcasts"
     * @param query The String you want to search for
     * @return List of Podcast Objects containing the Data from gPodder
     *
     */
    PodcastListPtr search( const QString& query );

    /**
     * Returns the Result for the Simple API Call "Downloading podcast suggestions"
     * Requires Authentication
     * @param count The maximum number of Podcasts that should be returned - will be set to to 100 if > 100 or < 1
     * @return List of Podcast Objects containing the Data from gPodder
     *
     */
    PodcastListPtr suggestions( uint count );

    QNetworkReply* downloadSubscriptionsJson( const QString& username, const QString& device = QString() );

    //ADVANCED API

    /**
     * Returns the Result for the Advanced API Call "Retrieving Podcasts of a Tag"
     * @param query The number of Podcasts that should be returned - will be set to to 100 if > 100 or < 1
     * @param tag The Tag for which Podcasts should be retrieved
     * @return List of Podcast Objects containing the Data from gPodder
     *
     */
    PodcastListPtr podcastsOfTag( uint count, const QString& tag );

    /**
     * Returns the Result for the Advanced API Call "Retrieving Podcast Data"
     * @param podcasturl Url of the Podcast for which Data should be retrieved
     * @return Podcast Object containing the Data from gPodder
     *
     */
    PodcastPtr podcastData( const QUrl& podcasturl );

    /**
     * Returns the Result for the Advanced API Call "Retrieving Episode Data"
     * @param podcasturl Url of the Podcast that contains the Episode
     * @param episodeurl Url of the Episode Data for which Data should be retrieved
     * @return Episode Object containing the Data from gPodder
     *
     */
    EpisodePtr episodeData( const QUrl& podcasturl, const QUrl& episodeurl );

    /**
     * Returns the Result for the Advanced API Call "Listing Favorite Episodes"
     * @param username The User whose Favorite Episodes should be retrieved
     * @return List of Episode Objects containing the Data from gPodder
     *
     */
    EpisodeListPtr favoriteEpisodes( const QString& username );

    /**
     * Returns the Result for the Advanced API Call "Retrieving Top Tags"
     * @param count The number of Tags that should be returned - will be set to to 100 if > 100 or < 1
     * @return List of Tag Objects containing the Data from gPodder
     *
     */
    TagListPtr topTags( uint count );

    /**
     * Uploads Data & returns the Result for the Advanced API Call "Add/remove subscriptions"
     * Requires Authentication.
     * @param username User for which this API Call should be executed
     * @param device gPodder Device for which this API Call should be executed
     * @param add URLs of Podcasts that should be added to the Subscriptions of the User
     * @param remove URLs of Podcasts that should be removed from the Subscriptions of the User
     *
     */
    AddRemoveResultPtr addRemoveSubscriptions( const QString& username, const QString& device, const QList< QUrl >& add, const QList< QUrl >& remove );

    /**
     * Retrieve settings which are attached to an account.
     * @param username Username of the targeted account
     * @return Received settings as key-value-pairs
     *
     */
    SettingsPtr accountSettings( const QString& username );

    /**
     * Retrieve settings which are attached to a device.
     * @param username Username of the account which owns the device
     * @param device Name of the targeted device
     * @return Received settings as key-value-pairs
     *
     */
    SettingsPtr deviceSettings( const QString& username, const QString& device );

    /**
     * Retrieve settings which are attached to a podcast.
     * @param username Username of the account which owns the podcast
     * @param podcastUrl Url which identifies the targeted podcast
     * @return Received settings as key-value-pairs
     *
     */
    SettingsPtr podcastSettings( const QString& username, const QString& podcastUrl );

    /**
     * Retrieve settings which are attached to an episode.
     * @param username Username of the account which owns the episode
     * @param podcastUrl Url as String which identifies the podcast to which the episode belongs to
     * @param episodeUrl Url as String which identifies the targeted episode
     * @return Received settings as key-value-pairs
     *
     */
    SettingsPtr episodeSettings( const QString& username, const QString& podcastUrl, const QString& episodeUrl );

    /**
     * Set and or remove settings which are attached to an account.
     * @param username Username of the targeted account
     * @param set A set of settings as key-value-pairs which shall be set
     * @param set A set of exisiting settings as key-value-pairs which shall be removed
     * @return All settings as key-value-pairs which are stored after the update
     *
     */
    SettingsPtr setAccountSettings( const QString& username, QMap<QString, QVariant >& set, const QList<QString>& remove );

    /**
     * Set and or remove settings which are attached to a device.
     * @param username Username of the account which owns the device
     * @param device Name of the targeted device
     * @param set A set of settings as key-value-pairs which shall be set
     * @param set A set of exisiting settings as key-value-pairs which shall be removed
     * @return All settings as key-value-pairs which are stored after the update
     *
     */
    SettingsPtr setDeviceSettings( const QString& username, const QString& device, QMap<QString, QVariant >& set, const QList<QString>& remove );

    /**
     * Set and or remove settings which are attached to a podcast.
     * @param username Username of the account which owns the podcast
     * @param podcastUrl Url which identifies the targeted podcast
     * @param set A set of settings as key-value-pairs which shall be set
     * @param set A set of exisiting settings as key-value-pairs which shall be removed
     * @return All settings as key-value-pairs which are stored after the update
     *
     */
    SettingsPtr setPodcastSettings( const QString& username, const QString& podcastUrl, QMap<QString, QVariant >& set, const QList<QString>& remove );

    /**
     * Set and or remove settings which are attached to an episode.
     * @param username Username of the account which owns the episode
     * @param podcastUrl Url as String which identifies the podcast to which the episode belongs to
     * @param episodeUrl Url as String which identifies the targeted episode
     * @param set A set of settings as key-value-pairs which shall be set
     * @param set A set of exisiting settings as key-value-pairs which shall be removed
     * @return All settings as key-value-pairs which are stored after the update
     *
     */
    SettingsPtr setEpisodeSettings( const QString& username, const QString& podcastUrl, const QString& episodeUrl, QMap<QString, QVariant >& set, const QList<QString>& remove );

    /**
     * Retrieve episode and subscription updates for a given device.
     * @param username Username of the account which owns the device
     * @param deviceId Id of the targeted device
     * @param timestamp A date in milliseconds, All changes since this timestamp will be retrieved
     * @return A DeviceUpdatesPtr which accesses:
     *    - a list of subscriptions to be added, with URL, title and descriptions
     *    - a list of URLs to be unsubscribed
     *    - a list of updated episodes
     *
     */
    DeviceUpdatesPtr deviceUpdates( const QString& username, const QString& deviceId, qlonglong timestamp );

    /**
     * Sets a new name and type for a device identified by a given ID
     * @param username Username of the account which owns the device
     * @param deviceId The id of the targeted device
     * @param caption The new name of the device
     * @param type The new type of the device
     * @return A Pointer to a QNetworkReply which receives network signals
     *
     */
    QNetworkReply* renameDevice( const QString& username, const QString& deviceId, const QString& caption, Device::Type type );

    /**
     * Returns the list of devices that belong to a user.
     * @param username Username of the targeted user
     * @return List of devices
     *
     */
    DeviceListPtr listDevices( const QString& username );

    /**
     * Download episode actions for a given username.
     * @param Username of the targeted user
     * @param aggregated If aggregated is set to true, only the latest episode action will be returned
     * @return List of all episode actions of the user
     *
     */
    EpisodeActionListPtr episodeActions( const QString& username, const bool aggregated = false );

    /**
     * Download episode actions for a given podcast.
     * @param username Username of the account which owns the podcast
     * @param podcastUrl Url which identifies the targeted podcast
     * @param aggregated If aggregated is set to true, only the latest episode action will be returned
     * @return List of all episode actions for the given podcast
     *
     */
    EpisodeActionListPtr episodeActionsByPodcast( const QString& username, const QString& podcastUrl, const bool aggregated = false );

    /**
     * Download episode actions for a given device.
     * @param username Username of the account which owns the device
     * @param deviceId The Id of the targeted device
     * @param aggregated If aggregated is set to true, only the latest episode action will be returned
     * @return List of all episode actions for the given device
     *
     */
    EpisodeActionListPtr episodeActionsByDevice( const QString& username, const QString& deviceId, const bool aggregated = false );

    /**
     * Download episode actions for a given username since a given timestamp.
     * @param Username of the targeted user
     * @param since Timestamp in milliseconds, Episode Actions since this time will be retrieved
     * @return List of all new episode actions since the given timestamp
     *
     */
    EpisodeActionListPtr episodeActionsByTimestamp( const QString& username, const qulonglong since );

    /**
     * Download episode actions for a given podcast since a given timestamp.
     * @param username Username of the account which owns the podcast
     * @param podcastUrl Url which identifies the targeted podcast
     * @param since Timestamp in milliseconds, Episode Actions since this time will be retrieved
     * @return List of all new episode actions since the given timestamp
     *
     */
    EpisodeActionListPtr episodeActionsByPodcastAndTimestamp( const QString& username, const QString& podcastUrl, const qulonglong since );

    /**
     * Download episode actions for a given device since a given timestamp.
     * @param username Username of the account which owns the device
     * @param deviceId The Id of the targeted device
     * @param since Timestamp in milliseconds, Episode Actions since this time will be retrieved
     * @return List of all new episode actions since the given timestamp
     *
     */
    EpisodeActionListPtr episodeActionsByDeviceAndTimestamp( const QString& username, const QString& deviceId, const qulonglong since );

    /**
     * Upload episode actions
     * @param episodeActions The list of episode actions which shall be uploaded
     * @return An AddRemoveResultPtr which contains information about the updated Urls
     *
     */
    AddRemoveResultPtr uploadEpisodeActions( const QString& username, const QList<EpisodeActionPtr>& episodeActions );

    DeviceSyncResultPtr deviceSynchronizationStatus( const QString& username );

    DeviceSyncResultPtr setDeviceSynchronizationStatus( const QString& username, const QList<QStringList>& synchronize, const QList<QString>& stopSynchronize );

private:
    ApiRequestPrivate* const d;
};

}

#endif