EHS
Loading...
Searching...
No Matches
ehs::Request Class Reference

#include <Request.h>

Public Member Functions

 Request ()
 Default member initialization.
 
 Request (const Verb verb, const Str_8 &rsrc)
 
 Request (const char *data, const UInt_64 size)
 
 Request (const Str_8 &data)
 
 Request (const Request &req)=default
 
Requestoperator= (const Request &req)
 
Verb GetVerb () const
 
void SetContentType (const ContentType cType)
 
ContentType GetContentType () const
 
void SetResource (const Str_8 &rsrc)
 
Str_8 GetResource () const
 
void AddQuery (const Str_8 &var, const Str_8 &value)
 
Str_8 GetQuery (const Str_8 &var)
 
Vector< Str_8GetQueries () const
 
void BasicAuth (const Str_8 &id, const Str_8 &secret)
 
void BearerAuth (const Str_8 &token)
 
void BearerAuth (const Str_8 &token, const Str_8 &clientId)
 
void BotAuth (const Str_8 &token)
 
void AddToHeader (const Str_8 &var, const Str_8 &value)
 
Str_8 GetHeader (const Str_8 &var) const
 
Vector< Str_8GetHeader () const
 
void AddToBody (const Str_8 &var, const Str_8 &value)
 
void AddToBody (const Str_8 &data)
 
void SetBody (const Str_8 &body)
 
Str_8 GetVar (const Str_8 &var) const
 
Str_8 GetBody () const
 
Json GetJson () const
 
Str_8 FormResult () const
 
bool IsValid () const
 

Constructor & Destructor Documentation

◆ Request() [1/5]

ehs::Request::Request ( )

Default member initialization.

◆ Request() [2/5]

ehs::Request::Request ( const Verb verb,
const Str_8 & rsrc )

Initializes this request with a given verb and URI resource.

Parameters
[in]verbThe type of request to make.
[in]rsrcThe URI endpoint to make the request at.

◆ Request() [3/5]

ehs::Request::Request ( const char * data,
const UInt_64 size )

Initializes this request with the raw request data.

Parameters
[in]dataThe C-style string of the request.
[in]sizeThe size of the given C-style string.

◆ Request() [4/5]

ehs::Request::Request ( const Str_8 & data)

Initializes this request with the raw request data.

Parameters
[in]dataThe string of the request.

◆ Request() [5/5]

ehs::Request::Request ( const Request & req)
default

Copies members from another object of the same type.

Parameters
[in]reqThe object to copy from.

Member Function Documentation

◆ AddQuery()

void ehs::Request::AddQuery ( const Str_8 & var,
const Str_8 & value )

Adds a query variable to the URI.

Parameters
[in]varThe variable identifier.
[in]valueThe value of the variable.

◆ AddToBody() [1/2]

void ehs::Request::AddToBody ( const Str_8 & data)

Adds a value to the body.

Parameters
[in]dataThe value to add.

◆ AddToBody() [2/2]

void ehs::Request::AddToBody ( const Str_8 & var,
const Str_8 & value )

Adds a body variable.

Parameters
[in]varThe variable identifier.
[in]valueThe value of the variable.

◆ AddToHeader()

void ehs::Request::AddToHeader ( const Str_8 & var,
const Str_8 & value )

Adds a header variable.

Parameters
[in]varThe variable identifier.
[in]valueThe value of the variable.

◆ BasicAuth()

void ehs::Request::BasicAuth ( const Str_8 & id,
const Str_8 & secret )

A helper method to automatically add the required header variables for basic authentication.

Parameters
[in]idThe username or id.
[in]secretThe secret given by an API.

◆ BearerAuth() [1/2]

void ehs::Request::BearerAuth ( const Str_8 & token)

A helper method to automatically add the required header variables for bearer authentication.

Parameters
[in]tokenThe token given by an API.

◆ BearerAuth() [2/2]

void ehs::Request::BearerAuth ( const Str_8 & token,
const Str_8 & clientId )

A helper method to automatically add the required header variables for bearer authentication.

Parameters
[in]tokenThe token given by an API.
[in]clientIdThe client id given by an API.

◆ BotAuth()

void ehs::Request::BotAuth ( const Str_8 & token)

A helper method to automatically add the required header variables for bot authentication.

Parameters
[in]tokenThe token given by an API.

◆ FormResult()

Str_8 ehs::Request::FormResult ( ) const

Forms the raw result of the request to be sent.

Returns
The result.

◆ GetBody()

Str_8 ehs::Request::GetBody ( ) const

Retrieves the entire body.

Returns
The result.

◆ GetContentType()

ContentType ehs::Request::GetContentType ( ) const

Retrieves the content type for the body.

Returns
The result.

◆ GetHeader() [1/2]

Vector< Str_8 > ehs::Request::GetHeader ( ) const

Retrieves all the header variables in a vector object.

Returns
The result.

◆ GetHeader() [2/2]

Str_8 ehs::Request::GetHeader ( const Str_8 & var) const

Retrieves a header variable.

Parameters
[in]varThe variable identifier to look for.
Returns
The value of the header variable. Empty if it was not found.

◆ GetJson()

Json ehs::Request::GetJson ( ) const

Retrieves the entire body as a Json.

Returns
The result.

◆ GetQueries()

Vector< Str_8 > ehs::Request::GetQueries ( ) const

Retrieves all the query variables from the URI in a vector object.

Returns
The result.

◆ GetQuery()

Str_8 ehs::Request::GetQuery ( const Str_8 & var)

Retrieves a query variable from the URI.

Parameters
[in]varThe variable identifier to look for.
Returns
The value of the query variable. Empty if it was not found.

◆ GetResource()

Str_8 ehs::Request::GetResource ( ) const

Retrieves the URI resource.

Returns
The result.

◆ GetVar()

Str_8 ehs::Request::GetVar ( const Str_8 & var) const

Retrieves a body variable.

Parameters
[in]varThe variable identifier to look for.
Returns
The value of the body variable. Empty if it was not found.

◆ GetVerb()

Verb ehs::Request::GetVerb ( ) const

Retrieves the verb for the request.

Returns
The result.

◆ IsValid()

bool ehs::Request::IsValid ( ) const

◆ operator=()

Request & ehs::Request::operator= ( const Request & req)

Copies members from another object of the same type.

Parameters
[in]reqThe object to copy from.
Returns
The request that has been assigned to.

◆ SetBody()

void ehs::Request::SetBody ( const Str_8 & body)

Sets the entire body.

Parameters
[in]bodyThe body to use.

◆ SetContentType()

void ehs::Request::SetContentType ( const ContentType cType)

Sets the content type for the body.

Parameters
[in]cTypeThe content type to use.

◆ SetResource()

void ehs::Request::SetResource ( const Str_8 & rsrc)

Sets the URI resource.

Parameters
[in]rsrcThe resource.

The documentation for this class was generated from the following files: