/// <summary> /// Gets an Endpoint Setting. This is a configuration for Web API RESTful Endpoints /// including their routes, descriptions, and authorization requirements /// /// Get is called during every endpoint hit. The reason the entire Model is sent for this Get /// instead of just an ID is because; when you check your DB to get the settings, and it doesn't /// exist, you should add it for the first time. If you add it for the first time, return "true" for /// isNewSetting. Otherwise, return the existing DB setting, and ensure IsNewSetting is set to "false"; /// </summary> public async Task <Maybe <EndpointSettingModel> > GetEndpointSetting(EndpointSettingModel setting) { if (setting.TimeoutMS == 0) { setting.TimeoutMS = 10000; // <-- If TimeoutMS is 0, your endpoint will always return Timeout } // In Localhost (::1), Timeout is forced in the framework to 60000 for debugging purposes. setting.IsNewSetting = true; // <-- Forces the framework to always look up the endpoint details and use "Initial" settings return(setting.ToMaybe()); // <-- Currently returning what was passed to me, slightly altered. Instead, return what you get from your Database }
/// <summary> /// Adds an Endpoint Setting. This is a configuration for Web API RESTful Endpoints /// including their routes, descriptions, and authorization requirements. /// This is called automatically when a newly found endpoint is hit for the first time. /// </summary> public async Task <Maybe> AddEndpointSettingAsync(EndpointSettingModel setting) => Maybe.Success();
/// <summary> /// When an GetEndpointSetting(...) is hit, and if a setting is returned with IsNewSetting == true, /// Then the setting is fleshed out with a whole bunch of additional initial settings. /// In that case, this method is called as a follow-up with all the additional Initial details. /// </summary> public async Task <Maybe> UpdateEndpointSetting(EndpointSettingModel fromSetting, EndpointSettingModel toSetting) => Maybe.Success();