Public Types | Public Member Functions | Protected Member Functions | List of all members
NAF::Functions::Function Class Reference
Inheritance diagram for NAF::Functions::Function:
Inheritance graph
[legend]
Collaboration diagram for NAF::Functions::Function:
Collaboration graph
[legend]

Public Types

enum class  ResponseType { kJSON , kFile , kCustom }
 
using Ptr = std::shared_ptr< Functions::Function >
 
- Public Types inherited from NAF::HTTP::Request
using HTTPServerRequestPtr = std::optional< HTTPServerRequest * >
 
using HTTPServerResponsePtr = std::optional< HTTPServerResponse * >
 

Public Member Functions

 Function (std::string endpoint, HTTP::EnumMethods method, ResponseType response_type=ResponseType::kJSON)
 
std::string get_endpoint () const
 
std::string get_target () const
 
bool get_error () const
 
std::string get_error_message () const
 
bool get_remove_file_on_modify () const
 
ResponseType get_response_type () const
 
HTTP::EnumMethods get_method () const
 
Security::Userget_current_user ()
 
std::vector< Action::Ptr > & get_actions ()
 
HTTP::Methodsget_methods ()
 
Files::FileManager::Ptr & get_file_manager ()
 
void set_endpoint (std::string endpoint)
 
void set_target (std::string target)
 
void set_remove_file_on_modify (bool remove_file_on_modify)
 
void set_method (HTTP::EnumMethods type)
 
void set_response_type (ResponseType response_type)
 
Action::Ptr AddAction_ (std::string identifier)
 
void Process_ (HTTP::Request::HTTPServerRequestPtr request, HTTP::Request::HTTPServerResponsePtr response)
 
bool ProcessAction_ (Action::Ptr action)
 
bool ProcessJSON_ (JSON::Object::Ptr &json_result)
 
bool ProcessFile_ (std::string &filepath)
 
void DownloadProcess_ (std::string &filepath)
 
void UploadProcess_ ()
 
void ModifyProcess_ (std::string &filepath)
 
void RemoveProcess_ (std::string &filepath)
 
void SetupCustomProcess_ (std::function< void(Function &)> custom_process)
 
- Public Member Functions inherited from NAF::HTTP::CommonResponses
std::map< HTTP::Status, Attributes > & get_responses_ ()
 
void CompoundResponse_ (HTTP::Status status, JSON::Object::Ptr result_json)
 
void CompoundFillResponse_ (HTTP::Status status, JSON::Object::Ptr result_json, std::string message)
 
void JSONResponse_ (HTTP::Status status, std::string message)
 
void HTMLResponse_ (HTTP::Status status, std::string message)
 
void CustomHTMLResponse_ (HTTP::Status status, std::string html_message)
 
void FileResponse_ (HTTP::Status status, std::string address)
 
- Public Member Functions inherited from NAF::HTTP::Request
HTTPServerRequestPtr & get_http_server_request ()
 
HTTPServerResponsePtr & get_http_server_response ()
 
std::vector< HTTP::Headerget_headers ()
 
std::vector< HTTP::Cookieget_cookies ()
 
void AddHeader_ (std::string name, std::string value)
 
void AddCookie_ (std::string name, std::string value)
 

Protected Member Functions

void Setup_ (HTTP::Request::HTTPServerRequestPtr request, HTTP::Request::HTTPServerResponsePtr response)
 
- Protected Member Functions inherited from NAF::HTTP::CommonResponses
void FillResponses_ ()
 
void FillStatusMessage_ (JSON::Object::Ptr json_object, HTTP::Status status, std::string message)
 
- Protected Member Functions inherited from NAF::HTTP::Request
void SetupRequest_ (Net::HTTPServerRequest &request)
 
void SetupResponse_ (Net::HTTPServerResponse &response)
 
void SetupHeaders_ ()
 
void SetupCookies_ ()