Terarea  2
The automation project
Loading...
Searching...
No Matches
src.lib.boilerplates.responses.BoilerplateResponses Class Reference
Collaboration diagram for src.lib.boilerplates.responses.BoilerplateResponses:
Collaboration graph

Public Member Functions

None __init__ (self, RuntimeData runtime_data, bool debug=False)
 
Dict[str, Any] build_response_body (self, str title, str message, Any resp, Union[str, None] token, bool error=False)
 
Response invalid_token (self, str title)
 
Response no_access_token (self, str title, Union[str, None] token=None)
 
Response provider_not_found (self, str title, Union[str, None] token=None)
 
Response provider_not_given (self, str title, Union[str, None] token=None)
 
Response not_logged_in (self, str title)
 
Response login_failed (self, str title)
 
Response insuffisant_rights (self, str title, Union[str, None] token=None)
 
Response bad_request (self, str title, Union[str, None] token=None)
 
Response internal_server_error (self, str title, Union[str, None] token=None)
 
Response unauthorized (self, str title, Union[str, None] token=None)
 
Response invalid_verification_code (self, str title, Union[str, None] token=None)
 
Response user_not_found (self, str title, Union[str, None] token=None)
 
Response missing_variable_in_body (self, str title, Union[str, None] token=None)
 

Data Fields

bool debug = debug
 
RuntimeData runtime_data_initialised = runtime_data
 
Disp disp
 

Detailed Description

_summary_

Definition at line 10 of file responses.py.

Constructor & Destructor Documentation

◆ __init__()

None src.lib.boilerplates.responses.BoilerplateResponses.__init__ ( self,
RuntimeData runtime_data,
bool debug = False )
_summary_

Args:
    debug (bool, optional): _description_. Defaults to False.

Definition at line 14 of file responses.py.

Member Function Documentation

◆ bad_request()

Response src.lib.boilerplates.responses.BoilerplateResponses.bad_request ( self,
str title,
Union[str, None] token = None )
_summary_
    This is a function that will return a bad request response.

Args:
    title (str): _description_: The title of the called endpoint
    token (Union[str, None], optional): _description_. Defaults to None.: The token provided by the user of the called endpoint

Returns:
    Response: _description_: The response ready to be sent back to the user

Definition at line 199 of file responses.py.

◆ build_response_body()

Dict[str, Any] src.lib.boilerplates.responses.BoilerplateResponses.build_response_body ( self,
str title,
str message,
Any resp,
Union[str, None] token,
bool error = False )
_summary_
    This is a function that will create a response body for the queries of the server.
Args:
    title (str): _description_: The title of the message in the body
    message (any): _description_: The actual message you wish to send (this is so that it is human friendly [i.e. "You have successfully logged in"])
    resp (any): _description_: The section where you can put more coder side data.
    token Union[str, None]: _description_: The user token or None if not present
    error (bool, optional): _description_: If this is an error message or not. Defaults to False.

Returns:
    Dict[str, any]: _description_: the final version of the body message

Definition at line 31 of file responses.py.

◆ insuffisant_rights()

Response src.lib.boilerplates.responses.BoilerplateResponses.insuffisant_rights ( self,
str title,
Union[str, None] token = None )
_summary_
    This is a function that will return an insuffisant rights response.

Args:
    title (str): _description_: The title of the called endpoint
    token (Union[str, None], optional): _description_. Defaults to None.:  The token provided by the user of the called endpoint

Returns:
    Response: _description_: The response ready to be sent back to the user

Definition at line 179 of file responses.py.

◆ internal_server_error()

Response src.lib.boilerplates.responses.BoilerplateResponses.internal_server_error ( self,
str title,
Union[str, None] token = None )
_summary_
    This is a function that will return an internal server error response.

Args:
    title (str): _description_: The title of the called endpoint
    token (Union[str, None], optional): _description_. Defaults to None.: The token provided by the user of the called endpoint

Returns:
    Response: _description_: The response ready to be sent back to the user

Definition at line 219 of file responses.py.

◆ invalid_token()

Response src.lib.boilerplates.responses.BoilerplateResponses.invalid_token ( self,
str title )
_summary_
    This is a function that will return an invalid token response.

Args:
    title (str): _description_: The title of the called endpoint

Returns:
    Response: _description_: The response ready to be sent back to the user

Definition at line 62 of file responses.py.

◆ invalid_verification_code()

Response src.lib.boilerplates.responses.BoilerplateResponses.invalid_verification_code ( self,
str title,
Union[str, None] token = None )
_summary_
    This is a function that will return an invalid verification code response.

