RestLink 2.2.0
Powerfull Rest Client for Qt
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
RestLink::RequestInterface Class Referenceabstract

A class for storing and managing some HTTP request informations (url path and query parameter along with headers). More...

#include <requestinterface.h>

Inherited by RestLink::ApiBase, and RestLink::Request.

Public Member Functions

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 &parameter)
 Sets a path parameter using a PathParameter object.
 
void unsetPathParameter (const QString &name)
 Unsets (removes) a path parameter from the request.
 
QList< PathParameterpathParameters () const
 Retrieves all path parameters.
 
void setPathParameters (const QList< PathParameter > &parameters)
 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 &param)
 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< QueryParameterqueryParameters () const
 Retrieves all query parameters.
 
void setQueryParameters (const QList< QueryParameter > &parameters)
 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< Headerheaders () const
 Retrieves all headers.
 
void setHeaders (const QList< Header > &headers)
 Sets all headers.
 

Protected Member Functions

virtual const QList< PathParameter > * constPathParameters () const =0
 
virtual QList< PathParameter > * mutablePathParameters ()=0
 
virtual const QList< QueryParameter > * constQueryParameters () const =0
 
virtual QList< QueryParameter > * mutableQueryParameters ()=0
 
virtual const QList< Header > * constHeaders () const =0
 
virtual QList< Header > * mutableHeaders ()=0
 

Detailed Description

A class for storing and managing some HTTP request informations (url path and query parameter along with headers).

Member Function Documentation

◆ hasPathParameter()

bool RestLink::RequestInterface::hasPathParameter ( const QString &  name) const

Checks if a path parameter exists in the request.

This function checks whether a path parameter with the given name exists.

Parameters
nameThe name of the path parameter.
Returns
true If the path parameter exists.
false If the path parameter does not exist.

◆ pathParameter()

PathParameter RestLink::RequestInterface::pathParameter ( const QString &  name) const

Retrieves a specific path parameter.

This function retrieves the path parameter for the given name. If the parameter is not found, it returns a default-constructed PathParameter.

Parameters
nameThe name of the path parameter.
Returns
The path parameter corresponding to the given name.

◆ pathParameterValue()

QVariant RestLink::RequestInterface::pathParameterValue ( const QString &  name) const

Retrieves the value of a path parameter.

This function returns the value associated with the given path parameter name. If the parameter is not found, an empty QVariant is returned.

Parameters
nameThe name of the path parameter.
Returns
The value of the path parameter, or an empty QVariant if not found.

◆ pathParameterNames()

QStringList RestLink::RequestInterface::pathParameterNames ( ) const

Retrieves the names of all path parameters.

This function returns a list of names of all the path parameters in the request.

Returns
A list of names of path parameters.

◆ setPathParameter() [1/2]

void RestLink::RequestInterface::setPathParameter ( const QString &  name,
const QVariant &  value 
)

Sets the value of a path parameter.

This function sets or updates the value of a path parameter in the request. If the parameter does not exist, it is added.

Parameters
nameThe name of the path parameter.
valueThe new value to set for the path parameter.

◆ setPathParameter() [2/2]

void RestLink::RequestInterface::setPathParameter ( const PathParameter parameter)

Sets a path parameter using a PathParameter object.

This function sets or updates a path parameter using a PathParameter object.

Parameters
parameterThe PathParameter object containing the name and value.

◆ unsetPathParameter()

void RestLink::RequestInterface::unsetPathParameter ( const QString &  name)

Unsets (removes) a path parameter from the request.

This function removes the path parameter with the given name from the request.

Parameters
nameThe name of the path parameter to remove.

◆ pathParameters()

QList< PathParameter > RestLink::RequestInterface::pathParameters ( ) const

Retrieves all path parameters.

This function returns a list of all path parameters in the request.

Returns
A list of all path parameters.

◆ setPathParameters()

void RestLink::RequestInterface::setPathParameters ( const QList< PathParameter > &  parameters)

Sets all path parameters.

This function sets the list of path parameters to the provided list of parameters.

Parameters
parametersA list of path parameters to set.

◆ hasQueryParameter()

bool RestLink::RequestInterface::hasQueryParameter ( const QString &  name) const

Checks if a query parameter exists in the request.

This function checks whether a query parameter with the given name exists.

Parameters
nameThe name of the query parameter.
Returns
true If the query parameter exists.
false If the query parameter does not exist.

◆ queryParameter()

QueryParameter RestLink::RequestInterface::queryParameter ( const QString &  name) const

Retrieves a specific query parameter.

This function retrieves the query parameter for the given name. If the parameter is not found, it returns a default-constructed QueryParameter.

Parameters
nameThe name of the query parameter.
Returns
The query parameter corresponding to the given name.

◆ queryParameterValues()

QList< QVariant > RestLink::RequestInterface::queryParameterValues ( const QString &  name) const

Retrieves the values of a query parameter.

This function returns a list of values associated with the given query parameter name. If the parameter is not found, an empty list is returned.

