KDAV

davjobbase.h
1/*
2 SPDX-FileCopyrightText: 2014 Gregory Oestreicher <greg@kamago.net>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KDAV_DAVJOBBASE_H
8#define KDAV_DAVJOBBASE_H
9
10#include "kdav_export.h"
11
12#include <KJob>
13
14#include <memory>
15
16namespace KDAV
17{
18class DavJobBasePrivate;
19class Error;
20
21/**
22 * @class DavJobBase davjobbase.h <KDAV/DavJobBase>
23 *
24 * @short base class for the jobs used by the resource.
25 */
26class KDAV_EXPORT DavJobBase : public KJob
27{
28 Q_OBJECT
29
30public:
31 explicit DavJobBase(QObject *parent = nullptr);
32 ~DavJobBase() override;
33
34 /**
35 * Get the latest response code.
36 *
37 * If no response code has been set then 0 will be returned, but will
38 * be meaningless unless error() is non-zero. In that case this means
39 * that the latest error was not at the HTTP level.
40 */
41 Q_REQUIRED_RESULT int latestResponseCode() const;
42
43 /**
44 * Check if the job can be retried later.
45 *
46 * This will return true for transient errors, i.e. if the response code
47 * is either zero and error() is set or if the HTTP response code hints
48 * at a temporary error.
49 *
50 * The HTTP response codes considered retryable are:
51 * - 401
52 * - 402
53 * - 407
54 * - 408
55 * - 423
56 * - 429
57 * - 501 to 504, inclusive
58 * - 507
59 * - 511
60 */
61 Q_REQUIRED_RESULT bool canRetryLater() const;
62
63 /**
64 * Check if the job failed because of a conflict
65 */
66 Q_REQUIRED_RESULT bool hasConflict() const;
67
68 /**
69 * Returns a instance of the KDAV:Error to be able to translate the error
70 */
71 Q_REQUIRED_RESULT Error davError() const;
72
73protected:
74 Q_DECL_HIDDEN explicit DavJobBase(DavJobBasePrivate *dd, QObject *parent = nullptr);
75 std::unique_ptr<DavJobBasePrivate> d_ptr;
76
77private:
78 Q_DECLARE_PRIVATE(DavJobBase)
79};
80}
81
82#endif
base class for the jobs used by the resource.
Definition davjobbase.h:27
DAV operation error.
Definition daverror.h:47
The KDAV namespace.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 12 2024 11:54:45 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.