Args:
    title (str): _description_: The title of the called endpoint
    token (Union[str, None], optional): _description_. Defaults to None.: The token provided by the user of the called endpoint

Returns:
    Response: _description_: The response ready to be sent back to the user

Definition at line 259 of file responses.py.

◆ login_failed()

Response src.lib.boilerplates.responses.BoilerplateResponses.login_failed ( self,
str title )
_summary_
    This is a function that will return a failed login response.

Args:
    title (str): _description_: The title of the called endpoint

Returns:
    Response: _description_: The response ready to be sent back to the user

Definition at line 160 of file responses.py.

◆ missing_variable_in_body()

Response src.lib.boilerplates.responses.BoilerplateResponses.missing_variable_in_body ( self,
str title,
Union[str, None] token = None )
_summary_
    Function that will return a message saying that there is a missing variable in the provided body.

Args:
    title (str): _description_: The name of the endpoint
    token (Union[str, None], optional): _description_. Defaults to None.: The token of the account.

Returns:
    Response: _description_: The pre-compiled response (ready to go)

Definition at line 299 of file responses.py.

◆ no_access_token()

Response src.lib.boilerplates.responses.BoilerplateResponses.no_access_token ( self,
str title,
Union[str, None] token = None )
_summary_
    This is a function that will return a no access token response.

Args:
    title (str): _description_: The name of the endpoint that is concerned
    token (str): _description_: The token corresponding to the user being logged in

Returns:
    Response: _description_: A pre-made http response ready to go.

Definition at line 81 of file responses.py.

◆ not_logged_in()

Response src.lib.boilerplates.responses.BoilerplateResponses.not_logged_in ( self,
str title )
_summary_
    This is a function that will return a not logged in response.

Args:
    title (str): _description_: The title of the called endpoint

Returns:
    Response: _description_: The response ready to be sent back to the user

Definition at line 141 of file responses.py.

◆ provider_not_found()

Response src.lib.boilerplates.responses.BoilerplateResponses.provider_not_found ( self,
str title,
Union[str, None] token = None )
_summary_
    This is a function that will return a provider not found response.

Args:
    title (str): _description_: The title of the called endpoint
    token (Union[str, None], optional): _description_. Defaults to None.: The token provided by the user of the called endpoint

Returns:
    Response: _description_: The response ready to be sent back to the user

Definition at line 101 of file responses.py.

◆ provider_not_given()

Response src.lib.boilerplates.responses.BoilerplateResponses.provider_not_given ( self,
str title,
Union[str, None] token = None )
_summary_
    This is a function that will return a provider not found response.

Args:
    title (str): _description_: The title of the called endpoint
    token (Union[str, None], optional): _description_. Defaults to None.: The token provided by the user of the called endpoint

Returns:
    Response: _description_: The response ready to be sent back to the user

Definition at line 121 of file responses.py.

◆ unauthorized()

Response src.lib.boilerplates.responses.BoilerplateResponses.unauthorized ( self,
str title,
Union[str, None] token = None )
_summary_
    This is a function that will return an unauthorized response.

Args:
    title (str): _description_: The title of the called endpoint
    token (Union[str, None], optional): _description_. Defaults to None.: The token provided by the user of the called endpoint

Returns:
    Response: _description_: The response ready to be sent back to the user

Definition at line 239 of file responses.py.

◆ user_not_found()

Response src.lib.boilerplates.responses.BoilerplateResponses.user_not_found ( self,
str title,
Union[str, None] token = None )
_summary_
    Function that will return a user not found error.

Args:
    title (str): _description_: The title of the endpoint
    token (Union[str, None], optional): _description_. Defaults to None.: The token if present.

Returns:
    Response: _description_: The pre-compiled response (ready to go)

Definition at line 279 of file responses.py.

Field Documentation

◆ debug

bool src.lib.boilerplates.responses.BoilerplateResponses.debug = debug

Definition at line 20 of file responses.py.

◆ disp

Disp src.lib.boilerplates.responses.BoilerplateResponses.disp
Initial value:
= Disp(
TOML_CONF,
SAVE_TO_FILE,
FILE_NAME,
FILE_DESCRIPTOR,
debug=self.debug,
logger=self.__class__.__name__
)

Definition at line 22 of file responses.py.

◆ runtime_data_initialised

RuntimeData src.lib.boilerplates.responses.BoilerplateResponses.runtime_data_initialised = runtime_data

Definition at line 21 of file responses.py.


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