Changeset View
Changeset View
Standalone View
Standalone View
src/core/job.h
Show All 34 Lines | |||||
35 | namespace KGAPI2 { | 35 | namespace KGAPI2 { | ||
36 | 36 | | |||
37 | /** | 37 | /** | ||
38 | * @headerfile job.h | 38 | * @headerfile job.h | ||
39 | * @brief Abstract base class for all jobs in LibKGAPI | 39 | * @brief Abstract base class for all jobs in LibKGAPI | ||
40 | * | 40 | * | ||
41 | * Usual workflow of Job subclasses is to reimplement Job::start, | 41 | * Usual workflow of Job subclasses is to reimplement Job::start, | ||
42 | * Job::dispatchRequest and Job::handleReply, then enqueue a QNetworkRequest using | 42 | * Job::dispatchRequest and Job::handleReply, then enqueue a QNetworkRequest using | ||
43 | * Job::enqueueRequest. The request will automatically be scheduled in a queue | 43 | * Job::enqueueRequest. Authorization headers and standard query parameters will be | ||
44 | * and dispatched by calling Job::dispatchRequest implementation. When a reply | 44 | * set by Job class. The request will automatically be scheduled in a queue and | ||
45 | * is received, the Job will automatically perform error handling and if there | 45 | * dispatched by calling Job::dispatchRequest implementation. When a reply is received, | ||
46 | * is no error, the reply is passed to implementation of Job::handleReply. | 46 | * the Job will automatically perform error handling and if there is no error, the | ||
47 | * reply is passed to implementation of Job::handleReply. | ||||
47 | * | 48 | * | ||
48 | * Job is automatically when program enters an event loop. | 49 | * Job is automatically started when program enters an event loop. | ||
49 | * | 50 | * | ||
50 | * @author Daniel Vrátil <dvratil@redhat.com> | 51 | * @author Daniel Vrátil <dvratil@redhat.com> | ||
51 | * @since 2.0 | 52 | * @since 2.0 | ||
52 | */ | 53 | */ | ||
53 | class KGAPICORE_EXPORT Job : public QObject | 54 | class KGAPICORE_EXPORT Job : public QObject | ||
54 | { | 55 | { | ||
55 | Q_OBJECT | 56 | Q_OBJECT | ||
56 | 57 | | |||
▲ Show 20 Lines • Show All 251 Lines • ▼ Show 20 Line(s) | 233 | /** | |||
308 | */ | 309 | */ | ||
309 | virtual void handleReply(const QNetworkReply *reply, const QByteArray &rawData) = 0; | 310 | virtual void handleReply(const QNetworkReply *reply, const QByteArray &rawData) = 0; | ||
310 | 311 | | |||
311 | /** | 312 | /** | ||
312 | * @brief Enqueues @p request in dispatcher queue | 313 | * @brief Enqueues @p request in dispatcher queue | ||
313 | * | 314 | * | ||
314 | * Subclasses should call this method to enqueue the @p request in main job | 315 | * Subclasses should call this method to enqueue the @p request in main job | ||
315 | * queue. The request is automatically dispatched, and reply is handled. | 316 | * queue. The request is automatically dispatched, and reply is handled. | ||
317 | * Authorization headers and standars query parameters will be applied. | ||||
316 | * | 318 | * | ||
317 | * @param request Request to enqueue | 319 | * @param request Request to enqueue | ||
318 | * @param data Data to be send in body of the request | 320 | * @param data Data to be send in body of the request | ||
319 | * @param contentType Content type of @p data | 321 | * @param contentType Content type of @p data | ||
320 | */ | 322 | */ | ||
321 | virtual void enqueueRequest(const QNetworkRequest &request, const QByteArray &data = QByteArray(), | 323 | virtual void enqueueRequest(const QNetworkRequest &request, const QByteArray &data = QByteArray(), | ||
322 | const QString &contentType = QString()); | 324 | const QString &contentType = QString()); | ||
323 | 325 | | |||
Show All 11 Lines |