|
Terarea
2
The automation project
|

Public Member Functions | |
| None | __init__ (self, RuntimeData runtime_data_initialised, int success=0, int error=84, bool debug=False) |
| str | pause (self) |
| datetime | set_lifespan (self, int seconds) |
| bool | is_token_correct (self, str token) |
| str | generate_token (self) |
| None | server_show_item_content (self, str function_name="show_item_content", str item_name="", object item=None, bool show=True) |
| bool | check_date (self, str date="DD/MM/YYYY") |
| None | check_database_health (self) |
| bool | is_token_admin (self, str token) |
| str | generate_check_token (self, int token_size=4) |
| Union[str, Response] | get_user_id_from_token (self, str title, str token) |
| Union[int, Response] | update_user_data (self, str title, str usr_id, List[str] line_content) |
| Union[int, Dict[str, int]] | remove_user_from_tables (self, str where, List[str] tables) |
| int | update_single_data (self, str table, str column_finder, str column_to_update, str data_finder, dict request_body) |
| List[Dict[str, Any]] | get_actions (self, str service_id) |
| List[Dict[str, Any]] | get_reactions (self, str service_id) |
| List[Dict[str, Any]] | get_services (self) |
| str | hide_api_key (self, str api_key) |
Data Fields | |
| bool | debug = debug |
| int | error = error |
| int | success = success |
| RuntimeData | runtime_data_initialised = runtime_data_initialised |
| Disp | disp |
_summary_
Definition at line 19 of file non_web.py.
| None src.lib.boilerplates.non_web.BoilerplateNonHTTP.__init__ | ( | self, | |
| RuntimeData | runtime_data_initialised, | ||
| int | success = 0, | ||
| int | error = 84, | ||
| bool | debug = False ) |
_summary_
Definition at line 23 of file non_web.py.
| None src.lib.boilerplates.non_web.BoilerplateNonHTTP.check_database_health | ( | self | ) |
_summary_
This function will reconnect to the database in case it has been disconnected.
Definition at line 180 of file non_web.py.
| bool src.lib.boilerplates.non_web.BoilerplateNonHTTP.check_date | ( | self, | |
| str | date = "DD/MM/YYYY" ) |
_summary_
This is a function that will check if the date is correct or not.
Args:
date (str, optional): _description_: The date to check. Defaults to "DD/MM/YYYY".
Returns:
bool: _description_: True if the date is correct, False otherwise
Definition at line 165 of file non_web.py.
| str src.lib.boilerplates.non_web.BoilerplateNonHTTP.generate_check_token | ( | self, | |
| int | token_size = 4 ) |
_summary_
Create a token that can be used for e-mail verification.
Returns:
str: _description_
Definition at line 261 of file non_web.py.
| str src.lib.boilerplates.non_web.BoilerplateNonHTTP.generate_token | ( | self | ) |
_summary_
This is a function that will generate a token for the user.
Returns:
str: _description_: The token generated
Definition at line 111 of file non_web.py.
| List[Dict[str, Any]] src.lib.boilerplates.non_web.BoilerplateNonHTTP.get_actions | ( | self, | |
| str | service_id ) |
_summary_
Get the actions that are available for the service
Args:
service_id (str): _description_
Returns:
List[Dict[str, Any]]: _description_
Definition at line 395 of file non_web.py.
| List[Dict[str, Any]] src.lib.boilerplates.non_web.BoilerplateNonHTTP.get_reactions | ( | self, | |
| str | service_id ) |
_summary_
Get the reactions that are available for the service
Args:
service_id (str): _description_
Returns:
List[Dict[str, Any]]: _description_
Definition at line 452 of file non_web.py.
| List[Dict[str, Any]] src.lib.boilerplates.non_web.BoilerplateNonHTTP.get_services | ( | self | ) |
_summary_
Get the services that are available.
Returns:
List[Dict[str, Any]]: _description_
Definition at line 509 of file non_web.py.
| Union[str, Response] src.lib.boilerplates.non_web.BoilerplateNonHTTP.get_user_id_from_token | ( | self, | |
| str | title, | ||
| str | token ) |
_summary_
The function in charge of getting the user id based of the provided content.
Args:
title (str): _description_: The title of the endpoint calling it
token (str): _description_: The token of the user account
Returns:
Union[str, Response]: _description_: Returns as string id if success, otherwise, a pre-made response for the endpoint.
Definition at line 277 of file non_web.py.
| str src.lib.boilerplates.non_web.BoilerplateNonHTTP.hide_api_key | ( | self, | |
| str | api_key ) |
_summary_
Hide the api key from the user.
Args:
api_key (str): _description_: The api key to hide
Returns:
str: _description_: The hidden api key
Definition at line 540 of file non_web.py.
| bool src.lib.boilerplates.non_web.BoilerplateNonHTTP.is_token_admin | ( | self, | |
| str | token ) |
_summary_
Check if the user's token has admin privileges.
Args:
token (str): _description_
Returns:
bool: _description_
Definition at line 225 of file non_web.py.
| bool src.lib.boilerplates.non_web.BoilerplateNonHTTP.is_token_correct | ( | self, | |
| str | token ) |
_summary_
Check if the token is correct.
Args:
token (str): _description_: The token to check
Returns:
bool: _description_: True if the token is correct, False otherwise
Definition at line 63 of file non_web.py.
| str src.lib.boilerplates.non_web.BoilerplateNonHTTP.pause | ( | self | ) |
_summary_
This is a pause function that works in the same wat as the batch pause command.
It pauses the program execution until the user presses the enter key.
Returns:
str: _description_: The input from the user
Definition at line 40 of file non_web.py.
| Union[int, Dict[str, int]] src.lib.boilerplates.non_web.BoilerplateNonHTTP.remove_user_from_tables | ( | self, | |
| str | where, | ||
| List[str] | tables ) |
_summary_
Remove the user from the provided tables.
Args:
where (str): _description_: The id of the user to remove
tables (List[str]): _description_: The tables to remove the user from
Returns:
int: _description_: The status of the operation
Definition at line 345 of file non_web.py.
| None src.lib.boilerplates.non_web.BoilerplateNonHTTP.server_show_item_content | ( | self, | |
| str | function_name = "show_item_content", | ||
| str | item_name = "", | ||
| object | item = None, | ||
| bool | show = True ) |
_summary_
This is a function that will display the content of an item.
The purpose of this function is more for debugging purposes.
Args:
function_name (str, optional): _description_. Defaults to "show_item_content".
item (object, optional): _description_. Defaults to None.
Definition at line 141 of file non_web.py.
| datetime src.lib.boilerplates.non_web.BoilerplateNonHTTP.set_lifespan | ( | self, | |
| int | seconds ) |
The function to set the lifespan of the user token
Args:
seconds (int): Seconds
Returns:
datetime: The datetime of the lifespan of the token
Definition at line 50 of file non_web.py.
| int src.lib.boilerplates.non_web.BoilerplateNonHTTP.update_single_data | ( | self, | |
| str | table, | ||
| str | column_finder, | ||
| str | column_to_update, | ||
| str | data_finder, | ||
| dict | request_body ) |
The function in charge of updating the data in the database
Definition at line 382 of file non_web.py.
| Union[int, Response] src.lib.boilerplates.non_web.BoilerplateNonHTTP.update_user_data | ( | self, | |
| str | title, | ||
| str | usr_id, | ||
| List[str] | line_content ) |
_summary_
Update the account information based on the provided line.
Args:
title (str): _description_: This is the title of the endpoint
usr_id (str): _description_: This is the id of the user that needs to be updated
line_content (List[str]): _description_: The content of the line to be edited.
Returns:
Union[int, Response]: _description_
Definition at line 317 of file non_web.py.
| bool src.lib.boilerplates.non_web.BoilerplateNonHTTP.debug = debug |
Definition at line 26 of file non_web.py.
| Disp src.lib.boilerplates.non_web.BoilerplateNonHTTP.disp |
Definition at line 31 of file non_web.py.
| int src.lib.boilerplates.non_web.BoilerplateNonHTTP.error = error |
Definition at line 27 of file non_web.py.
| RuntimeData src.lib.boilerplates.non_web.BoilerplateNonHTTP.runtime_data_initialised = runtime_data_initialised |
Definition at line 29 of file non_web.py.
| int src.lib.boilerplates.non_web.BoilerplateNonHTTP.success = success |
Definition at line 28 of file non_web.py.