|
RestLink 2.2.0
Powerfull Rest Client for Qt
|
Represents a response to an API request in the RestLink framework. More...
#include <response.h>
Inherits RestLink::ResponseBase.
Inherited by RestLink::NetworkResponse, and RestLink::ServerResponse.
Public Slots | |
| virtual void | ignoreSslErrors () |
| virtual void | abort ()=0 |
Signals | |
| void | downloadProgress (qint64 bytesReceived, qint64 bytesTotal) |
| void | uploadProgress (qint64 bytesSent, qint64 bytesTotal) |
| void | networkErrorOccured (int error) |
| void | finished () |
| void | sslErrorsOccured (const QList< QSslError > &errors) |
Public Member Functions | |
| virtual | ~Response () |
| Destructor for Response. | |
| QString | endpoint () const |
| Retrieves the API endpoint associated with this response. | |
| Request | request () const |
| Retrieves the API request associated with this response. | |
| virtual AbstractRequestHandler::Method | method () const =0 |
| Api * | api () const |
| Retrieves the API instance associated with this response. | |
| QUrl | url () const |
| Retrieves the URL associated with this response. | |
| virtual QNetworkRequest | networkRequest () const =0 |
| Retrieves the network request used in this response. | |
| bool | isRunning () const |
| Checks if the request is currently running. | |
| virtual bool | isFinished () const =0 |
| Checks if the request has finished processing. | |
| bool | isSuccess () const |
| Checks if the request was successful. | |
| bool | isHttpStatusSuccess () const |
| Checks if the HTTP status code indicates success. | |
| bool | hasHttpStatusCode () const |
| Checks if the HTTP status code is valid. | |
| virtual int | httpStatusCode () const =0 |
| virtual QString | httpReasonPhrase () const |
| virtual bool | hasHeader (const QByteArray &name) const |
| Checks if the response contains a specific header. | |
| virtual Q_INVOKABLE QByteArray | header (const QByteArray &name) const =0 |
| Retrieves the value of a specific header. | |
| virtual QByteArrayList | headerList () const =0 |
| bool | hasNetworkError () const |
| virtual int | networkError () const |
| Retrieves the network error code. | |
| virtual QString | networkErrorString () const |
| Retrieves a string description of the network error. | |
| virtual QNetworkReply * | networkReply () const =0 |
Public Member Functions inherited from RestLink::ResponseBase | |
| ResponseBase (QObject *parent=nullptr) | |
| virtual | ~ResponseBase () |
| bool | isSequential () const override |
| bool | open (OpenMode mode) override |
| void | close () override |
| qint64 | pos () const override |
| qint64 | size () const override |
| bool | seek (qint64 pos) override |
| bool | atEnd () const override |
| bool | reset () override |
| qint64 | bytesAvailable () const override |
| qint64 | bytesToWrite () const override |
| bool | canReadLine () const override |
| bool | waitForReadyRead (int msecs) override |
| bool | waitForBytesWritten (int msecs) override |
| virtual QJsonObject | readJsonObject (QJsonParseError *error=nullptr) |
| Reads the response body as a JSON object. | |
| virtual QJsonArray | readJsonArray (QJsonParseError *error=nullptr) |
| Reads the response body as a JSON array. | |
| virtual QJsonValue | readJson (QJsonParseError *error=nullptr) |
| Reads the response body as a JSON value. | |
| virtual QString | readString () |
| Reads the response body as a QString. | |
| virtual QByteArray | readBody () |
| Reads the raw response body as a QByteArray. | |
| QIODevice * | responseDevice () const |
Protected Member Functions | |
| Response (ResponsePrivate *d, QObject *parent) | |
| void | setRequest (const Request &request) |
| QByteArray | body () |
Protected Member Functions inherited from RestLink::ResponseBase | |
| qint64 | readData (char *data, qint64 maxlen) override |
| qint64 | readLineData (char *data, qint64 maxlen) override |
| qint64 | skipData (qint64 maxSize) override |
| qint64 | writeData (const char *data, qint64 len) override |
| void | setResponseDevice (QIODevice *device) |
Protected Attributes | |
| QScopedPointer< ResponsePrivate > | d_ptr |
Properties | |
| QString | endpoint |
| int | method |
| Retrieves the HTTP method type for this response. | |
| QUrl | url |
| bool | running |
| bool | finished |
| bool | success |
| bool | hasHttpStatusCode |
| int | httpStatusCode |
| Retrieves the HTTP status code of the response. | |
| QString | httpReasonPhrase |
| Retrieves the HTTP reason phrase of the response. | |
| QByteArrayList | headerList |
| Retrieves a list of all headers in the response. | |
| bool | hasNetworkError |
| Checks if a network error occurred during the request. | |
| int | networkError |
| QString | networkErrorString |
| QByteArray | body |
Represents a response to an API request in the RestLink framework.
The Response class encapsulates the response from an API request, providing methods for accessing various aspects of the response such as status, headers, body, and progress. It also provides signals for progress updates, completion, and error handling.
The Response object is associated with a specific API request and provides functionality to handle download/upload progress, SSL errors, network errors, and HTTP status codes. It also supports reading the response body as JSON or raw data and provides the option to abort or ignore specific errors during the process.
|
virtual |
|
protected |
| QString RestLink::Response::endpoint | ( | ) | const |
Retrieves the API endpoint associated with this response.
| Request RestLink::Response::request | ( | ) | const |
Retrieves the API request associated with this response.
|
pure virtual |
Implemented in RestLink::NetworkResponse, and RestLink::ServerResponse.
| Api * RestLink::Response::api | ( | ) | const |
Retrieves the API instance associated with this response.
| QUrl RestLink::Response::url | ( | ) | const |
Retrieves the URL associated with this response.
|
pure virtual |
Retrieves the network request used in this response.
Implemented in RestLink::NetworkResponse, and RestLink::ServerResponse.
|
inline |
Checks if the request is currently running.
true if the request is running, otherwise false.
|
pure virtual |
Checks if the request has finished processing.
true if the request is finished, otherwise false. Implemented in RestLink::NetworkResponse, and RestLink::ServerResponse.
|
inline |
Checks if the request was successful.
true if the request was successful, otherwise false. | bool RestLink::Response::isHttpStatusSuccess | ( | ) | const |
Checks if the HTTP status code indicates success.
true if the HTTP status code indicates success, otherwise false. | bool RestLink::Response::hasHttpStatusCode | ( | ) | const |
Checks if the HTTP status code is valid.
true if the HTTP status code is valid, otherwise false.
|
pure virtual |
Implemented in RestLink::NetworkResponse, and RestLink::ServerResponse.
|
virtual |
Reimplemented in RestLink::NetworkResponse.
|
virtual |
Checks if the response contains a specific header.
| name | The name of the header to check. |
true if the header is present, otherwise false. Reimplemented in RestLink::NetworkResponse, and RestLink::ServerResponse.
|
pure virtual |
Retrieves the value of a specific header.
| header | The name of the header to retrieve. |
Implemented in RestLink::NetworkResponse, and RestLink::ServerResponse.
|
pure virtual |
Implemented in RestLink::NetworkResponse, and RestLink::ServerResponse.
|
inline |
|
virtual |
Retrieves the network error code.
Reimplemented in RestLink::NetworkResponse.
|
virtual |
Retrieves a string description of the network error.
Reimplemented in RestLink::NetworkResponse.
|
pure virtual |
Implemented in RestLink::NetworkResponse, and RestLink::ServerResponse.
|
protected |
|
protected |
|
virtualslot |
|
pure virtualslot |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
protected |
|
read |
|
read |
Retrieves the HTTP method type for this response.
|
read |
|
read |
|
read |
|
read |
|
read |
|
read |
Retrieves the HTTP status code of the response.
|
read |
Retrieves the HTTP reason phrase of the response.
|
read |
Retrieves a list of all headers in the response.
|
read |
Checks if a network error occurred during the request.
true if a network error occurred, otherwise false.
|
read |
|
read |
|
read |