Attica

metadata.h
1/*
2 This file is part of KDE.
3
4 SPDX-FileCopyrightText: 2009 Frederik Gladhorn <gladhorn@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#ifndef ATTICA_METADATA_H
10#define ATTICA_METADATA_H
11
12#include <QString>
13
14#include <QNetworkReply>
15#include <QSharedDataPointer>
16
17#include "attica_export.h"
18
19namespace Attica
20{
21class BaseJob;
22
23/**
24 * @class Metadata metadata.h <Attica/Metadata>
25 *
26 * Status messages from the server
27 */
28class ATTICA_EXPORT Metadata
29{
30public:
31 Metadata();
32 Metadata(const Metadata &other);
33 ~Metadata();
34 Metadata &operator=(const Metadata &other);
35
36 enum Error {
37 NoError = 0,
38 NetworkError,
39 OcsError,
40 };
41
42 /**
43 * Check if the job was successful.
44 * @return the error state enum returns the type of error (network or ocs)
45 */
46 Error error() const;
47 void setError(Error error);
48
49 /**
50 * The status as integer.
51 * If the error is an OCS error, refer to http://www.freedesktop.org/wiki/Specifications/open-collaboration-services
52 * in any other case it is the network return code.
53 */
54 int statusCode() const;
55 void setStatusCode(int code);
56
57 /**
58 * The status of the job, for example "Ok"
59 */
60 QString statusString() const;
61 void setStatusString(const QString &status);
62
63 /// An optional additional message from the server
64 QString message();
65 void setMessage(const QString &message);
66
67 /// The number of items returned by this job (only relevant for list jobs)
68 int totalItems();
69 void setTotalItems(int items);
70
71 /// The number of items per page the server was asked for
72 int itemsPerPage();
73 void setItemsPerPage(int itemsPerPage);
74
75 /// The resulting ID when a PostJob created a new item.
76 QString resultingId();
77 void setResultingId(const QString &id);
78
79 /**
80 * The http headers for the most recent network action in the case of a network error
81 * Use this to further inspect the error condition if the OCS status code and string is
82 * not enough to work out precisely what has happened (for example in case of a HTTP
83 * 503 status, which would suggest the service is down for maintenance for an expected
84 * duration which might be read from the Retry-After header).
85 * @return The list of raw headers (equivalent to a QNetworkReply::rawHeaderPairs call)
86 * @since 5.83
87 */
89 /**
90 * Sets the http headers read by headers()
91 * @param headers The new list of raw headers
92 * @since 5.83
93 */
94 void setHeaders(const QList<QNetworkReply::RawHeaderPair> &headers);
95
96private:
97 class Private;
99
100 friend class Attica::BaseJob;
101};
102
103}
104
105#endif
The baseclass for all job classes.
Status messages from the server.
Definition metadata.h:29
Q_SCRIPTABLE CaptureState status()
The Attica namespace,.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:48 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.