Represents an API interface that manages configuration, requests, and parameters.
More...
|
| | Api (QObject *parent=nullptr) |
| | Constructs an Api object with an optional parent.
|
| |
| | ~Api () |
| |
| QString | name () const |
| | Returns the name of the API.
|
| |
| Q_SLOT void | setName (const QString &name) |
| | Sets the name of the API.
|
| |
| Q_SIGNAL void | nameChanged (const QString &name) |
| |
| QVersionNumber | version () const |
| | Returns the version of the API.
|
| |
| Q_SLOT void | setVersion (const QVersionNumber &version) |
| | Sets the version of the API.
|
| |
| Q_SIGNAL void | versionChanged () |
| |
| QUrl | url () const override |
| | Returns the URL of the API.
|
| |
| Q_SLOT void | setUrl (const QUrl &url) |
| | Sets the URL of the API.
|
| |
| Q_SIGNAL void | urlChanged (const QUrl &url) |
| | Emitted when the API URL changes.
|
| |
| QLocale | locale () const override |
| | Returns the api locale.
|
| |
| Q_SLOT void | setLocale (const QLocale &locale) |
| |
| Q_SIGNAL void | localeChanged (const QLocale &locale) |
| |
| QString | bearerToken () const |
| |
| Q_SLOT void | setBearerToken (const QString &token) |
| |
| Q_SIGNAL void | bearerTokenChanged (const QString &token) |
| |
| QString | userAgent () const override |
| | Returns the user agent for the API.
|
| |
| Q_SLOT void | setUserAgent (const QString &agent) |
| | Sets the user agent for the API.
|
| |
| Q_SIGNAL void | userAgentChanged (const QString &agent) |
| | Emitted when the user agent changes.
|
| |
| Q_SLOT void | configure (const QUrl &url) |
| | Configures the API with the given URL.
|
| |
| bool | configure (const QJsonObject &config) |
| | Configures the API with the given JSON configuration.
|
| |
| Q_SIGNAL void | configurationCompleted () |
| | Emitted when the API configuration is completed.
|
| |
| Q_SIGNAL void | configurationFailed () |
| | Emitted when the API configuration fails.
|
| |
| Response * | send (AbstractRequestHandler::Method method, const Request &request, const Body &body) override |
| |
| virtual | ~ApiBase () |
| | Destructor for ApiBase.
|
| |
| void | head (const Request &request, const ApiRunCallback &callback) |
| | Makes a HEAD request and calls the provided callback upon completion.
|
| |
| Response * | head (const Request &request) |
| | Makes a HEAD request and returns the Response object.
|
| |
| void | get (const Request &request, const ApiRunCallback &callback) |
| | Makes a GET request and calls the provided callback upon completion.
|
| |
| Response * | get (const Request &request) |
| | Makes a GET request and returns the Response object.
|
| |
| void | post (const Request &request, const Body &body, const ApiRunCallback &callback) |
| | Makes a POST request with a body and calls the provided callback upon completion.
|
| |
| Response * | post (const Request &request, const Body &body) |
| | Makes a POST request with a body and returns the Response object.
|
| |
| void | put (const Request &request, const Body &body, const ApiRunCallback &callback) |
| | Makes a PUT request with a body and calls the provided callback upon completion.
|
| |
| Response * | put (const Request &request, const Body &body) |
| | Makes a PUT request with a body and returns the Response object.
|
| |
| void | patch (const Request &request, const Body &body, const ApiRunCallback &callback) |
| | Makes a PATCH request with a body and calls the provided callback upon completion.
|
| |
| Response * | patch (const Request &request, const Body &body) |
| | Makes a PATCH request with a body and returns the Response object.
|
| |
| void | deleteResource (const Request &request, const ApiRunCallback &callback) |
| | Makes a DELETE request and calls the provided callback upon completion.
|
| |
| Response * | deleteResource (const Request &request) |
| | Makes a DELETE request and returns the Response object.
|
| |
| NetworkManager * | networkManager () const |
| | Returns the network manager used by the ApiBase class.
|
| |
| void | setNetworkManager (NetworkManager *manager) |
| | Sets the network manager for the ApiBase class.
|
| |
| bool | hasPathParameter (const QString &name) const |
| | Checks if a path parameter exists in the request.
|
| |
| PathParameter | pathParameter (const QString &name) const |
| | Retrieves a specific path parameter.
|
| |
| QVariant | pathParameterValue (const QString &name) const |
| | Retrieves the value of a path parameter.
|
| |
| QStringList | pathParameterNames () const |
| | Retrieves the names of all path parameters.
|
| |
| void | setPathParameter (const QString &name, const QVariant &value) |
| | Sets the value of a path parameter.
|
| |
| void | setPathParameter (const PathParameter ¶meter) |
| | Sets a path parameter using a PathParameter object.
|
| |
| void | unsetPathParameter (const QString &name) |
| | Unsets (removes) a path parameter from the request.
|
| |
| QList< PathParameter > | pathParameters () const |
| | Retrieves all path parameters.
|
| |
| void | setPathParameters (const QList< PathParameter > ¶meters) |
| | Sets all path parameters.
|
| |
| bool | hasQueryParameter (const QString &name) const |
| | Checks if a query parameter exists in the request.
|
| |
| QueryParameter | queryParameter (const QString &name) const |
| | Retrieves a specific query parameter.
|
| |
| QList< QVariant > | queryParameterValues (const QString &name) const |
| | Retrieves the values of a query parameter.
|
| |
| QStringList | queryParameterNames () const |
| | Retrieves the names of all query parameters.
|
| |
| void | addQueryParameter (const QString &name, const QVariant &value) |
| | Add the value of a query parameter.
|
| |
| void | addQueryParameter (const QueryParameter ¶m) |
| | Add query parameter using a QueryParameter object.
|
| |
| void | removeQueryParameter (const QString &name) |
| | Removes a query parameter from the request.
|
| |
| void | removeQueryParameter (const QString &name, const QVariant &value) |
| | Removes a query parameter from the request.
|
| |
| QList< QueryParameter > | queryParameters () const |
| | Retrieves all query parameters.
|
| |
| void | setQueryParameters (const QList< QueryParameter > ¶meters) |
| | Sets all query parameters.
|
| |
| bool | hasHeader (const QString &name) const |
| | Checks if a header exists in the request.
|
| |
| Header | header (const QString &name) const |
| | Retrieves a specific header.
|
| |
| QList< QVariant > | headerValues (const QString &name) const |
| | Retrieves the values of a header.
|
| |
| QStringList | headerNames () const |
| | Retrieves the names of all headers.
|
| |
| void | setHeader (const QString &name, const QVariant &value) |
| | Sets the value of a header.
|
| |
| void | setHeader (const Header &header) |
| | Sets a header using a Header object.
|
| |
| void | unsetHeader (const QString &name) |
| | Unsets (removes) a header from the request.
|
| |
| QList< Header > | headers () const |
| | Retrieves all headers.
|
| |
| void | setHeaders (const QList< Header > &headers) |
| | Sets all headers.
|
| |
Represents an API interface that manages configuration, requests, and parameters.
The Api class is responsible for creating network requests and managing response data. It supports adding parameters to requests, configuring the API from different sources, and emitting signals for configuration changes and network error events.