Parameters
nameThe name of the query parameter.
Returns
A list of values of the query parameter, or an empty list if not found.

◆ queryParameterNames()

QStringList RestLink::RequestInterface::queryParameterNames ( ) const

Retrieves the names of all query parameters.

This function returns a list of names of all the query parameters in the request.

Returns
A list of names of query parameters.

◆ addQueryParameter() [1/2]

void RestLink::RequestInterface::addQueryParameter ( const QString &  name,
const QVariant &  value 
)

Add the value of a query parameter.

This function sets or updates the value of a query parameter in the request. If the parameter does not exist, it is added.

Parameters
nameThe name of the query parameter.
valueThe new value to set for the query parameter.

◆ addQueryParameter() [2/2]

void RestLink::RequestInterface::addQueryParameter ( const QueryParameter param)

Add query parameter using a QueryParameter object.

This function sets or updates a query parameter using a QueryParameter object.

Parameters
paramThe QueryParameter object containing the name and value.

◆ removeQueryParameter() [1/2]

void RestLink::RequestInterface::removeQueryParameter ( const QString &  name)

Removes a query parameter from the request.

This function removes the query parameter with the given name from the request.

Parameters
nameThe name of the query parameter to remove.

◆ removeQueryParameter() [2/2]

void RestLink::RequestInterface::removeQueryParameter ( const QString &  name,
const QVariant &  value 
)

Removes a query parameter from the request.

This function removes the value on the query parameter if it exists.

Parameters
nameThe name of the query parameter to remove.

◆ queryParameters()

QList< QueryParameter > RestLink::RequestInterface::queryParameters ( ) const

Retrieves all query parameters.

This function returns a list of all query parameters in the request.

Returns
A list of all query parameters.

◆ setQueryParameters()

void RestLink::RequestInterface::setQueryParameters ( const QList< QueryParameter > &  parameters)

Sets all query parameters.

This function sets the list of query parameters to the provided list of parameters.

Parameters
parametersA list of query parameters to set.

◆ hasHeader()

bool RestLink::RequestInterface::hasHeader ( const QString &  name) const

Checks if a header exists in the request.

This function checks whether a header with the given name exists.

Parameters
nameThe name of the header.
Returns
true If the header exists.
false If the header does not exist.

◆ header()

Header RestLink::RequestInterface::header ( const QString &  name) const

Retrieves a specific header.

This function retrieves the header for the given name. If the header is not found, it returns a default-constructed Header.

Parameters
nameThe name of the header.
Returns
The header corresponding to the given name.

◆ headerValues()

QList< QVariant > RestLink::RequestInterface::headerValues ( const QString &  name) const

Retrieves the values of a header.

This function returns a list of values associated with the given header name. If the header is not found, an empty list is returned.

Parameters
nameThe name of the header.
Returns
A list of values of the header, or an empty list if not found.

◆ headerNames()

QStringList RestLink::RequestInterface::headerNames ( ) const

Retrieves the names of all headers.

This function returns a list of names of all the headers in the request.

Returns
A list of names of headers.

◆ setHeader() [1/2]

void RestLink::RequestInterface::setHeader ( const QString &  name,
const QVariant &  value 
)

Sets the value of a header.

This function sets or updates the value of a header in the request. If the header does not exist, it is added.

Parameters
nameThe name of the header.
valueThe new value to set for the header.

◆ setHeader() [2/2]

void RestLink::RequestInterface::setHeader ( const Header header)

Sets a header using a Header object.

This function sets or updates a header using a Header object.

Parameters
headerThe Header object containing the name and value.

◆ unsetHeader()

void RestLink::RequestInterface::unsetHeader ( const QString &  name)

Unsets (removes) a header from the request.

This function removes the header with the given name from the request.

Parameters
nameThe name of the header to remove.

◆ headers()

QList< Header > RestLink::RequestInterface::headers ( ) const

Retrieves all headers.

This function returns a list of all headers in the request.

Returns
A list of all headers.

◆ setHeaders()

void RestLink::RequestInterface::setHeaders ( const QList< Header > &  headers)

Sets all headers.

This function sets the list of headers to the provided list of headers.

Parameters
headersA list of headers to set.

◆ constPathParameters()

virtual const QList< PathParameter > * RestLink::RequestInterface::constPathParameters ( ) const
protectedpure virtual

◆ mutablePathParameters()

virtual QList< PathParameter > * RestLink::RequestInterface::mutablePathParameters ( )
protectedpure virtual

◆ constQueryParameters()

virtual const QList< QueryParameter > * RestLink::RequestInterface::constQueryParameters ( ) const
protectedpure virtual

◆ mutableQueryParameters()

virtual QList< QueryParameter > * RestLink::RequestInterface::mutableQueryParameters ( )
protectedpure virtual

◆ constHeaders()

virtual const QList< Header > * RestLink::RequestInterface::constHeaders ( ) const
protectedpure virtual

◆ mutableHeaders()

virtual QList< Header > * RestLink::RequestInterface::mutableHeaders ( )
protectedpure virtual